Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 30 Mar 2012 23:50:26 +0000 (UTC)
From:      Marius Strobl <marius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r233716 - in stable/8/sys: dev/ata dev/ata/chipsets i386/conf
Message-ID:  <201203302350.q2UNoQqt063656@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: marius
Date: Fri Mar 30 23:50:26 2012
New Revision: 233716
URL: http://svn.freebsd.org/changeset/base/233716

Log:
  MFC: r233274
  
  Remove remnants of ATA_LOCKING uses in the ATA_CAM case and wrap it
  along with functions, SYSCTLs and tunables that are not used with
  ATA_CAM in #ifndef ATA_CAM, similar to the existing #ifdef'ed ATA_CAM
  code for the other way around. This makes it easier to understand
  which parts of ata(4) actually are used in the new world order and
  to later on remove the !ATA_CAM bits. It also makes it obvious that
  there is something fishy with the C-bus front-end as well as in the
  ATP850 support, as these used ATA_LOCKING which is defunct in the
  ATA_CAM case. When fixing the former, ATA_LOCKING probably needs to
  be brought back in some form or other.
  
  Reviewed by:	mav

Modified:
  stable/8/sys/dev/ata/ata-all.c
  stable/8/sys/dev/ata/ata-cbus.c
  stable/8/sys/dev/ata/ata-pci.c
  stable/8/sys/dev/ata/ata-pci.h
  stable/8/sys/dev/ata/ata-queue.c
  stable/8/sys/dev/ata/chipsets/ata-acard.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/boot/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/e1000/   (props changed)
  stable/8/sys/i386/conf/XENHVM   (props changed)

Modified: stable/8/sys/dev/ata/ata-all.c
==============================================================================
--- stable/8/sys/dev/ata/ata-all.c	Fri Mar 30 23:50:16 2012	(r233715)
+++ stable/8/sys/dev/ata/ata-all.c	Fri Mar 30 23:50:26 2012	(r233716)
@@ -78,9 +78,11 @@ static void ataaction(struct cam_sim *si
 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);
@@ -89,27 +91,36 @@ static void ata_periodic_poll(void *data
 /* 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 */
 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");
@@ -119,6 +130,7 @@ SYSCTL_INT(_hw_ata, OID_AUTO, wc, CTLFLA
 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
@@ -185,13 +197,13 @@ ata_attach(device_t dev)
 	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);
-#ifndef ATA_CAM
     ATA_RESET(dev);
-#endif
     ATA_LOCKING(dev, ATA_LF_UNLOCK);
+#endif
 
     /* allocate DMA resources if DMA HW present*/
     if (ch->dma.alloc)
@@ -605,6 +617,7 @@ 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)
 {
@@ -622,7 +635,9 @@ ata_check_80pin(device_t dev, int mode)
     }
     return mode;
 }
+#endif
 
+#ifndef ATA_CAM
 void
 ata_setmode(device_t dev)
 {
@@ -643,6 +658,7 @@ ata_setmode(device_t dev)
 		    (error) ? "FAILURE " : "", ata_mode2str(mode));
 	atadev->mode = mode;
 }
