- Use <x86/mptable.h> instead of duplicating its definitions.

- Switch to mmaping the table from RAM instead of reading it out of
  /dev/mem via read(2).
This commit is contained in:
John Baldwin 2013-12-11 21:21:03 +00:00
parent b2b76a45bf
commit a61a3b338f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=259229

View File

@ -43,9 +43,12 @@ static const char rcsid[] =
#define OEM_PROCESSING_READY_NOT #define OEM_PROCESSING_READY_NOT
#include <sys/param.h> #include <sys/param.h>
#include <sys/mman.h>
#include <x86/mptable.h>
#include <err.h> #include <err.h>
#include <fcntl.h> #include <fcntl.h>
#include <paths.h> #include <paths.h>
#include <stdint.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@ -74,23 +77,8 @@ static const char rcsid[] =
#define GROPE_AREA2 0x90000 #define GROPE_AREA2 0x90000
#define GROPE_SIZE 0x10000 #define GROPE_SIZE 0x10000
#define PROCENTRY_FLAG_EN 0x01
#define PROCENTRY_FLAG_BP 0x02
#define IOAPICENTRY_FLAG_EN 0x01
#define MAXPNSTR 132 #define MAXPNSTR 132
enum busTypes {
CBUS = 1,
CBUSII = 2,
EISA = 3,
ISA = 6,
PCI = 13,
XPRESS = 18,
MAX_BUSTYPE = 18,
UNKNOWN_BUSTYPE = 0xff
};
typedef struct BUSTYPENAME { typedef struct BUSTYPENAME {
u_char type; u_char type;
char name[ 7 ]; char name[ 7 ];
@ -129,140 +117,25 @@ static const char *whereStrings[] = {
"GROPE AREA #2" "GROPE AREA #2"
}; };
typedef struct TABLE_ENTRY {
u_char type;
u_char length;
char name[ 32 ];
} tableEntry;
static const tableEntry extendedtableEntryTypes[] =
{
{ 128, 20, "System Address Space" },
{ 129, 8, "Bus Hierarchy" },
{ 130, 8, "Compatibility Bus Address" }
};
/* MP Floating Pointer Structure */
typedef struct MPFPS {
char signature[ 4 ];
u_int32_t pap;
u_char length;
u_char spec_rev;
u_char checksum;
u_char mpfb1;
u_char mpfb2;
u_char mpfb3;
u_char mpfb4;
u_char mpfb5;
} mpfps_t;
/* MP Configuration Table Header */
typedef struct MPCTH {
char signature[ 4 ];
u_short base_table_length;
u_char spec_rev;
u_char checksum;
u_char oem_id[ 8 ];
u_char product_id[ 12 ];
u_int32_t oem_table_pointer;
u_short oem_table_size;
u_short entry_count;
u_int32_t apic_address;
u_short extended_table_length;
u_char extended_table_checksum;
u_char reserved;
} mpcth_t;
typedef struct PROCENTRY {
u_char type;
u_char apicID;
u_char apicVersion;
u_char cpuFlags;
u_int32_t cpuSignature;
u_int32_t featureFlags;
u_int32_t reserved1;
u_int32_t reserved2;
} ProcEntry;
typedef struct BUSENTRY {
u_char type;
u_char busID;
char busType[ 6 ];
} BusEntry;
typedef struct IOAPICENTRY {
u_char type;
u_char apicID;
u_char apicVersion;
u_char apicFlags;
u_int32_t apicAddress;
} IOApicEntry;
typedef struct INTENTRY {
u_char type;
u_char intType;
u_short intFlags;
u_char srcBusID;
u_char srcBusIRQ;
u_char dstApicID;
u_char dstApicINT;
} IntEntry;
/*
* extended entry type structures
*/
typedef struct SASENTRY {
u_char type;
u_char length;
u_char busID;
u_char addressType;
u_int64_t addressBase;
u_int64_t addressLength;
} __attribute__((__packed__)) SasEntry;
typedef struct BHDENTRY {
u_char type;
u_char length;
u_char busID;
u_char busInfo;
u_char busParent;
u_char reserved[ 3 ];
} BhdEntry;
typedef struct CBASMENTRY {
u_char type;
u_char length;
u_char busID;
u_char addressMod;
u_int predefinedRange;
} CbasmEntry;
static void apic_probe( u_int32_t* paddr, int* where ); static void apic_probe( u_int32_t* paddr, int* where );
static void MPConfigDefault( int featureByte ); static void MPConfigDefault( int featureByte );
static void MPFloatingPointer( u_int32_t paddr, int where, mpfps_t* mpfps ); static void MPFloatingPointer( u_int32_t paddr, int where, mpfps_t* mpfpsp );
static void MPConfigTableHeader( u_int32_t pap ); static void MPConfigTableHeader( u_int32_t pap );
static int readType( void );
static void seekEntry( u_int32_t addr ); static void seekEntry( u_int32_t addr );
static void readEntry( void* entry, int size ); static void readEntry( void* entry, int size );
static void *mapEntry( u_int32_t addr, int size );
static void processorEntry( void ); static void processorEntry( proc_entry_ptr entry );
static void busEntry( void ); static void busEntry( bus_entry_ptr entry );
static void ioApicEntry( void ); static void ioApicEntry( io_apic_entry_ptr entry );
static void intEntry( void ); static void intEntry( int_entry_ptr entry );
static void sasEntry( void ); static void sasEntry( sas_entry_ptr entry );
static void bhdEntry( void ); static void bhdEntry( bhd_entry_ptr entry );
static void cbasmEntry( void ); static void cbasmEntry( cbasm_entry_ptr entry );
static void doDmesg( void ); static void doDmesg( void );
static void pnstr( char* s, int c ); static void pnstr( char* s, int c );
@ -360,10 +233,10 @@ main( int argc, char *argv[] )
puts( SEP_LINE ); puts( SEP_LINE );
/* check whether an MP config table exists */ /* check whether an MP config table exists */
if ( (defaultConfig = mpfps.mpfb1) ) if ( (defaultConfig = mpfps->config_type) )
MPConfigDefault( defaultConfig ); MPConfigDefault( defaultConfig );
else else
MPConfigTableHeader( mpfps.pap ); MPConfigTableHeader( mpfps->pap );
/* do a dmesg output */ /* do a dmesg output */
if ( dmesg ) if ( dmesg )
@ -524,12 +397,12 @@ apic_probe( u_int32_t* paddr, int* where )
* *
*/ */
static void static void
MPFloatingPointer( u_int32_t paddr, int where, mpfps_t* mpfps ) MPFloatingPointer( u_int32_t paddr, int where, mpfps_t* mpfpsp )
{ {
mpfps_t mpfps;
/* read in mpfps structure*/
seekEntry( paddr ); /* map in mpfps structure*/
readEntry( mpfps, sizeof( mpfps_t ) ); *mpfpsp = mpfps = mapEntry( paddr, sizeof( mpfps ) );
/* show its contents */ /* show its contents */
printf( "MP Floating Pointer Structure:\n\n" ); printf( "MP Floating Pointer Structure:\n\n" );
@ -576,7 +449,7 @@ MPFloatingPointer( u_int32_t paddr, int where, mpfps_t* mpfps )
} }
/* bit 7 is IMCRP */ /* bit 7 is IMCRP */
printf( " mode:\t\t\t\t%s\n", (mpfps->mpfb2 & 0x80) ? printf( " mode:\t\t\t\t%s\n", (mpfps->mpfb2 & MPFB2_IMCR_PRESENT) ?
"PIC" : "Virtual Wire" ); "PIC" : "Virtual Wire" );
/* MP feature bytes 3-5 are expected to be ZERO */ /* MP feature bytes 3-5 are expected to be ZERO */
@ -652,59 +525,53 @@ MPConfigDefault( int featureByte )
static void static void
MPConfigTableHeader( u_int32_t pap ) MPConfigTableHeader( u_int32_t pap )
{ {
u_int32_t paddr;
mpcth_t cth; mpcth_t cth;
int x; int x;
int totalSize; int totalSize;
int count, c; int c;
int type;
int oldtype, entrytype; int oldtype, entrytype;
u_int8_t *entry;
if ( pap == 0 ) { if ( pap == 0 ) {
printf( "MP Configuration Table Header MISSING!\n" ); printf( "MP Configuration Table Header MISSING!\n" );
exit( 1 ); exit( 1 );
} }
/* convert physical address to virtual address */ /* map in cth structure */
paddr = pap; cth = mapEntry( pap, sizeof( *cth ) );
/* read in cth structure */
seekEntry( paddr );
readEntry( &cth, sizeof( cth ) );
printf( "MP Config Table Header:\n\n" ); printf( "MP Config Table Header:\n\n" );
printf( " physical address:\t\t0x%08x\n", pap ); printf( " physical address:\t\t0x%08x\n", pap );
printf( " signature:\t\t\t'" ); printf( " signature:\t\t\t'" );
pnstr( cth.signature, 4 ); pnstr( cth->signature, 4 );
printf( "'\n" ); printf( "'\n" );
printf( " base table length:\t\t%d\n", cth.base_table_length ); printf( " base table length:\t\t%d\n", cth->base_table_length );
printf( " version:\t\t\t1.%1d\n", cth.spec_rev ); printf( " version:\t\t\t1.%1d\n", cth->spec_rev );
printf( " checksum:\t\t\t0x%02x\n", cth.checksum ); printf( " checksum:\t\t\t0x%02x\n", cth->checksum );
printf( " OEM ID:\t\t\t'" ); printf( " OEM ID:\t\t\t'" );
pnstr( cth.oem_id, 8 ); pnstr( cth->oem_id, 8 );
printf( "'\n" ); printf( "'\n" );
printf( " Product ID:\t\t\t'" ); printf( " Product ID:\t\t\t'" );
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", cth->extended_table_length );
printf( " extended table checksum:\t%d\n", cth.extended_table_checksum ); 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;
puts( SEP_LINE ); puts( SEP_LINE );
@ -723,101 +590,99 @@ MPConfigTableHeader( u_int32_t pap )
nintr = 0; nintr = 0;
oldtype = -1; oldtype = -1;
for (c = count; c; c--) { entry = mapEntry(pap + sizeof(*cth), cth->base_table_length);
entrytype = readType(); for (c = cth->entry_count; c; c--) {
entrytype = *entry;
if (entrytype != oldtype) if (entrytype != oldtype)
printf("--\n"); printf("--\n");
if (entrytype < oldtype) if (entrytype < oldtype)
printf("MPTABLE OUT OF ORDER!\n"); printf("MPTABLE OUT OF ORDER!\n");
switch (entrytype) { switch (entrytype) {
case 0: case MPCT_ENTRY_PROCESSOR:
if (oldtype != 0) if (oldtype != MPCT_ENTRY_PROCESSOR)
printf( "Processors:\tAPIC ID\tVersion\tState" printf( "Processors:\tAPIC ID\tVersion\tState"
"\t\tFamily\tModel\tStep\tFlags\n" ); "\t\tFamily\tModel\tStep\tFlags\n" );
oldtype = 0; processorEntry((proc_entry_ptr)entry);
processorEntry(); entry += sizeof(struct PROCENTRY);
break; break;
case 1: case MPCT_ENTRY_BUS:
if (oldtype != 1) if (oldtype != MPCT_ENTRY_BUS)
printf( "Bus:\t\tBus ID\tType\n" ); printf( "Bus:\t\tBus ID\tType\n" );
oldtype = 1; busEntry((bus_entry_ptr)entry);
busEntry(); entry += sizeof(struct BUSENTRY);
break; break;
case 2: case MPCT_ENTRY_IOAPIC:
if (oldtype != 2) if (oldtype != MPCT_ENTRY_IOAPIC)
printf( "I/O APICs:\tAPIC ID\tVersion\tState\t\tAddress\n" ); printf( "I/O APICs:\tAPIC ID\tVersion\tState\t\tAddress\n" );
oldtype = 2; ioApicEntry((io_apic_entry_ptr)entry);
ioApicEntry(); entry += sizeof(struct IOAPICENTRY);
break; break;
case 3: case MPCT_ENTRY_INT:
if (oldtype != 3) if (oldtype != MPCT_ENTRY_INT)
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" );
oldtype = 3; intEntry((int_entry_ptr)entry);
intEntry(); entry += sizeof(struct INTENTRY);
break; break;
case 4: case MPCT_ENTRY_LOCAL_INT:
if (oldtype != 4) if (oldtype != MPCT_ENTRY_LOCAL_INT)
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" );
oldtype = 4; intEntry((int_entry_ptr)entry);
intEntry(); entry += sizeof(struct INTENTRY);
break; break;
default: default:
printf("MPTABLE HOSED! record type = %d\n", entrytype); printf("MPTABLE HOSED! record type = %d\n", entrytype);
exit(1); exit(1);
} }
oldtype = entrytype;
} }
#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 ( cth->extended_table_length ) {
ext_entry_ptr ext_entry, end;
puts( SEP_LINE ); puts( SEP_LINE );
printf( "MP Config Extended Table Entries:\n\n" ); printf( "MP Config Extended Table Entries:\n\n" );
while ( totalSize > 0 ) { ext_entry = mapEntry(pap + cth->base_table_length,
switch ( type = readType() ) { cth->extended_table_length);
case 128: end = (ext_entry_ptr)((char *)ext_entry + cth->extended_table_length);
sasEntry(); while (ext_entry < end) {
switch (ext_entry->type) {
case MPCT_EXTENTRY_SAS:
sasEntry((sas_entry_ptr)ext_entry);
break; break;
case 129: case MPCT_EXTENTRY_BHD:
bhdEntry(); bhdEntry((bhd_entry_ptr)ext_entry);
break; break;
case 130: case MPCT_EXTENTRY_CBASM:
cbasmEntry(); cbasmEntry((cbasm_entry_ptr)ext_entry);
break; break;
default: default:
printf( "Extended Table HOSED!\n" ); printf( "Extended Table HOSED!\n" );
exit( 1 ); exit( 1 );
} }
totalSize -= extendedtableEntryTypes[ type-128 ].length; ext_entry = (ext_entry_ptr)((char *)ext_entry + ext_entry->length);
} }
} }
#endif /* EXTENDED_PROCESSING_READY */ #endif /* EXTENDED_PROCESSING_READY */
/* process any OEM data */ /* process any OEM data */
if ( cth.oem_table_pointer && (cth.oem_table_size > 0) ) { if ( cth->oem_table_pointer && (cth->oem_table_size > 0) ) {
#if defined( OEM_PROCESSING_READY ) #if defined( OEM_PROCESSING_READY )
# error your on your own here! # error your on your own here!
/* convert OEM table pointer to virtual address */ /* map in oem table structure */
poemtp = (u_int32_t)cth.oem_table_pointer; oemdata = mapEntry( cth->oem_table_pointer, cth->oem_table_size);
/* read in oem table structure */
if ( (oemdata = (void*)malloc( cth.oem_table_size )) == NULL )
err( 1, "oem malloc" );
seekEntry( poemtp );
readEntry( oemdata, cth.oem_table_size );
/** process it */ /** process it */
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 */
@ -828,11 +693,11 @@ MPConfigTableHeader( u_int32_t pap )
#if defined( RAW_DUMP ) #if defined( RAW_DUMP )
{ {
int ofd; int ofd;
u_char dumpbuf[ 4096 ]; void *dumpbuf;
ofd = open( "/tmp/mpdump", O_CREAT | O_RDWR, 0666 ); ofd = open( "/tmp/mpdump", O_CREAT | O_RDWR, 0666 );
seekEntry( paddr );
readEntry( dumpbuf, 1024 ); dumpbuf = mapEntry( paddr, 1024 );
write( ofd, dumpbuf, 1024 ); write( ofd, dumpbuf, 1024 );
close( ofd ); close( ofd );
} }
@ -840,24 +705,6 @@ MPConfigTableHeader( u_int32_t pap )
} }
/*
*
*/
static int
readType( void )
{
u_char type;
if ( read( pfd, &type, sizeof( u_char ) ) != sizeof( u_char ) )
err( 1, "type read; pfd: %d", pfd );
if ( lseek( pfd, -1, SEEK_CUR ) < 0 )
err( 1, "type seek" );
return (int)type;
}
/* /*
* *
*/ */
@ -879,31 +726,37 @@ readEntry( void* entry, int size )
err( 1, "readEntry" ); err( 1, "readEntry" );
} }
static void *
mapEntry( u_int32_t addr, int size )
{
void *p;
p = mmap( NULL, size, PROT_READ, MAP_SHARED, pfd, addr );
if (p == MAP_FAILED)
err( 1, "mapEntry" );
return (p);
}
static void static void
processorEntry( void ) processorEntry( proc_entry_ptr entry )
{ {
ProcEntry entry;
/* read it into local memory */
readEntry( &entry, sizeof( entry ) );
/* count it */ /* count it */
++ncpu; ++ncpu;
printf( "\t\t%2d", entry.apicID ); printf( "\t\t%2d", entry->apic_id );
printf( "\t 0x%2x", entry.apicVersion ); printf( "\t 0x%2x", entry->apic_version );
printf( "\t %s, %s", printf( "\t %s, %s",
(entry.cpuFlags & PROCENTRY_FLAG_BP) ? "BSP" : "AP", (entry->cpu_flags & PROCENTRY_FLAG_BP) ? "BSP" : "AP",
(entry.cpuFlags & PROCENTRY_FLAG_EN) ? "usable" : "unusable" ); (entry->cpu_flags & PROCENTRY_FLAG_EN) ? "usable" : "unusable" );
printf( "\t %d\t %d\t %d", printf( "\t %d\t %d\t %d",
(entry.cpuSignature >> 8) & 0x0f, (entry->cpu_signature >> 8) & 0x0f,
(entry.cpuSignature >> 4) & 0x0f, (entry->cpu_signature >> 4) & 0x0f,
entry.cpuSignature & 0x0f ); entry->cpu_signature & 0x0f );
printf( "\t 0x%04x\n", entry.featureFlags ); printf( "\t 0x%04x\n", entry->feature_flags );
} }
@ -924,50 +777,42 @@ lookupBusType( char* name )
static void static void
busEntry( void ) busEntry( bus_entry_ptr entry )
{ {
int x; int x;
char name[ 8 ]; char name[ 8 ];
char c; char c;
BusEntry entry;
/* read it into local memory */
readEntry( &entry, sizeof( entry ) );
/* count it */ /* count it */
++nbus; ++nbus;
printf( "\t\t%2d", entry.busID ); printf( "\t\t%2d", entry->bus_id );
printf( "\t " ); pnstr( entry.busType, 6 ); printf( "\n" ); printf( "\t " ); pnstr( entry->bus_type, 6 ); printf( "\n" );
for ( x = 0; x < 6; ++x ) { for ( x = 0; x < 6; ++x ) {
if ( (c = entry.busType[ x ]) == ' ' ) if ( (c = entry->bus_type[ x ]) == ' ' )
break; break;
name[ x ] = c; name[ x ] = c;
} }
name[ x ] = '\0'; name[ x ] = '\0';
busses[ entry.busID ] = lookupBusType( name ); busses[ entry->bus_id ] = lookupBusType( name );
} }
static void static void
ioApicEntry( void ) ioApicEntry( io_apic_entry_ptr entry )
{ {
IOApicEntry entry;
/* read it into local memory */
readEntry( &entry, sizeof( entry ) );
/* count it */ /* count it */
++napic; ++napic;
printf( "\t\t%2d", entry.apicID ); printf( "\t\t%2d", entry->apic_id );
printf( "\t 0x%02x", entry.apicVersion ); printf( "\t 0x%02x", entry->apic_version );
printf( "\t %s", printf( "\t %s",
(entry.apicFlags & IOAPICENTRY_FLAG_EN) ? "usable" : "unusable" ); (entry->apic_flags & IOAPICENTRY_FLAG_EN) ? "usable" : "unusable" );
printf( "\t\t 0x%x\n", entry.apicAddress ); printf( "\t\t 0x%x\n", entry->apic_address );
apics[ entry.apicID ] = entry.apicID; apics[ entry->apic_id ] = entry->apic_id;
} }
@ -983,53 +828,45 @@ static const char *triggerMode[] = {
}; };
static void static void
intEntry( void ) intEntry( int_entry_ptr entry )
{ {
IntEntry entry;
/* read it into local memory */
readEntry( &entry, sizeof( entry ) );
/* count it */ /* count it */
if ( (int)entry.type == 3 ) if ( entry->type == MPCT_ENTRY_INT )
++nintr; ++nintr;
printf( "\t\t%s", intTypes[ (int)entry.intType ] ); printf( "\t\t%s", intTypes[ entry->int_type ] );
printf( "\t%9s", polarityMode[ (int)entry.intFlags & 0x03 ] ); printf( "\t%9s", polarityMode[ entry->int_flags & INTENTRY_FLAGS_POLARITY ] );
printf( "%12s", triggerMode[ ((int)entry.intFlags >> 2) & 0x03 ] ); printf( "%12s", triggerMode[ (entry->int_flags & INTENTRY_FLAGS_TRIGGER) >> 2 ] );
printf( "\t %5d", (int)entry.srcBusID ); printf( "\t %5d", entry->src_bus_id );
if ( busses[ (int)entry.srcBusID ] == PCI ) if ( busses[ entry->src_bus_id ] == PCI )
printf( "\t%2d:%c", printf( "\t%2d:%c",
((int)entry.srcBusIRQ >> 2) & 0x1f, (entry->src_bus_irq >> 2) & 0x1f,
((int)entry.srcBusIRQ & 0x03) + 'A' ); (entry->src_bus_irq & 0x03) + 'A' );
else else
printf( "\t %3d", (int)entry.srcBusIRQ ); printf( "\t %3d", entry->src_bus_irq );
printf( "\t %6d", (int)entry.dstApicID ); printf( "\t %6d", entry->dst_apic_id );
printf( "\t %3d\n", (int)entry.dstApicINT ); printf( "\t %3d\n", entry->dst_apic_int );
} }
static void static void
sasEntry( void ) sasEntry( sas_entry_ptr entry )
{ {
SasEntry entry;
/* read it into local memory */ printf( "--\nSystem Address Space\n");
readEntry( &entry, sizeof( entry ) ); printf( " bus ID: %d", entry->bus_id );
printf( "--\n%s\n", extendedtableEntryTypes[entry.type - 128].name );
printf( " bus ID: %d", entry.busID );
printf( " address type: " ); printf( " address type: " );
switch ( entry.addressType ) { switch ( entry->address_type ) {
case 0: case SASENTRY_TYPE_IO:
printf( "I/O address\n" ); printf( "I/O address\n" );
break; break;
case 1: case SASENTRY_TYPE_MEMORY:
printf( "memory address\n" ); printf( "memory address\n" );
break; break;
case 2: case SASENTRY_TYPE_PREFETCH:
printf( "prefetch address\n" ); printf( "prefetch address\n" );
break; break;
default: default:
@ -1037,39 +874,32 @@ sasEntry( void )
break; break;
} }
printf( " address base: 0x%llx\n", (long long)entry.addressBase ); printf( " address base: 0x%jx\n", (uintmax_t)entry->address_base );
printf( " address range: 0x%llx\n", (long long)entry.addressLength ); printf( " address range: 0x%jx\n", (uintmax_t)entry->address_length );
} }
static void static void
bhdEntry( void ) bhdEntry( bhd_entry_ptr entry )
{ {
BhdEntry entry;
/* read it into local memory */ printf( "--\nBus Hierarchy\n" );
readEntry( &entry, sizeof( entry ) ); printf( " bus ID: %d", entry->bus_id );
printf( " bus info: 0x%02x", entry->bus_info );
printf( "--\n%s\n", extendedtableEntryTypes[entry.type - 128].name ); printf( " parent bus ID: %d\n", entry->parent_bus );
printf( " bus ID: %d", entry.busID );
printf( " bus info: 0x%02x", entry.busInfo );
printf( " parent bus ID: %d\n", entry.busParent );
} }
static void static void
cbasmEntry( void ) cbasmEntry( cbasm_entry_ptr entry )
{ {
CbasmEntry entry;
/* read it into local memory */ printf( "--\nCompatibility Bus Address\n" );
readEntry( &entry, sizeof( entry ) ); printf( " bus ID: %d", entry->bus_id );
printf( " address modifier: %s\n",
printf( "--\n%s\n", extendedtableEntryTypes[entry.type - 128].name ); (entry->address_mod & CBASMENTRY_ADDRESS_MOD_SUBTRACT) ?
printf( " bus ID: %d", entry.busID ); "subtract" : "add" );
printf( " address modifier: %s\n", (entry.addressMod & 0x01) ? printf( " predefined range: 0x%08x\n", entry->predefined_range );
"subtract" : "add" );
printf( " predefined range: 0x%08x\n", entry.predefinedRange );
} }