Author: mav
Date: Thu Apr  4 07:12:24 2013
New Revision: 249083
URL: http://svnweb.freebsd.org/changeset/base/249083

Log:
  Remove all legacy ATA code parts, not used since options ATA_CAM enabled in
  most kernels before FreeBSD 9.0.  Remove such modules and respective kernel
  options: atadisk, ataraid, atapicd, atapifd, atapist, atapicam.  Remove the
  atacontrol utility and some man pages.  Remove useless now options ATA_CAM.
  
  No objections:        current@, stable@
  MFC after:    never

Deleted:
  head/sbin/atacontrol/
  head/share/man/man4/atapicam.4
  head/share/man/man4/ataraid.4
  head/sys/dev/ata/ata-disk.c
  head/sys/dev/ata/ata-disk.h
  head/sys/dev/ata/ata-raid-ddf.h
  head/sys/dev/ata/ata-raid.c
  head/sys/dev/ata/ata-raid.h
  head/sys/dev/ata/atapi-cam.c
  head/sys/dev/ata/atapi-cd.c
  head/sys/dev/ata/atapi-cd.h
  head/sys/dev/ata/atapi-fd.c
  head/sys/dev/ata/atapi-fd.h
  head/sys/dev/ata/atapi-tape.c
  head/sys/dev/ata/atapi-tape.h
  head/sys/modules/ata/atacam/
  head/sys/modules/ata/atadisk/
  head/sys/modules/ata/atapicam/
  head/sys/modules/ata/atapicd/
  head/sys/modules/ata/atapifd/
  head/sys/modules/ata/atapist/
  head/sys/modules/ata/ataraid/
Modified:
  head/rescue/rescue/Makefile
  head/sbin/Makefile
  head/share/man/man4/Makefile
  head/share/man/man4/ata.4
  head/sys/amd64/conf/GENERIC
  head/sys/arm/conf/AC100
  head/sys/arm/conf/ARMADAXP
  head/sys/arm/conf/AVILA
  head/sys/arm/conf/CAMBRIA
  head/sys/arm/conf/CRB
  head/sys/arm/conf/CUBIEBOARD
  head/sys/arm/conf/EFIKA_MX
  head/sys/arm/conf/EP80219
  head/sys/arm/conf/IQ31244
  head/sys/arm/conf/TS7800
  head/sys/cam/ata/ata_da.c
  head/sys/conf/NOTES
  head/sys/conf/files
  head/sys/conf/files.sparc64
  head/sys/conf/options
  head/sys/dev/ata/ata-all.c
  head/sys/dev/ata/ata-all.h
  head/sys/dev/ata/ata-cbus.c
  head/sys/dev/ata/ata-dma.c
  head/sys/dev/ata/ata-lowlevel.c
  head/sys/dev/ata/ata-pci.c
  head/sys/dev/ata/ata-pci.h
  head/sys/dev/ata/ata-queue.c
  head/sys/dev/ata/ata-sata.c
  head/sys/dev/ata/ata_if.m
  head/sys/dev/ata/chipsets/ata-acard.c
  head/sys/dev/ata/chipsets/ata-acerlabs.c
  head/sys/dev/ata/chipsets/ata-intel.c
  head/sys/dev/ata/chipsets/ata-ite.c
  head/sys/dev/ata/chipsets/ata-serverworks.c
  head/sys/dev/ata/chipsets/ata-siliconimage.c
  head/sys/i386/conf/GENERIC
  head/sys/i386/conf/XBOX
  head/sys/ia64/conf/GENERIC
  head/sys/mips/conf/OCTEON1
  head/sys/mips/conf/XLR
  head/sys/mips/conf/XLR64
  head/sys/mips/conf/XLRN32
  head/sys/mips/conf/std.SWARM
  head/sys/mips/conf/std.XLP
  head/sys/mips/malta/std.malta
  head/sys/modules/ata/Makefile
  head/sys/pc98/conf/GENERIC
  head/sys/pc98/conf/NOTES
  head/sys/powerpc/conf/GENERIC
  head/sys/powerpc/conf/GENERIC64
  head/sys/powerpc/conf/MPC85XX
  head/sys/sparc64/conf/GENERIC

Modified: head/rescue/rescue/Makefile
==============================================================================
--- head/rescue/rescue/Makefile Thu Apr  4 05:47:50 2013        (r249082)
+++ head/rescue/rescue/Makefile Thu Apr  4 07:12:24 2013        (r249083)
@@ -87,7 +87,7 @@ CRUNCH_SUPPRESS_LINK_-tcsh= 1
 # headers in addition to the standard 'paths.h' header.
 #
 CRUNCH_SRCDIRS+= sbin
-CRUNCH_PROGS_sbin= atacontrol badsect                          \
+CRUNCH_PROGS_sbin= badsect                                     \
        camcontrol ccdconfig clri devfs dmesg dump              \
        dumpfs dumpon fsck fsck_ffs fsck_msdosfs fsdb           \
        fsirand gbde geom ifconfig init                         \

Modified: head/sbin/Makefile
==============================================================================
--- head/sbin/Makefile  Thu Apr  4 05:47:50 2013        (r249082)
+++ head/sbin/Makefile  Thu Apr  4 07:12:24 2013        (r249083)
@@ -6,7 +6,6 @@
 # XXX MISSING:         icheck ncheck
 
 SUBDIR=adjkerntz \
-       atacontrol \
        badsect \
        camcontrol \
        ccdconfig \

Modified: head/share/man/man4/Makefile
==============================================================================
--- head/share/man/man4/Makefile        Thu Apr  4 05:47:50 2013        
(r249082)
+++ head/share/man/man4/Makefile        Thu Apr  4 07:12:24 2013        
(r249083)
@@ -51,8 +51,6 @@ MAN=  aac.4 \
        ${_asmc.4} \
        asr.4 \
        ata.4 \
-       atapicam.4 \
-       ataraid.4 \
        ath.4 \
        ath_ahb.4 \
        ath_hal.4 \

Modified: head/share/man/man4/ata.4
==============================================================================
--- head/share/man/man4/ata.4   Thu Apr  4 05:47:50 2013        (r249082)
+++ head/share/man/man4/ata.4   Thu Apr  4 07:12:24 2013        (r249083)
@@ -36,7 +36,6 @@ kernel configuration file:
 .Bd -ragged -offset indent
 .Cd "device scbus"
 .Cd "device ata"
-.Cd "options ATA_CAM"
 .Ed
 .Pp
 Alternatively, to load the driver as set of modules at boot time,
@@ -79,12 +78,6 @@ prerequisite for the other modules.
 The next three lines are generic bus-specific drivers.
 Of the rest, ataahci is the AHCI driver.
 The others are vendor-specific PCI drivers.
-The
-.Dv ATA_CAM
-option should always remain in the kernel configuration, to make
-the driver work as a
-.Xr CAM 4
-subsystem module.
 .Pp
 The following tunables are settable from the
 .Xr loader 8 :

Modified: head/sys/amd64/conf/GENERIC
==============================================================================
--- head/sys/amd64/conf/GENERIC Thu Apr  4 05:47:50 2013        (r249082)
+++ head/sys/amd64/conf/GENERIC Thu Apr  4 07:12:24 2013        (r249083)
@@ -102,7 +102,6 @@ device              fdc
 # ATA controllers
 device         ahci            # AHCI-compatible SATA controllers
 device         ata             # Legacy ATA/SATA controllers
-options        ATA_CAM         # Handle legacy controllers with CAM
 options        ATA_STATIC_ID   # Static device numbering
 device         mvs             # Marvell 88SX50XX/88SX60XX/88SX70XX/SoC SATA
 device         siis            # SiliconImage SiI3124/SiI3132/SiI3531 SATA

Modified: head/sys/arm/conf/AC100
==============================================================================
--- head/sys/arm/conf/AC100     Thu Apr  4 05:47:50 2013        (r249082)
+++ head/sys/arm/conf/AC100     Thu Apr  4 07:12:24 2013        (r249083)
@@ -76,7 +76,6 @@ device                md
 
 # SATA
 #device                ata
-#device                atadisk
 #device                mvs
 
 # Serial ports

Modified: head/sys/arm/conf/ARMADAXP
==============================================================================
--- head/sys/arm/conf/ARMADAXP  Thu Apr  4 05:47:50 2013        (r249082)
+++ head/sys/arm/conf/ARMADAXP  Thu Apr  4 07:12:24 2013        (r249083)
@@ -76,7 +76,6 @@ device                da
 
 # SATA
 device         ata
-device         atadisk
 #device                mvs
 
 # Serial ports

Modified: head/sys/arm/conf/AVILA
==============================================================================
--- head/sys/arm/conf/AVILA     Thu Apr  4 05:47:50 2013        (r249082)
+++ head/sys/arm/conf/AVILA     Thu Apr  4 07:12:24 2013        (r249083)
@@ -93,7 +93,6 @@ device                avila_gpio      # GPIO pins on J8
 
 device         ata
 device         avila_ata       # Gateworks CF/IDE support
-options        ATA_CAM
 
 device         npe             # Network Processing Engine
 device         npe_fw

Modified: head/sys/arm/conf/CAMBRIA
==============================================================================
--- head/sys/arm/conf/CAMBRIA   Thu Apr  4 05:47:50 2013        (r249082)
+++ head/sys/arm/conf/CAMBRIA   Thu Apr  4 07:12:24 2013        (r249083)
@@ -96,7 +96,6 @@ device                cambria_gpio    # GPIO pins on J11
 
 device         ata
 device         avila_ata       # Gateworks CF/IDE support
-options        ATA_CAM
 
 device         npe             # Network Processing Engine
 device         npe_fw

Modified: head/sys/arm/conf/CRB
==============================================================================
--- head/sys/arm/conf/CRB       Thu Apr  4 05:47:50 2013        (r249082)
+++ head/sys/arm/conf/CRB       Thu Apr  4 07:12:24 2013        (r249083)
@@ -73,7 +73,6 @@ device                uart
 device         pci
 
 device         ata
-options        ATA_CAM
 options        ATA_STATIC_ID   # Static device numbering
 
 device         scbus           # SCSI bus (required for ATA/SCSI)

Modified: head/sys/arm/conf/CUBIEBOARD
==============================================================================
--- head/sys/arm/conf/CUBIEBOARD        Thu Apr  4 05:47:50 2013        
(r249082)
+++ head/sys/arm/conf/CUBIEBOARD        Thu Apr  4 07:12:24 2013        
(r249083)
@@ -83,7 +83,6 @@ options               ROOTDEVNAME=\"ufs:/dev/da0s2\"
 # ATA controllers
 #device                ahci            # AHCI-compatible SATA controllers
 #device                ata             # Legacy ATA/SATA controllers
-#options       ATA_CAM         # Handle legacy controllers with CAM
 #options       ATA_STATIC_ID   # Static device numbering
 
 # Console and misc

Modified: head/sys/arm/conf/EFIKA_MX
==============================================================================
--- head/sys/arm/conf/EFIKA_MX  Thu Apr  4 05:47:50 2013        (r249082)
+++ head/sys/arm/conf/EFIKA_MX  Thu Apr  4 07:12:24 2013        (r249083)
@@ -111,7 +111,6 @@ options     ALT_BREAK_TO_DEBUGGER
 device         ata
 device         atapci          # Only for helper functions
 device         imxata
-options        ATA_CAM
 options        ATA_STATIC_ID   # Static device numbering
 
 device         iomux           # IO Multiplexor

Modified: head/sys/arm/conf/EP80219
==============================================================================
--- head/sys/arm/conf/EP80219   Thu Apr  4 05:47:50 2013        (r249082)
+++ head/sys/arm/conf/EP80219   Thu Apr  4 07:12:24 2013        (r249083)
@@ -73,7 +73,6 @@ device                uart
 device         pci
 
 device         ata
-options        ATA_CAM
 options        ATA_STATIC_ID   # Static device numbering
 
 device         scbus           # SCSI bus (required for ATA/SCSI)

Modified: head/sys/arm/conf/IQ31244
==============================================================================
--- head/sys/arm/conf/IQ31244   Thu Apr  4 05:47:50 2013        (r249082)
+++ head/sys/arm/conf/IQ31244   Thu Apr  4 07:12:24 2013        (r249083)
@@ -72,7 +72,6 @@ device                uart
 device         pci
 
 device         ata
-options        ATA_CAM
 options        ATA_STATIC_ID   # Static device numbering
 
 device         scbus           # SCSI bus (required for ATA/SCSI)

Modified: head/sys/arm/conf/TS7800
==============================================================================
--- head/sys/arm/conf/TS7800    Thu Apr  4 05:47:50 2013        (r249082)
+++ head/sys/arm/conf/TS7800    Thu Apr  4 07:12:24 2013        (r249083)
@@ -70,7 +70,6 @@ device                da
 
 # SATA
 device         ata
-options        ATA_CAM
 
 # Flattened Device Tree
 options        FDT

Modified: head/sys/cam/ata/ata_da.c
==============================================================================
--- head/sys/cam/ata/ata_da.c   Thu Apr  4 05:47:50 2013        (r249082)
+++ head/sys/cam/ata/ata_da.c   Thu Apr  4 07:12:24 2013        (r249083)
@@ -411,11 +411,7 @@ static void                adasuspend(void *arg);
 static void            adaresume(void *arg);
 
 #ifndef        ADA_DEFAULT_LEGACY_ALIASES
-#ifdef ATA_CAM
 #define        ADA_DEFAULT_LEGACY_ALIASES      1
-#else
-#define        ADA_DEFAULT_LEGACY_ALIASES      0
-#endif
 #endif
 
 #ifndef ADA_DEFAULT_TIMEOUT

Modified: head/sys/conf/NOTES
==============================================================================
--- head/sys/conf/NOTES Thu Apr  4 05:47:50 2013        (r249082)
+++ head/sys/conf/NOTES Thu Apr  4 07:12:24 2013        (r249083)
@@ -1706,21 +1706,14 @@ device          mvs
 device         siis
 
 #
-# The 'ATA' driver supports all ATA and ATAPI devices, including PC Card
-# devices. You only need one "device ata" for it to find all
+# The 'ATA' driver supports all legacy ATA/ATAPI controllers, including
+# PC Card devices. You only need one "device ata" for it to find all
 # PCI and PC Card ATA/ATAPI devices on modern machines.
 # Alternatively, individual bus and chipset drivers may be chosen by using
 # the 'atacore' driver then selecting the drivers on a per vendor basis.
 # For example to build a system which only supports a VIA chipset,
 # omit 'ata' and include the 'atacore', 'atapci' and 'atavia' drivers.
 device         ata
-#device                atadisk         # ATA disk drives
-#device                ataraid         # ATA RAID drives
-#device                atapicd         # ATAPI CDROM drives
-#device                atapifd         # ATAPI floppy drives
-#device                atapist         # ATAPI tape drives
-#device                atapicam        # emulate ATAPI devices as SCSI ditto 
via CAM
-                               # needs CAM to be present (scbus & pass)
 
 # Modular ATA
 #device                atacore         # Core ATA functionality
@@ -1770,15 +1763,9 @@ hint.ata.1.irq="15"
 #                      else the device numbers are dynamically allocated.
 # ATA_REQUEST_TIMEOUT: the number of seconds to wait for an ATA request
 #                      before timing out.
-# ATA_CAM:             Turn ata(4) subsystem controller drivers into cam(4)
-#                      interface modules. This deprecates all ata(4)
-#                      peripheral device drivers (atadisk, ataraid, atapicd,
-#                      atapifd, atapist, atapicam) and all user-level APIs.
-#                      cam(4) drivers and APIs will be connected instead.
 
 options        ATA_STATIC_ID
 #options       ATA_REQUEST_TIMEOUT=10
-options        ATA_CAM
 
 #
 # Standard floppy disk controllers and floppy tapes, supports

Modified: head/sys/conf/files
==============================================================================
--- head/sys/conf/files Thu Apr  4 05:47:50 2013        (r249082)
+++ head/sys/conf/files Thu Apr  4 07:12:24 2013        (r249083)
@@ -705,12 +705,6 @@ dev/ata/chipsets/ata-serverworks.c optio
 dev/ata/chipsets/ata-siliconimage.c    optional ata pci | atasiliconimage | 
ataati
 dev/ata/chipsets/ata-sis.c     optional ata pci | atasis
 dev/ata/chipsets/ata-via.c     optional ata pci | atavia
-dev/ata/ata-disk.c             optional atadisk
-dev/ata/ata-raid.c             optional ataraid
-dev/ata/atapi-cd.c             optional atapicd
-dev/ata/atapi-fd.c             optional atapifd
-dev/ata/atapi-tape.c           optional atapist
-dev/ata/atapi-cam.c            optional atapicam
 #
 dev/ath/if_ath_pci.c           optional ath_pci pci \
        compile-with "${NORMAL_C} -I$S/dev/ath"

