diff options
author | marius <marius@FreeBSD.org> | 2009-12-13 18:26:19 +0000 |
---|---|---|
committer | marius <marius@FreeBSD.org> | 2009-12-13 18:26:19 +0000 |
commit | 9b1fbd7dcf305c90301ead415bfa69cb7caab37a (patch) | |
tree | df82df39cc26e99f34a5b658f0466356fa048181 /sys/dev/ata/atapi-cd.c | |
parent | f1fc4c2cca8fecba0b78eac7cad3f77c0b70a3eb (diff) | |
download | FreeBSD-src-9b1fbd7dcf305c90301ead415bfa69cb7caab37a.zip FreeBSD-src-9b1fbd7dcf305c90301ead415bfa69cb7caab37a.tar.gz |
Specify the capability and media bits of the capabilities page in
native, i.e. big-endian, format and convert as appropriate like we
also do with the multibyte fields of the other pages. This fixes
the output of acd_describe() to match reality on big-endian machines
without breaking it on little-endian ones. While at it, also convert
the remaining multibyte fields of the pages read although they are
currently unused for consistency and in order to prevent possible
similar bugs in the future.
MFC after: 1 week
Diffstat (limited to 'sys/dev/ata/atapi-cd.c')
-rw-r--r-- | sys/dev/ata/atapi-cd.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/sys/dev/ata/atapi-cd.c b/sys/dev/ata/atapi-cd.c index 5d0c0f7..7e470ea 100644 --- a/sys/dev/ata/atapi-cd.c +++ b/sys/dev/ata/atapi-cd.c @@ -1206,6 +1206,7 @@ acd_read_track_info(device_t dev, int32_t lba, struct acd_track_info *info) if ((error = ata_atapicmd(dev, ccb, (caddr_t)info, sizeof(*info), ATA_R_READ, 30))) return error; + info->data_length = ntohs(info->data_length); info->track_start_addr = ntohl(info->track_start_addr); info->next_writeable_addr = ntohl(info->next_writeable_addr); info->free_blocks = ntohl(info->free_blocks); @@ -1644,12 +1645,17 @@ acd_get_cap(device_t dev) for (count = 0 ; count < 5 ; count++) { if (!ata_atapicmd(dev, ccb, (caddr_t)&cdp->cap, sizeof(cdp->cap), ATA_R_READ | ATA_R_QUIET, 5)) { + cdp->cap.data_length = ntohs(cdp->cap.data_length); + cdp->cap.blk_desc_len = ntohs(cdp->cap.blk_desc_len); + cdp->cap.media = ntohs(cdp->cap.media); + cdp->cap.capabilities = ntohs(cdp->cap.capabilities); cdp->cap.max_read_speed = ntohs(cdp->cap.max_read_speed); + cdp->cap.max_vol_levels = ntohs(cdp->cap.max_vol_levels); + cdp->cap.buf_size = ntohs(cdp->cap.buf_size); cdp->cap.cur_read_speed = ntohs(cdp->cap.cur_read_speed); cdp->cap.max_write_speed = ntohs(cdp->cap.max_write_speed); cdp->cap.cur_write_speed = max(ntohs(cdp->cap.cur_write_speed),177); - cdp->cap.max_vol_levels = ntohs(cdp->cap.max_vol_levels); - cdp->cap.buf_size = ntohs(cdp->cap.buf_size); + cdp->cap.copy_protect_rev = ntohs(cdp->cap.copy_protect_rev); } } } |