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/>. */
34 static inline void wrent(void *cb
, unsigned long which
)
36 register void *a0
__asm__("$16") = cb
;
37 register unsigned long a1
__asm__("$17") = which
;
39 asm volatile ("call_pal 0x34"
41 : : "$1", "$22", "$23", "$24", "$25");
44 static inline unsigned long swpipl(unsigned long newipl
)
46 register unsigned long v0
__asm__("$0");
47 register unsigned long a0
__asm__("$16") = newipl
;
49 asm volatile ("call_pal 0x35"
51 : : "$1", "$22", "$23", "$24", "$25");
56 static inline unsigned long rdps(void)
58 register unsigned long v0
__asm__("$0");
60 asm volatile ("call_pal 0x36"
61 : "=r"(v0
) : : "$1", "$22", "$23", "$24", "$25");
66 static inline void wrkgp(void)
68 asm volatile ("mov $29, $16\n\tcall_pal 0x37"
69 : : : "$16", "$1", "$22", "$23", "$24", "$25");
72 static inline unsigned long wtint(unsigned long skip
)
74 register unsigned long v0
__asm__("$0");
75 register unsigned long a0
__asm__("$16") = skip
;
77 asm volatile ("call_pal 0x3e"
79 : : "$1", "$22", "$23", "$24", "$25");
88 static inline unsigned long ldq_p(unsigned long addr
)
90 register unsigned long v0
__asm__("$0");
91 register unsigned long a0
__asm__("$16") = 1;
92 register unsigned long a1
__asm__("$17") = addr
;
94 asm volatile ("call_pal 9"
95 : "=r"(v0
), "+r"(a0
), "+r"(a1
) :
96 : "$18", "$19", "$20", "$21");
101 static inline unsigned long stq_p(unsigned long port
, unsigned long val
)
103 register unsigned long v0
__asm__("$0");
104 register unsigned long a0
__asm__("$16") = 2;
105 register unsigned long a1
__asm__("$17") = port
;
106 register unsigned long a2
__asm__("$18") = val
;
108 asm volatile ("call_pal 9"
109 : "=r"(v0
), "+r"(a0
), "+r"(a1
), "+r"(a2
) :
110 : "$19", "$20", "$21");
115 static inline unsigned long get_wall_time(void)
117 register unsigned long v0
__asm__("$0");
118 register unsigned long a0
__asm__("$16") = 3;
120 asm("call_pal 9" : "=r"(v0
), "+r"(a0
) : : "$17", "$18", "$19", "$20", "$21");
125 static inline unsigned long get_alarm(void)
127 register unsigned long v0
__asm__("$0");
128 register unsigned long a0
__asm__("$16") = 4;
130 asm("call_pal 9" : "=r"(v0
), "+r"(a0
) : : "$17", "$18", "$19", "$20", "$21");
135 static inline void set_alarm_rel(unsigned long nsec
)
137 register unsigned long a0
__asm__("$16") = 5;
138 register unsigned long a1
__asm__("$17") = nsec
;
140 asm volatile ("call_pal 9"
142 : : "$0", "$18", "$19", "$20", "$21");
145 static inline void set_alarm_abs(unsigned long nsec
)
147 register unsigned long a0
__asm__("$16") = 6;
148 register unsigned long a1
__asm__("$17") = nsec
;
150 asm volatile ("call_pal 9"
152 : : "$0", "$18", "$19", "$20", "$21");
159 extern void *pci_io_base
;
160 extern void *pci_mem_base
;
162 static inline uint8_t inb(unsigned long port
)
164 return *(volatile uint8_t *)(pci_io_base
+ port
);
167 static inline uint16_t inw(unsigned long port
)
169 return *(volatile uint16_t *)(pci_io_base
+ port
);
172 static inline uint32_t inl(unsigned long port
)
174 return *(volatile uint32_t *)(pci_io_base
+ port
);
177 static inline void outb(uint8_t val
, unsigned long port
)
179 *(volatile uint8_t *)(pci_io_base
+ port
) = val
;
182 static inline void outw(uint16_t val
, unsigned long port
)
184 *(volatile uint16_t *)(pci_io_base
+ port
) = val
;
187 static inline void outl(uint32_t val
, unsigned long port
)
189 *(volatile uint32_t *)(pci_io_base
+ port
) = val
;
196 extern unsigned long crb_dispatch(long select
, long a1
, long a2
,
198 extern unsigned long crb_fixup(unsigned long vptptr
, unsigned long hwrpb
);
204 extern bool have_vga
;
206 extern void do_console(void);
207 extern void entInt(void);
213 extern int printf(const char *, ...);
214 extern void ndelay(unsigned long nsec
);
216 static inline void udelay(unsigned long msec
)
224 extern void ps2port_setup(void);
225 extern void pci_setup(void);
227 #endif /* PROTOS_H */