Merge /spare/repo/linux-2.6/
[sfrench/cifs-2.6.git] / include / asm-ppc64 / machdep.h
1 #ifdef __KERNEL__
2 #ifndef _PPC64_MACHDEP_H
3 #define _PPC64_MACHDEP_H
4
5 /*
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version
9  * 2 of the License, or (at your option) any later version.
10  */
11
12 #include <linux/config.h>
13 #include <linux/seq_file.h>
14 #include <linux/init.h>
15 #include <linux/dma-mapping.h>
16
17 #include <asm/setup.h>
18
19 struct pt_regs;
20 struct pci_bus; 
21 struct device_node;
22 struct iommu_table;
23 struct rtc_time;
24 struct file;
25
26 #ifdef CONFIG_SMP
27 struct smp_ops_t {
28         void  (*message_pass)(int target, int msg);
29         int   (*probe)(void);
30         void  (*kick_cpu)(int nr);
31         void  (*setup_cpu)(int nr);
32         void  (*take_timebase)(void);
33         void  (*give_timebase)(void);
34         int   (*cpu_enable)(unsigned int nr);
35         int   (*cpu_disable)(void);
36         void  (*cpu_die)(unsigned int nr);
37         int   (*cpu_bootable)(unsigned int nr);
38 };
39 #endif
40
41 struct machdep_calls {
42         void            (*hpte_invalidate)(unsigned long slot,
43                                            unsigned long va,
44                                            int large,
45                                            int local);
46         long            (*hpte_updatepp)(unsigned long slot, 
47                                          unsigned long newpp, 
48                                          unsigned long va,
49                                          int large,
50                                          int local);
51         void            (*hpte_updateboltedpp)(unsigned long newpp, 
52                                                unsigned long ea);
53         long            (*hpte_insert)(unsigned long hpte_group,
54                                        unsigned long va,
55                                        unsigned long prpn,
56                                        int secondary, 
57                                        unsigned long hpteflags, 
58                                        int bolted,
59                                        int large);
60         long            (*hpte_remove)(unsigned long hpte_group);
61         void            (*flush_hash_range)(unsigned long context,
62                                             unsigned long number,
63                                             int local);
64         /* special for kexec, to be called in real mode, linar mapping is
65          * destroyed as well */
66         void            (*hpte_clear_all)(void);
67
68         void            (*tce_build)(struct iommu_table * tbl,
69                                      long index,
70                                      long npages,
71                                      unsigned long uaddr,
72                                      enum dma_data_direction direction);
73         void            (*tce_free)(struct iommu_table *tbl,
74                                     long index,
75                                     long npages);
76         void            (*tce_flush)(struct iommu_table *tbl);
77         void            (*iommu_dev_setup)(struct pci_dev *dev);
78         void            (*iommu_bus_setup)(struct pci_bus *bus);
79         void            (*irq_bus_setup)(struct pci_bus *bus);
80
81         int             (*probe)(int platform);
82         void            (*setup_arch)(void);
83         void            (*init_early)(void);
84         /* Optional, may be NULL. */
85         void            (*get_cpuinfo)(struct seq_file *m);
86
87         void            (*init_IRQ)(void);
88         int             (*get_irq)(struct pt_regs *);
89         void            (*cpu_irq_down)(void);
90
91         /* PCI stuff */
92         void            (*pcibios_fixup)(void);
93
94         void            (*restart)(char *cmd);
95         void            (*power_off)(void);
96         void            (*halt)(void);
97         void            (*panic)(char *str);
98         void            (*cpu_die)(void);
99
100         int             (*set_rtc_time)(struct rtc_time *);
101         void            (*get_rtc_time)(struct rtc_time *);
102         void            (*get_boot_time)(struct rtc_time *);
103
104         void            (*calibrate_decr)(void);
105
106         void            (*progress)(char *, unsigned short);
107
108         /* Debug interface.  Low level I/O to some terminal device */
109         void            (*udbg_putc)(unsigned char c);
110         unsigned char   (*udbg_getc)(void);
111         int             (*udbg_getc_poll)(void);
112
113         /* Interface for platform error logging */
114         void            (*log_error)(char *buf, unsigned int err_type, int fatal);
115
116         ssize_t         (*nvram_write)(char *buf, size_t count, loff_t *index);
117         ssize_t         (*nvram_read)(char *buf, size_t count, loff_t *index);  
118         ssize_t         (*nvram_size)(void);            
119         int             (*nvram_sync)(void);
120
121         /* Exception handlers */
122         void            (*system_reset_exception)(struct pt_regs *regs);
123         int             (*machine_check_exception)(struct pt_regs *regs);
124
125         /* Motherboard/chipset features. This is a kind of general purpose
126          * hook used to control some machine specific features (like reset
127          * lines, chip power control, etc...).
128          */
129         long            (*feature_call)(unsigned int feature, ...);
130
131         /* Check availability of legacy devices like i8042 */
132         int             (*check_legacy_ioport)(unsigned int baseport);
133
134         /* Get legacy PCI/IDE interrupt mapping */ 
135         int             (*pci_get_legacy_ide_irq)(struct pci_dev *dev, int channel);
136         
137         /* Get access protection for /dev/mem */
138         pgprot_t        (*phys_mem_access_prot)(struct file *file,
139                                                 unsigned long offset,
140                                                 unsigned long size,
141                                                 pgprot_t vma_prot);
142
143 };
144
145 extern struct machdep_calls ppc_md;
146 extern char cmd_line[COMMAND_LINE_SIZE];
147
148 #ifdef CONFIG_PPC_PMAC
149 /*
150  * Power macintoshes have either a CUDA, PMU or SMU controlling
151  * system reset, power, NVRAM, RTC.
152  */
153 typedef enum sys_ctrler_kind {
154         SYS_CTRLER_UNKNOWN = 0,
155         SYS_CTRLER_CUDA = 1,
156         SYS_CTRLER_PMU = 2,
157         SYS_CTRLER_SMU = 3,
158 } sys_ctrler_t;
159 extern sys_ctrler_t sys_ctrler;
160
161 #endif /* CONFIG_PPC_PMAC */
162
163
164
165 /* Functions to produce codes on the leds.
166  * The SRC code should be unique for the message category and should
167  * be limited to the lower 24 bits (the upper 8 are set by these funcs),
168  * and (for boot & dump) should be sorted numerically in the order
169  * the events occur.
170  */
171 /* Print a boot progress message. */
172 void ppc64_boot_msg(unsigned int src, const char *msg);
173 /* Print a termination message (print only -- does not stop the kernel) */
174 void ppc64_terminate_msg(unsigned int src, const char *msg);
175 /* Print something that needs attention (device error, etc) */
176 void ppc64_attention_msg(unsigned int src, const char *msg);
177 /* Print a dump progress message. */
178 void ppc64_dump_msg(unsigned int src, const char *msg);
179
180 static inline void log_error(char *buf, unsigned int err_type, int fatal)
181 {
182         if (ppc_md.log_error)
183                 ppc_md.log_error(buf, err_type, fatal);
184 }
185
186 #endif /* _PPC64_MACHDEP_H */
187 #endif /* __KERNEL__ */