libpayload: Use unsigned long for BARs in *hci_init()
Using void* for physical addresses leads to much casting and confuses developers when to convert from physical to virtual addresses or the other way around. When using plain integers for physical addresses and pointers for virtual addresses things become much cleaner and we won't ever end up dereferencing a physical address. Change-Id: I24cd53b81c7863b6d14f0cbb4ce8937728b37c1c Signed-off-by: Nico Huber <nico.huber@secunet.com> Reviewed-on: http://review.coreboot.org/6244 Tested-by: build bot (Jenkins) Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
This commit is contained in:
parent
322794243a
commit
6e23066d7a
|
@ -724,7 +724,7 @@ static u8 *ehci_poll_intr_queue(void *const queue)
|
|||
}
|
||||
|
||||
hci_t *
|
||||
ehci_init (void *bar)
|
||||
ehci_init (unsigned long physical_bar)
|
||||
{
|
||||
int i;
|
||||
hci_t *controller = new_controller ();
|
||||
|
@ -751,7 +751,7 @@ ehci_init (void *bar)
|
|||
controller->create_intr_queue = ehci_create_intr_queue;
|
||||
controller->destroy_intr_queue = ehci_destroy_intr_queue;
|
||||
controller->poll_intr_queue = ehci_poll_intr_queue;
|
||||
controller->reg_base = (u32)(unsigned long)bar;
|
||||
controller->reg_base = (u32)physical_bar;
|
||||
for (i = 0; i < 128; i++) {
|
||||
controller->devices[i] = 0;
|
||||
}
|
||||
|
@ -822,7 +822,7 @@ ehci_pci_init (pcidev_t addr)
|
|||
/* default value for frame length adjust */
|
||||
pci_write_config8(addr, FLADJ, FLADJ_framelength(60000));
|
||||
|
||||
controller = ehci_init((void *)(unsigned long)reg_base);
|
||||
controller = ehci_init((unsigned long)reg_base);
|
||||
|
||||
return controller;
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
#include <usb/usb.h>
|
||||
|
||||
hci_t *ehci_pci_init (pcidev_t addr);
|
||||
hci_t *ehci_init (void *bar);
|
||||
hci_t *ehci_init (unsigned long physical_bar);
|
||||
|
||||
void ehci_rh_init (usbdev_t *dev);
|
||||
|
||||
|
|
|
@ -167,7 +167,7 @@ static const char *direction[] = {
|
|||
#endif
|
||||
|
||||
hci_t *
|
||||
ohci_init (void *bar)
|
||||
ohci_init (unsigned long physical_bar)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -201,7 +201,7 @@ ohci_init (void *bar)
|
|||
init_device_entry (controller, 0);
|
||||
OHCI_INST (controller)->roothub = controller->devices[0];
|
||||
|
||||
controller->reg_base = (u32)(unsigned long)bar;
|
||||
controller->reg_base = (u32)physical_bar;
|
||||
OHCI_INST (controller)->opreg = (opreg_t*)phys_to_virt(controller->reg_base);
|
||||
usb_debug("OHCI Version %x.%x\n", (OHCI_INST (controller)->opreg->HcRevision >> 4) & 0xf, OHCI_INST (controller)->opreg->HcRevision & 0xf);
|
||||
|
||||
|
@ -263,7 +263,7 @@ ohci_pci_init (pcidev_t addr)
|
|||
* OHCI mandates MMIO, so bit 0 is clear */
|
||||
reg_base = pci_read_config32 (addr, 0x10) & 0xfffff000;
|
||||
|
||||
return ohci_init((void *)(unsigned long)reg_base);
|
||||
return ohci_init((unsigned long)reg_base);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
#include <usb/usb.h>
|
||||
|
||||
hci_t *ohci_pci_init (pcidev_t addr);
|
||||
hci_t *ohci_init (void *bar);
|
||||
hci_t *ohci_init (unsigned long physical_bar);
|
||||
|
||||
void ohci_rh_init (usbdev_t *dev);
|
||||
|
||||
|
|
|
@ -160,13 +160,13 @@ static void usb_scan_pci_bus(int bus)
|
|||
static void usb_scan_memory(void)
|
||||
{
|
||||
#ifdef CONFIG_USB_XHCI
|
||||
xhci_init((void *)(unsigned long)CONFIG_USB_XHCI_BASE_ADDRESS);
|
||||
xhci_init(CONFIG_USB_XHCI_BASE_ADDRESS);
|
||||
#endif
|
||||
#ifdef CONFIG_USB_EHCI
|
||||
ehci_init((void *)(unsigned long)CONFIG_USB_EHCI_BASE_ADDRESS);
|
||||
ehci_init(CONFIG_USB_EHCI_BASE_ADDRESS);
|
||||
#endif
|
||||
#ifdef CONFIG_USB_OHCI
|
||||
ohci_init((void *)(unsigned long)CONFIG_USB_OHCI_BASE_ADDRESS);
|
||||
ohci_init(CONFIG_USB_OHCI_BASE_ADDRESS);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -143,7 +143,7 @@ xhci_wait_ready(xhci_t *const xhci)
|
|||
}
|
||||
|
||||
hci_t *
|
||||
xhci_init (const void *bar)
|
||||
xhci_init (unsigned long physical_bar)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -192,7 +192,7 @@ xhci_init (const void *bar)
|
|||
goto _free_xhci;
|
||||
}
|
||||
|
||||
controller->reg_base = (u32)(unsigned long)bar;
|
||||
controller->reg_base = (u32)physical_bar;
|
||||
|
||||
xhci->capreg = phys_to_virt(controller->reg_base);
|
||||
xhci->opreg = ((void *)xhci->capreg) + xhci->capreg->caplength;
|
||||
|
@ -310,7 +310,7 @@ xhci_pci_init (pcidev_t addr)
|
|||
fatal("We don't do 64bit addressing.\n");
|
||||
}
|
||||
|
||||
controller = xhci_init((void *)(unsigned long)reg_addr);
|
||||
controller = xhci_init((unsigned long)reg_addr);
|
||||
controller->pcidev = addr;
|
||||
|
||||
xhci_switch_ppt_ports(addr);
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
#include <usb/usb.h>
|
||||
|
||||
hci_t *xhci_pci_init (pcidev_t addr);
|
||||
hci_t *xhci_init (const void *bar);
|
||||
hci_t *xhci_init (unsigned long physical_bar);
|
||||
|
||||
void xhci_rh_init (usbdev_t *dev);
|
||||
|
||||
|
|
Loading…
Reference in New Issue