more changes on original files
[linux-2.4.git] / asm-ppc / machdep.h
1 #ifdef __KERNEL__
2 #ifndef _PPC_MACHDEP_H
3 #define _PPC_MACHDEP_H
4
5 #include <linux/config.h>
6
7 #ifdef CONFIG_APUS
8 #include <asm-m68k/machdep.h>
9 #endif
10
11 struct pt_regs;
12 struct pci_bus;
13 struct pci_dev;
14 struct seq_file;
15
16 /* We export this macro for external modules like Alsa to know if
17  * ppc_md.feature_call is implemented or not
18  */
19 #define CONFIG_PPC_HAS_FEATURE_CALLS
20
21 struct machdep_calls {
22         void            (*setup_arch)(void);
23         /* Optional, may be NULL. */
24         int             (*show_cpuinfo)(struct seq_file *m);
25         int             (*show_percpuinfo)(struct seq_file *m, int i);
26         /* Optional, may be NULL. */
27         unsigned int    (*irq_cannonicalize)(unsigned int irq);
28         void            (*init_IRQ)(void);
29         int             (*get_irq)(struct pt_regs *);
30
31         /* A general init function, called by ppc_init in init/main.c.
32            May be NULL. */
33         void            (*init)(void);
34
35         void            (*restart)(char *cmd);
36         void            (*power_off)(void);
37         void            (*halt)(void);
38
39         long            (*time_init)(void); /* Optional, may be NULL */
40         int             (*set_rtc_time)(unsigned long nowtime);
41         unsigned long   (*get_rtc_time)(void);
42         void            (*calibrate_decr)(void);
43         void            (*heartbeat)(void);
44
45         unsigned long   (*find_end_of_memory)(void);
46         void            (*setup_io_mappings)(void);
47
48         void            (*early_serial_map)(void);
49         void            (*progress)(char *, unsigned short);
50
51         unsigned char   (*nvram_read_val)(int addr);
52         void            (*nvram_write_val)(int addr, unsigned char val);
53
54         /* Called from prepare_namespace() */
55         void            (*discover_root)(void);
56
57         /* Tons of keyboard stuff. */
58         int             (*kbd_setkeycode)(unsigned int scancode,
59                                 unsigned int keycode);
60         int             (*kbd_getkeycode)(unsigned int scancode);
61         int             (*kbd_translate)(unsigned char scancode,
62                                 unsigned char *keycode,
63                                 char raw_mode);
64         char            (*kbd_unexpected_up)(unsigned char keycode);
65         void            (*kbd_leds)(unsigned char leds);
66         void            (*kbd_init_hw)(void);
67         unsigned char   *ppc_kbd_sysrq_xlate;
68
69         /*
70          * optional PCI "hooks"
71          */
72
73         /* Called after scanning the bus, before allocating resources */
74         void (*pcibios_fixup)(void);
75
76         /* Called after PPC generic resource fixup to perform
77            machine specific fixups */
78         void (*pcibios_fixup_resources)(struct pci_dev *);
79
80         /* Called for each PCI bus in the system when it's probed */
81         void (*pcibios_fixup_bus)(struct pci_bus *);
82
83         /* Called when pci_enable_device() is called (initial=0) or
84          * when a device with no assigned resource is found (initial=1).
85          * Returns 0 to allow assignment/enabling of the device. */
86         int  (*pcibios_enable_device_hook)(struct pci_dev *, int initial);
87
88         /* For interrupt routing */
89         unsigned char (*pci_swizzle)(struct pci_dev *, unsigned char *);
90         int (*pci_map_irq)(struct pci_dev *, unsigned char, unsigned char);
91
92         /* Called in indirect_* to avoid touching devices */
93         int (*pci_exclude_device)(unsigned char, unsigned char);
94
95         /* Called at then very end of pcibios_init() */
96         void (*pcibios_after_init)(void);
97
98         /* this is for modules, since _machine can be a define -- Cort */
99         int ppc_machine;
100
101         /* Motherboard/chipset features. This is a kind of general purpose
102          * hook used to control some machine specific features (like reset
103          * lines, chip power control, etc...).
104          */
105         int (*feature_call)(unsigned int feature, ...);
106
107         /* Hook for board-specific info passed by the bootloader */
108         void (*board_info)(void *bdinfo, int bdinfo_size);
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__ */