Date: Sun, 20 Dec 2009 01:38:21 +0000 (UTC) From: Marius Strobl <marius@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org Subject: svn commit: r200745 - stable/7/sys/dev/ata Message-ID: <200912200138.nBK1cLuk049082@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: marius Date: Sun Dec 20 01:38:21 2009 New Revision: 200745 URL: http://svn.freebsd.org/changeset/base/200745 Log: MFC: r200481 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. Modified: stable/7/sys/dev/ata/atapi-cd.c stable/7/sys/dev/ata/atapi-cd.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/ata/atapi-cd.c ============================================================================== --- stable/7/sys/dev/ata/atapi-cd.c Sun Dec 20 01:38:01 2009 (r200744) +++ stable/7/sys/dev/ata/atapi-cd.c Sun Dec 20 01:38:21 2009 (r200745) @@ -1211,6 +1211,7 @@ acd_read_track_info(device_t dev, int32_ 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); @@ -1649,12 +1650,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); } } } Modified: stable/7/sys/dev/ata/atapi-cd.h ============================================================================== --- stable/7/sys/dev/ata/atapi-cd.h Sun Dec 20 01:38:01 2009 (r200744) +++ stable/7/sys/dev/ata/atapi-cd.h Sun Dec 20 01:38:21 2009 (r200745) @@ -112,34 +112,34 @@ struct cappage { u_int8_t param_len; u_int16_t media; -#define MST_READ_CDR 0x0001 -#define MST_READ_CDRW 0x0002 -#define MST_READ_PACKET 0x0004 -#define MST_READ_DVDROM 0x0008 -#define MST_READ_DVDR 0x0010 -#define MST_READ_DVDRAM 0x0020 -#define MST_WRITE_CDR 0x0100 -#define MST_WRITE_CDRW 0x0200 -#define MST_WRITE_TEST 0x0400 -#define MST_WRITE_DVDR 0x1000 -#define MST_WRITE_DVDRAM 0x2000 +#define MST_READ_CDR 0x0100 +#define MST_READ_CDRW 0x0200 +#define MST_READ_PACKET 0x0400 +#define MST_READ_DVDROM 0x0800 +#define MST_READ_DVDR 0x1000 +#define MST_READ_DVDRAM 0x2000 +#define MST_WRITE_CDR 0x0001 +#define MST_WRITE_CDRW 0x0002 +#define MST_WRITE_TEST 0x0004 +#define MST_WRITE_DVDR 0x0010 +#define MST_WRITE_DVDRAM 0x0020 u_int16_t capabilities; -#define MST_AUDIO_PLAY 0x0001 -#define MST_COMPOSITE 0x0002 -#define MST_AUDIO_P1 0x0004 -#define MST_AUDIO_P2 0x0008 -#define MST_MODE2_f1 0x0010 -#define MST_MODE2_f2 0x0020 -#define MST_MULTISESSION 0x0040 -#define MST_BURNPROOF 0x0080 -#define MST_READ_CDDA 0x0100 -#define MST_CDDA_STREAM 0x0200 -#define MST_COMBINED_RW 0x0400 -#define MST_CORRECTED_RW 0x0800 -#define MST_SUPPORT_C2 0x1000 -#define MST_ISRC 0x2000 -#define MST_UPC 0x4000 +#define MST_AUDIO_PLAY 0x0100 +#define MST_COMPOSITE 0x0200 +#define MST_AUDIO_P1 0x0400 +#define MST_AUDIO_P2 0x0800 +#define MST_MODE2_f1 0x1000 +#define MST_MODE2_f2 0x2000 +#define MST_MULTISESSION 0x4000 +#define MST_BURNPROOF 0x8000 +#define MST_READ_CDDA 0x0001 +#define MST_CDDA_STREAM 0x0002 +#define MST_COMBINED_RW 0x0004 +#define MST_CORRECTED_RW 0x0008 +#define MST_SUPPORT_C2 0x0010 +#define MST_ISRC 0x0020 +#define MST_UPC 0x0040 u_int8_t mechanism; #define MST_LOCKABLE 0x01
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200912200138.nBK1cLuk049082>