1 /* Declarations common the the C portions of the QEMU PALcode console.
3 Copyright (C) 2011 Richard Henderson
5 This file is part of QEMU PALcode.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the text
15 of the GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; see the file COPYING. If not see
19 <http://www.gnu.org/licenses/>. */
33 static inline void wrent(void *cb
, unsigned long which
)
35 register void *a0
__asm__("$16") = cb
;
36 register unsigned long a1
__asm__("$17") = which
;
38 asm volatile ("call_pal 0x34"
40 : : "$1", "$22", "$23", "$24", "$25");
43 static inline unsigned long swpipl(unsigned long newipl
)
45 register unsigned long v0
__asm__("$0");
46 register unsigned long a0
__asm__("$16") = newipl
;
48 asm volatile ("call_pal 0x35"
50 : : "$1", "$22", "$23", "$24", "$25");
55 static inline unsigned long rdps(void)
57 register unsigned long v0
__asm__("$0");
59 asm volatile ("call_pal 0x36"
60 : "=r"(v0
) : : "$1", "$22", "$23", "$24", "$25");
65 static inline void wrkgp(void)
67 asm volatile ("mov $29, $16\n\tcall_pal 0x37"
68 : : : "$16", "$1", "$22", "$23", "$24", "$25");
71 static inline unsigned long wtint(unsigned long skip
)
73 register unsigned long v0
__asm__("$0");
74 register unsigned long a0
__asm__("$16") = skip
;
76 asm volatile ("call_pal 0x3e"
78 : : "$1", "$22", "$23", "$24", "$25");
87 static inline unsigned long ldq_p(unsigned long addr
)
89 register unsigned long v0
__asm__("$0");
90 register unsigned long a0
__asm__("$16") = 1;
91 register unsigned long a1
__asm__("$17") = addr
;
93 asm volatile ("call_pal 9"
94 : "=r"(v0
), "+r"(a0
), "+r"(a1
) :
95 : "$18", "$19", "$20", "$21");
100 static inline unsigned long stq_p(unsigned long port
, unsigned long val
)
102 register unsigned long v0
__asm__("$0");
103 register unsigned long a0
__asm__("$16") = 2;
104 register unsigned long a1
__asm__("$17") = port
;
105 register unsigned long a2
__asm__("$18") = val
;
107 asm volatile ("call_pal 9"
108 : "=r"(v0
), "+r"(a0
), "+r"(a1
), "+r"(a2
) :
109 : "$19", "$20", "$21");
114 static inline unsigned long get_wall_time(void)
116 register unsigned long v0
__asm__("$0");
117 register unsigned long a0
__asm__("$16") = 3;
119 asm("call_pal 9" : "=r"(v0
), "+r"(a0
) : : "$17", "$18", "$19", "$20", "$21");
124 static inline unsigned long get_alarm(void)
126 register unsigned long v0
__asm__("$0");
127 register unsigned long a0
__asm__("$16") = 4;
129 asm("call_pal 9" : "=r"(v0
), "+r"(a0
) : : "$17", "$18", "$19", "$20", "$21");
134 static inline void set_alarm_rel(unsigned long nsec
)
136 register unsigned long a0
__asm__("$16") = 5;
137 register unsigned long a1
__asm__("$17") = nsec
;
139 asm volatile ("call_pal 9"
141 : : "$0", "$18", "$19", "$20", "$21");
144 static inline void set_alarm_abs(unsigned long nsec
)
146 register unsigned long a0
__asm__("$16") = 6;
147 register unsigned long a1
__asm__("$17") = nsec
;
149 asm volatile ("call_pal 9"
151 : : "$0", "$18", "$19", "$20", "$21");
158 extern void *pci_io_base
;
160 static inline uint8_t inb(unsigned long port
)
162 return *(volatile uint8_t *)(pci_io_base
+ port
);
165 static inline void outb(uint8_t val
, unsigned long port
)
167 *(volatile uint8_t *)(pci_io_base
+ port
) = val
;
174 extern unsigned long crb_dispatch(long select
, long a1
, long a2
,
176 extern unsigned long crb_fixup(unsigned long vptptr
, unsigned long hwrpb
);
181 extern void do_console(void);
182 extern void entInt(void);
188 extern int printf(const char *, ...);
189 extern void ndelay(unsigned long nsec
);
191 static inline void udelay(unsigned long msec
)
199 extern void ps2port_setup(void);
200 extern void pci_setup(void);
202 #endif /* PROTOS_H */