aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-h8300.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/ide-h8300.c')
-rw-r--r--drivers/ide/ide-h8300.c101
1 files changed, 2 insertions, 99 deletions
diff --git a/drivers/ide/ide-h8300.c b/drivers/ide/ide-h8300.c
index dac9a6d44963..c06ebdc4a130 100644
--- a/drivers/ide/ide-h8300.c
+++ b/drivers/ide/ide-h8300.c
@@ -22,103 +22,6 @@
22 (r); \ 22 (r); \
23}) 23})
24 24
25static void mm_outw(u16 d, unsigned long a)
26{
27 __asm__("mov.b %w0,r2h\n\t"
28 "mov.b %x0,r2l\n\t"
29 "mov.w r2,@%1"
30 :
31 :"r"(d),"r"(a)
32 :"er2");
33}
34
35static u16 mm_inw(unsigned long a)
36{
37 register u16 r __asm__("er0");
38 __asm__("mov.w @%1,r2\n\t"
39 "mov.b r2l,%x0\n\t"
40 "mov.b r2h,%w0"
41 :"=r"(r)
42 :"r"(a)
43 :"er2");
44 return r;
45}
46
47static void h8300_tf_load(ide_drive_t *drive, struct ide_cmd *cmd)
48{
49 ide_hwif_t *hwif = drive->hwif;
50 struct ide_io_ports *io_ports = &hwif->io_ports;
51 struct ide_taskfile *tf = &cmd->tf;
52 u8 HIHI = (cmd->tf_flags & IDE_TFLAG_LBA48) ? 0xE0 : 0xEF;
53
54 if (cmd->ftf_flags & IDE_FTFLAG_FLAGGED)
55 HIHI = 0xFF;
56
57 if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE)
58 outb(tf->hob_feature, io_ports->feature_addr);
59 if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_NSECT)
60 outb(tf->hob_nsect, io_ports->nsect_addr);
61 if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAL)
62 outb(tf->hob_lbal, io_ports->lbal_addr);
63 if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAM)
64 outb(tf->hob_lbam, io_ports->lbam_addr);
65 if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAH)
66 outb(tf->hob_lbah, io_ports->lbah_addr);
67
68 if (cmd->tf_flags & IDE_TFLAG_OUT_FEATURE)
69 outb(tf->feature, io_ports->feature_addr);
70 if (cmd->tf_flags & IDE_TFLAG_OUT_NSECT)
71 outb(tf->nsect, io_ports->nsect_addr);
72 if (cmd->tf_flags & IDE_TFLAG_OUT_LBAL)
73 outb(tf->lbal, io_ports->lbal_addr);
74 if (cmd->tf_flags & IDE_TFLAG_OUT_LBAM)
75 outb(tf->lbam, io_ports->lbam_addr);
76 if (cmd->tf_flags & IDE_TFLAG_OUT_LBAH)
77 outb(tf->lbah, io_ports->lbah_addr);
78
79 if (cmd->tf_flags & IDE_TFLAG_OUT_DEVICE)
80 outb((tf->device & HIHI) | drive->select,
81 io_ports->device_addr);
82}
83
84static void h8300_tf_read(ide_drive_t *drive, struct ide_cmd *cmd)
85{
86 ide_hwif_t *hwif = drive->hwif;
87 struct ide_io_ports *io_ports = &hwif->io_ports;
88 struct ide_taskfile *tf = &cmd->tf;
89
90 /* be sure we're looking at the low order bits */
91 outb(ATA_DEVCTL_OBS, io_ports->ctl_addr);
92
93 if (cmd->tf_flags & IDE_TFLAG_IN_ERROR)
94 tf->error = inb(io_ports->feature_addr);
95 if (cmd->tf_flags & IDE_TFLAG_IN_NSECT)
96 tf->nsect = inb(io_ports->nsect_addr);
97 if (cmd->tf_flags & IDE_TFLAG_IN_LBAL)
98 tf->lbal = inb(io_ports->lbal_addr);
99 if (cmd->tf_flags & IDE_TFLAG_IN_LBAM)
100 tf->lbam = inb(io_ports->lbam_addr);
101 if (cmd->tf_flags & IDE_TFLAG_IN_LBAH)
102 tf->lbah = inb(io_ports->lbah_addr);
103 if (cmd->tf_flags & IDE_TFLAG_IN_DEVICE)
104 tf->device = inb(io_ports->device_addr);
105
106 if (cmd->tf_flags & IDE_TFLAG_LBA48) {
107 outb(ATA_HOB | ATA_DEVCTL_OBS, io_ports->ctl_addr);
108
109 if (cmd->tf_flags & IDE_TFLAG_IN_HOB_ERROR)
110 tf->hob_error = inb(io_ports->feature_addr);
111 if (cmd->tf_flags & IDE_TFLAG_IN_HOB_NSECT)
112 tf->hob_nsect = inb(io_ports->nsect_addr);
113 if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAL)
114 tf->hob_lbal = inb(io_ports->lbal_addr);
115 if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAM)
116 tf->hob_lbam = inb(io_ports->lbam_addr);
117 if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAH)
118 tf->hob_lbah = inb(io_ports->lbah_addr);
119 }
120}
121
122static void mm_outsw(unsigned long addr, void *buf, u32 len) 25static void mm_outsw(unsigned long addr, void *buf, u32 len)
123{ 26{
124 unsigned short *bp = (unsigned short *)buf; 27 unsigned short *bp = (unsigned short *)buf;
@@ -152,8 +55,8 @@ static const struct ide_tp_ops h8300_tp_ops = {
152 .write_devctl = ide_write_devctl, 55 .write_devctl = ide_write_devctl,
153 56
154 .dev_select = ide_dev_select, 57 .dev_select = ide_dev_select,
155 .tf_load = h8300_tf_load, 58 .tf_load = ide_tf_load,
156 .tf_read = h8300_tf_read, 59 .tf_read = ide_tf_read,
157 60
158 .input_data = h8300_input_data, 61 .input_data = h8300_input_data,
159 .output_data = h8300_output_data, 62 .output_data = h8300_output_data,