[pci] Provide PCI_CLASS() to calculate a scalar PCI class value
Rename PCI_CLASS() (which constructs a struct pci_class_id) to PCI_CLASS_ID(), and provide PCI_CLASS() as a macro which constructs the 24-bit scalar value of a PCI class code. Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
parent
50e703a534
commit
b88ab14ba3
@ -140,7 +140,7 @@ static struct pci_device_id undipci_nics[] = {
|
|||||||
struct pci_driver undipci_driver __pci_driver_fallback = {
|
struct pci_driver undipci_driver __pci_driver_fallback = {
|
||||||
.ids = undipci_nics,
|
.ids = undipci_nics,
|
||||||
.id_count = ( sizeof ( undipci_nics ) / sizeof ( undipci_nics[0] ) ),
|
.id_count = ( sizeof ( undipci_nics ) / sizeof ( undipci_nics[0] ) ),
|
||||||
.class = PCI_CLASS ( PCI_CLASS_NETWORK, PCI_ANY_ID, PCI_ANY_ID ),
|
.class = PCI_CLASS_ID ( PCI_CLASS_NETWORK, PCI_ANY_ID, PCI_ANY_ID ),
|
||||||
.probe = undipci_probe,
|
.probe = undipci_probe,
|
||||||
.remove = undipci_remove,
|
.remove = undipci_remove,
|
||||||
};
|
};
|
||||||
|
@ -1877,8 +1877,8 @@ static struct pci_device_id ehci_ids[] = {
|
|||||||
struct pci_driver ehci_driver __pci_driver = {
|
struct pci_driver ehci_driver __pci_driver = {
|
||||||
.ids = ehci_ids,
|
.ids = ehci_ids,
|
||||||
.id_count = ( sizeof ( ehci_ids ) / sizeof ( ehci_ids[0] ) ),
|
.id_count = ( sizeof ( ehci_ids ) / sizeof ( ehci_ids[0] ) ),
|
||||||
.class = PCI_CLASS ( PCI_CLASS_SERIAL, PCI_CLASS_SERIAL_USB,
|
.class = PCI_CLASS_ID ( PCI_CLASS_SERIAL, PCI_CLASS_SERIAL_USB,
|
||||||
PCI_CLASS_SERIAL_USB_EHCI ),
|
PCI_CLASS_SERIAL_USB_EHCI ),
|
||||||
.probe = ehci_probe,
|
.probe = ehci_probe,
|
||||||
.remove = ehci_remove,
|
.remove = ehci_remove,
|
||||||
};
|
};
|
||||||
|
@ -3280,8 +3280,8 @@ static struct pci_device_id xhci_ids[] = {
|
|||||||
struct pci_driver xhci_driver __pci_driver = {
|
struct pci_driver xhci_driver __pci_driver = {
|
||||||
.ids = xhci_ids,
|
.ids = xhci_ids,
|
||||||
.id_count = ( sizeof ( xhci_ids ) / sizeof ( xhci_ids[0] ) ),
|
.id_count = ( sizeof ( xhci_ids ) / sizeof ( xhci_ids[0] ) ),
|
||||||
.class = PCI_CLASS ( PCI_CLASS_SERIAL, PCI_CLASS_SERIAL_USB,
|
.class = PCI_CLASS_ID ( PCI_CLASS_SERIAL, PCI_CLASS_SERIAL_USB,
|
||||||
PCI_CLASS_SERIAL_USB_XHCI ),
|
PCI_CLASS_SERIAL_USB_XHCI ),
|
||||||
.probe = xhci_probe,
|
.probe = xhci_probe,
|
||||||
.remove = xhci_remove,
|
.remove = xhci_remove,
|
||||||
};
|
};
|
||||||
|
@ -118,6 +118,16 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
|||||||
#define PCI_CLASS_SERIAL_USB_EHCI 0x20 /**< ECHI USB controller */
|
#define PCI_CLASS_SERIAL_USB_EHCI 0x20 /**< ECHI USB controller */
|
||||||
#define PCI_CLASS_SERIAL_USB_XHCI 0x30 /**< xHCI USB controller */
|
#define PCI_CLASS_SERIAL_USB_XHCI 0x30 /**< xHCI USB controller */
|
||||||
|
|
||||||
|
/** Construct PCI class
|
||||||
|
*
|
||||||
|
* @v base Base class (or PCI_ANY_ID)
|
||||||
|
* @v sub Subclass (or PCI_ANY_ID)
|
||||||
|
* @v progif Programming interface (or PCI_ANY_ID)
|
||||||
|
*/
|
||||||
|
#define PCI_CLASS( base, sub, progif ) \
|
||||||
|
( ( ( (base) & 0xff ) << 16 ) | ( ( (sub) & 0xff ) << 8 ) | \
|
||||||
|
( ( (progif) & 0xff) << 0 ) )
|
||||||
|
|
||||||
/** A PCI device ID list entry */
|
/** A PCI device ID list entry */
|
||||||
struct pci_device_id {
|
struct pci_device_id {
|
||||||
/** Name */
|
/** Name */
|
||||||
@ -147,10 +157,8 @@ struct pci_class_id {
|
|||||||
* @v sub Subclass (or PCI_ANY_ID)
|
* @v sub Subclass (or PCI_ANY_ID)
|
||||||
* @v progif Programming interface (or PCI_ANY_ID)
|
* @v progif Programming interface (or PCI_ANY_ID)
|
||||||
*/
|
*/
|
||||||
#define PCI_CLASS(base,sub,progif) { \
|
#define PCI_CLASS_ID( base, sub, progif ) { \
|
||||||
.class = ( ( ( (base) & 0xff ) << 16 ) | \
|
.class = PCI_CLASS ( base, sub, progif ), \
|
||||||
( ( (sub) & 0xff ) << 8 ) | \
|
|
||||||
( ( (progif) & 0xff) << 0 ) ), \
|
|
||||||
.mask = ( ( ( ( (base) == PCI_ANY_ID ) ? 0x00 : 0xff ) << 16 ) | \
|
.mask = ( ( ( ( (base) == PCI_ANY_ID ) ? 0x00 : 0xff ) << 16 ) | \
|
||||||
( ( ( (sub) == PCI_ANY_ID ) ? 0x00 : 0xff ) << 8 ) | \
|
( ( ( (sub) == PCI_ANY_ID ) ? 0x00 : 0xff ) << 8 ) | \
|
||||||
( ( ( (progif) == PCI_ANY_ID ) ? 0x00 : 0xff ) << 0 ) ), \
|
( ( ( (progif) == PCI_ANY_ID ) ? 0x00 : 0xff ) << 0 ) ), \
|
||||||
|
Reference in New Issue
Block a user