bus_space(9), if drivers want it (they shouldn't; easy to convert) they
can define it right before including bus.h. There's been a release since
the interfaces were (slightly) changed, and no code in the source tree
uses the old interfaces as far as I can tell.
is defined, the bus_space macros will check to ensure that the bus address
and the target buffer (if applicable) are aligned properly for the size
of the type being used. If they are not, a message will be displayed on
the console.
While strict alignment is not strictly necessary on the x86, ensuring
proper alignment can aid performance, and help make drivers more portable
to architectures (like the Alpha and StrongARM) which _do_ require strict
alignment.
* make map and alloc take 'flags' rather than 'cacheable,' for
more flexibility.
* rename BUS_BARRIER_* to BUS_SPACE_BARRIER_*, for consistency.
* rename bus_space_copy_* to bus_space_copy_region_* and make their
defns match the updated spec.
Backward compatibility is provided by defining __BUS_SPACE_COMPAT_OLDDEFS,
which is currently defined by default.
functions (which only work on memory and i/o space) to i386_memio_*,
and make bus_space_* in bus.h be #defines which invoke them. This makes
life easier for people who need to define the all of the bus_space functions
so that they work on spaces other than memory and I/O space. Also, add
an _i386_memio_map function which is like i386_memio_map but doesn't do
the extent map checking or allocation. _i386_memio_map and i386_memio_*
are for use only by machine-dependent code.
- The boundary argument to bus_space_alloc() should be a bus_size_t, not
a bus_addr_t.
- The buffer arguments in the "multiple write" methods should have
const qualifiers.
And one from me:
- Make bus_space_barrier() eat up the arguments passed to it so that
the compiler doesn't needlessly whine.
- No more distinction between i/o-mapped and memory-mapped
devices. It's all "bus space" now, and space tags
differentiate the space with finer grain than the
bus chipset tag.
- Add memory barrier methods.
- Implement space alloc/free methods.
- Implement region read/write methods (like memcpy to/from
bus space).
This interface provides a better abstraction for dealing with
machine-independent chipset drivers.
- 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.
machine-independent code for more sane access to bus resources.
New functions will be added to this set, in the future, as appropriate,
but this is a good starting set. Defines:
bus_{io,mem}_{map,unmap}
bus_{io,mem}_{read,write}_{1,2,4,8}
functions, and several types to go with them.