5 #include <linux/init.h>
6 #include <linux/kexec.h>
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
26 #define __MACHINE_IS_prep 0
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);
44 /* A general init function, called by ppc_init in init/main.c.
45 May be NULL. DEPRECATED ! */
47 /* For compatibility with merged platforms */
48 void (*init_early)(void);
50 void (*restart)(char *cmd);
51 void (*power_off)(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,
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, ...);
121 /* functions for dealing with other cpus */
122 struct smp_ops_t *smp_ops;
123 #endif /* CONFIG_SMP */
126 /* Called to shutdown machine specific hardware not already controlled
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
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);
163 void (*message_pass)(int target, int msg);
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__ */