1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-29 16:44:03 +00:00

Cleanup sweep.

This commit is contained in:
Søren Schmidt 2000-03-13 12:27:11 +00:00
parent c7a9e0529c
commit 0d611a6c29
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=57988
6 changed files with 50 additions and 54 deletions

View File

@ -921,15 +921,15 @@ ata_detach(device_t dev)
#if NATADISK > 0
if (scp->devices & ATA_ATA_MASTER)
ad_detach((struct ad_softc *)scp->dev_softc[0]);
ad_detach(scp->dev_softc[0]);
if (scp->devices & ATA_ATA_SLAVE)
ad_detach((struct ad_softc *)scp->dev_softc[1]);
ad_detach(scp->dev_softc[1]);
#endif
#if NATAPICD > 0 || NATAPIFD > 0 || NATAPIST > 0
if (scp->devices & ATA_ATAPI_MASTER)
atapi_detach((struct atapi_softc *)scp->dev_softc[0]);
atapi_detach(scp->dev_softc[0]);
if (scp->devices & ATA_ATAPI_SLAVE)
atapi_detach((struct atapi_softc *)scp->dev_softc[1]);
atapi_detach(scp->dev_softc[1]);
#endif
if (scp->dev_param[ATA_DEV(ATA_MASTER)]) {
free(scp->dev_param[ATA_DEV(ATA_MASTER)], M_ATA);

View File

@ -150,7 +150,7 @@ atapi_detach(struct atapi_softc *atp)
int32_t
atapi_queue_cmd(struct atapi_softc *atp, int8_t *ccb, void *data,
int32_t count, int32_t flags, int32_t timeout,
atapi_callback_t callback, void *unused, struct buf *bp)
atapi_callback_t callback, struct buf *bp)
{
struct atapi_request *request;
int32_t error, s;
@ -463,7 +463,7 @@ atapi_test_ready(struct atapi_softc *atp)
int8_t ccb[16] = { ATAPI_TEST_UNIT_READY, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
return atapi_queue_cmd(atp, ccb, NULL, 0, 0, 30, NULL, NULL, NULL);
return atapi_queue_cmd(atp, ccb, NULL, 0, 0, 30, NULL, NULL);
}
int32_t

View File

@ -182,7 +182,7 @@ void atapi_detach(struct atapi_softc *);
void atapi_start(struct atapi_softc *);
void atapi_transfer(struct atapi_request *);
int32_t atapi_interrupt(struct atapi_request *);
int32_t atapi_queue_cmd(struct atapi_softc *, int8_t [], void *, int32_t, int32_t, int32_t, atapi_callback_t, void *, struct buf *);
int32_t atapi_queue_cmd(struct atapi_softc *, int8_t [], void *, int32_t, int32_t, int32_t, atapi_callback_t, struct buf *);
void atapi_reinit(struct atapi_softc *);
int32_t atapi_test_ready(struct atapi_softc *);
int32_t atapi_wait_ready(struct atapi_softc *, int32_t);

View File

@ -149,7 +149,7 @@ acdattach(struct atapi_softc *atp)
}
bzero(chp, sizeof(struct changer));
error = atapi_queue_cmd(cdp->atp, ccb, chp, sizeof(struct changer),
ATPR_F_READ, 60, NULL, NULL, NULL);
ATPR_F_READ, 60, NULL, NULL);
if (!error) {
struct acd_softc *tmpcdp = cdp;
@ -700,7 +700,7 @@ acdioctl(dev_t dev, u_long cmd, caddr_t addr, int32_t flags, struct proc *p)
if ((error = atapi_queue_cmd(cdp->atp, ccb, &cdp->subchan,
sizeof(cdp->subchan), ATPR_F_READ, 10,
NULL, NULL, NULL))) {
NULL, NULL))) {
break;
}
abslba = cdp->subchan.abslba;
@ -735,8 +735,7 @@ acdioctl(dev_t dev, u_long cmd, caddr_t addr, int32_t flags, struct proc *p)
args->end_m, args->end_s, args->end_f,
0, 0, 0, 0, 0, 0, 0 };
error = atapi_queue_cmd(cdp->atp, ccb, NULL, 0, 0, 10,
NULL, NULL, NULL);
error = atapi_queue_cmd(cdp->atp, ccb, NULL, 0, 0, 10, NULL, NULL);
break;
}
@ -749,8 +748,7 @@ acdioctl(dev_t dev, u_long cmd, caddr_t addr, int32_t flags, struct proc *p)
args->len>>8, args->len,
0, 0, 0, 0, 0, 0 };
error = atapi_queue_cmd(cdp->atp, ccb, NULL, 0, 0, 10,
NULL, NULL, NULL);
error = atapi_queue_cmd(cdp->atp, ccb, NULL, 0, 0, 10, NULL, NULL);
break;
}
@ -790,8 +788,7 @@ acdioctl(dev_t dev, u_long cmd, caddr_t addr, int32_t flags, struct proc *p)
ccb[8] = len>>8;
ccb[9] = len;
error = atapi_queue_cmd(cdp->atp, ccb, NULL, 0, 0, 10,
NULL, NULL, NULL);
error = atapi_queue_cmd(cdp->atp, ccb, NULL, 0, 0, 10, NULL, NULL);
break;
}
@ -847,7 +844,7 @@ acdioctl(dev_t dev, u_long cmd, caddr_t addr, int32_t flags, struct proc *p)
ccb[8] = blocks;
ccb[9] = 0xf0;
if ((error = atapi_queue_cmd(cdp->atp, ccb, buffer, size,
ATPR_F_READ, 30, NULL, NULL,NULL)))
ATPR_F_READ, 30, NULL,NULL)))
break;
if ((error = copyout(buffer, ubuf, size)))
@ -1149,7 +1146,7 @@ acd_start(struct atapi_softc *atp)
devstat_start_transaction(cdp->stats);
atapi_queue_cmd(cdp->atp, ccb, bp->b_data, count * cdp->block_size,
bp->b_flags&B_READ ? ATPR_F_READ : 0, 30, acd_done, cdp,bp);
bp->b_flags&B_READ ? ATPR_F_READ : 0, 30, acd_done, bp);
}
static int32_t
@ -1195,7 +1192,7 @@ acd_read_toc(struct acd_softc *cdp)
ccb[7] = len>>8;
ccb[8] = len;
if (atapi_queue_cmd(cdp->atp, ccb, &cdp->toc, len, ATPR_F_READ, 30,
NULL, NULL, NULL)) {
NULL, NULL)) {
bzero(&cdp->toc, sizeof(cdp->toc));
return 0;
}
@ -1211,7 +1208,7 @@ acd_read_toc(struct acd_softc *cdp)
ccb[7] = len>>8;
ccb[8] = len;
if (atapi_queue_cmd(cdp->atp, ccb, &cdp->toc, len, ATPR_F_READ, 30,
NULL, NULL, NULL)) {
NULL, NULL)) {
bzero(&cdp->toc, sizeof(cdp->toc));
return 0;
}
@ -1221,7 +1218,7 @@ acd_read_toc(struct acd_softc *cdp)
bzero(ccb, sizeof(ccb));
ccb[0] = ATAPI_READ_CAPACITY;
if (atapi_queue_cmd(cdp->atp, ccb, &cdp->info, sizeof(cdp->info),
ATPR_F_READ, 30, NULL, NULL, NULL))
ATPR_F_READ, 30, NULL, NULL))
bzero(&cdp->info, sizeof(cdp->info));
cdp->info.volsize = ntohl(cdp->info.volsize);
@ -1308,7 +1305,7 @@ acd_select_slot(struct acd_softc *cdp)
ccb[0] = ATAPI_LOAD_UNLOAD;
ccb[4] = 2;
ccb[8] = cdp->changer_info->current_slot;
atapi_queue_cmd(cdp->atp, ccb, NULL, 0, 0, 30, NULL, NULL, NULL);
atapi_queue_cmd(cdp->atp, ccb, NULL, 0, 0, 30, NULL, NULL);
/* load the wanted slot */
bzero(ccb, sizeof(ccb));
@ -1316,7 +1313,7 @@ acd_select_slot(struct acd_softc *cdp)
ccb[1] = 0x01;
ccb[4] = 3;
ccb[8] = cdp->slot;
atapi_queue_cmd(cdp->atp, ccb, NULL, 0, 0, 10, NULL, NULL, NULL);
atapi_queue_cmd(cdp->atp, ccb, NULL, 0, 0, 10, NULL, NULL);
atapi_wait_ready(cdp->atp, 30);
cdp->changer_info->current_slot = cdp->slot;
@ -1333,7 +1330,7 @@ acd_close_disk(struct acd_softc *cdp)
0, 0, 0, 0, 0, 0, 0, 0 };
int32_t error;
error = atapi_queue_cmd(cdp->atp, ccb, NULL, 0, 0, 10, NULL, NULL, NULL);
error = atapi_queue_cmd(cdp->atp, ccb, NULL, 0, 0, 10, NULL, NULL);
if (error)
return error;
return atapi_wait_ready(cdp->atp, 10*60);
@ -1426,7 +1423,7 @@ acd_close_track(struct acd_softc *cdp)
0, 0, 0, 0, 0, 0, 0, 0 };
int32_t error;
error = atapi_queue_cmd(cdp->atp, ccb1, NULL, 0, 0, 10, NULL, NULL, NULL);
error = atapi_queue_cmd(cdp->atp, ccb1, NULL, 0, 0, 10, NULL, NULL);
if (error)
return error;
return atapi_wait_ready(cdp->atp, 5*60);
@ -1444,7 +1441,7 @@ acd_read_track_info(struct acd_softc *cdp,
int32_t error;
if ((error = atapi_queue_cmd(cdp->atp, ccb, info, sizeof(*info),
ATPR_F_READ, 30, NULL, NULL, NULL)))
ATPR_F_READ, 30, NULL, NULL)))
return error;
info->track_start_addr = ntohl(info->track_start_addr);
info->next_writeable_addr = ntohl(info->next_writeable_addr);
@ -1503,7 +1500,7 @@ acd_report_key(struct acd_softc *cdp, struct dvd_authinfo *ai)
d.length = htons(length - 2);
error = atapi_queue_cmd(cdp->atp, ccb, &d, length,
ai->format == DVD_INVALIDATE_AGID ? 0 : ATPR_F_READ,
10, NULL, NULL, NULL);
10, NULL, NULL);
if (error)
return error;
@ -1584,7 +1581,7 @@ acd_send_key(struct acd_softc *cdp, struct dvd_authinfo *ai)
ccb[9] = length & 0xff;
ccb[10] = (ai->agid << 6) | ai->format;
d.length = htons(length - 2);
return atapi_queue_cmd(cdp->atp, ccb, &d, length, 0, 10, NULL, NULL, NULL);
return atapi_queue_cmd(cdp->atp, ccb, &d, length, 0, 10, NULL, NULL);
}
static int
@ -1645,7 +1642,7 @@ acd_read_structure(struct acd_softc *cdp, struct dvd_struct *s)
ccb[10] = s->agid << 6;
d.length = htons(length - 2);
error = atapi_queue_cmd(cdp->atp, ccb, &d, length, ATPR_F_READ, 30,
NULL, NULL, NULL);
NULL, NULL);
if (error)
return error;
@ -1728,7 +1725,7 @@ acd_blank(struct acd_softc *cdp)
0, 0, 0, 0, 0, 0, 0, 0 };
int32_t error;
error = atapi_queue_cmd(cdp->atp, ccb, NULL, 0, 0, 60*60, NULL, NULL, NULL);
error = atapi_queue_cmd(cdp->atp, ccb, NULL, 0, 0, 60*60, NULL, NULL);
cdp->flags &= ~(F_WRITTEN | F_DISK_OPEN | F_TRACK_OPEN);
cdp->atp->flags |= ATAPI_F_MEDIA_CHANGED;
return error;
@ -1740,7 +1737,7 @@ acd_prevent_allow(struct acd_softc *cdp, int32_t lock)
int8_t ccb[16] = { ATAPI_PREVENT_ALLOW, 0, 0, 0, lock,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
return atapi_queue_cmd(cdp->atp, ccb, NULL, 0, 0, 30, NULL, NULL, NULL);
return atapi_queue_cmd(cdp->atp, ccb, NULL, 0, 0, 30, NULL, NULL);
}
static int32_t
@ -1749,7 +1746,7 @@ acd_start_stop(struct acd_softc *cdp, int32_t start)
int8_t ccb[16] = { ATAPI_START_STOP, 0, 0, 0, start,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
return atapi_queue_cmd(cdp->atp, ccb, NULL, 0, 0, 30, NULL, NULL, NULL);
return atapi_queue_cmd(cdp->atp, ccb, NULL, 0, 0, 30, NULL, NULL);
}
static int32_t
@ -1758,7 +1755,7 @@ acd_pause_resume(struct acd_softc *cdp, int32_t pause)
int8_t ccb[16] = { ATAPI_PAUSE, 0, 0, 0, 0, 0, 0, 0, pause,
0, 0, 0, 0, 0, 0, 0 };
return atapi_queue_cmd(cdp->atp, ccb, NULL, 0, 0, 30, NULL, NULL, NULL);
return atapi_queue_cmd(cdp->atp, ccb, NULL, 0, 0, 30, NULL, NULL);
}
static int32_t
@ -1770,7 +1767,7 @@ acd_mode_sense(struct acd_softc *cdp, u_int8_t page,
int32_t error;
error = atapi_queue_cmd(cdp->atp, ccb, pagebuf, pagesize, ATPR_F_READ, 10,
NULL, NULL, NULL);
NULL, NULL);
#ifdef ACD_DEBUG
atapi_dump("acd: mode sense ", pagebuf, pagesize);
#endif
@ -1787,8 +1784,7 @@ acd_mode_select(struct acd_softc *cdp, void *pagebuf, int32_t pagesize)
printf("acd: modeselect pagesize=%d\n", pagesize);
atapi_dump("acd: mode select ", pagebuf, pagesize);
#endif
return atapi_queue_cmd(cdp->atp, ccb, pagebuf, pagesize, 0, 30,
NULL, NULL, NULL);
return atapi_queue_cmd(cdp->atp, ccb, pagebuf, pagesize, 0, 30, NULL, NULL);
}
static int32_t
@ -1797,5 +1793,5 @@ acd_set_speed(struct acd_softc *cdp, int32_t speed)
int8_t ccb[16] = { ATAPI_SET_SPEED, 0, 0xff, 0xff, speed>>8, speed,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
return atapi_queue_cmd(cdp->atp, ccb, NULL, 0, 0, 30, NULL, NULL, NULL);
return atapi_queue_cmd(cdp->atp, ccb, NULL, 0, 0, 30, NULL, NULL);
}