Modified: head/sys/conf/files.sparc64
==============================================================================
--- head/sys/conf/files.sparc64 Thu Apr  4 05:47:50 2013        (r249082)
+++ head/sys/conf/files.sparc64 Thu Apr  4 07:12:24 2013        (r249083)
@@ -88,7 +88,7 @@ sparc64/pci/schizo.c          optional        pci
 sparc64/sbus/dma_sbus.c                optional        sbus
 sparc64/sbus/sbus.c            optional        sbus
 sparc64/sbus/lsi64854.c                optional        sbus
-sparc64/sparc64/ata_machdep.c  optional        ada | atadisk | da
+sparc64/sparc64/ata_machdep.c  optional        ada | da
 sparc64/sparc64/autoconf.c     standard
 sparc64/sparc64/bus_machdep.c  standard
 sparc64/sparc64/cache.c                standard

Modified: head/sys/conf/options
==============================================================================
--- head/sys/conf/options       Thu Apr  4 05:47:50 2013        (r249082)
+++ head/sys/conf/options       Thu Apr  4 07:12:24 2013        (r249083)
@@ -366,7 +366,6 @@ ISCSI_INITIATOR_DEBUG       opt_iscsi_initiato
 ATA_STATIC_ID          opt_ata.h
 ATA_NOPCI              opt_ata.h
 ATA_REQUEST_TIMEOUT    opt_ata.h
-ATA_CAM                        opt_ata.h
 
 # Net stuff.
 ACCEPT_FILTER_DATA

Modified: head/sys/dev/ata/ata-all.c
==============================================================================
--- head/sys/dev/ata/ata-all.c  Thu Apr  4 05:47:50 2013        (r249082)
+++ head/sys/dev/ata/ata-all.c  Thu Apr  4 07:12:24 2013        (r249083)
@@ -51,90 +51,33 @@ __FBSDID("$FreeBSD$");
 #include <dev/pci/pcivar.h>
 #include <ata_if.h>
 
-#ifdef ATA_CAM
 #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>
-#endif
-
-#ifndef ATA_CAM
-/* device structure */
-static  d_ioctl_t       ata_ioctl;
-static struct cdevsw ata_cdevsw = {
-       .d_version =    D_VERSION,
-       .d_flags =      D_NEEDGIANT, /* we need this as newbus isn't mpsafe */
-       .d_ioctl =      ata_ioctl,
-       .d_name =       "ata",
-};
-#endif
 
 /* prototypes */
-#ifndef ATA_CAM
-static void ata_boot_attach(void);
-static device_t ata_add_child(device_t, struct ata_device *, int);
-#else
 static void ataaction(struct cam_sim *sim, union ccb *ccb);
 static void atapoll(struct cam_sim *sim);
-#endif
 static void ata_conn_event(void *, int);
-#ifndef ATA_CAM
-static void bswap(int8_t *, int);
-static void btrim(int8_t *, int);
-static void bpack(int8_t *, int8_t *, int);
-#endif
 static void ata_interrupt_locked(void *data);
-#ifdef ATA_CAM
 static void ata_periodic_poll(void *data);
-#endif
 
 /* global vars */
 MALLOC_DEFINE(M_ATA, "ata_generic", "ATA driver generic layer");
 int (*ata_raid_ioctl_func)(u_long cmd, caddr_t data) = NULL;
-#ifndef ATA_CAM
-struct intr_config_hook *ata_delayed_attach = NULL;
-#endif
 devclass_t ata_devclass;
 uma_zone_t ata_request_zone;
-uma_zone_t ata_composite_zone;
-#ifndef ATA_CAM
-int ata_wc = 1;
-int ata_setmax = 0;
-#endif
 int ata_dma_check_80pin = 1;
 
-/* local vars */
-#ifndef ATA_CAM
-static int ata_dma = 1;
-static int atapi_dma = 1;
-#endif
-
 /* sysctl vars */
 static SYSCTL_NODE(_hw, OID_AUTO, ata, CTLFLAG_RD, 0, "ATA driver parameters");
-#ifndef ATA_CAM
-TUNABLE_INT("hw.ata.ata_dma", &ata_dma);
-SYSCTL_INT(_hw_ata, OID_AUTO, ata_dma, CTLFLAG_RDTUN, &ata_dma, 0,
-          "ATA disk DMA mode control");
-#endif
 TUNABLE_INT("hw.ata.ata_dma_check_80pin", &ata_dma_check_80pin);
 SYSCTL_INT(_hw_ata, OID_AUTO, ata_dma_check_80pin,
           CTLFLAG_RW, &ata_dma_check_80pin, 1,
           "Check for 80pin cable before setting ATA DMA mode");
-#ifndef ATA_CAM
-TUNABLE_INT("hw.ata.atapi_dma", &atapi_dma);
-SYSCTL_INT(_hw_ata, OID_AUTO, atapi_dma, CTLFLAG_RDTUN, &atapi_dma, 0,
-          "ATAPI device DMA mode control");
-TUNABLE_INT("hw.ata.wc", &ata_wc);
-SYSCTL_INT(_hw_ata, OID_AUTO, wc, CTLFLAG_RDTUN, &ata_wc, 0,
-          "ATA disk write caching");
-TUNABLE_INT("hw.ata.setmax", &ata_setmax);
-SYSCTL_INT(_hw_ata, OID_AUTO, setmax, CTLFLAG_RDTUN, &ata_setmax, 0,
-          "ATA disk set max native address");
-#endif
-#ifdef ATA_CAM
 FEATURE(ata_cam, "ATA devices are accessed through the cam(4) driver");
-#endif
 
 /*
  * newbus device interface related functions
@@ -150,12 +93,10 @@ ata_attach(device_t dev)
 {
     struct ata_channel *ch = device_get_softc(dev);
     int error, rid;
-#ifdef ATA_CAM
     struct cam_devq *devq;
     const char *res;
     char buf[64];
     int i, mode;
-#endif
 
     /* check that we have a virgin channel to attach */
     if (ch->r_irq)
