iPXE
isa_ids.h
Go to the documentation of this file.
00001 #ifndef ISA_IDS_H
00002 #define ISA_IDS_H
00003 
00004 /* 
00005  * This file defines IDs as used by ISAPnP and EISA devices.  These
00006  * IDs have the format:
00007  *
00008  * vendor  byte 0 bit  7    must be zero
00009  *                bits 6-2  first vendor char in compressed ASCII
00010  *                bits 1-0  second vendor char in compressed ASCII (bits 4-3)
00011  *         byte 1 bits 7-5  second vendor char in compressed ASCII (bits 2-0)
00012  *                bits 4-0  third vendor char in compressed ASCII
00013  * product byte 0 bits 7-4  first hex digit of product number
00014  *                bits 3-0  second hex digit of product number
00015  *         byte 1 bits 7-4  third hex digit of product number
00016  *                bits 3-0  hex digit of revision level
00017  *
00018  * ISA IDs are always expressed in little-endian order, even though
00019  * the underlying "meaning" is big-endian.
00020  */
00021 
00022 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
00023 
00024 #include <byteswap.h>
00025 
00026 /*
00027  * Construct a vendor ID from three ASCII characters
00028  *
00029  */
00030 #define ISA_VENDOR( a, b, c )                                   \
00031         bswap_16 ( ( ( ( (a) - 'A' + 1 ) & 0x1f ) << 10 ) |     \
00032                    ( ( ( (b) - 'A' + 1 ) & 0x1f ) << 5 ) |      \
00033                    ( ( ( (c) - 'A' + 1 ) & 0x1f ) << 0 ) )
00034 
00035 #define ISAPNP_VENDOR( a, b, c )        ISA_VENDOR ( a, b, c )
00036 #define EISA_VENDOR( a, b, c )          ISA_VENDOR ( a, b, c )
00037 
00038 #define GENERIC_ISAPNP_VENDOR           ISAPNP_VENDOR ( 'P','N','P' )
00039 
00040 /*
00041  * Extract product ID and revision from combined product field
00042  *
00043  */
00044 #define ISA_PROD_ID_MASK        ( 0xf0ff )
00045 #define ISA_PROD_ID(product)    ( (product) & ISA_PROD_ID_MASK )
00046 #define ISA_PROD_REV(product)   ( ( (product) & ~ISA_PROD_ID_MASK ) >> 8 )
00047 
00048 /* Functions in isa_ids.c */
00049 extern char * isa_id_string ( unsigned int vendor, unsigned int product );
00050 
00051 #endif /* ISA_IDS_H */