+#endif
 
 /*
  * device related interfaces
@@ -731,6 +747,7 @@ ata_ioctl(struct cdev *dev, u_long cmd, 
 }
 #endif
 
+#ifndef ATA_CAM
 int
 ata_device_ioctl(device_t dev, u_long cmd, caddr_t data)
 {
@@ -829,6 +846,7 @@ ata_device_ioctl(device_t dev, u_long cm
 	return ENOTTY;
     }
 }
+#endif
 
 #ifndef ATA_CAM
 static void
@@ -877,6 +895,7 @@ ata_add_child(device_t parent, struct at
 }
 #endif
 
+#ifndef ATA_CAM
 int
 ata_getparam(struct ata_device *atadev, int init)
 {
@@ -982,6 +1001,7 @@ ata_getparam(struct ata_device *atadev, 
     }
     return error;
 }
+#endif
 
 #ifndef ATA_CAM
 int
@@ -1187,6 +1207,7 @@ ata_udelay(int interval)
 	pause("ataslp", interval/(1000000/hz));
 }
 
+#ifndef ATA_CAM
 char *
 ata_unit2str(struct ata_device *atadev)
 {
@@ -1199,6 +1220,7 @@ ata_unit2str(struct ata_device *atadev)
 	sprintf(str, "%s", atadev->unit == ATA_MASTER ? "master" : "slave");
     return str;
 }
+#endif
 
 const char *
 ata_mode2str(int mode)
@@ -1259,6 +1281,7 @@ ata_str2mode(const char *str)
 	return (-1);
 }
 
+#ifndef ATA_CAM
 const char *
 ata_satarev2str(int rev)
 {
@@ -1271,6 +1294,7 @@ ata_satarev2str(int rev)
 	default: return "???";
 	}
 }
+#endif
 
 int
 ata_atapi(device_t dev, int target)
@@ -1280,6 +1304,7 @@ ata_atapi(device_t dev, int target)
     return (ch->devices & (ATA_ATAPI_MASTER << target));
 }
 
+#ifndef ATA_CAM
 int
 ata_pmode(struct ata_params *ap)
 {
@@ -1303,7 +1328,9 @@ ata_pmode(struct ata_params *ap)
 	return ATA_PIO0;
     return ATA_PIO0;
 }
+#endif
 
+#ifndef ATA_CAM
 int
 ata_wmode(struct ata_params *ap)
 {
@@ -1315,7 +1342,9 @@ ata_wmode(struct ata_params *ap)
 	return ATA_WDMA0;
     return -1;
 }
+#endif
 
+#ifndef ATA_CAM
 int
 ata_umode(struct ata_params *ap)
 {
@@ -1337,7 +1366,9 @@ ata_umode(struct ata_params *ap)
     }
     return -1;
 }
+#endif
 
+#ifndef ATA_CAM
 int
 ata_limit_mode(device_t dev, int mode, int maxmode)
 {
@@ -1357,7 +1388,9 @@ ata_limit_mode(device_t dev, int mode, i
 
     return mode;
 }
+#endif
 
+#ifndef ATA_CAM
 static void
 bswap(int8_t *buf, int len)
 {
@@ -1366,7 +1399,9 @@ bswap(int8_t *buf, int len)
     while (--ptr >= (u_int16_t*)buf)
 	*ptr = ntohs(*ptr);
 }
+#endif
 
+#ifndef ATA_CAM
 static void
 btrim(int8_t *buf, int len)
 {
@@ -1378,7 +1413,9 @@ btrim(int8_t *buf, int len)
     for (ptr = buf + len - 1; ptr >= buf && *ptr == ' '; --ptr)
 	*ptr = 0;
 }
+#endif
 
+#ifndef ATA_CAM
 static void
 bpack(int8_t *src, int8_t *dst, int len)
 {
@@ -1401,6 +1438,7 @@ bpack(int8_t *src, int8_t *dst, int len)
     if (j < len)
 	dst[j] = 0x00;
 }
+#endif
 
 #ifdef ATA_CAM
 void

Modified: stable/8/sys/dev/ata/ata-cbus.c
==============================================================================
--- stable/8/sys/dev/ata/ata-cbus.c	Fri Mar 30 23:50:16 2012	(r233715)
+++ stable/8/sys/dev/ata/ata-cbus.c	Fri Mar 30 23:50:26 2012	(r233716)
@@ -339,11 +339,14 @@ static int
 ata_cbuschannel_banking(device_t dev, int flags)
 {
     struct ata_cbus_controller *ctlr = device_get_softc(device_get_parent(dev));
+#ifndef ATA_CAM
     struct ata_channel *ch = device_get_softc(dev);
+#endif
     int res;
 
     mtx_lock(&ctlr->bank_mtx);
     switch (flags) {
+#ifndef ATA_CAM
     case ATA_LF_LOCK:
 	if (ctlr->locked_bank == -1)
 	    ctlr->locked_bank = ch->unit;
@@ -368,6 +371,7 @@ ata_cbuschannel_banking(device_t dev, in
 	    }
 	}
 	break;
+#endif
 
     case ATA_LF_WHICH:
 	break;
@@ -385,8 +389,10 @@ static device_method_t ata_cbuschannel_m
     DEVMETHOD(device_suspend,   ata_cbuschannel_suspend),
     DEVMETHOD(device_resume,    ata_cbuschannel_resume),
 
+#ifndef ATA_CAM
     /* ATA methods */
     DEVMETHOD(ata_locking,      ata_cbuschannel_banking),
+#endif
     { 0, 0 }
 };
 

Modified: stable/8/sys/dev/ata/ata-pci.c
==============================================================================
--- stable/8/sys/dev/ata/ata-pci.c	Fri Mar 30 23:50:16 2012	(r233715)
+++ stable/8/sys/dev/ata/ata-pci.c	Fri Mar 30 23:50:26 2012	(r233716)
@@ -704,6 +704,7 @@ ata_pcichannel_resume(device_t dev)
 }
 
 
