Add qemu 2.4.0
[kvmfornfv.git] / qemu / roms / openbios / include / drivers / drivers.h
1 /*
2  *   OpenBIOS driver prototypes
3  *
4  *   (C) 2004 Stefan Reinauer <stepan@openbios.org>
5  *
6  *   This program is free software; you can redistribute it and/or
7  *   modify it under the terms of the GNU General Public License
8  *   version 2
9  *
10  */
11 #ifndef OPENBIOS_DRIVERS_H
12 #define OPENBIOS_DRIVERS_H
13
14 #include "config.h"
15
16 #ifdef CONFIG_DRIVER_PCI
17 /* drivers/pci.c */
18 int ob_pci_init(void);
19 #endif
20
21 #if defined(CONFIG_DRIVER_PCI) || defined(CONFIG_DRIVER_ESCC)
22 #ifdef CONFIG_PPC
23 extern int is_apple(void);
24 extern int is_oldworld(void);
25 extern int is_newworld(void);
26 #else
27 static inline int is_apple(void)
28 {
29         return 0;
30 }
31 static inline int is_oldworld(void)
32 {
33         return 0;
34 }
35 static inline int is_newworld(void)
36 {
37         return 0;
38 }
39 #endif
40 #define AAPL(_cmd)      do { if (is_apple()) _cmd; } while(0)
41 #define OLDWORLD(_cmd)  do { if (is_oldworld()) _cmd; } while(0)
42 #define NEWWORLD(_cmd)  do { if (is_newworld()) _cmd; } while(0)
43 #endif
44 #ifdef CONFIG_DRIVER_SBUS
45 /* drivers/sbus.c */
46 int ob_sbus_init(uint64_t base, int machine_id);
47
48 /* arch/sparc32/console.c */
49 void kbd_init(uint64_t base);
50 #endif
51 #ifdef CONFIG_DRIVER_IDE
52 /* drivers/ide.c */
53 int ob_ide_init(const char *path, uint32_t io_port0, uint32_t ctl_port0,
54                 uint32_t io_port1, uint32_t ctl_port1);
55 int macio_ide_init(const char *path, uint32_t addr, int nb_channels);
56 #endif
57 #ifdef CONFIG_DRIVER_ESP
58 /* drivers/esp.c */
59 int ob_esp_init(unsigned int slot, uint64_t base, unsigned long espoffset,
60                 unsigned long dmaoffset);
61 #endif
62 #ifdef CONFIG_DRIVER_OBIO
63 /* drivers/obio.c */
64 int ob_obio_init(uint64_t slavio_base, unsigned long fd_offset,
65                  unsigned long counter_offset, unsigned long intr_offset,
66                  int intr_ncpu, unsigned long aux1_offset, unsigned long aux2_offset,
67                  unsigned long mem_size);
68 int start_cpu(unsigned int pc, unsigned int context_ptr, unsigned int context,
69               int cpu);
70 void ob_eccmemctl_init(uint64_t base);
71 void ss5_init(uint64_t base);
72
73 /* drivers/iommu.c */
74 void ob_init_iommu(uint64_t base);
75 void *dvma_alloc(int size, unsigned int *pphys);
76
77 /* drivers/sbus.c */
78 extern uint16_t graphic_depth;
79
80 /* drivers/obio.c */
81 extern volatile unsigned char *power_reg;
82 extern volatile unsigned int *reset_reg;
83 extern volatile struct sun4m_timer_regs *counter_regs;
84
85 void ob_new_obio_device(const char *name, const char *type);
86 unsigned long ob_reg(uint64_t base, uint64_t offset, unsigned long size, int map);
87 void ob_intr(int intr);
88
89 /* arch/sparc32/boot.c */
90 extern uint32_t kernel_image;
91 extern uint32_t kernel_size;
92 extern uint32_t qemu_cmdline;
93 extern uint32_t cmdline_size;
94 extern char boot_device;
95 #endif
96 #ifdef CONFIG_DRIVER_FLOPPY
97 int ob_floppy_init(const char *path, const char *dev_name,
98                    unsigned long io_base, unsigned long mmio_base);
99 #endif
100 #ifdef CONFIG_DRIVER_PC_KBD
101 void ob_pc_kbd_init(const char *path, const char *dev_name, uint64_t base,
102                     uint64_t offset, int intr);
103 int pc_kbd_dataready(void);
104 unsigned char pc_kbd_readdata(void);
105 #endif
106 #ifdef CONFIG_DRIVER_PC_SERIAL
107 void ob_pc_serial_init(const char *path, const char *dev_name, uint64_t base,
108                        uint64_t offset, int intr);
109 int uart_init(int port, unsigned long speed);
110 int uart_charav(int port);
111 char uart_getchar(int port);
112 void uart_putchar(int c);
113 #endif
114 #ifdef CONFIG_DRIVER_ESCC
115 int escc_uart_init(phys_addr_t port, unsigned long speed);
116 int escc_uart_charav(uintptr_t port);
117 char escc_uart_getchar(uintptr_t port);
118 void escc_uart_putchar(int c);
119 void serial_cls(void);
120 #ifdef CONFIG_DRIVER_ESCC_SUN
121 int keyboard_dataready(void);
122 unsigned char keyboard_readdata(void);
123 #endif
124 #endif
125 int macio_get_nvram_size(void);
126 void macio_nvram_put(char *buf);
127 void macio_nvram_get(char *buf);
128
129 /* drivers/timer.c */
130 void setup_timers(void);
131
132 #endif /* OPENBIOS_DRIVERS_H */