Commit 488bade3 authored by Christoph Hellwig's avatar Christoph Hellwig

[PATCH] fix inia100 driver

John W Fort helped me debugging the brown paperbag bugs, the patch below
makes it work.
parent f73e9f0f
...@@ -420,7 +420,7 @@ static int __devinit inia100_probe_one(struct pci_dev *pdev, ...@@ -420,7 +420,7 @@ static int __devinit inia100_probe_one(struct pci_dev *pdev,
struct Scsi_Host *shost; struct Scsi_Host *shost;
ORC_HCS *pHCB; ORC_HCS *pHCB;
unsigned long port, bios; unsigned long port, bios;
int ok = -ENODEV; int error = -ENODEV;
u32 sz; u32 sz;
unsigned long dBiosAdr; unsigned long dBiosAdr;
char *pbBiosAdr; char *pbBiosAdr;
...@@ -433,17 +433,17 @@ static int __devinit inia100_probe_one(struct pci_dev *pdev, ...@@ -433,17 +433,17 @@ static int __devinit inia100_probe_one(struct pci_dev *pdev,
goto out_disable_device; goto out_disable_device;
} }
pci_set_master(pdev);
port = pci_resource_start(pdev, 0); port = pci_resource_start(pdev, 0);
if (!request_region(pHCB->HCS_Base, 256, "inia100")) { if (!request_region(port, 256, "inia100")) {
printk(KERN_WARNING "inia100: io port 0x%x, is busy.\n", printk(KERN_WARNING "inia100: io port 0x%lx, is busy.\n", port);
pHCB->HCS_Base); goto out_disable_device;
goto out_disable_device; /* XXX: undo init_orchid() ?? */
} }
/* <02> read from base address + 0x50 offset to get the bios balue. */ /* <02> read from base address + 0x50 offset to get the bios balue. */
bios = ORC_RDWORD(port, 0x50); bios = ORC_RDWORD(port, 0x50);
pci_set_master(pdev);
shost = scsi_host_alloc(&inia100_template, sizeof(ORC_HCS)); shost = scsi_host_alloc(&inia100_template, sizeof(ORC_HCS));
if (!shost) if (!shost)
...@@ -460,7 +460,8 @@ static int __devinit inia100_probe_one(struct pci_dev *pdev, ...@@ -460,7 +460,8 @@ static int __devinit inia100_probe_one(struct pci_dev *pdev,
/* Get total memory needed for SCB */ /* Get total memory needed for SCB */
sz = ORC_MAXQUEUE * sizeof(ORC_SCB); sz = ORC_MAXQUEUE * sizeof(ORC_SCB);
pHCB->HCS_virScbArray = pci_alloc_consistent(pdev, sz, &pHCB->HCS_physScbArray); pHCB->HCS_virScbArray = pci_alloc_consistent(pdev, sz,
&pHCB->HCS_physScbArray);
if (!pHCB->HCS_virScbArray) { if (!pHCB->HCS_virScbArray) {
printk("inia100: SCB memory allocation error\n"); printk("inia100: SCB memory allocation error\n");
goto out_host_put; goto out_host_put;
...@@ -469,7 +470,8 @@ static int __devinit inia100_probe_one(struct pci_dev *pdev, ...@@ -469,7 +470,8 @@ static int __devinit inia100_probe_one(struct pci_dev *pdev,
/* Get total memory needed for ESCB */ /* Get total memory needed for ESCB */
sz = ORC_MAXQUEUE * sizeof(ESCB); sz = ORC_MAXQUEUE * sizeof(ESCB);
pHCB->HCS_virEscbArray = pci_alloc_consistent(pdev, sz, &pHCB->HCS_physEscbArray); pHCB->HCS_virEscbArray = pci_alloc_consistent(pdev, sz,
&pHCB->HCS_physEscbArray);
if (!pHCB->HCS_virEscbArray) { if (!pHCB->HCS_virEscbArray) {
printk("inia100: ESCB memory allocation error\n"); printk("inia100: ESCB memory allocation error\n");
goto out_free_scb_array; goto out_free_scb_array;
...@@ -490,21 +492,23 @@ static int __devinit inia100_probe_one(struct pci_dev *pdev, ...@@ -490,21 +492,23 @@ static int __devinit inia100_probe_one(struct pci_dev *pdev,
shost->unique_id = shost->io_port; shost->unique_id = shost->io_port;
shost->max_id = pHCB->HCS_MaxTar; shost->max_id = pHCB->HCS_MaxTar;
shost->max_lun = 16; shost->max_lun = 16;
shost->irq = pHCB->HCS_Intr; shost->irq = pHCB->HCS_Intr = pdev->irq;
shost->this_id = pHCB->HCS_SCSI_ID; /* Assign HCS index */ shost->this_id = pHCB->HCS_SCSI_ID; /* Assign HCS index */
shost->sg_tablesize = TOTAL_SG_ENTRY; shost->sg_tablesize = TOTAL_SG_ENTRY;
/* Initial orc chip */ /* Initial orc chip */
ok = request_irq(pHCB->HCS_Intr, inia100_intr, SA_SHIRQ, "inia100", shost); error = request_irq(pdev->irq, inia100_intr, SA_SHIRQ,
if (ok < 0) { "inia100", shost);
printk(KERN_WARNING "inia100: unable to get irq %d\n", pHCB->HCS_Intr); if (error < 0) {
printk(KERN_WARNING "inia100: unable to get irq %d\n",
pdev->irq);
goto out_free_escb_array; goto out_free_escb_array;
} }
pci_set_drvdata(pdev, shost); pci_set_drvdata(pdev, shost);
ok = scsi_add_host(shost, &pdev->dev); error = scsi_add_host(shost, &pdev->dev);
if (!ok) if (error)
goto out_free_irq; goto out_free_irq;
scsi_scan_host(shost); scsi_scan_host(shost);
...@@ -521,11 +525,11 @@ static int __devinit inia100_probe_one(struct pci_dev *pdev, ...@@ -521,11 +525,11 @@ static int __devinit inia100_probe_one(struct pci_dev *pdev,
out_host_put: out_host_put:
scsi_host_put(shost); scsi_host_put(shost);
out_release_region: out_release_region:
release_region(pHCB->HCS_Base, 256); release_region(port, 256);
out_disable_device: out_disable_device:
pci_disable_device(pdev); pci_disable_device(pdev);
out: out:
return ok; return error;
} }
static void __devexit inia100_remove_one(struct pci_dev *pdev) static void __devexit inia100_remove_one(struct pci_dev *pdev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment