diff options
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/ppc/ppc.c | 20 | ||||
-rw-r--r-- | sys/dev/ppc/ppcreg.h | 39 | ||||
-rw-r--r-- | sys/isa/ppc.c | 20 | ||||
-rw-r--r-- | sys/isa/ppcreg.h | 39 |
4 files changed, 68 insertions, 50 deletions
diff --git a/sys/dev/ppc/ppc.c b/sys/dev/ppc/ppc.c index 3a30d54..099cd79 100644 --- a/sys/dev/ppc/ppc.c +++ b/sys/dev/ppc/ppc.c @@ -1355,8 +1355,9 @@ ppc_exec_microseq(device_t dev, struct ppb_microseq **p_msq) struct ppb_microseq *stack = 0; /* microsequence registers are equivalent to PC-like port registers */ -#define r_reg(register,ppc) (inb((ppc)->ppc_base + register)) -#define w_reg(register,ppc,byte) outb((ppc)->ppc_base + register, byte) + +#define r_reg(register,ppc) (bus_space_read_1((ppc)->bst, (ppc)->bsh, register)) +#define w_reg(register, ppc, byte) (bus_space_write_1((ppc)->bst, (ppc)->bsh, register, byte)) #define INCR_PC (mi ++) /* increment program counter */ @@ -1912,6 +1913,9 @@ ppc_probe(device_t dev) ppc->ppc_base = rman_get_start(ppc->res_ioport); + ppc->bsh = rman_get_bushandle(ppc->res_ioport); + ppc->bst = rman_get_bustag(ppc->res_ioport); + ppc->ppc_flags = device_get_flags(dev); if (!(ppc->ppc_flags & 0x20)) { @@ -2013,22 +2017,22 @@ ppc_io(device_t ppcdev, int iop, u_char *addr, int cnt, u_char byte) struct ppc_data *ppc = DEVTOSOFTC(ppcdev); switch (iop) { case PPB_OUTSB_EPP: - outsb(ppc->ppc_base + PPC_EPP_DATA, addr, cnt); + bus_space_write_multi_1(ppc->bst, ppc->bsh, PPC_EPP_DATA, addr, cnt); break; case PPB_OUTSW_EPP: - outsw(ppc->ppc_base + PPC_EPP_DATA, addr, cnt); + bus_space_write_multi_2(ppc->bst, ppc->bsh, PPC_EPP_DATA, (u_int16_t *)addr, cnt); break; case PPB_OUTSL_EPP: - outsl(ppc->ppc_base + PPC_EPP_DATA, addr, cnt); + bus_space_write_multi_4(ppc->bst, ppc->bsh, PPC_EPP_DATA, (u_int32_t *)addr, cnt); break; case PPB_INSB_EPP: - insb(ppc->ppc_base + PPC_EPP_DATA, addr, cnt); + bus_space_read_multi_1(ppc->bst, ppc->bsh, PPC_EPP_DATA, addr, cnt); break; case PPB_INSW_EPP: - insw(ppc->ppc_base + PPC_EPP_DATA, addr, cnt); + bus_space_read_multi_2(ppc->bst, ppc->bsh, PPC_EPP_DATA, (u_int16_t *)addr, cnt); break; case PPB_INSL_EPP: - insl(ppc->ppc_base + PPC_EPP_DATA, addr, cnt); + bus_space_read_multi_4(ppc->bst, ppc->bsh, PPC_EPP_DATA, (u_int32_t *)addr, cnt); break; case PPB_RDTR: return (r_dtr(ppc)); diff --git a/sys/dev/ppc/ppcreg.h b/sys/dev/ppc/ppcreg.h index 4d5e665..ea12ead 100644 --- a/sys/dev/ppc/ppcreg.h +++ b/sys/dev/ppc/ppcreg.h @@ -106,6 +106,9 @@ struct ppc_data { int rid_irq, rid_drq, rid_ioport; struct resource *res_irq, *res_drq, *res_ioport; + bus_space_handle_t bsh; + bus_space_tag_t bst; + void *intr_cookie; int ppc_registered; /* 1 if ppcintr() is the registered interrupt */ @@ -139,23 +142,25 @@ struct ppc_data { #define PPC_DISABLE_INTR (PPC_SERVICE_INTR | PPC_nFAULT_INTR) #define PPC_ECR_RESET (PPC_ECR_PS2 | PPC_DISABLE_INTR) -#define r_dtr(ppc) (inb((ppc)->ppc_base + PPC_SPP_DTR)) -#define r_str(ppc) (inb((ppc)->ppc_base + PPC_SPP_STR)) -#define r_ctr(ppc) (inb((ppc)->ppc_base + PPC_SPP_CTR)) -#define r_epp_A(ppc) (inb((ppc)->ppc_base + PPC_EPP_ADDR)) -#define r_epp_D(ppc) (inb((ppc)->ppc_base + PPC_EPP_DATA)) -#define r_cnfgA(ppc) (inb((ppc)->ppc_base + PPC_ECP_CNFGA)) -#define r_cnfgB(ppc) (inb((ppc)->ppc_base + PPC_ECP_CNFGB)) -#define r_ecr(ppc) (inb((ppc)->ppc_base + PPC_ECP_ECR)) -#define r_fifo(ppc) (inb((ppc)->ppc_base + PPC_ECP_D_FIFO)) - -#define w_dtr(ppc,byte) outb((ppc)->ppc_base + PPC_SPP_DTR, byte) -#define w_str(ppc,byte) outb((ppc)->ppc_base + PPC_SPP_STR, byte) -#define w_ctr(ppc,byte) outb((ppc)->ppc_base + PPC_SPP_CTR, byte) -#define w_epp_A(ppc,byte) outb((ppc)->ppc_base + PPC_EPP_ADDR, byte) -#define w_epp_D(ppc,byte) outb((ppc)->ppc_base + PPC_EPP_DATA, byte) -#define w_ecr(ppc,byte) outb((ppc)->ppc_base + PPC_ECP_ECR, byte) -#define w_fifo(ppc,byte) outb((ppc)->ppc_base + PPC_ECP_D_FIFO, byte) +#define r_dtr(ppc) (bus_space_read_1((ppc)->bst, (ppc)->bsh, PPC_SPP_DTR)) +#define r_str(ppc) (bus_space_read_1((ppc)->bst, (ppc)->bsh, PPC_SPP_STR)) +#define r_ctr(ppc) (bus_space_read_1((ppc)->bst, (ppc)->bsh, PPC_SPP_CTR)) + +#define r_epp_A(ppc) (bus_space_read_1((ppc)->bst, (ppc)->bsh, PPC_EPP_ADDR)) +#define r_epp_D(ppc) (bus_space_read_1((ppc)->bst, (ppc)->bsh, PPC_EPP_DATA)) +#define r_cnfgA(ppc) (bus_space_read_1((ppc)->bst, (ppc)->bsh, PPC_ECP_CNFGA)) +#define r_cnfgB(ppc) (bus_space_read_1((ppc)->bst, (ppc)->bsh, PPC_ECP_CNFGB)) +#define r_ecr(ppc) (bus_space_read_1((ppc)->bst, (ppc)->bsh, PPC_ECP_ECR)) +#define r_fifo(ppc) (bus_space_read_1((ppc)->bst, (ppc)->bsh, PPC_ECP_D_FIFO)) + +#define w_dtr(ppc, byte) (bus_space_write_1((ppc)->bst, (ppc)->bsh, PPC_SPP_DTR, byte)) +#define w_str(ppc, byte) (bus_space_write_1((ppc)->bst, (ppc)->bsh, PPC_SPP_STR, byte)) +#define w_ctr(ppc, byte) (bus_space_write_1((ppc)->bst, (ppc)->bsh, PPC_SPP_CTR, byte)) + +#define w_epp_A(ppc, byte) (bus_space_write_1((ppc)->bst, (ppc)->bsh, PPC_EPP_ADDR, byte)) +#define w_epp_D(ppc, byte) (bus_space_write_1((ppc)->bst, (ppc)->bsh, PPC_EPP_DATA, byte)) +#define w_ecr(ppc, byte) (bus_space_write_1((ppc)->bst, (ppc)->bsh, PPC_ECP_ECR, byte)) +#define w_fifo(ppc, byte) (bus_space_write_1((ppc)->bst, (ppc)->bsh, PPC_ECP_D_FIFO, byte)) /* * Register defines for the PC873xx parts diff --git a/sys/isa/ppc.c b/sys/isa/ppc.c index 3a30d54..099cd79 100644 --- a/sys/isa/ppc.c +++ b/sys/isa/ppc.c @@ -1355,8 +1355,9 @@ ppc_exec_microseq(device_t dev, struct ppb_microseq **p_msq) struct ppb_microseq *stack = 0; /* microsequence registers are equivalent to PC-like port registers */ -#define r_reg(register,ppc) (inb((ppc)->ppc_base + register)) -#define w_reg(register,ppc,byte) outb((ppc)->ppc_base + register, byte) + +#define r_reg(register,ppc) (bus_space_read_1((ppc)->bst, (ppc)->bsh, register)) +#define w_reg(register, ppc, byte) (bus_space_write_1((ppc)->bst, (ppc)->bsh, register, byte)) #define INCR_PC (mi ++) /* increment program counter */ @@ -1912,6 +1913,9 @@ ppc_probe(device_t dev) ppc->ppc_base = rman_get_start(ppc->res_ioport); + ppc->bsh = rman_get_bushandle(ppc->res_ioport); + ppc->bst = rman_get_bustag(ppc->res_ioport); + ppc->ppc_flags = device_get_flags(dev); if (!(ppc->ppc_flags & 0x20)) { @@ -2013,22 +2017,22 @@ ppc_io(device_t ppcdev, int iop, u_char *addr, int cnt, u_char byte) struct ppc_data *ppc = DEVTOSOFTC(ppcdev); switch (iop) { case PPB_OUTSB_EPP: - outsb(ppc->ppc_base + PPC_EPP_DATA, addr, cnt); + bus_space_write_multi_1(ppc->bst, ppc->bsh, PPC_EPP_DATA, addr, cnt); break; case PPB_OUTSW_EPP: - outsw(ppc->ppc_base + PPC_EPP_DATA, addr, cnt); + bus_space_write_multi_2(ppc->bst, ppc->bsh, PPC_EPP_DATA, (u_int16_t *)addr, cnt); break; case PPB_OUTSL_EPP: - outsl(ppc->ppc_base + PPC_EPP_DATA, addr, cnt); + bus_space_write_multi_4(ppc->bst, ppc->bsh, PPC_EPP_DATA, (u_int32_t *)addr, cnt); break; case PPB_INSB_EPP: - insb(ppc->ppc_base + PPC_EPP_DATA, addr, cnt); + bus_space_read_multi_1(ppc->bst, ppc->bsh, PPC_EPP_DATA, addr, cnt); break; case PPB_INSW_EPP: - insw(ppc->ppc_base + PPC_EPP_DATA, addr, cnt); + bus_space_read_multi_2(ppc->bst, ppc->bsh, PPC_EPP_DATA, (u_int16_t *)addr, cnt); break; case PPB_INSL_EPP: - insl(ppc->ppc_base + PPC_EPP_DATA, addr, cnt); + bus_space_read_multi_4(ppc->bst, ppc->bsh, PPC_EPP_DATA, (u_int32_t *)addr, cnt); break; case PPB_RDTR: return (r_dtr(ppc)); diff --git a/sys/isa/ppcreg.h b/sys/isa/ppcreg.h index 4d5e665..ea12ead 100644 --- a/sys/isa/ppcreg.h +++ b/sys/isa/ppcreg.h @@ -106,6 +106,9 @@ struct ppc_data { int rid_irq, rid_drq, rid_ioport; struct resource *res_irq, *res_drq, *res_ioport; + bus_space_handle_t bsh; + bus_space_tag_t bst; + void *intr_cookie; int ppc_registered; /* 1 if ppcintr() is the registered interrupt */ @@ -139,23 +142,25 @@ struct ppc_data { #define PPC_DISABLE_INTR (PPC_SERVICE_INTR | PPC_nFAULT_INTR) #define PPC_ECR_RESET (PPC_ECR_PS2 | PPC_DISABLE_INTR) -#define r_dtr(ppc) (inb((ppc)->ppc_base + PPC_SPP_DTR)) -#define r_str(ppc) (inb((ppc)->ppc_base + PPC_SPP_STR)) -#define r_ctr(ppc) (inb((ppc)->ppc_base + PPC_SPP_CTR)) -#define r_epp_A(ppc) (inb((ppc)->ppc_base + PPC_EPP_ADDR)) -#define r_epp_D(ppc) (inb((ppc)->ppc_base + PPC_EPP_DATA)) -#define r_cnfgA(ppc) (inb((ppc)->ppc_base + PPC_ECP_CNFGA)) -#define r_cnfgB(ppc) (inb((ppc)->ppc_base + PPC_ECP_CNFGB)) -#define r_ecr(ppc) (inb((ppc)->ppc_base + PPC_ECP_ECR)) -#define r_fifo(ppc) (inb((ppc)->ppc_base + PPC_ECP_D_FIFO)) - -#define w_dtr(ppc,byte) outb((ppc)->ppc_base + PPC_SPP_DTR, byte) -#define w_str(ppc,byte) outb((ppc)->ppc_base + PPC_SPP_STR, byte) -#define w_ctr(ppc,byte) outb((ppc)->ppc_base + PPC_SPP_CTR, byte) -#define w_epp_A(ppc,byte) outb((ppc)->ppc_base + PPC_EPP_ADDR, byte) -#define w_epp_D(ppc,byte) outb((ppc)->ppc_base + PPC_EPP_DATA, byte) -#define w_ecr(ppc,byte) outb((ppc)->ppc_base + PPC_ECP_ECR, byte) -#define w_fifo(ppc,byte) outb((ppc)->ppc_base + PPC_ECP_D_FIFO, byte) +#define r_dtr(ppc) (bus_space_read_1((ppc)->bst, (ppc)->bsh, PPC_SPP_DTR)) +#define r_str(ppc) (bus_space_read_1((ppc)->bst, (ppc)->bsh, PPC_SPP_STR)) +#define r_ctr(ppc) (bus_space_read_1((ppc)->bst, (ppc)->bsh, PPC_SPP_CTR)) + +#define r_epp_A(ppc) (bus_space_read_1((ppc)->bst, (ppc)->bsh, PPC_EPP_ADDR)) +#define r_epp_D(ppc) (bus_space_read_1((ppc)->bst, (ppc)->bsh, PPC_EPP_DATA)) +#define r_cnfgA(ppc) (bus_space_read_1((ppc)->bst, (ppc)->bsh, PPC_ECP_CNFGA)) +#define r_cnfgB(ppc) (bus_space_read_1((ppc)->bst, (ppc)->bsh, PPC_ECP_CNFGB)) +#define r_ecr(ppc) (bus_space_read_1((ppc)->bst, (ppc)->bsh, PPC_ECP_ECR)) +#define r_fifo(ppc) (bus_space_read_1((ppc)->bst, (ppc)->bsh, PPC_ECP_D_FIFO)) + +#define w_dtr(ppc, byte) (bus_space_write_1((ppc)->bst, (ppc)->bsh, PPC_SPP_DTR, byte)) +#define w_str(ppc, byte) (bus_space_write_1((ppc)->bst, (ppc)->bsh, PPC_SPP_STR, byte)) +#define w_ctr(ppc, byte) (bus_space_write_1((ppc)->bst, (ppc)->bsh, PPC_SPP_CTR, byte)) + +#define w_epp_A(ppc, byte) (bus_space_write_1((ppc)->bst, (ppc)->bsh, PPC_EPP_ADDR, byte)) +#define w_epp_D(ppc, byte) (bus_space_write_1((ppc)->bst, (ppc)->bsh, PPC_EPP_DATA, byte)) +#define w_ecr(ppc, byte) (bus_space_write_1((ppc)->bst, (ppc)->bsh, PPC_ECP_ECR, byte)) +#define w_fifo(ppc, byte) (bus_space_write_1((ppc)->bst, (ppc)->bsh, PPC_ECP_D_FIFO, byte)) /* * Register defines for the PC873xx parts |