mlx.c (072d5b98c4318e20248a6fbea4a5ca7c96992cac) mlx.c (c6df6f5322f7004c71216391e1c0b374d853704a)
1/*-
2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3 *
4 * Copyright (c) 1999 Michael Smith
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

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

825 }
826 MLX_CONFIG_UNLOCK(sc);
827 return(ENOENT);
828
829 /*
830 * Scan the controller to see whether new drives have appeared.
831 */
832 case MLX_RESCAN_DRIVES:
1/*-
2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3 *
4 * Copyright (c) 1999 Michael Smith
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

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

825 }
826 MLX_CONFIG_UNLOCK(sc);
827 return(ENOENT);
828
829 /*
830 * Scan the controller to see whether new drives have appeared.
831 */
832 case MLX_RESCAN_DRIVES:
833 mtx_lock(&Giant);
833 bus_topo_lock();
834 mlx_startup(sc);
834 mlx_startup(sc);
835 mtx_unlock(&Giant);
835 bus_topo_unlock();
836 return(0);
837
838 /*
839 * Disconnect from the specified drive; it may be about to go
840 * away.
841 */
842 case MLX_DETACH_DRIVE: /* detach one drive */
843 MLX_CONFIG_LOCK(sc);

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

974
975 /*
976 * Return the per-controller system drive number matching the
977 * disk device number in (arg), if it happens to belong to us.
978 */
979 case MLX_GET_SYSDRIVE:
980 error = ENOENT;
981 MLX_CONFIG_LOCK(sc);
836 return(0);
837
838 /*
839 * Disconnect from the specified drive; it may be about to go
840 * away.
841 */
842 case MLX_DETACH_DRIVE: /* detach one drive */
843 MLX_CONFIG_LOCK(sc);

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

974
975 /*
976 * Return the per-controller system drive number matching the
977 * disk device number in (arg), if it happens to belong to us.
978 */
979 case MLX_GET_SYSDRIVE:
980 error = ENOENT;
981 MLX_CONFIG_LOCK(sc);
982 mtx_lock(&Giant);
982 bus_topo_lock();
983 mlxd = (struct mlxd_softc *)devclass_get_softc(mlxd_devclass, *arg);
983 mlxd = (struct mlxd_softc *)devclass_get_softc(mlxd_devclass, *arg);
984 mtx_unlock(&Giant);
984 bus_topo_unlock();
985 if ((mlxd != NULL) && (mlxd->mlxd_drive >= sc->mlx_sysdrive) &&
986 (mlxd->mlxd_drive < (sc->mlx_sysdrive + MLX_MAXDRIVES))) {
987 error = 0;
988 *arg = mlxd->mlxd_drive - sc->mlx_sysdrive;
989 }
990 MLX_CONFIG_UNLOCK(sc);
991 return(error);
992

--- 2084 unchanged lines hidden ---
985 if ((mlxd != NULL) && (mlxd->mlxd_drive >= sc->mlx_sysdrive) &&
986 (mlxd->mlxd_drive < (sc->mlx_sysdrive + MLX_MAXDRIVES))) {
987 error = 0;
988 *arg = mlxd->mlxd_drive - sc->mlx_sysdrive;
989 }
990 MLX_CONFIG_UNLOCK(sc);
991 return(error);
992

--- 2084 unchanged lines hidden ---