MFp4: Optimize in/out macros. Cache the handle and tag in softc and
use them in the macros. Since the rman_get_bus{tag,handle} transitioned from macros to function calls, this unpessimizes that conversion.
This commit is contained in:
parent
acf420c37c
commit
49d4d6052b
@ -169,6 +169,8 @@ ed_alloc_port(device_t dev, int rid, int size)
|
||||
sc->port_rid = rid;
|
||||
sc->port_res = res;
|
||||
sc->port_used = size;
|
||||
sc->port_bst = rman_get_bustag(res);
|
||||
sc->port_bsh = rman_get_bushandle(res);
|
||||
return (0);
|
||||
}
|
||||
return (ENOENT);
|
||||
@ -189,6 +191,8 @@ ed_alloc_memory(device_t dev, int rid, int size)
|
||||
sc->mem_rid = rid;
|
||||
sc->mem_res = res;
|
||||
sc->mem_used = size;
|
||||
sc->mem_bst = rman_get_bustag(res);
|
||||
sc->mem_bsh = rman_get_bushandle(res);
|
||||
return (0);
|
||||
}
|
||||
return (ENOENT);
|
||||
|
@ -47,9 +47,13 @@ struct ed_softc {
|
||||
int port_rid; /* resource id for port range */
|
||||
int port_used; /* nonzero if ports used */
|
||||
struct resource* port_res; /* resource for port range */
|
||||
bus_space_tag_t port_bst;
|
||||
bus_space_handle_t port_bsh;
|
||||
int mem_rid; /* resource id for memory range */
|
||||
int mem_used; /* nonzero if memory used */
|
||||
struct resource* mem_res; /* resource for memory range */
|
||||
bus_space_tag_t mem_bst;
|
||||
bus_space_handle_t mem_bsh;
|
||||
int irq_rid; /* resource id for irq */
|
||||
struct resource* irq_res; /* resource for irq */
|
||||
void* irq_handle; /* handle for irq handler */
|
||||
@ -95,99 +99,81 @@ struct ed_softc {
|
||||
};
|
||||
|
||||
#define ed_nic_inb(sc, port) \
|
||||
bus_space_read_1(rman_get_bustag((sc)->port_res), \
|
||||
rman_get_bushandle((sc)->port_res), (sc)->nic_offset + (port))
|
||||
bus_space_read_1(sc->port_bst, sc->port_bsh, (sc)->nic_offset + (port))
|
||||
|
||||
#define ed_nic_outb(sc, port, value) \
|
||||
bus_space_write_1(rman_get_bustag((sc)->port_res), \
|
||||
rman_get_bushandle((sc)->port_res), (sc)->nic_offset + (port), \
|
||||
(value))
|
||||
bus_space_write_1(sc->port_bst, sc->port_bsh, \
|
||||
(sc)->nic_offset + (port), (value))
|
||||
|
||||
#define ed_nic_inw(sc, port) \
|
||||
bus_space_read_2(rman_get_bustag((sc)->port_res), \
|
||||
rman_get_bushandle((sc)->port_res), (sc)->nic_offset + (port))
|
||||
bus_space_read_2(sc->port_bst, sc->port_bsh, (sc)->nic_offset + (port))
|
||||
|
||||
#define ed_nic_outw(sc, port, value) \
|
||||
bus_space_write_2(rman_get_bustag((sc)->port_res), \
|
||||
rman_get_bushandle((sc)->port_res), (sc)->nic_offset + (port), \
|
||||
(value))
|
||||
bus_space_write_2(sc->port_bst, sc->port_bsh, \
|
||||
(sc)->nic_offset + (port), (value))
|
||||
|
||||
#define ed_nic_insb(sc, port, addr, count) \
|
||||
bus_space_read_multi_1(rman_get_bustag((sc)->port_res), \
|
||||
rman_get_bushandle((sc)->port_res), \
|
||||
bus_space_read_multi_1(sc->port_bst, sc->port_bsh, \
|
||||
(sc)->nic_offset + (port), (addr), (count))
|
||||
|
||||
#define ed_nic_outsb(sc, port, addr, count) \
|
||||
bus_space_write_multi_1(rman_get_bustag((sc)->port_res), \
|
||||
rman_get_bushandle((sc)->port_res), \
|
||||
bus_space_write_multi_1(sc->port_bst, sc->port_bsh, \
|
||||
(sc)->nic_offset + (port), (addr), (count))
|
||||
|
||||
#define ed_nic_insw(sc, port, addr, count) \
|
||||
bus_space_read_multi_2(rman_get_bustag((sc)->port_res), \
|
||||
rman_get_bushandle((sc)->port_res), \
|
||||
bus_space_read_multi_2(sc->port_bst, sc->port_bsh, \
|
||||
(sc)->nic_offset + (port), (uint16_t *)(addr), (count))
|
||||
|
||||
#define ed_nic_outsw(sc, port, addr, count) \
|
||||
bus_space_write_multi_2(rman_get_bustag((sc)->port_res), \
|
||||
rman_get_bushandle((sc)->port_res), \
|
||||
bus_space_write_multi_2(sc->port_bst, sc->port_bsh, \
|
||||
(sc)->nic_offset + (port), (uint16_t *)(addr), (count))
|
||||
|
||||
#define ed_nic_insl(sc, port, addr, count) \
|
||||
bus_space_read_multi_4(rman_get_bustag((sc)->port_res), \
|
||||
rman_get_bushandle((sc)->port_res), \
|
||||
bus_space_read_multi_4(sc->port_bst, sc->port_bsh, \
|
||||
(sc)->nic_offset + (port), (uint32_t *)(addr), (count))
|
||||
|
||||
#define ed_nic_outsl(sc, port, addr, count) \
|
||||
bus_space_write_multi_4(rman_get_bustag((sc)->port_res), \
|
||||
rman_get_bushandle((sc)->port_res), \
|
||||
bus_space_write_multi_4(sc->port_bst, sc->port_bsh, \
|
||||
(sc)->nic_offset + (port), (uint32_t *)(addr), (count))
|
||||
|
||||
#define ed_asic_inb(sc, port) \
|
||||
bus_space_read_1(rman_get_bustag((sc)->port_res), \
|
||||
rman_get_bushandle((sc)->port_res), (sc)->asic_offset + (port))
|
||||
bus_space_read_1(sc->port_bst, sc->port_bsh, \
|
||||
(sc)->asic_offset + (port))
|
||||
|
||||
#define ed_asic_outb(sc, port, value) \
|
||||
bus_space_write_1(rman_get_bustag((sc)->port_res), \
|
||||
rman_get_bushandle((sc)->port_res), (sc)->asic_offset + (port), \
|
||||
(value))
|
||||
bus_space_write_1(sc->port_bst, sc->port_bsh, \
|
||||
(sc)->asic_offset + (port), (value))
|
||||
|
||||
#define ed_asic_inw(sc, port) \
|
||||
bus_space_read_2(rman_get_bustag((sc)->port_res), \
|
||||
rman_get_bushandle((sc)->port_res), (sc)->asic_offset + (port))
|
||||
bus_space_read_2(sc->port_bst, sc->port_bsh, \
|
||||
(sc)->asic_offset + (port))
|
||||
|
||||
#define ed_asic_outw(sc, port, value) \
|
||||
bus_space_write_2(rman_get_bustag((sc)->port_res), \
|
||||
rman_get_bushandle((sc)->port_res), (sc)->asic_offset + (port), \
|
||||
(value))
|
||||
bus_space_write_2(sc->port_bst, sc->port_bsh, \
|
||||
(sc)->asic_offset + (port), (value))
|
||||
|
||||
#define ed_asic_insb(sc, port, addr, count) \
|
||||
bus_space_read_multi_1(rman_get_bustag((sc)->port_res), \
|
||||
rman_get_bushandle((sc)->port_res), \
|
||||
bus_space_read_multi_1(sc->port_bst, sc->port_bsh, \
|
||||
(sc)->asic_offset + (port), (addr), (count))
|
||||
|
||||
#define ed_asic_outsb(sc, port, addr, count) \
|
||||
bus_space_write_multi_1(rman_get_bustag((sc)->port_res), \
|
||||
rman_get_bushandle((sc)->port_res), \
|
||||
bus_space_write_multi_1(sc->port_bst, sc->port_bsh, \
|
||||
(sc)->asic_offset + (port), (addr), (count))
|
||||
|
||||
#define ed_asic_insw(sc, port, addr, count) \
|
||||
bus_space_read_multi_2(rman_get_bustag((sc)->port_res), \
|
||||
rman_get_bushandle((sc)->port_res), \
|
||||
bus_space_read_multi_2(sc->port_bst, sc->port_bsh, \
|
||||
(sc)->asic_offset + (port), (uint16_t *)(addr), (count))
|
||||
|
||||
#define ed_asic_outsw(sc, port, addr, count) \
|
||||
bus_space_write_multi_2(rman_get_bustag((sc)->port_res), \
|
||||
rman_get_bushandle((sc)->port_res), \
|
||||
bus_space_write_multi_2(sc->port_bst, sc->port_bsh, \
|
||||
(sc)->asic_offset + (port), (uint16_t *)(addr), (count))
|
||||
|
||||
#define ed_asic_insl(sc, port, addr, count) \
|
||||
bus_space_read_multi_4(rman_get_bustag((sc)->port_res), \
|
||||
rman_get_bushandle((sc)->port_res), \
|
||||
bus_space_read_multi_4(sc->port_bst, sc->port_bsh, \
|
||||
(sc)->asic_offset + (port), (uint32_t *)(addr), (count))
|
||||
|
||||
#define ed_asic_outsl(sc, port, addr, count) \
|
||||
bus_space_write_multi_4(rman_get_bustag((sc)->port_res), \
|
||||
rman_get_bushandle((sc)->port_res), \
|
||||
bus_space_write_multi_4(sc->port_bst, sc->port_bsh, \
|
||||
(sc)->asic_offset + (port), (uint32_t *)(addr), (count))
|
||||
|
||||
void ed_release_resources(device_t);
|
||||
|
Loading…
Reference in New Issue
Block a user