13636169cSJiange Zhao /* 23636169cSJiange Zhao * Copyright 2014 Advanced Micro Devices, Inc. 33636169cSJiange Zhao * 43636169cSJiange Zhao * Permission is hereby granted, free of charge, to any person obtaining a 53636169cSJiange Zhao * copy of this software and associated documentation files (the "Software"), 63636169cSJiange Zhao * to deal in the Software without restriction, including without limitation 73636169cSJiange Zhao * the rights to use, copy, modify, merge, publish, distribute, sublicense, 83636169cSJiange Zhao * and/or sell copies of the Software, and to permit persons to whom the 93636169cSJiange Zhao * Software is furnished to do so, subject to the following conditions: 103636169cSJiange Zhao * 113636169cSJiange Zhao * The above copyright notice and this permission notice shall be included in 123636169cSJiange Zhao * all copies or substantial portions of the Software. 133636169cSJiange Zhao * 143636169cSJiange Zhao * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 153636169cSJiange Zhao * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 163636169cSJiange Zhao * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 173636169cSJiange Zhao * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 183636169cSJiange Zhao * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 193636169cSJiange Zhao * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 203636169cSJiange Zhao * OTHER DEALINGS IN THE SOFTWARE. 213636169cSJiange Zhao * 223636169cSJiange Zhao */ 233636169cSJiange Zhao 243636169cSJiange Zhao #ifndef __MXGPU_NV_H__ 253636169cSJiange Zhao #define __MXGPU_NV_H__ 263636169cSJiange Zhao 273636169cSJiange Zhao #define NV_MAILBOX_POLL_ACK_TIMEDOUT 500 28ef6c2cb3SVictor Zhao #define NV_MAILBOX_POLL_MSG_TIMEDOUT 15000 29cbda2758SVignesh Chander #define NV_MAILBOX_POLL_FLR_TIMEDOUT 10000 303aa883acSJiange Zhao #define NV_MAILBOX_POLL_MSG_REP_MAX 11 313636169cSJiange Zhao 324d130238SMonk Liu enum idh_request { 334d130238SMonk Liu IDH_REQ_GPU_INIT_ACCESS = 1, 344d130238SMonk Liu IDH_REL_GPU_INIT_ACCESS, 354d130238SMonk Liu IDH_REQ_GPU_FINI_ACCESS, 364d130238SMonk Liu IDH_REL_GPU_FINI_ACCESS, 374d130238SMonk Liu IDH_REQ_GPU_RESET_ACCESS, 38c27cbdd2SMonk Liu IDH_REQ_GPU_INIT_DATA, 394d130238SMonk Liu 404d130238SMonk Liu IDH_LOG_VF_ERROR = 200, 413e183e2fSJiange Zhao IDH_READY_TO_RESET = 201, 42ae844dd7STao Zhou IDH_RAS_POISON = 202, 4360c58d72SVictor Skvortsov IDH_REQ_RAS_ERROR_COUNT = 203, 44*d4c60219STony Yi IDH_REQ_RAS_CPER_DUMP = 204, 454d130238SMonk Liu }; 464d130238SMonk Liu 474d130238SMonk Liu enum idh_event { 484d130238SMonk Liu IDH_CLR_MSG_BUF = 0, 494d130238SMonk Liu IDH_READY_TO_ACCESS_GPU, 504d130238SMonk Liu IDH_FLR_NOTIFICATION, 514d130238SMonk Liu IDH_FLR_NOTIFICATION_CMPL, 524d130238SMonk Liu IDH_SUCCESS, 534d130238SMonk Liu IDH_FAIL, 544d130238SMonk Liu IDH_QUERY_ALIVE, 55c27cbdd2SMonk Liu IDH_REQ_GPU_INIT_DATA_READY, 562474414cSVictor Skvortsov IDH_RAS_POISON_READY, 57cbda2758SVignesh Chander IDH_PF_SOFT_FLR_NOTIFICATION, 58cbda2758SVignesh Chander IDH_RAS_ERROR_DETECTED, 5960c58d72SVictor Skvortsov IDH_RAS_ERROR_COUNT_READY = 11, 60*d4c60219STony Yi IDH_RAS_CPER_DUMP_READY = 14, 6160c58d72SVictor Skvortsov 624d130238SMonk Liu IDH_TEXT_MESSAGE = 255, 634d130238SMonk Liu }; 644d130238SMonk Liu 653636169cSJiange Zhao extern const struct amdgpu_virt_ops xgpu_nv_virt_ops; 663636169cSJiange Zhao 673636169cSJiange Zhao void xgpu_nv_mailbox_set_irq_funcs(struct amdgpu_device *adev); 683636169cSJiange Zhao int xgpu_nv_mailbox_add_irq_id(struct amdgpu_device *adev); 693636169cSJiange Zhao int xgpu_nv_mailbox_get_irq(struct amdgpu_device *adev); 703636169cSJiange Zhao void xgpu_nv_mailbox_put_irq(struct amdgpu_device *adev); 713636169cSJiange Zhao 72ff1f03a7SMonk Liu #define mmMAILBOX_CONTROL 0xE5E 73ff1f03a7SMonk Liu 74ff1f03a7SMonk Liu #define NV_MAIBOX_CONTROL_TRN_OFFSET_BYTE (mmMAILBOX_CONTROL * 4) 75ff1f03a7SMonk Liu #define NV_MAIBOX_CONTROL_RCV_OFFSET_BYTE (NV_MAIBOX_CONTROL_TRN_OFFSET_BYTE + 1) 76ff1f03a7SMonk Liu 77ff1f03a7SMonk Liu #define mmMAILBOX_MSGBUF_TRN_DW0 0xE56 78ff1f03a7SMonk Liu #define mmMAILBOX_MSGBUF_TRN_DW1 0xE57 79ff1f03a7SMonk Liu #define mmMAILBOX_MSGBUF_TRN_DW2 0xE58 80ff1f03a7SMonk Liu #define mmMAILBOX_MSGBUF_TRN_DW3 0xE59 81ff1f03a7SMonk Liu 82ff1f03a7SMonk Liu #define mmMAILBOX_MSGBUF_RCV_DW0 0xE5A 83ff1f03a7SMonk Liu #define mmMAILBOX_MSGBUF_RCV_DW1 0xE5B 84ff1f03a7SMonk Liu #define mmMAILBOX_MSGBUF_RCV_DW2 0xE5C 85ff1f03a7SMonk Liu #define mmMAILBOX_MSGBUF_RCV_DW3 0xE5D 86ff1f03a7SMonk Liu 87ff1f03a7SMonk Liu #define mmMAILBOX_INT_CNTL 0xE5F 883636169cSJiange Zhao 893636169cSJiange Zhao #endif 90