From: David van Moolenbroek Date: Mon, 1 Dec 2014 17:21:17 +0000 (+0000) Subject: orinoco: restore register memory mapping X-Git-Url: http://zhaoyanbai.com/repos/man.rndc.conf.html?a=commitdiff_plain;h=refs%2Fchanges%2F10%2F2910%2F1;p=minix.git orinoco: restore register memory mapping Untested. Change-Id: I439f0e711e16ba478dadf57ffc8ad74ec19ea1b9 --- diff --git a/minix/drivers/net/orinoco/orinoco.c b/minix/drivers/net/orinoco/orinoco.c index b6632f080..b645c284f 100644 --- a/minix/drivers/net/orinoco/orinoco.c +++ b/minix/drivers/net/orinoco/orinoco.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #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 * * * diff --git a/minix/drivers/net/orinoco/orinoco.h b/minix/drivers/net/orinoco/orinoco.h index 6adb838b5..a9ade97ad 100644 --- a/minix/drivers/net/orinoco/orinoco.h +++ b/minix/drivers/net/orinoco/orinoco.h @@ -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;