aac_disk.c (177567) | aac_disk.c (177619) |
---|---|
1/*- 2 * Copyright (c) 2000 Michael Smith 3 * Copyright (c) 2001 Scott Long 4 * Copyright (c) 2000 BSDi 5 * Copyright (c) 2001 Adaptec, Inc. 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 14 unchanged lines hidden (view full) --- 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 */ 29 30#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2000 Michael Smith 3 * Copyright (c) 2001 Scott Long 4 * Copyright (c) 2000 BSDi 5 * Copyright (c) 2001 Adaptec, Inc. 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 14 unchanged lines hidden (view full) --- 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 */ 29 30#include <sys/cdefs.h> |
31__FBSDID("$FreeBSD: head/sys/dev/aac/aac_disk.c 177567 2008-03-24 19:23:33Z emaste $"); | 31__FBSDID("$FreeBSD: head/sys/dev/aac/aac_disk.c 177619 2008-03-25 21:39:06Z emaste $"); |
32 33#include "opt_aac.h" 34 35#include <sys/param.h> 36#include <sys/systm.h> 37#include <sys/kernel.h> 38#include <sys/module.h> 39#include <sys/sysctl.h> --- 298 unchanged lines hidden (view full) --- 338 sc->ad_container = device_get_ivars(dev); 339 sc->ad_dev = dev; 340 341 /* 342 * require that extended translation be enabled - other drivers read the 343 * disk! 344 */ 345 sc->ad_size = sc->ad_container->co_mntobj.Capacity; | 32 33#include "opt_aac.h" 34 35#include <sys/param.h> 36#include <sys/systm.h> 37#include <sys/kernel.h> 38#include <sys/module.h> 39#include <sys/sysctl.h> --- 298 unchanged lines hidden (view full) --- 338 sc->ad_container = device_get_ivars(dev); 339 sc->ad_dev = dev; 340 341 /* 342 * require that extended translation be enabled - other drivers read the 343 * disk! 344 */ 345 sc->ad_size = sc->ad_container->co_mntobj.Capacity; |
346 if (sc->ad_controller->flags & AAC_FLAGS_LBA_64BIT) 347 sc->ad_size += (u_int64_t) 348 sc->ad_container->co_mntobj.CapacityHigh << 32; |
|
346 if (sc->ad_size >= (2 * 1024 * 1024)) { /* 2GB */ 347 sc->ad_heads = 255; 348 sc->ad_sectors = 63; 349 } else if (sc->ad_size >= (1 * 1024 * 1024)) { /* 1GB */ 350 sc->ad_heads = 128; 351 sc->ad_sectors = 32; 352 } else { 353 sc->ad_heads = 64; 354 sc->ad_sectors = 32; 355 } 356 sc->ad_cylinders = (sc->ad_size / (sc->ad_heads * sc->ad_sectors)); 357 | 349 if (sc->ad_size >= (2 * 1024 * 1024)) { /* 2GB */ 350 sc->ad_heads = 255; 351 sc->ad_sectors = 63; 352 } else if (sc->ad_size >= (1 * 1024 * 1024)) { /* 1GB */ 353 sc->ad_heads = 128; 354 sc->ad_sectors = 32; 355 } else { 356 sc->ad_heads = 64; 357 sc->ad_sectors = 32; 358 } 359 sc->ad_cylinders = (sc->ad_size / (sc->ad_heads * sc->ad_sectors)); 360 |
358 device_printf(dev, "%uMB (%u sectors)\n", 359 sc->ad_size / ((1024 * 1024) / AAC_BLOCK_SIZE), 360 sc->ad_size); | 361 device_printf(dev, "%juMB (%ju sectors)\n", 362 (intmax_t)sc->ad_size / ((1024 * 1024) / AAC_BLOCK_SIZE), 363 (intmax_t)sc->ad_size); |
361 362 /* attach a generic disk device to ourselves */ 363 sc->unit = device_get_unit(dev); 364 sc->ad_disk = disk_alloc(); 365 sc->ad_disk->d_drv1 = sc; 366 sc->ad_disk->d_name = "aacd"; 367 sc->ad_disk->d_maxsize = aac_iosize_max; 368 sc->ad_disk->d_open = aac_disk_open; --- 31 unchanged lines hidden --- | 364 365 /* attach a generic disk device to ourselves */ 366 sc->unit = device_get_unit(dev); 367 sc->ad_disk = disk_alloc(); 368 sc->ad_disk->d_drv1 = sc; 369 sc->ad_disk->d_name = "aacd"; 370 sc->ad_disk->d_maxsize = aac_iosize_max; 371 sc->ad_disk->d_open = aac_disk_open; --- 31 unchanged lines hidden --- |