msi-x: read is a per-function property
authorRonald G. Minnich <rminnich@google.com>
Tue, 1 Apr 2014 00:54:21 +0000 (17:54 -0700)
committerRonald G. Minnich <rminnich@google.com>
Tue, 1 Apr 2014 00:54:21 +0000 (17:54 -0700)
Add a pci_device struct member so we know if msix is working.

Signed-off-by: Ronald G. Minnich <rminnich@google.com>
kern/arch/x86/msi.c
kern/arch/x86/pci.h

index 7c61432..85b6370 100644 (file)
@@ -287,12 +287,14 @@ int pci_msix_enable(struct pci_device *p, uint64_t vec)
 {
        int i;
        struct msixentry *entry;
-       static int ready = 0;
        unsigned int c, d, datao, lopri, dmode, logical;
-       if (! ready) {
+       /* we don't call this much, so we don't mind
+        * retrying it.
+        */
+       if (! p->msixready) {
                if (pci_msix_init(p) < 0)
                        return -1;
-               ready = 1;
+               p->msixready = 1;
        }
 
        /* find an unused slot. */
index c88b4c1..4da5bf9 100644 (file)
@@ -362,6 +362,7 @@ struct pci_device {
        /* for MSI-X we might have allocated two physically contiguous pages. */
        void *                                          msix;
        int                                             msixbar;
+       int                                             msixready;
        int                                             msixsize;
 };