diff options
-rw-r--r-- | sys/conf/NOTES | 1 | ||||
-rw-r--r-- | sys/conf/files | 2 | ||||
-rw-r--r-- | sys/dev/amr/amr.c | 31 | ||||
-rw-r--r-- | sys/dev/amr/amr_cam.c | 51 | ||||
-rw-r--r-- | sys/dev/amr/amrvar.h | 9 | ||||
-rw-r--r-- | sys/i386/conf/XEN | 71 | ||||
-rw-r--r-- | sys/modules/amr/Makefile | 5 |
7 files changed, 65 insertions, 105 deletions
diff --git a/sys/conf/NOTES b/sys/conf/NOTES index 4a7ddbe..4880f3c 100644 --- a/sys/conf/NOTES +++ b/sys/conf/NOTES @@ -1579,6 +1579,7 @@ device mly device ida # Compaq Smart RAID device mlx # Mylex DAC960 device amr # AMI MegaRAID +device amrp # SCSI Passthrough interface (optional, CAM req.) device mfi # LSI MegaRAID SAS device mfip # LSI MegaRAID SAS passthrough, requires CAM options MFI_DEBUG diff --git a/sys/conf/files b/sys/conf/files index 0374f09..073f737 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -450,7 +450,7 @@ dev/aic7xxx/aic7xxx_osm.c optional ahc dev/aic7xxx/aic7xxx_pci.c optional ahc pci dev/amd/amd.c optional amd dev/amr/amr.c optional amr -dev/amr/amr_cam.c optional amr +dev/amr/amr_cam.c optional amrp amr dev/amr/amr_disk.c optional amr dev/amr/amr_linux.c optional amr compat_linux dev/amr/amr_pci.c optional amr pci diff --git a/sys/dev/amr/amr.c b/sys/dev/amr/amr.c index 192f128..6b75ebb 100644 --- a/sys/dev/amr/amr.c +++ b/sys/dev/amr/amr.c @@ -88,13 +88,6 @@ __FBSDID("$FreeBSD$"); #define AMR_DEFINE_TABLES #include <dev/amr/amr_tables.h> -/* - * The CAM interface appears to be completely broken. Disable it. - */ -#ifndef AMR_ENABLE_CAM -#define AMR_ENABLE_CAM 1 -#endif - SYSCTL_NODE(_hw, OID_AUTO, amr, CTLFLAG_RD, 0, "AMR driver parameters"); static d_open_t amr_open; @@ -202,6 +195,7 @@ MALLOC_DEFINE(M_AMR, "amr", "AMR memory"); int amr_attach(struct amr_softc *sc) { + device_t child; debug_called(1); @@ -259,14 +253,16 @@ amr_attach(struct amr_softc *sc) */ amr_init_sysctl(sc); -#if AMR_ENABLE_CAM != 0 /* * Attach our 'real' SCSI channels to CAM. */ - if (amr_cam_attach(sc)) - return(ENXIO); - debug(2, "CAM attach done"); -#endif + child = device_add_child(sc->amr_dev, "amrp", -1); + sc->amr_pass = child; + if (child != NULL) { + device_set_softc(child, sc); + device_set_desc(child, "SCSI Passthrough Bus"); + bus_generic_attach(sc->amr_dev); + } /* * Create the control device. @@ -391,10 +387,9 @@ amr_free(struct amr_softc *sc) { struct amr_command_cluster *acc; -#if AMR_ENABLE_CAM != 0 /* detach from CAM */ - amr_cam_detach(sc); -#endif + if (sc->amr_pass != NULL) + device_delete_child(sc->amr_dev, sc->amr_pass); /* cancel status timeout */ untimeout(amr_periodic, sc, sc->amr_timeout); @@ -1240,11 +1235,9 @@ amr_startio(struct amr_softc *sc) if (ac == NULL) (void)amr_bio_command(sc, &ac); -#if AMR_ENABLE_CAM != 0 /* if that failed, build a command from a ccb */ - if (ac == NULL) - (void)amr_cam_command(sc, &ac); -#endif + if ((ac == NULL) && (sc->amr_cam_command != NULL)) + sc->amr_cam_command(sc, &ac); /* if we don't have anything to do, give up */ if (ac == NULL) diff --git a/sys/dev/amr/amr_cam.c b/sys/dev/amr/amr_cam.c index 65913d1..bcd036e 100644 --- a/sys/dev/amr/amr_cam.c +++ b/sys/dev/amr/amr_cam.c @@ -61,6 +61,7 @@ __FBSDID("$FreeBSD$"); #include <sys/systm.h> #include <sys/malloc.h> #include <sys/kernel.h> +#include <sys/module.h> #include <sys/bio.h> #include <sys/bus.h> @@ -82,9 +83,31 @@ __FBSDID("$FreeBSD$"); #include <dev/amr/amrreg.h> #include <dev/amr/amrvar.h> +static int amr_cam_probe(device_t dev); +static int amr_cam_attach(device_t dev); +static int amr_cam_detach(device_t dev); static void amr_cam_action(struct cam_sim *sim, union ccb *ccb); static void amr_cam_poll(struct cam_sim *sim); static void amr_cam_complete(struct amr_command *ac); +static int amr_cam_command(struct amr_softc *sc, struct amr_command **acp); + +static devclass_t amr_pass_devclass; + +static device_method_t amr_pass_methods[] = { + DEVMETHOD(device_probe, amr_cam_probe), + DEVMETHOD(device_attach, amr_cam_attach), + DEVMETHOD(device_detach, amr_cam_detach), + { 0, 0 } +}; + +static driver_t amr_pass_driver = { + "amrp", + amr_pass_methods, + 0 +}; + +DRIVER_MODULE(amrp, amr, amr_pass_driver, amr_pass_devclass, 0, 0); +MODULE_DEPEND(amrp, cam, 1, 1, 1); MALLOC_DEFINE(M_AMRCAM, "amrcam", "AMR CAM memory"); @@ -115,14 +138,23 @@ amr_dequeue_ccb(struct amr_softc *sc) return(ccb); } +static int +amr_cam_probe(device_t dev) +{ + return (0); +} + /******************************************************************************** * Attach our 'real' SCSI channels to CAM */ -int -amr_cam_attach(struct amr_softc *sc) +static int +amr_cam_attach(device_t dev) { + struct amr_softc *sc; struct cam_devq *devq; - int chn, error; + int chn, error; + + sc = device_get_softc(dev); /* initialise the ccb queue */ TAILQ_INIT(&sc->amr_cam_ccbq); @@ -134,7 +166,7 @@ amr_cam_attach(struct amr_softc *sc) * during detach. */ if ((devq = cam_simq_alloc(AMR_MAX_SCSI_CMDS)) == NULL) - return(ENOMEM); + return(ENOMEM); sc->amr_cam_devq = devq; /* @@ -165,17 +197,20 @@ amr_cam_attach(struct amr_softc *sc) * XXX we should scan the config and work out which devices are * actually protected. */ + sc->amr_cam_command = amr_cam_command; return(0); } /******************************************************************************** * Disconnect ourselves from CAM */ -void -amr_cam_detach(struct amr_softc *sc) +static int +amr_cam_detach(device_t dev) { + struct amr_softc *sc; int chn; + sc = device_get_softc(dev); mtx_lock(&sc->amr_list_lock); for (chn = 0; chn < sc->amr_maxchan; chn++) { /* @@ -191,6 +226,8 @@ amr_cam_detach(struct amr_softc *sc) /* Now free the devq */ if (sc->amr_cam_devq != NULL) cam_simq_free(sc->amr_cam_devq); + + return (0); } /*********************************************************************** @@ -379,7 +416,7 @@ amr_cam_action(struct cam_sim *sim, union ccb *ccb) * Convert a CAM CCB off the top of the CCB queue to a passthrough SCSI * command. */ -int +static int amr_cam_command(struct amr_softc *sc, struct amr_command **acp) { struct amr_command *ac; diff --git a/sys/dev/amr/amrvar.h b/sys/dev/amr/amrvar.h index e208c53..7dc0fb4 100644 --- a/sys/dev/amr/amrvar.h +++ b/sys/dev/amr/amrvar.h @@ -253,6 +253,8 @@ struct amr_softc int support_ext_cdb; /* greater than 10 byte cdb support */ /* misc glue */ + device_t amr_pass; + int (*amr_cam_command)(struct amr_softc *sc, struct amr_command **acp); struct intr_config_hook amr_ich; /* wait-for-interrupts probe hook */ struct callout_handle amr_timeout; /* periodic status check */ int amr_allow_vol_config; @@ -277,13 +279,6 @@ extern struct amr_command *amr_alloccmd(struct amr_softc *sc); extern void amr_releasecmd(struct amr_command *ac); /* - * CAM interface - */ -extern int amr_cam_attach(struct amr_softc *sc); -extern void amr_cam_detach(struct amr_softc *sc); -extern int amr_cam_command(struct amr_softc *sc, struct amr_command **acp); - -/* * MegaRAID logical disk driver */ struct amrd_softc diff --git a/sys/i386/conf/XEN b/sys/i386/conf/XEN index 328a214..5f35a96 100644 --- a/sys/i386/conf/XEN +++ b/sys/i386/conf/XEN @@ -1,28 +1,10 @@ # -# GENERIC -- Generic kernel configuration file for FreeBSD/i386 -# -# For more information on this file, please read the handbook section on -# Kernel Configuration Files: -# -# http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html -# -# The handbook is also available locally in /usr/share/doc/handbook -# if you've installed the doc distribution, otherwise always see the -# FreeBSD World Wide Web server (http://www.FreeBSD.org/) for the -# latest information. -# -# An exhaustive list of options and more detailed explanations of the -# device lines is also present in the ../../conf/NOTES and NOTES files. -# If you are in doubt as to the purpose or necessity of a line, check first -# in NOTES. +# XEN -- Kernel configuration for i386 XEN DomU # # $FreeBSD$ cpu I686_CPU -ident GENERIC - -# To statically compile in device wiring instead of /boot/device.hints -#hints "GENERIC.hints" # Default places to look for devices. +ident XEN makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols makeoptions MODULES_OVERRIDE="" @@ -39,7 +21,6 @@ options SOFTUPDATES # Enable FFS soft updates support options UFS_ACL # Support for access control lists options UFS_DIRHASH # Improve performance on big directories options UFS_GJOURNAL # Enable gjournal-based UFS journaling -options MD_ROOT # MD is a potential root device options NFSCLIENT # Network Filesystem Client options NFSSERVER # Network Filesystem Server options NFSLOCKD # Network Lock Manager @@ -55,7 +36,6 @@ options COMPAT_FREEBSD4 # Compatible with FreeBSD4 options COMPAT_FREEBSD5 # Compatible with FreeBSD5 options COMPAT_FREEBSD6 # Compatible with FreeBSD6 options COMPAT_FREEBSD7 # Compatible with FreeBSD7 -options SCSI_DELAY=5000 # Delay (in ms) before probing SCSI options KTRACE # ktrace(1) support options STACK # stack(9) support options SYSVSHM # SYSV-style shared memory @@ -63,7 +43,6 @@ options SYSVMSG # SYSV-style message queues options SYSVSEM # SYSV-style semaphores options _KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time extensions options KBD_INSTALL_CDEV # install a CDEV entry in /dev -options HWPMC_HOOKS # Necessary kernel hooks for hwpmc(4) options AUDIT # Security event auditing # Debugging for use in -current @@ -86,53 +65,8 @@ options MCLSHIFT=12 options SMP # Symmetric MultiProcessor Kernel device apic # I/O APIC -# CPU frequency control -#device cpufreq - -# atkbdc0 controls both the keyboard and the PS/2 mouse -device atkbdc # AT keyboard controller -device atkbd # AT keyboard -device psm # PS/2 mouse - device kbdmux # keyboard multiplexer -#device vga # VGA video card driver - -device splash # Splash screen and screen saver support - -# syscons is the default console driver, resembling an SCO console -#device sc - -# Power management support (see NOTES for more options) -#device apm -# Add suspend/resume support for the i8254. -device pmtimer - - -device pci - -# PCCARD (PCMCIA) support -# PCMCIA and cardbus bridge support -#device cbb # cardbus (yenta) bridge -#device pccard # PC Card (16-bit) bus -#device cardbus # CardBus (32-bit) bus - -# Serial (COM) ports -device uart # Generic UART driver - -# Parallel port -device ppc -device ppbus # Parallel port bus (required) -device lpt # Printer -device plip # TCP/IP over parallel -device ppi # Parallel port interface device -#device vpo # Requires scbus and da - -# If you've got a "dumb" serial or parallel PCI card that is -# supported by the puc(4) glue driver, uncomment the following -# line to enable it (connects to sio, uart and/or ppc drivers): -#device puc - # Pseudo devices. device loop # Network loopback device random # Entropy device @@ -142,7 +76,6 @@ device pty # Pseudo-ttys (telnet etc) device md # Memory "disks" device gif # IPv6 and IPv4 tunneling device faith # IPv6-to-IPv4 relaying (translation) -device firmware # firmware assist module # The `bpf' device enables the Berkeley Packet Filter. # Be aware of the administrative consequences of enabling this! diff --git a/sys/modules/amr/Makefile b/sys/modules/amr/Makefile index 107a099..c6b3d03 100644 --- a/sys/modules/amr/Makefile +++ b/sys/modules/amr/Makefile @@ -2,15 +2,16 @@ .PATH: ${.CURDIR}/../../dev/amr +SUBDIR= amr_cam .if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "amd64" -SUBDIR= amr_linux +SUBDIR+= amr_linux .endif KMOD= amr SRCS= amr.c amr_pci.c amr_disk.c device_if.h bus_if.h pci_if.h # SCSI passthrough support for non-disk devices -SRCS+= amr_cam.c opt_cam.h opt_scsi.h +#SRCS+= amr_cam.c opt_cam.h opt_scsi.h # Enable a questionable optimisation for newer adapters #CFLAGS+= -DAMR_QUARTZ_GOFASTER |