@@ -166,13 +107,7 @@ ata_attach(device_t dev)
     ch->state = ATA_IDLE;
     bzero(&ch->state_mtx, sizeof(struct mtx));
     mtx_init(&ch->state_mtx, "ATA state lock", NULL, MTX_DEF);
-#ifndef ATA_CAM
-    bzero(&ch->queue_mtx, sizeof(struct mtx));
-    mtx_init(&ch->queue_mtx, "ATA queue lock", NULL, MTX_DEF);
-    TAILQ_INIT(&ch->ata_queue);
-#endif
     TASK_INIT(&ch->conntask, 0, ata_conn_event, dev);
-#ifdef ATA_CAM
        for (i = 0; i < 16; i++) {
                ch->user[i].revision = 0;
                snprintf(buf, sizeof(buf), "dev%d.sata_rev", i);
@@ -207,15 +142,6 @@ ata_attach(device_t dev)
                        ch->user[i].caps |= CTS_SATA_CAPS_D_PMREQ;
        }
        callout_init(&ch->poll_callout, 1);
-#endif
-
-#ifndef ATA_CAM
-    /* reset the controller HW, the channel and device(s) */
-    while (ATA_LOCKING(dev, ATA_LF_LOCK) != ch->unit)
-       pause("ataatch", 1);
-    ATA_RESET(dev);
-    ATA_LOCKING(dev, ATA_LF_UNLOCK);
-#endif
 
     /* allocate DMA resources if DMA HW present*/
     if (ch->dma.alloc)
@@ -236,12 +162,6 @@ ata_attach(device_t dev)
        return error;
     }
 
-#ifndef ATA_CAM
-    /* probe and attach devices on this channel unless we are in early boot */
-    if (!ata_delayed_attach)
-       ata_identify(dev);
-    return (0);
-#else
        if (ch->flags & ATA_PERIODIC_POLL)
                callout_reset(&ch->poll_callout, hz, ata_periodic_poll, ch);
        mtx_lock(&ch->state_mtx);
@@ -286,17 +206,12 @@ err1:
        if (ch->flags & ATA_PERIODIC_POLL)
                callout_drain(&ch->poll_callout);
        return (error);
-#endif
 }
 
 int
 ata_detach(device_t dev)
 {
     struct ata_channel *ch = device_get_softc(dev);
-#ifndef ATA_CAM
-    device_t *children;
-    int nchildren, i;
-#endif
 
     /* check that we have a valid channel to detach */
     if (!ch->r_irq)
@@ -306,23 +221,11 @@ ata_detach(device_t dev)
     mtx_lock(&ch->state_mtx);
     ch->state |= ATA_STALL_QUEUE;
     mtx_unlock(&ch->state_mtx);
-#ifdef ATA_CAM
     if (ch->flags & ATA_PERIODIC_POLL)
        callout_drain(&ch->poll_callout);
-#endif
 
-#ifndef ATA_CAM
-    /* detach & delete all children */
-    if (!device_get_children(dev, &children, &nchildren)) {
-       for (i = 0; i < nchildren; i++)
-           if (children[i])
-               device_delete_child(dev, children[i]);
-       free(children, M_TEMP);
-    } 
-#endif
     taskqueue_drain(taskqueue_thread, &ch->conntask);
 
-#ifdef ATA_CAM
        mtx_lock(&ch->state_mtx);
        xpt_async(AC_LOST_DEVICE, ch->path, NULL);
        xpt_free_path(ch->path);
@@ -330,7 +233,6 @@ ata_detach(device_t dev)
        cam_sim_free(ch->sim, /*free_devq*/TRUE);
        ch->sim = NULL;
        mtx_unlock(&ch->state_mtx);
-#endif
 
     /* release resources */
     bus_teardown_intr(dev, ch->r_irq, ch->ih);
@@ -342,9 +244,6 @@ ata_detach(device_t dev)
        ch->dma.free(dev);
 
     mtx_destroy(&ch->state_mtx);
-#ifndef ATA_CAM
-    mtx_destroy(&ch->queue_mtx);
-#endif
     return 0;
 }
 
@@ -352,7 +251,6 @@ static void
 ata_conn_event(void *context, int dummy)
 {
        device_t dev = (device_t)context;
-#ifdef ATA_CAM
        struct ata_channel *ch = device_get_softc(dev);
        union ccb *ccb;
 
@@ -372,9 +270,6 @@ ata_conn_event(void *context, int dummy)
        }
        xpt_rescan(ccb);
        mtx_unlock(&ch->state_mtx);
-#else
-       ata_reinit(dev);
-#endif
 }
 
 int