+#ifndef ATA_CAM
 static int
 ata_pcichannel_locking(device_t dev, int mode)
 {
@@ -715,6 +716,7 @@ ata_pcichannel_locking(device_t dev, int
     else
 	return ch->unit;
 }
+#endif
 
 static void
 ata_pcichannel_reset(device_t dev)
@@ -771,7 +773,9 @@ static device_method_t ata_pcichannel_me
     /* ATA methods */
     DEVMETHOD(ata_setmode,      ata_pcichannel_setmode),
     DEVMETHOD(ata_getrev,       ata_pcichannel_getrev),
+#ifndef ATA_CAM
     DEVMETHOD(ata_locking,      ata_pcichannel_locking),
+#endif
     DEVMETHOD(ata_reset,        ata_pcichannel_reset),
 
     { 0, 0 }

Modified: stable/8/sys/dev/ata/ata-pci.h
==============================================================================
--- stable/8/sys/dev/ata/ata-pci.h	Fri Mar 30 23:50:16 2012	(r233715)
+++ stable/8/sys/dev/ata/ata-pci.h	Fri Mar 30 23:50:26 2012	(r233716)
@@ -62,7 +62,9 @@ struct ata_pci_controller {
     int                 (*ch_detach)(device_t);
     int                 (*ch_suspend)(device_t);
     int                 (*ch_resume)(device_t);
+#ifndef ATA_CAM
     int                 (*locking)(device_t, int);
+#endif
     void                (*reset)(device_t);
     int                 (*setmode)(device_t, int, int);
     int                 (*getrev)(device_t, int);

Modified: stable/8/sys/dev/ata/ata-queue.c
==============================================================================
--- stable/8/sys/dev/ata/ata-queue.c	Fri Mar 30 23:50:16 2012	(r233715)
+++ stable/8/sys/dev/ata/ata-queue.c	Fri Mar 30 23:50:26 2012	(r233716)
@@ -43,11 +43,14 @@ __FBSDID("$FreeBSD$");
 #include <dev/ata/ata-all.h>
 #include <ata_if.h>
 
+#ifndef ATA_CAM
 /* prototypes */
 static void ata_completed(void *, int);
 static void ata_sort_queue(struct ata_channel *ch, struct ata_request *request);
-static char *ata_skey2str(u_int8_t);
+static const char *ata_skey2str(u_int8_t);
+#endif
 
+#ifndef ATA_CAM
 void
 ata_queue_request(struct ata_request *request)
 {
@@ -123,7 +126,9 @@ ata_queue_request(struct ata_request *re
 	sema_destroy(&request->done);
     }
 }
+#endif
 
+#ifndef ATA_CAM
 int
 ata_controlcmd(device_t dev, u_int8_t command, u_int16_t feature,
 	       u_int64_t lba, u_int16_t count)
@@ -153,7 +158,9 @@ ata_controlcmd(device_t dev, u_int8_t co
     }
     return error;
 }
+#endif
 
+#ifndef ATA_CAM
 int
 ata_atapicmd(device_t dev, u_int8_t *ccb, caddr_t data,
 	     int count, int flags, int timeout)
@@ -176,7 +183,9 @@ ata_atapicmd(device_t dev, u_int8_t *ccb
     }
     return error;
 }
+#endif
 
+#ifndef ATA_CAM
 void
 ata_start(device_t dev)
 {
@@ -235,7 +244,9 @@ ata_start(device_t dev)
 	}
     }
 }
+#endif
 
+#ifndef ATA_CAM
 void
 ata_finish(struct ata_request *request)
 {
@@ -263,7 +274,9 @@ ata_finish(struct ata_request *request)
 	}
     }
 }
+#endif
 
+#ifndef ATA_CAM
 static void
 ata_completed(void *context, int dummy)
 {
@@ -495,6 +508,7 @@ ata_completed(void *context, int dummy)
     if (ch)
 	ata_start(ch->dev);
 }
+#endif
 
 void
 ata_timeout(struct ata_request *request)
@@ -520,8 +534,8 @@ ata_timeout(struct ata_request *request)
 	ata_cam_end_transaction(ch->dev, request);
 #endif
 	mtx_unlock(&ch->state_mtx);
-	ATA_LOCKING(ch->dev, ATA_LF_UNLOCK);
 #ifndef ATA_CAM
+	ATA_LOCKING(ch->dev, ATA_LF_UNLOCK);
 	ata_finish(request);
 #endif
     }
@@ -530,6 +544,7 @@ ata_timeout(struct ata_request *request)
     }
 }
 
+#ifndef ATA_CAM
 void
 ata_fail_requests(device_t dev)
 {
@@ -568,7 +583,9 @@ ata_fail_requests(device_t dev)
         ata_finish(request);
     }
 }
+#endif
 
