Annotation of qemu/roms/qemu-palcode/protos.h, revision 1.1.1.1

1.1       root        1: /* Declarations common the the C portions of the QEMU PALcode console.
                      2: 
                      3:    Copyright (C) 2011 Richard Henderson
                      4: 
                      5:    This file is part of QEMU PALcode.
                      6: 
                      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.
                     11: 
                     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.
                     16: 
                     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/>.  */
                     20: 
                     21: #ifndef PROTOS_H
                     22: #define PROTOS_H 1
                     23: 
                     24: #include <stdint.h>
                     25: #include <stdbool.h>
                     26: #include <stddef.h>
                     27: #include <string.h>
                     28: 
                     29: 
                     30: /*
                     31:  * Call_Pal functions.
                     32:  */
                     33: 
                     34: static inline void wrent(void *cb, unsigned long which)
                     35: {
                     36:   register void *a0 __asm__("$16") = cb;
                     37:   register unsigned long a1 __asm__("$17") = which;
                     38: 
                     39:   asm volatile ("call_pal 0x34"
                     40:                : "+r"(a0), "+r"(a1)
                     41:                : : "$1", "$22", "$23", "$24", "$25");
                     42: }
                     43: 
                     44: static inline unsigned long swpipl(unsigned long newipl)
                     45: {
                     46:   register unsigned long v0 __asm__("$0");
                     47:   register unsigned long a0 __asm__("$16") = newipl;
                     48: 
                     49:   asm volatile ("call_pal 0x35"
                     50:                : "=r"(v0), "+r"(a0)
                     51:                : : "$1", "$22", "$23", "$24", "$25");
                     52: 
                     53:   return v0;
                     54: }
                     55: 
                     56: static inline unsigned long rdps(void)
                     57: {
                     58:   register unsigned long v0 __asm__("$0");
                     59: 
                     60:   asm volatile ("call_pal 0x36"
                     61:                : "=r"(v0) : : "$1", "$22", "$23", "$24", "$25");
                     62: 
                     63:   return v0;
                     64: }
                     65: 
                     66: static inline void wrkgp(void)
                     67: {
                     68:   asm volatile ("mov $29, $16\n\tcall_pal 0x37"
                     69:                : : : "$16", "$1", "$22", "$23", "$24", "$25");
                     70: }
                     71: 
                     72: static inline unsigned long wtint(unsigned long skip)
                     73: {
                     74:   register unsigned long v0 __asm__("$0");
                     75:   register unsigned long a0 __asm__("$16") = skip;
                     76: 
                     77:   asm volatile ("call_pal 0x3e"
                     78:                : "=r"(v0), "+r"(a0)
                     79:                : : "$1", "$22", "$23", "$24", "$25");
                     80: 
                     81:   return v0;
                     82: }
                     83: 
                     84: /* 
                     85:  * Cserve functions.
                     86:  */
                     87: 
                     88: static inline unsigned long ldq_p(unsigned long addr)
                     89: {
                     90:   register unsigned long v0 __asm__("$0");
                     91:   register unsigned long a0 __asm__("$16") = 1;
                     92:   register unsigned long a1 __asm__("$17") = addr;
                     93: 
                     94:   asm volatile ("call_pal 9"
                     95:                : "=r"(v0), "+r"(a0), "+r"(a1) :
                     96:                : "$18", "$19", "$20", "$21");
                     97: 
                     98:   return v0;
                     99: }
                    100: 
                    101: static inline unsigned long stq_p(unsigned long port, unsigned long val)
                    102: {
                    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;
                    107: 
                    108:   asm volatile ("call_pal 9"
                    109:                : "=r"(v0), "+r"(a0), "+r"(a1), "+r"(a2) :
                    110:                : "$19", "$20", "$21");
                    111: 
                    112:   return v0;
                    113: }
                    114: 
                    115: static inline unsigned long get_wall_time(void)
                    116: {
                    117:   register unsigned long v0 __asm__("$0");
                    118:   register unsigned long a0 __asm__("$16") = 3;
                    119: 
                    120:   asm("call_pal 9" : "=r"(v0), "+r"(a0) : : "$17", "$18", "$19", "$20", "$21");
                    121: 
                    122:   return v0;
                    123: }
                    124: 
                    125: static inline unsigned long get_alarm(void)
                    126: {
                    127:   register unsigned long v0 __asm__("$0");
                    128:   register unsigned long a0 __asm__("$16") = 4;
                    129: 
                    130:   asm("call_pal 9" : "=r"(v0), "+r"(a0) : : "$17", "$18", "$19", "$20", "$21");
                    131: 
                    132:   return v0;
                    133: }
                    134: 
                    135: static inline void set_alarm_rel(unsigned long nsec)
                    136: {
                    137:   register unsigned long a0 __asm__("$16") = 5;
                    138:   register unsigned long a1 __asm__("$17") = nsec;
                    139: 
                    140:   asm volatile ("call_pal 9"
                    141:                : "+r"(a0), "+r"(a1)
                    142:                : : "$0", "$18", "$19", "$20", "$21");
                    143: }
                    144: 
                    145: static inline void set_alarm_abs(unsigned long nsec)
                    146: {
                    147:   register unsigned long a0 __asm__("$16") = 6;
                    148:   register unsigned long a1 __asm__("$17") = nsec;
                    149: 
                    150:   asm volatile ("call_pal 9"
                    151:                : "+r"(a0), "+r"(a1)
                    152:                : : "$0", "$18", "$19", "$20", "$21");
                    153: }
                    154: 
                    155: /*
                    156:  * I/O functions
                    157:  */
                    158: 
                    159: extern void *pci_io_base;
                    160: extern void *pci_mem_base;
                    161: 
                    162: static inline uint8_t inb(unsigned long port)
                    163: {
                    164:   return *(volatile uint8_t *)(pci_io_base + port);
                    165: }
                    166: 
                    167: static inline uint16_t inw(unsigned long port)
                    168: {
                    169:   return *(volatile uint16_t *)(pci_io_base + port);
                    170: }
                    171: 
                    172: static inline uint32_t inl(unsigned long port)
                    173: {
                    174:   return *(volatile uint32_t *)(pci_io_base + port);
                    175: }
                    176: 
                    177: static inline void outb(uint8_t val, unsigned long port)
                    178: {
                    179:   *(volatile uint8_t *)(pci_io_base + port) = val;
                    180: }
                    181: 
                    182: static inline void outw(uint16_t val, unsigned long port)
                    183: {
                    184:   *(volatile uint16_t *)(pci_io_base + port) = val;
                    185: }
                    186: 
                    187: static inline void outl(uint32_t val, unsigned long port)
                    188: {
                    189:   *(volatile uint32_t *)(pci_io_base + port) = val;
                    190: }
                    191: 
                    192: /*
                    193:  * CRB functions
                    194:  */
                    195: 
                    196: extern unsigned long crb_dispatch(long select, long a1, long a2,
                    197:                                   long a3, long a4);
                    198: extern unsigned long crb_fixup(unsigned long vptptr, unsigned long hwrpb);
                    199: 
                    200: /*
                    201:  * The Console
                    202:  */
                    203: 
                    204: extern bool have_vga;
                    205: 
                    206: extern void do_console(void);
                    207: extern void entInt(void);
                    208: 
                    209: /*
                    210:  * Utils
                    211:  */
                    212: 
                    213: extern int printf(const char *, ...);
                    214: extern void ndelay(unsigned long nsec);
                    215: 
                    216: static inline void udelay(unsigned long msec)
                    217: {
                    218:   ndelay(msec * 1000);
                    219: }
                    220: 
                    221: /*
                    222:  * Initialization
                    223:  */
                    224: extern void ps2port_setup(void);
                    225: extern void pci_setup(void);
                    226: 
                    227: #endif /* PROTOS_H */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.