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