clean
[linux-2.4.21-pre4.git] / include / asm-ppc / machdep.h
1 /*
2  * BK Id: SCCS/s.machdep.h 1.48 10/16/02 10:15:45 paulus
3  */
4 #ifdef __KERNEL__
5 #ifndef _PPC_MACHDEP_H
6 #define _PPC_MACHDEP_H
7
8 #include <linux/config.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_cannonicalize)(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         long            (*time_init)(void); /* Optional, may be NULL */
43         int             (*set_rtc_time)(unsigned long nowtime);
44         unsigned long   (*get_rtc_time)(void);
45         void            (*calibrate_decr)(void);
46         void            (*heartbeat)(void);
47
48         unsigned long   (*find_end_of_memory)(void);
49         void            (*setup_io_mappings)(void);
50
51         void            (*early_serial_map)(void);
52         void            (*progress)(char *, unsigned short);
53
54         unsigned char   (*nvram_read_val)(int addr);
55         void            (*nvram_write_val)(int addr, unsigned char val);
56
57         /* Called from prepare_namespace() */
58         void            (*discover_root)(void);
59
60         /* Tons of keyboard stuff. */
61         int             (*kbd_setkeycode)(unsigned int scancode,
62                                 unsigned int keycode);
63         int             (*kbd_getkeycode)(unsigned int scancode);
64         int             (*kbd_translate)(unsigned char scancode,
65                                 unsigned char *keycode,
66                                 char raw_mode);
67         char            (*kbd_unexpected_up)(unsigned char keycode);
68         void            (*kbd_leds)(unsigned char leds);
69         void            (*kbd_init_hw)(void);
70         unsigned char   *ppc_kbd_sysrq_xlate;
71
72         /*
73          * optional PCI "hooks"
74          */
75
76         /* Called after scanning the bus, before allocating resources */
77         void (*pcibios_fixup)(void);
78
79         /* Called after PPC generic resource fixup to perform
80            machine specific fixups */
81         void (*pcibios_fixup_resources)(struct pci_dev *);
82
83         /* Called for each PCI bus in the system when it's probed */
84         void (*pcibios_fixup_bus)(struct pci_bus *);
85
86         /* Called when pci_enable_device() is called (initial=0) or
87          * when a device with no assigned resource is found (initial=1).
88          * Returns 0 to allow assignment/enabling of the device. */
89         int  (*pcibios_enable_device_hook)(struct pci_dev *, int initial);
90
91         /* For interrupt routing */
92         unsigned char (*pci_swizzle)(struct pci_dev *, unsigned char *);
93         int (*pci_map_irq)(struct pci_dev *, unsigned char, unsigned char);
94
95         /* Called in indirect_* to avoid touching devices */
96         int (*pci_exclude_device)(unsigned char, unsigned char);
97
98         /* Called at then very end of pcibios_init() */
99         void (*pcibios_after_init)(void);
100
101         /* this is for modules, since _machine can be a define -- Cort */
102         int ppc_machine;
103
104         /* Motherboard/chipset features. This is a kind of general purpose
105          * hook used to control some machine specific features (like reset
106          * lines, chip power control, etc...).
107          */
108         int (*feature_call)(unsigned int feature, ...);
109
110 #ifdef CONFIG_SMP
111         /* functions for dealing with other cpus */
112         struct smp_ops_t *smp_ops;
113 #endif /* CONFIG_SMP */
114 };
115
116 extern struct machdep_calls ppc_md;
117 extern char cmd_line[];
118
119 extern void setup_pci_ptrs(void);
120
121 /*
122  * Power macintoshes have either a CUDA or a PMU controlling
123  * system reset, power, NVRAM, RTC.
124  */
125 typedef enum sys_ctrler_kind {
126         SYS_CTRLER_UNKNOWN = 0,
127         SYS_CTRLER_CUDA = 1,
128         SYS_CTRLER_PMU = 2,
129 } sys_ctrler_t;
130
131 extern sys_ctrler_t sys_ctrler;
132
133 #ifdef CONFIG_SMP
134 struct smp_ops_t {
135         void  (*message_pass)(int target, int msg, unsigned long data, int wait);
136         int   (*probe)(void);
137         void  (*kick_cpu)(int nr);
138         void  (*setup_cpu)(int nr);
139 };
140 #endif /* CONFIG_SMP */
141
142 #endif /* _PPC_MACHDEP_H */
143 #endif /* __KERNEL__ */