aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-ppc64
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2005-11-14 01:22:01 -0500
committerPaul Mackerras <paulus@samba.org>2005-11-14 01:22:01 -0500
commitc55377ee73f6efeb373ae06f6e918d87660b4852 (patch)
tree8085472005f758e73d996d2b3e0e91064524d533 /include/asm-ppc64
parent821077b2617ef70662a861393c929d7e47609512 (diff)
powerpc: Move a bunch of ppc64 headers to include/asm-powerpc
... and also delete some that are no longer used because we already had an include/asm-powerpc version of the header. Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'include/asm-ppc64')
-rw-r--r--include/asm-ppc64/btext.h27
-rw-r--r--include/asm-ppc64/delay.h48
-rw-r--r--include/asm-ppc64/eeh.h364
-rw-r--r--include/asm-ppc64/floppy.h106
-rw-r--r--include/asm-ppc64/hvconsole.h49
-rw-r--r--include/asm-ppc64/hvcserver.h57
-rw-r--r--include/asm-ppc64/nvram.h116
-rw-r--r--include/asm-ppc64/prom.h220
-rw-r--r--include/asm-ppc64/serial.h23
-rw-r--r--include/asm-ppc64/system.h310
10 files changed, 0 insertions, 1320 deletions
diff --git a/include/asm-ppc64/btext.h b/include/asm-ppc64/btext.h
deleted file mode 100644
index 71cce36bc630..000000000000
--- a/include/asm-ppc64/btext.h
+++ /dev/null
@@ -1,27 +0,0 @@
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-ppc64/delay.h b/include/asm-ppc64/delay.h
deleted file mode 100644
index 05f198cf73d9..000000000000
--- a/include/asm-ppc64/delay.h
+++ /dev/null
@@ -1,48 +0,0 @@
1#ifndef _PPC64_DELAY_H
2#define _PPC64_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/* define these here to prevent circular dependencies */
19#define __HMT_low() asm volatile("or 1,1,1")
20#define __HMT_medium() asm volatile("or 2,2,2")
21#define __barrier() asm volatile("":::"memory")
22
23static inline unsigned long __get_tb(void)
24{
25 unsigned long rval;
26
27 asm volatile("mftb %0" : "=r" (rval));
28 return rval;
29}
30
31static inline void __delay(unsigned long loops)
32{
33 unsigned long start = __get_tb();
34
35 while((__get_tb()-start) < loops)
36 __HMT_low();
37 __HMT_medium();
38 __barrier();
39}
40
41static inline void udelay(unsigned long usecs)
42{
43 unsigned long loops = tb_ticks_per_usec * usecs;
44
45 __delay(loops);
46}
47
48#endif /* _PPC64_DELAY_H */
diff --git a/include/asm-ppc64/eeh.h b/include/asm-ppc64/eeh.h
deleted file mode 100644
index 89f26ab31908..000000000000
--- a/include/asm-ppc64/eeh.h
+++ /dev/null
@@ -1,364 +0,0 @@
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-ppc64/floppy.h b/include/asm-ppc64/floppy.h
deleted file mode 100644
index 5c497b588e54..000000000000
--- a/include/asm-ppc64/floppy.h
+++ /dev/null
@@ -1,106 +0,0 @@
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_PPC64_FLOPPY_H
11#define __ASM_PPC64_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) ppc64_fd_dma_setup(addr,size,mode,io)
39
40static __inline__ int
41ppc64_fd_dma_setup(char *addr, unsigned long size, 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
62 /* remember this one as prev */
63 prev_addr = addr;
64 prev_size = size;
65 prev_dir = dir;
66
67 fd_clear_dma_ff();
68 fd_cacheflush(addr, size);
69 fd_set_dma_mode(mode);
70 set_dma_addr(FLOPPY_DMA, bus_addr);
71 fd_set_dma_count(size);
72 virtual_dma_port = io;
73 fd_enable_dma();
74
75 return 0;
76}
77
78#endif /* CONFIG_PCI */
79
80__inline__ void virtual_dma_init(void)
81{
82 /* Nothing to do on PowerPC */
83}
84
85static int FDC1 = 0x3f0;
86static int FDC2 = -1;
87
88/*
89 * Again, the CMOS information not available
90 */
91#define FLOPPY0_TYPE 6
92#define FLOPPY1_TYPE 0
93
94#define N_FDC 2 /* Don't change this! */
95#define N_DRIVE 8
96
97#define FLOPPY_MOTOR_MASK 0xf0
98
99/*
100 * The PowerPC has no problems with floppy DMA crossing 64k borders.
101 */
102#define CROSS_64KB(a,s) (0)
103
104#define EXTRA_FLOPPY_PARAMS
105
106#endif /* __ASM_PPC64_FLOPPY_H */
diff --git a/include/asm-ppc64/hvconsole.h b/include/asm-ppc64/hvconsole.h
deleted file mode 100644
index 6da93ce74dc0..000000000000
--- a/include/asm-ppc64/hvconsole.h
+++ /dev/null
@@ -1,49 +0,0 @@
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-ppc64/hvcserver.h b/include/asm-ppc64/hvcserver.h
deleted file mode 100644
index aecba9665796..000000000000
--- a/include/asm-ppc64/hvcserver.h
+++ /dev/null
@@ -1,57 +0,0 @@
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-ppc64/nvram.h b/include/asm-ppc64/nvram.h
deleted file mode 100644
index def47d720d3d..000000000000
--- a/include/asm-ppc64/nvram.h
+++ /dev/null
@@ -1,116 +0,0 @@
1/*
2 * PreP compliant NVRAM access
3 * This needs to be updated for PPC64
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version
8 * 2 of the License, or (at your option) any later version.
9 */
10
11#ifndef _PPC64_NVRAM_H
12#define _PPC64_NVRAM_H
13
14#define NVRW_CNT 0x20
15#define NVRAM_HEADER_LEN 16 /* sizeof(struct nvram_header) */
16#define NVRAM_BLOCK_LEN 16
17#define NVRAM_MAX_REQ (2080/NVRAM_BLOCK_LEN)
18#define NVRAM_MIN_REQ (1056/NVRAM_BLOCK_LEN)
19
20#define NVRAM_AS0 0x74
21#define NVRAM_AS1 0x75
22#define NVRAM_DATA 0x77
23
24
25/* RTC Offsets */
26
27#define MOTO_RTC_SECONDS 0x1FF9
28#define MOTO_RTC_MINUTES 0x1FFA
29#define MOTO_RTC_HOURS 0x1FFB
30#define MOTO_RTC_DAY_OF_WEEK 0x1FFC
31#define MOTO_RTC_DAY_OF_MONTH 0x1FFD
32#define MOTO_RTC_MONTH 0x1FFE
33#define MOTO_RTC_YEAR 0x1FFF
34#define MOTO_RTC_CONTROLA 0x1FF8
35#define MOTO_RTC_CONTROLB 0x1FF9
36
37#define NVRAM_SIG_SP 0x02 /* support processor */
38#define NVRAM_SIG_OF 0x50 /* open firmware config */
39#define NVRAM_SIG_FW 0x51 /* general firmware */
40#define NVRAM_SIG_HW 0x52 /* hardware (VPD) */
41#define NVRAM_SIG_FLIP 0x5a /* Apple flip/flop header */
42#define NVRAM_SIG_APPL 0x5f /* Apple "system" (???) */
43#define NVRAM_SIG_SYS 0x70 /* system env vars */
44#define NVRAM_SIG_CFG 0x71 /* config data */
45#define NVRAM_SIG_ELOG 0x72 /* error log */
46#define NVRAM_SIG_VEND 0x7e /* vendor defined */
47#define NVRAM_SIG_FREE 0x7f /* Free space */
48#define NVRAM_SIG_OS 0xa0 /* OS defined */
49#define NVRAM_SIG_PANIC 0xa1 /* Apple OSX "panic" */
50
51/* If change this size, then change the size of NVNAME_LEN */
52struct nvram_header {
53 unsigned char signature;
54 unsigned char checksum;
55 unsigned short length;
56 char name[12];
57};
58
59struct nvram_partition {
60 struct list_head partition;
61 struct nvram_header header;
62 unsigned int index;
63};
64
65
66extern int nvram_write_error_log(char * buff, int length, unsigned int err_type);
67extern int nvram_read_error_log(char * buff, int length, unsigned int * err_type);
68extern int nvram_clear_error_log(void);
69extern struct nvram_partition *nvram_find_partition(int sig, const char *name);
70
71extern int pSeries_nvram_init(void);
72extern int pmac_nvram_init(void);
73extern int mmio_nvram_init(void);
74
75/* PowerMac specific nvram stuffs */
76
77enum {
78 pmac_nvram_OF, /* Open Firmware partition */
79 pmac_nvram_XPRAM, /* MacOS XPRAM partition */
80 pmac_nvram_NR /* MacOS Name Registry partition */
81};
82
83/* Return partition offset in nvram */
84extern int pmac_get_partition(int partition);
85
86/* Direct access to XPRAM on PowerMacs */
87extern u8 pmac_xpram_read(int xpaddr);
88extern void pmac_xpram_write(int xpaddr, u8 data);
89
90/* Synchronize NVRAM */
91extern int nvram_sync(void);
92
93/* Some offsets in XPRAM */
94#define PMAC_XPRAM_MACHINE_LOC 0xe4
95#define PMAC_XPRAM_SOUND_VOLUME 0x08
96
97/* Machine location structure in PowerMac XPRAM */
98struct pmac_machine_location {
99 unsigned int latitude; /* 2+30 bit Fractional number */
100 unsigned int longitude; /* 2+30 bit Fractional number */
101 unsigned int delta; /* mix of GMT delta and DLS */
102};
103
104/*
105 * /dev/nvram ioctls
106 *
107 * Note that PMAC_NVRAM_GET_OFFSET is still supported, but is
108 * definitely obsolete. Do not use it if you can avoid it
109 */
110
111#define OBSOLETE_PMAC_NVRAM_GET_OFFSET \
112 _IOWR('p', 0x40, int)
113
114#define IOC_NVRAM_GET_OFFSET _IOWR('p', 0x42, int) /* Get NVRAM partition offset */
115
116#endif /* _PPC64_NVRAM_H */
diff --git a/include/asm-ppc64/prom.h b/include/asm-ppc64/prom.h
deleted file mode 100644
index ddfe186589fa..000000000000
--- a/include/asm-ppc64/prom.h
+++ /dev/null
@@ -1,220 +0,0 @@
1#ifndef _PPC64_PROM_H
2#define _PPC64_PROM_H
3
4/*
5 * Definitions for talking to the Open Firmware PROM on
6 * Power Macintosh computers.
7 *
8 * Copyright (C) 1996 Paul Mackerras.
9 *
10 * Updates for PPC64 by Peter Bergner & David Engebretsen, IBM Corp.
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version
15 * 2 of the License, or (at your option) any later version.
16 */
17#include <linux/config.h>
18#include <linux/proc_fs.h>
19#include <asm/atomic.h>
20
21#define PTRRELOC(x) ((typeof(x))((unsigned long)(x) - offset))
22#define PTRUNRELOC(x) ((typeof(x))((unsigned long)(x) + offset))
23#define RELOC(x) (*PTRRELOC(&(x)))
24
25/* Definitions used by the flattened device tree */
26#define OF_DT_HEADER 0xd00dfeed /* marker */
27#define OF_DT_BEGIN_NODE 0x1 /* Start of node, full name */
28#define OF_DT_END_NODE 0x2 /* End node */
29#define OF_DT_PROP 0x3 /* Property: name off, size,
30 * content */
31#define OF_DT_NOP 0x4 /* nop */
32#define OF_DT_END 0x9
33
34#define OF_DT_VERSION 0x10
35
36/*
37 * This is what gets passed to the kernel by prom_init or kexec
38 *
39 * The dt struct contains the device tree structure, full pathes and
40 * property contents. The dt strings contain a separate block with just
41 * the strings for the property names, and is fully page aligned and
42 * self contained in a page, so that it can be kept around by the kernel,
43 * each property name appears only once in this page (cheap compression)
44 *
45 * the mem_rsvmap contains a map of reserved ranges of physical memory,
46 * passing it here instead of in the device-tree itself greatly simplifies
47 * the job of everybody. It's just a list of u64 pairs (base/size) that
48 * ends when size is 0
49 */
50struct boot_param_header
51{
52 u32 magic; /* magic word OF_DT_HEADER */
53 u32 totalsize; /* total size of DT block */
54 u32 off_dt_struct; /* offset to structure */
55 u32 off_dt_strings; /* offset to strings */
56 u32 off_mem_rsvmap; /* offset to memory reserve map */
57 u32 version; /* format version */
58 u32 last_comp_version; /* last compatible version */
59 /* version 2 fields below */
60 u32 boot_cpuid_phys; /* Physical CPU id we're booting on */
61 /* version 3 fields below */
62 u32 dt_strings_size; /* size of the DT strings block */
63};
64
65
66
67typedef u32 phandle;
68typedef u32 ihandle;
69
70struct address_range {
71 unsigned long space;
72 unsigned long address;
73 unsigned long size;
74};
75
76struct interrupt_info {
77 int line;
78 int sense; /* +ve/-ve logic, edge or level, etc. */
79};
80
81struct pci_address {
82 u32 a_hi;
83 u32 a_mid;
84 u32 a_lo;
85};
86
87struct isa_address {
88 u32 a_hi;
89 u32 a_lo;
90};
91
92struct isa_range {
93 struct isa_address isa_addr;
94 struct pci_address pci_addr;
95 unsigned int size;
96};
97
98struct reg_property {
99 unsigned long address;
100 unsigned long size;
101};
102
103struct reg_property32 {
104 unsigned int address;
105 unsigned int size;
106};
107
108struct reg_property64 {
109 unsigned long address;
110 unsigned long size;
111};
112
113struct property {
114 char *name;
115 int length;
116 unsigned char *value;
117 struct property *next;
118};
119
120struct device_node {
121 char *name;
122 char *type;
123 phandle node;
124 phandle linux_phandle;
125 int n_addrs;
126 struct address_range *addrs;
127 int n_intrs;
128 struct interrupt_info *intrs;
129 char *full_name;
130
131 struct property *properties;
132 struct device_node *parent;
133 struct device_node *child;
134 struct device_node *sibling;
135 struct device_node *next; /* next device of same type */
136 struct device_node *allnext; /* next in list of all nodes */
137 struct proc_dir_entry *pde; /* this node's proc directory */
138 struct kref kref;
139 unsigned long _flags;
140 void *data;
141#ifdef CONFIG_PPC_ISERIES
142 struct list_head Device_List;
143#endif
144};
145
146extern struct device_node *of_chosen;
147
148/* flag descriptions */
149#define OF_DYNAMIC 1 /* node and properties were allocated via kmalloc */
150
151#define OF_IS_DYNAMIC(x) test_bit(OF_DYNAMIC, &x->_flags)
152#define OF_MARK_DYNAMIC(x) set_bit(OF_DYNAMIC, &x->_flags)
153
154/*
155 * Until 32-bit ppc can add proc_dir_entries to its device_node
156 * definition, we cannot refer to pde, name_link, and addr_link
157 * in arch-independent code.
158 */
159#define HAVE_ARCH_DEVTREE_FIXUPS
160
161static inline void set_node_proc_entry(struct device_node *dn, struct proc_dir_entry *de)
162{
163 dn->pde = de;
164}
165
166
167/* OBSOLETE: Old stlye node lookup */
168extern struct device_node *find_devices(const char *name);
169extern struct device_node *find_type_devices(const char *type);
170extern struct device_node *find_path_device(const char *path);
171extern struct device_node *find_compatible_devices(const char *type,
172 const char *compat);
173extern struct device_node *find_all_nodes(void);
174
175/* New style node lookup */
176extern struct device_node *of_find_node_by_name(struct device_node *from,
177 const char *name);
178extern struct device_node *of_find_node_by_type(struct device_node *from,
179 const char *type);
180extern struct device_node *of_find_compatible_node(struct device_node *from,
181 const char *type, const char *compat);
182extern struct device_node *of_find_node_by_path(const char *path);
183extern struct device_node *of_find_node_by_phandle(phandle handle);
184extern struct device_node *of_find_all_nodes(struct device_node *prev);
185extern struct device_node *of_get_parent(const struct device_node *node);
186extern struct device_node *of_get_next_child(const struct device_node *node,
187 struct device_node *prev);
188extern struct device_node *of_node_get(struct device_node *node);
189extern void of_node_put(struct device_node *node);
190
191/* For scanning the flat device-tree at boot time */
192int __init of_scan_flat_dt(int (*it)(unsigned long node,
193 const char *uname, int depth,
194 void *data),
195 void *data);
196void* __init of_get_flat_dt_prop(unsigned long node, const char *name,
197 unsigned long *size);
198
199/* For updating the device tree at runtime */
200extern void of_attach_node(struct device_node *);
201extern void of_detach_node(const struct device_node *);
202
203/* Other Prototypes */
204extern unsigned long prom_init(unsigned long, unsigned long, unsigned long,
205 unsigned long, unsigned long);
206extern void finish_device_tree(void);
207extern void unflatten_device_tree(void);
208extern void early_init_devtree(void *);
209extern int device_is_compatible(struct device_node *device, const char *);
210extern int machine_is_compatible(const char *compat);
211extern unsigned char *get_property(struct device_node *node, const char *name,
212 int *lenp);
213extern void print_properties(struct device_node *node);
214extern int prom_n_addr_cells(struct device_node* np);
215extern int prom_n_size_cells(struct device_node* np);
216extern int prom_n_intr_cells(struct device_node* np);
217extern void prom_get_irq_senses(unsigned char *senses, int off, int max);
218extern int prom_add_property(struct device_node* np, struct property* prop);
219
220#endif /* _PPC64_PROM_H */
diff --git a/include/asm-ppc64/serial.h b/include/asm-ppc64/serial.h
deleted file mode 100644
index d6bcb79b7d7b..000000000000
--- a/include/asm-ppc64/serial.h
+++ /dev/null
@@ -1,23 +0,0 @@
1/*
2 * include/asm-ppc64/serial.h
3 */
4#ifndef _PPC64_SERIAL_H
5#define _PPC64_SERIAL_H
6
7/*
8 * This assumes you have a 1.8432 MHz clock for your UART.
9 *
10 * It'd be nice if someone built a serial card with a 24.576 MHz
11 * clock, since the 16550A is capable of handling a top speed of 1.5
12 * megabits/second; but this requires the faster clock.
13 *
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License
16 * as published by the Free Software Foundation; either version
17 * 2 of the License, or (at your option) any later version.
18 */
19
20/* Default baud base if not found in device-tree */
21#define BASE_BAUD ( 1843200 / 16 )
22
23#endif /* _PPC64_SERIAL_H */
diff --git a/include/asm-ppc64/system.h b/include/asm-ppc64/system.h
deleted file mode 100644
index bf9a6aba19c9..000000000000
--- a/include/asm-ppc64/system.h
+++ /dev/null
@@ -1,310 +0,0 @@
1#ifndef __PPC64_SYSTEM_H
2#define __PPC64_SYSTEM_H
3
4/*
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version
8 * 2 of the License, or (at your option) any later version.
9 */
10
11#include <linux/config.h>
12#include <linux/compiler.h>
13#include <asm/page.h>
14#include <asm/processor.h>
15#include <asm/hw_irq.h>
16#include <asm/synch.h>
17
18/*
19 * Memory barrier.
20 * The sync instruction guarantees that all memory accesses initiated
21 * by this processor have been performed (with respect to all other
22 * mechanisms that access memory). The eieio instruction is a barrier
23 * providing an ordering (separately) for (a) cacheable stores and (b)
24 * loads and stores to non-cacheable memory (e.g. I/O devices).
25 *
26 * mb() prevents loads and stores being reordered across this point.
27 * rmb() prevents loads being reordered across this point.
28 * wmb() prevents stores being reordered across this point.
29 * read_barrier_depends() prevents data-dependent loads being reordered
30 * across this point (nop on PPC).
31 *
32 * We have to use the sync instructions for mb(), since lwsync doesn't
33 * order loads with respect to previous stores. Lwsync is fine for
34 * rmb(), though.
35 * For wmb(), we use sync since wmb is used in drivers to order
36 * stores to system memory with respect to writes to the device.
37 * However, smp_wmb() can be a lighter-weight eieio barrier on
38 * SMP since it is only used to order updates to system memory.
39 */
40#define mb() __asm__ __volatile__ ("sync" : : : "memory")
41#define rmb() __asm__ __volatile__ ("lwsync" : : : "memory")
42#define wmb() __asm__ __volatile__ ("sync" : : : "memory")
43#define read_barrier_depends() do { } while(0)
44
45#define set_mb(var, value) do { var = value; smp_mb(); } while (0)
46#define set_wmb(var, value) do { var = value; smp_wmb(); } while (0)
47
48#ifdef CONFIG_SMP
49#define smp_mb() mb()
50#define smp_rmb() rmb()
51#define smp_wmb() eieio()
52#define smp_read_barrier_depends() read_barrier_depends()
53#else
54#define smp_mb() __asm__ __volatile__("": : :"memory")
55#define smp_rmb() __asm__ __volatile__("": : :"memory")
56#define smp_wmb() __asm__ __volatile__("": : :"memory")
57#define smp_read_barrier_depends() do { } while(0)
58#endif /* CONFIG_SMP */
59
60#ifdef __KERNEL__
61struct task_struct;
62struct pt_regs;
63
64#ifdef CONFIG_DEBUGGER
65
66extern int (*__debugger)(struct pt_regs *regs);
67extern int (*__debugger_ipi)(struct pt_regs *regs);
68extern int (*__debugger_bpt)(struct pt_regs *regs);
69extern int (*__debugger_sstep)(struct pt_regs *regs);
70extern int (*__debugger_iabr_match)(struct pt_regs *regs);
71extern int (*__debugger_dabr_match)(struct pt_regs *regs);
72extern int (*__debugger_fault_handler)(struct pt_regs *regs);
73
74#define DEBUGGER_BOILERPLATE(__NAME) \
75static inline int __NAME(struct pt_regs *regs) \
76{ \
77 if (unlikely(__ ## __NAME)) \
78 return __ ## __NAME(regs); \
79 return 0; \
80}
81
82DEBUGGER_BOILERPLATE(debugger)
83DEBUGGER_BOILERPLATE(debugger_ipi)
84DEBUGGER_BOILERPLATE(debugger_bpt)
85DEBUGGER_BOILERPLATE(debugger_sstep)
86DEBUGGER_BOILERPLATE(debugger_iabr_match)
87DEBUGGER_BOILERPLATE(debugger_dabr_match)
88DEBUGGER_BOILERPLATE(debugger_fault_handler)
89
90#ifdef CONFIG_XMON
91extern void xmon_init(int enable);
92#endif
93
94#else
95static inline int debugger(struct pt_regs *regs) { return 0; }
96static inline int debugger_ipi(struct pt_regs *regs) { return 0; }
97static inline int debugger_bpt(struct pt_regs *regs) { return 0; }
98static inline int debugger_sstep(struct pt_regs *regs) { return 0; }
99static inline int debugger_iabr_match(struct pt_regs *regs) { return 0; }
100static inline int debugger_dabr_match(struct pt_regs *regs) { return 0; }
101static inline int debugger_fault_handler(struct pt_regs *regs) { return 0; }
102#endif
103
104extern int set_dabr(unsigned long dabr);
105extern void _exception(int signr, struct pt_regs *regs, int code,
106 unsigned long addr);
107extern int fix_alignment(struct pt_regs *regs);
108extern void bad_page_fault(struct pt_regs *regs, unsigned long address,
109 int sig);
110extern void show_regs(struct pt_regs * regs);
111extern void low_hash_fault(struct pt_regs *regs, unsigned long address);
112extern int die(const char *str, struct pt_regs *regs, long err);
113
114extern int _get_PVR(void);
115extern void giveup_fpu(struct task_struct *);
116extern void disable_kernel_fp(void);
117extern void flush_fp_to_thread(struct task_struct *);
118extern void enable_kernel_fp(void);
119extern void giveup_altivec(struct task_struct *);
120extern void disable_kernel_altivec(void);
121extern void enable_kernel_altivec(void);
122extern int emulate_altivec(struct pt_regs *);
123extern void cvt_fd(float *from, double *to, struct thread_struct *thread);
124extern void cvt_df(double *from, float *to, struct thread_struct *thread);
125
126#ifdef CONFIG_ALTIVEC
127extern void flush_altivec_to_thread(struct task_struct *);
128#else
129static inline void flush_altivec_to_thread(struct task_struct *t)
130{
131}
132#endif
133
134static inline void flush_spe_to_thread(struct task_struct *t)
135{
136}
137
138extern int mem_init_done; /* set on boot once kmalloc can be called */
139extern unsigned long memory_limit;
140
141/* EBCDIC -> ASCII conversion for [0-9A-Z] on iSeries */
142extern unsigned char e2a(unsigned char);
143
144extern struct task_struct *__switch_to(struct task_struct *,
145 struct task_struct *);
146#define switch_to(prev, next, last) ((last) = __switch_to((prev), (next)))
147
148struct thread_struct;
149extern struct task_struct * _switch(struct thread_struct *prev,
150 struct thread_struct *next);
151
152extern unsigned long klimit;
153
154extern int powersave_nap; /* set if nap mode can be used in idle loop */
155
156/*
157 * Atomic exchange
158 *
159 * Changes the memory location '*ptr' to be val and returns
160 * the previous value stored there.
161 *
162 * Inline asm pulled from arch/ppc/kernel/misc.S so ppc64
163 * is more like most of the other architectures.
164 */
165static __inline__ unsigned long
166__xchg_u32(volatile unsigned int *m, unsigned long val)
167{
168 unsigned long dummy;
169
170 __asm__ __volatile__(
171 EIEIO_ON_SMP
172"1: lwarx %0,0,%3 # __xchg_u32\n\
173 stwcx. %2,0,%3\n\
1742: bne- 1b"
175 ISYNC_ON_SMP
176 : "=&r" (dummy), "=m" (*m)
177 : "r" (val), "r" (m)
178 : "cc", "memory");
179
180 return (dummy);
181}
182
183static __inline__ unsigned long
184__xchg_u64(volatile long *m, unsigned long val)
185{
186 unsigned long dummy;
187
188 __asm__ __volatile__(
189 EIEIO_ON_SMP
190"1: ldarx %0,0,%3 # __xchg_u64\n\
191 stdcx. %2,0,%3\n\
1922: bne- 1b"
193 ISYNC_ON_SMP
194 : "=&r" (dummy), "=m" (*m)
195 : "r" (val), "r" (m)
196 : "cc", "memory");
197
198 return (dummy);
199}
200
201/*
202 * This function doesn't exist, so you'll get a linker error
203 * if something tries to do an invalid xchg().
204 */
205extern void __xchg_called_with_bad_pointer(void);
206
207static __inline__ unsigned long
208__xchg(volatile void *ptr, unsigned long x, unsigned int size)
209{
210 switch (size) {
211 case 4:
212 return __xchg_u32(ptr, x);
213 case 8:
214 return __xchg_u64(ptr, x);
215 }
216 __xchg_called_with_bad_pointer();
217 return x;
218}
219
220#define xchg(ptr,x) \
221 ({ \
222 __typeof__(*(ptr)) _x_ = (x); \
223 (__typeof__(*(ptr))) __xchg((ptr), (unsigned long)_x_, sizeof(*(ptr))); \
224 })
225
226#define tas(ptr) (xchg((ptr),1))
227
228#define __HAVE_ARCH_CMPXCHG 1
229
230static __inline__ unsigned long
231__cmpxchg_u32(volatile unsigned int *p, unsigned long old, unsigned long new)
232{
233 unsigned int prev;
234
235 __asm__ __volatile__ (
236 EIEIO_ON_SMP
237"1: lwarx %0,0,%2 # __cmpxchg_u32\n\
238 cmpw 0,%0,%3\n\
239 bne- 2f\n\
240 stwcx. %4,0,%2\n\
241 bne- 1b"
242 ISYNC_ON_SMP
243 "\n\
2442:"
245 : "=&r" (prev), "=m" (*p)
246 : "r" (p), "r" (old), "r" (new), "m" (*p)
247 : "cc", "memory");
248
249 return prev;
250}
251
252static __inline__ unsigned long
253__cmpxchg_u64(volatile unsigned long *p, unsigned long old, unsigned long new)
254{
255 unsigned long prev;
256
257 __asm__ __volatile__ (
258 EIEIO_ON_SMP
259"1: ldarx %0,0,%2 # __cmpxchg_u64\n\
260 cmpd 0,%0,%3\n\
261 bne- 2f\n\
262 stdcx. %4,0,%2\n\
263 bne- 1b"
264 ISYNC_ON_SMP
265 "\n\
2662:"
267 : "=&r" (prev), "=m" (*p)
268 : "r" (p), "r" (old), "r" (new), "m" (*p)
269 : "cc", "memory");
270
271 return prev;
272}
273
274/* This function doesn't exist, so you'll get a linker error
275 if something tries to do an invalid cmpxchg(). */
276extern void __cmpxchg_called_with_bad_pointer(void);
277
278static __inline__ unsigned long
279__cmpxchg(volatile void *ptr, unsigned long old, unsigned long new,
280 unsigned int size)
281{
282 switch (size) {
283 case 4:
284 return __cmpxchg_u32(ptr, old, new);
285 case 8:
286 return __cmpxchg_u64(ptr, old, new);
287 }
288 __cmpxchg_called_with_bad_pointer();
289 return old;
290}
291
292#define cmpxchg(ptr,o,n)\
293 ((__typeof__(*(ptr)))__cmpxchg((ptr),(unsigned long)(o),\
294 (unsigned long)(n),sizeof(*(ptr))))
295
296/*
297 * We handle most unaligned accesses in hardware. On the other hand
298 * unaligned DMA can be very expensive on some ppc64 IO chips (it does
299 * powers of 2 writes until it reaches sufficient alignment).
300 *
301 * Based on this we disable the IP header alignment in network drivers.
302 */
303#define NET_IP_ALIGN 0
304
305#define arch_align_stack(x) (x)
306
307extern unsigned long reloc_offset(void);
308
309#endif /* __KERNEL__ */
310#endif