Date: Wed, 4 May 2011 18:25:40 GMT From: John Baldwin <jhb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 192609 for review Message-ID: <201105041825.p44IPeGx079270@skunkworks.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@192609?ac=10 Change 192609 by jhb@jhb_jhbbsd on 2011/05/04 18:25:06 Add support for parsing MP config table extended entries. Affected files ... .. //depot/projects/pci/sys/x86/include/mptable.h#2 edit .. //depot/projects/pci/sys/x86/x86/mptable.c#2 edit Differences ... ==== //depot/projects/pci/sys/x86/include/mptable.h#2 (text+ko) ==== @@ -78,6 +78,8 @@ #define MPCT_ENTRY_INT 3 #define MPCT_ENTRY_LOCAL_INT 4 +/* Base table entries */ + typedef struct PROCENTRY { u_char type; u_char apic_id; @@ -132,7 +134,52 @@ #define INTENTRY_FLAGS_TRIGGER_EDGE 0x4 #define INTENTRY_FLAGS_TRIGGER_LEVEL 0xc -/* descriptions of MP basetable entries */ +/* Extended table entries */ + +typedef struct EXTENTRY { + u_char type; + u_char length; +} *ext_entry_ptr; + +typedef struct SASENTRY { + u_char type; + u_char length; + u_char bus_id; + u_char address_type; + uint64_t address_base; + uint64_t address_length; +} __attribute__((__packed__)) *sas_entry_ptr; + +#define SASENTRY_TYPE_IO 0 +#define SASENTRY_TYPE_MEMORY 1 +#define SASENTRY_TYPE_PREFETCH 2 + +typedef struct BHDENTRY { + u_char type; + u_char length; + u_char bus_id; + u_char bus_info; + u_char parent_bus; + u_char reserved[3]; +} *bhd_entry_ptr; + +#define BHDENTRY_INFO_SUBTRACTIVE_DECODE 0x1 + +typedef struct CBASMENTRY { + u_char type; + u_char length; + u_char bus_id; + u_char address_mod; + u_int predefined_range; +} *cbasm_entry_ptr; + +#define CBASMENTRY_ADDRESS_MOD_ADD 0x0 +#define CBASMENTRY_ADDRESS_MOD_SUBTRACT 0x1 + +#define CBASMENTRY_RANGE_ISA_IO 0 +#define CBASMENTRY_RANGE_VGA_IO 1 + +/* descriptions of MP table entries */ typedef struct BASETABLE_ENTRY { u_char type; u_char length; ==== //depot/projects/pci/sys/x86/x86/mptable.c#2 (text+ko) ==== @@ -67,6 +67,7 @@ #define BIOS_COUNT (BIOS_SIZE/4) typedef void mptable_entry_handler(u_char *entry, void *arg); +typedef void mptable_extended_entry_handler(ext_entry_ptr *entry, void *arg); static basetable_entry basetable_entry_types[] = { @@ -146,6 +147,7 @@ static mpfps_t mpfps; static mpcth_t mpct; +static char *mpet; static void *ioapics[MAX_APIC_ID + 1]; static bus_datum *busses; static int mptable_nioapics, mptable_nbusses, mptable_maxbusid; @@ -181,6 +183,8 @@ static void mptable_register(void *dummy); static int mptable_setup_local(void); static int mptable_setup_io(void); +static void mptable_walk_extended_table( + mptable_extended_entry_handler *handler, void *arg); static void mptable_walk_table(mptable_entry_handler *handler, void *arg); static int search_for_sig(u_int32_t target, int count); @@ -281,6 +285,11 @@ __func__); return (ENXIO); } + if (mpct->extended_table_length != 0 && + mpct->extended_table_length + mpct->base_table_length + + (uintptr_t)mpfps->pap < 1024 * 1024) + mpet = (ext_entry_ptr)((char *)mpct + + mpct->base_table_length); if (mpct->signature[0] != 'P' || mpct->signature[1] != 'C' || mpct->signature[2] != 'M' || mpct->signature[3] != 'P') { printf("%s: MP Config Table has bad signature: %c%c%c%c\n", @@ -393,7 +402,7 @@ NULL); /* - * Call the handler routine for each entry in the MP config table. + * Call the handler routine for each entry in the MP config base table. */ static void mptable_walk_table(mptable_entry_handler *handler, void *arg) @@ -419,6 +428,25 @@ } } +/* + * Call the handler routine for each entry in the MP config extended + * table. + */ +static void +mptable_walk_extended_table(mptable_extended_entry_handler *handler, void *arg) +{ + ext_entry_ptr *end, *entry; + + if (mpet == NULL) + return; + entry = mpet; + end = (ext_entry_ptr)((char *)mpet + mpct->extended_table_length); + while (entry < end) { + handler(entry, arg); + entry = (ext_entry_ptr)((char *)entry + entry->length); + } +} + static void mptable_probe_cpus_handler(u_char *entry, void *arg) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201105041825.p44IPeGx079270>