CVS commit: src/sys/dev/ic

"Jason R Thorpe" <[email protected]> Fri, 7 Aug 2026 02:25:54 +0000
Newsgroups gmane.os.netbsd.devel.cvs
Message-ID <[email protected]>
Module Name:	src
Committed By:	thorpej
Date:		Fri Aug  7 02:25:54 UTC 2026

Modified Files:
	src/sys/dev/ic: wdc.c

Log Message:
Deal with the absolutely pathological handling of the IDENTIFY command
on big-endian systems.

In wdc_datain_pio(), in the ATA_DRIVE_NOSTREAM case, if the bus.h
implementation does does not have __BUS_SPACE_HAS_STREAM_METHODS
and the system is _BIG_ENDIAN, individually swap each 16-bit value
rather than assuming the bus_space_read_*2() implementation will do
it.

This is necessary because IDENTIFY is treated differently than every
other command; all callers assume it will be returned in host-order,
when in reality it's an array of 256 16-bit little-endian integers (even
the string fields).

Ultimately, the correct fix is to stop special-casing IDENTIFY, but
that is a much larger change due to the confusing array of flags that
control I/O size and disposition, and requires much wider testing.


To generate a diff of this commit:
cvs rdiff -u -r1.315 -r1.316 src/sys/dev/ic/wdc.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.