]> Zhao Yanbai Git Server - minix.git/commitdiff
orinoco: restore register memory mapping 10/2910/1
authorDavid van Moolenbroek <david@minix3.org>
Mon, 1 Dec 2014 17:21:17 +0000 (17:21 +0000)
committerDavid van Moolenbroek <david@minix3.org>
Thu, 4 Dec 2014 12:10:47 +0000 (12:10 +0000)
Untested.

Change-Id: I439f0e711e16ba478dadf57ffc8ad74ec19ea1b9

minix/drivers/net/orinoco/orinoco.c
minix/drivers/net/orinoco/orinoco.h

index b6632f08006ad3c76f5e5132262478a493544b7b..b645c284fdc6896804bb57fd1b3068cae6e885df 100644 (file)
@@ -18,6 +18,7 @@
 #include       <minix/timers.h>
 #include       <machine/pci.h>
 #include       <machine/vmparam.h>
+#include       <sys/mman.h>
 #include       <minix/ds.h>
 #include       <minix/endpoint.h>
 #include       "kernel/const.h"
@@ -138,7 +139,6 @@ static void or_ev_info(t_or *);
 static void or_init(message *);
 static void or_pci_conf(void);
 static void or_init_struct(t_or *);
-static void map_hw_buffer(t_or *);
 static void or_init_hw(t_or *);
 static void or_check_ints(t_or *);
 static void or_writerids(hermes_t *, t_or *);
@@ -536,54 +536,17 @@ static int or_probe (t_or * orp, int skip)
        ilr = pci_attr_r8 (devind, PCI_ILR);
        orp->or_irq = ilr;
 
-       /* Get the base address */
-       bar = or_get_bar (devind, orp);
-       orp->or_base_port = bar;
+       /* Map registers into memory */
+       bar = or_get_bar(devind, orp);
 
-       map_hw_buffer(orp);
-       return TRUE;
-}
-
-/*****************************************************************************
- *                map_hw_buffer                                              *
- *                                                                           *
- * Map the memory mapped registers into user space memory                    *
- *****************************************************************************/
-static void map_hw_buffer(t_or *orp)
-{
-       int r;
-       size_t o, size;
-       char *buf, *abuf;       
-       hermes_t *hw = &(orp->hw);      
+       orp->hw.locmem = vm_map_phys(SELF, (void *)bar, PAGE_SIZE);
+       if (orp->hw.locmem == MAP_FAILED)
+               panic("or_probe: vm_map_phys failed");
 
-       /* This way, the buffer will be at least PAGE_SIZE big: see
-        * calculation with the offset */
-       size = 2 * PAGE_SIZE;
-
-       buf = (char *)malloc(size);
-       if(buf == NULL) 
-               panic("map_hw_buffer: cannot malloc size: %d", size);
-
-       /* Let the mapped memory by PAGE_SIZE aligned */
-       o = PAGE_SIZE - ((vir_bytes)buf % PAGE_SIZE);
-       abuf = buf + o;
-
-#if 0
-       r = sys_vm_map(SELF, 1, (vir_bytes)abuf, 
-                       1 * PAGE_SIZE, (phys_bytes)orp->or_base_port);
-#else
-       r = ENOSYS;
-#endif
-
-       if(r!=OK) 
-               panic("map_hw_buffer: sys_vm_map failed: %d", r);
-
-
-       hw->locmem = abuf;
+       return TRUE;
 }
 
 
-
 /*****************************************************************************
  *                or_get_bar                                                 *
  *                                                                           *
index 6adb838b52fb0c5ba0281ae84c9e95d8baafdde5..a9ade97ad61178edf68e01ae8f3f181af5ef0c42 100644 (file)
@@ -35,7 +35,6 @@ typedef struct s_or
        int or_tx_alive;
        int or_send_int;
        int or_clear_rx;
-       u32_t or_base_port;
        int or_need_reset;
        int or_report_link;