1
2
3
4
5
6
7
8#include <linux/dma-mapping.h>
9#include <linux/pci.h>
10
11
12
13
14
15static void quirk_sb1250_pci(struct pci_dev *dev)
16{
17 pci_write_config_byte(dev, 0x40, 0xff);
18}
19DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_SIBYTE, PCI_DEVICE_ID_BCM1250_PCI,
20 quirk_sb1250_pci);
21
22
23
24
25
26
27
28
29
30
31struct sb1250_bus_dma_limit_exclude {
32 bool set;
33 unsigned char start;
34 unsigned char end;
35};
36
37static int sb1250_bus_dma_limit(struct pci_dev *dev, void *data)
38{
39 struct sb1250_bus_dma_limit_exclude *exclude = data;
40 bool exclude_this;
41 bool ht_bridge;
42
43 exclude_this = exclude->set && (dev->bus->number >= exclude->start &&
44 dev->bus->number <= exclude->end);
45 ht_bridge = !exclude->set && (dev->vendor == PCI_VENDOR_ID_SIBYTE &&
46 dev->device == PCI_DEVICE_ID_BCM1250_HT);
47
48 if (exclude_this) {
49 dev_dbg(&dev->dev, "not disabling DAC for device");
50 } else if (ht_bridge) {
51 exclude->start = dev->subordinate->number;
52 exclude->end = pci_bus_max_busnr(dev->subordinate);
53 exclude->set = true;
54 dev_dbg(&dev->dev, "not disabling DAC for [bus %02x-%02x]",
55 exclude->start, exclude->end);
56 } else {
57 dev_dbg(&dev->dev, "disabling DAC for device");
58 dev->dev.bus_dma_limit = DMA_BIT_MASK(32);
59 }
60
61 return 0;
62}
63
64static void quirk_sb1250_pci_dac(struct pci_dev *dev)
65{
66 struct sb1250_bus_dma_limit_exclude exclude = { .set = false };
67
68 pci_walk_bus(dev->bus, sb1250_bus_dma_limit, &exclude);
69}
70DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SIBYTE, PCI_DEVICE_ID_BCM1250_PCI,
71 quirk_sb1250_pci_dac);
72
73
74
75
76static void quirk_sb1250_ht(struct pci_dev *dev)
77{
78 dev->class = PCI_CLASS_BRIDGE_PCI << 8;
79}
80DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_SIBYTE, PCI_DEVICE_ID_BCM1250_HT,
81 quirk_sb1250_ht);
82
83
84
85
86static void quirk_sp1011(struct pci_dev *dev)
87{
88 pci_write_config_byte(dev, 0x64, 0xff);
89}
90DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_SIPACKETS, PCI_DEVICE_ID_SP1011,
91 quirk_sp1011);
92