]> Joshua Wise's Git repositories - netwatch.git/blob - pci/pci-bother.c
dd1ff2133048cbd7071b0ce37a076098d95c5738
[netwatch.git] / pci / pci-bother.c
1 #include <pci.h>
2 #include <pci-bother.h>
3
4 struct pci_bother {
5         int bus, dev, fn;
6         unsigned short origstate;
7 };
8
9 static struct pci_bother bothers[MAX_BOTHERS];
10 static int nbothers = 0;
11
12 int pci_bother_add(pci_dev_t *dev)
13 {
14         if (nbothers == MAX_BOTHERS)
15                 return -1;
16         
17         bothers[nbothers].bus = dev->bus;
18         bothers[nbothers].dev = dev->dev;
19         bothers[nbothers].fn = dev->fn;
20         
21         bothers[nbothers].origstate = pci_read16(dev->bus, dev->dev, dev->fn, 0x04);
22         
23         nbothers++;
24         
25         return 0;
26 }
27
28 void pci_bother_all()
29 {
30         int i;
31         
32         for (i = 0; i < nbothers; i++)
33                 pci_write16(bothers[i].bus, bothers[i].dev, bothers[i].fn, 0x04, 0x0);
34 }
35
36 void pci_unbother_all()
37 {
38         int i;
39         
40         for (i = 0; i < nbothers; i++)
41                 pci_write16(bothers[i].bus, bothers[i].dev, bothers[i].fn, 0x04, bothers[i].origstate);
42 }
This page took 0.017348 seconds and 2 git commands to generate.