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