david/ipxe
Archived
1
0
This repository has been archived on 2020-12-06. You can view files and clone it, but cannot push or open issues or pull requests.
ipxe/src/drivers/bus/isa_ids.c

27 lines
581 B
C
Raw Normal View History

2005-04-17 12:51:05 +02:00
#include "stdint.h"
#include "byteswap.h"
#include "console.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 = bswap_16 ( 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", bswap_16 ( product ) );
return buf;
}