Deleted Added
full compact
ata_pmp.c (199321) ata_pmp.c (199747)
1/*-
2 * Copyright (c) 2009 Alexander Motin <mav@FreeBSD.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2009 Alexander Motin <mav@FreeBSD.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
28__FBSDID("$FreeBSD: head/sys/cam/ata/ata_pmp.c 199321 2009-11-16 15:18:02Z mav $");
28__FBSDID("$FreeBSD: head/sys/cam/ata/ata_pmp.c 199747 2009-11-24 12:47:58Z mav $");
29
30#include <sys/param.h>
31
32#ifdef _KERNEL
33#include <sys/systm.h>
34#include <sys/kernel.h>
35#include <sys/bio.h>
36#include <sys/sysctl.h>

--- 474 unchanged lines hidden (view full) ---

511 break;
512 }
513 xpt_action(start_ccb);
514}
515
516static void
517pmpdone(struct cam_periph *periph, union ccb *done_ccb)
518{
29
30#include <sys/param.h>
31
32#ifdef _KERNEL
33#include <sys/systm.h>
34#include <sys/kernel.h>
35#include <sys/bio.h>
36#include <sys/sysctl.h>

--- 474 unchanged lines hidden (view full) ---

511 break;
512 }
513 xpt_action(start_ccb);
514}
515
516static void
517pmpdone(struct cam_periph *periph, union ccb *done_ccb)
518{
519 struct ccb_trans_settings cts;
519 struct pmp_softc *softc;
520 struct ccb_ataio *ataio;
521 union ccb *work_ccb;
522 struct cam_path *path, *dpath;
523 u_int32_t priority, res;
524
525 softc = (struct pmp_softc *)periph->softc;
526 ataio = &done_ccb->ataio;

--- 103 unchanged lines hidden (view full) ---

630 return;
631 case PMP_STATE_CHECK:
632 res = (done_ccb->ataio.res.lba_high << 24) +
633 (done_ccb->ataio.res.lba_mid << 16) +
634 (done_ccb->ataio.res.lba_low << 8) +
635 done_ccb->ataio.res.sector_count;
636 if ((res & 0xf0f) == 0x103 && (res & 0x0f0) != 0) {
637 printf("PM status: %d - %08x\n", softc->pm_step, res);
520 struct pmp_softc *softc;
521 struct ccb_ataio *ataio;
522 union ccb *work_ccb;
523 struct cam_path *path, *dpath;
524 u_int32_t priority, res;
525
526 softc = (struct pmp_softc *)periph->softc;
527 ataio = &done_ccb->ataio;

--- 103 unchanged lines hidden (view full) ---

631 return;
632 case PMP_STATE_CHECK:
633 res = (done_ccb->ataio.res.lba_high << 24) +
634 (done_ccb->ataio.res.lba_mid << 16) +
635 (done_ccb->ataio.res.lba_low << 8) +
636 done_ccb->ataio.res.sector_count;
637 if ((res & 0xf0f) == 0x103 && (res & 0x0f0) != 0) {
638 printf("PM status: %d - %08x\n", softc->pm_step, res);
639 /* Report device speed. */
640 if (xpt_create_path(&dpath, periph,
641 xpt_path_path_id(periph->path),
642 softc->pm_step, 0) == CAM_REQ_CMP) {
643 bzero(&cts, sizeof(cts));
644 xpt_setup_ccb(&cts.ccb_h, dpath, CAM_PRIORITY_NORMAL);
645 cts.ccb_h.func_code = XPT_SET_TRAN_SETTINGS;
646 cts.type = CTS_TYPE_CURRENT_SETTINGS;
647 cts.xport_specific.sata.revision = (res & 0x0f0) >> 4;
648 cts.xport_specific.sata.valid = CTS_SATA_VALID_REVISION;
649 xpt_action((union ccb *)&cts);
650 xpt_free_path(dpath);
651 }
638 softc->found |= (1 << softc->pm_step);
639 softc->pm_step++;
640 } else {
641 if (softc->pm_try < 10) {
642 cam_freeze_devq(periph->path);
643 cam_release_devq(periph->path,
644 RELSIM_RELEASE_AFTER_TIMEOUT,
645 /*reduction*/0,

--- 92 unchanged lines hidden ---
652 softc->found |= (1 << softc->pm_step);
653 softc->pm_step++;
654 } else {
655 if (softc->pm_try < 10) {
656 cam_freeze_devq(periph->path);
657 cam_release_devq(periph->path,
658 RELSIM_RELEASE_AFTER_TIMEOUT,
659 /*reduction*/0,

--- 92 unchanged lines hidden ---