Skip to contentSkip to conversation

ARM: PCI: Use PCI_CLASS_* defines for PCI class

PATCH Superseded Rostislav Lisovy 3 participants 5 messages Aug 1, 2014 – Aug 25, 2014 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: PCI: Use PCI_CLASS_* defines for PCI class

---
 arch/arm/kernel/bios32.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
arch/arm/kernel/bios32.c +2 -3
index 17a26c1..e511ad1 100644
@@ -255,10 +255,9 @@ static void pci_fixup_it8152(struct pci_dev *dev)
 {
 	int i;
 	/* fixup for ITE 8152 devices */
-	/* FIXME: add defines for class 0x68000 and 0x80103 */
 	if ((dev->class >> 8) == PCI_CLASS_BRIDGE_HOST ||
-	    dev->class == 0x68000 ||
-	    dev->class == 0x80103) {
+	    dev->class == (PCI_CLASS_BRIDGE_OTHER << 8) ||
+	    dev->class == ((PCI_CLASS_SYSTEM_DMA << 8) | 0x03)) {
 		for (i = 0; i < PCI_NUM_RESOURCES; i++) {
 			dev->resource[i].start = 0;
 			dev->resource[i].end   = 0;
Signature · 1 line
1.7.10.4
#1 lore raw
Quoted 13 lines · Rostislav Lisovy
---
 arch/arm/kernel/bios32.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
arch/arm/kernel/bios32.c +0 -0
index 17a26c1..e511ad1 100644
@@ -255,10 +255,9 @@ static void pci_fixup_it8152(struct pci_dev *dev)
 {
 	int i;

arch/arm/kernel/bios32.c static void pci_fixup_it8152(struct pci_dev *dev) · line 263

Quoted 10 lines
arch/arm/kernel/bios32.c +2 -3
 	/* fixup for ITE 8152 devices */
-	/* FIXME: add defines for class 0x68000 and 0x80103 */
 	if ((dev->class >> 8) == PCI_CLASS_BRIDGE_HOST ||
-	    dev->class == 0x68000 ||
-	    dev->class == 0x80103) {
+	    dev->class == (PCI_CLASS_BRIDGE_OTHER << 8) ||
+	    dev->class == ((PCI_CLASS_SYSTEM_DMA << 8) | 0x03)) {
 		for (i = 0; i < PCI_NUM_RESOURCES; i++) {
 			dev->resource[i].start = 0;
 			dev->resource[i].end   = 0;

Care to explain how your new code is equivalent to the old one?

Thanks,
Sasha

#2 lore raw
Quoted 11 lines · Sasha Levin

arch/arm/kernel/bios32.c static void pci_fixup_it8152(struct pci_dev *dev) · line 263

Quoted 10 lines
arch/arm/kernel/bios32.c +2 -3
-     /* FIXME: add defines for class 0x68000 and 0x80103 */
      if ((dev->class >> 8) == PCI_CLASS_BRIDGE_HOST ||
-         dev->class == 0x68000 ||
-         dev->class == 0x80103) {
+         dev->class == (PCI_CLASS_BRIDGE_OTHER << 8) ||
+         dev->class == ((PCI_CLASS_SYSTEM_DMA << 8) | 0x03)) {
              for (i = 0; i < PCI_NUM_RESOURCES; i++) {
                      dev->resource[i].start = 0;
                      dev->resource[i].end   = 0;
Quoted 1 line

Care to explain how your new code is equivalent to the old one?

The header file include/linux/pci_ids.h defines
#define PCI_CLASS_BRIDGE_OTHER 0x0680
#define PCI_CLASS_SYSTEM_DMA 0x0801

((struct pci_dev*)dev)->class
corresponds to the 3 bytes Class code in the PCI Configuration space header -- 1B Base class, 1B Sub-class, 1B Reg-level interface.

In that case
(PCI_CLASS_BRIDGE_OTHER << 8)
is equivalent to 0x68000 (imagine the leading zero) and
((PCI_CLASS_SYSTEM_DMA << 8) | 0x03))
is equivalent to 0x80103.

Best regards;
Rostislav

#3 lore raw
Quoted 22 lines · Rostislav Lisovy
Quoted 11 lines · Sasha Levin

arch/arm/kernel/bios32.c static void pci_fixup_it8152(struct pci_dev *dev) · line 263

Quoted 10 lines
arch/arm/kernel/bios32.c +2 -3
-     /* FIXME: add defines for class 0x68000 and 0x80103 */
      if ((dev->class >> 8) == PCI_CLASS_BRIDGE_HOST ||
-         dev->class == 0x68000 ||
-         dev->class == 0x80103) {
+         dev->class == (PCI_CLASS_BRIDGE_OTHER << 8) ||
+         dev->class == ((PCI_CLASS_SYSTEM_DMA << 8) | 0x03)) {
              for (i = 0; i < PCI_NUM_RESOURCES; i++) {
                      dev->resource[i].start = 0;
                      dev->resource[i].end   = 0;
Quoted 1 line

Care to explain how your new code is equivalent to the old one?

The header file include/linux/pci_ids.h defines
#define PCI_CLASS_BRIDGE_OTHER 0x0680
#define PCI_CLASS_SYSTEM_DMA 0x0801

((struct pci_dev*)dev)->class
corresponds to the 3 bytes Class code in the PCI Configuration space header -- 1B Base class, 1B Sub-class, 1B Reg-level interface.

Quoted 7 lines

In that case
(PCI_CLASS_BRIDGE_OTHER << 8)
is equivalent to 0x68000 (imagine the leading zero) and
((PCI_CLASS_SYSTEM_DMA << 8) | 0x03))
is equivalent to 0x80103.

Just a kind reminder in case anyone is interested in reviewing and accepting the patch.

Best regards;
Rostislav Lisovy

Reviewed-by
#4 lore raw
Quoted 31 lines · Rostislav Lisovy
Quoted 22 lines · Rostislav Lisovy
Quoted 11 lines · Sasha Levin

arch/arm/kernel/bios32.c static void pci_fixup_it8152(struct pci_dev *dev) · line 263

Quoted 10 lines
arch/arm/kernel/bios32.c +2 -3
-     /* FIXME: add defines for class 0x68000 and 0x80103 */
      if ((dev->class >> 8) == PCI_CLASS_BRIDGE_HOST ||
-         dev->class == 0x68000 ||
-         dev->class == 0x80103) {
+         dev->class == (PCI_CLASS_BRIDGE_OTHER << 8) ||
+         dev->class == ((PCI_CLASS_SYSTEM_DMA << 8) | 0x03)) {
              for (i = 0; i < PCI_NUM_RESOURCES; i++) {
                      dev->resource[i].start = 0;
                      dev->resource[i].end   = 0;
Quoted 1 line

Care to explain how your new code is equivalent to the old one?

The header file include/linux/pci_ids.h defines
#define PCI_CLASS_BRIDGE_OTHER 0x0680
#define PCI_CLASS_SYSTEM_DMA 0x0801

((struct pci_dev*)dev)->class
corresponds to the 3 bytes Class code in the PCI Configuration space header -- 1B Base class, 1B Sub-class, 1B Reg-level interface.

Quoted 7 lines

In that case
(PCI_CLASS_BRIDGE_OTHER << 8)
is equivalent to 0x68000 (imagine the leading zero) and
((PCI_CLASS_SYSTEM_DMA << 8) | 0x03))
is equivalent to 0x80103.

Quoted 2 lines

Just a kind reminder in case anyone is interested in reviewing and accepting the patch.

Quoted 8 lines

Best regards;
Rostislav Lisovy

.

Signature · 2 lines
Thanks!
Yijing