1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
/*
* Copyright (c) 2000 Linus Torvalds & authors
*/
/*
* Authors: Petr Soucek <petr@ryston.cz>
* Samuel Thibault <samuel.thibault@ens-lyon.org>
*/
/* truncates a in [b,c] */
#define IDE_IN(a,b,c) ( ((a)<(b)) ? (b) : ( (a)>(c) ? (c) : (a)) )
#define IDE_IMPLY(a,b) ((!(a)) || (b))
#define QD_TIM1_PORT (base)
#define QD_CONFIG_PORT (base+0x01)
#define QD_TIM2_PORT (base+0x02)
#define QD_CONTROL_PORT (base+0x03)
#define QD_CONFIG_IDE_BASEPORT 0x01
#define QD_CONFIG_BASEPORT 0x02
#define QD_CONFIG_ID3 0x04
#define QD_CONFIG_DISABLED 0x08
#define QD_CONFIG_QD6500 0xc0
#define QD_CONFIG_QD6580_A 0xa0
#define QD_CONFIG_QD6580_B 0x50
#define QD_CONTR_SEC_DISABLED 0x01
#define QD_ID3 ((config & QD_CONFIG_ID3)!=0)
#define QD_CONFIG(hwif) ((hwif)->config_data & 0x00ff)
static inline u8 QD_TIMING(ide_drive_t *drive)
{
return (unsigned long)ide_get_drivedata(drive) & 0x00ff;
}
static inline u8 QD_TIMREG(ide_drive_t *drive)
{
return ((unsigned long)ide_get_drivedata(drive) & 0xff00) >> 8;
}
#define QD6500_DEF_DATA ((QD_TIM1_PORT<<8) | (QD_ID3 ? 0x0c : 0x08))
#define QD6580_DEF_DATA ((QD_TIM1_PORT<<8) | (QD_ID3 ? 0x0a : 0x00))
#define QD6580_DEF_DATA2 ((QD_TIM2_PORT<<8) | (QD_ID3 ? 0x0a : 0x00))
#define QD_DEF_CONTR (0x40 | ((control & 0x02) ? 0x9f : 0x1f))
#define QD_TESTVAL 0x19 /* safe value */
/* Drive specific timing taken from DOS driver v3.7 */
static struct qd65xx_timing_s {
s8 offset; /* ofset from the beginning of Model Number" */
char model[4]; /* 4 chars from Model number, no conversion */
s16 active; /* active time */
s16 recovery; /* recovery time */
} qd65xx_timing [] = {
{ 30, "2040", 110, 225 }, /* Conner CP30204 */
{ 30, "2045", 135, 225 }, /* Conner CP30254 */
{ 30, "1040", 155, 325 }, /* Conner CP30104 */
{ 30, "1047", 135, 265 }, /* Conner CP30174 */
{ 30, "5344", 135, 225 }, /* Conner CP3544 */
{ 30, "01 4", 175, 405 }, /* Conner CP-3104 */
{ 27, "C030", 175, 375 }, /* Conner CP3000 */
{ 8, "PL42", 110, 295 }, /* Quantum LP240 */
{ 8, "PL21", 110, 315 }, /* Quantum LP120 */
{ 8, "PL25", 175, 385 }, /* Quantum LP52 */
{ 4, "PA24", 110, 285 }, /* WD Piranha SP4200 */
{ 6, "2200", 110, 260 }, /* WD Caviar AC2200 */
{ 6, "3204", 110, 235 }, /* WD Caviar AC2340 */
{ 6, "1202", 110, 265 }, /* WD Caviar AC2120 */
{ 0, "DS3-", 135, 315 }, /* Teac SD340 */
{ 8, "KM32", 175, 355 }, /* Toshiba MK234 */
{ 2, "53A1", 175, 355 }, /* Seagate ST351A */
{ 2, "4108", 175, 295 }, /* Seagate ST1480A */
{ 2, "1344", 175, 335 }, /* Seagate ST3144A */
{ 6, "7 12", 110, 225 }, /* Maxtor 7213A */
{ 30, "02F4", 145, 295 }, /* Conner 3204F */
{ 2, "1302", 175, 335 }, /* Seagate ST3120A */
{ 2, "2334", 145, 265 }, /* Seagate ST3243A */
{ 2, "2338", 145, 275 }, /* Seagate ST3283A */
{ 2, "3309", #define BLK_TA_DRV_DATA (__BLK_TA_DRV_DATA | BLK_TC_ACT(BLK_TC_DRV_DATA))
#define BLK_TN_PROCESS (__BLK_TN_PROCESS | BLK_TC_ACT(BLK_TC_NOTIFY))
#define BLK_TN_TIMESTAMP (__BLK_TN_TIMESTAMP | BLK_TC_ACT(BLK_TC_NOTIFY))
#define BLK_TN_MESSAGE (__BLK_TN_MESSAGE | BLK_TC_ACT(BLK_TC_NOTIFY))
#define BLK_IO_TRACE_MAGIC 0x65617400
#define BLK_IO_TRACE_VERSION 0x07
/*
* The trace itself
*/
struct blk_io_trace {
__u32 magic; /* MAGIC << 8 | version */
__u32 sequence; /* event number */
__u64 time; /* in microseconds */
__u64 sector; /* disk offset */
__u32 bytes; /* transfer length */
__u32 action; /* what happened */
__u32 pid; /* who did it */
__u32 device; /* device number */
__u32 cpu; /* on what cpu did it happen */
__u16 error; /* completion error */
__u16 pdu_len; /* length of data after this trace */
};
/*
* The remap event
*/
struct blk_io_trace_remap {
__be32 device_from;
__be32 device_to;
__be64 sector_from;
};
enum {
Blktrace_setup = 1,
Blktrace_running,
Blktrace_stopped,
};
#define BLKTRACE_BDEV_SIZE 32
/*
* User setup structure passed with BLKTRACESTART
*/
struct blk_user_trace_setup {
char name[BLKTRACE_BDEV_SIZE]; { 6, "3 04", 135, 265 }, /* Maxtor 340 AT */
{ 6, "61 0", 135, 285 }, /* WD AC160 */
{ 6, "1107", 135, 235 }, /* WD AC1170 */
{ 6, "2101", 110, 220 }, /* WD AC1210 */
{ 6, "4202", 135, 245 }, /* WD AC2420 */
{ 6, "41 0", 175, 355 }, /* WD Caviar 140 */
{ 6, "82 0", 175, 355 }, /* WD Caviar 280 */
{ 8, "PL01", 175, 375 }, /* Quantum LP105 */
{ 8, "PL25", 110, 295 }, /* Quantum LP525 */
{ 10, "4S 2", 175, 385 }, /* Quantum ELS42 */
{ 10, "8S 5", 175, 385 }, /* Quantum ELS85 */
{ 10, "1S72", 175, 385 }, /* Quantum ELS127 */
{ 10, "1S07", 175, 385 }, /* Quantum ELS170 */
{ 8, "ZE42", 135, 295 }, /* Quantum EZ240 */
{ 8, "ZE21", 175, extern int
{ 8, "ZE58", 175, 385 }, /* Quantum EZ85 */
{ 8, "ZE24",
extern int blk_trace_startstop({ 27, "C036", 155, 325 }, /* Conner CP30064 */
{ 27, "C038", 155, 325 }, /* Conner CP30084 */
{ 6, "2205", 110, 255 }, /* WDC AC2250 */
{
#else /* !CONFIG_BLK_DEV_IO_TRACE */
# define blk_trace_ioctl(bdev, cmd, arg) (-ENOTTY)
# define blk_trace_shutdown(q) do { } while (0)
# define do_blk_trace_setup(q, name, dev, bdev, buts) (-ENOTTY)
# define blk_add_driver_data(q, rq, data, len) do {} while (0)
# define blk_trace_setup(q, name, dev, bdev, arg) (-ENOTTY)
# define blk_trace_startstop(q, start) (-ENOTTY)
# define blk_trace_remove(q) (-ENOTTY)
# define blk_add_trace_msg(q, fmt, ...) do { } while (0)
# define blk_trace_remove_sysfs(dev) do { } while (0)
static inline int blk_trace_init_sysfs(struct device *dev)
{
return 0;
}
#endif /* CONFIG_BLK_DEV_IO_TRACE */
#ifdef CONFIG_COMPAT
struct compat_blk_user_trace_setup {
char name[32];
u16 act_mask;
u32 buf_size;
u32 buf_nr;
compat_u64 start_lba;
compat_u64 end_lba;
u32 pid;
};
#define BLKTRACESETUP32 _IOWR(0x12, 115, struct compat_blk_user_trace_setup)
#endif
#if defined(CONFIG_EVENT_TRACING) && defined(CONFIG_BLOCK)
static inline int blk_cmd_buf_len(struct request *rq)
{
return (rq->cmd_type == REQ_TYPE_BLOCK_PC) ? rq->cmd_len * 3 : 1;
}
extern void blk_dump_cmd(char *buf, struct request *rq);
extern void blk_fill_rwbs(char *rwbs, u32 rw, int bytes);
extern void blk_fill_rwbs_rq(char *rwbs, struct request *rq);
#endif /* CONFIG_EVENT_TRACING && CONFIG_BLOCK */
#endif /* __KERNEL__ */
#endif
|