From 5648002757ed616af6920cb3c3643cc367576de5 Mon Sep 17 00:00:00 2001 From: Sascha Wildner Date: Tue, 24 Mar 2009 11:11:37 +0100 Subject: [PATCH] mptable(1): Make dumping the raw MP table an option. --- usr.sbin/mptable/mptable.1 | 6 +++++- usr.sbin/mptable/mptable.c | 35 ++++++++++++++++------------------- 2 files changed, 21 insertions(+), 20 deletions(-) diff --git a/usr.sbin/mptable/mptable.1 b/usr.sbin/mptable/mptable.1 index 102dd5e7e0..2cd035d169 100644 --- a/usr.sbin/mptable/mptable.1 +++ b/usr.sbin/mptable/mptable.1 @@ -24,7 +24,7 @@ .\" $FreeBSD: src/usr.sbin/mptable/mptable.1,v 1.6.2.2 2000/12/08 15:28:29 ru Exp $ .\" $DragonFly: src/usr.sbin/mptable/mptable.1,v 1.2 2003/06/17 04:29:57 dillon Exp $ .\" -.Dd April 28, 1997 +.Dd March 24, 2009 .Dt MPTABLE 1 .Os .Sh NAME @@ -35,6 +35,7 @@ .Op Fl dmesg .Op Fl verbose .Op Fl grope +.Op Fl raw .Op Fl help .Sh DESCRIPTION The @@ -53,6 +54,9 @@ The following options are available: Include a dmesg dump. .It Fl grope Look in areas it shouldn't NEED to, use ONLY as a last resort. +.It Fl raw +This will cause the raw MP table to be dumped to +.Pa /tmp/mpdump . .It Fl help Print a usage message and exits. .It Fl verbose diff --git a/usr.sbin/mptable/mptable.c b/usr.sbin/mptable/mptable.c index 57089cdbbe..292ecc5fb1 100644 --- a/usr.sbin/mptable/mptable.c +++ b/usr.sbin/mptable/mptable.c @@ -34,12 +34,6 @@ #define VMINOR 0 #define VDELTA 15 -/* - * this will cause the raw mp table to be dumped to /tmp/mpdump - * -#define RAW_DUMP - */ - #define MP_SIG 0x5f504d5f /* _MP_ */ #define EXTENDED_PROCESSING_READY #define OEM_PROCESSING_READY_NOT @@ -291,12 +285,13 @@ int nintr; int dmesg; int grope; +int raw; int verbose; static void usage( void ) { - fprintf( stderr, "usage: mptable [-dmesg] [-verbose] [-grope] [-help]\n" ); + fprintf( stderr, "usage: mptable [-dmesg] [-verbose] [-grope] [-raw] [-help]\n" ); exit( 0 ); } @@ -319,7 +314,7 @@ main( int argc, char *argv[] ) printf( "MPTable, version %d.%d.%d\n", VMAJOR, VMINOR, VDELTA ); - while ((ch = getopt(argc, argv, "d:g:h:v:")) != -1) { + while ((ch = getopt(argc, argv, "d:g:h:r:v:")) != -1) { switch(ch) { case 'd': if ( strcmp( optarg, "mesg") == 0 ) @@ -335,6 +330,10 @@ main( int argc, char *argv[] ) if ( strcmp( optarg, "rope") == 0 ) grope = 1; break; + case 'r': + if ( strcmp (optarg, "aw") == 0 ) + raw = 1; + break; case 'v': if ( strcmp( optarg, "erbose") == 0 ) verbose = 1; @@ -824,18 +823,16 @@ MPConfigTableHeader( void* pap ) fflush( stdout ); -#if defined( RAW_DUMP ) -{ - int ofd; - u_char dumpbuf[ 4096 ]; + if ( raw ) { + int ofd; + u_char dumpbuf[ 4096 ]; - ofd = open( "/tmp/mpdump", O_CREAT | O_RDWR ); - seekEntry( paddr ); - readEntry( dumpbuf, 1024 ); - write( ofd, dumpbuf, 1024 ); - close( ofd ); -} -#endif /* RAW_DUMP */ + ofd = open( "/tmp/mpdump", O_CREAT | O_RDWR ); + seekEntry( paddr ); + readEntry( dumpbuf, 1024 ); + write( ofd, dumpbuf, 1024 ); + close( ofd ); + } } -- 2.41.0