dp8390,ti1225: reenable register memory mapping

This commit is contained in:
David van Moolenbroek 2012-03-07 23:57:34 +01:00
parent 21ed531c8f
commit de45264c74
2 changed files with 12 additions and 56 deletions

View file

@ -24,6 +24,7 @@
#include <net/gen/ether.h>
#include <net/gen/eth_io.h>
#include <machine/vm.h>
#include <sys/mman.h>
#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");
}
/*===========================================================================*

View file

@ -8,6 +8,7 @@ Created: Dec 2005 by Philip Homburg
#include <minix/driver.h>
#include <machine/pci.h>
#include <machine/vm.h>
#include <sys/mman.h>
#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,