]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - drivers/block/ahci.c
ati_radeon: Support PCI virtual not eq bus mapping.
[karo-tx-uboot.git] / drivers / block / ahci.c
index 3d82c625a353dfc36ec8bddeb6856cca5e9a5317..a3ca2dcaf70e7b3535816a24d2193c9ec31513d3 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) Freescale Semiconductor, Inc. 2006. All rights reserved.
+ * Copyright (C) Freescale Semiconductor, Inc. 2006.
  * Author: Jason Jin<Jason.jin@freescale.com>
  *         Zhang Wei<wei.zhang@freescale.com>
  *
@@ -26,8 +26,6 @@
  */
 #include <common.h>
 
-#ifdef CONFIG_SCSI_AHCI
-
 #include <command.h>
 #include <pci.h>
 #include <asm/processor.h>
@@ -253,7 +251,6 @@ static void ahci_print_info(struct ahci_probe_ent *probe_ent)
 
 static int ahci_init_one(pci_dev_t pdev)
 {
-       u32 iobase;
        u16 vendor;
        int rc;
 
@@ -263,9 +260,6 @@ static int ahci_init_one(pci_dev_t pdev)
        memset(probe_ent, 0, sizeof(struct ahci_probe_ent));
        probe_ent->dev = pdev;
 
-       pci_read_config_dword(pdev, AHCI_PCI_BAR, &iobase);
-       iobase &= ~0xf;
-
        probe_ent->host_flags = ATA_FLAG_SATA
                                | ATA_FLAG_NO_LEGACY
                                | ATA_FLAG_MMIO
@@ -274,7 +268,8 @@ static int ahci_init_one(pci_dev_t pdev)
        probe_ent->pio_mask = 0x1f;
        probe_ent->udma_mask = 0x7f;    /*Fixme,assume to support UDMA6 */
 
-       probe_ent->mmio_base = iobase;
+       probe_ent->mmio_base = (u32)pci_map_bar(pdev, AHCI_PCI_BAR,
+                                               PCI_REGION_MEM);
 
        /* Take from kernel:
         * JMicron-specific fixup:
@@ -607,7 +602,7 @@ static int ata_scsiop_read10(ccb * pccb)
  */
 static int ata_scsiop_read_capacity10(ccb *pccb)
 {
-       u8 buf[8];
+       u32 cap;
 
        if (!ataid[pccb->target]) {
                printf("scsi_ahci: SCSI READ CAPACITY10 command failure. "
@@ -616,14 +611,12 @@ static int ata_scsiop_read_capacity10(ccb *pccb)
                return -EPERM;
        }
 
-       memset(buf, 0, 8);
-
-       *(u32 *) buf = le32_to_cpu(ataid[pccb->target]->lba_capacity);
-
-       buf[6] = 512 >> 8;
-       buf[7] = 512 & 0xff;
+       cap = le32_to_cpu(ataid[pccb->target]->lba_capacity);
+       memcpy(pccb->pdata, &cap, sizeof(cap));
 
-       memcpy(pccb->pdata, buf, 8);
+       pccb->pdata[4] = pccb->pdata[5] = 0;
+       pccb->pdata[6] = 512 >> 8;
+       pccb->pdata[7] = 512 & 0xff;
 
        return 0;
 }
@@ -678,7 +671,7 @@ void scsi_low_level_init(int busdevfunc)
 
        linkmap = probe_ent->link_port_map;
 
-       for (i = 0; i < CFG_SCSI_MAX_SCSI_ID; i++) {
+       for (i = 0; i < CONFIG_SYS_SCSI_MAX_SCSI_ID; i++) {
                if (((linkmap >> i) & 0x01)) {
                        if (ahci_port_start((u8) i)) {
                                printf("Can not start port %d\n", i);
@@ -700,4 +693,3 @@ void scsi_print_error(ccb * pccb)
 {
        /*The ahci error info can be read in the ahci driver*/
 }
-#endif