libpayload: Fix 16-bit read/write to PCI_COMMAND register

Change-Id: I34facbe0cbbdc91066799b586d96abca1599c509
Signed-off-by: Elyes HAOUAS <ehaouas@noos.fr>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/40743
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Nico Huber <nico.h@gmx.de>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Elyes HAOUAS 2020-04-27 05:34:05 +02:00 committed by Patrick Georgi
parent 804a34022c
commit 52e56e8479
2 changed files with 5 additions and 5 deletions

View File

@ -860,9 +860,9 @@ ehci_pci_init (pcidev_t addr)
hci_t *controller; hci_t *controller;
u32 reg_base; u32 reg_base;
u32 pci_command = pci_read_config32(addr, PCI_COMMAND); u16 pci_command = pci_read_config16(addr, PCI_COMMAND);
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_config16(addr, PCI_COMMAND, pci_command);
reg_base = pci_read_config32 (addr, USBBASE); reg_base = pci_read_config32 (addr, USBBASE);

View File

@ -62,11 +62,11 @@ static int usb_controller_initialize(int bus, int dev, int func)
/* enable busmaster */ /* enable busmaster */
if (devclass == 0xc03) { if (devclass == 0xc03) {
u32 pci_command; u16 pci_command;
pci_command = pci_read_config32(pci_device, PCI_COMMAND); pci_command = pci_read_config16(pci_device, PCI_COMMAND);
pci_command |= PCI_COMMAND_MASTER; pci_command |= PCI_COMMAND_MASTER;
pci_write_config32(pci_device, PCI_COMMAND, pci_command); pci_write_config16(pci_device, PCI_COMMAND, pci_command);
usb_debug("%02x:%02x.%x %04x:%04x.%d ", bus, dev, func, usb_debug("%02x:%02x.%x %04x:%04x.%d ", bus, dev, func,
pciid >> 16, pciid & 0xFFFF, func); pciid >> 16, pciid & 0xFFFF, func);