OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [linux-2.4/] [drivers/] [block/] [xd.h] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1275 phoenix
#ifndef _LINUX_XD_H
2
#define _LINUX_XD_H
3
 
4
/*
5
 * This file contains the definitions for the IO ports and errors etc. for XT hard disk controllers (at least the DTC 5150X).
6
 *
7
 * Author: Pat Mackinlay, pat@it.com.au
8
 * Date: 29/09/92
9
 *
10
 * Revised: 01/01/93, ...
11
 *
12
 * Ref: DTC 5150X Controller Specification (thanks to Kevin Fowler, kevinf@agora.rain.com)
13
 * Also thanks to: Salvador Abreu, Dave Thaler, Risto Kankkunen and Wim Van Dorst.
14
 */
15
 
16
/* XT hard disk controller registers */
17
#define XD_DATA         (xd_iobase + 0x00)      /* data RW register */
18
#define XD_RESET        (xd_iobase + 0x01)      /* reset WO register */
19
#define XD_STATUS       (xd_iobase + 0x01)      /* status RO register */
20
#define XD_SELECT       (xd_iobase + 0x02)      /* select WO register */
21
#define XD_JUMPER       (xd_iobase + 0x02)      /* jumper RO register */
22
#define XD_CONTROL      (xd_iobase + 0x03)      /* DMAE/INTE WO register */
23
#define XD_RESERVED     (xd_iobase + 0x03)      /* reserved */
24
 
25
/* XT hard disk controller commands (incomplete list) */
26
#define CMD_TESTREADY   0x00    /* test drive ready */
27
#define CMD_RECALIBRATE 0x01    /* recalibrate drive */
28
#define CMD_SENSE       0x03    /* request sense */
29
#define CMD_FORMATDRV   0x04    /* format drive */
30
#define CMD_VERIFY      0x05    /* read verify */
31
#define CMD_FORMATTRK   0x06    /* format track */
32
#define CMD_FORMATBAD   0x07    /* format bad track */
33
#define CMD_READ        0x08    /* read */
34
#define CMD_WRITE       0x0A    /* write */
35
#define CMD_SEEK        0x0B    /* seek */
36
 
37
/* Controller specific commands */
38
#define CMD_DTCSETPARAM 0x0C    /* set drive parameters (DTC 5150X & CX only?) */
39
#define CMD_DTCGETECC   0x0D    /* get ecc error length (DTC 5150X only?) */
40
#define CMD_DTCREADBUF  0x0E    /* read sector buffer (DTC 5150X only?) */
41
#define CMD_DTCWRITEBUF 0x0F    /* write sector buffer (DTC 5150X only?) */
42
#define CMD_DTCREMAPTRK 0x11    /* assign alternate track (DTC 5150X only?) */
43
#define CMD_DTCGETPARAM 0xFB    /* get drive parameters (DTC 5150X only?) */
44
#define CMD_DTCSETSTEP  0xFC    /* set step rate (DTC 5150X only?) */
45
#define CMD_DTCSETGEOM  0xFE    /* set geometry data (DTC 5150X only?) */
46
#define CMD_DTCGETGEOM  0xFF    /* get geometry data (DTC 5150X only?) */
47
#define CMD_ST11GETGEOM 0xF8    /* get geometry data (Seagate ST11R/M only?) */
48
#define CMD_WDSETPARAM  0x0C    /* set drive parameters (WD 1004A27X only?) */
49
#define CMD_XBSETPARAM  0x0C    /* set drive parameters (XEBEC only?) */
50
 
51
/* Bits for command status byte */
52
#define CSB_ERROR       0x02    /* error */
53
#define CSB_LUN         0x20    /* logical Unit Number */
54
 
55
/* XT hard disk controller status bits */
56
#define STAT_READY      0x01    /* controller is ready */
57
#define STAT_INPUT      0x02    /* data flowing from controller to host */
58
#define STAT_COMMAND    0x04    /* controller in command phase */
59
#define STAT_SELECT     0x08    /* controller is selected */
60
#define STAT_REQUEST    0x10    /* controller requesting data */
61
#define STAT_INTERRUPT  0x20    /* controller requesting interrupt */
62
 
