cleanup
[linux-2.4.git] / include / asm-ppc64 / machdep.h
1 #ifdef __KERNEL__
2 #ifndef _PPC_MACHDEP_H
3 #define _PPC_MACHDEP_H
4
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  * as published by the Free Software Foundation; either version
9  * 2 of the License, or (at your option) any later version.
10  */
11
12 #include <linux/config.h>
13 #include <linux/seq_file.h>
14 #include <linux/irq.h>
15
16 struct pt_regs;
17 struct pci_bus; 
18 struct pci_dev;
19 struct kbd_repeat;
20 struct device_node;
21 struct TceTable;
22 struct rtc_time;
23
24 struct machdep_calls {
25         void            (*hpte_invalidate)(unsigned long slot,
26                                            unsigned long secondary,  
27                                            unsigned long va, 
28                                            int large, int local);
29         long            (*hpte_updatepp)(unsigned long slot,
30                                          unsigned long secondary,  
31                                          unsigned long newpp, 
32                                          unsigned long va,
33                                          int large);
34         void            (*hpte_updateboltedpp)(unsigned long newpp, 
35                                                unsigned long ea);
36         long            (*hpte_insert)(unsigned long vpn,
37                                        unsigned long prpn,
38                                        unsigned long hpteflags, 
39                                        int bolted,
40                                        int large);
41         long            (*hpte_remove)(unsigned long hpte_group);
42         
43         void            (*tce_build)(struct TceTable * tbl,
44                                      long tcenum,
45                                      unsigned long uaddr,
46                                      int direction);
47         void            (*tce_free_one)(struct TceTable *tbl,
48                                         long tcenum);    
49
50         void            (*smp_message_pass)(int target,
51                                             int msg, 
52                                             unsigned long data,
53                                             int wait);
54         int             (*smp_probe)(void);
55         void            (*smp_kick_cpu)(int nr);
56         void            (*smp_setup_cpu)(int nr);
57
58         void            (*setup_arch)(void);
59         /* Optional, may be NULL. */
60         void            (*setup_residual)(struct seq_file *m, int cpu_id);
61         /* Optional, may be NULL. */
62         void            (*get_cpuinfo)(struct seq_file *m);
63         /* Optional, may be NULL. */
64         unsigned int    (*irq_cannonicalize)(unsigned int irq);
65         void            (*init_IRQ)(void);
66         void            (*init_ras_IRQ)(void);
67         void            (*init_irq_desc)(irq_desc_t *desc);
68         int             (*get_irq)(struct pt_regs *);
69         
70         /* A general init function, called by ppc_init in init/main.c.
71            May be NULL. */
72         void            (*init)(void);
73
74         void            (*restart)(char *cmd);
75         void            (*power_off)(void);
76         void            (*halt)(void);
77
78         long            (*time_init)(void); /* Optional, may be NULL */
79         int             (*set_rtc_time)(struct rtc_time *);
80         void            (*get_rtc_time)(struct rtc_time *);
81         void            (*get_boot_time)(struct rtc_time *);
82         void            (*calibrate_decr)(void);
83
84         void            (*progress)(char *, unsigned short);
85
86
87         unsigned char   (*nvram_read_val)(int addr);
88         void            (*nvram_write_val)(int addr, unsigned char val);
89
90 /* Tons of keyboard stuff. */
91         int             (*kbd_setkeycode)(unsigned int scancode,
92                                 unsigned int keycode);
93         int             (*kbd_getkeycode)(unsigned int scancode);
94         int             (*kbd_translate)(unsigned char scancode,
95                                 unsigned char *keycode,
96                                 char raw_mode);
97         char            (*kbd_unexpected_up)(unsigned char keycode);
98         void            (*kbd_leds)(unsigned char leds);
99         void            (*kbd_init_hw)(void);
100 #ifdef CONFIG_MAGIC_SYSRQ
101         unsigned char   *ppc_kbd_sysrq_xlate;
102 #endif
103
104         /* Debug interface.  Low level I/O to some terminal device */
105         void            (*udbg_putc)(unsigned char c);
106         unsigned char   (*udbg_getc)(void);
107         int             (*udbg_getc_poll)(void);
108
109         /* PCI interfaces */
110         int (*pcibios_read_config_byte)(struct device_node *dn, int offset, u8 *val);
111         int (*pcibios_read_config_word)(struct device_node *dn, int offset, u16 *val);
112         int (*pcibios_read_config_dword)(struct device_node *dn, int offset, u32 *val);
113         int (*pcibios_write_config_byte)(struct device_node *dn, int offset, u8 val);
114         int (*pcibios_write_config_word)(struct device_node *dn, int offset, u16 val);
115         int (*pcibios_write_config_dword)(struct device_node *dn, int offset, u32 val);
116
117         /* Called after scanning the bus, before allocating
118          * resources
119          */
120         void (*pcibios_fixup)(void);
121
122        /* Called for each PCI bus in the system
123         * when it's probed
124         */
125         void (*pcibios_fixup_bus)(struct pci_bus *);
126
127        /* Called when pci_enable_device() is called (initial=0) or
128         * when a device with no assigned resource is found (initial=1).
129         * Returns 0 to allow assignement/enabling of the device
130         */
131         int  (*pcibios_enable_device_hook)(struct pci_dev *, int initial);
132
133         void* (*pci_dev_io_base)(unsigned char bus, unsigned char devfn, int physical);
134         void* (*pci_dev_mem_base)(unsigned char bus, unsigned char devfn);
135         int (*pci_dev_root_bridge)(unsigned char bus, unsigned char devfn);
136
137         /* Interface for platform error logging */
138         void (*log_error)(char *buf, unsigned int err_type, int fatal);
139
140         /* this is for modules, since _machine can be a define -- Cort */
141         int ppc_machine;
142 };
143
144 extern struct machdep_calls ppc_md;
145 extern char cmd_line[512];
146
147 extern void setup_pci_ptrs(void);
148
149
150 /* Functions to produce codes on the leds.
151  * The SRC code should be unique for the message category and should
152  * be limited to the lower 24 bits (the upper 8 are set by these funcs),
153  * and (for boot & dump) should be sorted numerically in the order
154  * the events occur.
155  */
156 /* Print a boot progress message. */
157 void ppc64_boot_msg(unsigned int src, const char *msg);
158 /* Print a termination message (print only -- does not stop the kernel) */
159 void ppc64_terminate_msg(unsigned int src, const char *msg);
160 /* Print something that needs attention (device error, etc) */
161 void ppc64_attention_msg(unsigned int src, const char *msg);
162 /* Print a dump progress message. */
163 void ppc64_dump_msg(unsigned int src, const char *msg);
164
165 static inline void log_error(char *buf, unsigned int err_type, int fatal)
166 {
167         if (ppc_md.log_error)
168                 ppc_md.log_error(buf, err_type, fatal);
169 }
170
171 #endif /* _PPC_MACHDEP_H */
172 #endif /* __KERNEL__ */