Mercurial > illumos > illumos-gate
changeset 3606:f8d6924e5a84
6521623 dboot: need to create properties from ACPI SLIT early in boot
author | myers |
---|---|
date | Tue, 06 Feb 2007 17:55:02 -0800 |
parents | 16b1da2c7b52 |
children | 288ca557ca70 |
files | usr/src/uts/i86pc/os/acpi_fw.h usr/src/uts/i86pc/os/fakebop.c |
diffstat | 2 files changed, 41 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/usr/src/uts/i86pc/os/acpi_fw.h Tue Feb 06 16:54:41 2007 -0800 +++ b/usr/src/uts/i86pc/os/acpi_fw.h Tue Feb 06 17:55:02 2007 -0800 @@ -138,6 +138,21 @@ #define SRAT_HOT_PLUG (2) #define SRAT_NON_VOLATILE (4) +struct slit { + struct table_header hdr; + uint64_t number; + uint8_t entry[1]; +}; + +/* + * Arbitrary limit on number of localities we handle; if + * this limit is raised to more than UINT16_MAX, make sure + * process_slit() knows how to handle it. + */ +#define SLIT_LOCALITIES_MAX (4096) + +#define SLIT_NUM_PROPNAME "acpi-slit-localities" +#define SLIT_PROPNAME "acpi-slit" #pragma pack()
--- a/usr/src/uts/i86pc/os/fakebop.c Tue Feb 06 16:54:41 2007 -0800 +++ b/usr/src/uts/i86pc/os/fakebop.c Tue Feb 06 17:55:02 2007 -0800 @@ -1477,6 +1477,29 @@ } static void +process_slit(struct slit *tp) +{ + + /* + * Check the number of localities; if it's too huge, we just + * return and locality enumeration code will handle this later, + * if possible. + * + * Note that the size of the table is the square of the + * number of localities; if the number of localities exceeds + * UINT16_MAX, the table size may overflow an int when being + * passed to bsetprop() below. + */ + if (tp->number >= SLIT_LOCALITIES_MAX) + return; + + bsetprop(SLIT_NUM_PROPNAME, strlen(SLIT_NUM_PROPNAME), &tp->number, + sizeof (tp->number)); + bsetprop(SLIT_PROPNAME, strlen(SLIT_PROPNAME), &tp->entry, + tp->number * tp->number); +} + +static void build_firmware_properties(void) { struct table_header *tp; @@ -1486,6 +1509,9 @@ if (tp = find_fw_table("SRAT")) process_srat((struct srat *)tp); + + if (tp = find_fw_table("SLIT")) + process_slit((struct slit *)tp); } /*