diff options
| author | jakllsch <jakllsch@NetBSD.org> | 2010-03-12 19:03:14 +0000 |
|---|---|---|
| committer | jakllsch <jakllsch@NetBSD.org> | 2010-03-12 19:03:14 +0000 |
| commit | 07188f89fa2fd4d26f7be9f932639c8a94f0af7f (patch) | |
| tree | 87d38f30c200e2dbd78f03b7909e543fde79d803 /sys/dev | |
| parent | 0d21743f107613368bc4b68f7092b0a7642f2445 (diff) | |
ata(4) expects IDENTIFY data to be in host endianess.
Logic borrowed from siisata(4) (which I've confirmed works on sparc64).
Should fix PR kern/39659.
Diffstat (limited to 'sys/dev')
| -rw-r--r-- | sys/dev/ic/ahcisata_core.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/sys/dev/ic/ahcisata_core.c b/sys/dev/ic/ahcisata_core.c index 90cbb16ecbd..627b34c85aa 100644 --- a/sys/dev/ic/ahcisata_core.c +++ b/sys/dev/ic/ahcisata_core.c @@ -1,4 +1,4 @@ -/* $NetBSD: ahcisata_core.c,v 1.24 2010/03/10 19:23:57 bouyer Exp $ */ +/* $NetBSD: ahcisata_core.c,v 1.25 2010/03/12 19:03:14 jakllsch Exp $ */ /* * Copyright (c) 2006 Manuel Bouyer. @@ -26,7 +26,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ahcisata_core.c,v 1.24 2010/03/10 19:23:57 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ahcisata_core.c,v 1.25 2010/03/12 19:03:14 jakllsch Exp $"); #include <sys/types.h> #include <sys/malloc.h> @@ -831,6 +831,8 @@ ahci_cmd_done(struct ata_channel *chp, struct ata_xfer *xfer, int slot) struct ahci_softc *sc = (struct ahci_softc *)chp->ch_atac; struct ahci_channel *achp = (struct ahci_channel *)chp; struct ata_command *ata_c = xfer->c_cmd; + uint16_t *idwordbuf; + int i; AHCIDEBUG_PRINT(("ahci_cmd_done channel %d\n", chp->ch_channel), DEBUG_FUNCS); @@ -849,6 +851,15 @@ ahci_cmd_done(struct ata_channel *chp, struct ata_xfer *xfer, int slot) AHCI_CMDH_SYNC(sc, achp, slot, BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); + /* ata(4) expects IDENTIFY data to be in host endianess */ + if (ata_c->r_command == WDCC_IDENTIFY || + ata_c->r_command == ATAPI_IDENTIFY_DEVICE) { + idwordbuf = xfer->c_databuf; + for (i = 0; i < (xfer->c_bcount / sizeof(*idwordbuf)); i++) { + idwordbuf[i] = le16toh(idwordbuf[i]); + } + } + ata_c->flags |= AT_DONE; if (achp->ahcic_cmdh[slot].cmdh_prdbc) ata_c->flags |= AT_XFDONE; |
