Skip to contentSkip to conversation

pci: Do not skip legacy IDE device configutation

PATCH Superseded Bin Meng 2 participants 6 messages May 15, 2015 – May 18, 2015 1 message not in the archive

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Bin Meng

author
#1 lore raw

PATCH 2/6 pci: Do not skip legacy IDE device configutation

The legacy IDE device has a BAR4 (Bus Master Interface BAR) which needs to be configured.

---

 drivers/pci/pci_auto.c | 14 --------------
 1 file changed, 14 deletions(-)
drivers/pci/pci_auto.c +0 -14
index 43965d8..7c10983 100644
@@ -20,8 +20,6 @@
 #define DEBUGF(x...)
 #endif /* DEBUG */
 
-#define	PCIAUTO_IDE_MODE_MASK		0x05
-
 /* the user can define CONFIG_SYS_PCI_CACHE_LINE_SIZE to avoid problems */
 #ifndef CONFIG_SYS_PCI_CACHE_LINE_SIZE
 #define CONFIG_SYS_PCI_CACHE_LINE_SIZE	8
@@ -424,7 +422,6 @@ int pciauto_config_device(struct pci_controller *hose, pci_dev_t dev)
 {
 	unsigned int sub_bus = PCI_BUS(dev);
 	unsigned short class;
-	unsigned char prg_iface;
 	int n;
 
 	pci_hose_read_config_word(hose, dev, PCI_CLASS_DEVICE, &class);
@@ -460,17 +457,6 @@ int pciauto_config_device(struct pci_controller *hose, pci_dev_t dev)
 #endif
 		break;
 
-	case PCI_CLASS_STORAGE_IDE:
-		pci_hose_read_config_byte(hose, dev, PCI_CLASS_PROG, &prg_iface);
-		if (!(prg_iface & PCIAUTO_IDE_MODE_MASK)) {
-			DEBUGF("PCI Autoconfig: Skipping legacy mode IDE controller\n");
-			return sub_bus;
-		}
-
-		pciauto_setup_device(hose, dev, 6, hose->pci_mem,
-			hose->pci_prefetch, hose->pci_io);
-		break;
-
 	case PCI_CLASS_BRIDGE_CARDBUS:
 		/*
 		 * just do a minimal setup of the bridge,
Signature · 1 line
1.8.2.1
#2 lore raw

PATCH 2/6 pci: Do not skip legacy IDE device configutation

Hi Bin,

Quoted 8 lines · Bin Meng

The legacy IDE device has a BAR4 (Bus Master Interface BAR) which needs to be configured.

---

 drivers/pci/pci_auto.c | 14 --------------
 1 file changed, 14 deletions(-)

I don't see how this code change relates to your commit message...

Quoted 41 lines
drivers/pci/pci_auto.c +0 -15
index 43965d8..7c10983 100644
@@ -20,8 +20,6 @@
 #define DEBUGF(x...)
 #endif /* DEBUG */
 
-#define        PCIAUTO_IDE_MODE_MASK           0x05
-
 /* the user can define CONFIG_SYS_PCI_CACHE_LINE_SIZE to avoid problems */
 #ifndef CONFIG_SYS_PCI_CACHE_LINE_SIZE
 #define CONFIG_SYS_PCI_CACHE_LINE_SIZE 8
@@ -424,7 +422,6 @@ int pciauto_config_device(struct pci_controller *hose, pci_dev_t dev)
 {
        unsigned int sub_bus = PCI_BUS(dev);
        unsigned short class;
-       unsigned char prg_iface;
        int n;
 
        pci_hose_read_config_word(hose, dev, PCI_CLASS_DEVICE, &class);
@@ -460,17 +457,6 @@ int pciauto_config_device(struct pci_controller *hose, pci_dev_t dev)
 #endif
                break;
 
-       case PCI_CLASS_STORAGE_IDE:
-               pci_hose_read_config_byte(hose, dev, PCI_CLASS_PROG, &prg_iface);
-               if (!(prg_iface & PCIAUTO_IDE_MODE_MASK)) {
-                       DEBUGF("PCI Autoconfig: Skipping legacy mode IDE controller\n");
-                       return sub_bus;
-               }
-
-               pciauto_setup_device(hose, dev, 6, hose->pci_mem,
-                       hose->pci_prefetch, hose->pci_io);
-               break;
-
        case PCI_CLASS_BRIDGE_CARDBUS:
                /*
                 * just do a minimal setup of the bridge,
--
Quoted 2 lines

1.8.2.1

Regards,
Simon

author
#3 lore raw

PATCH 3/6 drivers: block: Remove the ata_piix driver

In reply to a message not in the archive

This driver was originally added to support the native IDE mode for Intel chipset, however it has some bugs like not supporting ATAPI devices, endianess issue, or even broken build when CONFIG_LAB48. Given no board is using this driver as of today, rather than fixing all these issues we just remove it from the source tree.

---

 drivers/block/Makefile   |   1 -
 drivers/block/ata_piix.c | 717 -----------------------------------------------
 drivers/block/ata_piix.h |  71 -----
 3 files changed, 789 deletions(-)
 delete mode 100644 drivers/block/ata_piix.c
 delete mode 100644 drivers/block/ata_piix.h
drivers/block/Makefile +0 -1
index 8697da4..f161c01 100644
@@ -6,7 +6,6 @@
 #
 
 obj-$(CONFIG_SCSI_AHCI) += ahci.o
-obj-$(CONFIG_ATA_PIIX) += ata_piix.o
 obj-$(CONFIG_DWC_AHSATA) += dwc_ahsata.o
 obj-$(CONFIG_FSL_SATA) += fsl_sata.o
 obj-$(CONFIG_IDE_FTIDE020) += ftide020.o
drivers/block/ata_piix.c deleted +0 -717

717 lines not on this page · raw message

drivers/block/ata_piix.h deleted +0 -71

71 lines not on this page · raw message

Signature · 1 line
1.8.2.1
author
#4 lore raw

PATCH 4/6 cmd_ide: Eliminate build warnings in atapi_inquiry()

In reply to a message not in the archive

Elinimate the following build warning in atapi_inquiry():
"warning: assignment from incompatible pointer type [enabled by default]"

---

 common/cmd_ide.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
common/cmd_ide.c +3 -3
index 04a6d9b..ecd3e9d 100644
@@ -79,7 +79,7 @@ static void ident_cpy (unsigned char *dest, unsigned char *src, unsigned int len
 
 #ifdef CONFIG_ATAPI
 static void	atapi_inquiry(block_dev_desc_t *dev_desc);
-static ulong atapi_read(int device, ulong blknr, lbaint_t blkcnt,
+static ulong atapi_read(int device, lbaint_t blknr, lbaint_t blkcnt,
 			void *buffer);
 #endif
 
@@ -1388,13 +1388,13 @@ static void atapi_inquiry(block_dev_desc_t *dev_desc)
 #define ATAPI_READ_BLOCK_SIZE	2048	/* assuming CD part */
 #define ATAPI_READ_MAX_BLOCK	(ATAPI_READ_MAX_BYTES/ATAPI_READ_BLOCK_SIZE)
 
-ulong atapi_read(int device, ulong blknr, lbaint_t blkcnt, void *buffer)
+ulong atapi_read(int device, lbaint_t blknr, lbaint_t blkcnt, void *buffer)
 {
 	ulong n = 0;
 	unsigned char ccb[12];	/* Command descriptor block */
 	ulong cnt;
 
-	debug("atapi_read dev %d start %lX, blocks " LBAF " buffer at %lX\n",
+	debug("atapi_read dev %d start " LBAF " blocks " LBAF " buffer at %lX\n",
 	      device, blknr, blkcnt, (ulong) buffer);
 
 	do {
Signature · 1 line
1.8.2.1
author
#5 lore raw

PATCH 5/6 x86: Add CONFIG_LBA48 and remove CONFIG_ATAPI in x86-common.h

In reply to a message not in the archive

Enable CONFIG_LBA48 to support large disks. CONFIG_ATAPI is only needed by cmd_ide.c which is not common for modern x86 targets, hence remove it.

---

 include/configs/x86-common.h | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
include/configs/x86-common.h +1 -4
index 0b61615..3912b39 100644
@@ -37,6 +37,7 @@
 #define CONFIG_SCSI_AHCI
 #ifdef CONFIG_SCSI_AHCI
 #define CONFIG_LIBATA
+#define CONFIG_LBA48
 #define CONFIG_SYS_64BIT_LBA
 
 #define CONFIG_SYS_SCSI_MAX_SCSI_ID	2
@@ -76,10 +77,6 @@
 #define CONFIG_SYS_HUSH_PARSER
 
 #define CONFIG_SUPPORT_VFAT
-/************************************************************
- * ATAPI support (experimental)
- ************************************************************/
-#define CONFIG_ATAPI
 
 /************************************************************
  * DISK Partition support
Signature · 1 line
1.8.2.1
author
#6 lore raw

PATCH 6/6 x86: qemu: Add ATA/SATA support

In reply to a message not in the archive

Enable legacy IDE support on the pc target and AHCI support on the q35 target. Default configuration is to support the pc target.

---

 include/configs/qemu-x86.h | 26 +++++++++++++++++++++++++-
 include/pci_ids.h          |  1 +
 2 files changed, 26 insertions(+), 1 deletion(-)
include/configs/qemu-x86.h +25 -1
index e2a223f..77f88d2 100644
@@ -36,8 +36,32 @@
 					"stdout=serial,vga\0" \
 					"stderr=serial,vga\0"
 
+/*
+ * ATA/SATA support for QEMU x86 targets
+ *   - Only legacy IDE controller is supported for QEMU '-M pc' target
+ *   - AHCI controller is supported for QEMU '-M q35' target
+ *
+ * Default configuraion is to support the QEMU default x86 target
+ * Undefine CONFIG_CMD_IDE to support q35 target
+ */
+#define CONFIG_CMD_IDE
+#ifdef CONFIG_CMD_IDE
+#define CONFIG_SYS_IDE_MAXBUS		2
+#define CONFIG_SYS_IDE_MAXDEVICE	4
+#define CONFIG_SYS_ATA_BASE_ADDR	0
+#define CONFIG_SYS_ATA_DATA_OFFSET	0
+#define CONFIG_SYS_ATA_REG_OFFSET	0
+#define CONFIG_SYS_ATA_ALT_OFFSET	0
+#define CONFIG_SYS_ATA_IDE0_OFFSET	0x1f0
+#define CONFIG_SYS_ATA_IDE1_OFFSET	0x170
+#define CONFIG_ATAPI
+
+#undef CONFIG_SCSI_AHCI
+#undef CONFIG_CMD_SCSI
+#else
 #define CONFIG_SCSI_DEV_LIST		\
-	{PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371SB_1}
+	{PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH9_AHCI}
+#endif
 
 /* GPIO is not supported */
 #undef CONFIG_INTEL_ICH6_GPIO
include/pci_ids.h +1 -0
index 2e66851..5771e12 100644
@@ -2838,6 +2838,7 @@
 #define PCI_DEVICE_ID_INTEL_ICH9_6	0x2930
 #define PCI_DEVICE_ID_INTEL_ICH9_7	0x2916
 #define PCI_DEVICE_ID_INTEL_ICH9_8	0x2918
+#define PCI_DEVICE_ID_INTEL_ICH9_AHCI	0x2922
 #define PCI_DEVICE_ID_INTEL_I7_MCR	0x2c18
 #define PCI_DEVICE_ID_INTEL_I7_MC_TAD	0x2c19
 #define PCI_DEVICE_ID_INTEL_I7_MC_RAS	0x2c1a
Signature · 1 line
1.8.2.1