@@ -382,94 +277,7 @@ ata_reinit(device_t dev)
 {
     struct ata_channel *ch = device_get_softc(dev);
     struct ata_request *request;
-#ifndef ATA_CAM
-    device_t *children;
-    int nchildren, i;
-
-    /* check that we have a valid channel to reinit */
-    if (!ch || !ch->r_irq)
-       return ENXIO;
-
-    if (bootverbose)
-       device_printf(dev, "reiniting channel ..\n");
-
-    /* poll for locking the channel */
-    while (ATA_LOCKING(dev, ATA_LF_LOCK) != ch->unit)
-       pause("atarini", 1);
-
-    /* catch eventual request in ch->running */
-    mtx_lock(&ch->state_mtx);
-    if (ch->state & ATA_STALL_QUEUE) {
-       /* Recursive reinits and reinits during detach prohobited. */
-       mtx_unlock(&ch->state_mtx);
-       return (ENXIO);
-    }
-    if ((request = ch->running))
-       callout_stop(&request->callout);
-    ch->running = NULL;
-
-    /* unconditionally grap the channel lock */
-    ch->state |= ATA_STALL_QUEUE;
-    mtx_unlock(&ch->state_mtx);
-
-    /* reset the controller HW, the channel and device(s) */
-    ATA_RESET(dev);
-
-    /* reinit the children and delete any that fails */
-    if (!device_get_children(dev, &children, &nchildren)) {
-       mtx_lock(&Giant);       /* newbus suckage it needs Giant */
-       for (i = 0; i < nchildren; i++) {
-           /* did any children go missing ? */
-           if (children[i] && device_is_attached(children[i]) &&
-               ATA_REINIT(children[i])) {
-               /*
-                * if we had a running request and its device matches
-                * this child we need to inform the request that the 
-                * device is gone.
-                */
-               if (request && request->dev == children[i]) {
-                   request->result = ENXIO;
-                   device_printf(request->dev, "FAILURE - device detached\n");
-
-                   /* if not timeout finish request here */
-                   if (!(request->flags & ATA_R_TIMEOUT))
-                           ata_finish(request);
-                   request = NULL;
-               }
-               device_delete_child(dev, children[i]);
-           }
-       }
-       free(children, M_TEMP);
-       mtx_unlock(&Giant);     /* newbus suckage dealt with, release Giant */
-    }
-
-    /* if we still have a good request put it on the queue again */
-    if (request && !(request->flags & ATA_R_TIMEOUT)) {
-       device_printf(request->dev,
-                     "WARNING - %s requeued due to channel reset",
-                     ata_cmd2str(request));
-       if (!(request->flags & (ATA_R_ATAPI | ATA_R_CONTROL)))
-           printf(" LBA=%ju", request->u.ata.lba);
-       printf("\n");
-       request->flags |= ATA_R_REQUEUE;
-       ata_queue_request(request);
-    }
-
-    /* we're done release the channel for new work */
-    mtx_lock(&ch->state_mtx);
-    ch->state = ATA_IDLE;
-    mtx_unlock(&ch->state_mtx);
-    ATA_LOCKING(dev, ATA_LF_UNLOCK);
-
-    /* Add new children. */
-/*    ata_identify(dev); */
-
-    if (bootverbose)
-       device_printf(dev, "reinit done ..\n");
 
-    /* kick off requests on the queue */
-    ata_start(dev);
-#else
        xpt_freeze_simq(ch->sim, 1);
        if ((request = ch->running)) {
                ch->running = NULL;
@@ -486,7 +294,6 @@ ata_reinit(device_t dev)
        /* Tell the XPT about the event */
        xpt_async(AC_BUS_RESET, ch->path, NULL);
        xpt_release_simq(ch->sim, TRUE);
-#endif
        return(0);
 }
 
@@ -499,7 +306,6 @@ ata_suspend(device_t dev)
     if (!dev || !(ch = device_get_softc(dev)))
        return ENXIO;
 
-#ifdef ATA_CAM
        if (ch->flags & ATA_PERIODIC_POLL)
                callout_drain(&ch->poll_callout);
        mtx_lock(&ch->state_mtx);
@@ -507,20 +313,6 @@ ata_suspend(device_t dev)
        while (ch->state != ATA_IDLE)
                msleep(ch, &ch->state_mtx, PRIBIO, "atasusp", hz/100);
        mtx_unlock(&ch->state_mtx);
-#else
-    /* wait for the channel to be IDLE or detached before suspending */
-    while (ch->r_irq) {
-       mtx_lock(&ch->state_mtx);
-       if (ch->state == ATA_IDLE) {
-           ch->state = ATA_ACTIVE;
-           mtx_unlock(&ch->state_mtx);
-           break;
-       }
-       mtx_unlock(&ch->state_mtx);
-       tsleep(ch, PRIBIO, "atasusp", hz/10);
-    }
-    ATA_LOCKING(dev, ATA_LF_UNLOCK);
-#endif
     return(0);
 }
 
@@ -534,36 +326,25 @@ ata_resume(device_t dev)
     if (!dev || !(ch = device_get_softc(dev)))
        return ENXIO;
 
-#ifdef ATA_CAM
        mtx_lock(&ch->state_mtx);
        error = ata_reinit(dev);
        xpt_release_simq(ch->sim, TRUE);
        mtx_unlock(&ch->state_mtx);
        if (ch->flags & ATA_PERIODIC_POLL)
                callout_reset(&ch->poll_callout, hz, ata_periodic_poll, ch);
-#else
-    /* reinit the devices, we dont know what mode/state they are in */
-    error = ata_reinit(dev);
-    /* kick off requests on the queue */
-    ata_start(dev);
-#endif
     return error;
 }
 
 void
 ata_interrupt(void *data)
 {
-#ifdef ATA_CAM
     struct ata_channel *ch = (struct ata_channel *)data;
 
     mtx_lock(&ch->state_mtx);
     xpt_batch_start(ch->sim);
-#endif
     ata_interrupt_locked(data);
-#ifdef ATA_CAM
     xpt_batch_done(ch->sim);
     mtx_unlock(&ch->state_mtx);
-#endif
 }
 
 static void
@@ -572,9 +353,6 @@ ata_interrupt_locked(void *data)
     struct ata_channel *ch = (struct ata_channel *)data;
     struct ata_request *request;
 
-#ifndef ATA_CAM
-    mtx_lock(&ch->state_mtx);
-#endif
     do {
        /* ignore interrupt if its not for us */
        if (ch->hw.status && !ch->hw.status(ch->dev))
@@ -600,22 +378,12 @@ ata_interrupt_locked(void *data)
            ch->running = NULL;
            if (ch->state == ATA_ACTIVE)
                ch->state = ATA_IDLE;
-#ifdef ATA_CAM
            ata_cam_end_transaction(ch->dev, request);
-#else
-           mtx_unlock(&ch->state_mtx);
-           ATA_LOCKING(ch->dev, ATA_LF_UNLOCK);
-           ata_finish(request);
-#endif
            return;
        }
     } while (0);
-#ifndef ATA_CAM
-    mtx_unlock(&ch->state_mtx);
-#endif
 }
 
