1*fec70a86SHawking Zhang /*
2*fec70a86SHawking Zhang * Copyright (C) 2023 Advanced Micro Devices, Inc.
3*fec70a86SHawking Zhang *
4*fec70a86SHawking Zhang * Permission is hereby granted, free of charge, to any person obtaining a
5*fec70a86SHawking Zhang * copy of this software and associated documentation files (the "Software"),
6*fec70a86SHawking Zhang * to deal in the Software without restriction, including without limitation
7*fec70a86SHawking Zhang * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8*fec70a86SHawking Zhang * and/or sell copies of the Software, and to permit persons to whom the
9*fec70a86SHawking Zhang * Software is furnished to do so, subject to the following conditions:
10*fec70a86SHawking Zhang *
11*fec70a86SHawking Zhang * The above copyright notice and this permission notice shall be included
12*fec70a86SHawking Zhang * in all copies or substantial portions of the Software.
13*fec70a86SHawking Zhang *
14*fec70a86SHawking Zhang * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15*fec70a86SHawking Zhang * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16*fec70a86SHawking Zhang * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17*fec70a86SHawking Zhang * THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
18*fec70a86SHawking Zhang * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19*fec70a86SHawking Zhang * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20*fec70a86SHawking Zhang */
21*fec70a86SHawking Zhang #include "amdgpu.h"
22*fec70a86SHawking Zhang #include "amdgpu_ras.h"
23*fec70a86SHawking Zhang
amdgpu_mmhub_ras_sw_init(struct amdgpu_device * adev)24*fec70a86SHawking Zhang int amdgpu_mmhub_ras_sw_init(struct amdgpu_device *adev)
25*fec70a86SHawking Zhang {
26*fec70a86SHawking Zhang int err;
27*fec70a86SHawking Zhang struct amdgpu_mmhub_ras *ras;
28*fec70a86SHawking Zhang
29*fec70a86SHawking Zhang if (!adev->mmhub.ras)
30*fec70a86SHawking Zhang return 0;
31*fec70a86SHawking Zhang
32*fec70a86SHawking Zhang ras = adev->mmhub.ras;
33*fec70a86SHawking Zhang err = amdgpu_ras_register_ras_block(adev, &ras->ras_block);
34*fec70a86SHawking Zhang if (err) {
35*fec70a86SHawking Zhang dev_err(adev->dev, "Failed to register mmhub ras block!\n");
36*fec70a86SHawking Zhang return err;
37*fec70a86SHawking Zhang }
38*fec70a86SHawking Zhang
39*fec70a86SHawking Zhang strcpy(ras->ras_block.ras_comm.name, "mmhub");
40*fec70a86SHawking Zhang ras->ras_block.ras_comm.block = AMDGPU_RAS_BLOCK__MMHUB;
41*fec70a86SHawking Zhang ras->ras_block.ras_comm.type = AMDGPU_RAS_ERROR__MULTI_UNCORRECTABLE;
42*fec70a86SHawking Zhang adev->mmhub.ras_if = &ras->ras_block.ras_comm;
43*fec70a86SHawking Zhang
44*fec70a86SHawking Zhang /* mmhub ras follows amdgpu_ras_block_late_init_default for late init */
45*fec70a86SHawking Zhang return 0;
46*fec70a86SHawking Zhang }
47