xref: /linux/arch/x86/include/asm/amd_node.h (revision b9d8a295ed6bc3cee846f8e3f27c9c6e9ebe43f2)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * AMD Node helper functions and common defines
4  *
5  * Copyright (c) 2024, Advanced Micro Devices, Inc.
6  * All Rights Reserved.
7  *
8  * Author: Yazen Ghannam <Yazen.Ghannam@amd.com>
9  *
10  * Note:
11  * Items in this file may only be used in a single place.
12  * However, it's prudent to keep all AMD Node functionality
13  * in a unified place rather than spreading throughout the
14  * kernel.
15  */
16 
17 #ifndef _ASM_X86_AMD_NODE_H_
18 #define _ASM_X86_AMD_NODE_H_
19 
20 #include <linux/pci.h>
21 
22 #define MAX_AMD_NUM_NODES	8
23 #define AMD_NODE0_PCI_SLOT	0x18
24 
25 struct pci_dev *amd_node_get_func(u16 node, u8 func);
26 struct pci_dev *amd_node_get_root(u16 node);
27 
28 static inline u16 amd_num_nodes(void)
29 {
30 	return topology_amd_nodes_per_pkg() * topology_max_packages();
31 }
32 
33 int __must_check amd_smn_read(u16 node, u32 address, u32 *value);
34 int __must_check amd_smn_write(u16 node, u32 address, u32 value);
35 
36 #endif /*_ASM_X86_AMD_NODE_H_*/
37