58c58
< __FBSDID("$FreeBSD: head/sys/dev/amr/amr.c 119418 2003-08-24 17:55:58Z obrien $");
---
> __FBSDID("$FreeBSD: head/sys/dev/amr/amr.c 120988 2003-10-10 22:49:40Z ps $");
980,984c980,986
< count=0;
< while (sc->amr_busyslots){
< tsleep(sc, PRIBIO | PCATCH, "amrpoll", hz);
< if(count++>10) {
< break;
---
> if (sc->amr_state & AMR_STATE_INTEN) {
> count=0;
> while (sc->amr_busyslots) {
> tsleep(sc, PRIBIO | PCATCH, "amrpoll", hz);
> if(count++>10) {
> break;
> }
986d987
< }
988,993c989,995
< if(sc->amr_busyslots) {
< device_printf(sc->amr_dev, "adapter is busy\n");
< splx(s);
< amr_unmapcmd(ac);
< ac->ac_status=0;
< return(1);
---
> if(sc->amr_busyslots) {
> device_printf(sc->amr_dev, "adapter is busy\n");
> splx(s);
> amr_unmapcmd(ac);
> ac->ac_status=0;
> return(1);
> }
1781a1784,1824
> int
> amr_dump_blocks(struct amr_softc *sc, int unit, u_int32_t lba, void *data, int blks)
> {
> struct amr_command *ac;
> int error = EIO;
>
> debug_called(1);
>
> sc->amr_state &= ~AMR_STATE_INTEN;
>
> /* get ourselves a command buffer */
> if ((ac = amr_alloccmd(sc)) == NULL)
> goto out;
> /* set command flags */
> ac->ac_flags |= AMR_CMD_PRIORITY | AMR_CMD_DATAOUT;
>
> /* point the command at our data */
> ac->ac_data = data;
> ac->ac_length = blks * AMR_BLKSIZE;
>
> /* build the command proper */
> ac->ac_mailbox.mb_command = AMR_CMD_LWRITE;
> ac->ac_mailbox.mb_blkcount = blks;
> ac->ac_mailbox.mb_lba = lba;
> ac->ac_mailbox.mb_drive = unit;
>
> /* can't assume that interrupts are going to work here, so play it safe */
> if (sc->amr_poll_command(ac))
> goto out;
> error = ac->ac_status;
>
> out:
> if (ac != NULL)
> amr_releasecmd(ac);
>
> sc->amr_state |= AMR_STATE_INTEN;
> return (error);
> }
>
>
>
< __FBSDID("$FreeBSD: head/sys/dev/amr/amr.c 119418 2003-08-24 17:55:58Z obrien $");
---
> __FBSDID("$FreeBSD: head/sys/dev/amr/amr.c 120988 2003-10-10 22:49:40Z ps $");
980,984c980,986
< count=0;
< while (sc->amr_busyslots){
< tsleep(sc, PRIBIO | PCATCH, "amrpoll", hz);
< if(count++>10) {
< break;
---
> if (sc->amr_state & AMR_STATE_INTEN) {
> count=0;
> while (sc->amr_busyslots) {
> tsleep(sc, PRIBIO | PCATCH, "amrpoll", hz);
> if(count++>10) {
> break;
> }
986d987
< }
988,993c989,995
< if(sc->amr_busyslots) {
< device_printf(sc->amr_dev, "adapter is busy\n");
< splx(s);
< amr_unmapcmd(ac);
< ac->ac_status=0;
< return(1);
---
> if(sc->amr_busyslots) {
> device_printf(sc->amr_dev, "adapter is busy\n");
> splx(s);
> amr_unmapcmd(ac);
> ac->ac_status=0;
> return(1);
> }
1781a1784,1824
> int
> amr_dump_blocks(struct amr_softc *sc, int unit, u_int32_t lba, void *data, int blks)
> {
> struct amr_command *ac;
> int error = EIO;
>
> debug_called(1);
>
> sc->amr_state &= ~AMR_STATE_INTEN;
>
> /* get ourselves a command buffer */
> if ((ac = amr_alloccmd(sc)) == NULL)
> goto out;
> /* set command flags */
> ac->ac_flags |= AMR_CMD_PRIORITY | AMR_CMD_DATAOUT;
>
> /* point the command at our data */
> ac->ac_data = data;
> ac->ac_length = blks * AMR_BLKSIZE;
>
> /* build the command proper */
> ac->ac_mailbox.mb_command = AMR_CMD_LWRITE;
> ac->ac_mailbox.mb_blkcount = blks;
> ac->ac_mailbox.mb_lba = lba;
> ac->ac_mailbox.mb_drive = unit;
>
> /* can't assume that interrupts are going to work here, so play it safe */
> if (sc->amr_poll_command(ac))
> goto out;
> error = ac->ac_status;
>
> out:
> if (ac != NULL)
> amr_releasecmd(ac);
>
> sc->amr_state |= AMR_STATE_INTEN;
> return (error);
> }
>
>
>