Lijian Zhao has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/32293
Change subject: smbios: Add memory type 9 system slot support ......................................................................
smbios: Add memory type 9 system slot support
Add SMBIOS type 9 system slots into coreboot, the definiation is up to date with SMBIOS spec 3.2
Signed-off-by: Lijian Zhao lijian.zhao@intel.com Change-Id: Ibcfa377c260083203c1daf5562e103001f76b257 --- M src/arch/x86/smbios.c M src/include/smbios.h 2 files changed, 169 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/93/32293/1
diff --git a/src/arch/x86/smbios.c b/src/arch/x86/smbios.c index 44ff578..10feb15 100644 --- a/src/arch/x86/smbios.c +++ b/src/arch/x86/smbios.c @@ -827,6 +827,32 @@
return len; } +int smbios_write_type9(unsigned long *current, int *handle, + const char *name, u8 type, u8 slot_char1, + u8 slot_char2, u8 bus, u8 dev_func) +{ + struct smbios_type9 *t = (struct smbios_type9 *)*current; + int len = sizeof(struct smbios_type9); + + memset(t, 0, sizeof(struct smbios_type9)); + t->type = SMBIOS_SYSTEM_SLOTS; + t->handle = *handle; + t->length = len - 2; + t->slot_designation = smbios_add_string(t->eos, name); + t->slot_type = type; + t->slot_data_bus_width = SlotDataBusWidthOther; + t->current_usage = SlotUsageAvailable; + t->slot_length = SlotLengthOther; + t->slot_characteristics_1 = slot_char1; + t->slot_characteristics_2 = slot_char2; + t->bus_number = bus; + t->device_function_number = dev_func; + + len = t->length + smbios_string_table_len(t->eos); + *current += len; + *handle += 1; + return len; +}
static int smbios_write_type11(unsigned long *current, int *handle) { diff --git a/src/include/smbios.h b/src/include/smbios.h index 08e6b61..70d8179 100644 --- a/src/include/smbios.h +++ b/src/include/smbios.h @@ -25,6 +25,9 @@ int smbios_string_table_len(u8 *start);
/* Used by mainboard to add an on-board device */ +int smbios_write_type9(unsigned long *current, int *handle, + const char *name, u8 type, u8 slot_char1, + u8 slot_char2, u8 bus, u8 dev_func); enum smbios_bmc_interface_type; int smbios_write_type38(unsigned long *current, int *handle, const enum smbios_bmc_interface_type interface_type, @@ -480,6 +483,146 @@ u8 eos[2]; } __packed;
+/* System Slots - Slot Type */ +enum misc_slot_type { + SlotTypeOther = 0x01, + SlotTypeUnknown = 0x02, + SlotTypeIsa = 0x03, + SlotTypeMca = 0x04, + SlotTypeEisa = 0x05, + SlotTypePci = 0x06, + SlotTypePcmcia = 0x07, + SlotTypeVlVesa = 0x08, + SlotTypeProprietary = 0x09, + SlotTypeProcessorCardSlot = 0x0A, + SlotTypeProprietaryMemoryCardSlot = 0x0B, + SlotTypeIORiserCardSlot = 0x0C, + SlotTypeNuBus = 0x0D, + SlotTypePci66MhzCapable = 0x0E, + SlotTypeAgp = 0x0F, + SlotTypeApg2X = 0x10, + SlotTypeAgp4X = 0x11, + SlotTypePciX = 0x12, + SlotTypeAgp8X = 0x13, + SlotTypeM2Socket1_DP = 0x14, + SlotTypeM2Socket1_SD = 0x15, + SlotTypeM2Socket2 = 0x16, + SlotTypeM2Socket3 = 0x17, + SlotTypeMxmTypeI = 0x18, + SlotTypeMxmTypeII = 0x19, + SlotTypeMxmTypeIIIStandard = 0x1A, + SlotTypeMxmTypeIIIHe = 0x1B, + SlotTypeMxmTypeIV = 0x1C, + SlotTypeMxm30TypeA = 0x1D, + SlotTypeMxm30TypeB = 0x1E, + SlotTypePciExpressGen2Sff_8639 = 0x1F, + SlotTypePciExpressGen3Sff_8639 = 0x20, + SlotTypePciExpressMini52pinWithBSKO = 0x21, + SlotTypePciExpressMini52pinWithoutBSKO = 0x22, + SlotTypePciExpressMini76pin = 0x23, + SlotTypePC98C20 = 0xA0, + SlotTypePC98C24 = 0xA1, + SlotTypePC98E = 0xA2, + SlotTypePC98LocalBus = 0xA3, + SlotTypePC98Card = 0xA4, + SlotTypePciExpress = 0xA5, + SlotTypePciExpressX1 = 0xA6, + SlotTypePciExpressX2 = 0xA7, + SlotTypePciExpressX4 = 0xA8, + SlotTypePciExpressX8 = 0xA9, + SlotTypePciExpressX16 = 0xAA, + SlotTypePciExpressGen2 = 0xAB, + SlotTypePciExpressGen2X1 = 0xAC, + SlotTypePciExpressGen2X2 = 0xAD, + SlotTypePciExpressGen2X4 = 0xAE, + SlotTypePciExpressGen2X8 = 0xAF, + SlotTypePciExpressGen2X16 = 0xB0, + SlotTypePciExpressGen3 = 0xB1, + SlotTypePciExpressGen3X1 = 0xB2, + SlotTypePciExpressGen3X2 = 0xB3, + SlotTypePciExpressGen3X4 = 0xB4, + SlotTypePciExpressGen3X8 = 0xB5, + SlotTypePciExpressGen3X16 = 0xB6 +}; + +/* System Slots - Slot Data Bus Width. */ +enum slot_data_bus_bandwidth { + SlotDataBusWidthOther = 0x01, + SlotDataBusWidthUnknown = 0x02, + SlotDataBusWidth8Bit = 0x03, + SlotDataBusWidth16Bit = 0x04, + SlotDataBusWidth32Bit = 0x05, + SlotDataBusWidth64Bit = 0x06, + SlotDataBusWidth128Bit = 0x07, + SlotDataBusWidth1X = 0x08, + SlotDataBusWidth2X = 0x09, + SlotDataBusWidth4X = 0x0A, + SlotDataBusWidth8X = 0x0B, + SlotDataBusWidth12X = 0x0C, + SlotDataBusWidth16X = 0x0D, + SlotDataBusWidth32X = 0x0E +}; + +/* System Slots - Current Usage. */ +enum mist_slot_usage { + SlotUsageOther = 0x01, + SlotUsageUnknown = 0x02, + SlotUsageAvailable = 0x03, + SlotUsageInUse = 0x04, + SlotUsageUnavailable = 0x05 +}; + +/* System Slots - Slot Length.*/ +enum misc_slot_length { + SlotLengthOther = 0x01, + SlotLengthUnknown = 0x02, + SlotLengthShort = 0x03, + SlotLengthLong = 0x04 +}; + +/* System Slots - Slot Characteristics 1. */ +#define SMBIOS_SLOT_UNKNOWN (1 << 0) +#define SMBIOS_SLOT_5V (1 << 1) +#define SMBIOS_SLOT_3P3V (1 << 2) +#define SMBIOS_SLOT_SHARED (1 << 3) +#define SMBIOS_SLOT_PCCARD_16 (1 << 4) +#define SMBIOS_SLOT_PCCARD_CARDBUS (1 << 5) +#define SMBIOS_SLOT_PCCARD_ZOOM (1 << 6) +#define SMBIOS_SLOT_PCCARD_MODEM_RING (1 << 7) +/* System Slots - Slot Characteristics 2. */ +#define SMBIOS_SLOT_PME (1 << 0) +#define SMBIOS_SLOT_HOTPLUG (1 << 1) +#define SMBIOS_SLOT_SMBUS (1 << 2) +#define SMBIOS_SLOT_BIFURCATION (1 << 3) + +struct slot_peer_groups { + u16 peer_seg_num; + u8 peer_bus_num; + u8 peer_dev_fn_num; + u8 peer_data_bus_width; +} __packed; + +struct smbios_type9 { + u8 type; + u8 length; + u16 handle; + u8 slot_designation; + u8 slot_type; + u8 slot_data_bus_width; + u8 current_usage; + u8 slot_length; + u16 slot_id; + u8 slot_characteristics_1; + u8 slot_characteristics_2; + u16 segment_group_number; + u8 bus_number; + u8 device_function_number; + u8 data_bus_width; + u8 peer_group_count; + struct slot_peer_groups peer[1]; + u8 eos[2]; +} __packed; + struct smbios_type11 { u8 type; u8 length;
Patrick Rudolph has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/32293 )
Change subject: smbios: Add memory type 9 system slot support ......................................................................
Patch Set 1: Code-Review+1
(2 comments)
looks good so far. I was thinking about a adding SMBIOS slot description to the devicetree.cb and parse it here to have a platform independent solution (for PCI slots).
https://review.coreboot.org/#/c/32293/1/src/arch/x86/smbios.c File src/arch/x86/smbios.c:
https://review.coreboot.org/#/c/32293/1/src/arch/x86/smbios.c@831 PS1, Line 831: const char *name, u8 type, u8 slot_char1, make attributes const and use enums defined in smbios.h
https://review.coreboot.org/#/c/32293/1/src/arch/x86/smbios.c@849 PS1, Line 849: t->device_function_number = dev_func; missing:
data_bus_width segment_group_number current_usage slot_id
Patrick Rudolph has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/32293 )
Change subject: smbios: Add memory type 9 system slot support ......................................................................
Patch Set 1:
Added some fields to sconfig: https://review.coreboot.org/c/coreboot/+/32307/1 Tested on Lenovo T520 using https://review.coreboot.org/c/coreboot/+/32309/1. The slots are correctly listed in dmidecode -t9.
Lijian Zhao has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/32293 )
Change subject: smbios: Add memory type 9 system slot support ......................................................................
Patch Set 1:
(2 comments)
https://review.coreboot.org/#/c/32293/1/src/arch/x86/smbios.c File src/arch/x86/smbios.c:
https://review.coreboot.org/#/c/32293/1/src/arch/x86/smbios.c@831 PS1, Line 831: const char *name, u8 type, u8 slot_char1,
make attributes const and use enums defined in smbios. […]
just for "type"?
https://review.coreboot.org/#/c/32293/1/src/arch/x86/smbios.c@849 PS1, Line 849: t->device_function_number = dev_func;
missing: […]
slot_it and current usage already there, I put fixed number first. If you want the segment group number and data bus width for peer? I have that skipped first.
Hello Patrick Rudolph, build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/32293
to look at the new patch set (#2).
Change subject: smbios: Add memory type 9 system slot support ......................................................................
smbios: Add memory type 9 system slot support
Add SMBIOS type 9 system slots into coreboot, the definiation is up to date with SMBIOS spec 3.2
Signed-off-by: Lijian Zhao lijian.zhao@intel.com Change-Id: Ibcfa377c260083203c1daf5562e103001f76b257 --- M src/arch/x86/smbios.c M src/include/smbios.h 2 files changed, 171 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/93/32293/2
Lijian Zhao has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/32293 )
Change subject: smbios: Add memory type 9 system slot support ......................................................................
Patch Set 1:
(2 comments)
https://review.coreboot.org/#/c/32293/1/src/arch/x86/smbios.c File src/arch/x86/smbios.c:
https://review.coreboot.org/#/c/32293/1/src/arch/x86/smbios.c@831 PS1, Line 831: const char *name, u8 type, u8 slot_char1,
make attributes const and use enums defined in smbios. […]
Done
https://review.coreboot.org/#/c/32293/1/src/arch/x86/smbios.c@849 PS1, Line 849: t->device_function_number = dev_func;
missing: […]
Done
Hello Patrick Rudolph, build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/32293
to look at the new patch set (#3).
Change subject: smbios: Add memory type 9 system slot support ......................................................................
smbios: Add memory type 9 system slot support
Add SMBIOS type 9 system slots into coreboot, the definiation is up to date with SMBIOS spec 3.2
Signed-off-by: Lijian Zhao lijian.zhao@intel.com Change-Id: Ibcfa377c260083203c1daf5562e103001f76b257 --- M src/arch/x86/smbios.c M src/include/smbios.h 2 files changed, 172 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/93/32293/3
Patrick Rudolph has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/32293 )
Change subject: smbios: Add memory type 9 system slot support ......................................................................
Patch Set 4:
(5 comments)
https://review.coreboot.org/#/c/32293/1/src/arch/x86/smbios.c File src/arch/x86/smbios.c:
https://review.coreboot.org/#/c/32293/1/src/arch/x86/smbios.c@831 PS1, Line 831: const char *name, u8 type, u8 slot_char1,
Done
please constify all arguments and use enums where possible. That would be: slot_type, slot_data_bus_width, current_usage, slot_length.
https://review.coreboot.org/#/c/32293/1/src/arch/x86/smbios.c@849 PS1, Line 849: t->device_function_number = dev_func;
Done
I don't see segment group number or peer useful at the moment.
https://review.coreboot.org/#/c/32293/4/src/arch/x86/smbios.c File src/arch/x86/smbios.c:
https://review.coreboot.org/#/c/32293/4/src/arch/x86/smbios.c@847 PS4, Line 847: t->slot_designation = smbios_add_string(t->eos, name); Use a default string if name is NULL? Like SLOT-%d?
https://review.coreboot.org/#/c/32293/4/src/arch/x86/smbios.c@857 PS4, Line 857: t->data_bus_width = SlotDataBusWidthOther; I need data_bus_width in https://review.coreboot.org/c/coreboot/+/32307/1. I haven't implemented slot_length in https://review.coreboot.org/c/coreboot/+/32307/1, but it's easy an probably should be done too. Also current_usage can be detected at runtime. If the PCI device has enabled children, it's 'In use', otherwise 'Available'.
Setting a default for them doesn't make sense.
https://review.coreboot.org/#/c/32293/4/src/include/smbios.h File src/include/smbios.h:
https://review.coreboot.org/#/c/32293/4/src/include/smbios.h@624 PS4, Line 624: struct slot_peer_groups peer[1]; peer[0] if peer_group_count is always zero
Hello Patrick Rudolph, build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/32293
to look at the new patch set (#5).
Change subject: smbios: Add memory type 9 system slot support ......................................................................
smbios: Add memory type 9 system slot support
Add SMBIOS type 9 system slots into coreboot, the definiation is up to date with SMBIOS spec 3.2
Signed-off-by: Lijian Zhao lijian.zhao@intel.com Change-Id: Ibcfa377c260083203c1daf5562e103001f76b257 --- M src/arch/x86/smbios.c M src/include/smbios.h 2 files changed, 179 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/93/32293/5
Hello Patrick Rudolph, build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/32293
to look at the new patch set (#6).
Change subject: smbios: Add memory type 9 system slot support ......................................................................
smbios: Add memory type 9 system slot support
Add SMBIOS type 9 system slots into coreboot, the definiation is up to date with SMBIOS spec 3.2
Signed-off-by: Lijian Zhao lijian.zhao@intel.com Change-Id: Ibcfa377c260083203c1daf5562e103001f76b257 --- M src/arch/x86/smbios.c M src/include/smbios.h 2 files changed, 181 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/93/32293/6
Hello Patrick Rudolph, build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/32293
to look at the new patch set (#7).
Change subject: smbios: Add memory type 9 system slot support ......................................................................
smbios: Add memory type 9 system slot support
Add SMBIOS type 9 system slots into coreboot, the definiation is up to date with SMBIOS spec 3.2
Signed-off-by: Lijian Zhao lijian.zhao@intel.com Change-Id: Ibcfa377c260083203c1daf5562e103001f76b257 --- M src/arch/x86/smbios.c M src/include/smbios.h 2 files changed, 184 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/93/32293/7
Lijian Zhao has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/32293 )
Change subject: smbios: Add memory type 9 system slot support ......................................................................
Patch Set 7:
(5 comments)
https://review.coreboot.org/#/c/32293/1/src/arch/x86/smbios.c File src/arch/x86/smbios.c:
https://review.coreboot.org/#/c/32293/1/src/arch/x86/smbios.c@831 PS1, Line 831: const char *name, u8 type, u8 slot_char1,
please constify all arguments and use enums where possible. That would be: […]
Done
https://review.coreboot.org/#/c/32293/1/src/arch/x86/smbios.c@849 PS1, Line 849: t->device_function_number = dev_func;
I don't see segment group number or peer useful at the moment.
Yes segment number can be 0xff for non-pci devices, and 0 for single segment pci spaces. As of now 0 maybe enough, but probably we shall at least let people have a chance to set.
https://review.coreboot.org/#/c/32293/4/src/arch/x86/smbios.c File src/arch/x86/smbios.c:
https://review.coreboot.org/#/c/32293/4/src/arch/x86/smbios.c@847 PS4, Line 847: t->slot_designation = smbios_add_string(t->eos, name);
Use a default string if name is NULL? Like SLOT-%d?
Done. Just "SLOT"? SLOT-%d will need slot_id? That's still open right?
https://review.coreboot.org/#/c/32293/4/src/arch/x86/smbios.c@857 PS4, Line 857: t->data_bus_width = SlotDataBusWidthOther;
I need data_bus_width in https://review.coreboot.org/c/coreboot/+/32307/1. […]
Done
https://review.coreboot.org/#/c/32293/4/src/include/smbios.h File src/include/smbios.h:
https://review.coreboot.org/#/c/32293/4/src/include/smbios.h@624 PS4, Line 624: struct slot_peer_groups peer[1];
peer[0] if peer_group_count is always zero
Done
Patrick Rudolph has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/32293 )
Change subject: smbios: Add memory type 9 system slot support ......................................................................
Patch Set 7: Code-Review+1
(1 comment)
Tested using the follow on patches. Works fine on Lenovo T520 using the devicetree provided values (except current_usage due to a bug in coreboot).
https://review.coreboot.org/#/c/32293/4/src/arch/x86/smbios.c File src/arch/x86/smbios.c:
https://review.coreboot.org/#/c/32293/4/src/arch/x86/smbios.c@847 PS4, Line 847: t->slot_designation = smbios_add_string(t->eos, name);
Done. […]
yes, slot_id is still open. I'm not sure how to integrate it, yet. Best would be to mark it as TODO.
Hello Pratikkumar V Prajapati, Patrick Rudolph, Patrick Rudolph, Bora Guvendik, build bot (Jenkins), Francois Toguo Fotso,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/32293
to look at the new patch set (#8).
Change subject: smbios: Add memory type 9 system slot support ......................................................................
smbios: Add memory type 9 system slot support
Add SMBIOS type 9 system slots into coreboot, the definiation is up to date with SMBIOS spec 3.2
Signed-off-by: Lijian Zhao lijian.zhao@intel.com Change-Id: Ibcfa377c260083203c1daf5562e103001f76b257 --- M src/arch/x86/smbios.c M src/include/smbios.h 2 files changed, 185 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/93/32293/8
Lijian Zhao has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/32293 )
Change subject: smbios: Add memory type 9 system slot support ......................................................................
Patch Set 4:
(1 comment)
https://review.coreboot.org/#/c/32293/4/src/arch/x86/smbios.c File src/arch/x86/smbios.c:
https://review.coreboot.org/#/c/32293/4/src/arch/x86/smbios.c@847 PS4, Line 847: t->slot_designation = smbios_add_string(t->eos, name);
yes, slot_id is still open. […]
Done
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/32293 )
Change subject: smbios: Add memory type 9 system slot support ......................................................................
Patch Set 8:
(1 comment)
https://review.coreboot.org/#/c/32293/8/src/arch/x86/smbios.c File src/arch/x86/smbios.c:
https://review.coreboot.org/#/c/32293/8/src/arch/x86/smbios.c@849 PS8, Line 849: /* TODO Implement supoort for slot_id, it will be "_SUN" for ACPI devices */ line over 80 characters
Hello Pratikkumar V Prajapati, Patrick Rudolph, Patrick Rudolph, Bora Guvendik, build bot (Jenkins), Francois Toguo Fotso,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/32293
to look at the new patch set (#9).
Change subject: smbios: Add memory type 9 system slot support ......................................................................
smbios: Add memory type 9 system slot support
Add SMBIOS type 9 system slots into coreboot, the definiation is up to date with SMBIOS spec 3.2
Signed-off-by: Lijian Zhao lijian.zhao@intel.com Change-Id: Ibcfa377c260083203c1daf5562e103001f76b257 --- M src/arch/x86/smbios.c M src/include/smbios.h 2 files changed, 185 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/93/32293/9
HAOUAS Elyes has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/32293 )
Change subject: smbios: Add memory type 9 system slot support ......................................................................
Patch Set 9: Code-Review+2
HAOUAS Elyes has removed a vote on this change.
Change subject: smbios: Add memory type 9 system slot support ......................................................................
Removed Code-Review+2 by HAOUAS Elyes ehaouas@noos.fr
HAOUAS Elyes has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/32293 )
Change subject: smbios: Add memory type 9 system slot support ......................................................................
Patch Set 9: Code-Review+1
Patrick Rudolph has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/32293 )
Change subject: smbios: Add memory type 9 system slot support ......................................................................
Patch Set 9: Code-Review+1
(1 comment)
https://review.coreboot.org/#/c/32293/9/src/include/smbios.h File src/include/smbios.h:
https://review.coreboot.org/#/c/32293/9/src/include/smbios.h@629 PS9, Line 629: struct slot_peer_groups peer[1]; peer[0] as peer_group_count is zero
Hello Patrick Rudolph, Pratikkumar V Prajapati, HAOUAS Elyes, Patrick Rudolph, Bora Guvendik, build bot (Jenkins), Francois Toguo Fotso,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/32293
to look at the new patch set (#10).
Change subject: smbios: Add memory type 9 system slot support ......................................................................
smbios: Add memory type 9 system slot support
Add SMBIOS type 9 system slots into coreboot, the definiation is up to date with SMBIOS spec 3.2
Signed-off-by: Lijian Zhao lijian.zhao@intel.com Change-Id: Ibcfa377c260083203c1daf5562e103001f76b257 --- M src/arch/x86/smbios.c M src/include/smbios.h 2 files changed, 185 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/93/32293/10
Lijian Zhao has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/32293 )
Change subject: smbios: Add memory type 9 system slot support ......................................................................
Patch Set 9:
(1 comment)
https://review.coreboot.org/#/c/32293/9/src/include/smbios.h File src/include/smbios.h:
https://review.coreboot.org/#/c/32293/9/src/include/smbios.h@629 PS9, Line 629: struct slot_peer_groups peer[1];
peer[0] as peer_group_count is zero
Done
Patrick Rudolph has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/32293 )
Change subject: smbios: Add memory type 9 system slot support ......................................................................
Patch Set 10: Code-Review+2
Patrick Georgi has submitted this change and it was merged. ( https://review.coreboot.org/c/coreboot/+/32293 )
Change subject: smbios: Add memory type 9 system slot support ......................................................................
smbios: Add memory type 9 system slot support
Add SMBIOS type 9 system slots into coreboot, the definiation is up to date with SMBIOS spec 3.2
Signed-off-by: Lijian Zhao lijian.zhao@intel.com Change-Id: Ibcfa377c260083203c1daf5562e103001f76b257 Reviewed-on: https://review.coreboot.org/c/coreboot/+/32293 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Patrick Rudolph siro@das-labor.org --- M src/arch/x86/smbios.c M src/include/smbios.h 2 files changed, 185 insertions(+), 0 deletions(-)
Approvals: build bot (Jenkins): Verified Patrick Rudolph: Looks good to me, approved
diff --git a/src/arch/x86/smbios.c b/src/arch/x86/smbios.c index 1aa5be9..7c87c69 100644 --- a/src/arch/x86/smbios.c +++ b/src/arch/x86/smbios.c @@ -833,6 +833,41 @@
return len; } +int smbios_write_type9(unsigned long *current, int *handle, + const char *name, const enum misc_slot_type type, + const enum slot_data_bus_bandwidth bandwidth, + const enum misc_slot_usage usage, + const enum misc_slot_length length, + u8 slot_char1, u8 slot_char2, u8 bus, u8 dev_func) +{ + struct smbios_type9 *t = (struct smbios_type9 *)*current; + int len = sizeof(struct smbios_type9); + + memset(t, 0, sizeof(struct smbios_type9)); + t->type = SMBIOS_SYSTEM_SLOTS; + t->handle = *handle; + t->length = len - 2; + if (name) + t->slot_designation = smbios_add_string(t->eos, name); + else + t->slot_designation = smbios_add_string(t->eos, "SLOT"); + t->slot_type = type; + /* TODO add slot_id supoort, will be "_SUN" for ACPI devices */ + t->slot_data_bus_width = bandwidth; + t->current_usage = usage; + t->slot_length = length; + t->slot_characteristics_1 = slot_char1; + t->slot_characteristics_2 = slot_char2; + t->segment_group_number = 0; + t->bus_number = bus; + t->device_function_number = dev_func; + t->data_bus_width = SlotDataBusWidthOther; + + len = t->length + smbios_string_table_len(t->eos); + *current += len; + *handle += 1; + return len; +}
static int smbios_write_type11(unsigned long *current, int *handle) { diff --git a/src/include/smbios.h b/src/include/smbios.h index 5e06947..afe77d6 100644 --- a/src/include/smbios.h +++ b/src/include/smbios.h @@ -26,6 +26,16 @@ int smbios_string_table_len(u8 *start);
/* Used by mainboard to add an on-board device */ +enum misc_slot_type; +enum misc_slot_length; +enum misc_slot_usage; +enum slot_data_bus_bandwidth; +int smbios_write_type9(unsigned long *current, int *handle, + const char *name, const enum misc_slot_type type, + const enum slot_data_bus_bandwidth bandwidth, + const enum misc_slot_usage usage, + const enum misc_slot_length length, + u8 slot_char1, u8 slot_char2, u8 bus, u8 dev_func); enum smbios_bmc_interface_type; int smbios_write_type38(unsigned long *current, int *handle, const enum smbios_bmc_interface_type interface_type, @@ -481,6 +491,146 @@ u8 eos[2]; } __packed;
+/* System Slots - Slot Type */ +enum misc_slot_type { + SlotTypeOther = 0x01, + SlotTypeUnknown = 0x02, + SlotTypeIsa = 0x03, + SlotTypeMca = 0x04, + SlotTypeEisa = 0x05, + SlotTypePci = 0x06, + SlotTypePcmcia = 0x07, + SlotTypeVlVesa = 0x08, + SlotTypeProprietary = 0x09, + SlotTypeProcessorCardSlot = 0x0A, + SlotTypeProprietaryMemoryCardSlot = 0x0B, + SlotTypeIORiserCardSlot = 0x0C, + SlotTypeNuBus = 0x0D, + SlotTypePci66MhzCapable = 0x0E, + SlotTypeAgp = 0x0F, + SlotTypeApg2X = 0x10, + SlotTypeAgp4X = 0x11, + SlotTypePciX = 0x12, + SlotTypeAgp8X = 0x13, + SlotTypeM2Socket1_DP = 0x14, + SlotTypeM2Socket1_SD = 0x15, + SlotTypeM2Socket2 = 0x16, + SlotTypeM2Socket3 = 0x17, + SlotTypeMxmTypeI = 0x18, + SlotTypeMxmTypeII = 0x19, + SlotTypeMxmTypeIIIStandard = 0x1A, + SlotTypeMxmTypeIIIHe = 0x1B, + SlotTypeMxmTypeIV = 0x1C, + SlotTypeMxm30TypeA = 0x1D, + SlotTypeMxm30TypeB = 0x1E, + SlotTypePciExpressGen2Sff_8639 = 0x1F, + SlotTypePciExpressGen3Sff_8639 = 0x20, + SlotTypePciExpressMini52pinWithBSKO = 0x21, + SlotTypePciExpressMini52pinWithoutBSKO = 0x22, + SlotTypePciExpressMini76pin = 0x23, + SlotTypePC98C20 = 0xA0, + SlotTypePC98C24 = 0xA1, + SlotTypePC98E = 0xA2, + SlotTypePC98LocalBus = 0xA3, + SlotTypePC98Card = 0xA4, + SlotTypePciExpress = 0xA5, + SlotTypePciExpressX1 = 0xA6, + SlotTypePciExpressX2 = 0xA7, + SlotTypePciExpressX4 = 0xA8, + SlotTypePciExpressX8 = 0xA9, + SlotTypePciExpressX16 = 0xAA, + SlotTypePciExpressGen2 = 0xAB, + SlotTypePciExpressGen2X1 = 0xAC, + SlotTypePciExpressGen2X2 = 0xAD, + SlotTypePciExpressGen2X4 = 0xAE, + SlotTypePciExpressGen2X8 = 0xAF, + SlotTypePciExpressGen2X16 = 0xB0, + SlotTypePciExpressGen3 = 0xB1, + SlotTypePciExpressGen3X1 = 0xB2, + SlotTypePciExpressGen3X2 = 0xB3, + SlotTypePciExpressGen3X4 = 0xB4, + SlotTypePciExpressGen3X8 = 0xB5, + SlotTypePciExpressGen3X16 = 0xB6 +}; + +/* System Slots - Slot Data Bus Width. */ +enum slot_data_bus_bandwidth { + SlotDataBusWidthOther = 0x01, + SlotDataBusWidthUnknown = 0x02, + SlotDataBusWidth8Bit = 0x03, + SlotDataBusWidth16Bit = 0x04, + SlotDataBusWidth32Bit = 0x05, + SlotDataBusWidth64Bit = 0x06, + SlotDataBusWidth128Bit = 0x07, + SlotDataBusWidth1X = 0x08, + SlotDataBusWidth2X = 0x09, + SlotDataBusWidth4X = 0x0A, + SlotDataBusWidth8X = 0x0B, + SlotDataBusWidth12X = 0x0C, + SlotDataBusWidth16X = 0x0D, + SlotDataBusWidth32X = 0x0E +}; + +/* System Slots - Current Usage. */ +enum misc_slot_usage { + SlotUsageOther = 0x01, + SlotUsageUnknown = 0x02, + SlotUsageAvailable = 0x03, + SlotUsageInUse = 0x04, + SlotUsageUnavailable = 0x05 +}; + +/* System Slots - Slot Length.*/ +enum misc_slot_length { + SlotLengthOther = 0x01, + SlotLengthUnknown = 0x02, + SlotLengthShort = 0x03, + SlotLengthLong = 0x04 +}; + +/* System Slots - Slot Characteristics 1. */ +#define SMBIOS_SLOT_UNKNOWN (1 << 0) +#define SMBIOS_SLOT_5V (1 << 1) +#define SMBIOS_SLOT_3P3V (1 << 2) +#define SMBIOS_SLOT_SHARED (1 << 3) +#define SMBIOS_SLOT_PCCARD_16 (1 << 4) +#define SMBIOS_SLOT_PCCARD_CARDBUS (1 << 5) +#define SMBIOS_SLOT_PCCARD_ZOOM (1 << 6) +#define SMBIOS_SLOT_PCCARD_MODEM_RING (1 << 7) +/* System Slots - Slot Characteristics 2. */ +#define SMBIOS_SLOT_PME (1 << 0) +#define SMBIOS_SLOT_HOTPLUG (1 << 1) +#define SMBIOS_SLOT_SMBUS (1 << 2) +#define SMBIOS_SLOT_BIFURCATION (1 << 3) + +struct slot_peer_groups { + u16 peer_seg_num; + u8 peer_bus_num; + u8 peer_dev_fn_num; + u8 peer_data_bus_width; +} __packed; + +struct smbios_type9 { + u8 type; + u8 length; + u16 handle; + u8 slot_designation; + u8 slot_type; + u8 slot_data_bus_width; + u8 current_usage; + u8 slot_length; + u16 slot_id; + u8 slot_characteristics_1; + u8 slot_characteristics_2; + u16 segment_group_number; + u8 bus_number; + u8 device_function_number; + u8 data_bus_width; + u8 peer_group_count; + struct slot_peer_groups peer[0]; + u8 eos[2]; +} __packed; + struct smbios_type11 { u8 type; u8 length;
Nico Huber has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/32293 )
Change subject: smbios: Add memory type 9 system slot support ......................................................................
Patch Set 11:
Is it too late to fix the CamelCase? All other enums in `smbios.h` are all-caps.