[SeaBIOS] [PATCH v2 2/4] ahci: enable io/mem/dma

Gerd Hoffmann kraxel at redhat.com
Thu Dec 9 08:39:46 CET 2010


Make sure IO, MMIO and DMA are enabled in pci config space
before using the device.

[ v2: use pci_config_maskw ]

Signed-off-by: Gerd Hoffmann <kraxel at redhat.com>
---
 src/ahci.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/src/ahci.c b/src/ahci.c
index ee50e8f..0b23f43 100644
--- a/src/ahci.c
+++ b/src/ahci.c
@@ -436,6 +436,7 @@ ahci_init_controller(int bdf)
 {
     struct ahci_ctrl_s *ctrl = malloc_fseg(sizeof(*ctrl));
     u32 val;
+    u16 cmd;
 
     if (!ctrl) {
         warn_noalloc();
@@ -447,6 +448,9 @@ ahci_init_controller(int bdf)
     dprintf(1, "AHCI controller at %02x.%x, iobase %x, irq %d\n",
             bdf >> 3, bdf & 7, ctrl->iobase, ctrl->irq);
 
+    pci_config_maskw(bdf, PCI_COMMAND, 0,
+                     PCI_COMMAND_IO | PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER);
+
     val = ahci_ctrl_readl(ctrl, HOST_CTL);
     ahci_ctrl_writel(ctrl, HOST_CTL, val | HOST_CTL_AHCI_EN);
 
-- 
1.7.1




More information about the SeaBIOS mailing list