View File

@ -146,7 +146,7 @@ afd_sense(struct afd_softc *fdp)
/* get drive capabilities, some drives needs this repeated */
for (count = 0 ; count < 5 ; count++) {
if (!(error = atapi_queue_cmd(fdp->atp, ccb, buffer, sizeof(buffer),
ATPR_F_READ, 30, NULL, NULL, NULL)))
ATPR_F_READ, 30, NULL, NULL)))
break;
}
if (error)
@ -339,7 +339,7 @@ afd_start(struct atapi_softc *atp)
atapi_queue_cmd(fdp->atp, ccb, data_ptr,
fdp->transfersize * fdp->cap.sector_size,
(bp->b_flags & B_READ) ? ATPR_F_READ : 0, 30,
afd_partial_done, fdp, bp);
afd_partial_done, bp);
count -= fdp->transfersize;
lba += fdp->transfersize;
@ -354,7 +354,7 @@ afd_start(struct atapi_softc *atp)
ccb[8] = count;
atapi_queue_cmd(fdp->atp, ccb, data_ptr, count * fdp->cap.sector_size,
bp->b_flags&B_READ ? ATPR_F_READ : 0, 30, afd_done, fdp,bp);
bp->b_flags&B_READ ? ATPR_F_READ : 0, 30, afd_done, bp);
}
static int32_t
@ -416,7 +416,7 @@ afd_start_stop(struct afd_softc *fdp, int32_t start)
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
int32_t error;
error = atapi_queue_cmd(fdp->atp, ccb, NULL, 0, 0, 10, NULL, NULL, NULL);
error = atapi_queue_cmd(fdp->atp, ccb, NULL, 0, 0, 10, NULL, NULL);
if (error)
return error;
return atapi_wait_ready(fdp->atp, 30);
@ -428,5 +428,5 @@ afd_prevent_allow(struct afd_softc *fdp, int32_t lock)
int8_t ccb[16] = { ATAPI_PREVENT_ALLOW, 0, 0, 0, lock,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
return atapi_queue_cmd(fdp->atp, ccb, NULL, 0, 0,30, NULL, NULL, NULL);
return atapi_queue_cmd(fdp->atp, ccb, NULL, 0, 0,30, NULL, NULL);
}

