|
|
| version 1.12, 2004/03/08 15:13:56 | version 1.13, 2004/03/12 22:19:08 |
|---|---|
| Line 1673 acd_send_cue(struct acd_softc *cdp, stru | Line 1673 acd_send_cue(struct acd_softc *cdp, stru |
| static int | static int |
| acd_report_key(struct acd_softc *cdp, struct dvd_authinfo *ai) | acd_report_key(struct acd_softc *cdp, struct dvd_authinfo *ai) |
| { | { |
| struct dvd_miscauth *d = NULL; | struct dvd_miscauth *d; |
| u_int32_t lba = 0; | u_int32_t lba = 0; |
| int16_t length; | int16_t length; |
| int8_t ccb[16]; | int8_t ccb[16]; |
| int error; | int error; |
| /* this is common even for ai->format == DVD_INVALIDATE_AGID */ | |
| bzero(ccb, sizeof(ccb)); | |
| ccb[0] = ATAPI_REPORT_KEY; | |
| ccb[2] = (lba >> 24) & 0xff; | |
| ccb[3] = (lba >> 16) & 0xff; | |
| ccb[4] = (lba >> 8) & 0xff; | |
| ccb[5] = lba & 0xff; | |
| ccb[10] = (ai->agid << 6) | ai->format; | |
| switch (ai->format) { | switch (ai->format) { |
| case DVD_REPORT_AGID: | case DVD_REPORT_AGID: |
| case DVD_REPORT_ASF: | case DVD_REPORT_ASF: |
| Line 1696 acd_report_key(struct acd_softc *cdp, st | Line 1705 acd_report_key(struct acd_softc *cdp, st |
| length = 16; | length = 16; |
| break; | break; |
| case DVD_INVALIDATE_AGID: | case DVD_INVALIDATE_AGID: |
| length = 0; | error = atapi_queue_cmd(cdp->device, ccb, (caddr_t)d, length, |
| break; | 0, 10, NULL, NULL); |
| return error; | |
| default: | default: |
| return EINVAL; | return EINVAL; |
| } | } |
| bzero(ccb, sizeof(ccb)); | |
| ccb[0] = ATAPI_REPORT_KEY; | |
| ccb[2] = (lba >> 24) & 0xff; | |
| ccb[3] = (lba >> 16) & 0xff; | |
| ccb[4] = (lba >> 8) & 0xff; | |
| ccb[5] = lba & 0xff; | |
| ccb[8] = (length >> 8) & 0xff; | ccb[8] = (length >> 8) & 0xff; |
| ccb[9] = length & 0xff; | ccb[9] = length & 0xff; |
| ccb[10] = (ai->agid << 6) | ai->format; | |
| if (length) { | d = malloc(length, M_ACD, M_WAITOK | M_ZERO); |
| d = malloc(length, M_ACD, M_WAITOK | M_ZERO); | d->length = htons(length - 2); |
| d->length = htons(length - 2); | |
| } | |
| error = atapi_queue_cmd(cdp->device, ccb, (caddr_t)d, length, | error = atapi_queue_cmd(cdp->device, ccb, (caddr_t)d, length, |
| ai->format == DVD_INVALIDATE_AGID ? 0 : ATPR_F_READ, | ATPR_F_READ, 10, NULL, NULL); |
| 10, NULL, NULL); | |
| if (error) { | if (error) { |
| free(d, M_ACD); | free(d, M_ACD); |
| return error; | return(error); |
| } | } |
| switch (ai->format) { | switch (ai->format) { |
| Line 1758 acd_report_key(struct acd_softc *cdp, st | Line 1758 acd_report_key(struct acd_softc *cdp, st |
| break; | break; |
| case DVD_INVALIDATE_AGID: | case DVD_INVALIDATE_AGID: |
| /* not reached */ | |
| break; | break; |
| default: | default: |