Linux-2.6.12-rc2
[linux-2.6/next.git] / include / asm-ppc / machdep.h
blobb78d40870c951ac1a41c7133ac3edcc0acad1532
1 #ifdef __KERNEL__
2 #ifndef _PPC_MACHDEP_H
3 #define _PPC_MACHDEP_H
5 #include <linux/config.h>
6 #include <linux/init.h>
8 #include <asm/setup.h>
9 #include <asm/page.h>
11 #ifdef CONFIG_APUS
12 #include <asm-m68k/machdep.h>
13 #endif
15 struct pt_regs;
16 struct pci_bus;
17 struct pci_dev;
18 struct seq_file;
19 struct file;
21 /* We export this macro for external modules like Alsa to know if
22 * ppc_md.feature_call is implemented or not
24 #define CONFIG_PPC_HAS_FEATURE_CALLS
26 struct machdep_calls {
27 void (*setup_arch)(void);
28 /* Optional, may be NULL. */
29 int (*show_cpuinfo)(struct seq_file *m);
30 int (*show_percpuinfo)(struct seq_file *m, int i);
31 /* Optional, may be NULL. */
32 unsigned int (*irq_canonicalize)(unsigned int irq);
33 void (*init_IRQ)(void);
34 int (*get_irq)(struct pt_regs *);
36 /* A general init function, called by ppc_init in init/main.c.
37 May be NULL. */
38 void (*init)(void);
40 void (*restart)(char *cmd);
41 void (*power_off)(void);
42 void (*halt)(void);
44 void (*idle)(void);
45 void (*power_save)(void);
47 long (*time_init)(void); /* Optional, may be NULL */
48 int (*set_rtc_time)(unsigned long nowtime);
49 unsigned long (*get_rtc_time)(void);
50 unsigned char (*rtc_read_val)(int addr);
51 void (*rtc_write_val)(int addr, unsigned char val);
52 void (*calibrate_decr)(void);
54 void (*heartbeat)(void);
55 unsigned long heartbeat_reset;
56 unsigned long heartbeat_count;
58 unsigned long (*find_end_of_memory)(void);
59 void (*setup_io_mappings)(void);
61 void (*early_serial_map)(void);
62 void (*progress)(char *, unsigned short);
63 void (*kgdb_map_scc)(void);
65 unsigned char (*nvram_read_val)(int addr);
66 void (*nvram_write_val)(int addr, unsigned char val);
67 void (*nvram_sync)(void);
70 * optional PCI "hooks"
73 /* Called after scanning the bus, before allocating resources */
74 void (*pcibios_fixup)(void);
76 /* Called after PPC generic resource fixup to perform
77 machine specific fixups */
78 void (*pcibios_fixup_resources)(struct pci_dev *);
80 /* Called for each PCI bus in the system when it's probed */
81 void (*pcibios_fixup_bus)(struct pci_bus *);
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);
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);
92 /* Called in indirect_* to avoid touching devices */
93 int (*pci_exclude_device)(unsigned char, unsigned char);
95 /* Called at then very end of pcibios_init() */
96 void (*pcibios_after_init)(void);
98 /* Get access protection for /dev/mem */
99 pgprot_t (*phys_mem_access_prot)(struct file *file,
100 unsigned long offset,
101 unsigned long size,
102 pgprot_t vma_prot);
104 /* this is for modules, since _machine can be a define -- Cort */
105 int ppc_machine;
107 /* Motherboard/chipset features. This is a kind of general purpose
108 * hook used to control some machine specific features (like reset
109 * lines, chip power control, etc...).
111 long (*feature_call)(unsigned int feature, ...);
113 #ifdef CONFIG_SMP
114 /* functions for dealing with other cpus */
115 struct smp_ops_t *smp_ops;
116 #endif /* CONFIG_SMP */
119 extern struct machdep_calls ppc_md;
120 extern char cmd_line[COMMAND_LINE_SIZE];
122 extern void setup_pci_ptrs(void);
125 * Power macintoshes have either a CUDA or a PMU controlling
126 * system reset, power, NVRAM, RTC.
128 typedef enum sys_ctrler_kind {
129 SYS_CTRLER_UNKNOWN = 0,
130 SYS_CTRLER_CUDA = 1,
131 SYS_CTRLER_PMU = 2,
132 SYS_CTRLER_SMU = 3,
133 } sys_ctrler_t;
135 extern sys_ctrler_t sys_ctrler;
137 #ifdef CONFIG_SMP
138 struct smp_ops_t {
139 void (*message_pass)(int target, int msg, unsigned long data, int wait);
140 int (*probe)(void);
141 void (*kick_cpu)(int nr);
142 void (*setup_cpu)(int nr);
143 void (*space_timers)(int nr);
144 void (*take_timebase)(void);
145 void (*give_timebase)(void);
148 /* Poor default implementations */
149 extern void __devinit smp_generic_give_timebase(void);
150 extern void __devinit smp_generic_take_timebase(void);
151 #endif /* CONFIG_SMP */
153 #endif /* _PPC_MACHDEP_H */
154 #endif /* __KERNEL__ */