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