aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-powerpc
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-powerpc')
-rw-r--r--include/asm-powerpc/btext.h27
-rw-r--r--include/asm-powerpc/delay.h55
-rw-r--r--include/asm-powerpc/eeh.h364
-rw-r--r--include/asm-powerpc/floppy.h105
-rw-r--r--include/asm-powerpc/hvconsole.h49
-rw-r--r--include/asm-powerpc/hvcserver.h57
-rw-r--r--include/asm-powerpc/nvram.h120
-rw-r--r--include/asm-powerpc/serial.h18
8 files changed, 795 insertions, 0 deletions
diff --git a/include/asm-powerpc/btext.h b/include/asm-powerpc/btext.h
new file mode 100644
index 000000000000..71cce36bc630
--- /dev/null
+++ b/include/asm-powerpc/btext.h
@@ -0,0 +1,27 @@
1/*
2 * Definitions for using the procedures in btext.c.
3 *
4 * Benjamin Herrenschmidt <benh@kernel.crashing.org>
5 */
6#ifndef __PPC_BTEXT_H
7#define __PPC_BTEXT_H
8#ifdef __KERNEL__
9
10extern void btext_clearscreen(void);
11extern void btext_flushscreen(void);
12
13extern int boot_text_mapped;
14
15extern int btext_initialize(struct device_node *np);
16
17extern void map_boot_text(void);
18extern void init_boot_display(void);
19extern void btext_update_display(unsigned long phys, int width, int height,
20 int depth, int pitch);
21
22extern void btext_drawchar(char c);
23extern void btext_drawstring(const char *str);
24extern void btext_drawhex(unsigned long v);
25
26#endif /* __KERNEL__ */
27#endif /* __PPC_BTEXT_H */
diff --git a/include/asm-powerpc/delay.h b/include/asm-powerpc/delay.h
new file mode 100644
index 000000000000..1492aa9ab716
--- /dev/null
+++ b/include/asm-powerpc/delay.h
@@ -0,0 +1,55 @@
1#ifndef _ASM_POWERPC_DELAY_H
2#define _ASM_POWERPC_DELAY_H
3
4/*
5 * Copyright 1996, Paul Mackerras.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version.
11 *
12 * PPC64 Support added by Dave Engebretsen, Todd Inglett, Mike Corrigan,
13 * Anton Blanchard.
14 */
15
16extern unsigned long tb_ticks_per_usec;
17
18#ifdef CONFIG_PPC64
19/* define these here to prevent circular dependencies */
20/* these instructions control the thread priority on multi-threaded cpus */
21#define __HMT_low() asm volatile("or 1,1,1")
22#define __HMT_medium() asm volatile("or 2,2,2")
23#else
24#define __HMT_low()
25#define __HMT_medium()
26#endif
27
28#define __barrier() asm volatile("" ::: "memory")
29
30static inline unsigned long __get_tb(void)
31{
32 unsigned long rval;
33
34 asm volatile("mftb %0" : "=r" (rval));
35 return rval;
36}
37
38static inline void __delay(unsigned long loops)
39{
40 unsigned long start = __get_tb();
41
42 while((__get_tb() - start) < loops)
43 __HMT_low();
44 __HMT_medium();
45 __barrier();
46}
47
48static inline void udelay(unsigned long usecs)
49{
50 unsigned long loops = tb_ticks_per_usec * usecs;
51
52 __delay(loops);
53}
54
55#endif /* _ASM_POWERPC_DELAY_H */
diff --git a/include/asm-powerpc/eeh.h b/include/asm-powerpc/eeh.h
new file mode 100644
index 000000000000..89f26ab31908
--- /dev/null
+++ b/include/asm-powerpc/eeh.h
@@ -0,0 +1,364 @@
1/*
2 * eeh.h
3 * Copyright (C) 2001 Dave Engebretsen & Todd Inglett IBM Corporation.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20#ifndef _PPC64_EEH_H
21#define _PPC64_EEH_H
22
23#include <linux/config.h>
24#include <linux/init.h>
25#include <linux/list.h>
26#include <linux/string.h>
27
28struct pci_dev;
29struct device_node;
30
31#ifdef CONFIG_EEH
32
33/* Values for eeh_mode bits in device_node */
34#define EEH_MODE_SUPPORTED (1<<0)
35#define EEH_MODE_NOCHECK (1<<1)
36#define EEH_MODE_ISOLATED (1<<2)
37
38/* Max number of EEH freezes allowed before we consider the device
39 * to be permanently disabled. */
40#define EEH_MAX_ALLOWED_FREEZES 5
41
42void __init eeh_init(void);
43unsigned long eeh_check_failure(const volatile void __iomem *token,
44 unsigned long val);
45int eeh_dn_check_failure(struct device_node *dn, struct pci_dev *dev);
46void __init pci_addr_cache_build(void);
47
48/**
49 * eeh_add_device_early
50 * eeh_add_device_late
51 *
52 * Perform eeh initialization for devices added after boot.
53 * Call eeh_add_device_early before doing any i/o to the
54 * device (including config space i/o). Call eeh_add_device_late
55 * to finish the eeh setup for this device.
56 */
57void eeh_add_device_early(struct device_node *);
58void eeh_add_device_late(struct pci_dev *);
59
60/**
61 * eeh_remove_device - undo EEH setup for the indicated pci device
62 * @dev: pci device to be removed
63 *
64 * This routine should be called when a device is removed from
65 * a running system (e.g. by hotplug or dlpar). It unregisters
66 * the PCI device from the EEH subsystem. I/O errors affecting
67 * this device will no longer be detected after this call; thus,
68 * i/o errors affecting this slot may leave this device unusable.
69 */
70void eeh_remove_device(struct pci_dev *);
71
72/**
73 * EEH_POSSIBLE_ERROR() -- test for possible MMIO failure.
74 *
75 * If this macro yields TRUE, the caller relays to eeh_check_failure()
76 * which does further tests out of line.
77 */
78#define EEH_POSSIBLE_ERROR(val, type) ((val) == (type)~0)
79
80/*
81 * Reads from a device which has been isolated by EEH will return
82 * all 1s. This macro gives an all-1s value of the given size (in
83 * bytes: 1, 2, or 4) for comparing with the result of a read.
84 */
85#define EEH_IO_ERROR_VALUE(size) (~0U >> ((4 - (size)) * 8))
86
87#else /* !CONFIG_EEH */
88static inline void eeh_init(void) { }
89
90static inline unsigned long eeh_check_failure(const volatile void __iomem *token, unsigned long val)
91{
92 return val;
93}
94
95static inline int eeh_dn_check_failure(struct device_node *dn, struct pci_dev *dev)
96{
97 return 0;
98}
99
100static inline void pci_addr_cache_build(void) { }
101
102static inline void eeh_add_device_early(struct device_node *dn) { }
103
104static inline void eeh_add_device_late(struct pci_dev *dev) { }
105
106static inline void eeh_remove_device(struct pci_dev *dev) { }
107
108#define EEH_POSSIBLE_ERROR(val, type) (0)
109#define EEH_IO_ERROR_VALUE(size) (-1UL)
110#endif /* CONFIG_EEH */
111
112/*
113 * MMIO read/write operations with EEH support.
114 */
115static inline u8 eeh_readb(const volatile void __iomem *addr)
116{
117 u8 val = in_8(addr);
118 if (EEH_POSSIBLE_ERROR(val, u8))
119 return eeh_check_failure(addr, val);
120 return val;
121}
122static inline void eeh_writeb(u8 val, volatile void __iomem *addr)
123{
124 out_8(addr, val);
125}
126
127static inline u16 eeh_readw(const volatile void __iomem *addr)
128{
129 u16 val = in_le16(addr);
130 if (EEH_POSSIBLE_ERROR(val, u16))
131 return eeh_check_failure(addr, val);
132 return val;
133}
134static inline void eeh_writew(u16 val, volatile void __iomem *addr)
135{
136 out_le16(addr, val);
137}
138static inline u16 eeh_raw_readw(const volatile void __iomem *addr)
139{
140 u16 val = in_be16(addr);
141 if (EEH_POSSIBLE_ERROR(val, u16))
142 return eeh_check_failure(addr, val);
143 return val;
144}
145static inline void eeh_raw_writew(u16 val, volatile void __iomem *addr) {
146 volatile u16 __iomem *vaddr = (volatile u16 __iomem *) addr;
147 out_be16(vaddr, val);
148}
149
150static inline u32 eeh_readl(const volatile void __iomem *addr)
151{
152 u32 val = in_le32(addr);
153 if (EEH_POSSIBLE_ERROR(val, u32))
154 return eeh_check_failure(addr, val);
155 return val;
156}
157static inline void eeh_writel(u32 val, volatile void __iomem *addr)
158{
159 out_le32(addr, val);
160}
161static inline u32 eeh_raw_readl(const volatile void __iomem *addr)
162{
163 u32 val = in_be32(addr);
164 if (EEH_POSSIBLE_ERROR(val, u32))
165 return eeh_check_failure(addr, val);
166 return val;
167}
168static inline void eeh_raw_writel(u32 val, volatile void __iomem *addr)
169{
170 out_be32(addr, val);
171}
172
173static inline u64 eeh_readq(const volatile void __iomem *addr)
174{
175 u64 val = in_le64(addr);
176 if (EEH_POSSIBLE_ERROR(val, u64))
177 return eeh_check_failure(addr, val);
178 return val;
179}
180static inline void eeh_writeq(u64 val, volatile void __iomem *addr)
181{
182 out_le64(addr, val);
183}
184static inline u64 eeh_raw_readq(const volatile void __iomem *addr)
185{
186 u64 val = in_be64(addr);
187 if (EEH_POSSIBLE_ERROR(val, u64))
188 return eeh_check_failure(addr, val);
189 return val;
190}
191static inline void eeh_raw_writeq(u64 val, volatile void __iomem *addr)
192{
193 out_be64(addr, val);
194}
195
196#define EEH_CHECK_ALIGN(v,a) \
197 ((((unsigned long)(v)) & ((a) - 1)) == 0)
198
199static inline void eeh_memset_io(volatile void __iomem *addr, int c,
200 unsigned long n)
201{
202 void *p = (void __force *)addr;
203 u32 lc = c;
204 lc |= lc << 8;
205 lc |= lc << 16;
206
207 while(n && !EEH_CHECK_ALIGN(p, 4)) {
208 *((volatile u8 *)p) = c;
209 p++;
210 n--;
211 }
212 while(n >= 4) {
213 *((volatile u32 *)p) = lc;
214 p += 4;
215 n -= 4;
216 }
217 while(n) {
218 *((volatile u8 *)p) = c;
219 p++;
220 n--;
221 }
222 __asm__ __volatile__ ("sync" : : : "memory");
223}
224static inline void eeh_memcpy_fromio(void *dest, const volatile void __iomem *src,
225 unsigned long n)
226{
227 void *vsrc = (void __force *) src;
228 void *destsave = dest;
229 unsigned long nsave = n;
230
231 while(n && (!EEH_CHECK_ALIGN(vsrc, 4) || !EEH_CHECK_ALIGN(dest, 4))) {
232 *((u8 *)dest) = *((volatile u8 *)vsrc);
233 __asm__ __volatile__ ("eieio" : : : "memory");
234 vsrc++;
235 dest++;
236 n--;
237 }
238 while(n > 4) {
239 *((u32 *)dest) = *((volatile u32 *)vsrc);
240 __asm__ __volatile__ ("eieio" : : : "memory");
241 vsrc += 4;
242 dest += 4;
243 n -= 4;
244 }
245 while(n) {
246 *((u8 *)dest) = *((volatile u8 *)vsrc);
247 __asm__ __volatile__ ("eieio" : : : "memory");
248 vsrc++;
249 dest++;
250 n--;
251 }
252 __asm__ __volatile__ ("sync" : : : "memory");
253
254 /* Look for ffff's here at dest[n]. Assume that at least 4 bytes
255 * were copied. Check all four bytes.
256 */
257 if ((nsave >= 4) &&
258 (EEH_POSSIBLE_ERROR((*((u32 *) destsave+nsave-4)), u32))) {
259 eeh_check_failure(src, (*((u32 *) destsave+nsave-4)));
260 }
261}
262
263static inline void eeh_memcpy_toio(volatile void __iomem *dest, const void *src,
264 unsigned long n)
265{
266 void *vdest = (void __force *) dest;
267
268 while(n && (!EEH_CHECK_ALIGN(vdest, 4) || !EEH_CHECK_ALIGN(src, 4))) {
269 *((volatile u8 *)vdest) = *((u8 *)src);
270 src++;
271 vdest++;
272 n--;
273 }
274 while(n > 4) {
275 *((volatile u32 *)vdest) = *((volatile u32 *)src);
276 src += 4;
277 vdest += 4;
278 n-=4;
279 }
280 while(n) {
281 *((volatile u8 *)vdest) = *((u8 *)src);
282 src++;
283 vdest++;
284 n--;
285 }
286 __asm__ __volatile__ ("sync" : : : "memory");
287}
288
289#undef EEH_CHECK_ALIGN
290
291static inline u8 eeh_inb(unsigned long port)
292{
293 u8 val;
294 if (!_IO_IS_VALID(port))
295 return ~0;
296 val = in_8((u8 __iomem *)(port+pci_io_base));
297 if (EEH_POSSIBLE_ERROR(val, u8))
298 return eeh_check_failure((void __iomem *)(port), val);
299 return val;
300}
301
302static inline void eeh_outb(u8 val, unsigned long port)
303{
304 if (_IO_IS_VALID(port))
305 out_8((u8 __iomem *)(port+pci_io_base), val);
306}
307
308static inline u16 eeh_inw(unsigned long port)
309{
310 u16 val;
311 if (!_IO_IS_VALID(port))
312 return ~0;
313 val = in_le16((u16 __iomem *)(port+pci_io_base));
314 if (EEH_POSSIBLE_ERROR(val, u16))
315 return eeh_check_failure((void __iomem *)(port), val);
316 return val;
317}
318
319static inline void eeh_outw(u16 val, unsigned long port)
320{
321 if (_IO_IS_VALID(port))
322 out_le16((u16 __iomem *)(port+pci_io_base), val);
323}
324
325static inline u32 eeh_inl(unsigned long port)
326{
327 u32 val;
328 if (!_IO_IS_VALID(port))
329 return ~0;
330 val = in_le32((u32 __iomem *)(port+pci_io_base));
331 if (EEH_POSSIBLE_ERROR(val, u32))
332 return eeh_check_failure((void __iomem *)(port), val);
333 return val;
334}
335
336static inline void eeh_outl(u32 val, unsigned long port)
337{
338 if (_IO_IS_VALID(port))
339 out_le32((u32 __iomem *)(port+pci_io_base), val);
340}
341
342/* in-string eeh macros */
343static inline void eeh_insb(unsigned long port, void * buf, int ns)
344{
345 _insb((u8 __iomem *)(port+pci_io_base), buf, ns);
346 if (EEH_POSSIBLE_ERROR((*(((u8*)buf)+ns-1)), u8))
347 eeh_check_failure((void __iomem *)(port), *(u8*)buf);
348}
349
350static inline void eeh_insw_ns(unsigned long port, void * buf, int ns)
351{
352 _insw_ns((u16 __iomem *)(port+pci_io_base), buf, ns);
353 if (EEH_POSSIBLE_ERROR((*(((u16*)buf)+ns-1)), u16))
354 eeh_check_failure((void __iomem *)(port), *(u16*)buf);
355}
356
357static inline void eeh_insl_ns(unsigned long port, void * buf, int nl)
358{
359 _insl_ns((u32 __iomem *)(port+pci_io_base), buf, nl);
360 if (EEH_POSSIBLE_ERROR((*(((u32*)buf)+nl-1)), u32))
361 eeh_check_failure((void __iomem *)(port), *(u32*)buf);
362}
363
364#endif /* _PPC64_EEH_H */
diff --git a/include/asm-powerpc/floppy.h b/include/asm-powerpc/floppy.h
new file mode 100644
index 000000000000..64276a3f6153
--- /dev/null
+++ b/include/asm-powerpc/floppy.h
@@ -0,0 +1,105 @@
1/*
2 * Architecture specific parts of the Floppy driver
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 1995
9 */
10#ifndef __ASM_POWERPC_FLOPPY_H
11#define __ASM_POWERPC_FLOPPY_H
12
13#include <linux/config.h>
14#include <asm/machdep.h>
15
16#define fd_inb(port) inb_p(port)
17#define fd_outb(value,port) outb_p(value,port)
18
19#define fd_enable_dma() enable_dma(FLOPPY_DMA)
20#define fd_disable_dma() disable_dma(FLOPPY_DMA)
21#define fd_request_dma() request_dma(FLOPPY_DMA, "floppy")
22#define fd_free_dma() free_dma(FLOPPY_DMA)
23#define fd_clear_dma_ff() clear_dma_ff(FLOPPY_DMA)
24#define fd_set_dma_mode(mode) set_dma_mode(FLOPPY_DMA, mode)
25#define fd_set_dma_count(count) set_dma_count(FLOPPY_DMA, count)
26#define fd_enable_irq() enable_irq(FLOPPY_IRQ)
27#define fd_disable_irq() disable_irq(FLOPPY_IRQ)
28#define fd_cacheflush(addr,size) /* nothing */
29#define fd_request_irq() request_irq(FLOPPY_IRQ, floppy_interrupt, \
30 SA_INTERRUPT|SA_SAMPLE_RANDOM, \
31 "floppy", NULL)
32#define fd_free_irq() free_irq(FLOPPY_IRQ, NULL);
33
34#ifdef CONFIG_PCI
35
36#include <linux/pci.h>
37
38#define fd_dma_setup(addr,size,mode,io) powerpc_fd_dma_setup(addr,size,mode,io)
39
40static __inline__ int powerpc_fd_dma_setup(char *addr, unsigned long size,
41 int mode, int io)
42{
43 static unsigned long prev_size;
44 static dma_addr_t bus_addr = 0;
45 static char *prev_addr;
46 static int prev_dir;
47 int dir;
48
49 dir = (mode == DMA_MODE_READ) ? PCI_DMA_FROMDEVICE : PCI_DMA_TODEVICE;
50
51 if (bus_addr
52 && (addr != prev_addr || size != prev_size || dir != prev_dir)) {
53 /* different from last time -- unmap prev */
54 pci_unmap_single(NULL, bus_addr, prev_size, prev_dir);
55 bus_addr = 0;
56 }
57
58 if (!bus_addr) /* need to map it */
59 bus_addr = pci_map_single(NULL, addr, size, dir);
60
61 /* remember this one as prev */
62 prev_addr = addr;
63 prev_size = size;
64 prev_dir = dir;
65
66 fd_clear_dma_ff();
67 fd_cacheflush(addr, size);
68 fd_set_dma_mode(mode);
69 set_dma_addr(FLOPPY_DMA, bus_addr);
70 fd_set_dma_count(size);
71 virtual_dma_port = io;
72 fd_enable_dma();
73
74 return 0;
75}
76
77#endif /* CONFIG_PCI */
78
79__inline__ void virtual_dma_init(void)
80{
81 /* Nothing to do on PowerPC */
82}
83
84static int FDC1 = 0x3f0;
85static int FDC2 = -1;
86
87/*
88 * Again, the CMOS information not available
89 */
90#define FLOPPY0_TYPE 6
91#define FLOPPY1_TYPE 0
92
93#define N_FDC 2 /* Don't change this! */
94#define N_DRIVE 8
95
96#define FLOPPY_MOTOR_MASK 0xf0
97
98/*
99 * The PowerPC has no problems with floppy DMA crossing 64k borders.
100 */
101#define CROSS_64KB(a,s) (0)
102
103#define EXTRA_FLOPPY_PARAMS
104
105#endif /* __ASM_POWERPC_FLOPPY_H */
diff --git a/include/asm-powerpc/hvconsole.h b/include/asm-powerpc/hvconsole.h
new file mode 100644
index 000000000000..6da93ce74dc0
--- /dev/null
+++ b/include/asm-powerpc/hvconsole.h
@@ -0,0 +1,49 @@
1/*
2 * hvconsole.h
3 * Copyright (C) 2004 Ryan S Arnold, IBM Corporation
4 *
5 * LPAR console support.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21
22#ifndef _PPC64_HVCONSOLE_H
23#define _PPC64_HVCONSOLE_H
24
25/*
26 * This is the max number of console adapters that can/will be found as
27 * console devices on first stage console init. Any number beyond this range
28 * can't be used as a console device but is still a valid tty device.
29 */
30#define MAX_NR_HVC_CONSOLES 16
31
32/* implemented by a low level driver */
33struct hv_ops {
34 int (*get_chars)(uint32_t vtermno, char *buf, int count);
35 int (*put_chars)(uint32_t vtermno, const char *buf, int count);
36};
37extern int hvc_get_chars(uint32_t vtermno, char *buf, int count);
38extern int hvc_put_chars(uint32_t vtermno, const char *buf, int count);
39
40struct hvc_struct;
41
42/* Register a vterm and a slot index for use as a console (console_init) */
43extern int hvc_instantiate(uint32_t vtermno, int index, struct hv_ops *ops);
44/* register a vterm for hvc tty operation (module_init or hotplug add) */
45extern struct hvc_struct * __devinit hvc_alloc(uint32_t vtermno, int irq,
46 struct hv_ops *ops);
47/* remove a vterm from hvc tty operation (modele_exit or hotplug remove) */
48extern int __devexit hvc_remove(struct hvc_struct *hp);
49#endif /* _PPC64_HVCONSOLE_H */
diff --git a/include/asm-powerpc/hvcserver.h b/include/asm-powerpc/hvcserver.h
new file mode 100644
index 000000000000..aecba9665796
--- /dev/null
+++ b/include/asm-powerpc/hvcserver.h
@@ -0,0 +1,57 @@
1/*
2 * hvcserver.h
3 * Copyright (C) 2004 Ryan S Arnold, IBM Corporation
4 *
5 * PPC64 virtual I/O console server support.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21
22#ifndef _PPC64_HVCSERVER_H
23#define _PPC64_HVCSERVER_H
24
25#include <linux/list.h>
26
27/* Converged Location Code length */
28#define HVCS_CLC_LENGTH 79
29
30/**
31 * hvcs_partner_info - an element in a list of partner info
32 * @node: list_head denoting this partner_info struct's position in the list of
33 * partner info.
34 * @unit_address: The partner unit address of this entry.
35 * @partition_ID: The partner partition ID of this entry.
36 * @location_code: The converged location code of this entry + 1 char for the
37 * null-term.
38 *
39 * This structure outlines the format that partner info is presented to a caller
40 * of the hvcs partner info fetching functions. These are strung together into
41 * a list using linux kernel lists.
42 */
43struct hvcs_partner_info {
44 struct list_head node;
45 uint32_t unit_address;
46 uint32_t partition_ID;
47 char location_code[HVCS_CLC_LENGTH + 1]; /* CLC + 1 null-term char */
48};
49
50extern int hvcs_free_partner_info(struct list_head *head);
51extern int hvcs_get_partner_info(uint32_t unit_address,
52 struct list_head *head, unsigned long *pi_buff);
53extern int hvcs_register_connection(uint32_t unit_address,
54 uint32_t p_partition_ID, uint32_t p_unit_address);
55extern int hvcs_free_connection(uint32_t unit_address);
56
57#endif /* _PPC64_HVCSERVER_H */
diff --git a/include/asm-powerpc/nvram.h b/include/asm-powerpc/nvram.h
new file mode 100644
index 000000000000..1858244ced32
--- /dev/null
+++ b/include/asm-powerpc/nvram.h
@@ -0,0 +1,120 @@
1/*
2 * NVRAM definitions and access functions.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
8 */
9
10#ifndef _ASM_POWERPC_NVRAM_H
11#define _ASM_POWERPC_NVRAM_H
12
13#define NVRW_CNT 0x20
14#define NVRAM_HEADER_LEN 16 /* sizeof(struct nvram_header) */
15#define NVRAM_BLOCK_LEN 16
16#define NVRAM_MAX_REQ (2080/NVRAM_BLOCK_LEN)
17#define NVRAM_MIN_REQ (1056/NVRAM_BLOCK_LEN)
18
19#define NVRAM_AS0 0x74
20#define NVRAM_AS1 0x75
21#define NVRAM_DATA 0x77
22
23
24/* RTC Offsets */
25
26#define MOTO_RTC_SECONDS 0x1FF9
27#define MOTO_RTC_MINUTES 0x1FFA
28#define MOTO_RTC_HOURS 0x1FFB
29#define MOTO_RTC_DAY_OF_WEEK 0x1FFC
30#define MOTO_RTC_DAY_OF_MONTH 0x1FFD
31#define MOTO_RTC_MONTH 0x1FFE
32#define MOTO_RTC_YEAR 0x1FFF
33#define MOTO_RTC_CONTROLA 0x1FF8
34#define MOTO_RTC_CONTROLB 0x1FF9
35
36#define NVRAM_SIG_SP 0x02 /* support processor */
37#define NVRAM_SIG_OF 0x50 /* open firmware config */
38#define NVRAM_SIG_FW 0x51 /* general firmware */
39#define NVRAM_SIG_HW 0x52 /* hardware (VPD) */
40#define NVRAM_SIG_FLIP 0x5a /* Apple flip/flop header */
41#define NVRAM_SIG_APPL 0x5f /* Apple "system" (???) */
42#define NVRAM_SIG_SYS 0x70 /* system env vars */
43#define NVRAM_SIG_CFG 0x71 /* config data */
44#define NVRAM_SIG_ELOG 0x72 /* error log */
45#define NVRAM_SIG_VEND 0x7e /* vendor defined */
46#define NVRAM_SIG_FREE 0x7f /* Free space */
47#define NVRAM_SIG_OS 0xa0 /* OS defined */
48#define NVRAM_SIG_PANIC 0xa1 /* Apple OSX "panic" */
49
50/* If change this size, then change the size of NVNAME_LEN */
51struct nvram_header {
52 unsigned char signature;
53 unsigned char checksum;
54 unsigned short length;
55 char name[12];
56};
57
58struct nvram_partition {
59 struct list_head partition;
60 struct nvram_header header;
61 unsigned int index;
62};
63
64
65extern int nvram_write_error_log(char * buff, int length, unsigned int err_type);
66extern int nvram_read_error_log(char * buff, int length, unsigned int * err_type);
67extern int nvram_clear_error_log(void);
68extern struct nvram_partition *nvram_find_partition(int sig, const char *name);
69
70extern int pSeries_nvram_init(void);
71extern int pmac_nvram_init(void);
72extern int mmio_nvram_init(void);
73
74/* PowerMac specific nvram stuffs */
75
76enum {
77 pmac_nvram_OF, /* Open Firmware partition */
78 pmac_nvram_XPRAM, /* MacOS XPRAM partition */
79 pmac_nvram_NR /* MacOS Name Registry partition */
80};
81
82/* Return partition offset in nvram */
83extern int pmac_get_partition(int partition);
84
85/* Direct access to XPRAM on PowerMacs */
86extern u8 pmac_xpram_read(int xpaddr);
87extern void pmac_xpram_write(int xpaddr, u8 data);
88
89/* Synchronize NVRAM */
90extern void nvram_sync(void);
91
92/* Normal access to NVRAM */
93extern unsigned char nvram_read_byte(int i);
94extern void nvram_write_byte(unsigned char c, int i);
95
96/* Some offsets in XPRAM */
97#define PMAC_XPRAM_MACHINE_LOC 0xe4
98#define PMAC_XPRAM_SOUND_VOLUME 0x08
99
100/* Machine location structure in PowerMac XPRAM */
101struct pmac_machine_location {
102 unsigned int latitude; /* 2+30 bit Fractional number */
103 unsigned int longitude; /* 2+30 bit Fractional number */
104 unsigned int delta; /* mix of GMT delta and DLS */
105};
106
107/*
108 * /dev/nvram ioctls
109 *
110 * Note that PMAC_NVRAM_GET_OFFSET is still supported, but is
111 * definitely obsolete. Do not use it if you can avoid it
112 */
113
114#define OBSOLETE_PMAC_NVRAM_GET_OFFSET \
115 _IOWR('p', 0x40, int)
116
117#define IOC_NVRAM_GET_OFFSET _IOWR('p', 0x42, int) /* Get NVRAM partition offset */
118#define IOC_NVRAM_SYNC _IO('p', 0x43) /* Sync NVRAM image */
119
120#endif /* _ASM_POWERPC_NVRAM_H */
diff --git a/include/asm-powerpc/serial.h b/include/asm-powerpc/serial.h
new file mode 100644
index 000000000000..b273d630b32f
--- /dev/null
+++ b/include/asm-powerpc/serial.h
@@ -0,0 +1,18 @@
1/*
2 * This program is free software; you can redistribute it and/or
3 * modify it under the terms of the GNU General Public License
4 * as published by the Free Software Foundation; either version
5 * 2 of the License, or (at your option) any later version.
6 */
7#ifndef _ASM_POWERPC_SERIAL_H
8#define _ASM_POWERPC_SERIAL_H
9
10/*
11 * Serial ports are not listed here, because they are discovered
12 * through the device tree.
13 */
14
15/* Default baud base if not found in device-tree */
16#define BASE_BAUD ( 1843200 / 16 )
17
18#endif /* _PPC64_SERIAL_H */