mirror of
https://github.com/ipxe/ipxe
synced 2025-12-23 13:30:57 +03:00
Created separate isa_ids.h file and a utility function to print out ISA
IDs in a human-readable format.
This commit is contained in:
24
src/drivers/bus/isa_ids.c
Normal file
24
src/drivers/bus/isa_ids.c
Normal file
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user