Hi,
Here is a bunch of small fixes for the ahci driver which accumulated over the last week.
[ v2: use pci_config_maskw, one patch updated ]
cheers, Gerd
Gerd Hoffmann (4): ahci: set dma feature flag ahci: enable io/mem/dma ahci: fix off-by-one in port count ahci: set controller id
src/ahci.c | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-)
Signed-off-by: Gerd Hoffmann kraxel@redhat.com --- src/ahci.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/src/ahci.c b/src/ahci.c index 6c3127a..ee50e8f 100644 --- a/src/ahci.c +++ b/src/ahci.c @@ -50,6 +50,7 @@ static void sata_prep_readwrite(struct sata_cmd_fis *fis, command = (iswrite ? ATA_CMD_WRITE_DMA : ATA_CMD_READ_DMA); } + SET_FLATPTR(fis->feature, 1); /* dma */ SET_FLATPTR(fis->command, command); SET_FLATPTR(fis->sector_count, op->count); SET_FLATPTR(fis->lba_low, lba); @@ -62,6 +63,7 @@ static void sata_prep_atapi(struct sata_cmd_fis *fis, u16 blocksize) { memset_fl(fis, 0, sizeof(*fis)); SET_FLATPTR(fis->command, ATA_CMD_PACKET); + SET_FLATPTR(fis->feature, 1); /* dma */ SET_FLATPTR(fis->lba_mid, blocksize); SET_FLATPTR(fis->lba_high, blocksize >> 8); }
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@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);
On Thu, Dec 09, 2010 at 08:39:46AM +0100, Gerd Hoffmann wrote:
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@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;
You have an unused variable here.
The patch series looks fine to me. If there's no further comments I'll commit this weekend.
-Kevin
Hi,
- u16 cmd;
You have an unused variable here.
Ah, right. Howcome gcc didn't warn me on this, usually it does ... Is that warning turned off for seabios?
The patch series looks fine to me. If there's no further comments I'll commit this weekend.
Want me respin? Do do you just zap the variable when committing?
cheers, Gerd
On Fri, Dec 10, 2010 at 10:33:28AM +0100, Gerd Hoffmann wrote:
Hi,
- u16 cmd;
You have an unused variable here.
Ah, right. Howcome gcc didn't warn me on this, usually it does ... Is that warning turned off for seabios?
It warns for me.
Compiling whole program out/ccode.16.s src/ahci.c: In function ‘ahci_init_controller’: src/ahci.c:437:9: warning: unused variable ‘cmd’
Maybe something with different gcc versions?
$ gcc --version gcc (GCC) 4.5.1 20100924 (Red Hat 4.5.1-4)
The patch series looks fine to me. If there's no further comments I'll commit this weekend.
Want me respin? Do do you just zap the variable when committing?
I can fix it if it's easier.
-Kevin
Signed-off-by: Gerd Hoffmann kraxel@redhat.com --- src/ahci.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/ahci.c b/src/ahci.c index 0b23f43..7abff75 100644 --- a/src/ahci.c +++ b/src/ahci.c @@ -417,7 +417,7 @@ ahci_detect(void *data) int rc;
max = ctrl->caps & 0x1f; - for (pnr = 0; pnr < max; pnr++) { + for (pnr = 0; pnr <= max; pnr++) { if (!(ctrl->ports & (1 << pnr))) continue; dprintf(2, "AHCI/%d: probing\n", pnr);
Fill the controller id in the drive struct with the port number so we get a sane boot menu ordering with multiple hard disks attached.
Signed-off-by: Gerd Hoffmann kraxel@redhat.com --- src/ahci.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/src/ahci.c b/src/ahci.c index 7abff75..5373e72 100644 --- a/src/ahci.c +++ b/src/ahci.c @@ -345,6 +345,7 @@ ahci_port_init(struct ahci_ctrl_s *ctrl, u32 pnr) }
port->drive.type = DTYPE_AHCI; + port->drive.cntl_id = pnr; port->drive.removable = (buffer[0] & 0x80) ? 1 : 0; port->drive.desc = malloc_tmp(MAXDESCSIZE); if (!port->drive.desc) {
On Thu, Dec 09, 2010 at 08:39:44AM +0100, Gerd Hoffmann wrote:
Hi,
Here is a bunch of small fixes for the ahci driver which accumulated over the last week.
[ v2: use pci_config_maskw, one patch updated ]
I committed this series.
-Kevin