vserver 1.9.5.x5
[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
8 #include <asm/setup.h>
9
10 #ifdef CONFIG_APUS
11 #include <asm-m68k/machdep.h>
12 #endif
13
14 struct pt_regs;
15 struct pci_bus; 
16 struct pci_dev;
17 struct seq_file;
18
19 /* We export this macro for external modules like Alsa to know if
20  * ppc_md.feature_call is implemented or not
21  */
22 #define CONFIG_PPC_HAS_FEATURE_CALLS
23
24 struct machdep_calls {
25         void            (*setup_arch)(void);
26         /* Optional, may be NULL. */
27         int             (*show_cpuinfo)(struct seq_file *m);
28         int             (*show_percpuinfo)(struct seq_file *m, int i);
29         /* Optional, may be NULL. */
30         unsigned int    (*irq_canonicalize)(unsigned int irq);
31         void            (*init_IRQ)(void);
32         int             (*get_irq)(struct pt_regs *);
33         
34         /* A general init function, called by ppc_init in init/main.c.
35            May be NULL. */
36         void            (*init)(void);
37
38         void            (*restart)(char *cmd);
39         void            (*power_off)(void);
40         void            (*halt)(void);
41
42         void            (*idle)(void);
43         void            (*power_save)(void);
44
45         long            (*time_init)(void); /* Optional, may be NULL */
46         int             (*set_rtc_time)(unsigned long nowtime);
47         unsigned long   (*get_rtc_time)(void);
48         unsigned char   (*rtc_read_val)(int addr);
49         void            (*rtc_write_val)(int addr, unsigned char val);
50         void            (*calibrate_decr)(void);
51
52         void            (*heartbeat)(void);
53         unsigned long   heartbeat_reset;
54         unsigned long   heartbeat_count;
55
56         unsigned long   (*find_end_of_memory)(void);
57         void            (*setup_io_mappings)(void);
58
59         void            (*early_serial_map)(void);
60         void            (*progress)(char *, unsigned short);
61         void            (*kgdb_map_scc)(void);
62
63         unsigned char   (*nvram_read_val)(int addr);
64         void            (*nvram_write_val)(int addr, unsigned char val);
65         void            (*nvram_sync)(void);
66
67         /*
68          * optional PCI "hooks"
69          */
70
71         /* Called after scanning the bus, before allocating resources */
72         void (*pcibios_fixup)(void);
73
74         /* Called after PPC generic resource fixup to perform
75            machine specific fixups */
76         void (*pcibios_fixup_resources)(struct pci_dev *);
77
78         /* Called for each PCI bus in the system when it's probed */
79         void (*pcibios_fixup_bus)(struct pci_bus *);
80
81         /* Called when pci_enable_device() is called (initial=0) or
82          * when a device with no assigned resource is found (initial=1).
83          * Returns 0 to allow assignment/enabling of the device. */
84         int  (*pcibios_enable_device_hook)(struct pci_dev *, int initial);
85
86         /* For interrupt routing */
87         unsigned char (*pci_swizzle)(struct pci_dev *, unsigned char *);
88         int (*pci_map_irq)(struct pci_dev *, unsigned char, unsigned char);
89
90         /* Called in indirect_* to avoid touching devices */
91         int (*pci_exclude_device)(unsigned char, unsigned char);
92
93         /* Called at then very end of pcibios_init() */
94         void (*pcibios_after_init)(void);
95
96         /* this is for modules, since _machine can be a define -- Cort */
97         int ppc_machine;
98
99         /* Motherboard/chipset features. This is a kind of general purpose
100          * hook used to control some machine specific features (like reset
101          * lines, chip power control, etc...).
102          */
103         long (*feature_call)(unsigned int feature, ...);
104
105 #ifdef CONFIG_SMP
106         /* functions for dealing with other cpus */
107         struct smp_ops_t *smp_ops;
108 #endif /* CONFIG_SMP */
109 };
110
111 extern struct machdep_calls ppc_md;
112 extern char cmd_line[COMMAND_LINE_SIZE];
113
114 extern void setup_pci_ptrs(void);
115
116 /*
117  * Power macintoshes have either a CUDA or a PMU controlling
118  * system reset, power, NVRAM, RTC.
119  */
120 typedef enum sys_ctrler_kind {
121         SYS_CTRLER_UNKNOWN = 0,
122         SYS_CTRLER_CUDA = 1,
123         SYS_CTRLER_PMU = 2,
124 } sys_ctrler_t;
125
126 extern sys_ctrler_t sys_ctrler;
127
128 #ifdef CONFIG_SMP
129 struct smp_ops_t {
130         void  (*message_pass)(int target, int msg, unsigned long data, int wait);
131         int   (*probe)(void);
132         void  (*kick_cpu)(int nr);
133         void  (*setup_cpu)(int nr);
134         void  (*space_timers)(int nr);
135         void  (*take_timebase)(void);
136         void  (*give_timebase)(void);
137 };
138
139 /* Poor default implementations */
140 extern void __devinit smp_generic_give_timebase(void);
141 extern void __devinit smp_generic_take_timebase(void);
142 #endif /* CONFIG_SMP */
143
144 #endif /* _PPC_MACHDEP_H */
145 #endif /* __KERNEL__ */