Deleted Added
sdiff udiff text old ( 220615 ) new ( 220822 )
full compact
1/*-
2 * Copyright (c) 2010 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/dev/mvs/mvs.c 220615 2011-04-14 07:49:45Z mav $");
29
30#include <sys/param.h>
31#include <sys/module.h>
32#include <sys/systm.h>
33#include <sys/kernel.h>
34#include <sys/ata.h>
35#include <sys/bus.h>
36#include <sys/conf.h>

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

1776mvs_issue_recovery(device_t dev)
1777{
1778 struct mvs_channel *ch = device_get_softc(dev);
1779 union ccb *ccb;
1780 struct ccb_ataio *ataio;
1781 struct ccb_scsiio *csio;
1782 int i;
1783
1784 ch->recoverycmd = 1;
1785 /* Find some holden command. */
1786 for (i = 0; i < MVS_MAX_SLOTS; i++) {
1787 if (ch->hold[i])
1788 break;
1789 }
1790 ccb = xpt_alloc_ccb_nowait();
1791 if (ccb == NULL) {
1792 device_printf(dev, "Unable allocate READ LOG command");
1793 return; /* XXX */
1794 }
1795 ccb->ccb_h = ch->hold[i]->ccb_h; /* Reuse old header. */
1796 if (ccb->ccb_h.func_code == XPT_ATA_IO) {
1797 /* READ LOG */
1798 ccb->ccb_h.recovery_type = RECOVERY_READ_LOG;
1799 ccb->ccb_h.func_code = XPT_ATA_IO;
1800 ccb->ccb_h.flags = CAM_DIR_IN;
1801 ccb->ccb_h.timeout = 1000; /* 1s should be enough. */
1802 ataio = &ccb->ataio;
1803 ataio->data_ptr = malloc(512, M_MVS, M_NOWAIT);
1804 if (ataio->data_ptr == NULL) {
1805 xpt_free_ccb(ccb);
1806 device_printf(dev, "Unable allocate memory for READ LOG command");
1807 return; /* XXX */
1808 }
1809 ataio->dxfer_len = 512;
1810 bzero(&ataio->cmd, sizeof(ataio->cmd));
1811 ataio->cmd.flags = CAM_ATAIO_48BIT;
1812 ataio->cmd.command = 0x2F; /* READ LOG EXT */
1813 ataio->cmd.sector_count = 1;
1814 ataio->cmd.sector_count_exp = 0;
1815 ataio->cmd.lba_low = 0x10;

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

1826 csio = &ccb->csio;
1827 csio->data_ptr = (void *)&ch->hold[i]->csio.sense_data;
1828 csio->dxfer_len = ch->hold[i]->csio.sense_len;
1829 csio->cdb_len = 6;
1830 bzero(&csio->cdb_io, sizeof(csio->cdb_io));
1831 csio->cdb_io.cdb_bytes[0] = 0x03;
1832 csio->cdb_io.cdb_bytes[4] = csio->dxfer_len;
1833 }
1834 /* Freeze SIM while doing READ LOG EXT. */
1835 xpt_freeze_simq(ch->sim, 1);
1836 mvs_begin_transaction(dev, ccb);
1837}
1838
1839static void
1840mvs_process_read_log(device_t dev, union ccb *ccb)
1841{
1842 struct mvs_channel *ch = device_get_softc(dev);

--- 537 unchanged lines hidden ---