2000-11-24 15:52:36

by Ivan Kokshaysky

[permalink] [raw]
Subject: alpha: small PCI fixes (test11-ac3)

Just out of curiosity I tried S3 Sonic Vibes sound card, which has
only 24 address lines connected, on sx164. This revealed two bugs
in the pci code:
- dma mask 0x00ffffff (24 bits) exactly fits the ISA scatter-gather
window, but was rejected by pci_dma_supported() due to off-by-one bug.
- this card has some non-standard set of I/O ports, and driver tries to
allocate resource for it at the runtime. At this time
pcibios_update_resource() already has been vanished.

With these fixes the card started to work to the best of its ability,
i.e. screechy and noisy, so after being so helpful the poor thing went
back into the rubbish bin...

Ivan.

--- 2.4.0t11ac3/arch/alpha/kernel/pci_iommu.c Sat Sep 23 01:07:43 2000
+++ linux/arch/alpha/kernel/pci_iommu.c Thu Nov 23 14:35:40 2000
@@ -613,10 +613,10 @@ pci_dma_supported(struct pci_dev *pdev,
/* Check that we have a scatter-gather arena that fits. */
hose = pdev ? pdev->sysdata : pci_isa_hose;
arena = hose->sg_isa;
- if (arena && arena->dma_base + arena->size <= mask)
+ if (arena && arena->dma_base + arena->size - 1 <= mask)
return 1;
arena = hose->sg_pci;
- if (arena && arena->dma_base + arena->size <= mask)
+ if (arena && arena->dma_base + arena->size - 1 <= mask)
return 1;

return 0;
--- 2.4.0t11ac3/arch/alpha/kernel/pci.c Thu Nov 23 13:07:02 2000
+++ linux/arch/alpha/kernel/pci.c Thu Nov 23 15:09:59 2000
@@ -282,7 +282,7 @@ pcibios_fixup_bus(struct pci_bus *bus)
}
}

-void __init
+void
pcibios_update_resource(struct pci_dev *dev, struct resource *root,
struct resource *res, int resource)
{