vserver 1.9.5.x5
[linux-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
25 #ifdef CONFIG_SMP
26 struct smp_ops_t {
27         void  (*message_pass)(int target, int msg);
28         int   (*probe)(void);
29         void  (*kick_cpu)(int nr);
30         void  (*setup_cpu)(int nr);
31         void  (*take_timebase)(void);
32         void  (*give_timebase)(void);
33         int   (*cpu_disable)(void);
34         void  (*cpu_die)(unsigned int nr);
35 };
36 #endif
37
38 struct machdep_calls {
39         void            (*hpte_invalidate)(unsigned long slot,
40                                            unsigned long va,
41                                            int large,
42                                            int local);
43         long            (*hpte_updatepp)(unsigned long slot, 
44                                          unsigned long newpp, 
45                                          unsigned long va,
46                                          int large,
47                                          int local);
48         void            (*hpte_updateboltedpp)(unsigned long newpp, 
49                                                unsigned long ea);
50         long            (*hpte_insert)(unsigned long hpte_group,
51                                        unsigned long va,
52                                        unsigned long prpn,
53                                        int secondary, 
54                                        unsigned long hpteflags, 
55                                        int bolted,
56                                        int large);
57         long            (*hpte_remove)(unsigned long hpte_group);
58         void            (*flush_hash_range)(unsigned long context,
59                                             unsigned long number,
60                                             int local);
61         /* special for kexec, to be called in real mode, linar mapping is
62          * destroyed as well */
63         void            (*hpte_clear_all)(void);
64
65         void            (*tce_build)(struct iommu_table * tbl,
66                                      long index,
67                                      long npages,
68                                      unsigned long uaddr,
69                                      enum dma_data_direction direction);
70         void            (*tce_free)(struct iommu_table *tbl,
71                                     long index,
72                                     long npages);
73         void            (*tce_flush)(struct iommu_table *tbl);
74         void            (*iommu_dev_setup)(struct pci_dev *dev);
75         void            (*iommu_bus_setup)(struct pci_bus *bus);
76
77         int             (*probe)(int platform);
78         void            (*setup_arch)(void);
79         void            (*init_early)(void);
80         /* Optional, may be NULL. */
81         void            (*get_cpuinfo)(struct seq_file *m);
82
83         void            (*init_IRQ)(void);
84         int             (*get_irq)(struct pt_regs *);
85
86         /* PCI stuff */
87         void            (*pcibios_fixup)(void);
88
89         void            (*restart)(char *cmd);
90         void            (*power_off)(void);
91         void            (*halt)(void);
92         void            (*panic)(char *str);
93         void            (*cpu_die)(void);
94
95         int             (*set_rtc_time)(struct rtc_time *);
96         void            (*get_rtc_time)(struct rtc_time *);
97         void            (*get_boot_time)(struct rtc_time *);
98
99         void            (*calibrate_decr)(void);
100
101         void            (*progress)(char *, unsigned short);
102
103         /* Debug interface.  Low level I/O to some terminal device */
104         void            (*udbg_putc)(unsigned char c);
105         unsigned char   (*udbg_getc)(void);
106         int             (*udbg_getc_poll)(void);
107
108         /* Interface for platform error logging */
109         void            (*log_error)(char *buf, unsigned int err_type, int fatal);
110
111         ssize_t         (*nvram_write)(char *buf, size_t count, loff_t *index);
112         ssize_t         (*nvram_read)(char *buf, size_t count, loff_t *index);  
113         ssize_t         (*nvram_size)(void);            
114         int             (*nvram_sync)(void);
115
116         /* Exception handlers */
117         void            (*system_reset_exception)(struct pt_regs *regs);
118         int             (*machine_check_exception)(struct pt_regs *regs);
119
120         /* Motherboard/chipset features. This is a kind of general purpose
121          * hook used to control some machine specific features (like reset
122          * lines, chip power control, etc...).
123          */
124         long            (*feature_call)(unsigned int feature, ...);
125
126         /* Check availability of legacy devices like i8042 */
127         int             (*check_legacy_ioport)(unsigned int baseport);
128
129         /* Get legacy PCI/IDE interrupt mapping */ 
130         int             (*pci_get_legacy_ide_irq)(struct pci_dev *dev, int channel);
131         
132 };
133
134 extern struct machdep_calls ppc_md;
135 extern char cmd_line[COMMAND_LINE_SIZE];
136
137 /* Functions to produce codes on the leds.
138  * The SRC code should be unique for the message category and should
139  * be limited to the lower 24 bits (the upper 8 are set by these funcs),
140  * and (for boot & dump) should be sorted numerically in the order
141  * the events occur.
142  */
143 /* Print a boot progress message. */
144 void ppc64_boot_msg(unsigned int src, const char *msg);
145 /* Print a termination message (print only -- does not stop the kernel) */
146 void ppc64_terminate_msg(unsigned int src, const char *msg);
147 /* Print something that needs attention (device error, etc) */
148 void ppc64_attention_msg(unsigned int src, const char *msg);
149 /* Print a dump progress message. */
150 void ppc64_dump_msg(unsigned int src, const char *msg);
151
152 static inline void log_error(char *buf, unsigned int err_type, int fatal)
153 {
154         if (ppc_md.log_error)
155                 ppc_md.log_error(buf, err_type, fatal);
156 }
157
158 #endif /* _PPC64_MACHDEP_H */
159 #endif /* __KERNEL__ */