+#ifndef ATA_CAM
 /*
  * Rudely drop all requests queued to the channel of specified device.
  * XXX: The requests are leaked, use only in fatal case.
@@ -586,7 +603,9 @@ ata_drop_requests(device_t dev)
     }
     mtx_unlock(&ch->queue_mtx);
 }
+#endif
 
+#ifndef ATA_CAM
 static u_int64_t
 ata_get_lba(struct ata_request *request)
 {
@@ -608,7 +627,9 @@ ata_get_lba(struct ata_request *request)
     else
 	return request->u.ata.lba;
 }
+#endif
 
+#ifndef ATA_CAM
 static void
 ata_sort_queue(struct ata_channel *ch, struct ata_request *request)
 {
@@ -661,6 +682,7 @@ ata_sort_queue(struct ata_channel *ch, s
 	ch->freezepoint = request;
     TAILQ_INSERT_AFTER(&ch->ata_queue, this, request, chain);
 }
+#endif
 
 char *
 ata_cmd2str(struct ata_request *request)
@@ -776,7 +798,8 @@ ata_cmd2str(struct ata_request *request)
     return buffer;
 }
 
-static char *
+#ifndef ATA_CAM
+static const char *
 ata_skey2str(u_int8_t skey)
 {
     switch (skey) {
@@ -799,3 +822,4 @@ ata_skey2str(u_int8_t skey)
     default: return("UNKNOWN");
     }
 }
+#endif

Modified: stable/8/sys/dev/ata/chipsets/ata-acard.c
==============================================================================
--- stable/8/sys/dev/ata/chipsets/ata-acard.c	Fri Mar 30 23:50:16 2012	(r233715)
+++ stable/8/sys/dev/ata/chipsets/ata-acard.c	Fri Mar 30 23:50:26 2012	(r233716)
@@ -51,26 +51,29 @@ __FBSDID("$FreeBSD$");
 #include <dev/ata/ata-pci.h>
 #include <ata_if.h>
 
+#ifndef ATA_CAM
 struct ata_serialize {
     struct mtx  locked_mtx;
     int         locked_ch;
     int         restart_ch;
 };
+#endif
 
 /* local prototypes */
 static int ata_acard_chipinit(device_t dev);
-static int ata_acard_chipdeinit(device_t dev);
 static int ata_acard_ch_attach(device_t dev);
 static int ata_acard_status(device_t dev);
 static int ata_acard_850_setmode(device_t dev, int target, int mode);
 static int ata_acard_86X_setmode(device_t dev, int target, int mode);
+#ifndef ATA_CAM
+static int ata_acard_chipdeinit(device_t dev);
 static int ata_serialize(device_t dev, int flags);
 static void ata_serialize_init(struct ata_serialize *serial);
+#endif
 
 /* misc defines */
 #define ATP_OLD		1
 
-
 /*
  * Acard chipset support functions
  */
@@ -94,7 +97,9 @@ ata_acard_probe(device_t dev)
 
     ata_set_desc(dev);
     ctlr->chipinit = ata_acard_chipinit;
+#ifndef ATA_CAM
     ctlr->chipdeinit = ata_acard_chipdeinit;
+#endif
     return (BUS_PROBE_DEFAULT);
 }
 
@@ -102,7 +107,9 @@ static int
 ata_acard_chipinit(device_t dev)
 {
     struct ata_pci_controller *ctlr = device_get_softc(dev);
+#ifndef ATA_CAM
     struct ata_serialize *serial;
+#endif
 
     if (ata_setup_interrupt(dev, ata_generic_intr))
 	return ENXIO;
@@ -111,17 +118,20 @@ ata_acard_chipinit(device_t dev)
     ctlr->ch_detach = ata_pci_ch_detach;
     if (ctlr->chip->cfg1 == ATP_OLD) {
 	ctlr->setmode = ata_acard_850_setmode;
+#ifndef ATA_CAM
 	ctlr->locking = ata_serialize;
 	serial = malloc(sizeof(struct ata_serialize),
 			      M_ATAPCI, M_WAITOK | M_ZERO);
 	ata_serialize_init(serial);
 	ctlr->chipset_data = serial;
+#endif
     }
     else
 	ctlr->setmode = ata_acard_86X_setmode;
     return 0;
 }
 
+#ifndef ATA_CAM
 static int
 ata_acard_chipdeinit(device_t dev)
 {
@@ -136,6 +146,7 @@ ata_acard_chipdeinit(device_t dev)
 	}
 	return (0);
 }
+#endif
 
 static int
 ata_acard_ch_attach(device_t dev)
@@ -228,6 +239,7 @@ ata_acard_86X_setmode(device_t dev, int 
 	return (mode);
 }
 
+#ifndef ATA_CAM
 static void
 ata_serialize_init(struct ata_serialize *serial)
 {
@@ -277,5 +289,6 @@ ata_serialize(device_t dev, int flags)
     mtx_unlock(&serial->locked_mtx);
     return res;
 }
+#endif
 
 ATA_DECLARE_DRIVER(ata_acard);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201203302350.q2UNoQqt063656>