63
/* XT hard disk controller control bits */
64
#define PIO_MODE        0x00    /* control bits to set for PIO */
65
#define DMA_MODE        0x03    /* control bits to set for DMA & interrupt */
66
 
67
#define XD_MAXDRIVES    2       /* maximum 2 drives */
68
#define XD_TIMEOUT      HZ      /* 1 second timeout */
69
#define XD_RETRIES      4       /* maximum 4 retries */
70
 
71
#undef DEBUG                    /* define for debugging output */
72
 
73
#ifdef DEBUG
74
        #define DEBUG_STARTUP   /* debug driver initialisation */
75
        #define DEBUG_OVERRIDE  /* debug override geometry detection */
76
        #define DEBUG_READWRITE /* debug each read/write command */
77
        #define DEBUG_OTHER     /* debug misc. interrupt/DMA stuff */
78
        #define DEBUG_COMMAND   /* debug each controller command */
79
#endif /* DEBUG */
80
 
81
/* this structure defines the XT drives and their types */
82
typedef struct {
83
        u8 heads;
84
        u16 cylinders;
85
        u8 sectors;
86
        u8 control;
87
} XD_INFO;
88
 
89
/* this structure is returned to the HDIO_GETGEO ioctl */
90
typedef struct {
91
        __u8 heads;
92
        __u8 sectors;
93
        __u8 cylinders;
94
        __u32 start;
95
} XD_GEOMETRY;
96
 
97
/* this structure defines a ROM BIOS signature */
98
typedef struct {
99
        unsigned int offset;
100
        const char *string;
101
        void (*init_controller)(unsigned int address);
102
        void (*init_drive)(u8 drive);
103
        const char *name;
104
} XD_SIGNATURE;
105
 
106
#ifndef MODULE
107
static int xd_manual_geo_init (char *command);
108
#endif /* MODULE */
109
static u8 xd_detect (u8 *controller, unsigned int *address);
110
static u8 xd_initdrives (void (*init_drive)(u8 drive));
111
static void xd_geninit (void);
112
 
113
static int xd_open (struct inode *inode,struct file *file);
114
static void do_xd_request (request_queue_t * q);
115
static int xd_ioctl (struct inode *inode,struct file *file,unsigned int cmd,unsigned long arg);
116
static int xd_release (struct inode *inode,struct file *file);
117
static int xd_reread_partitions (kdev_t dev);
118
static int xd_readwrite (u8 operation,u8 drive,char *buffer,u_int block,u_int count);
119
static void xd_recalibrate (u8 drive);
120
 
121
static void xd_interrupt_handler (int irq, void *dev_id, struct pt_regs *regs);
122
static u8 xd_setup_dma (u8 opcode,u8 *buffer,u_int count);
123
static u8 *xd_build (u8 *cmdblk,u8 command,u8 drive,u8 head,u16 cylinder,u8 sector,u8 count,u8 control);
124
static void xd_watchdog (unsigned long unused);
125
static inline u8 xd_waitport (u16 port,u8 flags,u8 mask,unsigned long timeout);
126
static u_int xd_command (u8 *command,u8 mode,u8 *indata,u8 *outdata,u8 *sense,unsigned long timeout);
127
 
128
/* card specific setup and geometry gathering code */
129
static void xd_dtc_init_controller (unsigned int address);
130
static void xd_dtc5150cx_init_drive (u8 drive);
131
static void xd_dtc_init_drive (u8 drive);
132
static void xd_wd_init_controller (unsigned int address);
133
static void xd_wd_init_drive (u8 drive);
134
static void xd_seagate_init_controller (unsigned int address);
135
static void xd_seagate_init_drive (u8 drive);
136
static void xd_omti_init_controller (unsigned int address);
137
static void xd_omti_init_drive (u8 drive);
138
static void xd_xebec_init_controller (unsigned int address);
139
static void xd_xebec_init_drive (u8 drive);
140
static void xd_setparam (u8 command,u8 drive,u8 heads,u16 cylinders,u16 rwrite,u16 wprecomp,u8 ecc);
141
static void xd_override_init_drive (u8 drive);
142
 
143
#endif /* _LINUX_XD_H */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.