Fix timeout handeling and add retry counts.
Add HPT366 probe message (but no real support yet), Add CDR support for several diffenrent blocktypes, also close disk as a multisession CD.
This commit is contained in:
parent
61452e405e
commit
27fceb7416
@ -202,6 +202,8 @@ ata_pcimatch(device_t dev)
|
|||||||
return "Promise Ultra/66 IDE controller";
|
return "Promise Ultra/66 IDE controller";
|
||||||
case 0x522910b9:
|
case 0x522910b9:
|
||||||
return "AcerLabs Aladdin IDE controller";
|
return "AcerLabs Aladdin IDE controller";
|
||||||
|
case 0x00041103:
|
||||||
|
return "HighPoint HPT366 IDE controller";
|
||||||
case 0x05711106: /* 82c586 */
|
case 0x05711106: /* 82c586 */
|
||||||
case 0x05961106: /* 82c596 */
|
case 0x05961106: /* 82c596 */
|
||||||
return "VIA Apollo IDE controller (generic mode)";
|
return "VIA Apollo IDE controller (generic mode)";
|
||||||
@ -623,10 +625,8 @@ ata_start(struct ata_softc *scp)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!atapi_request) {
|
if (!atapi_request)
|
||||||
timeout((timeout_t*)ata_start, scp, 1);
|
atapi_request = TAILQ_FIRST(&scp->atapi_queue);
|
||||||
return;
|
|
||||||
}
|
|
||||||
TAILQ_REMOVE(&scp->atapi_queue, atapi_request, chain);
|
TAILQ_REMOVE(&scp->atapi_queue, atapi_request, chain);
|
||||||
scp->active = ATA_ACTIVE_ATAPI;
|
scp->active = ATA_ACTIVE_ATAPI;
|
||||||
scp->running = atapi_request;
|
scp->running = atapi_request;
|
||||||
|
@ -96,6 +96,9 @@ static void ad_drvinit(void);
|
|||||||
static int32_t adnlun = 0; /* number of config'd drives */
|
static int32_t adnlun = 0; /* number of config'd drives */
|
||||||
static struct intr_config_hook *ad_attach_hook;
|
static struct intr_config_hook *ad_attach_hook;
|
||||||
|
|
||||||
|
/* defines */
|
||||||
|
#define AD_MAX_RETRIES 5
|
||||||
|
|
||||||
static __inline int
|
static __inline int
|
||||||
apiomode(struct ata_params *ap)
|
apiomode(struct ata_params *ap)
|
||||||
{
|
{
|
||||||
@ -615,6 +618,19 @@ ad_timeout(struct ad_request *request)
|
|||||||
if (request->flags & AR_F_DMA_USED)
|
if (request->flags & AR_F_DMA_USED)
|
||||||
ata_dmadone(adp->controller, adp->unit);
|
ata_dmadone(adp->controller, adp->unit);
|
||||||
|
|
||||||
|
if (request->retries < AD_MAX_RETRIES) {
|
||||||
|
/* reinject this request */
|
||||||
|
request->retries++;
|
||||||
|
TAILQ_INSERT_HEAD(&adp->controller->ata_queue, request, chain);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
/* retries all used up, return error */
|
||||||
|
request->bp->b_error = EIO;
|
||||||
|
request->bp->b_flags |= B_ERROR;
|
||||||
|
devstat_end_transaction_buf(&adp->stats, request->bp);
|
||||||
|
biodone(request->bp);
|
||||||
|
free(request, M_DEVBUF);
|
||||||
|
}
|
||||||
ata_reinit(adp->controller);
|
ata_reinit(adp->controller);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,6 +149,7 @@ struct ad_request {
|
|||||||
u_int32_t donecount; /* bytes transferred */
|
u_int32_t donecount; /* bytes transferred */
|
||||||
u_int32_t currentsize; /* size of current transfer */
|
u_int32_t currentsize; /* size of current transfer */
|
||||||
struct callout_handle timeout_handle; /* handle for untimeout */
|
struct callout_handle timeout_handle; /* handle for untimeout */
|
||||||
|
int32_t retries; /* retry count */
|
||||||
int32_t flags;
|
int32_t flags;
|
||||||
#define AR_F_READ 0x0001
|
#define AR_F_READ 0x0001
|
||||||
#define AR_F_ERROR 0x0002
|
#define AR_F_ERROR 0x0002
|
||||||
|
@ -62,8 +62,12 @@ int32_t acdattach(struct atapi_softc *);
|
|||||||
int32_t afdattach(struct atapi_softc *);
|
int32_t afdattach(struct atapi_softc *);
|
||||||
int32_t astattach(struct atapi_softc *);
|
int32_t astattach(struct atapi_softc *);
|
||||||
|
|
||||||
|
/* internal vars */
|
||||||
static struct intr_config_hook *atapi_attach_hook;
|
static struct intr_config_hook *atapi_attach_hook;
|
||||||
|
|
||||||
|
/* defines */
|
||||||
|
#define ATAPI_MAX_RETRIES 5
|
||||||
|
|
||||||
static __inline int
|
static __inline int
|
||||||
apiomode(struct atapi_params *ap)
|
apiomode(struct atapi_params *ap)
|
||||||
{
|
{
|
||||||
@ -401,7 +405,8 @@ atapi_interrupt(struct atapi_request *request)
|
|||||||
if (atapi_wait(atp, 0) < 0) {
|
if (atapi_wait(atp, 0) < 0) {
|
||||||
printf("atapi_interrupt: timeout waiting for status");
|
printf("atapi_interrupt: timeout waiting for status");
|
||||||
atp->flags &= ~ATAPI_F_DMA_USED;
|
atp->flags &= ~ATAPI_F_DMA_USED;
|
||||||
request->result = inb(atp->controller->ioaddr + ATA_ERROR) | 0xf0;
|
request->result = inb(atp->controller->ioaddr + ATA_ERROR) |
|
||||||
|
ATAPI_SK_RESERVED;
|
||||||
goto op_finished;
|
goto op_finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -528,6 +533,16 @@ atapi_timeout(struct atapi_request *request)
|
|||||||
if (request->flags & ATAPI_F_DMA_USED)
|
if (request->flags & ATAPI_F_DMA_USED)
|
||||||
ata_dmadone(atp->controller, atp->unit);
|
ata_dmadone(atp->controller, atp->unit);
|
||||||
|
|
||||||
|
if (request->retries < ATAPI_MAX_RETRIES) {
|
||||||
|
/* reinject this request */
|
||||||
|
request->retries++;
|
||||||
|
TAILQ_INSERT_HEAD(&atp->controller->atapi_queue, request, chain);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
/* retries all used up, return error */
|
||||||
|
request->result = ATAPI_SK_RESERVED | ATAPI_E_ABRT;
|
||||||
|
wakeup((caddr_t)request);
|
||||||
|
}
|
||||||
ata_reinit(atp->controller);
|
ata_reinit(atp->controller);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -251,6 +251,7 @@ struct atapi_request {
|
|||||||
u_int32_t donecount; /* bytes transferred */
|
u_int32_t donecount; /* bytes transferred */
|
||||||
int32_t timeout; /* timeout for this cmd */
|
int32_t timeout; /* timeout for this cmd */
|
||||||
struct callout_handle timeout_handle; /* handle for untimeout */
|
struct callout_handle timeout_handle; /* handle for untimeout */
|
||||||
|
int32_t retries; /* retry count */
|
||||||
int32_t result; /* result of this cmd */
|
int32_t result; /* result of this cmd */
|
||||||
int32_t flags;
|
int32_t flags;
|
||||||
#define A_READ 0x0001
|
#define A_READ 0x0001
|
||||||
|
@ -941,7 +941,7 @@ acdioctl(dev_t dev, u_long cmd, caddr_t addr, int32_t flag, struct proc *p)
|
|||||||
cdp->dummy = w->dummy;
|
cdp->dummy = w->dummy;
|
||||||
}
|
}
|
||||||
/* set speed in KB/s (approximate) */
|
/* set speed in KB/s (approximate) */
|
||||||
acd_set_speed(cdp, w->speed * 173);
|
acd_set_speed(cdp, w->speed * 177);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1297,60 +1297,65 @@ acd_open_track(struct acd_softc *cdp, struct wormio_prepare_track *ptp)
|
|||||||
param.test_write = cdp->dummy ? 1 : 0;
|
param.test_write = cdp->dummy ? 1 : 0;
|
||||||
param.write_type = CDR_WTYPE_TRACK;
|
param.write_type = CDR_WTYPE_TRACK;
|
||||||
|
|
||||||
switch (ptp->audio) {
|
switch (ptp->track_type) {
|
||||||
/* switch (data_type) { */
|
|
||||||
|
|
||||||
case 0:
|
case BLOCK_RAW:
|
||||||
/* case CDR_DATA: */
|
if (ptp->preemp)
|
||||||
|
param.track_mode = CDR_TMODE_AUDIO;
|
||||||
|
else
|
||||||
|
param.track_mode = 0;
|
||||||
|
cdp->block_size = 2352;
|
||||||
|
param.data_block_type = CDR_DB_RAW;
|
||||||
|
param.session_format = CDR_SESS_CDROM;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case BLOCK_MODE_1:
|
||||||
cdp->block_size = 2048;
|
cdp->block_size = 2048;
|
||||||
param.track_mode = CDR_TMODE_DATA;
|
param.track_mode = CDR_TMODE_DATA;
|
||||||
param.data_block_type = CDR_DB_ROM_MODE1;
|
param.data_block_type = CDR_DB_ROM_MODE1;
|
||||||
param.session_format = CDR_SESS_CDROM;
|
param.session_format = CDR_SESS_CDROM;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
case BLOCK_MODE_2:
|
||||||
/* case CDR_AUDIO: */
|
cdp->block_size = 2336;
|
||||||
cdp->block_size = 2352;
|
|
||||||
if (ptp->preemp)
|
|
||||||
param.track_mode = CDR_TMODE_AUDIO;
|
|
||||||
else
|
|
||||||
param.track_mode = 0;
|
|
||||||
param.data_block_type = CDR_DB_RAW;
|
|
||||||
param.session_format = CDR_SESS_CDROM;
|
|
||||||
break;
|
|
||||||
|
|
||||||
/*
|
|
||||||
case CDR_MODE2:
|
|
||||||
param.track_mode = CDR_TMODE_DATA;
|
param.track_mode = CDR_TMODE_DATA;
|
||||||
param.data_block_type = CDR_DB_ROM_MODE2;
|
param.data_block_type = CDR_DB_ROM_MODE2;
|
||||||
param.session_format = CDR_SESS_CDROM;
|
param.session_format = CDR_SESS_CDROM;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CDR_XA1:
|
case BLOCK_MODE_2_FORM_1:
|
||||||
|
cdp->block_size = 2048;
|
||||||
param.track_mode = CDR_TMODE_DATA;
|
param.track_mode = CDR_TMODE_DATA;
|
||||||
param.data_block_type = CDR_DB_XA_MODE1;
|
param.data_block_type = CDR_DB_XA_MODE1;
|
||||||
param.session_format = CDR_SESS_CDROM_XA;
|
param.session_format = CDR_SESS_CDROM_XA;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CDR_XA2:
|
case BLOCK_MODE_2_FORM_1b:
|
||||||
|
cdp->block_size = 2056;
|
||||||
param.track_mode = CDR_TMODE_DATA;
|
param.track_mode = CDR_TMODE_DATA;
|
||||||
param.data_block_type = CDR_DB_XA_MODE2_F1;
|
param.data_block_type = CDR_DB_XA_MODE2_F1;
|
||||||
param.session_format = CDR_SESS_CDROM_XA;
|
param.session_format = CDR_SESS_CDROM_XA;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CDR_CDI:
|
case BLOCK_MODE_2_FORM_2:
|
||||||
|
cdp->block_size = 2324;
|
||||||
param.track_mode = CDR_TMODE_DATA;
|
param.track_mode = CDR_TMODE_DATA;
|
||||||
param.data_block_type = CDR_DB_XA_MODE2_F1;
|
param.data_block_type = CDR_DB_XA_MODE2_F2;
|
||||||
param.session_format = CDR_SESS_CDI;
|
param.session_format = CDR_SESS_CDROM_XA;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case BLOCK_MODE_2_FORM_2b:
|
||||||
|
cdp->block_size = 2332;
|
||||||
|
param.track_mode = CDR_TMODE_DATA;
|
||||||
|
param.data_block_type = CDR_DB_XA_MODE2_MIX;
|
||||||
|
param.session_format = CDR_SESS_CDROM_XA;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
#if 0
|
#if 1
|
||||||
param.multi_session = CDR_MSES_MULTI;
|
param.multi_session = CDR_MSES_MULTI;
|
||||||
#else
|
#else
|
||||||
param.multi_session = CDR_MSES_NONE;
|
param.multi_session = CDR_MSES_NONE;
|
||||||
#endif
|
#endif
|
||||||
param.fp = 0;
|
param.fp = 0;
|
||||||
param.packet_size = 0;
|
param.packet_size = 0;
|
||||||
|
@ -248,12 +248,12 @@ struct write_param {
|
|||||||
#define CDR_DB_VS_7 0x7 /* vendor specific */
|
#define CDR_DB_VS_7 0x7 /* vendor specific */
|
||||||
#define CDR_DB_ROM_MODE1 0x8 /* 2048 bytes Mode 1 (ISO/IEC 10149) */
|
#define CDR_DB_ROM_MODE1 0x8 /* 2048 bytes Mode 1 (ISO/IEC 10149) */
|
||||||
#define CDR_DB_ROM_MODE2 0x9 /* 2336 bytes Mode 2 (ISO/IEC 10149) */
|
#define CDR_DB_ROM_MODE2 0x9 /* 2336 bytes Mode 2 (ISO/IEC 10149) */
|
||||||
#define CDR_DB_XA_MODE1 0x10 /* 2048 bytes Mode 1 (CD-ROM XA 1) */
|
#define CDR_DB_XA_MODE1 0xa /* 2048 bytes Mode 1 (CD-ROM XA 1) */
|
||||||
#define CDR_DB_XA_MODE2_F1 0x11 /* 2056 bytes Mode 2 (CD-ROM XA 1) */
|
#define CDR_DB_XA_MODE2_F1 0xb /* 2056 bytes Mode 2 (CD-ROM XA 1) */
|
||||||
#define CDR_DB_XA_MODE2_F2 0x12 /* 2324 bytes Mode 2 (CD-ROM XA 2) */
|
#define CDR_DB_XA_MODE2_F2 0xc /* 2324 bytes Mode 2 (CD-ROM XA 2) */
|
||||||
#define CDR_DB_XA_MODE2_MIX 0x13 /* 2332 bytes Mode 2 (CD-ROM XA 1/2) */
|
#define CDR_DB_XA_MODE2_MIX 0xd /* 2332 bytes Mode 2 (CD-ROM XA 1/2) */
|
||||||
#define CDR_DB_RES_14 0x14 /* reserved */
|
#define CDR_DB_RES_14 0xe /* reserved */
|
||||||
#define CDR_DB_VS_15 0x15 /* vendor specific */
|
#define CDR_DB_VS_15 0xf /* vendor specific */
|
||||||
|
|
||||||
u_int8_t reserved4_4567 :4;
|
u_int8_t reserved4_4567 :4;
|
||||||
u_int8_t reserved5;
|
u_int8_t reserved5;
|
||||||
|
Loading…
Reference in New Issue
Block a user