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