Date: Fri, 30 Mar 2012 23:50:16 +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-9@freebsd.org Subject: svn commit: r233715 - in stable/9/sys: dev/ata dev/ata/chipsets i386/conf Message-ID: <201203302350.q2UNoGgW063609@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: marius Date: Fri Mar 30 23:50:16 2012 New Revision: 233715 URL: http://svn.freebsd.org/changeset/base/233715 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/9/sys/dev/ata/ata-all.c stable/9/sys/dev/ata/ata-cbus.c stable/9/sys/dev/ata/ata-pci.c stable/9/sys/dev/ata/ata-pci.h stable/9/sys/dev/ata/ata-queue.c stable/9/sys/dev/ata/chipsets/ata-acard.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) stable/9/sys/fs/ (props changed) stable/9/sys/fs/ntfs/ (props changed) stable/9/sys/i386/conf/XENHVM (props changed) Modified: stable/9/sys/dev/ata/ata-all.c ============================================================================== --- stable/9/sys/dev/ata/ata-all.c Fri Mar 30 23:48:15 2012 (r233714) +++ stable/9/sys/dev/ata/ata-all.c Fri Mar 30 23:50:16 2012 (r233715) @@ -79,9 +79,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); @@ -90,27 +92,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"); @@ -120,6 +131,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 @@ -186,13 +198,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) @@ -606,6 +618,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) { @@ -623,7 +636,9 @@ ata_check_80pin(device_t dev, int mode) } return mode; } +#endif +#ifndef ATA_CAM void ata_setmode(device_t dev) { @@ -644,6 +659,7 @@ ata_setmode(device_t dev) (error) ? "FAILURE " : "", ata_mode2str(mode)); atadev->mode = mode; } +#endif /* * device related interfaces @@ -732,6 +748,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) { @@ -830,6 +847,7 @@ ata_device_ioctl(device_t dev, u_long cm return ENOTTY; } } +#endif #ifndef ATA_CAM static void @@ -878,6 +896,7 @@ ata_add_child(device_t parent, struct at } #endif +#ifndef ATA_CAM int ata_getparam(struct ata_device *atadev, int init) { @@ -983,6 +1002,7 @@ ata_getparam(struct ata_device *atadev, } return error; } +#endif #ifndef ATA_CAM int @@ -1188,6 +1208,7 @@ ata_udelay(int interval) pause("ataslp", interval/(1000000/hz)); } +#ifndef ATA_CAM char * ata_unit2str(struct ata_device *atadev) { @@ -1200,6 +1221,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) @@ -1260,6 +1282,7 @@ ata_str2mode(const char *str) return (-1); } +#ifndef ATA_CAM const char * ata_satarev2str(int rev) { @@ -1272,6 +1295,7 @@ ata_satarev2str(int rev) default: return "???"; } } +#endif int ata_atapi(device_t dev, int target) @@ -1281,6 +1305,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) { @@ -1304,7 +1329,9 @@ ata_pmode(struct ata_params *ap) return ATA_PIO0; return ATA_PIO0; } +#endif +#ifndef ATA_CAM int ata_wmode(struct ata_params *ap) { @@ -1316,7 +1343,9 @@ ata_wmode(struct ata_params *ap) return ATA_WDMA0; return -1; } +#endif +#ifndef ATA_CAM int ata_umode(struct ata_params *ap) { @@ -1338,7 +1367,9 @@ ata_umode(struct ata_params *ap) } return -1; } +#endif +#ifndef ATA_CAM int ata_limit_mode(device_t dev, int mode, int maxmode) { @@ -1358,7 +1389,9 @@ ata_limit_mode(device_t dev, int mode, i return mode; } +#endif +#ifndef ATA_CAM static void bswap(int8_t *buf, int len) { @@ -1367,7 +1400,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) { @@ -1379,7 +1414,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) { @@ -1402,6 +1439,7 @@ bpack(int8_t *src, int8_t *dst, int len) if (j < len) dst[j] = 0x00; } +#endif #ifdef ATA_CAM void Modified: stable/9/sys/dev/ata/ata-cbus.c ============================================================================== --- stable/9/sys/dev/ata/ata-cbus.c Fri Mar 30 23:48:15 2012 (r233714) +++ stable/9/sys/dev/ata/ata-cbus.c Fri Mar 30 23:50:16 2012 (r233715) @@ -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/9/sys/dev/ata/ata-pci.c ============================================================================== --- stable/9/sys/dev/ata/ata-pci.c Fri Mar 30 23:48:15 2012 (r233714) +++ stable/9/sys/dev/ata/ata-pci.c Fri Mar 30 23:50:16 2012 (r233715) @@ -699,6 +699,7 @@ ata_pcichannel_resume(device_t dev) } +#ifndef ATA_CAM static int ata_pcichannel_locking(device_t dev, int mode) { @@ -710,6 +711,7 @@ ata_pcichannel_locking(device_t dev, int else return ch->unit; } +#endif static void ata_pcichannel_reset(device_t dev) @@ -766,7 +768,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/9/sys/dev/ata/ata-pci.h ============================================================================== --- stable/9/sys/dev/ata/ata-pci.h Fri Mar 30 23:48:15 2012 (r233714) +++ stable/9/sys/dev/ata/ata-pci.h Fri Mar 30 23:50:16 2012 (r233715) @@ -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/9/sys/dev/ata/ata-queue.c ============================================================================== --- stable/9/sys/dev/ata/ata-queue.c Fri Mar 30 23:48:15 2012 (r233714) +++ stable/9/sys/dev/ata/ata-queue.c Fri Mar 30 23:50:16 2012 (r233715) @@ -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/9/sys/dev/ata/chipsets/ata-acard.c ============================================================================== --- stable/9/sys/dev/ata/chipsets/ata-acard.c Fri Mar 30 23:48:15 2012 (r233714) +++ stable/9/sys/dev/ata/chipsets/ata-acard.c Fri Mar 30 23:50:16 2012 (r233715) @@ -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.q2UNoGgW063609>