libpayload: Drop obsolete setting of reg_base in [oex]hci

Setting of `controller->reg_base` is of no use here, as it is never read
(in another function) later. Looks like this pattern originated from uhci.c
where it makes sense.

By removing the indirection through `reg_base` we also fix a possible
truncation to u32.

Change-Id: I5c99c5bf1f5b1d6c04bd84d87fd3e275fd7d0411
Signed-off-by: Nico Huber <nico.huber@secunet.com>
Reviewed-on: http://review.coreboot.org/6251
Tested-by: build bot (Jenkins)
Reviewed-by: Patrick Georgi <patrick@georgi-clan.de>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
This commit is contained in:
Nico Huber 2014-07-10 12:56:34 +02:00 committed by Patrick Georgi
parent f4316f8c10
commit 5b9e6f175f
3 changed files with 5 additions and 9 deletions

View File

@ -751,14 +751,13 @@ ehci_init (unsigned long physical_bar)
controller->create_intr_queue = ehci_create_intr_queue; controller->create_intr_queue = ehci_create_intr_queue;
controller->destroy_intr_queue = ehci_destroy_intr_queue; controller->destroy_intr_queue = ehci_destroy_intr_queue;
controller->poll_intr_queue = ehci_poll_intr_queue; controller->poll_intr_queue = ehci_poll_intr_queue;
controller->reg_base = (u32)physical_bar;
for (i = 0; i < 128; i++) { for (i = 0; i < 128; i++) {
controller->devices[i] = 0; controller->devices[i] = 0;
} }
init_device_entry (controller, 0); init_device_entry (controller, 0);
EHCI_INST(controller)->capabilities = phys_to_virt(controller->reg_base); EHCI_INST(controller)->capabilities = phys_to_virt(physical_bar);
EHCI_INST(controller)->operation = (hc_op_t *)(phys_to_virt(controller->reg_base) + EHCI_INST(controller)->capabilities->caplength); EHCI_INST(controller)->operation = (hc_op_t *)(phys_to_virt(physical_bar) + EHCI_INST(controller)->capabilities->caplength);
/* Set the high address word (aka segment) if controller is 64-bit */ /* Set the high address word (aka segment) if controller is 64-bit */
if (EHCI_INST(controller)->capabilities->hccparams & 1) if (EHCI_INST(controller)->capabilities->hccparams & 1)

View File

@ -201,8 +201,7 @@ ohci_init (unsigned long physical_bar)
init_device_entry (controller, 0); init_device_entry (controller, 0);
OHCI_INST (controller)->roothub = controller->devices[0]; OHCI_INST (controller)->roothub = controller->devices[0];
controller->reg_base = (u32)physical_bar; OHCI_INST (controller)->opreg = (opreg_t*)phys_to_virt(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); usb_debug("OHCI Version %x.%x\n", (OHCI_INST (controller)->opreg->HcRevision >> 4) & 0xf, OHCI_INST (controller)->opreg->HcRevision & 0xf);
if ((OHCI_INST (controller)->opreg->HcControl & HostControllerFunctionalStateMask) == USBReset) { if ((OHCI_INST (controller)->opreg->HcControl & HostControllerFunctionalStateMask) == USBReset) {

View File

@ -193,13 +193,11 @@ xhci_init (unsigned long physical_bar)
goto _free_xhci; goto _free_xhci;
} }
controller->reg_base = (u32)physical_bar; xhci->capreg = phys_to_virt(physical_bar);
xhci->capreg = phys_to_virt(controller->reg_base);
xhci->opreg = ((void *)xhci->capreg) + xhci->capreg->caplength; xhci->opreg = ((void *)xhci->capreg) + xhci->capreg->caplength;
xhci->hcrreg = ((void *)xhci->capreg) + xhci->capreg->rtsoff; xhci->hcrreg = ((void *)xhci->capreg) + xhci->capreg->rtsoff;
xhci->dbreg = ((void *)xhci->capreg) + xhci->capreg->dboff; xhci->dbreg = ((void *)xhci->capreg) + xhci->capreg->dboff;
xhci_debug("regbase: 0x%"PRIx32"\n", controller->reg_base); xhci_debug("regbase: 0x%"PRIx32"\n", physical_bar);
xhci_debug("caplen: 0x%"PRIx32"\n", xhci->capreg->caplength); xhci_debug("caplen: 0x%"PRIx32"\n", xhci->capreg->caplength);
xhci_debug("rtsoff: 0x%"PRIx32"\n", xhci->capreg->rtsoff); xhci_debug("rtsoff: 0x%"PRIx32"\n", xhci->capreg->rtsoff);
xhci_debug("dboff: 0x%"PRIx32"\n", xhci->capreg->dboff); xhci_debug("dboff: 0x%"PRIx32"\n", xhci->capreg->dboff);