• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef ISA_IDS_H
2 #define ISA_IDS_H
3 
4 /*
5  * This file defines IDs as used by ISAPnP and EISA devices.  These
6  * IDs have the format:
7  *
8  * vendor  byte 0 bit  7    must be zero
9  *		  bits 6-2  first vendor char in compressed ASCII
10  *		  bits 1-0  second vendor char in compressed ASCII (bits 4-3)
11  *	   byte 1 bits 7-5  second vendor char in compressed ASCII (bits 2-0)
12  *                bits 4-0  third vendor char in compressed ASCII
13  * product byte 0 bits 7-4  first hex digit of product number
14  *		  bits 3-0  second hex digit of product number
15  *	   byte 1 bits 7-4  third hex digit of product number
16  *		  bits 3-0  hex digit of revision level
17  *
18  * ISA IDs are always expressed in little-endian order, even though
19  * the underlying "meaning" is big-endian.
20  */
21 
22 FILE_LICENCE ( GPL2_OR_LATER );
23 
24 #include <byteswap.h>
25 
26 /*
27  * Construct a vendor ID from three ASCII characters
28  *
29  */
30 #define ISA_VENDOR( a, b, c )					\
31 	bswap_16 ( ( ( ( (a) - 'A' + 1 ) & 0x1f ) << 10 ) |	\
32 		   ( ( ( (b) - 'A' + 1 ) & 0x1f ) << 5 ) |	\
33 		   ( ( ( (c) - 'A' + 1 ) & 0x1f ) << 0 ) )
34 
35 #define ISAPNP_VENDOR( a, b, c )	ISA_VENDOR ( a, b, c )
36 #define EISA_VENDOR( a, b, c )		ISA_VENDOR ( a, b, c )
37 
38 #define	GENERIC_ISAPNP_VENDOR		ISAPNP_VENDOR ( 'P','N','P' )
39 
40 /*
41  * Extract product ID and revision from combined product field
42  *
43  */
44 #define ISA_PROD_ID_MASK	( 0xf0ff )
45 #define ISA_PROD_ID(product)	( (product) & ISA_PROD_ID_MASK )
46 #define ISA_PROD_REV(product)	( ( (product) & ~ISA_PROD_ID_MASK ) >> 8 )
47 
48 /* Functions in isa_ids.c */
49 extern char * isa_id_string ( unsigned int vendor, unsigned int product );
50 
51 #endif /* ISA_IDS_H */
52