/* * $Id: hostio.c,v 1.1 2008/08/08 13:18:16 nbrk Exp $ */ #include #include #include "hostiovar.h" /* * Autoconf glue. */ int hostio_match(struct device *parent, void *aux); int hostio_attach(struct device *parent, struct device *self, void *aux); struct driver hostio_drv = { "hostio", /* name */ sizeof(struct hostio_softc),/* datasize */ hostio_match, /* match */ hostio_attach, /* attach */ NULL, /* detach */ -1 /* nunits XXX */ }; int hostio_match(struct device *parent, void *aux) { return(1); } int hostio_attach(struct device *parent, struct device *self, void *aux) { struct hostio_softc *sc = self->dv_data; printk("\n"); sc->sc_iot = &hostio_bs_tag; /* * Nothing to do. Just pass our bus_space_tag_t to upper layers. */ config_search_children(self, sc->sc_iot); return(0); } int hostio_map(void *cookie, bus_addr_t addr, bus_size_t size, int flags, bus_space_handle_t *ioh) { /* XXX */ /* *ioh = kmem_map(addr, size); */ *ioh = addr; return(0); } uint8_t hostio_read_1(void *cookie, bus_space_handle_t ioh, bus_size_t off) { uint8_t d; d = *(volatile uint32_t *)(ioh + off); return(d); } uint16_t hostio_read_2(void *cookie, bus_space_handle_t ioh, bus_size_t off) { uint16_t d; d = *(volatile uint32_t *)(ioh + off); return(d); } uint32_t hostio_read_4(void *cookie, bus_space_handle_t ioh, bus_size_t off) { uint32_t d; d = *(volatile uint32_t *)(ioh + off); return(d); } void hostio_write_1(void *cookie, bus_space_handle_t ioh, bus_size_t off, uint8_t data) { *(volatile uint32_t *)(ioh + off) = data; } void hostio_write_2(void *cookie, bus_space_handle_t ioh, bus_size_t off, uint16_t data) { *(volatile uint32_t *)(ioh + off) = data; } void hostio_write_4(void *cookie, bus_space_handle_t ioh, bus_size_t off, uint32_t data) { *(volatile uint32_t *)(ioh + off) = data; }