Skip to contentSkip to conversation

pci: Do not skip legacy IDE device configuration

PATCH New Bin Meng 2 participants 17 messages May 16, 2015 – Jul 13, 2015 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

Bin Meng

author
#1 lore raw

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

In reply to a message not in the archive

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

---

Changes in v2:
- Correct a typo in the commit message title

 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
author
#5 lore raw

PATCH v2 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, endianness 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.

---

Changes in v2:
- Correct typo of 'endianness' in the commit message

 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
#9 lore raw

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

In reply to a message not in the archive

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

---

Changes in v2:
- Correct the typo of 'Eliminate' in the commit message

 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
#12 lore raw

PATCH v2 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.

---

Changes in v2: None

 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
#15 lore raw

PATCH v2 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.

---

Changes in v2: None

 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
#6 lore raw

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

In reply to Bin Meng
Quoted 13 lines · Bin Meng

This driver was originally added to support the native IDE mode for Intel chipset, however it has some bugs like not supporting ATAPI devices, endianness 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.

---

Changes in v2:
- Correct typo of 'endianness' in the commit message

Quoted 7 lines
 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
#10 lore raw

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

In reply to Bin Meng
Quoted 43 lines · Bin Meng

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

---

Changes in v2:
- Correct the typo of 'Eliminate' in the commit message

 common/cmd_ide.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
common/cmd_ide.c +3 -4
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 {
--
Quoted 2 lines

1.8.2.1

#13 lore raw

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

In reply to Bin Meng
Quoted 35 lines · Bin Meng

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.

---

Changes in v2: None

 include/configs/x86-common.h | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
include/configs/x86-common.h +1 -5
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
--
Quoted 2 lines

1.8.2.1

#16 lore raw

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

In reply to Bin Meng
Quoted 5 lines · Bin Meng

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

Quoted 8 lines

---

Changes in v2: None

 include/configs/qemu-x86.h | 26 +++++++++++++++++++++++++-
 include/pci_ids.h          |  1 +
 2 files changed, 26 insertions(+), 1 deletion(-)
author
#2 lore raw

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

In reply to Bin Meng

Hi Simon,

Reply this thread to the v2 patch.

Quoted 2 lines · Simon Glass

Hi Bin,

Quoted 7 lines · Bin Meng
Quoted 7 lines

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

---

Quoted 8 lines
Quoted 5 lines

Changes in v2:
- Correct a typo in the commit message title

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

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

The legacy IDE controller reports PI (offset 9 in the configuration space) as 0x80, so the codes here will skip (!(0x80 & 0x05)) its configuration (ie: BAR4 won't be assigned to a valid memory window)

[snip]

Regards,
Bin

#3 lore raw

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

+Wolfgang

Quoted 21 lines · Bin Meng

Hi Simon,

Reply this thread to the v2 patch.

Quoted 2 lines · Simon Glass

Hi Bin,

Quoted 13 lines · Bin Meng
Quoted 12 lines

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

---

Changes in v2:
- Correct a typo in the commit message title

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

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

The legacy IDE controller reports PI (offset 9 in the configuration space) as 0x80, so the codes here will skip (!(0x80 & 0x05)) its configuration (ie: BAR4 won't be assigned to a valid memory window)

OK I see. It looks like this code has been there since the dawn of U-Boot. I added Wolfgang in case we are missing something.

Regards,
Simon

#4 lore raw

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

Quoted 27 lines · Simon Glass

+Wolfgang

Quoted 24 lines · Bin Meng

Hi Simon,

Reply this thread to the v2 patch.

Quoted 2 lines · Simon Glass

Hi Bin,

Quoted 15 lines · Bin Meng
Quoted 5 lines

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

Quoted 7 lines

---

Changes in v2:
- Correct a typo in the commit message title

 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 8 lines
Quoted 3 lines

The legacy IDE controller reports PI (offset 9 in the configuration space) as 0x80, so the codes here will skip (!(0x80 & 0x05)) its configuration (ie: BAR4 won't be assigned to a valid memory window)

OK I see. It looks like this code has been there since the dawn of U-Boot. I added Wolfgang in case we are missing something.

#11 lore raw

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

In reply to Simon Glass
Quoted 42 lines · Simon Glass
Quoted 41 lines · Bin Meng

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

---

Changes in v2:
- Correct the typo of 'Eliminate' in the commit message

 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);
 
Quoted 6 lines
Quoted 4 lines
common/cmd_ide.c +0 -1
        do {
--

1.8.2.1

Applied to u-boot-x86, thanks!

#14 lore raw

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

In reply to Simon Glass
Quoted 33 lines · Simon Glass
Quoted 32 lines · Bin Meng

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.

---

Changes in v2: None

 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
 
Quoted 7 lines
Quoted 5 lines
include/configs/x86-common.h +0 -1
 /************************************************************
  * DISK Partition support
--

1.8.2.1

Applied to u-boot-x86, thanks!

#17 lore raw

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

In reply to Simon Glass
Quoted 8 lines · Simon Glass
Quoted 7 lines · Bin Meng

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

---

Quoted 8 lines
Quoted 6 lines

Changes in v2: None

 include/configs/qemu-x86.h | 26 +++++++++++++++++++++++++-
 include/pci_ids.h          |  1 +
 2 files changed, 26 insertions(+), 1 deletion(-)

Applied to u-boot-x86, thanks!

author
#7 lore raw

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

In reply to Simon Glass

Hi Simon,

Quoted 22 lines · Simon Glass
Quoted 13 lines · Bin Meng

This driver was originally added to support the native IDE mode for Intel chipset, however it has some bugs like not supporting ATAPI devices, endianness 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.

---

Changes in v2:
- Correct typo of 'endianness' in the commit message

Quoted 7 lines
 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
Quoted 1 line

Given we are preparing next release on u-boot-x86/master, could this patch be applied now?

Regards,
Bin

#8 lore raw

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

Hi Bin,

Quoted 25 lines · Bin Meng

Hi Simon,

Quoted 22 lines · Simon Glass
Quoted 20 lines · Bin Meng

This driver was originally added to support the native IDE mode for Intel chipset, however it has some bugs like not supporting ATAPI devices, endianness 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.

---

Changes in v2:
- Correct typo of 'endianness' in the commit message

 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
Quoted 4 lines
Quoted 1 line

Given we are preparing next release on u-boot-x86/master, could this patch be applied now?

Yes!

Applied to u-boot-x86, thanks!