1N/A/*************************************************************************** 1N/A * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved. 1N/A * This file is licensed under either the Academic Free License 1N/A * version 2.1 or The GNU General Public License version 2. 1N/A **************************************************************************/ 1N/A#
define GET16(a) (((a)[0] <<
8) | (a)[
1])
1N/A#
define GET32(a) (((a)[0] <<
24) | ((a)[
1] <<
16) | ((a)[
2] <<
8) | (a)[
3])
1N/A * The drive is not ready to recieve commands but 1N/A * may be in the process of becoming ready. 1N/A * sleep for a short time then retry command. 1N/A * ASCQ = 0 Not Reportable. 1N/A * ASCQ = 1 Becoming ready. 1N/A * ASCQ = 4 FORMAT in progress. 1N/A * ASCQ = 7 Operation in progress. 1N/A * Device is not ready to transmit or a device reset 1N/A * has occurred. wait for a short period of time then 1N/A * retry the command. 1N/A * Blank Sense, we don't know what the error is or if 1N/A * the command succeeded, Hope for the best. Some 1N/A * drives return blank sense periodically and will 1N/A * fail if this is removed. 1N/A " sense: %02x ASC: %02x ASCQ:%02x\n",
1N/A * will get the mode page only i.e. will strip off the header. 1N/A /* Ask 254 bytes only to make our IDE driver happy */ 1N/A/* Get information about the Logical Unit's capabilities */ 1N/A * first determine amount of memory needed to hold all profiles. 1N/A * The first four bytes of smallbuf concatenated tell us the 1N/A * number of bytes of memory we need but do not take themselves 1N/A * into account. Therefore, add four to allocate that number 1N/A /* now get all profiles */ 1N/A * first determine amount of memory needed to hold all profiles. 1N/A * The first four bytes of smallbuf concatenated tell us the 1N/A * number of bytes of memory we need but do not take themselves 1N/A * into account. Therefore, add four to allocate that number 1N/A /* now get all profiles */ 1N/A/* retrieve speed list from the Write Speed Performance Descriptor Blocks 1N/A for (i = 0; i < n; i++, p +=
4) {
1N/A /* keep the list sorted */ 1N/A int n;
/* number of write speed performance descriptor blocks */ 1N/A /* retrieve speed list */ 1N/A n =
min(n, (
sizeof (p) -
32) /
4);
1N/A * According to MMC-5 6.22.3.2, the Disc Information Length should be 1N/A * 32+8*(Number of OPC Tables). Some devices, like U3 sticks, return 0. 1N/A * Yet some drives can return less than 32. We only need the first 22. 1N/A * given current profile, use the best method for determining 1N/A * disc capacity (in bytes) 1N/A case 0x08:
/* CD-ROM */ 1N/A case 0x10:
/* DVD-ROM */