]> Joshua Wise's Git repositories - netwatch.git/blame - pci/pci-bother.c
merge
[netwatch.git] / pci / pci-bother.c
CommitLineData
ec2d6189 1#include <pci.h>
d6f56afa 2#include <pci-bother.h>
ec2d6189
JW
3
4struct pci_bother {
5 int bus, dev, fn;
6 unsigned short origstate;
7};
8
9static struct pci_bother bothers[MAX_BOTHERS];
10static int nbothers = 0;
11
12int 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
28void pci_bother_all()
29{
30 int i;
31
32 for (i = 0; i < nbothers; i++)
d6f56afa 33 pci_write16(bothers[i].bus, bothers[i].dev, bothers[i].fn, 0x04, 0x0);
ec2d6189
JW
34}
35
36void pci_unbother_all()
37{
38 int i;
39
40 for (i = 0; i < nbothers; i++)
d6f56afa 41 pci_write16(bothers[i].bus, bothers[i].dev, bothers[i].fn, 0x04, bothers[i].origstate);
ec2d6189 42}
This page took 0.022847 seconds and 4 git commands to generate.