Deleted Added
full compact
mlx_disk.c (119418) mlx_disk.c (125975)
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:

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

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 */
28
29#include <sys/cdefs.h>
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:

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

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 */
28
29#include <sys/cdefs.h>
30__FBSDID("$FreeBSD: head/sys/dev/mlx/mlx_disk.c 119418 2003-08-24 17:55:58Z obrien $");
30__FBSDID("$FreeBSD: head/sys/dev/mlx/mlx_disk.c 125975 2004-02-18 21:36:53Z phk $");
31
32/*
33 * Disk driver for Mylex DAC960 RAID adapters.
34 */
35
36#include <sys/param.h>
37#include <sys/systm.h>
38#include <sys/kernel.h>

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

214 default:
215 state = "unknown state";
216 }
217
218 device_printf(dev, "%uMB (%u sectors) RAID %d (%s)\n",
219 sc->mlxd_drive->ms_size / ((1024 * 1024) / MLX_BLKSIZE),
220 sc->mlxd_drive->ms_size, sc->mlxd_drive->ms_raidlevel, state);
221
31
32/*
33 * Disk driver for Mylex DAC960 RAID adapters.
34 */
35
36#include <sys/param.h>
37#include <sys/systm.h>
38#include <sys/kernel.h>

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

214 default:
215 state = "unknown state";
216 }
217
218 device_printf(dev, "%uMB (%u sectors) RAID %d (%s)\n",
219 sc->mlxd_drive->ms_size / ((1024 * 1024) / MLX_BLKSIZE),
220 sc->mlxd_drive->ms_size, sc->mlxd_drive->ms_raidlevel, state);
221
222 sc->mlxd_disk.d_open = mlxd_open;
223 sc->mlxd_disk.d_close = mlxd_close;
224 sc->mlxd_disk.d_ioctl = mlxd_ioctl;
225 sc->mlxd_disk.d_strategy = mlxd_strategy;
226 sc->mlxd_disk.d_name = "mlxd";
227 sc->mlxd_disk.d_drv1 = sc;
228 sc->mlxd_disk.d_sectorsize = MLX_BLKSIZE;
229 sc->mlxd_disk.d_mediasize = MLX_BLKSIZE * (off_t)sc->mlxd_drive->ms_size;
230 sc->mlxd_disk.d_fwsectors = sc->mlxd_drive->ms_sectors;
231 sc->mlxd_disk.d_fwheads = sc->mlxd_drive->ms_heads;
222 sc->mlxd_disk = disk_alloc();
223 sc->mlxd_disk->d_open = mlxd_open;
224 sc->mlxd_disk->d_close = mlxd_close;
225 sc->mlxd_disk->d_ioctl = mlxd_ioctl;
226 sc->mlxd_disk->d_strategy = mlxd_strategy;
227 sc->mlxd_disk->d_name = "mlxd";
228 sc->mlxd_disk->d_unit = sc->mlxd_unit;
229 sc->mlxd_disk->d_drv1 = sc;
230 sc->mlxd_disk->d_sectorsize = MLX_BLKSIZE;
231 sc->mlxd_disk->d_mediasize = MLX_BLKSIZE * (off_t)sc->mlxd_drive->ms_size;
232 sc->mlxd_disk->d_fwsectors = sc->mlxd_drive->ms_sectors;
233 sc->mlxd_disk->d_fwheads = sc->mlxd_drive->ms_heads;
234 sc->mlxd_disk->d_flags = DISKFLAG_NEEDSGIANT;
232
233 /*
234 * Set maximum I/O size to the lesser of the recommended maximum and the practical
235 * maximum except on v2 cards where the maximum is set to 8 pages.
236 */
237 if (sc->mlxd_controller->mlx_iftype == MLX_IFTYPE_2)
235
236 /*
237 * Set maximum I/O size to the lesser of the recommended maximum and the practical
238 * maximum except on v2 cards where the maximum is set to 8 pages.
239 */
240 if (sc->mlxd_controller->mlx_iftype == MLX_IFTYPE_2)
238 sc->mlxd_disk.d_maxsize = 8 * PAGE_SIZE;
241 sc->mlxd_disk->d_maxsize = 8 * PAGE_SIZE;
239 else {
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 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;
242 sc->mlxd_disk.d_maxsize = imin(s1, s2);
245 sc->mlxd_disk->d_maxsize = imin(s1, s2);
243 }
244
246 }
247
245 disk_create(sc->mlxd_unit, &sc->mlxd_disk, 0, NULL, NULL);
248 disk_create(sc->mlxd_disk, DISK_VERSION);
246
247 return (0);
248}
249
250static int
251mlxd_detach(device_t dev)
252{
253 struct mlxd_softc *sc = (struct mlxd_softc *)device_get_softc(dev);
254
255 debug_called(1);
256
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
257 disk_destroy(&sc->mlxd_disk);
260 disk_destroy(sc->mlxd_disk);
258
259 return(0);
260}
261
261
262 return(0);
263}
264