Subject: can't figure bus_space_map() out
To: None <tech-kern@netbsd.org>
From: Alexander Funcke <funcke@daemon.se>
List: tech-kern
Date: 04/17/2002 05:10:55
Hi,


From a function set to cpu_setup in struct cpu_cpuid_nameclass I call
bus_space_map like this:

bus_space_handle_t *gx1_control;
unsigned int gx_base;

 if(gx_base) {
    printf("BASE_ADDR: 0x%08x\n", gx_base);
    if (bus_space_map(I386_BUS_SPACE_IO, (bus_addr_t) gx_base, 
	GX_BASE_SIZE, BUS_SPACE_MAP_LINEAR, gx1_control) != 0) 
      printf("Unable to allocate the GX_BASE I/O region\n");
  }

In linux it's done with gx1_control = ioremap(gx_base, GX_BASE_SIZE).

If I'll run it like this, it just return non-zero and my printf() draw
attention. But running without BUS_SPACE_MAP_LINEAR (i.e. insted with 0
as flags.) I'll get this error message at boot-time:

BASE_ADDR: 0x40000000
extent_alloc_region: extent `ioport' (0x0 - 0xffff)
extent_alloc_region: start 0x40000000, end 0x4000ffff
panic: extent_alloc_region: region lies outside extent

The operating system has halted.
Please press any key to reboot.

I have compiled the kernel with DIAGNOSTIC and CPUDEBUG.

How should I do this?

tia,
/Alexander