]> Zhao Yanbai Git Server - minix.git/commitdiff
e1000: map in 0x1000 of flash if 0x10000 fails.
authorBen Gras <ben@minix3.org>
Mon, 7 Jun 2010 16:30:10 +0000 (16:30 +0000)
committerBen Gras <ben@minix3.org>
Mon, 7 Jun 2010 16:30:10 +0000 (16:30 +0000)
drivers/e1000/e1000.c

index 0e1caacd08971d85a76a96697b7dd7ca772567c4..8c65b4191b0a3b0faa0900cd90d27a47cea83345 100644 (file)
@@ -14,6 +14,7 @@
 #include <minix/ds.h>
 #include <minix/vm.h>
 #include <timers.h>
+#include <sys/mman.h>
 #include "assert.h"
 #include "e1000.h"
 #include "e1000_hw.h"
@@ -323,8 +324,14 @@ PRIVATE int e1000_probe(e1000_t *e, int skip)
     /* Optionally map flash memory. */
     if (pci_attr_r32(devind, PCI_BAR_3))
     {
-       e->flash = vm_map_phys(SELF, (void *) pci_attr_r32(devind, PCI_BAR_2),
-                              0x10000);
+       if((e->flash = vm_map_phys(SELF,
+         (void *) pci_attr_r32(devind, PCI_BAR_2), 0x10000)) == MAP_FAILED) {
+               if((e->flash = vm_map_phys(SELF,
+                       (void *) pci_attr_r32(devind, PCI_BAR_2), 0x1000))
+                               == MAP_FAILED) {
+                               panic("e1000: couldn't map in flash.");
+               }
+       }
 
        gfpreg = E1000_READ_FLASH_REG(e, ICH_FLASH_GFPREG);
         /*