2 * Copyright 2022 Advanced Micro Devices, Inc.
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
24 #include "smuio_v13_0_3.h"
25 #include "soc15_common.h"
26 #include "smuio/smuio_13_0_3_offset.h"
27 #include "smuio/smuio_13_0_3_sh_mask.h"
29 #define PKG_TYPE_MASK 0x00000003L
32 * smuio_v13_0_3_get_die_id - query die id from FCH.
34 * @adev: amdgpu device pointer
38 static u32 smuio_v13_0_3_get_die_id(struct amdgpu_device *adev)
42 data = RREG32_SOC15(SMUIO, 0, regSMUIO_MCM_CONFIG);
43 die_id = REG_GET_FIELD(data, SMUIO_MCM_CONFIG, DIE_ID);
49 * smuio_v13_0_3_get_socket_id - query socket id from FCH
51 * @adev: amdgpu device pointer
55 static u32 smuio_v13_0_3_get_socket_id(struct amdgpu_device *adev)
59 data = RREG32_SOC15(SMUIO, 0, regSMUIO_MCM_CONFIG);
60 socket_id = REG_GET_FIELD(data, SMUIO_MCM_CONFIG, SOCKET_ID);
66 * smuio_v13_0_3_get_pkg_type - query package type set by MP1/bootcode
68 * @adev: amdgpu device pointer
70 * Returns package type
73 static enum amdgpu_pkg_type smuio_v13_0_3_get_pkg_type(struct amdgpu_device *adev)
75 enum amdgpu_pkg_type pkg_type;
78 data = RREG32_SOC15(SMUIO, 0, regSMUIO_MCM_CONFIG);
79 data = REG_GET_FIELD(data, SMUIO_MCM_CONFIG, PKG_TYPE);
82 * bit 1 == 1 APU form factor
84 * b0100 - b1111 - Reserved
86 switch (data & PKG_TYPE_MASK) {
88 pkg_type = AMDGPU_PKG_TYPE_CEM;
91 pkg_type = AMDGPU_PKG_TYPE_OAM;
94 pkg_type = AMDGPU_PKG_TYPE_APU;
97 pkg_type = AMDGPU_PKG_TYPE_UNKNOWN;
105 const struct amdgpu_smuio_funcs smuio_v13_0_3_funcs = {
106 .get_die_id = smuio_v13_0_3_get_die_id,
107 .get_socket_id = smuio_v13_0_3_get_socket_id,
108 .get_pkg_type = smuio_v13_0_3_get_pkg_type,