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