git: 399188a2c60c - main - iir: Remove
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 25 Nov 2021 07:46:54 UTC
The branch main has been updated by imp:
URL: https://cgit.FreeBSD.org/src/commit/?id=399188a2c60caffe496d03f8ddd6c1b1c34dc3ed
commit 399188a2c60caffe496d03f8ddd6c1b1c34dc3ed
Author: Warner Losh <imp@FreeBSD.org>
AuthorDate: 2021-11-25 07:20:31 +0000
Commit: Warner Losh <imp@FreeBSD.org>
CommitDate: 2021-11-25 07:45:12 +0000
iir: Remove
Belatedly remove iir(4). It was slated to go before 13, but was
overlooked.
Sponsored by: Netflix
Relnotes: yes
Reviewed by: scottl
Differential Revision: https://reviews.freebsd.org/D33112
---
share/man/man4/Makefile | 1 -
share/man/man4/iir.4 | 82 --
sys/amd64/conf/GENERIC | 1 -
sys/conf/NOTES | 9 -
sys/conf/files | 3 -
sys/dev/iir/iir.c | 1914 -------------------------------
sys/dev/iir/iir.h | 754 ------------
sys/dev/iir/iir_ctrl.c | 312 -----
sys/dev/iir/iir_pci.c | 460 --------
sys/i386/conf/GENERIC | 1 -
sys/modules/Makefile | 2 -
sys/modules/iir/Makefile | 9 -
tools/kerneldoc/subsys/Doxyfile-dev_iir | 21 -
13 files changed, 3569 deletions(-)
diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile
index 6bb519b36e1e..3eac0d1b3a39 100644
--- a/share/man/man4/Makefile
+++ b/share/man/man4/Makefile
@@ -223,7 +223,6 @@ MAN= aac.4 \
iichid.4 \
iicmux.4 \
iicsmb.4 \
- iir.4 \
${_igc.4} \
${_imcsmb.4} \
inet.4 \
diff --git a/share/man/man4/iir.4 b/share/man/man4/iir.4
deleted file mode 100644
index fa742965eb90..000000000000
--- a/share/man/man4/iir.4
+++ /dev/null
@@ -1,82 +0,0 @@
-.\" $FreeBSD$
-.\" Written by Tom Rhodes
-.\" This file is in the public domain.
-.\"
-.Dd August 8, 2004
-.Dt IIR 4
-.Os
-.Sh NAME
-.Nm iir
-.Nd Intel Integrated RAID controller and ICP Vortex driver
-.Sh DEPRECATION NOTICE
-The
-.Nm
-driver is not present in
-.Fx 13.0 .
-.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 iir"
-.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
-iir_load="YES"
-.Ed
-.Sh DESCRIPTION
-The
-.Nm
-driver claims to interface with the Intel integrated
-RAID controller cards, and all versions of the
-ICP Vortex controllers (including FC).
-.Sh HARDWARE
-Controllers supported by the
-.Nm
-driver include:
-.Pp
-.Bl -bullet -compact
-.It
-Intel RAID Controller SRCMR
-.It
-Intel Server RAID Controller U3-l (SRCU31a)
-.It
-Intel Server RAID Controller U3-1L (SRCU31La)
-.It
-Intel Server RAID Controller U3-2 (SRCU32)
-.It
-All past and future releases of Intel and ICP RAID Controllers.
-.El
-.Pp
-.Bl -bullet -compact
-.It
-Intel RAID Controller SRCU21 (discontinued)
-.It
-Intel RAID Controller SRCU31 (older revision, not compatible)
-.It
-Intel RAID Controller SRCU31L (older revision, not compatible)
-.El
-.Pp
-The SRCU31 and SRCU31L can be updated via a firmware update available
-from Intel.
-.Sh SEE ALSO
-.Xr cam 4 ,
-.Xr pass 4 ,
-.Xr xpt 4 ,
-.Xr camcontrol 8
-.Sh AUTHORS
-The
-.Nm
-driver is supported and maintained by
-.An -nosplit
-.An Achim Leubner Aq Mt Achim_Leubner@adaptec.com .
-.Pp
-This manual page was written by
-.An Tom Rhodes Aq Mt trhodes@FreeBSD.org
-and is based on information supplied by the driver authors and the website of
-.An Mike Smith Aq Mt msmith@FreeBSD.org .
diff --git a/sys/amd64/conf/GENERIC b/sys/amd64/conf/GENERIC
index 7b3a5f91e936..afd386f5913e 100644
--- a/sys/amd64/conf/GENERIC
+++ b/sys/amd64/conf/GENERIC
@@ -183,7 +183,6 @@ device ses # Enclosure Services (SES and SAF-TE)
device amr # AMI MegaRAID
device arcmsr # Areca SATA II RAID
device ciss # Compaq Smart RAID 5*
-device iir # Intel Integrated RAID
device ips # IBM (Adaptec) ServeRAID
device twa # 3ware 9000 series PATA/SATA RAID
device smartpqi # Microsemi smartpqi driver
diff --git a/sys/conf/NOTES b/sys/conf/NOTES
index d0749fe23b87..2221f8feb7dd 100644
--- a/sys/conf/NOTES
+++ b/sys/conf/NOTES
@@ -1635,15 +1635,6 @@ options ISP_DEFAULT_ROLES=0
#
device ciss
-#
-# Intel Integrated RAID controllers.
-# This driver was developed and is maintained by Intel. Contacts
-# at Intel for this driver are
-# "Kannanthanam, Boji T" <boji.t.kannanthanam@intel.com> and
-# "Leubner, Achim" <achim.leubner@intel.com>.
-#
-device iir
-
#
# 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 e65c318d1514..637aed6bfb9c 100644
--- a/sys/conf/files
+++ b/sys/conf/files
@@ -1874,9 +1874,6 @@ dev/iicbus/syr827.c optional syr827 ext_resources fdt
dev/iicbus/gpio/tca6408.c optional tca6408 fdt gpio
dev/iicbus/gpio/tca6416.c optional tca6416 fdt
dev/iicbus/pmic/fan53555.c optional fan53555 ext_resources fdt
-dev/iir/iir.c optional iir
-dev/iir/iir_ctrl.c optional iir
-dev/iir/iir_pci.c optional iir pci
dev/igc/if_igc.c optional igc iflib pci
dev/igc/igc_api.c optional igc iflib pci
dev/igc/igc_base.c optional igc iflib pci
diff --git a/sys/dev/iir/iir.c b/sys/dev/iir/iir.c
deleted file mode 100644
index 35ceef8d66a5..000000000000
--- a/sys/dev/iir/iir.c
+++ /dev/null
@@ -1,1914 +0,0 @@
-/*-
- * SPDX-License-Identifier: BSD-3-Clause
- *
- * Copyright (c) 2000-04 ICP vortex GmbH
- * Copyright (c) 2002-04 Intel Corporation
- * Copyright (c) 2003-04 Adaptec Inc.
- * 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,
- * without modification, immediately at the beginning of the file.
- * 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.
- * 3. 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 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.
- */
-
-/*
- * iir.c: SCSI dependent code for the Intel Integrated RAID Controller driver
- *
- * Written by: Achim Leubner <achim_leubner@adaptec.com>
- * Fixes/Additions: Boji Tony Kannanthanam <boji.t.kannanthanam@intel.com>
- *
- * credits: Niklas Hallqvist; OpenBSD driver for the ICP Controllers.
- * Mike Smith; Some driver source code.
- * FreeBSD.ORG; Great O/S to work on and for.
- *
- * $Id: iir.c 1.5 2004/03/30 10:17:53 achim Exp $"
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#define _IIR_C_
-
-/* #include "opt_iir.h" */
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/endian.h>
-#include <sys/eventhandler.h>
-#include <sys/malloc.h>
-#include <sys/kernel.h>
-#include <sys/bus.h>
-
-#include <machine/bus.h>
-#include <machine/stdarg.h>
-
-#include <cam/cam.h>
-#include <cam/cam_ccb.h>
-#include <cam/cam_sim.h>
-#include <cam/cam_xpt_sim.h>
-#include <cam/cam_debug.h>
-#include <cam/scsi/scsi_all.h>
-#include <cam/scsi/scsi_message.h>
-
-#include <dev/iir/iir.h>
-
-static MALLOC_DEFINE(M_GDTBUF, "iirbuf", "iir driver buffer");
-
-#ifdef GDT_DEBUG
-int gdt_debug = GDT_DEBUG;
-#ifdef __SERIAL__
-#define MAX_SERBUF 160
-static void ser_init(void);
-static void ser_puts(char *str);
-static void ser_putc(int c);
-static char strbuf[MAX_SERBUF+1];
-#ifdef __COM2__
-#define COM_BASE 0x2f8
-#else
-#define COM_BASE 0x3f8
-#endif
-static void ser_init()
-{
- unsigned port=COM_BASE;
-
- outb(port+3, 0x80);
- outb(port+1, 0);
- /* 19200 Baud, if 9600: outb(12,port) */
- outb(port, 6);
- outb(port+3, 3);
- outb(port+1, 0);
-}
-
-static void ser_puts(char *str)
-{
- char *ptr;
-
- ser_init();
- for (ptr=str;*ptr;++ptr)
- ser_putc((int)(*ptr));
-}
-
-static void ser_putc(int c)
-{
- unsigned port=COM_BASE;
-
- while ((inb(port+5) & 0x20)==0);
- outb(port, c);
- if (c==0x0a)
- {
- while ((inb(port+5) & 0x20)==0);
- outb(port, 0x0d);
- }
-}
-
-int ser_printf(const char *fmt, ...)
-{
- va_list args;
- int i;
-
- va_start(args,fmt);
- i = vsprintf(strbuf,fmt,args);
- ser_puts(strbuf);
- va_end(args);
- return i;
-}
-#endif
-#endif
-
-/* controller cnt. */
-int gdt_cnt = 0;
-/* event buffer */
-static gdt_evt_str ebuffer[GDT_MAX_EVENTS];
-static int elastidx, eoldidx;
-static struct mtx elock;
-MTX_SYSINIT(iir_elock, &elock, "iir events", MTX_DEF);
-/* statistics */
-gdt_statist_t gdt_stat;
-
-/* Definitions for our use of the SIM private CCB area */
-#define ccb_sim_ptr spriv_ptr0
-#define ccb_priority spriv_field1
-
-static void iir_action(struct cam_sim *sim, union ccb *ccb);
-static int iir_intr_locked(struct gdt_softc *gdt);
-static void iir_poll(struct cam_sim *sim);
-static void iir_shutdown(void *arg, int howto);
-static void iir_timeout(void *arg);
-
-static void gdt_eval_mapping(u_int32_t size, int *cyls, int *heads,
- int *secs);
-static int gdt_internal_cmd(struct gdt_softc *gdt, struct gdt_ccb *gccb,
- u_int8_t service, u_int16_t opcode,
- u_int32_t arg1, u_int32_t arg2, u_int32_t arg3);
-static int gdt_wait(struct gdt_softc *gdt, struct gdt_ccb *ccb,
- int timeout);
-
-static struct gdt_ccb *gdt_get_ccb(struct gdt_softc *gdt);
-
-static int gdt_sync_event(struct gdt_softc *gdt, int service,
- u_int8_t index, struct gdt_ccb *gccb);
-static int gdt_async_event(struct gdt_softc *gdt, int service);
-static struct gdt_ccb *gdt_raw_cmd(struct gdt_softc *gdt,
- union ccb *ccb);
-static struct gdt_ccb *gdt_cache_cmd(struct gdt_softc *gdt,
- union ccb *ccb);
-static struct gdt_ccb *gdt_ioctl_cmd(struct gdt_softc *gdt,
- gdt_ucmd_t *ucmd);
-static void gdt_internal_cache_cmd(struct gdt_softc *gdt, union ccb *ccb);
-
-static void gdtmapmem(void *arg, bus_dma_segment_t *dm_segs,
- int nseg, int error);
-static void gdtexecuteccb(void *arg, bus_dma_segment_t *dm_segs,
- int nseg, int error);
-
-int
-iir_init(struct gdt_softc *gdt)
-{
- u_int16_t cdev_cnt;
- int i, id, drv_cyls, drv_hds, drv_secs;
- struct gdt_ccb *gccb;
-
- GDT_DPRINTF(GDT_D_DEBUG, ("iir_init()\n"));
-
- gdt->sc_state = GDT_POLLING;
- gdt_clear_events();
- bzero(&gdt_stat, sizeof(gdt_statist_t));
-
- SLIST_INIT(&gdt->sc_free_gccb);
- SLIST_INIT(&gdt->sc_pending_gccb);
- TAILQ_INIT(&gdt->sc_ccb_queue);
- TAILQ_INIT(&gdt->sc_ucmd_queue);
-
- /* DMA tag for mapping buffers into device visible space. */
- if (bus_dma_tag_create(gdt->sc_parent_dmat, /*alignment*/1, /*boundary*/0,
- /*lowaddr*/BUS_SPACE_MAXADDR_32BIT,
- /*highaddr*/BUS_SPACE_MAXADDR,
- /*filter*/NULL, /*filterarg*/NULL,
- /*maxsize*/DFLTPHYS,
- /*nsegments*/GDT_MAXSG,
- /*maxsegsz*/BUS_SPACE_MAXSIZE_32BIT,
- /*flags*/BUS_DMA_ALLOCNOW,
- /*lockfunc*/busdma_lock_mutex,
- /*lockarg*/&gdt->sc_lock,
- &gdt->sc_buffer_dmat) != 0) {
- device_printf(gdt->sc_devnode,
- "bus_dma_tag_create(..., gdt->sc_buffer_dmat) failed\n");
- return (1);
- }
- gdt->sc_init_level++;
-
- /* DMA tag for our ccb structures */
- if (bus_dma_tag_create(gdt->sc_parent_dmat,
- /*alignment*/1,
- /*boundary*/0,
- /*lowaddr*/BUS_SPACE_MAXADDR_32BIT,
- /*highaddr*/BUS_SPACE_MAXADDR,
- /*filter*/NULL,
- /*filterarg*/NULL,
- GDT_MAXCMDS * GDT_SCRATCH_SZ, /* maxsize */
- /*nsegments*/1,
- /*maxsegsz*/BUS_SPACE_MAXSIZE_32BIT,
- /*flags*/0, /*lockfunc*/busdma_lock_mutex,
- /*lockarg*/&gdt->sc_lock,
- &gdt->sc_gcscratch_dmat) != 0) {
- device_printf(gdt->sc_devnode,
- "bus_dma_tag_create(...,gdt->sc_gcscratch_dmat) failed\n");
- return (1);
- }
- gdt->sc_init_level++;
-
- /* Allocation for our ccb scratch area */
- if (bus_dmamem_alloc(gdt->sc_gcscratch_dmat, (void **)&gdt->sc_gcscratch,
- BUS_DMA_NOWAIT, &gdt->sc_gcscratch_dmamap) != 0) {
- device_printf(gdt->sc_devnode,
- "bus_dmamem_alloc(...,&gdt->sc_gccbs,...) failed\n");
- return (1);
- }
- gdt->sc_init_level++;
-
- /* And permanently map them */
- bus_dmamap_load(gdt->sc_gcscratch_dmat, gdt->sc_gcscratch_dmamap,
- gdt->sc_gcscratch, GDT_MAXCMDS * GDT_SCRATCH_SZ,
- gdtmapmem, &gdt->sc_gcscratch_busbase, /*flags*/0);
- gdt->sc_init_level++;
-
- /* Clear them out. */
- bzero(gdt->sc_gcscratch, GDT_MAXCMDS * GDT_SCRATCH_SZ);
-
- /* Initialize the ccbs */
- gdt->sc_gccbs = malloc(sizeof(struct gdt_ccb) * GDT_MAXCMDS, M_GDTBUF,
- M_NOWAIT | M_ZERO);
- if (gdt->sc_gccbs == NULL) {
- device_printf(gdt->sc_devnode, "no memory for gccbs.\n");
- return (1);
- }
- for (i = GDT_MAXCMDS-1; i >= 0; i--) {
- gccb = &gdt->sc_gccbs[i];
- gccb->gc_cmd_index = i + 2;
- gccb->gc_flags = GDT_GCF_UNUSED;
- gccb->gc_map_flag = FALSE;
- if (bus_dmamap_create(gdt->sc_buffer_dmat, /*flags*/0,
- &gccb->gc_dmamap) != 0)
- return(1);
- gccb->gc_map_flag = TRUE;
- gccb->gc_scratch = &gdt->sc_gcscratch[GDT_SCRATCH_SZ * i];
- gccb->gc_scratch_busbase = gdt->sc_gcscratch_busbase + GDT_SCRATCH_SZ * i;
- callout_init_mtx(&gccb->gc_timeout, &gdt->sc_lock, 0);
- SLIST_INSERT_HEAD(&gdt->sc_free_gccb, gccb, sle);
- }
- gdt->sc_init_level++;
-
- /* create the control device */
- gdt->sc_dev = gdt_make_dev(gdt);
-
- /* allocate ccb for gdt_internal_cmd() */
- mtx_lock(&gdt->sc_lock);
- gccb = gdt_get_ccb(gdt);
- if (gccb == NULL) {
- mtx_unlock(&gdt->sc_lock);
- device_printf(gdt->sc_devnode, "No free command index found\n");
- return (1);
- }
- bzero(gccb->gc_cmd, GDT_CMD_SZ);
-
- if (!gdt_internal_cmd(gdt, gccb, GDT_SCREENSERVICE, GDT_INIT,
- 0, 0, 0)) {
- device_printf(gdt->sc_devnode,
- "Screen service initialization error %d\n", gdt->sc_status);
- gdt_free_ccb(gdt, gccb);
- mtx_unlock(&gdt->sc_lock);
- return (1);
- }
-
- gdt_internal_cmd(gdt, gccb, GDT_CACHESERVICE, GDT_UNFREEZE_IO,
- 0, 0, 0);
-
- if (!gdt_internal_cmd(gdt, gccb, GDT_CACHESERVICE, GDT_INIT,
- GDT_LINUX_OS, 0, 0)) {
- device_printf(gdt->sc_devnode, "Cache service initialization error %d\n",
- gdt->sc_status);
- gdt_free_ccb(gdt, gccb);
- mtx_unlock(&gdt->sc_lock);
- return (1);
- }
- cdev_cnt = (u_int16_t)gdt->sc_info;
- gdt->sc_fw_vers = gdt->sc_service;
-
- /* Detect number of buses */
- gdt_enc32(gccb->gc_scratch + GDT_IOC_VERSION, GDT_IOC_NEWEST);
- gccb->gc_scratch[GDT_IOC_LIST_ENTRIES] = GDT_MAXBUS;
- gccb->gc_scratch[GDT_IOC_FIRST_CHAN] = 0;
- gccb->gc_scratch[GDT_IOC_LAST_CHAN] = GDT_MAXBUS - 1;
- gdt_enc32(gccb->gc_scratch + GDT_IOC_LIST_OFFSET, GDT_IOC_HDR_SZ);
- if (gdt_internal_cmd(gdt, gccb, GDT_CACHESERVICE, GDT_IOCTL,
- GDT_IOCHAN_RAW_DESC, GDT_INVALID_CHANNEL,
- GDT_IOC_HDR_SZ + GDT_MAXBUS * GDT_RAWIOC_SZ)) {
- gdt->sc_bus_cnt = gccb->gc_scratch[GDT_IOC_CHAN_COUNT];
- for (i = 0; i < gdt->sc_bus_cnt; i++) {
- id = gccb->gc_scratch[GDT_IOC_HDR_SZ +
- i * GDT_RAWIOC_SZ + GDT_RAWIOC_PROC_ID];
- gdt->sc_bus_id[i] = id < GDT_MAXID_FC ? id : 0xff;
- }
- } else {
- /* New method failed, use fallback. */
- for (i = 0; i < GDT_MAXBUS; i++) {
- gdt_enc32(gccb->gc_scratch + GDT_GETCH_CHANNEL_NO, i);
- if (!gdt_internal_cmd(gdt, gccb, GDT_CACHESERVICE, GDT_IOCTL,
- GDT_SCSI_CHAN_CNT | GDT_L_CTRL_PATTERN,
- GDT_IO_CHANNEL | GDT_INVALID_CHANNEL,
- GDT_GETCH_SZ)) {
- if (i == 0) {
- device_printf(gdt->sc_devnode, "Cannot get channel count, "
- "error %d\n", gdt->sc_status);
- gdt_free_ccb(gdt, gccb);
- mtx_unlock(&gdt->sc_lock);
- return (1);
- }
- break;
- }
- gdt->sc_bus_id[i] =
- (gccb->gc_scratch[GDT_GETCH_SIOP_ID] < GDT_MAXID_FC) ?
- gccb->gc_scratch[GDT_GETCH_SIOP_ID] : 0xff;
- }
- gdt->sc_bus_cnt = i;
- }
- /* add one "virtual" channel for the host drives */
- gdt->sc_virt_bus = gdt->sc_bus_cnt;
- gdt->sc_bus_cnt++;
-
- if (!gdt_internal_cmd(gdt, gccb, GDT_SCSIRAWSERVICE, GDT_INIT,
- 0, 0, 0)) {
- device_printf(gdt->sc_devnode,
- "Raw service initialization error %d\n", gdt->sc_status);
- gdt_free_ccb(gdt, gccb);
- mtx_unlock(&gdt->sc_lock);
- return (1);
- }
-
- /* Set/get features raw service (scatter/gather) */
- gdt->sc_raw_feat = 0;
- if (gdt_internal_cmd(gdt, gccb, GDT_SCSIRAWSERVICE, GDT_SET_FEAT,
- GDT_SCATTER_GATHER, 0, 0)) {
- if (gdt_internal_cmd(gdt, gccb, GDT_SCSIRAWSERVICE, GDT_GET_FEAT,
- 0, 0, 0)) {
- gdt->sc_raw_feat = gdt->sc_info;
- if (!(gdt->sc_info & GDT_SCATTER_GATHER)) {
- panic("%s: Scatter/Gather Raw Service "
- "required but not supported!\n",
- device_get_nameunit(gdt->sc_devnode));
- gdt_free_ccb(gdt, gccb);
- mtx_unlock(&gdt->sc_lock);
- return (1);
- }
- }
- }
-
- /* Set/get features cache service (scatter/gather) */
- gdt->sc_cache_feat = 0;
- if (gdt_internal_cmd(gdt, gccb, GDT_CACHESERVICE, GDT_SET_FEAT,
- 0, GDT_SCATTER_GATHER, 0)) {
- if (gdt_internal_cmd(gdt, gccb, GDT_CACHESERVICE, GDT_GET_FEAT,
- 0, 0, 0)) {
- gdt->sc_cache_feat = gdt->sc_info;
- if (!(gdt->sc_info & GDT_SCATTER_GATHER)) {
- panic("%s: Scatter/Gather Cache Service "
- "required but not supported!\n",
- device_get_nameunit(gdt->sc_devnode));
- gdt_free_ccb(gdt, gccb);
- mtx_unlock(&gdt->sc_lock);
- return (1);
- }
- }
- }
-
- /* OEM */
- gdt_enc32(gccb->gc_scratch + GDT_OEM_VERSION, 0x01);
- gdt_enc32(gccb->gc_scratch + GDT_OEM_BUFSIZE, sizeof(gdt_oem_record_t));
- if (gdt_internal_cmd(gdt, gccb, GDT_CACHESERVICE, GDT_IOCTL,
- GDT_OEM_STR_RECORD, GDT_INVALID_CHANNEL,
- sizeof(gdt_oem_str_record_t))) {
- strncpy(gdt->oem_name, ((gdt_oem_str_record_t *)
- gccb->gc_scratch)->text.scsi_host_drive_inquiry_vendor_id, 7);
- gdt->oem_name[7]='\0';
- } else {
- /* Old method, based on PCI ID */
- if (gdt->sc_vendor == INTEL_VENDOR_ID_IIR)
- strcpy(gdt->oem_name,"Intel ");
- else
- strcpy(gdt->oem_name,"ICP ");
- }
-
- /* Scan for cache devices */
- for (i = 0; i < cdev_cnt && i < GDT_MAX_HDRIVES; i++) {
- if (gdt_internal_cmd(gdt, gccb, GDT_CACHESERVICE, GDT_INFO,
- i, 0, 0)) {
- gdt->sc_hdr[i].hd_present = 1;
- gdt->sc_hdr[i].hd_size = gdt->sc_info;
-
- /*
- * Evaluate mapping (sectors per head, heads per cyl)
- */
- gdt->sc_hdr[i].hd_size &= ~GDT_SECS32;
- if (gdt->sc_info2 == 0)
- gdt_eval_mapping(gdt->sc_hdr[i].hd_size,
- &drv_cyls, &drv_hds, &drv_secs);
- else {
- drv_hds = gdt->sc_info2 & 0xff;
- drv_secs = (gdt->sc_info2 >> 8) & 0xff;
- drv_cyls = gdt->sc_hdr[i].hd_size / drv_hds /
- drv_secs;
- }
- gdt->sc_hdr[i].hd_heads = drv_hds;
- gdt->sc_hdr[i].hd_secs = drv_secs;
- /* Round the size */
- gdt->sc_hdr[i].hd_size = drv_cyls * drv_hds * drv_secs;
-
- if (gdt_internal_cmd(gdt, gccb, GDT_CACHESERVICE,
- GDT_DEVTYPE, i, 0, 0))
- gdt->sc_hdr[i].hd_devtype = gdt->sc_info;
- }
- }
-
- GDT_DPRINTF(GDT_D_INIT, ("dpmem %x %d-bus %d cache device%s\n",
- gdt->sc_dpmembase,
- gdt->sc_bus_cnt, cdev_cnt,
- cdev_cnt == 1 ? "" : "s"));
- gdt_free_ccb(gdt, gccb);
- mtx_unlock(&gdt->sc_lock);
-
- atomic_add_int(&gdt_cnt, 1);
- return (0);
-}
-
-void
-iir_free(struct gdt_softc *gdt)
-{
- int i;
-
- GDT_DPRINTF(GDT_D_INIT, ("iir_free()\n"));
-
- switch (gdt->sc_init_level) {
- default:
- gdt_destroy_dev(gdt->sc_dev);
- case 5:
- for (i = GDT_MAXCMDS-1; i >= 0; i--)
- if (gdt->sc_gccbs[i].gc_map_flag) {
- callout_drain(&gdt->sc_gccbs[i].gc_timeout);
- bus_dmamap_destroy(gdt->sc_buffer_dmat,
- gdt->sc_gccbs[i].gc_dmamap);
- }
- bus_dmamap_unload(gdt->sc_gcscratch_dmat, gdt->sc_gcscratch_dmamap);
- free(gdt->sc_gccbs, M_GDTBUF);
- case 4:
- bus_dmamem_free(gdt->sc_gcscratch_dmat, gdt->sc_gcscratch, gdt->sc_gcscratch_dmamap);
- case 3:
- bus_dma_tag_destroy(gdt->sc_gcscratch_dmat);
- case 2:
- bus_dma_tag_destroy(gdt->sc_buffer_dmat);
- case 1:
- bus_dma_tag_destroy(gdt->sc_parent_dmat);
- case 0:
- break;
- }
-}
-
-void
-iir_attach(struct gdt_softc *gdt)
-{
- struct cam_devq *devq;
- int i;
-
- GDT_DPRINTF(GDT_D_INIT, ("iir_attach()\n"));
-
- /*
- * Create the device queue for our SIM.
- * XXX Throttle this down since the card has problems under load.
- */
- devq = cam_simq_alloc(32);
- if (devq == NULL)
- return;
-
- for (i = 0; i < gdt->sc_bus_cnt; i++) {
- /*
- * Construct our SIM entry
- */
- gdt->sims[i] = cam_sim_alloc(iir_action, iir_poll, "iir",
- gdt, device_get_unit(gdt->sc_devnode), &gdt->sc_lock,
- /*untagged*/1, /*tagged*/GDT_MAXCMDS, devq);
- mtx_lock(&gdt->sc_lock);
- if (xpt_bus_register(gdt->sims[i], gdt->sc_devnode, i) != CAM_SUCCESS) {
- cam_sim_free(gdt->sims[i], /*free_devq*/i == 0);
- mtx_unlock(&gdt->sc_lock);
- break;
- }
-
- if (xpt_create_path(&gdt->paths[i], /*periph*/NULL,
- cam_sim_path(gdt->sims[i]),
- CAM_TARGET_WILDCARD,
- CAM_LUN_WILDCARD) != CAM_REQ_CMP) {
- xpt_bus_deregister(cam_sim_path(gdt->sims[i]));
- cam_sim_free(gdt->sims[i], /*free_devq*/i == 0);
- mtx_unlock(&gdt->sc_lock);
- break;
- }
- mtx_unlock(&gdt->sc_lock);
- }
- if (i > 0)
- EVENTHANDLER_REGISTER(shutdown_final, iir_shutdown,
- gdt, SHUTDOWN_PRI_DEFAULT);
- /* iir_watchdog(gdt); */
- gdt->sc_state = GDT_NORMAL;
-}
-
-static void
-gdt_eval_mapping(u_int32_t size, int *cyls, int *heads, int *secs)
-{
- *cyls = size / GDT_HEADS / GDT_SECS;
- if (*cyls < GDT_MAXCYLS) {
- *heads = GDT_HEADS;
- *secs = GDT_SECS;
- } else {
- /* Too high for 64 * 32 */
- *cyls = size / GDT_MEDHEADS / GDT_MEDSECS;
- if (*cyls < GDT_MAXCYLS) {
- *heads = GDT_MEDHEADS;
- *secs = GDT_MEDSECS;
- } else {
- /* Too high for 127 * 63 */
- *cyls = size / GDT_BIGHEADS / GDT_BIGSECS;
- *heads = GDT_BIGHEADS;
- *secs = GDT_BIGSECS;
- }
- }
-}
-
-static int
-gdt_wait(struct gdt_softc *gdt, struct gdt_ccb *gccb,
- int timeout)
-{
- int rv = 0;
-
- GDT_DPRINTF(GDT_D_INIT,
- ("gdt_wait(%p, %p, %d)\n", gdt, gccb, timeout));
-
- gdt->sc_state |= GDT_POLL_WAIT;
- do {
- if (iir_intr_locked(gdt) == gccb->gc_cmd_index) {
- rv = 1;
- break;
- }
- DELAY(1);
- } while (--timeout);
- gdt->sc_state &= ~GDT_POLL_WAIT;
-
- while (gdt->sc_test_busy(gdt))
- DELAY(1); /* XXX correct? */
-
- return (rv);
-}
-
-static int
-gdt_internal_cmd(struct gdt_softc *gdt, struct gdt_ccb *gccb,
- u_int8_t service, u_int16_t opcode,
- u_int32_t arg1, u_int32_t arg2, u_int32_t arg3)
-{
- int retries;
-
- GDT_DPRINTF(GDT_D_CMD, ("gdt_internal_cmd(%p, %d, %d, %d, %d, %d)\n",
- gdt, service, opcode, arg1, arg2, arg3));
-
- bzero(gccb->gc_cmd, GDT_CMD_SZ);
-
- for (retries = GDT_RETRIES; ; ) {
- gccb->gc_service = service;
- gccb->gc_flags = GDT_GCF_INTERNAL;
-
- gdt_enc32(gccb->gc_cmd + GDT_CMD_COMMANDINDEX,
- gccb->gc_cmd_index);
- gdt_enc16(gccb->gc_cmd + GDT_CMD_OPCODE, opcode);
-
- switch (service) {
- case GDT_CACHESERVICE:
- if (opcode == GDT_IOCTL) {
- gdt_enc32(gccb->gc_cmd + GDT_CMD_UNION +
- GDT_IOCTL_SUBFUNC, arg1);
- gdt_enc32(gccb->gc_cmd + GDT_CMD_UNION +
- GDT_IOCTL_CHANNEL, arg2);
- gdt_enc16(gccb->gc_cmd + GDT_CMD_UNION +
- GDT_IOCTL_PARAM_SIZE, (u_int16_t)arg3);
- gdt_enc32(gccb->gc_cmd + GDT_CMD_UNION + GDT_IOCTL_P_PARAM,
- gccb->gc_scratch_busbase);
- } else {
- gdt_enc16(gccb->gc_cmd + GDT_CMD_UNION +
- GDT_CACHE_DEVICENO, (u_int16_t)arg1);
- gdt_enc32(gccb->gc_cmd + GDT_CMD_UNION +
- GDT_CACHE_BLOCKNO, arg2);
- }
- break;
-
- case GDT_SCSIRAWSERVICE:
- gdt_enc32(gccb->gc_cmd + GDT_CMD_UNION +
- GDT_RAW_DIRECTION, arg1);
- gccb->gc_cmd[GDT_CMD_UNION + GDT_RAW_BUS] =
- (u_int8_t)arg2;
- gccb->gc_cmd[GDT_CMD_UNION + GDT_RAW_TARGET] =
- (u_int8_t)arg3;
- gccb->gc_cmd[GDT_CMD_UNION + GDT_RAW_LUN] =
- (u_int8_t)(arg3 >> 8);
- }
-
- gdt->sc_set_sema0(gdt);
- gccb->gc_cmd_len = GDT_CMD_SZ;
- gdt->sc_cmd_off = 0;
- gdt->sc_cmd_cnt = 0;
- gdt->sc_copy_cmd(gdt, gccb);
- gdt->sc_release_event(gdt);
- DELAY(20);
- if (!gdt_wait(gdt, gccb, GDT_POLL_TIMEOUT))
- return (0);
- if (gdt->sc_status != GDT_S_BSY || --retries == 0)
- break;
- DELAY(1);
- }
- return (gdt->sc_status == GDT_S_OK);
-}
-
-static struct gdt_ccb *
-gdt_get_ccb(struct gdt_softc *gdt)
-{
- struct gdt_ccb *gccb;
-
- GDT_DPRINTF(GDT_D_QUEUE, ("gdt_get_ccb(%p)\n", gdt));
-
- mtx_assert(&gdt->sc_lock, MA_OWNED);
- gccb = SLIST_FIRST(&gdt->sc_free_gccb);
- if (gccb != NULL) {
- SLIST_REMOVE_HEAD(&gdt->sc_free_gccb, sle);
- SLIST_INSERT_HEAD(&gdt->sc_pending_gccb, gccb, sle);
- ++gdt_stat.cmd_index_act;
- if (gdt_stat.cmd_index_act > gdt_stat.cmd_index_max)
- gdt_stat.cmd_index_max = gdt_stat.cmd_index_act;
- }
- return (gccb);
-}
-
-void
-gdt_free_ccb(struct gdt_softc *gdt, struct gdt_ccb *gccb)
-{
-
- GDT_DPRINTF(GDT_D_QUEUE, ("gdt_free_ccb(%p, %p)\n", gdt, gccb));
-
- mtx_assert(&gdt->sc_lock, MA_OWNED);
- gccb->gc_flags = GDT_GCF_UNUSED;
- SLIST_REMOVE(&gdt->sc_pending_gccb, gccb, gdt_ccb, sle);
- SLIST_INSERT_HEAD(&gdt->sc_free_gccb, gccb, sle);
- --gdt_stat.cmd_index_act;
- if (gdt->sc_state & GDT_SHUTDOWN)
- wakeup(gccb);
-}
-
-void
-gdt_next(struct gdt_softc *gdt)
-{
- union ccb *ccb;
- gdt_ucmd_t *ucmd;
- struct cam_sim *sim;
- int bus, target, lun;
- int next_cmd;
-
- struct ccb_scsiio *csio;
- struct ccb_hdr *ccbh;
- struct gdt_ccb *gccb = NULL;
- u_int8_t cmd;
-
- GDT_DPRINTF(GDT_D_QUEUE, ("gdt_next(%p)\n", gdt));
-
- mtx_assert(&gdt->sc_lock, MA_OWNED);
- if (gdt->sc_test_busy(gdt)) {
- if (!(gdt->sc_state & GDT_POLLING)) {
- return;
- }
- while (gdt->sc_test_busy(gdt))
- DELAY(1);
- }
-
- gdt->sc_cmd_cnt = gdt->sc_cmd_off = 0;
- next_cmd = TRUE;
- for (;;) {
- /* I/Os in queue? controller ready? */
- if (!TAILQ_FIRST(&gdt->sc_ucmd_queue) &&
- !TAILQ_FIRST(&gdt->sc_ccb_queue))
- break;
-
- /* 1.: I/Os without ccb (IOCTLs) */
- ucmd = TAILQ_FIRST(&gdt->sc_ucmd_queue);
- if (ucmd != NULL) {
- TAILQ_REMOVE(&gdt->sc_ucmd_queue, ucmd, links);
- if ((gccb = gdt_ioctl_cmd(gdt, ucmd)) == NULL) {
- TAILQ_INSERT_HEAD(&gdt->sc_ucmd_queue, ucmd, links);
- break;
- }
- break;
- /* wenn mehrere Kdos. zulassen: if (!gdt_polling) continue; */
- }
-
- /* 2.: I/Os with ccb */
- ccb = (union ccb *)TAILQ_FIRST(&gdt->sc_ccb_queue);
- /* ist dann immer != NULL, da oben getestet */
- sim = (struct cam_sim *)ccb->ccb_h.ccb_sim_ptr;
- bus = cam_sim_bus(sim);
- target = ccb->ccb_h.target_id;
- lun = ccb->ccb_h.target_lun;
-
- TAILQ_REMOVE(&gdt->sc_ccb_queue, &ccb->ccb_h, sim_links.tqe);
- --gdt_stat.req_queue_act;
- /* ccb->ccb_h.func_code is XPT_SCSI_IO */
- GDT_DPRINTF(GDT_D_QUEUE, ("XPT_SCSI_IO flags 0x%x)\n",
- ccb->ccb_h.flags));
- csio = &ccb->csio;
- ccbh = &ccb->ccb_h;
- cmd = scsiio_cdb_ptr(csio)[0];
- /* Max CDB length is 12 bytes, can't be phys addr */
- if (csio->cdb_len > 12 || (ccbh->flags & CAM_CDB_PHYS)) {
- ccbh->status = CAM_REQ_INVALID;
- --gdt_stat.io_count_act;
- xpt_done(ccb);
- } else if (bus != gdt->sc_virt_bus) {
- /* raw service command */
- if ((gccb = gdt_raw_cmd(gdt, ccb)) == NULL) {
- TAILQ_INSERT_HEAD(&gdt->sc_ccb_queue, &ccb->ccb_h,
- sim_links.tqe);
- ++gdt_stat.req_queue_act;
- if (gdt_stat.req_queue_act > gdt_stat.req_queue_max)
- gdt_stat.req_queue_max = gdt_stat.req_queue_act;
- next_cmd = FALSE;
- }
- } else if (target >= GDT_MAX_HDRIVES ||
- !gdt->sc_hdr[target].hd_present || lun != 0) {
- ccbh->status = CAM_DEV_NOT_THERE;
- --gdt_stat.io_count_act;
- xpt_done(ccb);
- } else {
- /* cache service command */
- if (cmd == READ_6 || cmd == WRITE_6 ||
- cmd == READ_10 || cmd == WRITE_10) {
- if ((gccb = gdt_cache_cmd(gdt, ccb)) == NULL) {
- TAILQ_INSERT_HEAD(&gdt->sc_ccb_queue, &ccb->ccb_h,
- sim_links.tqe);
- ++gdt_stat.req_queue_act;
- if (gdt_stat.req_queue_act > gdt_stat.req_queue_max)
- gdt_stat.req_queue_max = gdt_stat.req_queue_act;
- next_cmd = FALSE;
- }
- } else {
- gdt_internal_cache_cmd(gdt, ccb);
- }
- }
- if ((gdt->sc_state & GDT_POLLING) || !next_cmd)
- break;
- }
- if (gdt->sc_cmd_cnt > 0)
- gdt->sc_release_event(gdt);
-
- if ((gdt->sc_state & GDT_POLLING) && gdt->sc_cmd_cnt > 0) {
- gdt_wait(gdt, gccb, GDT_POLL_TIMEOUT);
- }
-}
-
-static struct gdt_ccb *
-gdt_raw_cmd(struct gdt_softc *gdt, union ccb *ccb)
-{
- struct gdt_ccb *gccb;
*** 2732 LINES SKIPPED ***