[PATCH] sanitize the interface of graft_tree().
[linux-2.6/kvm.git] / include / asm-powerpc / machdep.h
blobfa03864d06eb0d69c528ffa4f25e110d102ca44c
1 #ifndef _ASM_POWERPC_MACHDEP_H
2 #define _ASM_POWERPC_MACHDEP_H
3 #ifdef __KERNEL__
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.
12 #include <linux/config.h>
13 #include <linux/seq_file.h>
14 #include <linux/init.h>
15 #include <linux/dma-mapping.h>
17 #include <asm/setup.h>
19 /* We export this macro for external modules like Alsa to know if
20 * ppc_md.feature_call is implemented or not
22 #define CONFIG_PPC_HAS_FEATURE_CALLS
24 struct pt_regs;
25 struct pci_bus;
26 struct device_node;
27 struct iommu_table;
28 struct rtc_time;
29 struct file;
31 #ifdef CONFIG_SMP
32 struct smp_ops_t {
33 void (*message_pass)(int target, int msg);
34 int (*probe)(void);
35 void (*kick_cpu)(int nr);
36 void (*setup_cpu)(int nr);
37 void (*take_timebase)(void);
38 void (*give_timebase)(void);
39 int (*cpu_enable)(unsigned int nr);
40 int (*cpu_disable)(void);
41 void (*cpu_die)(unsigned int nr);
42 int (*cpu_bootable)(unsigned int nr);
44 #endif
46 struct machdep_calls {
47 #ifdef CONFIG_PPC64
48 void (*hpte_invalidate)(unsigned long slot,
49 unsigned long va,
50 int psize,
51 int local);
52 long (*hpte_updatepp)(unsigned long slot,
53 unsigned long newpp,
54 unsigned long va,
55 int pize,
56 int local);
57 void (*hpte_updateboltedpp)(unsigned long newpp,
58 unsigned long ea,
59 int psize);
60 long (*hpte_insert)(unsigned long hpte_group,
61 unsigned long va,
62 unsigned long prpn,
63 unsigned long rflags,
64 unsigned long vflags,
65 int psize);
66 long (*hpte_remove)(unsigned long hpte_group);
67 void (*flush_hash_range)(unsigned long number, int local);
69 /* special for kexec, to be called in real mode, linar mapping is
70 * destroyed as well */
71 void (*hpte_clear_all)(void);
73 void (*tce_build)(struct iommu_table * tbl,
74 long index,
75 long npages,
76 unsigned long uaddr,
77 enum dma_data_direction direction);
78 void (*tce_free)(struct iommu_table *tbl,
79 long index,
80 long npages);
81 void (*tce_flush)(struct iommu_table *tbl);
82 void (*iommu_dev_setup)(struct pci_dev *dev);
83 void (*iommu_bus_setup)(struct pci_bus *bus);
84 void (*irq_bus_setup)(struct pci_bus *bus);
85 int (*set_dabr)(unsigned long dabr);
86 #endif
88 int (*probe)(int platform);
89 void (*setup_arch)(void);
90 void (*init_early)(void);
91 /* Optional, may be NULL. */
92 void (*show_cpuinfo)(struct seq_file *m);
93 void (*show_percpuinfo)(struct seq_file *m, int i);
95 void (*init_IRQ)(void);
96 int (*get_irq)(struct pt_regs *);
97 void (*cpu_irq_down)(int secondary);
99 /* PCI stuff */
100 /* Called after scanning the bus, before allocating resources */
101 void (*pcibios_fixup)(void);
102 int (*pci_probe_mode)(struct pci_bus *);
104 void (*restart)(char *cmd);
105 void (*power_off)(void);
106 void (*halt)(void);
107 void (*panic)(char *str);
108 void (*cpu_die)(void);
110 long (*time_init)(void); /* Optional, may be NULL */
112 int (*set_rtc_time)(struct rtc_time *);
113 void (*get_rtc_time)(struct rtc_time *);
114 unsigned long (*get_boot_time)(void);
115 unsigned char (*rtc_read_val)(int addr);
116 void (*rtc_write_val)(int addr, unsigned char val);
118 void (*calibrate_decr)(void);
120 void (*progress)(char *, unsigned short);
122 /* Interface for platform error logging */
123 void (*log_error)(char *buf, unsigned int err_type, int fatal);
125 unsigned char (*nvram_read_val)(int addr);
126 void (*nvram_write_val)(int addr, unsigned char val);
127 ssize_t (*nvram_write)(char *buf, size_t count, loff_t *index);
128 ssize_t (*nvram_read)(char *buf, size_t count, loff_t *index);
129 ssize_t (*nvram_size)(void);
130 void (*nvram_sync)(void);
132 /* Exception handlers */
133 void (*system_reset_exception)(struct pt_regs *regs);
134 int (*machine_check_exception)(struct pt_regs *regs);
136 /* Motherboard/chipset features. This is a kind of general purpose
137 * hook used to control some machine specific features (like reset
138 * lines, chip power control, etc...).
140 long (*feature_call)(unsigned int feature, ...);
142 /* Check availability of legacy devices like i8042 */
143 int (*check_legacy_ioport)(unsigned int baseport);
145 /* Get legacy PCI/IDE interrupt mapping */
146 int (*pci_get_legacy_ide_irq)(struct pci_dev *dev, int channel);
148 /* Get access protection for /dev/mem */
149 pgprot_t (*phys_mem_access_prot)(struct file *file,
150 unsigned long pfn,
151 unsigned long size,
152 pgprot_t vma_prot);
154 /* Idle loop for this platform, leave empty for default idle loop */
155 void (*idle_loop)(void);
157 /* Function to enable performance monitor counters for this
158 platform, called once per cpu. */
159 void (*enable_pmcs)(void);
161 #ifdef CONFIG_PPC32 /* XXX for now */
162 /* A general init function, called by ppc_init in init/main.c.
163 May be NULL. */
164 void (*init)(void);
166 void (*idle)(void);
167 void (*power_save)(void);
169 void (*heartbeat)(void);
170 unsigned long heartbeat_reset;
171 unsigned long heartbeat_count;
173 void (*setup_io_mappings)(void);
175 void (*early_serial_map)(void);
176 void (*kgdb_map_scc)(void);
179 * optional PCI "hooks"
182 /* Called after PPC generic resource fixup to perform
183 machine specific fixups */
184 void (*pcibios_fixup_resources)(struct pci_dev *);
186 /* Called for each PCI bus in the system when it's probed */
187 void (*pcibios_fixup_bus)(struct pci_bus *);
189 /* Called when pci_enable_device() is called (initial=0) or
190 * when a device with no assigned resource is found (initial=1).
191 * Returns 0 to allow assignment/enabling of the device. */
192 int (*pcibios_enable_device_hook)(struct pci_dev *, int initial);
194 /* For interrupt routing */
195 unsigned char (*pci_swizzle)(struct pci_dev *, unsigned char *);
196 int (*pci_map_irq)(struct pci_dev *, unsigned char, unsigned char);
198 /* Called in indirect_* to avoid touching devices */
199 int (*pci_exclude_device)(unsigned char, unsigned char);
201 /* Called at then very end of pcibios_init() */
202 void (*pcibios_after_init)(void);
204 /* this is for modules, since _machine can be a define -- Cort */
205 int ppc_machine;
207 #ifdef CONFIG_KEXEC
208 /* Called to shutdown machine specific hardware not already controlled
209 * by other drivers.
210 * XXX Should we move this one out of kexec scope?
212 void (*machine_shutdown)(void);
214 /* Called to do the minimal shutdown needed to run a kexec'd kernel
215 * to run successfully.
216 * XXX Should we move this one out of kexec scope?
218 void (*machine_crash_shutdown)(void);
220 /* Called to do what every setup is needed on image and the
221 * reboot code buffer. Returns 0 on success.
222 * Provide your own (maybe dummy) implementation if your platform
223 * claims to support kexec.
225 int (*machine_kexec_prepare)(struct kimage *image);
227 /* Called to handle any machine specific cleanup on image */
228 void (*machine_kexec_cleanup)(struct kimage *image);
230 /* Called to perform the _real_ kexec.
231 * Do NOT allocate memory or fail here. We are past the point of
232 * no return.
234 void (*machine_kexec)(struct kimage *image);
235 #endif /* CONFIG_KEXEC */
236 #endif /* CONFIG_PPC32 */
239 extern void default_idle(void);
240 extern void native_idle(void);
242 extern struct machdep_calls ppc_md;
243 extern char cmd_line[COMMAND_LINE_SIZE];
245 #ifdef CONFIG_PPC_PMAC
247 * Power macintoshes have either a CUDA, PMU or SMU controlling
248 * system reset, power, NVRAM, RTC.
250 typedef enum sys_ctrler_kind {
251 SYS_CTRLER_UNKNOWN = 0,
252 SYS_CTRLER_CUDA = 1,
253 SYS_CTRLER_PMU = 2,
254 SYS_CTRLER_SMU = 3,
255 } sys_ctrler_t;
256 extern sys_ctrler_t sys_ctrler;
258 #endif /* CONFIG_PPC_PMAC */
260 extern void setup_pci_ptrs(void);
262 #ifdef CONFIG_SMP
263 /* Poor default implementations */
264 extern void __devinit smp_generic_give_timebase(void);
265 extern void __devinit smp_generic_take_timebase(void);
266 #endif /* CONFIG_SMP */
269 /* Functions to produce codes on the leds.
270 * The SRC code should be unique for the message category and should
271 * be limited to the lower 24 bits (the upper 8 are set by these funcs),
272 * and (for boot & dump) should be sorted numerically in the order
273 * the events occur.
275 /* Print a boot progress message. */
276 void ppc64_boot_msg(unsigned int src, const char *msg);
277 /* Print a termination message (print only -- does not stop the kernel) */
278 void ppc64_terminate_msg(unsigned int src, const char *msg);
280 static inline void log_error(char *buf, unsigned int err_type, int fatal)
282 if (ppc_md.log_error)
283 ppc_md.log_error(buf, err_type, fatal);
286 #endif /* __KERNEL__ */
287 #endif /* _ASM_POWERPC_MACHDEP_H */