ata_da.c (207222) | ata_da.c (208349) |
---|---|
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_da.c 207222 2010-04-26 12:03:55Z mav $"); | 28__FBSDID("$FreeBSD: head/sys/cam/ata/ata_da.c 208349 2010-05-20 12:46:19Z marius $"); |
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> --- 16 unchanged lines hidden (view full) --- 53#include <cam/cam.h> 54#include <cam/cam_ccb.h> 55#include <cam/cam_periph.h> 56#include <cam/cam_xpt_periph.h> 57#include <cam/cam_sim.h> 58 59#include <cam/ata/ata_all.h> 60 | 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> --- 16 unchanged lines hidden (view full) --- 53#include <cam/cam.h> 54#include <cam/cam_ccb.h> 55#include <cam/cam_periph.h> 56#include <cam/cam_xpt_periph.h> 57#include <cam/cam_sim.h> 58 59#include <cam/ata/ata_all.h> 60 |
61#include <machine/md_var.h> /* geometry translation */ 62 |
|
61#ifdef _KERNEL 62 63#define ATA_MAX_28BIT_LBA 268435455UL 64 65typedef enum { 66 ADA_STATE_NORMAL 67} ada_state; 68 --- 104 unchanged lines hidden (view full) --- 173#ifndef ADA_DEFAULT_RETRY 174#define ADA_DEFAULT_RETRY 4 175#endif 176 177#ifndef ADA_DEFAULT_SEND_ORDERED 178#define ADA_DEFAULT_SEND_ORDERED 1 179#endif 180 | 63#ifdef _KERNEL 64 65#define ATA_MAX_28BIT_LBA 268435455UL 66 67typedef enum { 68 ADA_STATE_NORMAL 69} ada_state; 70 --- 104 unchanged lines hidden (view full) --- 175#ifndef ADA_DEFAULT_RETRY 176#define ADA_DEFAULT_RETRY 4 177#endif 178 179#ifndef ADA_DEFAULT_SEND_ORDERED 180#define ADA_DEFAULT_SEND_ORDERED 1 181#endif 182 |
183/* 184 * Most platforms map firmware geometry to actual, but some don't. If 185 * not overridden, default to nothing. 186 */ 187#ifndef ata_disk_firmware_geom_adjust 188#define ata_disk_firmware_geom_adjust(disk) 189#endif |
|
181 182static int ada_retry_count = ADA_DEFAULT_RETRY; 183static int ada_default_timeout = ADA_DEFAULT_TIMEOUT; 184static int ada_send_ordered = ADA_DEFAULT_SEND_ORDERED; 185 186SYSCTL_NODE(_kern_cam, OID_AUTO, ada, CTLFLAG_RD, 0, 187 "CAM Direct Access Disk driver"); 188SYSCTL_INT(_kern_cam_ada, OID_AUTO, retry_count, CTLFLAG_RW, --- 543 unchanged lines hidden (view full) --- 732 if (ata_physical_sector_size(&cgd->ident_data) != 733 softc->params.secsize) { 734 softc->disk->d_stripesize = 735 ata_physical_sector_size(&cgd->ident_data); 736 softc->disk->d_stripeoffset = (softc->disk->d_stripesize - 737 ata_logical_sector_offset(&cgd->ident_data)) % 738 softc->disk->d_stripesize; 739 } | 190 191static int ada_retry_count = ADA_DEFAULT_RETRY; 192static int ada_default_timeout = ADA_DEFAULT_TIMEOUT; 193static int ada_send_ordered = ADA_DEFAULT_SEND_ORDERED; 194 195SYSCTL_NODE(_kern_cam, OID_AUTO, ada, CTLFLAG_RD, 0, 196 "CAM Direct Access Disk driver"); 197SYSCTL_INT(_kern_cam_ada, OID_AUTO, retry_count, CTLFLAG_RW, --- 543 unchanged lines hidden (view full) --- 741 if (ata_physical_sector_size(&cgd->ident_data) != 742 softc->params.secsize) { 743 softc->disk->d_stripesize = 744 ata_physical_sector_size(&cgd->ident_data); 745 softc->disk->d_stripeoffset = (softc->disk->d_stripesize - 746 ata_logical_sector_offset(&cgd->ident_data)) % 747 softc->disk->d_stripesize; 748 } |
740 /* XXX: these are not actually "firmware" values, so they may be wrong */ | |
741 softc->disk->d_fwsectors = softc->params.secs_per_track; 742 softc->disk->d_fwheads = softc->params.heads; | 749 softc->disk->d_fwsectors = softc->params.secs_per_track; 750 softc->disk->d_fwheads = softc->params.heads; |
751 ata_disk_firmware_geom_adjust(softc->disk); |
|
743 744 disk_create(softc->disk, DISK_VERSION); 745 mtx_lock(periph->sim->mtx); 746 747 dp = &softc->params; 748 snprintf(announce_buf, sizeof(announce_buf), 749 "%juMB (%ju %u byte sectors: %dH %dS/T %dC)", 750 (uintmax_t)(((uintmax_t)dp->secsize * --- 468 unchanged lines hidden --- | 752 753 disk_create(softc->disk, DISK_VERSION); 754 mtx_lock(periph->sim->mtx); 755 756 dp = &softc->params; 757 snprintf(announce_buf, sizeof(announce_buf), 758 "%juMB (%ju %u byte sectors: %dH %dS/T %dC)", 759 (uintmax_t)(((uintmax_t)dp->secsize * --- 468 unchanged lines hidden --- |