1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
24  * Copyright 2020 Joyent, Inc.
25  * Copyright 2023 Oxide Computer Company
26  */
27 
28 #ifndef _TOPO_HC_H
29 #define	_TOPO_HC_H
30 
31 #ifdef	__cplusplus
32 extern "C" {
33 #endif
34 
35 /*
36  * Allowable hardware component names for hc FMRIs
37  */
38 #define	BANK		"bank"
39 #define	BAY		"bay"
40 #define	BLADE		"blade"
41 #define	BRANCH		"branch"
42 #define	CACHE		"cache"
43 #define	CCD		"ccd"
44 #define	CCX		"ccx"
45 #define	CMP		"CMP"
46 #define	CENTERPLANE	"centerplane"
47 #define	CHASSIS		"chassis"
48 #define	CHIP		"chip"
49 #define	CHIPSET		"chipset"
50 #define	CORE		"core"
51 #define	STRAND		"strand"
52 #define	CHIP_SELECT	"chip-select"
53 #define	CONTROLLER	"controller"
54 #define	CPU		"cpu"
55 #define	CPUBOARD	"cpuboard"
56 #define	DIMM		"dimm"
57 #define	DISK		"disk"
58 #define	DRAM		"dram"
59 #define	DRAMCHANNEL	"dram-channel"
60 #define	FAN		"fan"
61 #define	FANBOARD	"fanboard"
62 #define	FANMODULE	"fanmodule"
63 #define	HBA		"hba"
64 #define	HOSTBRIDGE	"hostbridge"
65 #define	INTERCONNECT	"interconnect"
66 #define	IOBOARD		"ioboard"
67 #define	IPORT		"iport"
68 #define	MEMBOARD	"memboard"
69 #define	MEMORYBUFFER	"memory-buffer"
70 #define	MEMORYCONTROL	"memory-controller"
71 #define	MICROCORE	"micro-core"
72 #define	MOTHERBOARD	"motherboard"
73 #define	NIU		"niu"
74 #define	NIUFN		"niufn"
75 #define	NVME		"nvme"
76 #define	PCI_BUS		"pcibus"
77 #define	PCI_DEVICE	"pcidev"
78 #define	PCI_FUNCTION    "pcifn"
79 #define	PCIEX_BUS	"pciexbus"
80 #define	PCIEX_DEVICE	"pciexdev"
81 #define	PCIEX_FUNCTION  "pciexfn"
82 #define	PCIEX_ROOT	"pciexrc"
83 #define	PCIEX_SWUP	"pciexswu"
84 #define	PCIEX_SWDWN	"pciexswd"
85 #define	PORT		"port"
86 #define	POWERBOARD	"powerboard"
87 #define	POWERMODULE	"powermodule"
88 #define	PSU		"psu"
89 #define	RANK		"rank"
90 #define	RECEPTACLE	"receptacle"
91 #define	RISER		"riser"
92 #define	SASEXPANDER	"sas-expander"
93 #define	SHELF		"shelf"
94 #define	SCSI_DEVICE	"scsi-device"
95 #define	SES_ENCLOSURE	"ses-enclosure"
96 #define	SLOT		"slot"
97 #define	SMP_DEVICE	"smp-device"
98 #define	SP		"sp"
99 #define	SUBCHASSIS	"subchassis"
100 #define	SYSTEMBOARD	"systemboard"
101 #define	TRANSCEIVER	"transceiver"
102 #define	UFM		"ufm"
103 #define	USB_DEVICE	"usb-device"
104 #define	XAUI		"xaui"
105 #define	XFP		"xfp"
106 
107 /*
108  * Allowable hc node property group and property names
109  */
110 #define	TOPO_PGROUP_IO		"io"
111 #define	TOPO_IO_DEVTYPE		"devtype"
112 #define	TOPO_IO_DRIVER		"driver"
113 #define	TOPO_IO_INSTANCE	"instance"
114 #define	TOPO_IO_MODULE		"module"
115 #define	TOPO_IO_DEV		"dev"
116 #define	TOPO_IO_DEVID		"devid"
117 #define	TOPO_IO_DEV_PATH	"devfs-path"
118 #define	TOPO_IO_AP_PATH		"ap-path"
119 #define	TOPO_IO_PHYS_PATH	"phys-path"
120 
121 #define	TOPO_PGROUP_PCI		"pci"
122 #define	TOPO_PCI_VENDID		"vendor-id"
123 #define	TOPO_PCI_VENDNM		"vendor-name"
124 #define	TOPO_PCI_SUBSYSNM	"subsystem-name"
125 #define	TOPO_PCI_DEVID		"device-id"
126 #define	TOPO_PCI_DEVNM		"device-name"
127 #define	TOPO_PCI_EXCAP		"extended-capabilities"
128 #define	TOPO_PCI_BDF		"BDF"
129 #define	TOPO_PCI_CLASS		"class-code"
130 #define	TOPO_PCI_AADDR		"assigned-addresses"
131 
132 #define	TOPO_PCI_MAX_WIDTH	"link-maximum-width"
133 #define	TOPO_PCI_CUR_WIDTH	"link-current-width"
134 #define	TOPO_PCI_MAX_SPEED	"link-maximum-speed"
135 #define	TOPO_PCI_CUR_SPEED	"link-current-speed"
136 #define	TOPO_PCI_SUP_SPEED	"link-supported-speeds"
137 #define	TOPO_PCI_ADMIN_SPEED	"link-admin-target-speed"
138 
139 #define	TOPO_PGROUP_BINDING	"binding"
140 #define	TOPO_BINDING_OCCUPANT	"occupant-path"
141 #define	TOPO_BINDING_DRIVER	"driver"
142 #define	TOPO_BINDING_DEVCTL	"devctl"
143 #define	TOPO_BINDING_ENCLOSURE	"enclosure"
144 #define	TOPO_BINDING_SLOT	"slot"
145 #define	TOPO_BINDING_PORT	"port"
146 #define	TOPO_BINDING_PARENT_DEV	"parent-device"
147 
148 #define	TOPO_PGROUP_STORAGE	"storage"
149 #define	TOPO_STORAGE_INITIATOR_PORT	"initiator-port"
150 #define	TOPO_STORAGE_INITIATOR_PORT_PM	"initiator-port-pm"
151 #define	TOPO_STORAGE_TARGET_PORT	"target-port"
152 #define	TOPO_STORAGE_TARGET_PORT_L0ID	"target-port-l0id"
153 #define	TOPO_STORAGE_TARGET_PORT_L0IDS	"target-port-l0ids"
154 #define	TOPO_STORAGE_ATTACHED_PORT	"attached-port"
155 #define	TOPO_STORAGE_TARGET_PORT_PM	"target-port-pm"
156 #define	TOPO_STORAGE_ATTACHED_PORT_PM	"attached-port-pm"
157 #define	TOPO_STORAGE_DEVID		"devid"
158 #define	TOPO_STORAGE_LUN64		"lun64"
159 #define	TOPO_STORAGE_DEVICE_TYPE	"inquiry-device-type"
160 #define	TOPO_STORAGE_MANUFACTURER	"manufacturer"
161 #define	TOPO_STORAGE_MODEL		"model"
162 #define	TOPO_STORAGE_FIRMWARE_REV	"firmware-revision"
163 #define	TOPO_STORAGE_SAS_PHY_MASK	"receptacle-pm"
164 #define	TOPO_STORAGE_SAS_CONNECTOR_TYPE	"sas-connector-type"
165 
166 #define	TOPO_PGROUP_SES		"ses"
167 /* Applied  any SES standard related topo node. */
168 #define	TOPO_PROP_NODE_ID	"node-id"
169 #define	TOPO_PROP_TARGET_PATH	"target-path"
170 #define	TOPO_PROP_SES_DEVID	"ses-devid"
171 #define	TOPO_PROP_SES_DEV_PATH	"ses-devfs-path"
172 #define	TOPO_PROP_SES_PHYS_PATH	"ses-phys-path"
173 #define	TOPO_PROP_SES_TARGET_PORT "ses-target-port"
174 
175 #define	TOPO_PGROUP_SMP		"smp"
176 /* host SMP target related info for an expander node. */
177 #define	TOPO_PROP_SMP_DEVID	"smp-devid"
178 #define	TOPO_PROP_SMP_DEV_PATH	"smp-devfs-path"
179 #define	TOPO_PROP_SMP_PHYS_PATH	"smp-phys-path"
180 #define	TOPO_PROP_SMP_TARGET_PORT	"smp-target-port"
181 #define	TOPO_PROP_SAS_ADDR	"sas-address"
182 #define	TOPO_PROP_PHY_COUNT	"phy-count"
183 #define	TOPO_PROP_PATHS		"paths"
184 #define	TOPO_PROP_CHASSIS_TYPE	"chassis-type"
185 #define	TOPO_PROP_SAS_PHY_MASK	"phy-mask"
186 #define	TOPO_PROP_SAS_CONNECTOR_TYPE	"sas-connector-type"
187 
188 #define	TOPO_PGROUP_PORT	"port"
189 #define	TOPO_PROP_PORT_TYPE	"type"
190 #define	TOPO_PROP_PORT_TYPE_SFF	"sff"
191 #define	TOPO_PROP_PORT_TYPE_USB	"usb"
192 #define	TOPO_PROP_PORT_TYPE_UNKNOWN	"unknown"
193 
194 #define	TOPO_PGROUP_TRANSCEIVER	"transceiver"
195 #define	TOPO_PROP_TRANSCEIVER_TYPE	"type"
196 #define	TOPO_PROP_TRANSCEIVER_USABLE	"usable"
197 
198 #define	TOPO_PGROUP_SFF_TRANSCEIVER	"sff-transceiver"
199 #define	TOPO_PORT_SFF_TRANSCEIVER_VENDOR	"vendor"
200 #define	TOPO_PORT_SFF_TRANSCEIVER_PN	"part-number"
201 #define	TOPO_PORT_SFF_TRANSCEIVER_REV	"revision"
202 #define	TOPO_PORT_SFF_TRANSCEIVER_SN	"serial-number"
203 
204 #define	TOPO_PGROUP_USB_PORT	"usb-port"
205 #define	TOPO_PROP_USB_PORT_LPORTS	"logical-ports"
206 #define	TOPO_PROP_USB_PORT_VERSIONS	"usb-versions"
207 #define	TOPO_PROP_USB_PORT_TYPE		"port-type"
208 #define	TOPO_PROP_USB_PORT_ATTRIBUTES	"port-attributes"
209 #define	TOPO_PROP_USB_PORT_A_VISIBLE	"user-visible"
210 #define	TOPO_PROP_USB_PORT_A_CONNECTED	"port-connected"
211 #define	TOPO_PROP_USB_PORT_A_DISCONNECTED	"port-disconnected"
212 #define	TOPO_PROP_USB_PORT_A_EXTERNAL	"external-port"
213 #define	TOPO_PROP_USB_PORT_A_INTERNAL	"internal-port"
214 #define	TOPO_PROP_USB_PORT_NATTRS	5
215 
216 #define	TOPO_PGROUP_USB_PROPS	"usb-properties"
217 #define	TOPO_PGROUP_USB_PROPS_VID	"usb-vendor-id"
218 #define	TOPO_PGROUP_USB_PROPS_PID	"usb-product-id"
219 #define	TOPO_PGROUP_USB_PROPS_REV	"usb-revision-id"
220 #define	TOPO_PGROUP_USB_PROPS_VNAME	"usb-vendor-name"
221 #define	TOPO_PGROUP_USB_PROPS_PNAME	"usb-product-name"
222 #define	TOPO_PGROUP_USB_PROPS_SN	"usb-serialno"
223 #define	TOPO_PGROUP_USB_PROPS_VERSION	"usb-version"
224 #define	TOPO_PGROUP_USB_PROPS_SPEED	"usb-speed"
225 #define	TOPO_PGROUP_USB_PROPS_PORT	"usb-port"
226 #define	TOPO_PGROUP_USB_PROPS_SUPPORTED_SPEEDS	"usb-supported-speeds"
227 #define	TOPO_PGROUP_USB_PROPS_MIN_SPEED	"usb-minimum-speed"
228 
229 
230 /*
231  * These properties will exist on nodes enumerated by the ipmi module. They
232  * are consumed by the fac_prov_ipmi module
233  */
234 #define	TOPO_PROP_IPMI_ENTITY_ID	"entity-id"
235 #define	TOPO_PROP_IPMI_ENTITY_INST	"entity-instance"
236 
237 /*
238  * This property can be statically set in a map file and is consumed by the
239  * fac_prov_ipmi module.
240  */
241 #define	TOPO_PROP_IPMI_ENTITY_LIST	"entity-list"
242 
243 #define	TOPO_PGROUP_SLOT		"slot"
244 #define	TOPO_PROP_SLOT_TYPE		"slot-type"
245 
246 #define	TOPO_PGROUP_DIMM_SLOT		"dimm-slot"
247 #define	TOPO_PROP_DIMM_SLOT_FORM	"form-factor"
248 #define	TOPO_DIMM_SLOT_FORM_DIMM	"DIMM"
249 #define	TOPO_DIMM_SLOT_FORM_SODIMM	"SODIMM"
250 #define	TOPO_DIMM_SLOT_FORM_FBDIMM	"FBDIMM"
251 
252 #define	TOPO_PGROUP_DIMM_PROPS		"dimm-properties"
253 #define	TOPO_PROP_DIMM_TYPE		"dram-type"
254 #define	TOPO_DIMM_TYPE_UNKNOWN		"UNKNOWN"
255 #define	TOPO_DIMM_TYPE_DDR		"DDR"
256 #define	TOPO_DIMM_TYPE_DDR2		"DDR2"
257 #define	TOPO_DIMM_TYPE_DDR3		"DDR3"
258 #define	TOPO_DIMM_TYPE_DDR4		"DDR4"
259 #define	TOPO_DIMM_TYPE_DDR5		"DDR5"
260 #define	TOPO_DIMM_TYPE_LPDDR		"LPDDR"
261 #define	TOPO_DIMM_TYPE_LPDDR2		"LPDDR2"
262 #define	TOPO_DIMM_TYPE_LPDDR3		"LPDDR3"
263 #define	TOPO_DIMM_TYPE_LPDDR4		"LPDDR4"
264 #define	TOPO_DIMM_TYPE_LPDDR5		"LPDDR5"
265 #define	TOPO_PROP_DIMM_MODULE_TYPE	"module-type"
266 #define	TOPO_PROP_DIMM_SIZE		"size"
267 #define	TOPO_PROP_DIMM_RANKS		"ranks"
268 #define	TOPO_PROP_DIMM_BANKS		"banks"
269 #define	TOPO_PROP_DIMM_BANK_GROUPS	"bank-groups"
270 #define	TOPO_PROP_DIMM_BANKS_PER_GROUP	"banks-per-bank-group"
271 #define	TOPO_PROP_DIMM_SUBCHANNELS	"subchannels"
272 #define	TOPO_PROP_DIMM_DATA_WIDTH	"data-width"
273 #define	TOPO_PROP_DIMM_ECC_WIDTH	"ecc-width"
274 #define	TOPO_PROP_DIMM_VDD		"Vdd-mV"
275 
276 /*
277  * DIMM Component property group. Because it is hard to determine the number of
278  * each type of component that is present on a DIMM across the various SPD
279  * revisions without embedding part-specific knowledge and in some cases
280  * multiple logically different components are in the same physical part (such
281  * as the SPD and temperature sensor), we instead create a property group which
282  * contains this information about the components. For each class of component,
283  * there is information about manufacturer, revision, and device class type.
284  * There may be multiple instances of a given item. For example, DDR5 allows for
285  * 3 different PMIC manufacturers, etc. As such, for each item class, there will
286  * be an array where each entry corresponds to one another, as well as a
287  * top-level string array that describes what components one can look for. For
288  * each component there will potentially be the following properties:
289  *
290  * <component>-revision:	string[]
291  * <component>-mfg-name:	string[]
292  * <component>-type:		string[]
293  * <component>-count:		uint32 (Uncommon)
294  */
295 #define	TOPO_PGROUP_DIMM_COMPONENTS	"dimm-components"
296 #define	TOPO_PROP_DIMM_COMP		"components"
297 #define	TOPO_PROP_DIMM_COMP_DIE		"dram-die"
298 #define	TOPO_PROP_DIMM_COMP_SPD		"spd"
299 #define	TOPO_PROP_DIMM_COMP_TS		"ts"
300 #define	TOPO_PROP_DIMM_COMP_HS		"hs"
301 #define	TOPO_PROP_DIMM_COMP_PMIC	"pmic"
302 #define	TOPO_PROP_DIMM_COMP_CD		"cd"
303 #define	TOPO_PROP_DIMM_COMP_RCD		"rcd"
304 #define	TOPO_PROP_DIMM_COMP_DB		"db"
305 #define	TOPO_PROP_DIMM_COMP_MRCD	"mrcd"
306 #define	TOPO_PROP_DIMM_COMP_MDB		"mdb"
307 #define	TOPO_PROP_DIMM_COMP_DMB		"dmb"
308 
309 #define	TOPO_PGROUP_MOTHERBOARD		"motherboard-properties"
310 #define	TOPO_PROP_MB_MANUFACTURER	"manufacturer"
311 #define	TOPO_PROP_MB_PRODUCT		"product-id"
312 #define	TOPO_PROP_MB_ASSET		"asset-tag"
313 #define	TOPO_PROP_MB_FIRMWARE_VENDOR	"firmware-vendor"
314 #define	TOPO_PROP_MB_FIRMWARE_RELDATE	"firmware-release-date"
315 
316 #define	TOPO_PGROUP_UFM			"ufm-properties"
317 #define	TOPO_PROP_UFM_DESCR		"ufm-description"
318 
319 #define	TOPO_PGROUP_UFM_SLOT		"ufm-slot-properties"
320 #define	TOPO_PROP_UFM_SLOT_VERSION	"ufm-slot-version"
321 #define	TOPO_PROP_UFM_SLOT_MODE		"ufm-slot-mode"
322 #define	TOPO_PROP_UFM_SLOT_ACTIVE	"ufm-slot-active"
323 
324 #define	TOPO_PGROUP_DATALINK		"datalink"
325 #define	TOPO_PGROUP_DATALINK_PMAC	"primary-mac-address"
326 #define	TOPO_PGROUP_DATALINK_LINK_SPEED		"link-speed"
327 #define	TOPO_PGROUP_DATALINK_LINK_STATUS	"link-status"
328 #define	TOPO_PGROUP_DATALINK_LINK_STATUS_UP	"up"
329 #define	TOPO_PGROUP_DATALINK_LINK_STATUS_DOWN	"down"
330 #define	TOPO_PGROUP_DATALINK_LINK_STATUS_UNKNOWN	"unknown"
331 #define	TOPO_PGROUP_DATALINK_LINK_DUPLEX	"link-duplex"
332 #define	TOPO_PGROUP_DATALINK_LINK_DUPLEX_FULL	"full"
333 #define	TOPO_PGROUP_DATALINK_LINK_DUPLEX_HALF	"half"
334 #define	TOPO_PGROUP_DATALINK_LINK_DUPLEX_UNKNOWN	"unknown"
335 #define	TOPO_PGROUP_DATALINK_LINK_NAME		"link-name"
336 #define	TOPO_PGROUP_DATALINK_LINK_MEDIA		"link-media"
337 
338 #define	TOPO_PGROUP_NVME		"nvme-properties"
339 #define	TOPO_PROP_NVME_VER		"nvme-version"
340 
341 /*
342  * Hardware cache properties.
343  */
344 #define	TOPO_PGROUP_CACHE	"cache"
345 #define	TOPO_PGROUP_CACHE_LEVEL		"level"
346 #define	TOPO_PGROUP_CACHE_WAYS		"ways"
347 #define	TOPO_PGROUP_CACHE_SETS		"sets"
348 #define	TOPO_PGROUP_CACHE_LINE_SIZE	"line-size"
349 #define	TOPO_PGROUP_CACHE_SIZE		"size"
350 #define	TOPO_PGROUP_CACHE_SYSTEM_ID	"system-id"
351 #define	TOPO_PGROUP_CACHE_TYPES		"cache-types"
352 #define	TOPO_PGROUP_CACHE_TYPES_DATA	"data"
353 #define	TOPO_PGROUP_CACHE_TYPES_INSTR	"instruction"
354 #define	TOPO_PGROUP_CACHE_FLAGS		"cache-flags"
355 #define	TOPO_PGROUP_CACHE_FLAGS_UNIFIED	"unified"
356 #define	TOPO_PGROUP_CACHE_FLAGS_FA	"fully-assosciative"
357 
358 #ifdef	__cplusplus
359 }
360 #endif
361 
362 #endif	/* _TOPO_HC_H */
363