]> Joshua Wise's Git repositories - netwatch.git/blobdiff - pci/pci-bother.c
Add a FB access layer.
[netwatch.git] / pci / pci-bother.c
index 0c3c0ec4d80703a2c19a68e325ea1414550e0be4..f05c41716d6cd25ea5d4ef7adadc836474978660 100644 (file)
@@ -1,8 +1,10 @@
 #include <pci.h>
 #include <pci.h>
+#include <pci-bother.h>
 
 struct pci_bother {
        int bus, dev, fn;
        unsigned short origstate;
 
 struct pci_bother {
        int bus, dev, fn;
        unsigned short origstate;
+       unsigned long origbars[6];
 };
 
 static struct pci_bother bothers[MAX_BOTHERS];
 };
 
 static struct pci_bother bothers[MAX_BOTHERS];
@@ -10,6 +12,8 @@ static int nbothers = 0;
 
 int pci_bother_add(pci_dev_t *dev)
 {
 
 int pci_bother_add(pci_dev_t *dev)
 {
+       int i;
+       
        if (nbothers == MAX_BOTHERS)
                return -1;
        
        if (nbothers == MAX_BOTHERS)
                return -1;
        
@@ -18,6 +22,8 @@ int pci_bother_add(pci_dev_t *dev)
        bothers[nbothers].fn = dev->fn;
        
        bothers[nbothers].origstate = pci_read16(dev->bus, dev->dev, dev->fn, 0x04);
        bothers[nbothers].fn = dev->fn;
        
        bothers[nbothers].origstate = pci_read16(dev->bus, dev->dev, dev->fn, 0x04);
+       for (i = 0; i < 6; i++)
+               bothers[nbothers].origbars[i] = pci_read32(dev->bus, dev->dev, dev->fn, 0x10 + i * 4);
        
        nbothers++;
        
        
        nbothers++;
        
@@ -26,16 +32,24 @@ int pci_bother_add(pci_dev_t *dev)
 
 void pci_bother_all()
 {
 
 void pci_bother_all()
 {
-       int i;
+       int i, j;
        
        for (i = 0; i < nbothers; i++)
        
        for (i = 0; i < nbothers; i++)
-               pci_write16(bothers[i].bus, bothers[i].dev, bothers[i].fn, 0x0);
+       {
+               pci_write16(bothers[i].bus, bothers[i].dev, bothers[i].fn, 0x04, 0x0);
+               for (j = 0; j < 6; j++)
+                       pci_write32(bothers[i].bus, bothers[i].dev, bothers[i].fn, 0x10 + j * 4, 0);
+       }
 }
 
 void pci_unbother_all()
 {
 }
 
 void pci_unbother_all()
 {
-       int i;
+       int i, j;
        
        for (i = 0; i < nbothers; i++)
        
        for (i = 0; i < nbothers; i++)
-               pci_write16(bothers[i].bus, bothers[i].dev, bothers[i].fn, bothers[i].origstate);
+       {
+               pci_write16(bothers[i].bus, bothers[i].dev, bothers[i].fn, 0x04, bothers[i].origstate);
+               for (j = 0; j < 6; j++)
+                       pci_write32(bothers[i].bus, bothers[i].dev, bothers[i].fn, 0x10 + j * 4, bothers[i].origbars[j]);
+       }
 }
 }
This page took 0.021114 seconds and 4 git commands to generate.