libpayload: add controller type in usbdev_hc

Add controller type (UHCI, OHCI, EHCI or XHCI)
into usbdev_hc (hci_t) struct, so now we know
which type selected controller have. It needed
to access controller specific data, if access
usb tree outside of libpayload (e.g. in payload
intself)

Change-Id: I7df947bbb56a50d0d792ccd4d3a6b021ee95e2ea
Signed-off-by: Anton Kochkov <anton.kochkov@gmail.com>
Reviewed-on: http://review.coreboot.org/1145
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
This commit is contained in:
Anton Kochkov 2012-06-28 08:30:15 +04:00 committed by Stefan Reinauer
parent 79b0574698
commit 1c36eada27
5 changed files with 11 additions and 0 deletions

View File

@ -635,6 +635,8 @@ ehci_init (pcidev_t addr)
pci_command = (pci_command | PCI_COMMAND_MEMORY) & ~PCI_COMMAND_IO ; pci_command = (pci_command | PCI_COMMAND_MEMORY) & ~PCI_COMMAND_IO ;
pci_write_config32(addr, PCI_COMMAND, pci_command); pci_write_config32(addr, PCI_COMMAND, pci_command);
controller->type = EHCI;
controller->start = ehci_start; controller->start = ehci_start;
controller->stop = ehci_stop; controller->stop = ehci_stop;
controller->reset = ehci_reset; controller->reset = ehci_reset;

View File

@ -102,6 +102,8 @@ ohci_init (pcidev_t addr)
if(!controller->instance) if(!controller->instance)
fatal("Not enough memory creating USB controller instance.\n"); fatal("Not enough memory creating USB controller instance.\n");
controller->type = OHCI;
controller->start = ohci_start; controller->start = ohci_start;
controller->stop = ohci_stop; controller->stop = ohci_stop;
controller->reset = ohci_reset; controller->reset = ohci_reset;

View File

@ -147,6 +147,8 @@ uhci_init (pcidev_t addr)
if(!controller->instance) if(!controller->instance)
fatal("Not enough memory creating USB controller instance.\n"); fatal("Not enough memory creating USB controller instance.\n");
controller->type = UHCI;
controller->start = uhci_start; controller->start = uhci_start;
controller->stop = uhci_stop; controller->stop = uhci_stop;
controller->reset = uhci_reset; controller->reset = uhci_reset;

View File

@ -63,6 +63,8 @@ xhci_init (pcidev_t addr)
if(!controller->instance) if(!controller->instance)
fatal("Not enough memory creating USB controller instance.\n"); fatal("Not enough memory creating USB controller instance.\n");
controller->type = XHCI;
controller->start = xhci_start; controller->start = xhci_start;
controller->stop = xhci_stop; controller->stop = xhci_stop;
controller->reset = xhci_reset; controller->reset = xhci_reset;

View File

@ -111,10 +111,13 @@ struct usbdev {
void (*poll) (usbdev_t *dev); void (*poll) (usbdev_t *dev);
}; };
typedef enum { OHCI = 0, UHCI = 1, EHCI = 2, XHCI = 3} hc_type;
struct usbdev_hc { struct usbdev_hc {
struct usbdev_hc *next; struct usbdev_hc *next;
pcidev_t bus_address; pcidev_t bus_address;
u32 reg_base; u32 reg_base;
hc_type type;
usbdev_t *devices[128]; // dev 0 is root hub, 127 is last addressable usbdev_t *devices[128]; // dev 0 is root hub, 127 is last addressable
void (*start) (hci_t *controller); void (*start) (hci_t *controller);
void (*stop) (hci_t *controller); void (*stop) (hci_t *controller);