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