mirror of
https://github.com/ipxe/ipxe
synced 2025-12-15 09:04:37 +03:00
[ehci] Allow UHCI/OHCI controllers to locate the EHCI companion controller
Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -337,6 +337,32 @@ static void ehci_poll_companions ( struct ehci_device *ehci ) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Locate EHCI companion controller
|
||||||
|
*
|
||||||
|
* @v pci PCI device
|
||||||
|
* @ret busdevfn EHCI companion controller bus:dev.fn (if any)
|
||||||
|
*/
|
||||||
|
unsigned int ehci_companion ( struct pci_device *pci ) {
|
||||||
|
struct pci_device tmp;
|
||||||
|
unsigned int busdevfn;
|
||||||
|
int rc;
|
||||||
|
|
||||||
|
/* Look for an EHCI function on the same PCI device */
|
||||||
|
busdevfn = pci->busdevfn;
|
||||||
|
while ( ++busdevfn <= PCI_LAST_FUNC ( pci->busdevfn ) ) {
|
||||||
|
pci_init ( &tmp, busdevfn );
|
||||||
|
if ( ( rc = pci_read_config ( &tmp ) ) != 0 )
|
||||||
|
continue;
|
||||||
|
if ( tmp.class == PCI_CLASS ( PCI_CLASS_SERIAL,
|
||||||
|
PCI_CLASS_SERIAL_USB,
|
||||||
|
PCI_CLASS_SERIAL_USB_EHCI ) )
|
||||||
|
return busdevfn;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
* Run / stop / reset
|
* Run / stop / reset
|
||||||
|
|||||||
@@ -537,4 +537,6 @@ struct ehci_endpoint {
|
|||||||
struct ehci_ring ring;
|
struct ehci_ring ring;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
extern unsigned int ehci_companion ( struct pci_device *pci );
|
||||||
|
|
||||||
#endif /* _IPXE_EHCI_H */
|
#endif /* _IPXE_EHCI_H */
|
||||||
|
|||||||
@@ -239,6 +239,7 @@ struct pci_driver {
|
|||||||
#define PCI_BUSDEVFN( bus, slot, func ) \
|
#define PCI_BUSDEVFN( bus, slot, func ) \
|
||||||
( ( (bus) << 8 ) | ( (slot) << 3 ) | ( (func) << 0 ) )
|
( ( (bus) << 8 ) | ( (slot) << 3 ) | ( (func) << 0 ) )
|
||||||
#define PCI_FIRST_FUNC( busdevfn ) ( (busdevfn) & ~0x07 )
|
#define PCI_FIRST_FUNC( busdevfn ) ( (busdevfn) & ~0x07 )
|
||||||
|
#define PCI_LAST_FUNC( busdevfn ) ( (busdevfn) | 0x07 )
|
||||||
|
|
||||||
#define PCI_BASE_CLASS( class ) ( (class) >> 16 )
|
#define PCI_BASE_CLASS( class ) ( (class) >> 16 )
|
||||||
#define PCI_SUB_CLASS( class ) ( ( (class) >> 8 ) & 0xff )
|
#define PCI_SUB_CLASS( class ) ( ( (class) >> 8 ) & 0xff )
|
||||||
|
|||||||
Reference in New Issue
Block a user