1 diff -ur linux-2.2.19ide/include/asm-sparc/hdreg.h linux/include/asm-sparc/hdreg.h
2 --- linux-2.2.19ide/include/asm-sparc/hdreg.h Thu Oct 11 15:56:53 2001
3 +++ linux/include/asm-sparc/hdreg.h Thu Oct 11 15:26:21 2001
6 + * hdreg.h: SPARC specific IDE glue.
8 + * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu)
9 + * Copyright (C) 1998 Eddie C. Dost (ecd@skynet.be)
12 +#ifndef __SPARC_HDREG_H
13 +#define __SPARC_HDREG_H
15 +typedef unsigned long ide_ioreg_t;
17 +#endif /* __SPARC_HDREG_H */
18 diff -ur linux-2.2.19ide/include/asm-sparc/ide.h linux/include/asm-sparc/ide.h
19 --- linux-2.2.19ide/include/asm-sparc/ide.h Thu Oct 11 15:56:41 2001
20 +++ linux/include/asm-sparc/ide.h Thu Oct 11 15:51:00 2001
23 + * ide.h: SPARC specific IDE glue.
25 + * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu)
26 + * Copyright (C) 1998 Eddie C. Dost (ecd@skynet.be)
34 +#include <asm/pgtable.h>
35 +#include <asm/hdreg.h>
40 +#define ide__sti() __sti()
42 +static __inline__ int ide_default_irq(ide_ioreg_t base)
47 +static __inline__ ide_ioreg_t ide_default_io_base(int index)
52 +static __inline__ void ide_init_hwif_ports(hw_regs_t *hw, ide_ioreg_t data_port, ide_ioreg_t ctrl_port, int *irq)
54 + ide_ioreg_t reg = data_port;
57 + for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) {
58 + hw->io_ports[i] = reg;
62 + hw->io_ports[IDE_CONTROL_OFFSET] = ctrl_port;
64 + hw->io_ports[IDE_CONTROL_OFFSET] = 0;
71 + * This registers the standard ports for this architecture with the IDE
74 +static __inline__ void ide_init_default_hwifs(void)
76 +#ifndef CONFIG_BLK_DEV_IDEPCI
80 + for (index = 0; index < MAX_HWIFS; index++) {
81 + ide_init_hwif_ports(&hw, ide_default_io_base(index), 0, 0);
82 + hw.irq = ide_default_irq(ide_default_io_base(index));
83 + ide_register_hw(&hw, NULL);
85 +#endif /* CONFIG_BLK_DEV_IDEPCI */
89 + unsigned int all : 8; /* all of the bits together */
91 + unsigned int bit7 : 1;
92 + unsigned int lba : 1;
93 + unsigned int bit5 : 1;
94 + unsigned int unit : 1;
95 + unsigned int head : 4;
99 +static __inline__ int ide_request_irq(unsigned int irq,
100 + void (*handler)(int, void *, struct pt_regs *),
101 + unsigned long flags, const char *name, void *devid)
103 + return request_irq(irq, handler, SA_SHIRQ, name, devid);
106 +static __inline__ void ide_free_irq(unsigned int irq, void *dev_id)
108 + free_irq(irq, dev_id);
111 +static __inline__ int ide_check_region(ide_ioreg_t base, unsigned int size)
113 + return check_region(base, size);
116 +static __inline__ void ide_request_region(ide_ioreg_t base, unsigned int size,
119 + request_region(base, size, name);
122 +static __inline__ void ide_release_region(ide_ioreg_t base, unsigned int size)
124 + release_region(base, size);
127 +#undef SUPPORT_SLOW_DATA_PORTS
128 +#define SUPPORT_SLOW_DATA_PORTS 0
130 +#undef SUPPORT_VLB_SYNC
131 +#define SUPPORT_VLB_SYNC 0
134 +#define HD_DATA ((ide_ioreg_t)0)
136 +/* From m68k code... */
151 +#define insl(data_reg, buffer, wcount) insw(data_reg, buffer, (wcount)<<1)
152 +#define outsl(data_reg, buffer, wcount) outsw(data_reg, buffer, (wcount)<<1)
154 +#define insw(port, buf, nr) ide_insw((port), (buf), (nr))
155 +#define outsw(port, buf, nr) ide_outsw((port), (buf), (nr))
157 +static __inline__ void ide_insw(unsigned long port,
159 + unsigned long count)
161 + volatile unsigned short *data_port;
162 + unsigned long end = (unsigned long)dst + (count << 1);
166 + data_port = (volatile unsigned short *)port;
168 + if(((u32)ps) & 0x2) {
169 + *ps++ = *data_port;
173 + while(count >= 2) {
176 + w = (*data_port) << 16;
183 + *ps++ = *data_port;
186 +static __inline__ void ide_outsw(unsigned long port,
188 + unsigned long count)
190 + volatile unsigned short *data_port;
191 + unsigned long end = (unsigned long)src + (count << 1);
192 + const u16 *ps = src;
195 + data_port = (volatile unsigned short *)port;
197 + if(((u32)src) & 0x2) {
198 + *data_port = *ps++;
201 + pi = (const u32 *)ps;
202 + while(count >= 2) {
206 + *data_port = (w >> 16);
210 + ps = (const u16 *)pi;
214 + __flush_dcache_range((unsigned long)src, end);
217 +#define T_CHAR (0x0000) /* char: don't touch */
218 +#define T_SHORT (0x4000) /* short: 12 -> 21 */
219 +#define T_INT (0x8000) /* int: 1234 -> 4321 */
220 +#define T_TEXT (0xc000) /* text: 12 -> 21 */
222 +#define T_MASK_TYPE (0xc000)
223 +#define T_MASK_COUNT (0x3fff)
225 +#define D_CHAR(cnt) (T_CHAR | (cnt))
226 +#define D_SHORT(cnt) (T_SHORT | (cnt))
227 +#define D_INT(cnt) (T_INT | (cnt))
228 +#define D_TEXT(cnt) (T_TEXT | (cnt))
230 +static u_short driveid_types[] = {
231 + D_SHORT(10), /* config - vendor2 */
232 + D_TEXT(20), /* serial_no */
233 + D_SHORT(3), /* buf_type - ecc_bytes */
234 + D_TEXT(48), /* fw_rev - model */
235 + D_CHAR(2), /* max_multsect - vendor3 */
236 + D_SHORT(1), /* dword_io */
237 + D_CHAR(2), /* vendor4 - capability */
238 + D_SHORT(1), /* reserved50 */
239 + D_CHAR(4), /* vendor5 - tDMA */
240 + D_SHORT(4), /* field_valid - cur_sectors */
241 + D_INT(1), /* cur_capacity */
242 + D_CHAR(2), /* multsect - multsect_valid */
243 + D_INT(1), /* lba_capacity */
244 + D_SHORT(194) /* dma_1word - reservedyy */
247 +#define num_driveid_types (sizeof(driveid_types)/sizeof(*driveid_types))
249 +static __inline__ void ide_fix_driveid(struct hd_driveid *id)
251 + u_char *p = (u_char *)id;
255 + for (i = 0; i < num_driveid_types; i++) {
256 + cnt = driveid_types[i] & T_MASK_COUNT;
257 + switch (driveid_types[i] & T_MASK_TYPE) {
262 + for (j = 0; j < cnt; j++) {
270 + for (j = 0; j < cnt; j++) {
281 + for (j = 0; j < cnt; j += 2) {
293 + * The following are not needed for the non-m68k ports
295 +#define ide_ack_intr(hwif) (1)
296 +#define ide_release_lock(lock) do {} while (0)
297 +#define ide_get_lock(lock, hdlr, data) do {} while (0)
299 +#endif /* __KERNEL__ */
301 +#endif /* _SPARC_IDE_H */