v2.6.22.24-op1
[linux-2.6.22.y-op.git] / include / asm-ppc / machdep.h
blob293a444a1d7724d057528655336f6e96a2a943cd
1 #ifdef __KERNEL__
2 #ifndef _PPC_MACHDEP_H
3 #define _PPC_MACHDEP_H
5 #include <linux/init.h>
6 #include <linux/kexec.h>
8 #include <asm/setup.h>
9 #include <asm/page.h>
11 #ifdef CONFIG_APUS
12 #include <asm-m68k/machdep.h>
13 #endif
15 struct pt_regs;
16 struct pci_bus;
17 struct pci_dev;
18 struct seq_file;
19 struct file;
22 * This is for compatibility with ARCH=powerpc.
24 #define machine_is(x) __MACHINE_IS_##x
25 #define __MACHINE_IS_powermac 0
26 #define __MACHINE_IS_chrp 0
27 #ifdef CONFIG_PPC_PREP
28 #define __MACHINE_IS_prep 1
29 #else
30 #define __MACHINE_IS_prep 0
31 #endif
33 /* We export this macro for external modules like Alsa to know if
34 * ppc_md.feature_call is implemented or not
36 #define CONFIG_PPC_HAS_FEATURE_CALLS
38 struct machdep_calls {
39 void (*setup_arch)(void);
40 /* Optional, may be NULL. */
41 int (*show_cpuinfo)(struct seq_file *m);
42 int (*show_percpuinfo)(struct seq_file *m, int i);
43 /* Optional, may be NULL. */
44 unsigned int (*irq_canonicalize)(unsigned int irq);
45 void (*init_IRQ)(void);
46 int (*get_irq)(void);
48 /* A general init function, called by ppc_init in init/main.c.
49 May be NULL. DEPRECATED ! */
50 void (*init)(void);
51 /* For compatibility with merged platforms */
52 void (*init_early)(void);
54 void (*restart)(char *cmd);
55 void (*power_off)(void);
56 void (*halt)(void);
58 void (*idle_loop)(void);
59 void (*power_save)(void);
61 long (*time_init)(void); /* Optional, may be NULL */
62 int (*set_rtc_time)(unsigned long nowtime);
63 unsigned long (*get_rtc_time)(void);
64 unsigned char (*rtc_read_val)(int addr);
65 void (*rtc_write_val)(int addr, unsigned char val);
66 void (*calibrate_decr)(void);
68 void (*heartbeat)(void);
69 unsigned long heartbeat_reset;
70 unsigned long heartbeat_count;
72 unsigned long (*find_end_of_memory)(void);
73 void (*setup_io_mappings)(void);
75 void (*early_serial_map)(void);
76 void (*progress)(char *, unsigned short);
77 void (*kgdb_map_scc)(void);
79 unsigned char (*nvram_read_val)(int addr);
80 void (*nvram_write_val)(int addr, unsigned char val);
81 void (*nvram_sync)(void);
84 * optional PCI "hooks"
87 /* Called after scanning the bus, before allocating resources */
88 void (*pcibios_fixup)(void);
90 /* Called after PPC generic resource fixup to perform
91 machine specific fixups */
92 void (*pcibios_fixup_resources)(struct pci_dev *);
94 /* Called for each PCI bus in the system when it's probed */
95 void (*pcibios_fixup_bus)(struct pci_bus *);
97 /* Called when pci_enable_device() is called (initial=0) or
98 * when a device with no assigned resource is found (initial=1).
99 * Returns 0 to allow assignment/enabling of the device. */
100 int (*pcibios_enable_device_hook)(struct pci_dev *, int initial);
102 /* For interrupt routing */
103 unsigned char (*pci_swizzle)(struct pci_dev *, unsigned char *);
104 int (*pci_map_irq)(struct pci_dev *, unsigned char, unsigned char);
106 /* Called in indirect_* to avoid touching devices */
107 int (*pci_exclude_device)(unsigned char, unsigned char);
109 /* Called at then very end of pcibios_init() */
110 void (*pcibios_after_init)(void);
112 /* Get access protection for /dev/mem */
113 pgprot_t (*phys_mem_access_prot)(struct file *file,
114 unsigned long pfn,
115 unsigned long size,
116 pgprot_t vma_prot);
118 /* Motherboard/chipset features. This is a kind of general purpose
119 * hook used to control some machine specific features (like reset
120 * lines, chip power control, etc...).
122 long (*feature_call)(unsigned int feature, ...);
124 #ifdef CONFIG_SMP
125 /* functions for dealing with other cpus */
126 struct smp_ops_t *smp_ops;
127 #endif /* CONFIG_SMP */
129 #ifdef CONFIG_KEXEC
130 /* Called to shutdown machine specific hardware not already controlled
131 * by other drivers.
132 * XXX Should we move this one out of kexec scope?
134 void (*machine_shutdown)(void);
136 /* Called to do the minimal shutdown needed to run a kexec'd kernel
137 * to run successfully.
138 * XXX Should we move this one out of kexec scope?
140 void (*machine_crash_shutdown)(void);
142 /* Called to do what every setup is needed on image and the
143 * reboot code buffer. Returns 0 on success.
144 * Provide your own (maybe dummy) implementation if your platform
145 * claims to support kexec.
147 int (*machine_kexec_prepare)(struct kimage *image);
149 /* Called to handle any machine specific cleanup on image */
150 void (*machine_kexec_cleanup)(struct kimage *image);
152 /* Called to perform the _real_ kexec.
153 * Do NOT allocate memory or fail here. We are past the point of
154 * no return.
156 void (*machine_kexec)(struct kimage *image);
157 #endif /* CONFIG_KEXEC */
160 extern struct machdep_calls ppc_md;
161 extern char cmd_line[COMMAND_LINE_SIZE];
163 extern void setup_pci_ptrs(void);
165 #ifdef CONFIG_SMP
166 struct smp_ops_t {
167 void (*message_pass)(int target, int msg);
168 int (*probe)(void);
169 void (*kick_cpu)(int nr);
170 void (*setup_cpu)(int nr);
171 void (*space_timers)(int nr);
172 void (*take_timebase)(void);
173 void (*give_timebase)(void);
176 /* Poor default implementations */
177 extern void __devinit smp_generic_give_timebase(void);
178 extern void __devinit smp_generic_take_timebase(void);
179 #endif /* CONFIG_SMP */
181 #endif /* _PPC_MACHDEP_H */
182 #endif /* __KERNEL__ */