ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[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/dma-mapping.h>
15
16 struct pt_regs;
17 struct pci_bus; 
18 struct device_node;
19 struct iommu_table;
20 struct rtc_time;
21
22 #ifdef CONFIG_SMP
23 struct smp_ops_t {
24         void  (*message_pass)(int target, int msg);
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 iommu_table * tbl,
58                                      long index,
59                                      long npages,
60                                      unsigned long uaddr,
61                                      enum dma_data_direction direction);
62         void            (*tce_free)(struct iommu_table *tbl,
63                                     long index,
64                                     long npages);
65         void            (*tce_flush)(struct iommu_table *tbl);
66
67         void            (*setup_arch)(void);
68         /* Optional, may be NULL. */
69         void            (*get_cpuinfo)(struct seq_file *m);
70
71         void            (*init_IRQ)(void);
72         int             (*get_irq)(struct pt_regs *);
73
74         /* PCI stuff */
75         void            (*pcibios_fixup)(void);
76
77         /* Optional, may be NULL. */
78         void            (*init)(void);
79
80         void            (*restart)(char *cmd);
81         void            (*power_off)(void);
82         void            (*halt)(void);
83         void            (*panic)(char *str);
84
85         int             (*set_rtc_time)(struct rtc_time *);
86         void            (*get_rtc_time)(struct rtc_time *);
87         void            (*get_boot_time)(struct rtc_time *);
88
89         void            (*calibrate_decr)(void);
90
91         void            (*progress)(char *, unsigned short);
92
93         /* Debug interface.  Low level I/O to some terminal device */
94         void            (*udbg_putc)(unsigned char c);
95         unsigned char   (*udbg_getc)(void);
96         int             (*udbg_getc_poll)(void);
97
98         /* Interface for platform error logging */
99         void            (*log_error)(char *buf, unsigned int err_type, int fatal);
100
101         ssize_t         (*nvram_write)(char *buf, size_t count, loff_t *index);
102         ssize_t         (*nvram_read)(char *buf, size_t count, loff_t *index);  
103         ssize_t         (*nvram_size)(void);            
104         int             (*nvram_sync)(void);
105
106         /* Motherboard/chipset features. This is a kind of general purpose
107          * hook used to control some machine specific features (like reset
108          * lines, chip power control, etc...).
109          */
110         long            (*feature_call)(unsigned int feature, ...);
111
112 };
113
114 extern struct machdep_calls ppc_md;
115 #define COMMAND_LINE_SIZE 512
116 extern char cmd_line[COMMAND_LINE_SIZE];
117 extern char saved_command_line[COMMAND_LINE_SIZE];
118
119 /* Functions to produce codes on the leds.
120  * The SRC code should be unique for the message category and should
121  * be limited to the lower 24 bits (the upper 8 are set by these funcs),
122  * and (for boot & dump) should be sorted numerically in the order
123  * the events occur.
124  */
125 /* Print a boot progress message. */
126 void ppc64_boot_msg(unsigned int src, const char *msg);
127 /* Print a termination message (print only -- does not stop the kernel) */
128 void ppc64_terminate_msg(unsigned int src, const char *msg);
129 /* Print something that needs attention (device error, etc) */
130 void ppc64_attention_msg(unsigned int src, const char *msg);
131 /* Print a dump progress message. */
132 void ppc64_dump_msg(unsigned int src, const char *msg);
133
134 static inline void log_error(char *buf, unsigned int err_type, int fatal)
135 {
136         if (ppc_md.log_error)
137                 ppc_md.log_error(buf, err_type, fatal);
138 }
139
140 #endif /* _PPC64_MACHDEP_H */
141 #endif /* __KERNEL__ */