static __inline void smc_select_bank(struct smc_softc *sc, uint16_t bank) { bus_barrier(sc->smc_reg, BSR, 2, BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); bus_write_2(sc->smc_reg, BSR, bank & BSR_BANK_MASK); bus_barrier(sc->smc_reg, BSR, 2, BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); }
static __inline void smc_barrier(struct smc_softc *sc, bus_size_t offset, bus_size_t length, int flags) { bus_barrier(sc->smc_reg, offset, length, flags); }
static __inline void atpic_write(struct atpic_softc *sc, int icu, int ofs, uint8_t val) { bus_write_1(sc->sc_res[icu], ofs, val); bus_barrier(sc->sc_res[icu], ofs, 2 - ofs, BUS_SPACE_BARRIER_READ|BUS_SPACE_BARRIER_WRITE); }
static uint16_t le_lebuffer_rdcsr(struct lance_softc *sc, uint16_t port) { struct le_lebuffer_softc *lesc = (struct le_lebuffer_softc *)sc; bus_write_2(lesc->sc_rres, LEREG1_RAP, port); bus_barrier(lesc->sc_rres, LEREG1_RAP, 2, BUS_SPACE_BARRIER_WRITE); return (bus_read_2(lesc->sc_rres, LEREG1_RDP)); }
static void le_lebuffer_wrcsr(struct lance_softc *sc, uint16_t port, uint16_t val) { struct le_lebuffer_softc *lesc = (struct le_lebuffer_softc *)sc; bus_write_2(lesc->sc_rres, LEREG1_RAP, port); bus_barrier(lesc->sc_rres, LEREG1_RAP, 2, BUS_SPACE_BARRIER_WRITE); bus_write_2(lesc->sc_rres, LEREG1_RDP, val); }
static uint16_t le_isa_rdcsr(struct lance_softc *sc, uint16_t port) { struct le_isa_softc *lesc = (struct le_isa_softc *)sc; bus_write_2(lesc->sc_rres, lesc->sc_rap, port); bus_barrier(lesc->sc_rres, lesc->sc_rap, 2, BUS_SPACE_BARRIER_WRITE); return (bus_read_2(lesc->sc_rres, lesc->sc_rdp)); }
static uint16_t le_pci_rdbcr(struct lance_softc *sc, uint16_t port) { struct le_pci_softc *lesc = (struct le_pci_softc *)sc; bus_write_2(lesc->sc_rres, PCNET_PCI_RAP, port); bus_barrier(lesc->sc_rres, PCNET_PCI_RAP, 2, BUS_SPACE_BARRIER_WRITE); return (bus_read_2(lesc->sc_rres, PCNET_PCI_BDP)); }
static void le_isa_wrcsr(struct lance_softc *sc, uint16_t port, uint16_t val) { struct le_isa_softc *lesc = (struct le_isa_softc *)sc; bus_write_2(lesc->sc_rres, lesc->sc_rap, port); bus_barrier(lesc->sc_rres, lesc->sc_rap, 2, BUS_SPACE_BARRIER_WRITE); bus_write_2(lesc->sc_rres, lesc->sc_rdp, val); }
static void le_pci_wrbcr(struct lance_softc *sc, uint16_t port, uint16_t val) { struct le_pci_softc *lesc = (struct le_pci_softc *)sc; bus_write_2(lesc->sc_rres, PCNET_PCI_RAP, port); bus_barrier(lesc->sc_rres, PCNET_PCI_RAP, 2, BUS_SPACE_BARRIER_WRITE); bus_write_2(lesc->sc_rres, PCNET_PCI_BDP, val); }
static __inline uint32_t reg_read(ig4iic_softc_t *sc, uint32_t reg) { uint32_t value; bus_barrier(sc->regs_res, reg, 4, BUS_SPACE_BARRIER_READ); value = bus_read_4(sc->regs_res, reg); return (value); }
static void le_pci_wrcsr(struct lance_softc *sc, uint16_t port, uint16_t val) { struct le_pci_softc *lesc = (struct le_pci_softc *)sc; #ifdef __HAIKU__ HAIKU_INTR_REGISTER_STATE; if (port == LE_CSR0) HAIKU_INTR_REGISTER_ENTER(); #endif bus_write_2(lesc->sc_rres, PCNET_PCI_RAP, port); bus_barrier(lesc->sc_rres, PCNET_PCI_RAP, 2, BUS_SPACE_BARRIER_WRITE); bus_write_2(lesc->sc_rres, PCNET_PCI_RDP, val); #ifdef __HAIKU__ if (port == LE_CSR0) HAIKU_INTR_REGISTER_LEAVE(); #endif }
static uint16_t le_pci_rdcsr(struct lance_softc *sc, uint16_t port) { struct le_pci_softc *lesc = (struct le_pci_softc *)sc; #ifdef __HAIKU__ HAIKU_INTR_REGISTER_STATE; uint16_t value; if (port == LE_CSR0) HAIKU_INTR_REGISTER_ENTER(); #endif bus_write_2(lesc->sc_rres, PCNET_PCI_RAP, port); bus_barrier(lesc->sc_rres, PCNET_PCI_RAP, 2, BUS_SPACE_BARRIER_WRITE); #ifndef __HAIKU__ return (bus_read_2(lesc->sc_rres, PCNET_PCI_RDP)); #else value = bus_read_2(lesc->sc_rres, PCNET_PCI_RDP); if (port == LE_CSR0) HAIKU_INTR_REGISTER_LEAVE(); return value; #endif }
/* * Low-level inline support functions */ static __inline void reg_write(ig4iic_softc_t *sc, uint32_t reg, uint32_t value) { bus_write_4(sc->regs_res, reg, value); bus_barrier(sc->regs_res, reg, 4, BUS_SPACE_BARRIER_WRITE); }