2 #include <pci-bother.h>
6 unsigned short origstate;
7 unsigned long origbars[6];
10 static struct pci_bother bothers[MAX_BOTHERS];
11 static int nbothers = 0;
13 int pci_bother_add(pci_dev_t *dev)
17 if (nbothers == MAX_BOTHERS)
20 bothers[nbothers].bus = dev->bus;
21 bothers[nbothers].dev = dev->dev;
22 bothers[nbothers].fn = dev->fn;
24 bothers[nbothers].origstate = pci_read16(dev->bus, dev->dev, dev->fn, 0x04);
25 for (i = 0; i < 6; i++)
26 bothers[nbothers].origbars[i] = pci_read32(dev->bus, dev->dev, dev->fn, 0x10 + i * 4);
37 for (i = 0; i < nbothers; i++)
39 pci_write16(bothers[i].bus, bothers[i].dev, bothers[i].fn, 0x04, 0x0);
40 for (j = 0; j < 6; j++)
41 pci_write32(bothers[i].bus, bothers[i].dev, bothers[i].fn, 0x10 + j * 4, 0);
45 void pci_unbother_all()
49 for (i = 0; i < nbothers; i++)
51 pci_write16(bothers[i].bus, bothers[i].dev, bothers[i].fn, 0x04, bothers[i].origstate);
52 for (j = 0; j < 6; j++)
53 pci_write32(bothers[i].bus, bothers[i].dev, bothers[i].fn, 0x10 + j * 4, bothers[i].origbars[j]);