]>
Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | #ifdef __KERNEL__ |
2 | #ifndef _PPC_MACHDEP_H | |
3 | #define _PPC_MACHDEP_H | |
4 | ||
1da177e4 | 5 | #include <linux/init.h> |
70765aa4 | 6 | #include <linux/kexec.h> |
1da177e4 LT |
7 | |
8 | #include <asm/setup.h> | |
9 | #include <asm/page.h> | |
10 | ||
11 | #ifdef CONFIG_APUS | |
12 | #include <asm-m68k/machdep.h> | |
13 | #endif | |
14 | ||
15 | struct pt_regs; | |
16 | struct pci_bus; | |
17 | struct pci_dev; | |
18 | struct seq_file; | |
19 | struct file; | |
20 | ||
e8222502 BH |
21 | /* |
22 | * This is for compatibility with ARCH=powerpc. | |
23 | */ | |
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 | |
32 | ||
1da177e4 LT |
33 | /* We export this macro for external modules like Alsa to know if |
34 | * ppc_md.feature_call is implemented or not | |
35 | */ | |
36 | #define CONFIG_PPC_HAS_FEATURE_CALLS | |
37 | ||
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)(struct pt_regs *); | |
47 | ||
48 | /* A general init function, called by ppc_init in init/main.c. | |
51d3082f | 49 | May be NULL. DEPRECATED ! */ |
1da177e4 | 50 | void (*init)(void); |
51d3082f BH |
51 | /* For compatibility with merged platforms */ |
52 | void (*init_early)(void); | |
1da177e4 LT |
53 | |
54 | void (*restart)(char *cmd); | |
55 | void (*power_off)(void); | |
56 | void (*halt)(void); | |
57 | ||
a0652fc9 | 58 | void (*idle_loop)(void); |
1da177e4 LT |
59 | void (*power_save)(void); |
60 | ||
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); | |
67 | ||
68 | void (*heartbeat)(void); | |
69 | unsigned long heartbeat_reset; | |
70 | unsigned long heartbeat_count; | |
71 | ||
72 | unsigned long (*find_end_of_memory)(void); | |
73 | void (*setup_io_mappings)(void); | |
74 | ||
75 | void (*early_serial_map)(void); | |
76 | void (*progress)(char *, unsigned short); | |
77 | void (*kgdb_map_scc)(void); | |
78 | ||
79 | unsigned char (*nvram_read_val)(int addr); | |
80 | void (*nvram_write_val)(int addr, unsigned char val); | |
81 | void (*nvram_sync)(void); | |
82 | ||
83 | /* | |
84 | * optional PCI "hooks" | |
85 | */ | |
86 | ||
87 | /* Called after scanning the bus, before allocating resources */ | |
88 | void (*pcibios_fixup)(void); | |
89 | ||
90 | /* Called after PPC generic resource fixup to perform | |
91 | machine specific fixups */ | |
92 | void (*pcibios_fixup_resources)(struct pci_dev *); | |
93 | ||
94 | /* Called for each PCI bus in the system when it's probed */ | |
95 | void (*pcibios_fixup_bus)(struct pci_bus *); | |
96 | ||
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); | |
101 | ||
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); | |
105 | ||
106 | /* Called in indirect_* to avoid touching devices */ | |
107 | int (*pci_exclude_device)(unsigned char, unsigned char); | |
108 | ||
109 | /* Called at then very end of pcibios_init() */ | |
110 | void (*pcibios_after_init)(void); | |
111 | ||
112 | /* Get access protection for /dev/mem */ | |
113 | pgprot_t (*phys_mem_access_prot)(struct file *file, | |
8b150478 | 114 | unsigned long pfn, |
1da177e4 LT |
115 | unsigned long size, |
116 | pgprot_t vma_prot); | |
117 | ||
1da177e4 LT |
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...). | |
121 | */ | |
122 | long (*feature_call)(unsigned int feature, ...); | |
123 | ||
124 | #ifdef CONFIG_SMP | |
125 | /* functions for dealing with other cpus */ | |
126 | struct smp_ops_t *smp_ops; | |
127 | #endif /* CONFIG_SMP */ | |
70765aa4 EB |
128 | |
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? | |
133 | */ | |
134 | void (*machine_shutdown)(void); | |
135 | ||
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? | |
139 | */ | |
140 | void (*machine_crash_shutdown)(void); | |
141 | ||
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. | |
146 | */ | |
147 | int (*machine_kexec_prepare)(struct kimage *image); | |
148 | ||
149 | /* Called to handle any machine specific cleanup on image */ | |
150 | void (*machine_kexec_cleanup)(struct kimage *image); | |
151 | ||
152 | /* Called to perform the _real_ kexec. | |
153 | * Do NOT allocate memory or fail here. We are past the point of | |
154 | * no return. | |
155 | */ | |
156 | void (*machine_kexec)(struct kimage *image); | |
157 | #endif /* CONFIG_KEXEC */ | |
1da177e4 LT |
158 | }; |
159 | ||
160 | extern struct machdep_calls ppc_md; | |
161 | extern char cmd_line[COMMAND_LINE_SIZE]; | |
162 | ||
163 | extern void setup_pci_ptrs(void); | |
164 | ||
1da177e4 LT |
165 | #ifdef CONFIG_SMP |
166 | struct smp_ops_t { | |
17a6392d | 167 | void (*message_pass)(int target, int msg); |
1da177e4 LT |
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); | |
174 | }; | |
175 | ||
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 */ | |
180 | ||
181 | #endif /* _PPC_MACHDEP_H */ | |
182 | #endif /* __KERNEL__ */ |