version 1.237.2.2, 2007/01/12 00:57:36 |
version 1.237.2.3, 2007/02/01 08:48:21 |
Line 94 __KERNEL_RCSID(0, "$NetBSD$"); |
|
Line 94 __KERNEL_RCSID(0, "$NetBSD$"); |
|
#define bus_space_write_multi_stream_4 bus_space_write_multi_4 |
#define bus_space_write_multi_stream_4 bus_space_write_multi_4 |
#define bus_space_read_multi_stream_2 bus_space_read_multi_2 |
#define bus_space_read_multi_stream_2 bus_space_read_multi_2 |
#define bus_space_read_multi_stream_4 bus_space_read_multi_4 |
#define bus_space_read_multi_stream_4 bus_space_read_multi_4 |
|
#define bus_space_read_stream_2 bus_space_read_2 |
|
#define bus_space_read_stream_4 bus_space_read_4 |
|
#define bus_space_write_stream_2 bus_space_write_2 |
|
#define bus_space_write_stream_4 bus_space_write_4 |
#endif /* __BUS_SPACE_HAS_STREAM_METHODS */ |
#endif /* __BUS_SPACE_HAS_STREAM_METHODS */ |
|
|
#include <dev/ata/atavar.h> |
#include <dev/ata/atavar.h> |
Line 1814 wdc_datain_pio(struct ata_channel *chp, |
|
Line 1818 wdc_datain_pio(struct ata_channel *chp, |
|
{ |
{ |
struct wdc_regs *wdr = CHAN_TO_WDC_REGS(chp); |
struct wdc_regs *wdr = CHAN_TO_WDC_REGS(chp); |
|
|
|
#ifndef __NO_STRICT_ALIGNMENT |
|
if ((uintptr_t)bf & 1) |
|
goto unaligned; |
|
if ((flags & DRIVE_CAP32) && ((uintptr_t)bf & 3)) |
|
goto unaligned; |
|
#endif |
|
|
if (flags & DRIVE_NOSTREAM) { |
if (flags & DRIVE_NOSTREAM) { |
if (flags & DRIVE_CAP32) { |
if (flags & DRIVE_CAP32) { |
bus_space_read_multi_4(wdr->data32iot, |
bus_space_read_multi_4(wdr->data32iot, |
Line 1837 wdc_datain_pio(struct ata_channel *chp, |
|
Line 1848 wdc_datain_pio(struct ata_channel *chp, |
|
wdr->cmd_iohs[wd_data], 0, bf, len >> 1); |
wdr->cmd_iohs[wd_data], 0, bf, len >> 1); |
} |
} |
} |
} |
|
return; |
|
|
|
#ifndef __NO_STRICT_ALIGNMENT |
|
unaligned: |
|
if (flags & DRIVE_NOSTREAM) { |
|
if (flags & DRIVE_CAP32) { |
|
while (len > 3) { |
|
uint32_t val; |
|
|
|
val = bus_space_read_4(wdr->data32iot, |
|
wdr->data32ioh, 0); |
|
memcpy(bf, &val, 4); |
|
bf = (char *)bf + 4; |
|
len -= 4; |
|
} |
|
} |
|
while (len > 1) { |
|
uint16_t val; |
|
|
|
val = bus_space_read_2(wdr->cmd_iot, |
|
wdr->cmd_iohs[wd_data], 0); |
|
memcpy(bf, &val, 2); |
|
bf = (char *)bf + 2; |
|
len -= 2; |
|
} |
|
} else { |
|
if (flags & DRIVE_CAP32) { |
|
while (len > 3) { |
|
uint32_t val; |
|
|
|
val = bus_space_read_stream_4(wdr->data32iot, |
|
wdr->data32ioh, 0); |
|
memcpy(bf, &val, 4); |
|
bf = (char *)bf + 4; |
|
len -= 4; |
|
} |
|
} |
|
while (len > 1) { |
|
uint16_t val; |
|
|
|
val = bus_space_read_stream_2(wdr->cmd_iot, |
|
wdr->cmd_iohs[wd_data], 0); |
|
memcpy(bf, &val, 2); |
|
bf = (char *)bf + 2; |
|
len -= 2; |
|
} |
|
} |
|
#endif |
} |
} |
|
|
static void |
static void |
Line 1844 wdc_dataout_pio(struct ata_channel *chp, |
|
Line 1903 wdc_dataout_pio(struct ata_channel *chp, |
|
{ |
{ |
struct wdc_regs *wdr = CHAN_TO_WDC_REGS(chp); |
struct wdc_regs *wdr = CHAN_TO_WDC_REGS(chp); |
|
|
|
#ifndef __NO_STRICT_ALIGNMENT |
|
if ((uintptr_t)bf & 1) |
|
goto unaligned; |
|
if ((flags & DRIVE_CAP32) && ((uintptr_t)bf & 3)) |
|
goto unaligned; |
|
#endif |
|
|
if (flags & DRIVE_NOSTREAM) { |
if (flags & DRIVE_NOSTREAM) { |
if (flags & DRIVE_CAP32) { |
if (flags & DRIVE_CAP32) { |
bus_space_write_multi_4(wdr->data32iot, |
bus_space_write_multi_4(wdr->data32iot, |
Line 1867 wdc_dataout_pio(struct ata_channel *chp, |
|
Line 1933 wdc_dataout_pio(struct ata_channel *chp, |
|
wdr->cmd_iohs[wd_data], 0, bf, len >> 1); |
wdr->cmd_iohs[wd_data], 0, bf, len >> 1); |
} |
} |
} |
} |
|
return; |
|
|
|
#ifndef __NO_STRICT_ALIGNMENT |
|
unaligned: |
|
if (flags & DRIVE_NOSTREAM) { |
|
if (flags & DRIVE_CAP32) { |
|
while (len > 3) { |
|
uint32_t val; |
|
|
|
memcpy(&val, bf, 4); |
|
bus_space_write_4(wdr->data32iot, |
|
wdr->data32ioh, 0, val); |
|
bf = (char *)bf + 4; |
|
len -= 4; |
|
} |
|
} |
|
while (len > 1) { |
|
uint16_t val; |
|
|
|
memcpy(&val, bf, 2); |
|
bus_space_write_2(wdr->cmd_iot, |
|
wdr->cmd_iohs[wd_data], 0, val); |
|
bf = (char *)bf + 2; |
|
len -= 2; |
|
} |
|
} else { |
|
if (flags & DRIVE_CAP32) { |
|
while (len > 3) { |
|
uint32_t val; |
|
|
|
memcpy(&val, bf, 4); |
|
bus_space_write_stream_4(wdr->data32iot, |
|
wdr->data32ioh, 0, val); |
|
bf = (char *)bf + 4; |
|
len -= 4; |
|
} |
|
} |
|
while (len > 1) { |
|
uint16_t val; |
|
|
|
memcpy(&val, bf, 2); |
|
bus_space_write_stream_2(wdr->cmd_iot, |
|
wdr->cmd_iohs[wd_data], 0, val); |
|
bf = (char *)bf + 2; |
|
len -= 2; |
|
} |
|
} |
|
#endif |
} |
} |