From nobody Thu Nov 25 07:46:52 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 7AC9618A11CA; Thu, 25 Nov 2021 07:46:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4J091n0q0mz4sXg; Thu, 25 Nov 2021 07:46:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F03BB19B90; Thu, 25 Nov 2021 07:46:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1AP7kq7G049884; Thu, 25 Nov 2021 07:46:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1AP7kqNk049883; Thu, 25 Nov 2021 07:46:52 GMT (envelope-from git) Date: Thu, 25 Nov 2021 07:46:52 GMT Message-Id: <202111250746.1AP7kqNk049883@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: a9620045a5b9 - main - mly: Remove. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a9620045a5b91f2b86e7ab0f3d27c1030d1ecafc Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1637826413; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=RjyVGF4Fdb2koZaaqpic/O4E9Yr3fIyyhwjeHriWd7Q=; b=aXECmpe5ZFLqb8oamwKAvU+BXGGinaul6GsqBXIsNARroaEGNL9ZAT71GUUaqKgm2BKG19 as+pF6RwFsb3XZaVJwtcQ0rkZwFBb+HG7ns6JNIdZ+ovJ+fxWv9wArK5AgvUwgMkXksJuv qIsSB4QROKw4l4t7EbM1a3b7kHDXnpoZSCit9uK1RF8y/AsGoe6JhLAmsmnkYkkwKBTtDs gNUWUv8/ojvJ78n/FyqtssA8aRFpiHUDKeAuwowNbFPJ+16fLsjbsX9wzyCEt7WgkfSpCk VBLaSoTeFpVPcwN0u1MamWP4bS7G873YtpEY5DtP229LQC89pYDYXsmcFauTbQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1637826413; a=rsa-sha256; cv=none; b=wSPpIwO63/pP+bZTYtgO0AXEYknJ1lRNEIQs2RgbgRK/HV0HhZObp+QbC8B2owA5iZLJVj oNskaytLZ0imFF/H9i4x21IruSe8SEM05SyOufBEVe+yR6HKU3h8tXC0XjFr7TgYL7X0pJ MNs0slJsZsacjrt+f22reWOAXAi7ZwFXknMqNbWMu/iql6b4B89kUwlzwAF2KsGToAno0V g0z9ZH06LPL5lLOeQXrawbOoz4tUTdLQuwyLaFRpiA2kNqEfcK/TwKekQQkrA0jUPklwfk yL0ePphs9tZrbBfbt8UASpezHDb2CtlbvcWhTOwfxF6IzJoorS3Ly0Q2MiEnjw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=a9620045a5b91f2b86e7ab0f3d27c1030d1ecafc commit a9620045a5b91f2b86e7ab0f3d27c1030d1ecafc Author: Warner Losh AuthorDate: 2021-11-25 07:20:10 +0000 Commit: Warner Losh CommitDate: 2021-11-25 07:45:12 +0000 mly: Remove. We'd said this was going away in 13, but was overlooked. Belatedly remove. Sponsored by: Netflix Relnotes: yes Reviewed by: scottl Differential Revision: https://reviews.freebsd.org/D33111 --- share/man/man4/Makefile | 1 - share/man/man4/mly.4 | 275 --- sys/amd64/conf/GENERIC | 1 - sys/conf/NOTES | 7 - sys/conf/files | 1 - sys/dev/mly/mly.c | 3003 ------------------------------- sys/dev/mly/mly_tables.h | 325 ---- sys/dev/mly/mlyio.h | 72 - sys/dev/mly/mlyreg.h | 1272 ------------- sys/dev/mly/mlyvar.h | 370 ---- sys/i386/conf/GENERIC | 1 - sys/modules/Makefile | 2 - sys/modules/mly/Makefile | 13 - tools/kerneldoc/subsys/Doxyfile-dev_mly | 21 - 14 files changed, 5364 deletions(-) diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile index dfef254bff56..6bb519b36e1e 100644 --- a/share/man/man4/Makefile +++ b/share/man/man4/Makefile @@ -305,7 +305,6 @@ MAN= aac.4 \ mlx.4 \ mlx4en.4 \ mlx5en.4 \ - mly.4 \ mmc.4 \ mmcsd.4 \ mod_cc.4 \ diff --git a/share/man/man4/mly.4 b/share/man/man4/mly.4 deleted file mode 100644 index 1a59903dfb2c..000000000000 --- a/share/man/man4/mly.4 +++ /dev/null @@ -1,275 +0,0 @@ -.\" -.\" Copyright (c) 2000 Michael Smith -.\" Copyright (c) 2000 BSDi -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. The name of the author may not be used to endorse or promote products -.\" derived from this software without specific prior written permission -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -.\" -.\" $FreeBSD$ -.\" -.Dd August 10, 2004 -.Dt MLY 4 -.Os -.Sh NAME -.Nm mly -.Nd Mylex AcceleRAID/eXtremeRAID family driver -.Sh SYNOPSIS -To compile this driver into the kernel, -place the following lines in your -kernel configuration file: -.Bd -ragged -offset indent -.Cd "device pci" -.Cd "device scbus" -.Cd "device da" -.Cd "device mly" -.Ed -.Pp -Alternatively, to load the driver as a -module at boot time, place the following line in -.Xr loader.conf 5 : -.Bd -literal -offset indent -mly_load="YES" -.Ed -.Sh DEPRECATION NOTICE -The -.Nm -driver is not present in -.Fx 13.0 . -.Sh DESCRIPTION -The -.Nm -driver provides support for Mylex AcceleRAID and eXtremeRAID-family -PCI to SCSI RAID controllers with version 6.00 and later -firmware. -.Pp -Logical devices (array drives) attached to the controller are presented -to the SCSI subsystem as though they were direct-access devices on a -virtual SCSI bus. -Physical devices which are not claimed by a logical -device are presented on SCSI channels which match the physical channels -on the controller. -.Sh HARDWARE -Controllers supported by the -.Nm -driver include: -.Pp -.Bl -bullet -compact -.It -Mylex AcceleRAID 160 -.It -Mylex AcceleRAID 170 -.It -Mylex AcceleRAID 352 -.It -Mylex eXtremeRAID 2000 -.It -Mylex eXtremeRAID 3000 -.El -.Pp -Compatible Mylex controllers not listed should work, but have not been -verified. -.Sh DIAGNOSTICS -.Ss Controller initialisation phase -.Bl -diag -.It "mly%d: controller initialisation started" -.It "mly%d: initialisation complete" -.Pp -The controller firmware has started initialisation. -Normally this process is performed by the controller BIOS, -but the driver may need -to do this in cases where the BIOS has failed, or is not compatible -(e.g.\& on non-x86 systems). -.It "mly%d: drive spinup in progress" -.Pp -Drive startup is in progress; this may take several minutes. -.It "mly%d: mirror race recovery failed, one or more drives offline" -.It "mly%d: mirror race recovery in progress" -.It "mly%d: mirror race recovery on a critical drive" -.Pp -These error codes are undocumented. -.It "mly%d: FATAL MEMORY PARITY ERROR" -.Pp -Firmware detected a fatal memory error; the driver will not attempt to -attach to this controller. -.It "mly%d: unknown initialisation code %x" -.Pp -An unknown error occurred during initialisation; it will be ignored. -.El -.Ss Driver initialisation/shutdown phase -.Bl -diag -.It "mly%d: can't enable busmaster feature" -.It "mly%d: memory window not available" -.It "mly%d: can't allocate register window" -.It "mly%d: can't allocate interrupt" -.It "mly%d: can't set up interrupt" -.Pp -The system's PCI BIOS has not correctly configured the controller's -PCI interface; initialisation has failed and the driver will not -attach to this controller. -.It "mly%d: can't allocate parent DMA tag" -.It "mly%d: can't allocate buffer DMA tag" -.It "mly%d: can't allocate command packet DMA tag" -.It "mly%d: can't allocate scatter/gather DMA tag" -.It "mly%d: can't allocate s/g table" -.It "mly%d: can't allocate memory mailbox DMA tag" -.It "mly%d: can't allocate memory mailbox" -.Pp -A resource allocation error occurred while initialising the driver; -initialisation has failed and the driver will not attach to this -controller. -.It "mly%d: BTL rescan result corrupted" -.Pp -The results of a scan for an attached device were corrupted. -One or more devices may not be correctly reported. -.It "mly%d: flushing cache..." -.Pp -The controller cache is being flushed prior to detach or shutdown. -.El -.Ss Operational diagnostics -.Bl -diag -.It "mly%d: physical device %d:%d online" -.It "mly%d: physical device %d:%d standby" -.It "mly%d: physical device %d:%d automatic rebuild started" -.It "mly%d: physical device %d:%d manual rebuild started" -.It "mly%d: physical device %d:%d rebuild completed" -.It "mly%d: physical device %d:%d rebuild cancelled" -.It "mly%d: physical device %d:%d rebuild failed for unknown reasons" -.It "mly%d: physical device %d:%d rebuild failed due to new physical device" -.It "mly%d: physical device %d:%d rebuild failed due to logical drive failure" -.It "mly%d: physical device %d:%d found" -.It "mly%d: physical device %d:%d gone" -.It "mly%d: physical device %d:%d unconfigured" -.It "mly%d: physical device %d:%d expand capacity started" -.It "mly%d: physical device %d:%d expand capacity completed" -.It "mly%d: physical device %d:%d expand capacity failed" -.It "mly%d: physical device %d:%d parity error" -.It "mly%d: physical device %d:%d soft error" -.It "mly%d: physical device %d:%d miscellaneous error" -.It "mly%d: physical device %d:%d reset" -.It "mly%d: physical device %d:%d active spare found" -.It "mly%d: physical device %d:%d warm spare found" -.It "mly%d: physical device %d:%d initialization started" -.It "mly%d: physical device %d:%d initialization completed" -.It "mly%d: physical device %d:%d initialization failed" -.It "mly%d: physical device %d:%d initialization cancelled" -.It "mly%d: physical device %d:%d write recovery failed" -.It "mly%d: physical device %d:%d scsi bus reset failed" -.It "mly%d: physical device %d:%d double check condition" -.It "mly%d: physical device %d:%d device cannot be accessed" -.It "mly%d: physical device %d:%d gross error on scsi processor" -.It "mly%d: physical device %d:%d bad tag from device" -.It "mly%d: physical device %d:%d command timeout" -.It "mly%d: physical device %d:%d system reset" -.It "mly%d: physical device %d:%d busy status or parity error" -.It "mly%d: physical device %d:%d host set device to failed state" -.It "mly%d: physical device %d:%d selection timeout" -.It "mly%d: physical device %d:%d scsi bus phase error" -.It "mly%d: physical device %d:%d device returned unknown status" -.It "mly%d: physical device %d:%d device not ready" -.It "mly%d: physical device %d:%d device not found at startup" -.It "mly%d: physical device %d:%d COD write operation failed" -.It "mly%d: physical device %d:%d BDT write operation failed" -.It "mly%d: physical device %d:%d missing at startup" -.It "mly%d: physical device %d:%d start rebuild failed due to physical drive too small" -.It "mly%d: physical device %d:%d sense data received" -.It "mly%d: sense key %d asc %02x ascq %02x" -.It "mly%d: info %4D csi %4D" -.It "mly%d: physical device %d:%d offline" -.It "mly%d: sense key %d asc %02x ascq %02x" -.It "mly%d: info %4D csi %4D" -.Pp -The reported event refers to the physical device at the given channel:target -address. -.It "mly%d: logical device %d (%s) consistency check started" -.It "mly%d: logical device %d (%s) consistency check completed" -.It "mly%d: logical device %d (%s) consistency check cancelled" -.It "mly%d: logical device %d (%s) consistency check completed with errors" -.It "mly%d: logical device %d (%s) consistency check failed due to logical drive failure" -.It "mly%d: logical device %d (%s) consistency check failed due to physical device failure" -.It "mly%d: logical device %d (%s) automatic rebuild started" -.It "mly%d: logical device %d (%s) manual rebuild started" -.It "mly%d: logical device %d (%s) rebuild completed" -.It "mly%d: logical device %d (%s) rebuild cancelled" -.It "mly%d: logical device %d (%s) rebuild failed for unknown reasons" -.It "mly%d: logical device %d (%s) rebuild failed due to new physical device" -.It "mly%d: logical device %d (%s) rebuild failed due to logical drive failure" -.It "mly%d: logical device %d (%s) offline" -.It "mly%d: logical device %d (%s) critical" -.It "mly%d: logical device %d (%s) online" -.It "mly%d: logical device %d (%s) initialization started" -.It "mly%d: logical device %d (%s) initialization completed" -.It "mly%d: logical device %d (%s) initialization cancelled" -.It "mly%d: logical device %d (%s) initialization failed" -.It "mly%d: logical device %d (%s) found" -.It "mly%d: logical device %d (%s) gone" -.It "mly%d: logical device %d (%s) expand capacity started" -.It "mly%d: logical device %d (%s) expand capacity completed" -.It "mly%d: logical device %d (%s) expand capacity failed" -.It "mly%d: logical device %d (%s) bad block found" -.It "mly%d: logical device %d (%s) size changed" -.It "mly%d: logical device %d (%s) type changed" -.It "mly%d: logical device %d (%s) bad data block found" -.It "mly%d: logical device %d (%s) read of data block in bdt" -.It "mly%d: logical device %d (%s) write back data for disk block lost" -.Pp -The event report will include the name of the SCSI device which has -attached to the device if possible. -.It "mly%d: enclosure %d fan %d failed" -.It "mly%d: enclosure %d fan %d ok" -.It "mly%d: enclosure %d fan %d not present" -.It "mly%d: enclosure %d power supply %d failed" -.It "mly%d: enclosure %d power supply %d ok" -.It "mly%d: enclosure %d power supply %d not present" -.It "mly%d: enclosure %d temperature sensor %d failed" -.It "mly%d: enclosure %d temperature sensor %d critical" -.It "mly%d: enclosure %d temperature sensor %d ok" -.It "mly%d: enclosure %d temperature sensor %d not present" -.It "mly%d: enclosure %d unit %d access critical" -.It "mly%d: enclosure %d unit %d access ok" -.It "mly%d: enclosure %d unit %d access offline" -.Pp -These events refer to external enclosures by number. -The driver does not attempt to name the enclosures. -.It "mly%d: controller cache write back error" -.It "mly%d: controller battery backup unit found" -.It "mly%d: controller battery backup unit charge level low" -.It "mly%d: controller battery backup unit charge level ok" -.It "mly%d: controller installation aborted" -.It "mly%d: controller mirror race recovery in progress" -.It "mly%d: controller mirror race on critical drive" -.It "mly%d: controller memory soft ecc error" -.It "mly%d: controller memory hard ecc error" -.It "mly%d: controller battery backup unit failed" -.Pp -These events report controller status changes. -.El -.Sh AUTHORS -.An -nosplit -The -.Nm -driver was written by -.An Michael Smith Aq Mt msmith@FreeBSD.org . -.Pp -This manual page was written by -.An Michael Smith Aq Mt msmith@FreeBSD.org . -.Sh BUGS -The driver does not yet provide an external management interface. -.Pp -Enclosures are not named or otherwise identified in event messages. diff --git a/sys/amd64/conf/GENERIC b/sys/amd64/conf/GENERIC index 589d81e06dde..7b3a5f91e936 100644 --- a/sys/amd64/conf/GENERIC +++ b/sys/amd64/conf/GENERIC @@ -185,7 +185,6 @@ device arcmsr # Areca SATA II RAID device ciss # Compaq Smart RAID 5* device iir # Intel Integrated RAID device ips # IBM (Adaptec) ServeRAID -device mly # Mylex AcceleRAID/eXtremeRAID device twa # 3ware 9000 series PATA/SATA RAID device smartpqi # Microsemi smartpqi driver device tws # LSI 3ware 9750 SATA+SAS 6Gb/s RAID controller diff --git a/sys/conf/NOTES b/sys/conf/NOTES index 79fa149ad33f..d0749fe23b87 100644 --- a/sys/conf/NOTES +++ b/sys/conf/NOTES @@ -1644,13 +1644,6 @@ device ciss # device iir -# -# Mylex AcceleRAID and eXtremeRAID controllers with v6 and later -# firmware. These controllers have a SCSI-like interface, and require -# the CAM infrastructure. -# -device mly - # # Compaq Smart RAID, Mylex DAC960 and AMI MegaRAID controllers. Only # one entry is needed; the code will find and configure all supported diff --git a/sys/conf/files b/sys/conf/files index 8936cdaf5bd3..e65c318d1514 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -2459,7 +2459,6 @@ dev/mlxfw/mlxfw_mfa2_tlv_multi.c optional mlxfw \ dev/mlx/mlx.c optional mlx dev/mlx/mlx_disk.c optional mlx dev/mlx/mlx_pci.c optional mlx pci -dev/mly/mly.c optional mly dev/mmc/mmc_subr.c optional mmc | mmcsd !mmccam dev/mmc/mmc.c optional mmc !mmccam dev/mmc/mmcbr_if.m standard diff --git a/sys/dev/mly/mly.c b/sys/dev/mly/mly.c deleted file mode 100644 index 1bdcdbb87443..000000000000 --- a/sys/dev/mly/mly.c +++ /dev/null @@ -1,3003 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2000, 2001 Michael Smith - * Copyright (c) 2000 BSDi - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include - -static int mly_probe(device_t dev); -static int mly_attach(device_t dev); -static int mly_pci_attach(struct mly_softc *sc); -static int mly_detach(device_t dev); -static int mly_shutdown(device_t dev); -static void mly_intr(void *arg); - -static int mly_sg_map(struct mly_softc *sc); -static void mly_sg_map_helper(void *arg, bus_dma_segment_t *segs, int nseg, int error); -static int mly_mmbox_map(struct mly_softc *sc); -static void mly_mmbox_map_helper(void *arg, bus_dma_segment_t *segs, int nseg, int error); -static void mly_free(struct mly_softc *sc); - -static int mly_get_controllerinfo(struct mly_softc *sc); -static void mly_scan_devices(struct mly_softc *sc); -static void mly_rescan_btl(struct mly_softc *sc, int bus, int target); -static void mly_complete_rescan(struct mly_command *mc); -static int mly_get_eventstatus(struct mly_softc *sc); -static int mly_enable_mmbox(struct mly_softc *sc); -static int mly_flush(struct mly_softc *sc); -static int mly_ioctl(struct mly_softc *sc, struct mly_command_ioctl *ioctl, void **data, - size_t datasize, u_int8_t *status, void *sense_buffer, size_t *sense_length); -static void mly_check_event(struct mly_softc *sc); -static void mly_fetch_event(struct mly_softc *sc); -static void mly_complete_event(struct mly_command *mc); -static void mly_process_event(struct mly_softc *sc, struct mly_event *me); -static void mly_periodic(void *data); - -static int mly_immediate_command(struct mly_command *mc); -static int mly_start(struct mly_command *mc); -static void mly_done(struct mly_softc *sc); -static void mly_complete(struct mly_softc *sc); -static void mly_complete_handler(void *context, int pending); - -static int mly_alloc_command(struct mly_softc *sc, struct mly_command **mcp); -static void mly_release_command(struct mly_command *mc); -static void mly_alloc_commands_map(void *arg, bus_dma_segment_t *segs, int nseg, int error); -static int mly_alloc_commands(struct mly_softc *sc); -static void mly_release_commands(struct mly_softc *sc); -static void mly_map_command(struct mly_command *mc); -static void mly_unmap_command(struct mly_command *mc); - -static int mly_cam_attach(struct mly_softc *sc); -static void mly_cam_detach(struct mly_softc *sc); -static void mly_cam_rescan_btl(struct mly_softc *sc, int bus, int target); -static void mly_cam_action(struct cam_sim *sim, union ccb *ccb); -static int mly_cam_action_io(struct cam_sim *sim, struct ccb_scsiio *csio); -static void mly_cam_poll(struct cam_sim *sim); -static void mly_cam_complete(struct mly_command *mc); -static struct cam_periph *mly_find_periph(struct mly_softc *sc, int bus, int target); -static int mly_name_device(struct mly_softc *sc, int bus, int target); - -static int mly_fwhandshake(struct mly_softc *sc); - -static void mly_describe_controller(struct mly_softc *sc); -#ifdef MLY_DEBUG -static void mly_printstate(struct mly_softc *sc); -static void mly_print_command(struct mly_command *mc); -static void mly_print_packet(struct mly_command *mc); -static void mly_panic(struct mly_softc *sc, char *reason); -static void mly_timeout(void *arg); -#endif -void mly_print_controller(int controller); - -static d_open_t mly_user_open; -static d_close_t mly_user_close; -static d_ioctl_t mly_user_ioctl; -static int mly_user_command(struct mly_softc *sc, struct mly_user_command *uc); -static int mly_user_health(struct mly_softc *sc, struct mly_user_health *uh); - -#define MLY_CMD_TIMEOUT 20 - -static device_method_t mly_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, mly_probe), - DEVMETHOD(device_attach, mly_attach), - DEVMETHOD(device_detach, mly_detach), - DEVMETHOD(device_shutdown, mly_shutdown), - { 0, 0 } -}; - -static driver_t mly_pci_driver = { - "mly", - mly_methods, - sizeof(struct mly_softc) -}; - -static devclass_t mly_devclass; -DRIVER_MODULE(mly, pci, mly_pci_driver, mly_devclass, 0, 0); -MODULE_DEPEND(mly, pci, 1, 1, 1); -MODULE_DEPEND(mly, cam, 1, 1, 1); - -static struct cdevsw mly_cdevsw = { - .d_version = D_VERSION, - .d_open = mly_user_open, - .d_close = mly_user_close, - .d_ioctl = mly_user_ioctl, - .d_name = "mly", -}; - -/******************************************************************************** - ******************************************************************************** - Device Interface - ******************************************************************************** - ********************************************************************************/ - -static struct mly_ident -{ - u_int16_t vendor; - u_int16_t device; - u_int16_t subvendor; - u_int16_t subdevice; - int hwif; - char *desc; -} mly_identifiers[] = { - {0x1069, 0xba56, 0x1069, 0x0040, MLY_HWIF_STRONGARM, "Mylex eXtremeRAID 2000"}, - {0x1069, 0xba56, 0x1069, 0x0030, MLY_HWIF_STRONGARM, "Mylex eXtremeRAID 3000"}, - {0x1069, 0x0050, 0x1069, 0x0050, MLY_HWIF_I960RX, "Mylex AcceleRAID 352"}, - {0x1069, 0x0050, 0x1069, 0x0052, MLY_HWIF_I960RX, "Mylex AcceleRAID 170"}, - {0x1069, 0x0050, 0x1069, 0x0054, MLY_HWIF_I960RX, "Mylex AcceleRAID 160"}, - {0, 0, 0, 0, 0, 0} -}; - -/******************************************************************************** - * Compare the provided PCI device with the list we support. - */ -static int -mly_probe(device_t dev) -{ - struct mly_ident *m; - - debug_called(1); - - for (m = mly_identifiers; m->vendor != 0; m++) { - if ((m->vendor == pci_get_vendor(dev)) && - (m->device == pci_get_device(dev)) && - ((m->subvendor == 0) || ((m->subvendor == pci_get_subvendor(dev)) && - (m->subdevice == pci_get_subdevice(dev))))) { - - device_set_desc(dev, m->desc); - return(BUS_PROBE_DEFAULT); /* allow room to be overridden */ - } - } - return(ENXIO); -} - -/******************************************************************************** - * Initialise the controller and softc - */ -static int -mly_attach(device_t dev) -{ - struct mly_softc *sc = device_get_softc(dev); - int error; - - debug_called(1); - - sc->mly_dev = dev; - mtx_init(&sc->mly_lock, "mly", NULL, MTX_DEF); - callout_init_mtx(&sc->mly_periodic, &sc->mly_lock, 0); - -#ifdef MLY_DEBUG - callout_init_mtx(&sc->mly_timeout, &sc->mly_lock, 0); - if (device_get_unit(sc->mly_dev) == 0) - mly_softc0 = sc; -#endif - - /* - * Do PCI-specific initialisation. - */ - if ((error = mly_pci_attach(sc)) != 0) - goto out; - - /* - * Initialise per-controller queues. - */ - mly_initq_free(sc); - mly_initq_busy(sc); - mly_initq_complete(sc); - - /* - * Initialise command-completion task. - */ - TASK_INIT(&sc->mly_task_complete, 0, mly_complete_handler, sc); - - /* disable interrupts before we start talking to the controller */ - MLY_MASK_INTERRUPTS(sc); - - /* - * Wait for the controller to come ready, handshake with the firmware if required. - * This is typically only necessary on platforms where the controller BIOS does not - * run. - */ - if ((error = mly_fwhandshake(sc))) - goto out; - - /* - * Allocate initial command buffers. - */ - if ((error = mly_alloc_commands(sc))) - goto out; - - /* - * Obtain controller feature information - */ - MLY_LOCK(sc); - error = mly_get_controllerinfo(sc); - MLY_UNLOCK(sc); - if (error) - goto out; - - /* - * Reallocate command buffers now we know how many we want. - */ - mly_release_commands(sc); - if ((error = mly_alloc_commands(sc))) - goto out; - - /* - * Get the current event counter for health purposes, populate the initial - * health status buffer. - */ - MLY_LOCK(sc); - error = mly_get_eventstatus(sc); - - /* - * Enable memory-mailbox mode. - */ - if (error == 0) - error = mly_enable_mmbox(sc); - MLY_UNLOCK(sc); - if (error) - goto out; - - /* - * Attach to CAM. - */ - if ((error = mly_cam_attach(sc))) - goto out; - - /* - * Print a little information about the controller - */ - mly_describe_controller(sc); - - /* - * Mark all attached devices for rescan. - */ - MLY_LOCK(sc); - mly_scan_devices(sc); - - /* - * Instigate the first status poll immediately. Rescan completions won't - * happen until interrupts are enabled, which should still be before - * the SCSI subsystem gets to us, courtesy of the "SCSI settling delay". - */ - mly_periodic((void *)sc); - MLY_UNLOCK(sc); - - /* - * Create the control device. - */ - sc->mly_dev_t = make_dev(&mly_cdevsw, 0, UID_ROOT, GID_OPERATOR, - S_IRUSR | S_IWUSR, "mly%d", device_get_unit(sc->mly_dev)); - sc->mly_dev_t->si_drv1 = sc; - - /* enable interrupts now */ - MLY_UNMASK_INTERRUPTS(sc); - -#ifdef MLY_DEBUG - callout_reset(&sc->mly_timeout, MLY_CMD_TIMEOUT * hz, mly_timeout, sc); -#endif - - out: - if (error != 0) - mly_free(sc); - else - gone_in_dev(dev, 13, "mly(4) removed"); - return(error); -} - -/******************************************************************************** - * Perform PCI-specific initialisation. - */ -static int -mly_pci_attach(struct mly_softc *sc) -{ - int i, error; - - debug_called(1); - - /* assume failure is 'not configured' */ - error = ENXIO; - - /* - * Verify that the adapter is correctly set up in PCI space. - */ - pci_enable_busmaster(sc->mly_dev); - - /* - * Allocate the PCI register window. - */ - sc->mly_regs_rid = PCIR_BAR(0); /* first base address register */ - if ((sc->mly_regs_resource = bus_alloc_resource_any(sc->mly_dev, - SYS_RES_MEMORY, &sc->mly_regs_rid, RF_ACTIVE)) == NULL) { - mly_printf(sc, "can't allocate register window\n"); - goto fail; - } - - /* - * Allocate and connect our interrupt. - */ - sc->mly_irq_rid = 0; - if ((sc->mly_irq = bus_alloc_resource_any(sc->mly_dev, SYS_RES_IRQ, - &sc->mly_irq_rid, RF_SHAREABLE | RF_ACTIVE)) == NULL) { - mly_printf(sc, "can't allocate interrupt\n"); - goto fail; - } - if (bus_setup_intr(sc->mly_dev, sc->mly_irq, INTR_TYPE_CAM | INTR_ENTROPY | INTR_MPSAFE, NULL, mly_intr, sc, &sc->mly_intr)) { - mly_printf(sc, "can't set up interrupt\n"); - goto fail; - } - - /* assume failure is 'out of memory' */ - error = ENOMEM; - - /* - * Allocate the parent bus DMA tag appropriate for our PCI interface. - * - * Note that all of these controllers are 64-bit capable. - */ - if (bus_dma_tag_create(bus_get_dma_tag(sc->mly_dev),/* PCI parent */ - 1, 0, /* alignment, boundary */ - BUS_SPACE_MAXADDR_32BIT, /* lowaddr */ - BUS_SPACE_MAXADDR, /* highaddr */ - NULL, NULL, /* filter, filterarg */ - BUS_SPACE_MAXSIZE_32BIT, /* maxsize */ - BUS_SPACE_UNRESTRICTED, /* nsegments */ - BUS_SPACE_MAXSIZE_32BIT, /* maxsegsize */ - BUS_DMA_ALLOCNOW, /* flags */ - NULL, /* lockfunc */ - NULL, /* lockarg */ - &sc->mly_parent_dmat)) { - mly_printf(sc, "can't allocate parent DMA tag\n"); - goto fail; - } - - /* - * Create DMA tag for mapping buffers into controller-addressable space. - */ - if (bus_dma_tag_create(sc->mly_parent_dmat, /* parent */ - 1, 0, /* alignment, boundary */ - BUS_SPACE_MAXADDR, /* lowaddr */ - BUS_SPACE_MAXADDR, /* highaddr */ - NULL, NULL, /* filter, filterarg */ - DFLTPHYS, /* maxsize */ - MLY_MAX_SGENTRIES, /* nsegments */ - BUS_SPACE_MAXSIZE_32BIT, /* maxsegsize */ - 0, /* flags */ - busdma_lock_mutex, /* lockfunc */ - &sc->mly_lock, /* lockarg */ - &sc->mly_buffer_dmat)) { - mly_printf(sc, "can't allocate buffer DMA tag\n"); - goto fail; - } - - /* - * Initialise the DMA tag for command packets. - */ - if (bus_dma_tag_create(sc->mly_parent_dmat, /* parent */ - 1, 0, /* alignment, boundary */ - BUS_SPACE_MAXADDR, /* lowaddr */ - BUS_SPACE_MAXADDR, /* highaddr */ - NULL, NULL, /* filter, filterarg */ - sizeof(union mly_command_packet) * MLY_MAX_COMMANDS, 1, /* maxsize, nsegments */ - BUS_SPACE_MAXSIZE_32BIT, /* maxsegsize */ - BUS_DMA_ALLOCNOW, /* flags */ - NULL, NULL, /* lockfunc, lockarg */ - &sc->mly_packet_dmat)) { - mly_printf(sc, "can't allocate command packet DMA tag\n"); - goto fail; - } - - /* - * Detect the hardware interface version - */ - for (i = 0; mly_identifiers[i].vendor != 0; i++) { - if ((mly_identifiers[i].vendor == pci_get_vendor(sc->mly_dev)) && - (mly_identifiers[i].device == pci_get_device(sc->mly_dev))) { - sc->mly_hwif = mly_identifiers[i].hwif; - switch(sc->mly_hwif) { - case MLY_HWIF_I960RX: - debug(1, "set hardware up for i960RX"); - sc->mly_doorbell_true = 0x00; - sc->mly_command_mailbox = MLY_I960RX_COMMAND_MAILBOX; - sc->mly_status_mailbox = MLY_I960RX_STATUS_MAILBOX; - sc->mly_idbr = MLY_I960RX_IDBR; - sc->mly_odbr = MLY_I960RX_ODBR; - sc->mly_error_status = MLY_I960RX_ERROR_STATUS; - sc->mly_interrupt_status = MLY_I960RX_INTERRUPT_STATUS; - sc->mly_interrupt_mask = MLY_I960RX_INTERRUPT_MASK; - break; - case MLY_HWIF_STRONGARM: - debug(1, "set hardware up for StrongARM"); - sc->mly_doorbell_true = 0xff; /* doorbell 'true' is 0 */ - sc->mly_command_mailbox = MLY_STRONGARM_COMMAND_MAILBOX; - sc->mly_status_mailbox = MLY_STRONGARM_STATUS_MAILBOX; - sc->mly_idbr = MLY_STRONGARM_IDBR; - sc->mly_odbr = MLY_STRONGARM_ODBR; - sc->mly_error_status = MLY_STRONGARM_ERROR_STATUS; - sc->mly_interrupt_status = MLY_STRONGARM_INTERRUPT_STATUS; - sc->mly_interrupt_mask = MLY_STRONGARM_INTERRUPT_MASK; - break; - } - break; - } - } - - /* - * Create the scatter/gather mappings. - */ - if ((error = mly_sg_map(sc))) - goto fail; - - /* - * Allocate and map the memory mailbox - */ - if ((error = mly_mmbox_map(sc))) - goto fail; - - error = 0; - -fail: - return(error); -} - -/******************************************************************************** - * Shut the controller down and detach all our resources. - */ -static int -mly_detach(device_t dev) -{ - int error; - - if ((error = mly_shutdown(dev)) != 0) - return(error); - - mly_free(device_get_softc(dev)); - return(0); -} - -/******************************************************************************** - * Bring the controller to a state where it can be safely left alone. - * - * Note that it should not be necessary to wait for any outstanding commands, - * as they should be completed prior to calling here. - * - * XXX this applies for I/O, but not status polls; we should beware of - * the case where a status command is running while we detach. - */ -static int -mly_shutdown(device_t dev) -{ - struct mly_softc *sc = device_get_softc(dev); - - debug_called(1); - - MLY_LOCK(sc); - if (sc->mly_state & MLY_STATE_OPEN) { - MLY_UNLOCK(sc); - return(EBUSY); - } - - /* kill the periodic event */ - callout_stop(&sc->mly_periodic); -#ifdef MLY_DEBUG - callout_stop(&sc->mly_timeout); -#endif - - /* flush controller */ - mly_printf(sc, "flushing cache..."); - printf("%s\n", mly_flush(sc) ? "failed" : "done"); - - MLY_MASK_INTERRUPTS(sc); - MLY_UNLOCK(sc); - - return(0); -} - -/******************************************************************************* - * Take an interrupt, or be poked by other code to look for interrupt-worthy - * status. - */ -static void -mly_intr(void *arg) -{ - struct mly_softc *sc = (struct mly_softc *)arg; - - debug_called(2); - - MLY_LOCK(sc); - mly_done(sc); - MLY_UNLOCK(sc); -}; - -/******************************************************************************** - ******************************************************************************** - Bus-dependant Resource Management - ******************************************************************************** - ********************************************************************************/ - -/******************************************************************************** - * Allocate memory for the scatter/gather tables - */ -static int -mly_sg_map(struct mly_softc *sc) -{ - size_t segsize; - - debug_called(1); - - /* - * Create a single tag describing a region large enough to hold all of - * the s/g lists we will need. - */ - segsize = sizeof(struct mly_sg_entry) * MLY_MAX_COMMANDS *MLY_MAX_SGENTRIES; - if (bus_dma_tag_create(sc->mly_parent_dmat, /* parent */ - 1, 0, /* alignment,boundary */ - BUS_SPACE_MAXADDR, /* lowaddr */ - BUS_SPACE_MAXADDR, /* highaddr */ - NULL, NULL, /* filter, filterarg */ - segsize, 1, /* maxsize, nsegments */ - BUS_SPACE_MAXSIZE_32BIT, /* maxsegsize */ - BUS_DMA_ALLOCNOW, /* flags */ - NULL, NULL, /* lockfunc, lockarg */ - &sc->mly_sg_dmat)) { - mly_printf(sc, "can't allocate scatter/gather DMA tag\n"); - return(ENOMEM); - } - - /* - * Allocate enough s/g maps for all commands and permanently map them into - * controller-visible space. - * - * XXX this assumes we can get enough space for all the s/g maps in one - * contiguous slab. - */ - if (bus_dmamem_alloc(sc->mly_sg_dmat, (void **)&sc->mly_sg_table, - BUS_DMA_NOWAIT, &sc->mly_sg_dmamap)) { *** 4534 LINES SKIPPED ***