mptable: reindent code to comply with coreboot coding style
Change-Id: Iee27c535f56ebedaceea542c2919cde68006827c Signed-off-by: Sven Schnelle <svens@stackframe.org> Reviewed-on: http://review.coreboot.org/1111 Tested-by: build bot (Jenkins)
This commit is contained in:
parent
09a180230a
commit
b00c9a2257
|
@ -97,8 +97,7 @@ typedef struct BUSTYPENAME {
|
||||||
char name[7];
|
char name[7];
|
||||||
} busTypeName;
|
} busTypeName;
|
||||||
|
|
||||||
static busTypeName busTypeTable[] =
|
static busTypeName busTypeTable[] = {
|
||||||
{
|
|
||||||
{CBUS, "CBUS"},
|
{CBUS, "CBUS"},
|
||||||
{CBUSII, "CBUSII"},
|
{CBUSII, "CBUSII"},
|
||||||
{EISA, "EISA"},
|
{EISA, "EISA"},
|
||||||
|
@ -136,8 +135,7 @@ typedef struct TABLE_ENTRY {
|
||||||
char name[32];
|
char name[32];
|
||||||
} tableEntry;
|
} tableEntry;
|
||||||
|
|
||||||
tableEntry basetableEntryTypes[] =
|
tableEntry basetableEntryTypes[] = {
|
||||||
{
|
|
||||||
{0, 20, "Processor"},
|
{0, 20, "Processor"},
|
||||||
{1, 8, "Bus"},
|
{1, 8, "Bus"},
|
||||||
{2, 8, "I/O APIC"},
|
{2, 8, "I/O APIC"},
|
||||||
|
@ -145,8 +143,7 @@ tableEntry basetableEntryTypes[] =
|
||||||
{4, 8, "Local INT"}
|
{4, 8, "Local INT"}
|
||||||
};
|
};
|
||||||
|
|
||||||
tableEntry extendedtableEntryTypes[] =
|
tableEntry extendedtableEntryTypes[] = {
|
||||||
{
|
|
||||||
{128, 20, "System Address Space"},
|
{128, 20, "System Address Space"},
|
||||||
{129, 8, "Bus Heirarchy"},
|
{129, 8, "Bus Heirarchy"},
|
||||||
{130, 8, "Compatibility Bus Address"}
|
{130, 8, "Compatibility Bus Address"}
|
||||||
|
@ -183,7 +180,6 @@ typedef struct MPCTH {
|
||||||
uint8_t reserved;
|
uint8_t reserved;
|
||||||
} mpcth_t;
|
} mpcth_t;
|
||||||
|
|
||||||
|
|
||||||
typedef struct PROCENTRY {
|
typedef struct PROCENTRY {
|
||||||
uint8_t type;
|
uint8_t type;
|
||||||
uint8_t apicID;
|
uint8_t apicID;
|
||||||
|
@ -219,7 +215,6 @@ typedef struct INTENTRY {
|
||||||
uint8_t dstApicINT;
|
uint8_t dstApicINT;
|
||||||
} IntEntry;
|
} IntEntry;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* extended entry type structures
|
* extended entry type structures
|
||||||
*/
|
*/
|
||||||
|
@ -233,7 +228,6 @@ typedef struct SASENTRY {
|
||||||
uint64_t addressLength;
|
uint64_t addressLength;
|
||||||
} SasEntry;
|
} SasEntry;
|
||||||
|
|
||||||
|
|
||||||
typedef struct BHDENTRY {
|
typedef struct BHDENTRY {
|
||||||
uint8_t type;
|
uint8_t type;
|
||||||
uint8_t length;
|
uint8_t length;
|
||||||
|
@ -243,7 +237,6 @@ typedef struct BHDENTRY {
|
||||||
uint8_t reserved[3];
|
uint8_t reserved[3];
|
||||||
} BhdEntry;
|
} BhdEntry;
|
||||||
|
|
||||||
|
|
||||||
typedef struct CBASMENTRY {
|
typedef struct CBASMENTRY {
|
||||||
uint8_t type;
|
uint8_t type;
|
||||||
uint8_t length;
|
uint8_t length;
|
||||||
|
@ -252,7 +245,6 @@ typedef struct CBASMENTRY {
|
||||||
uint32_t predefinedRange;
|
uint32_t predefinedRange;
|
||||||
} CbasmEntry;
|
} CbasmEntry;
|
||||||
|
|
||||||
|
|
||||||
typedef uint32_t vm_offset_t;
|
typedef uint32_t vm_offset_t;
|
||||||
|
|
||||||
static void apic_probe(vm_offset_t * paddr, int *where);
|
static void apic_probe(vm_offset_t * paddr, int *where);
|
||||||
|
@ -337,24 +329,23 @@ char *postamble[] = {
|
||||||
0
|
0
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void usage(void)
|
||||||
usage( void )
|
|
||||||
{
|
{
|
||||||
fprintf( stderr, "usage: mptable [-dmesg] [-verbose] [-grope] [-help]\n" );
|
fprintf(stderr,
|
||||||
|
"usage: mptable [-dmesg] [-verbose] [-grope] [-help]\n");
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void write_code(char **code)
|
||||||
write_code(char **code)
|
|
||||||
{
|
{
|
||||||
while (*code)
|
while (*code)
|
||||||
printf("%s\n", *code++);
|
printf("%s\n", *code++);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
int
|
int main(int argc, char *argv[])
|
||||||
main( int argc, char *argv[] )
|
|
||||||
{
|
{
|
||||||
vm_offset_t paddr;
|
vm_offset_t paddr;
|
||||||
int where;
|
int where;
|
||||||
|
@ -363,9 +354,11 @@ main( int argc, char *argv[] )
|
||||||
|
|
||||||
/* announce ourselves */
|
/* announce ourselves */
|
||||||
|
|
||||||
if (verbose) puts( SEP_LINE2 );
|
if (verbose)
|
||||||
|
puts(SEP_LINE2);
|
||||||
|
|
||||||
printf( "/* generated by MPTable, version %d.%d.%d*/\n", VMAJOR, VMINOR, VDELTA );
|
printf("/* generated by MPTable, version %d.%d.%d*/\n", VMAJOR, VMINOR,
|
||||||
|
VDELTA);
|
||||||
printf("/* as modified by RGM for coreboot */\n");
|
printf("/* as modified by RGM for coreboot */\n");
|
||||||
write_code(preamble);
|
write_code(preamble);
|
||||||
|
|
||||||
|
@ -374,18 +367,16 @@ main( int argc, char *argv[] )
|
||||||
for (argc--, argv++; argc; argc--, argv++) {
|
for (argc--, argv++; argc; argc--, argv++) {
|
||||||
if (strcmp(argv[0], "-dmesg") == 0) {
|
if (strcmp(argv[0], "-dmesg") == 0) {
|
||||||
dmesg = 1;
|
dmesg = 1;
|
||||||
} else
|
} else if (strcmp(argv[0], "-help") == 0) {
|
||||||
if ( strcmp( argv[0], "-help") == 0 )
|
|
||||||
{
|
|
||||||
usage();
|
usage();
|
||||||
} else
|
} else if (strcmp(argv[0], "-grope") == 0) {
|
||||||
if ( strcmp( argv[0], "-grope") == 0 ){
|
|
||||||
grope = 1;
|
grope = 1;
|
||||||
} else if (strcmp(argv[0], "-verbose") == 0)
|
} else if (strcmp(argv[0], "-verbose") == 0)
|
||||||
verbose = 1;
|
verbose = 1;
|
||||||
else if (strcmp(argv[0], "-noisy") == 0)
|
else if (strcmp(argv[0], "-noisy") == 0)
|
||||||
noisy = 1;
|
noisy = 1;
|
||||||
else usage();
|
else
|
||||||
|
usage();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* open physical memory for access to MP structures */
|
/* open physical memory for access to MP structures */
|
||||||
|
@ -404,12 +395,14 @@ main( int argc, char *argv[] )
|
||||||
printf("\n MP FPS found in %s @ physical addr: 0x%08x\n",
|
printf("\n MP FPS found in %s @ physical addr: 0x%08x\n",
|
||||||
whereStrings[where - 1], paddr);
|
whereStrings[where - 1], paddr);
|
||||||
|
|
||||||
if (verbose) puts( SEP_LINE );
|
if (verbose)
|
||||||
|
puts(SEP_LINE);
|
||||||
|
|
||||||
/* analyze the MP Floating Pointer Structure */
|
/* analyze the MP Floating Pointer Structure */
|
||||||
MPFloatingPointer(paddr, where, &mpfps);
|
MPFloatingPointer(paddr, where, &mpfps);
|
||||||
|
|
||||||
if (verbose) puts( SEP_LINE );
|
if (verbose)
|
||||||
|
puts(SEP_LINE);
|
||||||
|
|
||||||
/* check whether an MP config table exists */
|
/* check whether an MP config table exists */
|
||||||
if ((defaultConfig = mpfps.mpfb1))
|
if ((defaultConfig = mpfps.mpfb1))
|
||||||
|
@ -426,18 +419,17 @@ main( int argc, char *argv[] )
|
||||||
if (dmesg)
|
if (dmesg)
|
||||||
doDmesg();
|
doDmesg();
|
||||||
|
|
||||||
if (verbose) puts( SEP_LINE2 );
|
if (verbose)
|
||||||
|
puts(SEP_LINE2);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* set PHYSICAL address of MP floating pointer structure
|
* set PHYSICAL address of MP floating pointer structure
|
||||||
*/
|
*/
|
||||||
#define NEXT(X) ((X) += 4)
|
#define NEXT(X) ((X) += 4)
|
||||||
static void
|
static void apic_probe(vm_offset_t * paddr, int *where)
|
||||||
apic_probe( vm_offset_t* paddr, int* where )
|
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* c rewrite of apic_probe() by Jack F. Vogel
|
* c rewrite of apic_probe() by Jack F. Vogel
|
||||||
|
@ -470,8 +462,7 @@ apic_probe( vm_offset_t* paddr, int* where )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if (verbose)
|
if (verbose)
|
||||||
printf("NOT found\n");
|
printf("NOT found\n");
|
||||||
}
|
}
|
||||||
|
@ -492,7 +483,6 @@ apic_probe( vm_offset_t* paddr, int* where )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* read CMOS for real top of mem */
|
/* read CMOS for real top of mem */
|
||||||
seekEntry((vm_offset_t) TOPOFMEM_POINTER);
|
seekEntry((vm_offset_t) TOPOFMEM_POINTER);
|
||||||
readEntry(&segment, 2);
|
readEntry(&segment, 2);
|
||||||
|
@ -516,7 +506,8 @@ apic_probe( vm_offset_t* paddr, int* where )
|
||||||
if (target != (DEFAULT_TOPOFMEM - 1024)) {
|
if (target != (DEFAULT_TOPOFMEM - 1024)) {
|
||||||
target = (DEFAULT_TOPOFMEM - 1024);
|
target = (DEFAULT_TOPOFMEM - 1024);
|
||||||
if (verbose)
|
if (verbose)
|
||||||
printf( " searching default 'top of mem' @ 0x%08x (%dK)\n",
|
printf
|
||||||
|
(" searching default 'top of mem' @ 0x%08x (%dK)\n",
|
||||||
target, (target / 1024));
|
target, (target / 1024));
|
||||||
seekEntry(target);
|
seekEntry(target);
|
||||||
readEntry(buffer, ONE_KBYTE);
|
readEntry(buffer, ONE_KBYTE);
|
||||||
|
@ -569,7 +560,8 @@ apic_probe( vm_offset_t* paddr, int* where )
|
||||||
for (x = 0; x < GROPE_SIZE / sizeof(unsigned int); NEXT(x)) {
|
for (x = 0; x < GROPE_SIZE / sizeof(unsigned int); NEXT(x)) {
|
||||||
if (buffer[x] == MP_SIG) {
|
if (buffer[x] == MP_SIG) {
|
||||||
*where = 6;
|
*where = 6;
|
||||||
*paddr = (x * sizeof( unsigned int )) + GROPE_AREA1;
|
*paddr =
|
||||||
|
(x * sizeof(unsigned int)) + GROPE_AREA1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -583,7 +575,8 @@ apic_probe( vm_offset_t* paddr, int* where )
|
||||||
for (x = 0; x < GROPE_SIZE / sizeof(unsigned int); NEXT(x)) {
|
for (x = 0; x < GROPE_SIZE / sizeof(unsigned int); NEXT(x)) {
|
||||||
if (buffer[x] == MP_SIG) {
|
if (buffer[x] == MP_SIG) {
|
||||||
*where = 7;
|
*where = 7;
|
||||||
*paddr = (x * sizeof( unsigned int )) + GROPE_AREA2;
|
*paddr =
|
||||||
|
(x * sizeof(unsigned int)) + GROPE_AREA2;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -593,12 +586,10 @@ apic_probe( vm_offset_t* paddr, int* where )
|
||||||
*paddr = (vm_offset_t) 0;
|
*paddr = (vm_offset_t) 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static void
|
static void MPFloatingPointer(vm_offset_t paddr, int where, mpfps_t * mpfps)
|
||||||
MPFloatingPointer( vm_offset_t paddr, int where, mpfps_t* mpfps )
|
|
||||||
{
|
{
|
||||||
|
|
||||||
/* read in mpfps structure */
|
/* read in mpfps structure */
|
||||||
|
@ -610,8 +601,7 @@ MPFloatingPointer( vm_offset_t paddr, int where, mpfps_t* mpfps )
|
||||||
printf("MP Floating Pointer Structure:\n\n");
|
printf("MP Floating Pointer Structure:\n\n");
|
||||||
|
|
||||||
printf(" location:\t\t\t");
|
printf(" location:\t\t\t");
|
||||||
switch ( where )
|
switch (where) {
|
||||||
{
|
|
||||||
case 1:
|
case 1:
|
||||||
printf("EBDA\n");
|
printf("EBDA\n");
|
||||||
break;
|
break;
|
||||||
|
@ -647,7 +637,8 @@ MPFloatingPointer( vm_offset_t paddr, int where, mpfps_t* mpfps )
|
||||||
|
|
||||||
/* bits 0:6 are RESERVED */
|
/* bits 0:6 are RESERVED */
|
||||||
if (mpfps->mpfb2 & 0x7f) {
|
if (mpfps->mpfb2 & 0x7f) {
|
||||||
printf( " warning, MP feature byte 2: 0x%02x\n", mpfps->mpfb2 );
|
printf(" warning, MP feature byte 2: 0x%02x\n",
|
||||||
|
mpfps->mpfb2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* bit 7 is IMCRP */
|
/* bit 7 is IMCRP */
|
||||||
|
@ -664,12 +655,10 @@ MPFloatingPointer( vm_offset_t paddr, int where, mpfps_t* mpfps )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static void
|
static void MPConfigDefault(int featureByte)
|
||||||
MPConfigDefault( int featureByte )
|
|
||||||
{
|
{
|
||||||
printf(" MP default config type: %d\n\n", featureByte);
|
printf(" MP default config type: %d\n\n", featureByte);
|
||||||
switch (featureByte) {
|
switch (featureByte) {
|
||||||
|
@ -721,12 +710,10 @@ MPConfigDefault( int featureByte )
|
||||||
nintr = 16;
|
nintr = 16;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static void
|
static void MPConfigTableHeader(uint32_t pap)
|
||||||
MPConfigTableHeader( uint32_t pap )
|
|
||||||
{
|
{
|
||||||
vm_offset_t paddr;
|
vm_offset_t paddr;
|
||||||
mpcth_t cth;
|
mpcth_t cth;
|
||||||
|
@ -769,22 +756,26 @@ MPConfigTableHeader( uint32_t pap )
|
||||||
pnstr(cth.product_id, 12);
|
pnstr(cth.product_id, 12);
|
||||||
printf("'\n");
|
printf("'\n");
|
||||||
|
|
||||||
printf( " OEM table pointer:\t\t0x%08x\n", cth.oem_table_pointer );
|
printf(" OEM table pointer:\t\t0x%08x\n",
|
||||||
|
cth.oem_table_pointer);
|
||||||
printf(" OEM table size:\t\t%d\n", cth.oem_table_size);
|
printf(" OEM table size:\t\t%d\n", cth.oem_table_size);
|
||||||
|
|
||||||
printf(" entry count:\t\t\t%d\n", cth.entry_count);
|
printf(" entry count:\t\t\t%d\n", cth.entry_count);
|
||||||
|
|
||||||
printf(" local APIC address:\t\t0x%08x\n", cth.apic_address);
|
printf(" local APIC address:\t\t0x%08x\n", cth.apic_address);
|
||||||
|
|
||||||
printf( " extended table length:\t%d\n", cth.extended_table_length );
|
printf(" extended table length:\t%d\n",
|
||||||
printf( " extended table checksum:\t%d\n", cth.extended_table_checksum );
|
cth.extended_table_length);
|
||||||
|
printf(" extended table checksum:\t%d\n",
|
||||||
|
cth.extended_table_checksum);
|
||||||
}
|
}
|
||||||
|
|
||||||
totalSize = cth.base_table_length - sizeof(struct MPCTH);
|
totalSize = cth.base_table_length - sizeof(struct MPCTH);
|
||||||
count = cth.entry_count;
|
count = cth.entry_count;
|
||||||
|
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
if (verbose) puts( SEP_LINE );
|
if (verbose)
|
||||||
|
puts(SEP_LINE);
|
||||||
|
|
||||||
printf("MP Config Base Table Entries:\n\n");
|
printf("MP Config Base Table Entries:\n\n");
|
||||||
}
|
}
|
||||||
|
@ -827,7 +818,8 @@ MPConfigTableHeader( uint32_t pap )
|
||||||
}
|
}
|
||||||
|
|
||||||
/* process all the I/O Ints */
|
/* process all the I/O Ints */
|
||||||
printf( "/*I/O Ints:\tType\tPolarity Trigger\tBus ID\t IRQ\tAPIC ID\tPIN#\n*/" );
|
printf
|
||||||
|
("/*I/O Ints:\tType\tPolarity Trigger\tBus ID\t IRQ\tAPIC ID\tPIN#\n*/");
|
||||||
for (c = count; c; c--) {
|
for (c = count; c; c--) {
|
||||||
if (readType() == 3)
|
if (readType() == 3)
|
||||||
intEntry();
|
intEntry();
|
||||||
|
@ -835,18 +827,19 @@ MPConfigTableHeader( uint32_t pap )
|
||||||
}
|
}
|
||||||
|
|
||||||
/* process all the Local Ints */
|
/* process all the Local Ints */
|
||||||
printf( "/*Local Ints:\tType\tPolarity Trigger\tBus ID\t IRQ\tAPIC ID\tPIN#*/\n" );
|
printf
|
||||||
|
("/*Local Ints:\tType\tPolarity Trigger\tBus ID\t IRQ\tAPIC ID\tPIN#*/\n");
|
||||||
for (c = count; c; c--) {
|
for (c = count; c; c--) {
|
||||||
if (readType() == 4)
|
if (readType() == 4)
|
||||||
lintEntry();
|
lintEntry();
|
||||||
totalSize -= basetableEntryTypes[4].length;
|
totalSize -= basetableEntryTypes[4].length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if defined( EXTENDED_PROCESSING_READY )
|
#if defined( EXTENDED_PROCESSING_READY )
|
||||||
/* process any extended data */
|
/* process any extended data */
|
||||||
if ((totalSize = cth.extended_table_length)) {
|
if ((totalSize = cth.extended_table_length)) {
|
||||||
if (verbose) puts( SEP_LINE );
|
if (verbose)
|
||||||
|
puts(SEP_LINE);
|
||||||
|
|
||||||
printf("MP Config Extended Table Entries:\n\n");
|
printf("MP Config Extended Table Entries:\n\n");
|
||||||
|
|
||||||
|
@ -889,7 +882,8 @@ MPConfigTableHeader( uint32_t pap )
|
||||||
|
|
||||||
free(oemdata);
|
free(oemdata);
|
||||||
#else
|
#else
|
||||||
printf( "\nyou need to modify the source to handle OEM data!\n\n" );
|
printf
|
||||||
|
("\nyou need to modify the source to handle OEM data!\n\n");
|
||||||
#endif /* OEM_PROCESSING_READY */
|
#endif /* OEM_PROCESSING_READY */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -909,12 +903,10 @@ MPConfigTableHeader( uint32_t pap )
|
||||||
#endif /* RAW_DUMP */
|
#endif /* RAW_DUMP */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static int
|
static int readType(void)
|
||||||
readType( void )
|
|
||||||
{
|
{
|
||||||
u_char type;
|
u_char type;
|
||||||
|
|
||||||
|
@ -927,31 +919,25 @@ readType( void )
|
||||||
return (int)type;
|
return (int)type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static void
|
static void seekEntry(vm_offset_t addr)
|
||||||
seekEntry( vm_offset_t addr )
|
|
||||||
{
|
{
|
||||||
if (lseek(pfd, (off_t) addr, SEEK_SET) < 0)
|
if (lseek(pfd, (off_t) addr, SEEK_SET) < 0)
|
||||||
err(1, "/dev/mem seek");
|
err(1, "/dev/mem seek");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static void
|
static void readEntry(void *entry, int size)
|
||||||
readEntry( void* entry, int size )
|
|
||||||
{
|
{
|
||||||
if (read(pfd, entry, size) != size)
|
if (read(pfd, entry, size) != size)
|
||||||
err(1, "readEntry");
|
err(1, "readEntry");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void processorEntry(void)
|
||||||
static void
|
|
||||||
processorEntry( void )
|
|
||||||
{
|
{
|
||||||
ProcEntry entry;
|
ProcEntry entry;
|
||||||
|
|
||||||
|
@ -966,7 +952,8 @@ processorEntry( void )
|
||||||
|
|
||||||
printf("\t %s, %s",
|
printf("\t %s, %s",
|
||||||
(entry.cpuFlags & PROCENTRY_FLAG_BP) ? "BSP" : "AP",
|
(entry.cpuFlags & PROCENTRY_FLAG_BP) ? "BSP" : "AP",
|
||||||
(entry.cpuFlags & PROCENTRY_FLAG_EN) ? "usable" : "unusable" );
|
(entry.
|
||||||
|
cpuFlags & PROCENTRY_FLAG_EN) ? "usable" : "unusable");
|
||||||
|
|
||||||
printf("\t %d\t %d\t %d",
|
printf("\t %d\t %d\t %d",
|
||||||
(entry.cpuSignature >> 8) & 0x0f,
|
(entry.cpuSignature >> 8) & 0x0f,
|
||||||
|
@ -977,12 +964,10 @@ processorEntry( void )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static int
|
static int lookupBusType(char *name)
|
||||||
lookupBusType( char* name )
|
|
||||||
{
|
{
|
||||||
int x;
|
int x;
|
||||||
|
|
||||||
|
@ -993,9 +978,7 @@ lookupBusType( char* name )
|
||||||
return UNKNOWN_BUSTYPE;
|
return UNKNOWN_BUSTYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void busEntry(void)
|
||||||
static void
|
|
||||||
busEntry( void )
|
|
||||||
{
|
{
|
||||||
char name[8];
|
char name[8];
|
||||||
BusEntry entry;
|
BusEntry entry;
|
||||||
|
@ -1008,7 +991,9 @@ busEntry( void )
|
||||||
|
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
printf("\t\t%2d", entry.busID);
|
printf("\t\t%2d", entry.busID);
|
||||||
printf( "\t " ); pnstr( entry.busType, 6 ); printf( "\n" );
|
printf("\t ");
|
||||||
|
pnstr(entry.busType, 6);
|
||||||
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(name, '\0', sizeof(name));
|
memset(name, '\0', sizeof(name));
|
||||||
|
@ -1020,9 +1005,7 @@ busEntry( void )
|
||||||
printf("\");\n");
|
printf("\");\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void ioApicEntry(void)
|
||||||
static void
|
|
||||||
ioApicEntry( void )
|
|
||||||
{
|
{
|
||||||
IOApicEntry entry;
|
IOApicEntry entry;
|
||||||
|
|
||||||
|
@ -1036,7 +1019,9 @@ ioApicEntry( void )
|
||||||
printf("\t\t%2d", entry.apicID);
|
printf("\t\t%2d", entry.apicID);
|
||||||
printf("\t 0x%02x", entry.apicVersion);
|
printf("\t 0x%02x", entry.apicVersion);
|
||||||
printf("\t %s",
|
printf("\t %s",
|
||||||
(entry.apicFlags & IOAPICENTRY_FLAG_EN) ? "usable" : "unusable" );
|
(entry.
|
||||||
|
apicFlags & IOAPICENTRY_FLAG_EN) ? "usable" :
|
||||||
|
"unusable");
|
||||||
printf("\t\t 0x%x\n", entry.apicAddress);
|
printf("\t\t 0x%x\n", entry.apicAddress);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1047,20 +1032,21 @@ ioApicEntry( void )
|
||||||
entry.apicID, entry.apicVersion, entry.apicAddress);
|
entry.apicID, entry.apicVersion, entry.apicAddress);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
char *intTypes[] = {
|
char *intTypes[] = {
|
||||||
"mp_INT", "mp_NMI", "mp_SMI", "mp_ExtINT"
|
"mp_INT", "mp_NMI", "mp_SMI", "mp_ExtINT"
|
||||||
};
|
};
|
||||||
|
|
||||||
char *polarityMode[] = {
|
char *polarityMode[] = {
|
||||||
"MP_IRQ_POLARITY_DEFAULT", "MP_IRQ_POLARITY_HIGH", "reserved", "MP_IRQ_POLARITY_LOW"
|
"MP_IRQ_POLARITY_DEFAULT", "MP_IRQ_POLARITY_HIGH", "reserved",
|
||||||
};
|
"MP_IRQ_POLARITY_LOW"
|
||||||
char* triggerMode[] = {
|
|
||||||
"MP_IRQ_TRIGGER_DEFAULT", "MP_IRQ_TRIGGER_EDGE", "reserved", "MP_IRQ_TRIGGER_LEVEL"
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
char *triggerMode[] = {
|
||||||
intEntry( void )
|
"MP_IRQ_TRIGGER_DEFAULT", "MP_IRQ_TRIGGER_EDGE", "reserved",
|
||||||
|
"MP_IRQ_TRIGGER_LEVEL"
|
||||||
|
};
|
||||||
|
|
||||||
|
static void intEntry(void)
|
||||||
{
|
{
|
||||||
IntEntry entry;
|
IntEntry entry;
|
||||||
|
|
||||||
|
@ -1085,8 +1071,7 @@ intEntry( void )
|
||||||
else
|
else
|
||||||
printf("\t 0x%x:0x%x(0x%x)",
|
printf("\t 0x%x:0x%x(0x%x)",
|
||||||
(int)entry.srcBusIRQ >> 2,
|
(int)entry.srcBusIRQ >> 2,
|
||||||
(int)entry.srcBusIRQ & 3,
|
(int)entry.srcBusIRQ & 3, (int)entry.srcBusIRQ);
|
||||||
(int)entry.srcBusIRQ );
|
|
||||||
printf("\t %6d", (int)entry.dstApicID);
|
printf("\t %6d", (int)entry.dstApicID);
|
||||||
printf("\t %3d\n", (int)entry.dstApicINT);
|
printf("\t %3d\n", (int)entry.dstApicINT);
|
||||||
}
|
}
|
||||||
|
@ -1096,13 +1081,11 @@ intEntry( void )
|
||||||
polarityMode[(int)entry.intFlags & 0x03],
|
polarityMode[(int)entry.intFlags & 0x03],
|
||||||
(int)entry.srcBusID,
|
(int)entry.srcBusID,
|
||||||
(int)entry.srcBusIRQ,
|
(int)entry.srcBusIRQ,
|
||||||
(int)entry.dstApicID ,
|
(int)entry.dstApicID, (int)entry.dstApicINT);
|
||||||
(int)entry.dstApicINT );
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void lintEntry(void)
|
||||||
lintEntry( void )
|
|
||||||
{
|
{
|
||||||
IntEntry entry;
|
IntEntry entry;
|
||||||
|
|
||||||
|
@ -1129,19 +1112,16 @@ lintEntry( void )
|
||||||
printf("\t %6d", (int)entry.dstApicID);
|
printf("\t %6d", (int)entry.dstApicID);
|
||||||
printf("\t %3d\n", (int)entry.dstApicINT);
|
printf("\t %3d\n", (int)entry.dstApicINT);
|
||||||
}
|
}
|
||||||
printf("\tsmp_write_lintsrc(mc, %s, %s|%s, 0x%x, 0x%x, MP_APIC_ALL, 0x%x);\n",
|
printf
|
||||||
|
("\tsmp_write_lintsrc(mc, %s, %s|%s, 0x%x, 0x%x, MP_APIC_ALL, 0x%x);\n",
|
||||||
intTypes[(int)entry.intType],
|
intTypes[(int)entry.intType],
|
||||||
triggerMode[((int)entry.intFlags >> 2) & 0x03],
|
triggerMode[((int)entry.intFlags >> 2) & 0x03],
|
||||||
polarityMode[ (int)entry.intFlags & 0x03 ],
|
polarityMode[(int)entry.intFlags & 0x03], (int)entry.srcBusID,
|
||||||
(int)entry.srcBusID,
|
(int)entry.srcBusIRQ, (int)entry.dstApicINT);
|
||||||
(int)entry.srcBusIRQ,
|
|
||||||
(int)entry.dstApicINT );
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void sasEntry(void)
|
||||||
static void
|
|
||||||
sasEntry( void )
|
|
||||||
{
|
{
|
||||||
SasEntry entry;
|
SasEntry entry;
|
||||||
|
|
||||||
|
@ -1170,9 +1150,7 @@ sasEntry( void )
|
||||||
printf(" address range: 0x%lx\n", entry.addressLength);
|
printf(" address range: 0x%lx\n", entry.addressLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void bhdEntry(void)
|
||||||
static void
|
|
||||||
bhdEntry( void )
|
|
||||||
{
|
{
|
||||||
BhdEntry entry;
|
BhdEntry entry;
|
||||||
|
|
||||||
|
@ -1185,9 +1163,7 @@ bhdEntry( void )
|
||||||
printf(" parent bus ID: %d", entry.busParent);
|
printf(" parent bus ID: %d", entry.busParent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void cbasmEntry(void)
|
||||||
static void
|
|
||||||
cbasmEntry( void )
|
|
||||||
{
|
{
|
||||||
CbasmEntry entry;
|
CbasmEntry entry;
|
||||||
|
|
||||||
|
@ -1201,28 +1177,26 @@ cbasmEntry( void )
|
||||||
printf(" predefined range: 0x%08x", entry.predefinedRange);
|
printf(" predefined range: 0x%08x", entry.predefinedRange);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* do a dmesg output
|
* do a dmesg output
|
||||||
*/
|
*/
|
||||||
static void
|
static void doDmesg(void)
|
||||||
doDmesg( void )
|
|
||||||
{
|
{
|
||||||
if (verbose) puts( SEP_LINE );
|
if (verbose)
|
||||||
|
puts(SEP_LINE);
|
||||||
|
|
||||||
printf("dmesg output:\n\n");
|
printf("dmesg output:\n\n");
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
system("dmesg");
|
system("dmesg");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* build "options" entries for the kernel config file
|
* build "options" entries for the kernel config file
|
||||||
*/
|
*/
|
||||||
static void
|
static void doOptionList(void)
|
||||||
doOptionList( void )
|
|
||||||
{
|
{
|
||||||
if (verbose) puts( SEP_LINE );
|
if (verbose)
|
||||||
|
puts(SEP_LINE);
|
||||||
|
|
||||||
printf("# SMP kernel config file options:\n\n");
|
printf("# SMP kernel config file options:\n\n");
|
||||||
printf("\n# Required:\n");
|
printf("\n# Required:\n");
|
||||||
|
@ -1231,18 +1205,18 @@ doOptionList( void )
|
||||||
|
|
||||||
printf("\n# Optional (built-in defaults will work in most cases):\n");
|
printf("\n# Optional (built-in defaults will work in most cases):\n");
|
||||||
printf("#options NCPU=%d\t\t\t# number of CPUs\n", ncpu);
|
printf("#options NCPU=%d\t\t\t# number of CPUs\n", ncpu);
|
||||||
printf( "#options NBUS=%d\t\t\t# number of busses\n", nbus );
|
printf("#options NBUS=%d\t\t\t# number of busses\n",
|
||||||
printf( "#options NAPIC=%d\t\t\t# number of IO APICs\n", napic );
|
nbus);
|
||||||
|
printf("#options NAPIC=%d\t\t\t# number of IO APICs\n",
|
||||||
|
napic);
|
||||||
printf("#options NINTR=%d\t\t# number of INTs\n",
|
printf("#options NINTR=%d\t\t# number of INTs\n",
|
||||||
(nintr < 24) ? 24 : nintr);
|
(nintr < 24) ? 24 : nintr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static void
|
static void pnstr(uint8_t * s, int c)
|
||||||
pnstr( uint8_t* s, int c )
|
|
||||||
{
|
{
|
||||||
uint8_t string[MAXPNSTR + 1];
|
uint8_t string[MAXPNSTR + 1];
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue