[PATCH] taskstats_tgid_alloc: optimization
[linux-2.6-block.git] / include / asm-sparc / ide.h
CommitLineData
1da177e4
LT
1/* $Id: ide.h,v 1.7 2002/01/16 20:58:40 davem Exp $
2 * ide.h: SPARC PCI specific IDE glue.
3 *
4 * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu)
5 * Copyright (C) 1998 Eddie C. Dost (ecd@skynet.be)
6 * Adaptation from sparc64 version to sparc by Pete Zaitcev.
7 */
8
9#ifndef _SPARC_IDE_H
10#define _SPARC_IDE_H
11
12#ifdef __KERNEL__
13
1da177e4
LT
14#include <asm/pgtable.h>
15#include <asm/io.h>
16#include <asm/psr.h>
17
18#undef MAX_HWIFS
19#define MAX_HWIFS 2
20
21#define IDE_ARCH_OBSOLETE_INIT
22#define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */
23
24#define __ide_insl(data_reg, buffer, wcount) \
25 __ide_insw(data_reg, buffer, (wcount)<<1)
26#define __ide_outsl(data_reg, buffer, wcount) \
27 __ide_outsw(data_reg, buffer, (wcount)<<1)
28
29/* On sparc, I/O ports and MMIO registers are accessed identically. */
30#define __ide_mm_insw __ide_insw
31#define __ide_mm_insl __ide_insl
32#define __ide_mm_outsw __ide_outsw
33#define __ide_mm_outsl __ide_outsl
34
35static __inline__ void __ide_insw(unsigned long port,
36 void *dst,
37 unsigned long count)
38{
39 volatile unsigned short *data_port;
40 /* unsigned long end = (unsigned long)dst + (count << 1); */ /* P3 */
41 u16 *ps = dst;
42 u32 *pi;
43
44 data_port = (volatile unsigned short *)port;
45
46 if(((unsigned long)ps) & 0x2) {
47 *ps++ = *data_port;
48 count--;
49 }
50 pi = (u32 *)ps;
51 while(count >= 2) {
52 u32 w;
53
54 w = (*data_port) << 16;
55 w |= (*data_port);
56 *pi++ = w;
57 count -= 2;
58 }
59 ps = (u16 *)pi;
60 if(count)
61 *ps++ = *data_port;
62
63 /* __flush_dcache_range((unsigned long)dst, end); */ /* P3 see hme */
64}
65
66static __inline__ void __ide_outsw(unsigned long port,
67 const void *src,
68 unsigned long count)
69{
70 volatile unsigned short *data_port;
71 /* unsigned long end = (unsigned long)src + (count << 1); */
72 const u16 *ps = src;
73 const u32 *pi;
74
75 data_port = (volatile unsigned short *)port;
76
77 if(((unsigned long)src) & 0x2) {
78 *data_port = *ps++;
79 count--;
80 }
81 pi = (const u32 *)ps;
82 while(count >= 2) {
83 u32 w;
84
85 w = *pi++;
86 *data_port = (w >> 16);
87 *data_port = w;
88 count -= 2;
89 }
90 ps = (const u16 *)pi;
91 if(count)
92 *data_port = *ps;
93
94 /* __flush_dcache_range((unsigned long)src, end); */ /* P3 see hme */
95}
96
97#endif /* __KERNEL__ */
98
99#endif /* _SPARC_IDE_H */