-#ifdef ATA_CAM
 static void
 ata_periodic_poll(void *data)
 {
@@ -624,7 +392,6 @@ ata_periodic_poll(void *data)
     callout_reset(&ch->poll_callout, hz, ata_periodic_poll, ch);
     ata_interrupt(ch);
 }
-#endif
 
 void
 ata_print_cable(device_t dev, u_int8_t *who)
@@ -633,468 +400,9 @@ ata_print_cable(device_t dev, u_int8_t *
                   "DMA limited to UDMA33, %s found non-ATA66 cable\n", who);
 }
 
-#ifndef ATA_CAM
-int
-ata_check_80pin(device_t dev, int mode)
-{
-    struct ata_device *atadev = device_get_softc(dev);
-
-    if (!ata_dma_check_80pin) {
-        if (bootverbose)
-            device_printf(dev, "Skipping 80pin cable check\n");
-        return mode;
-    }
-
-    if (mode > ATA_UDMA2 && !(atadev->param.hwres & ATA_CABLE_ID)) {
-        ata_print_cable(dev, "device");
-        mode = ATA_UDMA2;
-    }
-    return mode;
-}
-#endif
-
-#ifndef ATA_CAM
-void
-ata_setmode(device_t dev)
-{
-       struct ata_channel *ch = device_get_softc(device_get_parent(dev));
-       struct ata_device *atadev = device_get_softc(dev);
-       int error, mode, pmode;
-
-       mode = atadev->mode;
-       do {
-               pmode = mode = ata_limit_mode(dev, mode, ATA_DMA_MAX);
-               mode = ATA_SETMODE(device_get_parent(dev), atadev->unit, mode);
-               if ((ch->flags & (ATA_CHECKS_CABLE | ATA_SATA)) == 0)
-                       mode = ata_check_80pin(dev, mode);
-       } while (pmode != mode); /* Interate till successfull negotiation. */
-       error = ata_controlcmd(dev, ATA_SETFEATURES, ATA_SF_SETXFER, 0, mode);
-       if (bootverbose)
-               device_printf(dev, "%ssetting %s\n",
-                   (error) ? "FAILURE " : "", ata_mode2str(mode));
-       atadev->mode = mode;
-}
-#endif
-
-/*
- * device related interfaces
- */
-#ifndef ATA_CAM
-static int
-ata_ioctl(struct cdev *dev, u_long cmd, caddr_t data,
-         int32_t flag, struct thread *td)
-{
-    device_t device, *children;
-    struct ata_ioc_devices *devices = (struct ata_ioc_devices *)data;
-    int *value = (int *)data;
-    int i, nchildren, error = ENOTTY;
-
-    switch (cmd) {
-    case IOCATAGMAXCHANNEL:
-       /* In case we have channel 0..n this will return n+1. */
-       *value = devclass_get_maxunit(ata_devclass);
-       error = 0;
-       break;
-
-    case IOCATAREINIT:
-       if (*value >= devclass_get_maxunit(ata_devclass) ||
-           !(device = devclass_get_device(ata_devclass, *value)) ||
-           !device_is_attached(device))
-           return ENXIO;
-       error = ata_reinit(device);
-       break;
-
-    case IOCATAATTACH:
-       if (*value >= devclass_get_maxunit(ata_devclass) ||
-           !(device = devclass_get_device(ata_devclass, *value)) ||
-           !device_is_attached(device))
-           return ENXIO;
-       error = DEVICE_ATTACH(device);
-       break;
-
-    case IOCATADETACH:
-       if (*value >= devclass_get_maxunit(ata_devclass) ||
-           !(device = devclass_get_device(ata_devclass, *value)) ||
-           !device_is_attached(device))
-           return ENXIO;
-       error = DEVICE_DETACH(device);
-       break;
-
-    case IOCATADEVICES:
-       if (devices->channel >= devclass_get_maxunit(ata_devclass) ||
-           !(device = devclass_get_device(ata_devclass, devices->channel)) ||
-           !device_is_attached(device))
-           return ENXIO;
-       bzero(devices->name[0], 32);
-       bzero(&devices->params[0], sizeof(struct ata_params));
-       bzero(devices->name[1], 32);
-       bzero(&devices->params[1], sizeof(struct ata_params));
-       if (!device_get_children(device, &children, &nchildren)) {
-           for (i = 0; i < nchildren; i++) {
-               if (children[i] && device_is_attached(children[i])) {
-                   struct ata_device *atadev = device_get_softc(children[i]);
-
-                   if (atadev->unit == ATA_MASTER) { /* XXX SOS PM */
-                       strncpy(devices->name[0],
-                               device_get_nameunit(children[i]), 32);
-                       bcopy(&atadev->param, &devices->params[0],
-                             sizeof(struct ata_params));
-                   }
-                   if (atadev->unit == ATA_SLAVE) { /* XXX SOS PM */
-                       strncpy(devices->name[1],
-                               device_get_nameunit(children[i]), 32);
-                       bcopy(&atadev->param, &devices->params[1],
-                             sizeof(struct ata_params));
-                   }
-               }
-           }
-           free(children, M_TEMP);
-           error = 0;
-       }
-       else
-           error = ENODEV;
-       break;
-
-    default:
-       if (ata_raid_ioctl_func)
-           error = ata_raid_ioctl_func(cmd, data);
-    }
-    return error;
-}
-#endif
-
-#ifndef ATA_CAM
-int
-ata_device_ioctl(device_t dev, u_long cmd, caddr_t data)
-{
-    struct ata_device *atadev = device_get_softc(dev);
-    struct ata_channel *ch = device_get_softc(device_get_parent(dev));
-    struct ata_ioc_request *ioc_request = (struct ata_ioc_request *)data;
-    struct ata_params *params = (struct ata_params *)data;
-    int *mode = (int *)data;
-    struct ata_request *request;
-    caddr_t buf;
-    int error;
-
-    switch (cmd) {
-    case IOCATAREQUEST:
-       if (ioc_request->count >
-           (ch->dma.max_iosize ? ch->dma.max_iosize : DFLTPHYS)) {
-               return (EFBIG);
-       }
-       if (!(buf = malloc(ioc_request->count, M_ATA, M_NOWAIT))) {
-           return ENOMEM;
-       }
-       if (!(request = ata_alloc_request())) {
-           free(buf, M_ATA);
-           return  ENOMEM;
-       }
-       request->dev = atadev->dev;
-       if (ioc_request->flags & ATA_CMD_WRITE) {
-           error = copyin(ioc_request->data, buf, ioc_request->count);
-           if (error) {
-               free(buf, M_ATA);
-               ata_free_request(request);
-               return error;
-           }
-       }
-       if (ioc_request->flags & ATA_CMD_ATAPI) {
-           request->flags = ATA_R_ATAPI;
-           bcopy(ioc_request->u.atapi.ccb, request->u.atapi.ccb, 16);
-       }
-       else {
-           request->u.ata.command = ioc_request->u.ata.command;
-           request->u.ata.feature = ioc_request->u.ata.feature;
-           request->u.ata.lba = ioc_request->u.ata.lba;
-           request->u.ata.count = ioc_request->u.ata.count;
-       }
-       request->timeout = ioc_request->timeout;
-       request->data = buf;
-       request->bytecount = ioc_request->count;
-       request->transfersize = request->bytecount;
-       if (ioc_request->flags & ATA_CMD_CONTROL)
-           request->flags |= ATA_R_CONTROL;
-       if (ioc_request->flags & ATA_CMD_READ)
-           request->flags |= ATA_R_READ;
-       if (ioc_request->flags & ATA_CMD_WRITE)
-           request->flags |= ATA_R_WRITE;
-       ata_queue_request(request);
-       if (request->flags & ATA_R_ATAPI) {
-           bcopy(&request->u.atapi.sense, &ioc_request->u.atapi.sense,
-                 sizeof(struct atapi_sense));
-       }
-       else {
-           ioc_request->u.ata.command = request->u.ata.command;
-           ioc_request->u.ata.feature = request->u.ata.feature;
-           ioc_request->u.ata.lba = request->u.ata.lba;
-           ioc_request->u.ata.count = request->u.ata.count;
-       }
-       ioc_request->error = request->result;
-       if (ioc_request->flags & ATA_CMD_READ)
-           error = copyout(buf, ioc_request->data, ioc_request->count);
-       else
-           error = 0;
-       free(buf, M_ATA);
-       ata_free_request(request);
-       return error;
-   
-    case IOCATAGPARM:
-       ata_getparam(atadev, 0);
-       bcopy(&atadev->param, params, sizeof(struct ata_params));
-       return 0;
-       
-    case IOCATASMODE:
-       atadev->mode = *mode;
-       ata_setmode(dev);
-       return 0;
-
-    case IOCATAGMODE:
-       *mode = atadev->mode |
-           (ATA_GETREV(device_get_parent(dev), atadev->unit) << 8);
-       return 0;
-    case IOCATASSPINDOWN:
-       atadev->spindown = *mode;
-       return 0;
-    case IOCATAGSPINDOWN:
-       *mode = atadev->spindown;
-       return 0;
-    default:
-       return ENOTTY;
-    }
-}
-#endif
-
-#ifndef ATA_CAM
-static void
-ata_boot_attach(void)
-{
-    struct ata_channel *ch;
-    int ctlr;
-
-    mtx_lock(&Giant);       /* newbus suckage it needs Giant */
-
-    /* kick off probe and attach on all channels */
-    for (ctlr = 0; ctlr < devclass_get_maxunit(ata_devclass); ctlr++) {
-       if ((ch = devclass_get_softc(ata_devclass, ctlr))) {
-           ata_identify(ch->dev);
-       }
-    }
-
-    /* release the hook that got us here, we are only needed once during boot 
*/
-    if (ata_delayed_attach) {
-       config_intrhook_disestablish(ata_delayed_attach);
-       free(ata_delayed_attach, M_TEMP);
-       ata_delayed_attach = NULL;
-    }
-
-    mtx_unlock(&Giant);     /* newbus suckage dealt with, release Giant */
-}
-#endif
-
 /*
  * misc support functions
  */
