sb/intel/i82801gx: Fix 16-bit read/write PCI_COMMAND register

Change-Id: I11b8743234cb1292db8c930edecf8fb5c47d63fd
Signed-off-by: Elyes HAOUAS <ehaouas@noos.fr>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/40741
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
This commit is contained in:
Elyes HAOUAS 2020-04-27 05:08:26 +02:00 committed by Nico Huber
parent 38df060aba
commit 1234925ad7
6 changed files with 10 additions and 21 deletions

View File

@ -230,8 +230,7 @@ static void azalia_init(struct device *dev)
pci_write_config32(dev, 0x120, reg32); pci_write_config32(dev, 0x120, reg32);
/* Set Bus Master */ /* Set Bus Master */
reg32 = pci_read_config32(dev, PCI_COMMAND); pci_or_config16(dev, PCI_COMMAND, PCI_COMMAND_MASTER);
pci_write_config32(dev, PCI_COMMAND, reg32 | PCI_COMMAND_MASTER);
pci_write_config8(dev, 0x3c, 0x0a); // unused? pci_write_config8(dev, 0x3c, 0x0a); // unused?

View File

@ -54,23 +54,21 @@ static void ich_hide_devfn(unsigned int devfn)
void i82801gx_enable(struct device *dev) void i82801gx_enable(struct device *dev)
{ {
u32 reg32; u16 reg16;
if (!dev->enabled) { if (!dev->enabled) {
printk(BIOS_DEBUG, "%s: Disabling device\n", dev_path(dev)); printk(BIOS_DEBUG, "%s: Disabling device\n", dev_path(dev));
/* Ensure memory, io, and bus master are all disabled */ /* Ensure memory, io, and bus master are all disabled */
reg32 = pci_read_config32(dev, PCI_COMMAND); reg16 = pci_read_config16(dev, PCI_COMMAND);
reg32 &= ~(PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY | PCI_COMMAND_IO); reg16 &= ~(PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY | PCI_COMMAND_IO);
pci_write_config32(dev, PCI_COMMAND, reg32); pci_write_config16(dev, PCI_COMMAND, reg16);
/* Hide this device if possible */ /* Hide this device if possible */
ich_hide_devfn(dev->path.pci.devfn); ich_hide_devfn(dev->path.pci.devfn);
} else { } else {
/* Enable SERR */ /* Enable SERR */
reg32 = pci_read_config32(dev, PCI_COMMAND); pci_or_config16(dev, PCI_COMMAND, PCI_COMMAND_SERR);
reg32 |= PCI_COMMAND_SERR;
pci_write_config32(dev, PCI_COMMAND, reg32);
if (dev->path.pci.devfn == PCI_DEVFN(31, 2)) { if (dev->path.pci.devfn == PCI_DEVFN(31, 2)) {
printk(BIOS_DEBUG, "Set SATA mode early\n"); printk(BIOS_DEBUG, "Set SATA mode early\n");

View File

@ -30,8 +30,7 @@ static void ide_init(struct device *dev)
enable_secondary = config->ide_enable_secondary; enable_secondary = config->ide_enable_secondary;
} }
reg32 = pci_read_config32(dev, PCI_COMMAND); pci_or_config16(dev, PCI_COMMAND, PCI_COMMAND_IO | PCI_COMMAND_MASTER);
pci_write_config32(dev, PCI_COMMAND, reg32 | PCI_COMMAND_IO | PCI_COMMAND_MASTER);
/* Native Capable, but not enabled. */ /* Native Capable, but not enabled. */
pci_write_config8(dev, 0x09, 0x8a); pci_write_config8(dev, 0x09, 0x8a);

View File

@ -47,9 +47,7 @@ static void pci_init(struct device *dev)
printk(BIOS_DEBUG, "Initializing ICH7 PCIe bridge.\n"); printk(BIOS_DEBUG, "Initializing ICH7 PCIe bridge.\n");
/* Enable Bus Master */ /* Enable Bus Master */
reg32 = pci_read_config32(dev, PCI_COMMAND); pci_or_config16(dev, PCI_COMMAND, PCI_COMMAND_MASTER);
reg32 |= PCI_COMMAND_MASTER;
pci_write_config32(dev, PCI_COMMAND, reg32);
/* Set Cache Line Size to 0x10 */ /* Set Cache Line Size to 0x10 */
// This has no effect but the OS might expect it // This has no effect but the OS might expect it

View File

@ -10,14 +10,12 @@
static void usb_init(struct device *dev) static void usb_init(struct device *dev)
{ {
u32 reg32;
u8 reg8; u8 reg8;
/* USB Specification says the device must be Bus Master */ /* USB Specification says the device must be Bus Master */
printk(BIOS_DEBUG, "UHCI: Setting up controller.. "); printk(BIOS_DEBUG, "UHCI: Setting up controller.. ");
reg32 = pci_read_config32(dev, PCI_COMMAND); pci_or_config16(dev, PCI_COMMAND, PCI_COMMAND_MASTER);
pci_write_config32(dev, PCI_COMMAND, reg32 | PCI_COMMAND_MASTER);
// Erratum // Erratum
pci_write_config8(dev, 0xca, 0x00); pci_write_config8(dev, 0xca, 0x00);

View File

@ -18,10 +18,7 @@ static void usb_ehci_init(struct device *dev)
u8 reg8; u8 reg8;
printk(BIOS_DEBUG, "EHCI: Setting up controller.. "); printk(BIOS_DEBUG, "EHCI: Setting up controller.. ");
reg32 = pci_read_config32(dev, PCI_COMMAND); pci_or_config16(dev, PCI_COMMAND, PCI_COMMAND_MASTER | PCI_COMMAND_SERR);
reg32 |= PCI_COMMAND_MASTER;
reg32 |= PCI_COMMAND_SERR;
pci_write_config32(dev, PCI_COMMAND, reg32);
reg32 = pci_read_config32(dev, 0xdc); reg32 = pci_read_config32(dev, 0xdc);
reg32 |= (1 << 31) | (1 << 27); reg32 |= (1 << 31) | (1 << 27);