VServer 1.9.2 (patch-2.6.8.1-vs1.9.2.diff)
[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            (*progress)(char *, unsigned short);
60         void            (*kgdb_map_scc)(void);
61
62         unsigned char   (*nvram_read_val)(int addr);
63         void            (*nvram_write_val)(int addr, unsigned char val);
64         void            (*nvram_sync)(void);
65
66         /*
67          * optional PCI "hooks"
68          */
69
70         /* Called after scanning the bus, before allocating resources */
71         void (*pcibios_fixup)(void);
72
73         /* Called after PPC generic resource fixup to perform
74            machine specific fixups */
75         void (*pcibios_fixup_resources)(struct pci_dev *);
76
77         /* Called for each PCI bus in the system when it's probed */
78         void (*pcibios_fixup_bus)(struct pci_bus *);
79
80         /* Called when pci_enable_device() is called (initial=0) or
81          * when a device with no assigned resource is found (initial=1).
82          * Returns 0 to allow assignment/enabling of the device. */
83         int  (*pcibios_enable_device_hook)(struct pci_dev *, int initial);
84
85         /* For interrupt routing */
86         unsigned char (*pci_swizzle)(struct pci_dev *, unsigned char *);
87         int (*pci_map_irq)(struct pci_dev *, unsigned char, unsigned char);
88
89         /* Called in indirect_* to avoid touching devices */
90         int (*pci_exclude_device)(unsigned char, unsigned char);
91
92         /* Called at then very end of pcibios_init() */
93         void (*pcibios_after_init)(void);
94
95         /* this is for modules, since _machine can be a define -- Cort */
96         int ppc_machine;
97
98         /* Motherboard/chipset features. This is a kind of general purpose
99          * hook used to control some machine specific features (like reset
100          * lines, chip power control, etc...).
101          */
102         long (*feature_call)(unsigned int feature, ...);
103
104 #ifdef CONFIG_SMP
105         /* functions for dealing with other cpus */
106         struct smp_ops_t *smp_ops;
107 #endif /* CONFIG_SMP */
108 };
109
110 extern struct machdep_calls ppc_md;
111 extern char cmd_line[COMMAND_LINE_SIZE];
112
113 extern void setup_pci_ptrs(void);
114
115 /*
116  * Power macintoshes have either a CUDA or a PMU controlling
117  * system reset, power, NVRAM, RTC.
118  */
119 typedef enum sys_ctrler_kind {
120         SYS_CTRLER_UNKNOWN = 0,
121         SYS_CTRLER_CUDA = 1,
122         SYS_CTRLER_PMU = 2,
123 } sys_ctrler_t;
124
125 extern sys_ctrler_t sys_ctrler;
126
127 #ifdef CONFIG_SMP
128 struct smp_ops_t {
129         void  (*message_pass)(int target, int msg, unsigned long data, int wait);
130         int   (*probe)(void);
131         void  (*kick_cpu)(int nr);
132         void  (*setup_cpu)(int nr);
133         void  (*space_timers)(int nr);
134         void  (*take_timebase)(void);
135         void  (*give_timebase)(void);
136 };
137
138 /* Poor default implementations */
139 extern void __devinit smp_generic_give_timebase(void);
140 extern void __devinit smp_generic_take_timebase(void);
141 #endif /* CONFIG_SMP */
142
143 #endif /* _PPC_MACHDEP_H */
144 #endif /* __KERNEL__ */