mlx_disk.c (111497) | mlx_disk.c (111499) |
---|---|
1/*- 2 * Copyright (c) 1999 Jonathan Lemon 3 * Copyright (c) 1999 Michael Smith 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 10 unchanged lines hidden (view full) --- 19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 * | 1/*- 2 * Copyright (c) 1999 Jonathan Lemon 3 * Copyright (c) 1999 Michael Smith 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 10 unchanged lines hidden (view full) --- 19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 * |
27 * $FreeBSD: head/sys/dev/mlx/mlx_disk.c 111497 2003-02-25 20:35:56Z jhb $ | 27 * $FreeBSD: head/sys/dev/mlx/mlx_disk.c 111499 2003-02-25 20:47:22Z jhb $ |
28 */ 29 30/* 31 * Disk driver for Mylex DAC960 RAID adapters. 32 */ 33 34#include <sys/param.h> 35#include <sys/systm.h> --- 194 unchanged lines hidden (view full) --- 230 sc->mlxd_disk.d_drv1 = sc; 231 sc->mlxd_disk.d_sectorsize = MLX_BLKSIZE; 232 sc->mlxd_disk.d_mediasize = MLX_BLKSIZE * (off_t)sc->mlxd_drive->ms_size; 233 sc->mlxd_disk.d_fwsectors = sc->mlxd_drive->ms_sectors; 234 sc->mlxd_disk.d_fwheads = sc->mlxd_drive->ms_heads; 235 236 /* 237 * Set maximum I/O size to the lesser of the recommended maximum and the practical | 28 */ 29 30/* 31 * Disk driver for Mylex DAC960 RAID adapters. 32 */ 33 34#include <sys/param.h> 35#include <sys/systm.h> --- 194 unchanged lines hidden (view full) --- 230 sc->mlxd_disk.d_drv1 = sc; 231 sc->mlxd_disk.d_sectorsize = MLX_BLKSIZE; 232 sc->mlxd_disk.d_mediasize = MLX_BLKSIZE * (off_t)sc->mlxd_drive->ms_size; 233 sc->mlxd_disk.d_fwsectors = sc->mlxd_drive->ms_sectors; 234 sc->mlxd_disk.d_fwheads = sc->mlxd_drive->ms_heads; 235 236 /* 237 * Set maximum I/O size to the lesser of the recommended maximum and the practical |
238 * maximum. | 238 * maximum except on v2 cards where the maximum is set to 8 pages. |
239 */ | 239 */ |
240 s1 = sc->mlxd_controller->mlx_enq2->me_maxblk * MLX_BLKSIZE; 241 s2 = (sc->mlxd_controller->mlx_enq2->me_max_sg - 1) * PAGE_SIZE; 242 sc->mlxd_disk.d_maxsize = imin(s1, s2); | 240 if (sc->mlxd_controller->mlx_iftype == MLX_IFTYPE_2) 241 dsk->si_iosize_max = 8 * PAGE_SIZE; 242 else { 243 s1 = sc->mlxd_controller->mlx_enq2->me_maxblk * MLX_BLKSIZE; 244 s2 = (sc->mlxd_controller->mlx_enq2->me_max_sg - 1) * PAGE_SIZE; 245 dsk->si_iosize_max = imin(s1, s2); 246 } |
243 244 disk_create(sc->mlxd_unit, &sc->mlxd_disk, 0, NULL, NULL); 245 246 return (0); 247} 248 249static int 250mlxd_detach(device_t dev) 251{ 252 struct mlxd_softc *sc = (struct mlxd_softc *)device_get_softc(dev); 253 254 debug_called(1); 255 256 devstat_remove_entry(&sc->mlxd_stats); 257 disk_destroy(&sc->mlxd_disk); 258 259 return(0); 260} 261 | 247 248 disk_create(sc->mlxd_unit, &sc->mlxd_disk, 0, NULL, NULL); 249 250 return (0); 251} 252 253static int 254mlxd_detach(device_t dev) 255{ 256 struct mlxd_softc *sc = (struct mlxd_softc *)device_get_softc(dev); 257 258 debug_called(1); 259 260 devstat_remove_entry(&sc->mlxd_stats); 261 disk_destroy(&sc->mlxd_disk); 262 263 return(0); 264} 265 |