-#ifndef ATA_CAM
-static device_t
-ata_add_child(device_t parent, struct ata_device *atadev, int unit)
-{
-    device_t child;
-
-    if ((child = device_add_child(parent, (unit < 0) ? NULL : "ad", unit))) {
-       device_set_softc(child, atadev);
-       device_quiet(child);
-       atadev->dev = child;
-       atadev->max_iosize = DEV_BSIZE;
-       atadev->mode = ATA_PIO_MAX;
-    }
-    return child;
-}
-#endif
-
-#ifndef ATA_CAM
-int
-ata_getparam(struct ata_device *atadev, int init)
-{
-    struct ata_channel *ch = device_get_softc(device_get_parent(atadev->dev));
-    struct ata_request *request;
-    const char *res;
-    char buf[64];
-    u_int8_t command = 0;
-    int error = ENOMEM, retries = 2, mode = -1;
-
-    if (ch->devices & (ATA_ATA_MASTER << atadev->unit))
-       command = ATA_ATA_IDENTIFY;
-    if (ch->devices & (ATA_ATAPI_MASTER << atadev->unit))
-       command = ATA_ATAPI_IDENTIFY;
-    if (!command)
-       return ENXIO;
-
-    while (retries-- > 0 && error) {
-       if (!(request = ata_alloc_request()))
-           break;
-       request->dev = atadev->dev;
-       request->timeout = 1;
-       request->retries = 0;

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to