Expand PMF_FN_* macros.
[netbsd-mini2440.git] / sys / arch / rs6000 / stand / boot / io.c
blob70281cb3c02d910ce9b5844cd9f8885d01276b39
1 /* $NetBSD: io.c,v 1.4 2006/06/27 23:26:13 garbled Exp $ */
4 #include <lib/libsa/stand.h>
5 #include <sys/bswap.h>
6 #include "boot.h"
8 #define POW_IOCC_SEG 0x820C00E0
9 #define IOCC_SEG 0x82000080
10 #define PSL_DR (1<<4)
12 volatile u_char *MCA_io = (u_char *)0xe0000000;
14 /* hardcode for now */
15 int
16 setup_iocc(void)
18 register_t savemsr, msr;
20 __asm volatile ("mfmsr %0" : "=r"(savemsr));
21 msr = savemsr & ~PSL_DR;
22 __asm volatile ("mtmsr %0" : : "r"(msr));
24 __asm volatile ("mtsr 14,%0" : : "r"(IOCC_SEG));
25 __asm volatile ("mtmsr %0" : : "r"(msr|PSL_DR));
26 __asm volatile ("isync");
27 __asm volatile ("mtmsr %0;isync" : : "r"(savemsr));
28 return 1;
31 void
32 outb(int port, char val)
35 MCA_io[port] = val;
38 inline void
39 outw(int port, u_int16_t val)
41 outb(port, val>>8);
42 outb(port+1, val);
45 u_char
46 inb(int port)
49 return (MCA_io[port]);