Skip to contentSkip to conversation

Add piix fix up function into pii.c

IDE-PATCH hugang 2 participants 2 messages Dec 4, 2002

lore
Share & tools
lore

hugang

author
#0 lore raw

Hello all:

Please apply.
Index: drivers/ide//pci/piix.c
===================================================================
RCS file: /home/hugang/local/cvs/2.4/drivers/ide/pci/piix.c,v retrieving revision 1.1.1.2

ide//pci/piix.c +21 -0
diff -u -r1.1.1.2 piix.c
@@ -652,6 +652,27 @@
  
 static void __init init_setup_piix (struct pci_dev *dev, ide_pci_device_t *d)
 {
+	int i;
+	unsigned short cmd;
+	unsigned long flags;
+	unsigned long base_address[4] = { 0x1f0, 0x3f4, 0x170, 0x374 };
+
+	printk(KERN_INFO "PIIX: fixup IDE controller\n");
+	local_irq_save(flags);
+	pci_read_config_word(dev, PCI_COMMAND, &cmd);
+	pci_write_config_word(dev, PCI_COMMAND, cmd & ~PCI_COMMAND_IO);
+	
+	for (i=0; i<4; i++) {
+		dev->resource[i].start = base_address[i];
+		dev->resource[i].flags |= PCI_BASE_ADDRESS_SPACE_IO;
+		pci_write_config_dword(dev,
+				       (PCI_BASE_ADDRESS_0 + (i * 4)),
+				       dev->resource[i].start);
+	}
+	
+	pci_write_config_word(dev, PCI_COMMAND, cmd);
+	local_irq_restore(flags);
+	
 	ide_setup_pci_device(dev, d);
 }
 
Signature · 1 line
		- Hu Gang
#1 lore raw
Quoted 4 lines · hugang

Hello all:

Please apply.
Index: drivers/ide//pci/piix.c

Please tell me why it would be needed ?

pci_enable_device already ensures the resources are allocated. Also on a PIIX you only need BAR4 as the other bits are on the ISA side.

Alan