aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/ide/h8300/ide-h8300.c88
1 files changed, 88 insertions, 0 deletions
diff --git a/drivers/ide/h8300/ide-h8300.c b/drivers/ide/h8300/ide-h8300.c
index b5d6508d39bb..6bd143cf0891 100644
--- a/drivers/ide/h8300/ide-h8300.c
+++ b/drivers/ide/h8300/ide-h8300.c
@@ -42,6 +42,91 @@ static u16 mm_inw(unsigned long a)
42 return r; 42 return r;
43} 43}
44 44
45static void h8300_tf_load(ide_drive_t *drive, ide_task_t *task)
46{
47 ide_hwif_t *hwif = drive->hwif;
48 struct ide_io_ports *io_ports = &hwif->io_ports;
49 struct ide_taskfile *tf = &task->tf;
50 u8 HIHI = (task->tf_flags & IDE_TFLAG_LBA48) ? 0xE0 : 0xEF;
51
52 if (task->tf_flags & IDE_TFLAG_FLAGGED)
53 HIHI = 0xFF;
54
55 ide_set_irq(drive, 1);
56
57 if (task->tf_flags & IDE_TFLAG_OUT_DATA)
58 mm_outw((tf->hob_data << 8) | tf->data, io_ports->data_addr);
59
60 if (task->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE)
61 outb(tf->hob_feature, io_ports->feature_addr);
62 if (task->tf_flags & IDE_TFLAG_OUT_HOB_NSECT)
63 outb(tf->hob_nsect, io_ports->nsect_addr);
64 if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAL)
65 outb(tf->hob_lbal, io_ports->lbal_addr);
66 if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAM)
67 outb(tf->hob_lbam, io_ports->lbam_addr);
68 if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAH)
69 outb(tf->hob_lbah, io_ports->lbah_addr);
70
71 if (task->tf_flags & IDE_TFLAG_OUT_FEATURE)
72 outb(tf->feature, io_ports->feature_addr);
73 if (task->tf_flags & IDE_TFLAG_OUT_NSECT)
74 outb(tf->nsect, io_ports->nsect_addr);
75 if (task->tf_flags & IDE_TFLAG_OUT_LBAL)
76 outb(tf->lbal, io_ports->lbal_addr);
77 if (task->tf_flags & IDE_TFLAG_OUT_LBAM)
78 outb(tf->lbam, io_ports->lbam_addr);
79 if (task->tf_flags & IDE_TFLAG_OUT_LBAH)
80 outb(tf->lbah, io_ports->lbah_addr);
81
82 if (task->tf_flags & IDE_TFLAG_OUT_DEVICE)
83 outb((tf->device & HIHI) | drive->select.all,
84 io_ports->device_addr);
85}
86
87static void h8300_tf_read(ide_drive_t *drive, ide_task_t *task)
88{
89 ide_hwif_t *hwif = drive->hwif;
90 struct ide_io_ports *io_ports = &hwif->io_ports;
91 struct ide_taskfile *tf = &task->tf;
92
93 if (task->tf_flags & IDE_TFLAG_IN_DATA) {
94 u16 data = mm_inw(io_ports->data_addr);
95
96 tf->data = data & 0xff;
97 tf->hob_data = (data >> 8) & 0xff;
98 }
99
100 /* be sure we're looking at the low order bits */
101 outb(drive->ctl & ~0x80, io_ports->ctl_addr);
102
103 if (task->tf_flags & IDE_TFLAG_IN_NSECT)
104 tf->nsect = inb(io_ports->nsect_addr);
105 if (task->tf_flags & IDE_TFLAG_IN_LBAL)
106 tf->lbal = inb(io_ports->lbal_addr);
107 if (task->tf_flags & IDE_TFLAG_IN_LBAM)
108 tf->lbam = inb(io_ports->lbam_addr);
109 if (task->tf_flags & IDE_TFLAG_IN_LBAH)
110 tf->lbah = inb(io_ports->lbah_addr);
111 if (task->tf_flags & IDE_TFLAG_IN_DEVICE)
112 tf->device = inb(io_ports->device_addr);
113
114 if (task->tf_flags & IDE_TFLAG_LBA48) {
115 outb(drive->ctl | 0x80, io_ports->ctl_addr);
116
117 if (task->tf_flags & IDE_TFLAG_IN_HOB_FEATURE)
118 tf->hob_feature = inb(io_ports->feature_addr);
119 if (task->tf_flags & IDE_TFLAG_IN_HOB_NSECT)
120 tf->hob_nsect = inb(io_ports->nsect_addr);
121 if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAL)
122 tf->hob_lbal = inb(io_ports->lbal_addr);
123 if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAM)
124 tf->hob_lbam = inb(io_ports->lbam_addr);
125 if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAH)
126 tf->hob_lbah = inb(io_ports->lbah_addr);
127 }
128}
129
45static void mm_outsw(unsigned long addr, void *buf, u32 len) 130static void mm_outsw(unsigned long addr, void *buf, u32 len)
46{ 131{
47 unsigned short *bp = (unsigned short *)buf; 132 unsigned short *bp = (unsigned short *)buf;
@@ -86,6 +171,9 @@ static inline void hwif_setup(ide_hwif_t *hwif)
86{ 171{
87 default_hwif_iops(hwif); 172 default_hwif_iops(hwif);
88 173
174 hwif->tf_load = h8300_tf_load;
175 hwif->tf_read = h8300_tf_read;
176
89 hwif->input_data = h8300_input_data; 177 hwif->input_data = h8300_input_data;
90 hwif->output_data = h8300_output_data; 178 hwif->output_data = h8300_output_data;
91 179