View File

@ -469,12 +469,12 @@ ast_start(struct atapi_softc *atp)
if (bp->b_flags & B_READ) {
ccb[0] = ATAPI_READ;
if (!(stp->flags & ATAPI_F_DSC_USED))
atapi_queue_cmd(stp->atp, ccb, NULL, 0, 0, 2*60, NULL, NULL, NULL);
atapi_queue_cmd(stp->atp, ccb, NULL, 0, 0, 2*60, NULL, NULL);
}
else {
ccb[0] = ATAPI_WRITE;
if (!(stp->flags & ATAPI_F_DSC_USED))
atapi_queue_cmd(stp->atp, ccb, NULL, 0, 0, 2*60, NULL, NULL, NULL);
atapi_queue_cmd(stp->atp, ccb, NULL, 0, 0, 2*60, NULL, NULL);
}
bufq_remove(&stp->buf_queue, bp);
@ -488,7 +488,7 @@ ast_start(struct atapi_softc *atp)
devstat_start_transaction(&stp->stats);
atapi_queue_cmd(stp->atp, ccb, bp->b_data, blkcount * stp->blksize,
bp->b_flags&B_READ ? ATPR_F_READ : 0, 60, ast_done, stp,bp);
bp->b_flags&B_READ ? ATPR_F_READ : 0, 60, ast_done, bp);
}
static int32_t
@ -521,7 +521,7 @@ ast_mode_sense(struct ast_softc *stp, u_int8_t page,
int32_t error;
error = atapi_queue_cmd(stp->atp, ccb, pagebuf, pagesize, ATPR_F_READ, 10,
NULL, NULL, NULL);
NULL, NULL);
#ifdef AST_DEBUG
atapi_dump("ast: mode sense ", pagebuf, pagesize);
#endif
@ -539,7 +539,7 @@ ast_mode_select(struct ast_softc *stp, void *pagebuf, int32_t pagesize)
atapi_dump("ast: mode select ", pagebuf, pagesize);
#endif
return atapi_queue_cmd(stp->atp, ccb, pagebuf, pagesize, 0, 10,
NULL, NULL, NULL);
NULL, NULL);
}
static int32_t
@ -559,7 +559,7 @@ ast_write_filemark(struct ast_softc *stp, u_int8_t function)
stp->flags |= F_FM_WRITTEN;
}
}
error = atapi_queue_cmd(stp->atp, ccb, NULL, 0, 0, 10, NULL, NULL, NULL);
error = atapi_queue_cmd(stp->atp, ccb, NULL, 0, 0, 10, NULL, NULL);
if (error)
return error;
return atapi_wait_ready(stp->atp, 10*60);
@ -575,7 +575,7 @@ ast_read_position(struct ast_softc *stp, int32_t hard,
error = atapi_queue_cmd(stp->atp, ccb, position,
sizeof(struct ast_readposition), ATPR_F_READ, 10,
NULL, NULL, NULL);
NULL, NULL);
position->tape = ntohl(position->tape);
position->host = ntohl(position->host);
return error;
@ -587,7 +587,7 @@ ast_space(struct ast_softc *stp, u_int8_t function, u_int32_t count)
int8_t ccb[16] = { ATAPI_SPACE, function, count>>16, count>>8, count,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
return atapi_queue_cmd(stp->atp, ccb, NULL, 0, 0, 60*60, NULL, NULL, NULL);
return atapi_queue_cmd(stp->atp, ccb, NULL, 0, 0, 60*60, NULL, NULL);
}
static int32_t
@ -598,7 +598,7 @@ ast_locate(struct ast_softc *stp, int32_t hard, int32_t pos)
0, 0, 0, 0, 0, 0, 0, 0, 0 };
int32_t error;
error = atapi_queue_cmd(stp->atp, ccb, NULL, 0, 0, 10, NULL, NULL, NULL);
error = atapi_queue_cmd(stp->atp, ccb, NULL, 0, 0, 10, NULL, NULL);
if (error)
return error;
return atapi_wait_ready(stp->atp, 60*60);
@ -610,7 +610,7 @@ ast_prevent_allow(struct ast_softc *stp, int32_t lock)
int8_t ccb[16] = { ATAPI_PREVENT_ALLOW, 0, 0, 0, lock,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
return atapi_queue_cmd(stp->atp, ccb, NULL, 0, 0,30, NULL, NULL, NULL);
return atapi_queue_cmd(stp->atp, ccb, NULL, 0, 0,30, NULL, NULL);
}
static int32_t
@ -622,7 +622,7 @@ ast_load_unload(struct ast_softc *stp, u_int8_t function)
if ((function & SS_EJECT) && !stp->cap.eject)
return 0;
error = atapi_queue_cmd(stp->atp, ccb, NULL, 0, 0, 10, NULL, NULL, NULL);
error = atapi_queue_cmd(stp->atp, ccb, NULL, 0, 0, 10, NULL, NULL);
if (error)
return error;
tsleep((caddr_t)&error, PRIBIO, "astlu", 1 * hz);
@ -638,7 +638,7 @@ ast_rewind(struct ast_softc *stp)
0, 0, 0, 0, 0, 0, 0, 0 };
int32_t error;
error = atapi_queue_cmd(stp->atp, ccb, NULL, 0, 0, 10, NULL, NULL, NULL);
error = atapi_queue_cmd(stp->atp, ccb, NULL, 0, 0, 10, NULL, NULL);
if (error)
return error;
return atapi_wait_ready(stp->atp, 60*60);
@ -654,5 +654,5 @@ ast_erase(struct ast_softc *stp)
if ((error = ast_rewind(stp)))
return error;
return atapi_queue_cmd(stp->atp, ccb, NULL, 0, 0, 60*60, NULL, NULL, NULL);
return atapi_queue_cmd(stp->atp, ccb, NULL, 0, 0, 60*60, NULL, NULL);
}