4610e53b07483bd5dec9a84221351aca9b2ba7a2
[linux-flexiantxendom0-3.2.10.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/irq.h>
15
16 struct pt_regs;
17 struct pci_bus; 
18 struct device_node;
19 struct TceTable;
20 struct rtc_time;
21
22 #ifdef CONFIG_SMP
23 struct smp_ops_t {
24         void  (*message_pass)(int target, int msg, unsigned long data, int wait);
25         int   (*probe)(void);
26         void  (*kick_cpu)(int nr);
27         void  (*setup_cpu)(int nr);
28         void  (*take_timebase)(void);
29         void  (*give_timebase)(void);
30 };
31 #endif
32
33 struct machdep_calls {
34         void            (*hpte_invalidate)(unsigned long slot,
35                                            unsigned long va,
36                                            int large,
37                                            int local);
38         long            (*hpte_updatepp)(unsigned long slot, 
39                                          unsigned long newpp, 
40                                          unsigned long va,
41                                          int large,
42                                          int local);
43         void            (*hpte_updateboltedpp)(unsigned long newpp, 
44                                                unsigned long ea);
45         long            (*hpte_insert)(unsigned long hpte_group,
46                                        unsigned long va,
47                                        unsigned long prpn,
48                                        int secondary, 
49                                        unsigned long hpteflags, 
50                                        int bolted,
51                                        int large);
52         long            (*hpte_remove)(unsigned long hpte_group);
53         void            (*flush_hash_range)(unsigned long context,
54                                             unsigned long number,
55                                             int local);
56
57         void            (*tce_build)(struct TceTable * tbl,
58                                      long tcenum,
59                                      unsigned long uaddr,
60                                      int direction);
61         void            (*tce_free_one)(struct TceTable *tbl,
62                                         long tcenum);    
63
64         void            (*setup_arch)(void);
65         /* Optional, may be NULL. */
66         void            (*setup_residual)(struct seq_file *m, int cpu_id);
67         /* Optional, may be NULL. */
68         void            (*get_cpuinfo)(struct seq_file *m);
69
70         void            (*init_IRQ)(void);
71         void            (*init_irq_desc)(irq_desc_t *desc);
72         int             (*get_irq)(struct pt_regs *);
73
74         /* Optional, may be NULL. */
75         void            (*init)(void);
76
77         void            (*restart)(char *cmd);
78         void            (*power_off)(void);
79         void            (*halt)(void);
80
81         int             (*set_rtc_time)(struct rtc_time *);
82         void            (*get_rtc_time)(struct rtc_time *);
83         void            (*get_boot_time)(struct rtc_time *);
84
85         void            (*calibrate_decr)(void);
86
87         void            (*progress)(char *, unsigned short);
88
89         /* Debug interface.  Low level I/O to some terminal device */
90         void            (*udbg_putc)(unsigned char c);
91         unsigned char   (*udbg_getc)(void);
92         int             (*udbg_getc_poll)(void);
93
94         /* Interface for platform error logging */
95         void            (*log_error)(char *buf, unsigned int err_type, int fatal);
96
97         ssize_t         (*nvram_write)(char *buf, size_t count, loff_t *index);
98         ssize_t         (*nvram_read)(char *buf, size_t count, loff_t *index);  
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 extern char cmd_line[512];
108
109 /* Functions to produce codes on the leds.
110  * The SRC code should be unique for the message category and should
111  * be limited to the lower 24 bits (the upper 8 are set by these funcs),
112  * and (for boot & dump) should be sorted numerically in the order
113  * the events occur.
114  */
115 /* Print a boot progress message. */
116 void ppc64_boot_msg(unsigned int src, const char *msg);
117 /* Print a termination message (print only -- does not stop the kernel) */
118 void ppc64_terminate_msg(unsigned int src, const char *msg);
119 /* Print something that needs attention (device error, etc) */
120 void ppc64_attention_msg(unsigned int src, const char *msg);
121 /* Print a dump progress message. */
122 void ppc64_dump_msg(unsigned int src, const char *msg);
123
124 static inline void log_error(char *buf, unsigned int err_type, int fatal)
125 {
126         if (ppc_md.log_error)
127                 ppc_md.log_error(buf, err_type, fatal);
128 }
129
130 #endif /* _PPC64_MACHDEP_H */
131 #endif /* __KERNEL__ */