- Use an extent map to manage the ISA memory "hole", much like
how i/o port space is manged with an extent map. Do the actual
accounting in bus_mem_{,un}map().
- When creating the ioport and iomem extent maps, pass the
EX_NOBLOB flag, which tells the extent map code to disallow
fragmenting of regions. This will make it easier to catch
simple i/o and memory mapping bugs (like the if_ed.c bug I just
fixed) in the future.
- In bus_mem_map(), a chunk of code was indented using spaces.
Make the indentation use tabs.
- In bus_io_unmap(), fix the format passed to printf().
- A fixed extent map (statically allocated descriptor storage) is
created in init386(), just before the call to consinit(). The
fixed descriptor storage has enough room for 8 region entires,
which is plenty for early initialization, but doesn't chew up
that much memory.
This extent map (ioport_ex) manages the i386 i/o port
space (0x0 - 0xffff).
- Just before the call to configure() in cpu_startup(), a
flag is set which notifies the bus_io functions that it is
safe to use malloc() to allocate descriptor storage, in the
event that more than 8 regions are needed.
- bus_io_map() attempts to allocate the specified region from
ioport_ex. If the allocation succeeds, the io handle is
filled in. If the allocation fails, it is implied that
something else is already using that io space, and an
error condition is returned.
- bus_io_unmap() frees a region previously allocated from
ioport_ex in bus_io_map(). If the free fails, a warning
is printed on the conole.
These changes implement "port accounting". This is required for
proper autoconfiguration on the i386 port, and makes dealing with,
among other things, PCMCIA io mappings _much_ easier.
kmem_map (the VA space is allocated from kernel_map).
In both bus_mem_map() and bus_mem_unmap(), adjust some arithmetic to
avoid wasting a page of VA space per call to bus_mem_map().
Changing types from unsigned {long,short} to u_int{32,16}_t causes problems
in a lot of userlevel code because those types aren't defined when machine/
endian.h is included. And IMO including sys/types.h in machine/endian.h
is clearly wrong.
XPG4.2 defines new types in_addr_t and in_port_t for the {h,n}to{n,h}{l,s}
functions. But we don't have time to figure out the implementation issues
given the current release schedule.