From: David van Moolenbroek Date: Wed, 7 Mar 2012 22:57:34 +0000 (+0100) Subject: dp8390,ti1225: reenable register memory mapping X-Git-Tag: v3.2.1~673 X-Git-Url: http://zhaoyanbai.com/repos/doc/verify-sign/verify.pl?a=commitdiff_plain;h=de45264c74e95e4659e0bc4bfa2a8418b12517a0;p=minix.git dp8390,ti1225: reenable register memory mapping --- diff --git a/drivers/dp8390/dp8390.c b/drivers/dp8390/dp8390.c index e268b855f..4af3d7311 100644 --- a/drivers/dp8390/dp8390.c +++ b/drivers/dp8390/dp8390.c @@ -24,6 +24,7 @@ #include #include #include +#include #include "assert.h" #include "local.h" @@ -1690,9 +1691,6 @@ dp_conf_t *dcp; static void map_hw_buffer(dep) dpeth_t *dep; { - int r; - size_t o, size; - char *buf, *abuf; if (dep->de_prog_IO) { @@ -1704,25 +1702,10 @@ dpeth_t *dep; return; } - size = dep->de_ramsize + I386_PAGE_SIZE; /* Add I386_PAGE_SIZE for - * alignment - */ - buf= malloc(size); - if (buf == NULL) - panic("map_hw_buffer: cannot malloc size: %d", size); - o= I386_PAGE_SIZE - ((vir_bytes)buf % I386_PAGE_SIZE); - abuf= buf + o; - printf("buf at %p, abuf at %p\n", buf, abuf); - -#if 0 - r= sys_vm_map(SELF, 1 /* map */, (vir_bytes)abuf, - dep->de_ramsize, (phys_bytes)dep->de_linmem); -#else - r = ENOSYS; -#endif - if (r != OK) - panic("map_hw_buffer: sys_vm_map failed: %d", r); - dep->de_locmem = abuf; + dep->de_locmem= + vm_map_phys(SELF, (void *) dep->de_linmem, dep->de_ramsize); + if (dep->de_locmem == MAP_FAILED) + panic("map_hw_buffer: vm_map_phys failed"); } /*===========================================================================* diff --git a/drivers/ti1225/ti1225.c b/drivers/ti1225/ti1225.c index 5bcb7a126..a5529faa5 100644 --- a/drivers/ti1225/ti1225.c +++ b/drivers/ti1225/ti1225.c @@ -8,6 +8,7 @@ Created: Dec 2005 by Philip Homburg #include #include #include +#include #include "ti1225.h" #include "i82365.h" @@ -27,10 +28,7 @@ PRIVATE struct port int p_irq; int p_hook; #endif - char *base_ptr; volatile struct csr *csr_ptr; - - char buffer[2*I386_PAGE_SIZE]; } ports[NR_PORTS]; #define PF_PRESENT 1 @@ -51,7 +49,6 @@ PRIVATE struct pcitab pcitab_ti[]= PRIVATE int debug; FORWARD _PROTOTYPE( void hw_init, (struct port *pp) ); -FORWARD _PROTOTYPE( void map_regs, (struct port *pp, u32_t base) ); FORWARD _PROTOTYPE( void do_int, (struct port *pp) ); /* SEF functions and variables. */ @@ -197,8 +194,12 @@ PRIVATE void hw_init(struct port *pp) v32= pci_attr_r32(devind, TI_CB_BASEADDR); if (debug) printf("ti1225: Cardbus/ExCA base address 0x%x\n", v32); - map_regs(pp, v32); - pp->csr_ptr= (struct csr *)pp->base_ptr; + v32 &= ~(u32_t)0xF; /* Clear low order bits in base */ + + pp->csr_ptr= + (struct csr *) vm_map_phys(SELF, (void *) v32, I386_PAGE_SIZE); + if (pp->csr_ptr == MAP_FAILED) + panic("hw_init: vm_map_phys failed"); if (debug) { @@ -276,34 +277,6 @@ PRIVATE void hw_init(struct port *pp) #endif } -PRIVATE void map_regs(struct port *pp, u32_t base) -{ - int r; - vir_bytes buf_base; - - buf_base= (vir_bytes)pp->buffer; - if (buf_base % I386_PAGE_SIZE) - buf_base += I386_PAGE_SIZE-(buf_base % I386_PAGE_SIZE); - pp->base_ptr= (char *)buf_base; - if (debug) - { - printf("ti1225: map_regs: using %p for %p\n", - pp->base_ptr, pp->buffer); - } - - /* Clear low order bits in base */ - base &= ~(u32_t)0xF; - -#if 0 - r= sys_vm_map(SELF, 1 /* map */, (vir_bytes)pp->base_ptr, - I386_PAGE_SIZE, (phys_bytes)base); -#else - r = ENOSYS; -#endif - if (r != OK) - panic("map_regs: sys_vm_map failed: %d", r); -} - PRIVATE void do_int(struct port *pp) { int devind, vcc_5v, vcc_3v, vcc_Xv, vcc_Yv,