From 9711f50e204c6e918a983e9dbfa864fd006acb01 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Wed, 13 Apr 2005 12:01:44 +0000 Subject: Created separate isa_ids.h file and a utility function to print out ISA IDs in a human-readable format. --- src/drivers/bus/isa_ids.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/drivers/bus/isa_ids.c (limited to 'src/drivers/bus') diff --git a/src/drivers/bus/isa_ids.c b/src/drivers/bus/isa_ids.c new file mode 100644 index 000000000..f7be1129c --- /dev/null +++ b/src/drivers/bus/isa_ids.c @@ -0,0 +1,24 @@ +#include "etherboot.h" +#include "isa_ids.h" + +/* + * EISA and ISAPnP IDs are actually mildly human readable, though in a + * somewhat brain-damaged way. + * + */ +char * isa_id_string ( uint16_t vendor, uint16_t product ) { + static unsigned char buf[7]; + int i; + + /* Vendor ID is a compressed ASCII string */ + vendor = htons ( vendor ); + for ( i = 2 ; i >= 0 ; i-- ) { + buf[i] = ( 'A' - 1 + ( vendor & 0x1f ) ); + vendor >>= 5; + } + + /* Product ID is a 4-digit hex string */ + sprintf ( &buf[3], "%hx", htons ( product ) ); + + return buf; +} -- cgit v1.2.3-55-g7522