NetBSD/sys/arch/alpha/isa/isafcns_jensen.c

136 lines
3.0 KiB
C

#include <sys/types.h>
#include <machine/pio.h>
#include <machine/pte.h>
static u_int8_t jensen_inb __P((int port));
/* static void jensen_insb __P((int port, void *addr, int cnt)); */
static u_int16_t jensen_inw __P((int port));
/* static void jensen_insw __P((int port, void *addr, int cnt)); */
u_int32_t jensen_inl __P((int port));
/* static void jensen_insl __P((int port, void *addr, int cnt)); */
static void jensen_outb __P((int port, u_int8_t datum));
/* static void jensen_outsb __P((int port, void *addr, int cnt)); */
static void jensen_outw __P((int port, u_int16_t datum));
/* static void jensen_outsw __P((int port, void *addr, int cnt)); */
static void jensen_outl __P((int port, u_int32_t datum));
/* static void jensen_outsl __P((int port, void *addr, int cnt)); */
struct alpha_isafcndesc jensen_isafcns = {
jensen_inb, 0 /* jensen_insb */,
jensen_inw, 0 /* jensen_insw */,
jensen_inl, 0 /* jensen_insl */,
jensen_outb, 0 /* jensen_outsb */,
jensen_outw, 0 /* jensen_outsw */,
jensen_outl, 0 /* jensen_outsl */,
};
u_int8_t
jensen_inb(ioaddr)
int ioaddr;
{
u_int32_t *port, val;
u_int8_t rval;
int offset;
offset = ioaddr & 3;
port = (int32_t *)phystok0seg(0x300000000L | 0 << 5 | ioaddr << 7);
val = *port;
rval = ((val) >> (8 * offset)) & 0xff;
rval = val & 0xff;
printf("inb(0x%x) => 0x%x @ %p => 0x%x\n", ioaddr, val, port, rval);
return rval;
}
u_int16_t
jensen_inw(ioaddr)
int ioaddr;
{
u_int32_t *port, val;
u_int16_t rval;
int offset;
offset = ioaddr & 3;
port = (int32_t *)phystok0seg(0x300000000L | 1 << 5 | ioaddr << 7);
val = *port;
rval = ((val) >> (8 * offset)) & 0xffff;
rval = val & 0xffff;
panic("inw(0x%x) => 0x%x @ %p => 0x%x\n", ioaddr, val, port, rval);
return rval;
}
u_int32_t
jensen_inl(ioaddr)
int ioaddr;
{
u_int32_t *port, val;
u_int32_t rval;
int offset;
offset = ioaddr & 3;
port = (int32_t *)phystok0seg(0x300000000L | 3 << 5 | ioaddr << 7);
val = *port;
rval = ((val) >> (8 * offset)) & 0xffffffff;
rval = val & 0xffffffff;
printf("inl(0x%x) => 0x%x @ %p => 0x%x\n", ioaddr, val, port, rval);
return rval;
}
void
jensen_outb(ioaddr, val)
int ioaddr;
u_int8_t val;
{
u_int32_t *port, nval;
int offset;
offset = ioaddr & 3;
nval = val /*<< (8 * offset)*/;
port = (int32_t *)phystok0seg(0x300000000L | 0 << 5 | ioaddr << 7);
printf("outb(0x%x, 0x%x) => 0x%x @ %p\n", ioaddr, val, nval, port);
*port = nval;
}
void
jensen_outw(ioaddr, val)
int ioaddr;
u_int16_t val;
{
u_int32_t *port, nval;
int offset;
offset = ioaddr & 3;
nval = val /*<< (8 * offset)*/;
port = (int32_t *)phystok0seg(0x300000000L | 1 << 5 | ioaddr << 7);
printf("outb(0x%x, 0x%x) => 0x%x @ %p\n", ioaddr, val, nval, port);
*port = nval;
}
void
jensen_outl(ioaddr, val)
int ioaddr;
u_int32_t val;
{
u_int32_t *port, nval;
int offset;
offset = ioaddr & 3;
nval = val /*<< (8 * offset)*/;
port = (int32_t *)phystok0seg(0x300000000L | 3 << 5 | ioaddr << 7);
printf("outb(0x%x, 0x%x) => 0x%x @ %p\n", ioaddr, val, nval, port);
*port = nval;
}