Index: head/rescue/rescue/Makefile =================================================================== --- head/rescue/rescue/Makefile (revision 249082) +++ head/rescue/rescue/Makefile (revision 249083) @@ -1,216 +1,216 @@ #$FreeBSD$ # @(#)Makefile 8.1 (Berkeley) 6/2/93 NO_MAN= .include MK_SSP= no PROG= rescue BINDIR?=/rescue # Shell scripts need #! line to be edited from /bin/sh to /rescue/sh SCRIPTS= nextboot_FIXED SCRIPTSNAME_nextboot_FIXED= nextboot nextboot_FIXED: ../../sbin/reboot/nextboot.sh sed '1s/\/bin\//\/rescue\//' ${.ALLSRC} > ${.TARGET} CLEANFILES+= nextboot_FIXED SCRIPTS+= dhclient_FIXED SCRIPTSNAME_dhclient_FIXED= dhclient-script dhclient_FIXED: ../../sbin/dhclient/dhclient-script sed '1s/\/bin\//\/rescue\//' ${.ALLSRC} > ${.TARGET} CLEANFILES+= dhclient_FIXED # The help which used to be here is now in mk/bsd.crunchgen.mk # Define Makefile variable RESCUE CRUNCH_BUILDOPTS+= -DRESCUE # Define compile-time RESCUE symbol when compiling components CRUNCH_BUILDOPTS+= CRUNCH_CFLAGS=-DRESCUE # An experiment that failed: try overriding bsd.lib.mk and bsd.prog.mk # rather than incorporating rescue-specific logic into standard files. #MAKEFLAGS= -m ${.CURDIR} ${.MAKEFLAGS} # Hackery: 'librescue' exists merely as a tool for appropriately # recompiling specific library entries. We _know_ they're needed, and # regular archive searching creates ugly library ordering problems. # Easiest fix: tell the linker to include them into the executable # first, so they are guaranteed to override the regular lib entries. # Note that if 'librescue' hasn't been compiled, we'll just get the # regular lib entries from libc and friends. CRUNCH_LIBS+= ${.OBJDIR}/../librescue/*.o ################################################################### # Programs from stock /bin # # WARNING: Changing this list may require adjusting # /usr/include/paths.h as well! You were warned! # CRUNCH_SRCDIRS+= bin CRUNCH_PROGS_bin= cat chflags chio chmod cp date dd df echo \ ed expr getfacl hostname kenv kill ln ls mkdir mv \ pkill ps pwd realpath rm rmdir setfacl sh stty sync test CRUNCH_LIBS+= -lcrypt -ledit -lkvm -ll -ltermcap -lutil CRUNCH_BUILDTOOLS+= bin/sh # Additional options for specific programs CRUNCH_ALIAS_test= [ CRUNCH_ALIAS_sh= -sh # The -sh alias shouldn't appear in /rescue as a hard link CRUNCH_SUPPRESS_LINK_-sh= 1 CRUNCH_ALIAS_ln= link CRUNCH_ALIAS_rm= unlink CRUNCH_ALIAS_ed= red CRUNCH_ALIAS_pkill= pgrep .if ${MK_RCMDS} != "no" CRUNCH_PROGS_bin+= rcp .endif .if ${MK_TCSH} != "no" CRUNCH_PROGS_bin+= csh CRUNCH_ALIAS_csh= -csh tcsh -tcsh CRUNCH_BUILDTOOLS+= bin/csh CRUNCH_SUPPRESS_LINK_-csh= 1 CRUNCH_SUPPRESS_LINK_-tcsh= 1 .endif ################################################################### # Programs from standard /sbin # # WARNING: Changing this list may require adjusting # /usr/include/paths.h as well! You were warned! # # Note that mdmfs have their own private 'pathnames.h' # 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 \ kldconfig kldload kldstat kldunload ldconfig \ md5 mdconfig mdmfs mknod mount mount_cd9660 \ mount_msdosfs mount_nfs mount_nullfs \ mount_udf mount_unionfs newfs \ newfs_msdos nos-tun ping reboot \ restore rcorder route routed rtquery rtsol savecore \ spppcontrol swapon sysctl tunefs umount .if ${MK_ATM} != "no" CRUNCH_PROGS_sbin+= atmconfig .endif .if ${MK_INET6_SUPPORT} != "no" CRUNCH_PROGS_sbin+= ping6 .endif .if ${MK_IPFILTER} != "no" CRUNCH_PROGS_sbin+= ipf .endif .if ${MK_ZFS} != "no" CRUNCH_PROGS_sbin+= zfs CRUNCH_PROGS_sbin+= zpool .endif # crunchgen does not like C++ programs; this should be fixed someday # CRUNCH_PROGS+= devd CRUNCH_LIBS+= -lalias -lcam -lcurses -ldevstat -lipsec .if ${MK_IPX} != "no" CRUNCH_LIBS+= -lipx .endif .if ${MK_ZFS} != "no" CRUNCH_LIBS+= -lavl -ljail -lzfs_core -lzfs -lnvpair -lpthread -luutil -lumem .endif CRUNCH_LIBS+= -lgeom -lbsdxml -lkiconv -lmd -lsbuf -lufs -lz .if ${MACHINE_CPUARCH} == "i386" CRUNCH_PROGS_sbin+= bsdlabel sconfig fdisk CRUNCH_ALIAS_bsdlabel= disklabel .endif .if ${MACHINE} == "pc98" CRUNCH_PROGS_sbin+= bsdlabel CRUNCH_SRCDIR_fdisk= $(.CURDIR)/../../sbin/fdisk_pc98 .endif .if ${MACHINE_CPUARCH} == "ia64" CRUNCH_PROGS_sbin+= mca .endif .if ${MACHINE_CPUARCH} == "sparc64" CRUNCH_PROGS_sbin+= bsdlabel sunlabel .endif .if ${MACHINE_CPUARCH} == "amd64" CRUNCH_PROGS_sbin+= bsdlabel fdisk CRUNCH_ALIAS_bsdlabel= disklabel .endif CRUNCH_SRCDIR_atm= $(.CURDIR)/../../sbin/atm/atm CRUNCH_SRCDIR_atmconfig= $(.CURDIR)/../../sbin/atm/atmconfig CRUNCH_SRCDIR_fore_dnld= $(.CURDIR)/../../sbin/atm/fore_dnld CRUNCH_SRCDIR_ilmid= $(.CURDIR)/../../sbin/atm/ilmid CRUNCH_SRCDIR_rtquery= $(.CURDIR)/../../sbin/routed/rtquery CRUNCH_SRCDIR_ipf= $(.CURDIR)/../../sbin/ipf/ipf .if ${MK_ZFS} != "no" CRUNCH_SRCDIR_zfs= ${.CURDIR}/../../cddl/sbin/zfs CRUNCH_SRCDIR_zpool= ${.CURDIR}/../../cddl/sbin/zpool .endif CRUNCH_ALIAS_reboot= fastboot halt fasthalt CRUNCH_ALIAS_restore= rrestore CRUNCH_ALIAS_dump= rdump CRUNCH_ALIAS_fsck_ffs= fsck_4.2bsd fsck_ufs CRUNCH_ALIAS_geom= glabel gpart # dhclient has historically been troublesome... CRUNCH_PROGS_sbin+= dhclient CRUNCH_BUILDOPTS_dhclient= -DRELEASE_CRUNCH -Dlint ################################################################## # Programs from stock /usr/bin # CRUNCH_SRCDIRS+= usr.bin CRUNCH_PROGS_usr.bin= head mt nc sed tail tee CRUNCH_PROGS_usr.bin+= gzip CRUNCH_ALIAS_gzip= gunzip gzcat zcat CRUNCH_PROGS_usr.bin+= bzip2 CRUNCH_ALIAS_bzip2= bunzip2 bzcat CRUNCH_LIBS+= -lbz2 CRUNCH_PROGS_usr.bin+= xz CRUNCH_ALIAS_xz= unxz lzma unlzma xzcat lzcat CRUNCH_LIBS+= -llzma CRUNCH_PROGS_usr.bin+= tar CRUNCH_LIBS+= -larchive -lmd .if ${MK_OPENSSL} != "no" CRUNCH_LIBS+= -lcrypto .endif CRUNCH_PROGS_usr.bin+= vi CRUNCH_ALIAS_vi= ex CRUNCH_PROGS_usr.bin+= id CRUNCH_ALIAS_id= groups whoami ################################################################## # Programs from stock /usr/sbin # CRUNCH_SRCDIRS+= usr.sbin CRUNCH_PROGS_usr.sbin= chroot CRUNCH_PROGS_usr.sbin+= chown CRUNCH_ALIAS_chown= chgrp ################################################################## CRUNCH_LIBS+= -lm .include .include Index: head/sbin/atacontrol/atacontrol.8 =================================================================== --- head/sbin/atacontrol/atacontrol.8 (revision 249082) +++ head/sbin/atacontrol/atacontrol.8 (nonexistent) @@ -1,405 +0,0 @@ -.\" -.\" Copyright (c) 2000,2001,2002 Søren Schmidt -.\" 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. -.\" 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. -.\" -.\" 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. -.\" -.\" $FreeBSD$ -.\" -.Dd October 9, 2011 -.Dt ATACONTROL 8 -.Os -.Sh NAME -.Nm atacontrol -.Nd ATA device driver control program -.Pp -This utility was -.Em deprecated -in -.Fx 9.0 . -See -.Sx NOTES . -.Sh SYNOPSIS -.Nm -.Aq Ar command -.Ar args -.Pp -.Nm -.Ic attach -.Ar channel -.Nm -.Ic detach -.Ar channel -.Nm -.Ic reinit -.Ar channel -.Nm -.Ic create -.Ar type Oo Ar interleave Oc Ar disk0 ... diskN -.Nm -.Ic delete -.Ar raid -.Nm -.Ic addspare -.Ar raid disk -.Nm -.Ic rebuild -.Ar raid -.Nm -.Ic status -.Ar raid -.Nm -.Ic mode -.Ar device -.Op Ar mode -.Nm -.Ic info -.Ar channel -.Nm -.Ic cap -.Ar device -.Nm -.Ic spindown -.Ar device -.Op Ar seconds -.Nm -.Ic list -.Sh DESCRIPTION -The -.Nm -utility is a control program that provides the user access and control to the -.Fx -.Xr ata 4 -subsystem. -.Pp -The -.Nm -utility -can cause severe system crashes and loss of data if used improperly. -Please -exercise caution when using this command! -.Pp -The -.Ar channel -argument is the ATA channel device (e.g., ata0) on which to operate. -The following commands are supported: -.Bl -tag -width ".Ic addspare" -.It Ic attach -Attach an ATA -.Ar channel . -Devices on the channel are probed and attached as -is done on boot. -.It Ic detach -Detach an ATA -.Ar channel . -Devices on the channel are removed from the kernel, -and all outstanding transfers etc.\& are returned back to the system marked -as failed. -.It Ic reinit -Reinitialize an ATA -.Ar channel . -Both devices on the channel are reset and -initialized to the parameters the ATA driver has stored internally. -Devices that have gone bad and no longer respond to the probe, or devices -that have physically been removed, are removed from the kernel. -Likewise are devices that show up during a reset, probed and attached. -.It Ic create -Create a -.Ar type -ATA RAID. -The type can be -.Cm RAID0 -(stripe), -.Cm RAID1 -(mirror), -.Cm RAID0+1 , -.Cm SPAN -or -.Cm JBOD . -In case the RAID has a -.Cm RAID0 -component, -the -.Ar interleave -must be specified in number of sectors. -The RAID will be created -of the individual disks named -.Bk -words -.Ar disk0 ... diskN . -.Ek -.Pp -Although the ATA driver allows for creating an ATA RAID on disks with any -controller, there are restrictions. -It is only possible to boot on -an array if it is either located on a -.Dq real -ATA RAID controller like -the Promise or Highpoint controllers, or if the RAID declared is of -.Cm RAID1 -or -.Cm SPAN -type; in case of a -.Cm SPAN , -the partition to boot must -reside on the first disk in the SPAN. -.It Ic delete -Delete a RAID array on a RAID capable ATA controller. -.It Ic addspare -Add a spare disk to an existing RAID. -.It Ic rebuild -Rebuild a RAID1 array on a RAID capable ATA controller. -.It Ic status -Get the status of an ATA RAID. -.It Ic mode -Without the -.Ar mode -argument, the current transfer mode of the -device are printed. -If the -.Ar mode -argument is given, the ATA driver -is asked to change the transfer mode to the one given. -The ATA driver -will reject modes that are not supported by the hardware. -Modes are given like -.Dq Li PIO3 , -.Dq Li udma2 , -.Dq Li udma100 , -case does not matter. -.Pp -Currently supported modes are: -.Cm BIOSPIO , PIO0 , PIO1 , PIO2 , PIO3 , PIO4 , WDMA2 , UDMA2 -(alias -.Cm UDMA33 ) , -.Cm UDMA4 -(alias -.Cm UDMA66 ) , -.Cm UDMA5 -(alias -.Cm UDMA100 ) , -.Cm UDMA6 -(alias -.Cm UDMA133 ) , -.Cm SATA150 , SATA300 , USB , USB1 , USB2 -and -.Cm BIOSDMA . -.It Ic cap -Show detailed info about the device on -.Ar device . -.It Ic spindown -Set or report timeout after which the -.Ar device -will be spun down. -To arm the timeout the device needs at least one more request after -setting the timeout. -To disable spindown, set the timeout to zero. -No further actions are needed in this case. -.It Ic info -Show info about the attached devices on the -.Ar channel . -The device name and manufacture/version strings are shown. -.It Ic list -Show info about all attached devices on all active controllers. -.El -.Sh EXAMPLES -To get information on devices attached to a channel, -use the command line: -.Pp -.Dl "atacontrol info ata0" -.Pp -To see the devices' current access modes, use the command line: -.Pp -.Dl "atacontrol mode ad0" -.Pp -which results in the modes of the devices being displayed as a string -like this: -.Pp -.Dl "current mode = UDMA100" -.Pp -You can set the mode with -.Nm -and a string like the above, -for example: -.Pp -.Dl "atacontrol mode ad0 PIO4" -.Pp -The new modes are set as soon as the -.Nm -command returns. -.Pp -The atacontrol command can also be used to create purely software -RAID arrays in systems that do NOT have a "real" hardware RAID card -such as a Highpoint or Promise card. -A common scenario is a 1U server such as the HP DL320 G4 or G5. -These servers contain a SATA controller that has 2 channels that can -contain 2 disks per channel, but the servers are wired to only place -a single SATA drive on each channel. -These servers do have a "pseudo" RAID BIOS but it uses a proprietary -format that is not compatible with the ata driver, and thus their -RAID bios must be switched off. -Another common scenario would be a Promise UDMA100 controller card -that did not contain the Fasttrack RAID BIOS, but did contain 2 -UDMA channels. -1 disk would be attached to one channel and the other disk would be -attached to the other channel. -It is NOT recommended to create such arrays on a primary/secondary -pair on a SINGLE channel since the throughput of the mirror would be -severely compromised, the ability to rebuild the array in the event -of a disk failure would be greatly complicated, and if a disk -controller electronics failed it could wedge the channel and take -both disks in the mirror offline. -(which would defeat the purpose of having a mirror in the first place) -.Pp -A quick and dirty way to create such a mirrored array on a new -system is to boot off the FreeBSD install CD, do a minimal scratch -install, abort out of the post install questions, and at the command -line issue the command: -.Pp -.Dl "atacontrol create RAID1 ad4 ad6" -.Pp -then immediately issue a reboot and boot from the installation CD -again, and during the installation, you will now see "ar0" listed -as a disk to install on, and install on that instead of ad4, ad6, etc. -.Pp -To get information about the status of a RAID array in the system -use the command line: -.Pp -.Dl "atacontrol status ar0" -.Pp -A typical output showing good health on a RAID array might be as -follows: -.Pp -.Dl "ar0: ATA RAID1 subdisks: ad4 ad6 status: READY" -.Pp -If a disk drive in a RAID1 array dies the system will mark the disk -in a DOWN state and change the array status to DEGRADED. -This can ALSO happen in rare instances due to a power fluctuation or -other event causing the system to not shutdown properly. -In that case the output will look like the following: -.Pp -.Dl "ar0: ATA RAID1 subdisks: ad4 DOWN status: DEGRADED" -.Pp -For a mirrored RAID1 system the server WILL ALLOW you to remove a -dead SATA disk drive (if the drive is in a hot-swap tray) without -freezing up the system, so you can remove the disk and while you are -obtaining a replacement the server can run from the active disk. -The only caveat is that if the active disk is ad6, the system most -likely will NOT be able to be rebooted since most systems only -support booting from the first disk drive. -.Pp -To deactivate the DOWN disk ad6 to allow for it to be ejected, use -the following: -.Pp -.Dl "atacontrol detach ata3" -.Pp -then eject or remove the disk. -Note that this only works if the 2 disks in the mirror are on separate -channels (which is the standard setup for 1-U servers like the HP DL320). -When the new disk drive is obtained, make sure it is blank, then shut -the system down. -At this point, if the system has a RAID array card like a Highpoint or -Promise controller, you may then boot it into the BIOS of the card and use -the manufacturers RAID array rebuild utilities to rebuild the array. -.Pp -If the system has a pure software array and is not using a "real" ATA -RAID controller, then shut the system down, make sure that the disk -that was still working is moved to the bootable position (channel 0 -or whatever the BIOS allows the system to boot from) and the blank disk -is placed in the secondary position, then boot the system into -single-user mode and issue the command: -.Pp -.Dl "atacontrol addspare ar0 ad6" -.Dl "atacontrol rebuild ar0" -.Pp -If the disk drive did NOT fail and the RAID array became unmirrored due -to a software glitch or improper shutdown, then a slightly different -process must be followed. -Begin by issuing the detach command (this shows the detach for disk ad6, -the primary master on channel 3): -.Pp -.Dl "atacontrol detach ata3" -.Pp -then reboot the system into single-user mode. -(don't just init the system, reboot it so that both disks get probed) -You will probably see TWO mirrored RAID arrays appear during the boot -messages, ar0 and ar1. -Issue the command: -.Pp -.Dl "atacontrol delete ar1" -.Dl "atacontrol addspare ar0 ad6" -.Pp -Now a status command will show the array rebuilding. -.Pp -To spin down a disk after 30 minutes run -.Pp -.Dl "atacontrol spindown ad6 1800" -.Dl "dd if=/dev/ad6 of=/dev/null count=1" -.Pp -While any IO on the disk will arm the timer, using -.Xr dd 1 -on the raw device will work in all cases, as when the disk is not -opened at all. -You can check the current setting with -.Pp -.Dl "atacontrol spindown ad6" -.Pp -You should not set a spindown timeout on a disk with -.Pa / -or syslog logging on it as the disk will be worn out spinning down and -up all the time. -.Sh SEE ALSO -.Xr ata 4 , -.Xr cam 4 , -.Xr camcontrol 8 -.Sh HISTORY -The -.Nm -utility first appeared in -.Fx 4.6 . -.Pp -.Nm -was deprecated in -.Fx 9.0 . -.Sh AUTHORS -.An -nosplit -The -.Nm -utility was written by -.An S\(/oren Schmidt -.Aq sos@FreeBSD.org . -.Pp -This manual page was written by -.An S\(/oren Schmidt -.Aq sos@FreeBSD.org . -.Sh NOTES -The -.Nm -utility was deprecated in -.Fx 9.0 . -When -.Bd -ragged -offset indent -.Cd "options ATA_CAM" -.Ed -.Pp -is compiled into the kernel, then -.Xr camcontrol 8 -must be used instead. Property changes on: head/sbin/atacontrol/atacontrol.8 ___________________________________________________________________ Deleted: svn:keywords ## -1 +0,0 ## -FreeBSD=%H \ No newline at end of property Index: head/sbin/atacontrol/atacontrol.c =================================================================== --- head/sbin/atacontrol/atacontrol.c (revision 249082) +++ head/sbin/atacontrol/atacontrol.c (nonexistent) @@ -1,644 +0,0 @@ -/*- - * Copyright (c) 2000 - 2006 Søren Schmidt - * 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. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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. - * - * $FreeBSD$ - */ - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -static const char * -mode2str(int mode) -{ - switch (mode & 0xff) { - case ATA_PIO: return "BIOSPIO"; - case ATA_PIO0: return "PIO0"; - case ATA_PIO1: return "PIO1"; - case ATA_PIO2: return "PIO2"; - case ATA_PIO3: return "PIO3"; - case ATA_PIO4: return "PIO4"; - case ATA_WDMA0: return "WDMA0"; - case ATA_WDMA1: return "WDMA1"; - case ATA_WDMA2: return "WDMA2"; - case ATA_UDMA0: return "UDMA0"; - case ATA_UDMA1: return "UDMA1"; - case ATA_UDMA2: return "UDMA33"; - case ATA_UDMA3: return "UDMA44"; - case ATA_UDMA4: return "UDMA66"; - case ATA_UDMA5: return "UDMA100"; - case ATA_UDMA6: return "UDMA133"; - case ATA_DMA: return "BIOSDMA"; - default: return "???"; - } -} - -static const char * -satarev2str(int mode) -{ - switch ((mode & 0xff00) >> 8) { - case 0: return ""; - case 1: return "SATA 1.5Gb/s"; - case 2: return "SATA 3Gb/s"; - case 3: return "SATA 6Gb/s"; - case 0xff: return "SATA"; - default: return "???"; - } -} - -static int -str2mode(char *str) -{ - if (!strcasecmp(str, "BIOSPIO")) return ATA_PIO; - if (!strcasecmp(str, "PIO0")) return ATA_PIO0; - if (!strcasecmp(str, "PIO1")) return ATA_PIO1; - if (!strcasecmp(str, "PIO2")) return ATA_PIO2; - if (!strcasecmp(str, "PIO3")) return ATA_PIO3; - if (!strcasecmp(str, "PIO4")) return ATA_PIO4; - if (!strcasecmp(str, "WDMA0")) return ATA_WDMA0; - if (!strcasecmp(str, "WDMA1")) return ATA_WDMA1; - if (!strcasecmp(str, "WDMA2")) return ATA_WDMA2; - if (!strcasecmp(str, "UDMA0")) return ATA_UDMA0; - if (!strcasecmp(str, "UDMA16")) return ATA_UDMA0; - if (!strcasecmp(str, "UDMA1")) return ATA_UDMA1; - if (!strcasecmp(str, "UDMA25")) return ATA_UDMA1; - if (!strcasecmp(str, "UDMA2")) return ATA_UDMA2; - if (!strcasecmp(str, "UDMA33")) return ATA_UDMA2; - if (!strcasecmp(str, "UDMA3")) return ATA_UDMA3; - if (!strcasecmp(str, "UDMA44")) return ATA_UDMA3; - if (!strcasecmp(str, "UDMA4")) return ATA_UDMA4; - if (!strcasecmp(str, "UDMA66")) return ATA_UDMA4; - if (!strcasecmp(str, "UDMA5")) return ATA_UDMA5; - if (!strcasecmp(str, "UDMA100")) return ATA_UDMA5; - if (!strcasecmp(str, "UDMA6")) return ATA_UDMA6; - if (!strcasecmp(str, "UDMA133")) return ATA_UDMA6; - if (!strcasecmp(str, "BIOSDMA")) return ATA_DMA; - return -1; -} - -static void -usage(void) -{ - fprintf(stderr, - "usage: atacontrol args:\n" - " atacontrol list\n" - " atacontrol info channel\n" - " atacontrol attach channel\n" - " atacontrol detach channel\n" - " atacontrol reinit channel\n" - " atacontrol create type [interleave] disk0 ... diskN\n" - " atacontrol delete array\n" - " atacontrol addspare array disk\n" - " atacontrol rebuild array\n" - " atacontrol status array\n" - " atacontrol mode device [mode]\n" - " atacontrol cap device\n" - " atacontrol spindown device [seconds]\n" - ); - exit(EX_USAGE); -} - -static int -version(int ver) -{ - int bit; - - if (ver == 0xffff) - return 0; - for (bit = 15; bit >= 0; bit--) - if (ver & (1< ", parm->model, parm->revision); - if (parm->satacapabilities && parm->satacapabilities != 0xffff) { - if (parm->satacapabilities & ATA_SATA_GEN2) - printf("SATA revision 2.x\n"); - else if (parm->satacapabilities & ATA_SATA_GEN1) - printf("SATA revision 1.x\n"); - else - printf("Unknown SATA revision\n"); - } - else - printf("ATA/ATAPI revision %d\n", version(parm->version_major)); -} - -static void -cap_print(struct ata_params *parm) -{ - u_int32_t lbasize = (u_int32_t)parm->lba_size_1 | - ((u_int32_t)parm->lba_size_2 << 16); - - u_int64_t lbasize48 = ((u_int64_t)parm->lba_size48_1) | - ((u_int64_t)parm->lba_size48_2 << 16) | - ((u_int64_t)parm->lba_size48_3 << 32) | - ((u_int64_t)parm->lba_size48_4 << 48); - - printf("\n"); - printf("Protocol "); - if (parm->satacapabilities && parm->satacapabilities != 0xffff) { - if (parm->satacapabilities & ATA_SATA_GEN2) - printf("SATA revision 2.x\n"); - else if (parm->satacapabilities & ATA_SATA_GEN1) - printf("SATA revision 1.x\n"); - else - printf("Unknown SATA revision\n"); - } - else - printf("ATA/ATAPI revision %d\n", version(parm->version_major)); - printf("device model %.40s\n", parm->model); - printf("serial number %.20s\n", parm->serial); - printf("firmware revision %.8s\n", parm->revision); - - printf("cylinders %d\n", parm->cylinders); - printf("heads %d\n", parm->heads); - printf("sectors/track %d\n", parm->sectors); - - if (parm->config == ATA_PROTO_CFA || - (parm->support.command2 & ATA_SUPPORT_CFA)) - printf("CFA supported\n"); - - printf("lba%ssupported ", - parm->capabilities1 & ATA_SUPPORT_LBA ? " " : " not "); - if (lbasize) - printf("%d sectors\n", lbasize); - else - printf("\n"); - - printf("lba48%ssupported ", - parm->support.command2 & ATA_SUPPORT_ADDRESS48 ? " " : " not "); - if (lbasize48) - printf("%ju sectors\n", (uintmax_t)lbasize48); - else - printf("\n"); - - printf("dma%ssupported\n", - parm->capabilities1 & ATA_SUPPORT_DMA ? " " : " not "); - - printf("overlap%ssupported\n", - parm->capabilities1 & ATA_SUPPORT_OVERLAP ? " " : " not "); - - printf("\nFeature " - "Support Enable Value Vendor\n"); - - printf("write cache %s %s\n", - parm->support.command1 & ATA_SUPPORT_WRITECACHE ? "yes" : "no", - parm->enabled.command1 & ATA_SUPPORT_WRITECACHE ? "yes" : "no"); - - printf("read ahead %s %s\n", - parm->support.command1 & ATA_SUPPORT_LOOKAHEAD ? "yes" : "no", - parm->enabled.command1 & ATA_SUPPORT_LOOKAHEAD ? "yes" : "no"); - - if (parm->satacapabilities && parm->satacapabilities != 0xffff) { - printf("Native Command Queuing (NCQ) %s %s" - " %d/0x%02X\n", - parm->satacapabilities & ATA_SUPPORT_NCQ ? - "yes" : "no", " -", - (parm->satacapabilities & ATA_SUPPORT_NCQ) ? - ATA_QUEUE_LEN(parm->queue) : 0, - (parm->satacapabilities & ATA_SUPPORT_NCQ) ? - ATA_QUEUE_LEN(parm->queue) : 0); - } - printf("Tagged Command Queuing (TCQ) %s %s %d/0x%02X\n", - parm->support.command2 & ATA_SUPPORT_QUEUED ? "yes" : "no", - parm->enabled.command2 & ATA_SUPPORT_QUEUED ? "yes" : "no", - ATA_QUEUE_LEN(parm->queue), ATA_QUEUE_LEN(parm->queue)); - - printf("SMART %s %s\n", - parm->support.command1 & ATA_SUPPORT_SMART ? "yes" : "no", - parm->enabled.command1 & ATA_SUPPORT_SMART ? "yes" : "no"); - - printf("microcode download %s %s\n", - parm->support.command2 & ATA_SUPPORT_MICROCODE ? "yes" : "no", - parm->enabled.command2 & ATA_SUPPORT_MICROCODE ? "yes" : "no"); - - printf("security %s %s\n", - parm->support.command1 & ATA_SUPPORT_SECURITY ? "yes" : "no", - parm->enabled.command1 & ATA_SUPPORT_SECURITY ? "yes" : "no"); - - printf("power management %s %s\n", - parm->support.command1 & ATA_SUPPORT_POWERMGT ? "yes" : "no", - parm->enabled.command1 & ATA_SUPPORT_POWERMGT ? "yes" : "no"); - - printf("advanced power management %s %s %d/0x%02X\n", - parm->support.command2 & ATA_SUPPORT_APM ? "yes" : "no", - parm->enabled.command2 & ATA_SUPPORT_APM ? "yes" : "no", - parm->apm_value, parm->apm_value); - - printf("automatic acoustic management %s %s " - "%d/0x%02X %d/0x%02X\n", - parm->support.command2 & ATA_SUPPORT_AUTOACOUSTIC ? "yes" :"no", - parm->enabled.command2 & ATA_SUPPORT_AUTOACOUSTIC ? "yes" :"no", - ATA_ACOUSTIC_CURRENT(parm->acoustic), - ATA_ACOUSTIC_CURRENT(parm->acoustic), - ATA_ACOUSTIC_VENDOR(parm->acoustic), - ATA_ACOUSTIC_VENDOR(parm->acoustic)); -} - -static void -ata_cap_print(int fd) -{ - struct ata_params params; - - if (ioctl(fd, IOCATAGPARM, ¶ms) < 0) - err(1, "ioctl(IOCATAGPARM)"); - cap_print(¶ms); -} - -static void -info_print(int fd, int channel, int prchan) -{ - struct ata_ioc_devices devices; - - devices.channel = channel; - - if (ioctl(fd, IOCATADEVICES, &devices) < 0) { - if (!prchan) - err(1, "ioctl(IOCATADEVICES)"); - return; - } - if (prchan) - printf("ATA channel %d:\n", channel); - printf("%sMaster: ", prchan ? " " : ""); - if (*devices.name[0]) { - printf("%4.4s ", devices.name[0]); - param_print(&devices.params[0]); - } - else - printf(" no device present\n"); - printf("%sSlave: ", prchan ? " " : ""); - if (*devices.name[1]) { - printf("%4.4s ", devices.name[1]); - param_print(&devices.params[1]); - } - else - printf(" no device present\n"); -} - -static void -ata_spindown(int fd, const char *dev, const char *arg) -{ - int tmo; - - if (arg != NULL) { - tmo = strtoul(arg, NULL, 0); - if (ioctl(fd, IOCATASSPINDOWN, &tmo) < 0) - err(1, "ioctl(IOCATASSPINDOWN)"); - } else { - if (ioctl(fd, IOCATAGSPINDOWN, &tmo) < 0) - err(1, "ioctl(IOCATAGSPINDOWN)"); - if (tmo == 0) - printf("%s: idle spin down disabled\n", dev); - else - printf("%s: spin down after %d seconds idle\n", - dev, tmo); - } -} - -static int -open_dev(const char *arg, int mode) -{ - int disk, fd; - char device[64]; - - if (!(sscanf(arg, "ad%d", &disk) == 1 || - sscanf(arg, "acd%d", &disk) == 1 || - sscanf(arg, "afd%d", &disk) == 1 || - sscanf(arg, "ast%d", &disk) == 1)) { - fprintf(stderr, "atacontrol: Invalid device %s\n", arg); - exit(EX_USAGE); - } - sprintf(device, "/dev/%s", arg); - if ((fd = open(device, mode)) < 0) - err(1, "device not found"); - return (fd); -} - -static int -ar_arg(const char *arg) -{ - int array; - - if (!(sscanf(arg, "ar%d", &array) == 1)) { - fprintf(stderr, "atacontrol: Invalid array %s\n", arg); - exit(EX_USAGE); - } - return (array); -} - -static int -ata_arg(const char *arg) -{ - int channel; - - if (!(sscanf(arg, "ata%d", &channel) == 1)) { - fprintf(stderr, "atacontrol: Invalid channel %s\n", arg); - exit(EX_USAGE); - } - return (channel); -} - -int -main(int argc, char **argv) -{ - int fd, mode, channel, array; - - if (feature_present("ata_cam")) { - errx(1, "\nATA_CAM option is enabled in kernel.\n" - "Please use camcontrol instead."); - } - - if (argc < 2) - usage(); - - if (!strcmp(argv[1], "mode") && (argc == 3 || argc == 4)) { - fd = open_dev(argv[2], O_RDONLY); - if (argc == 4) { - mode = str2mode(argv[3]); - if (mode == -1) - errx(1, "unknown mode"); - if (ioctl(fd, IOCATASMODE, &mode) < 0) - warn("ioctl(IOCATASMODE)"); - } - if (argc == 3 || argc == 4) { - if (ioctl(fd, IOCATAGMODE, &mode) < 0) - err(1, "ioctl(IOCATAGMODE)"); - printf("current mode = %s %s\n", - mode2str(mode), satarev2str(mode)); - } - exit(EX_OK); - } - if (!strcmp(argv[1], "cap") && argc == 3) { - fd = open_dev(argv[2], O_RDONLY); - ata_cap_print(fd); - exit(EX_OK); - } - - if (!strcmp(argv[1], "spindown") && (argc == 3 || argc == 4)) { - fd = open_dev(argv[2], O_RDONLY); - ata_spindown(fd, argv[2], argv[3]); - exit(EX_OK); - } - - if ((fd = open("/dev/ata", O_RDWR)) < 0) - err(1, "control device not found"); - - if (!strcmp(argv[1], "list") && argc == 2) { - int maxchannel; - - if (ioctl(fd, IOCATAGMAXCHANNEL, &maxchannel) < 0) - err(1, "ioctl(IOCATAGMAXCHANNEL)"); - for (channel = 0; channel < maxchannel; channel++) - info_print(fd, channel, 1); - exit(EX_OK); - } - if (!strcmp(argv[1], "info") && argc == 3) { - channel = ata_arg(argv[2]); - info_print(fd, channel, 0); - exit(EX_OK); - } - if (!strcmp(argv[1], "detach") && argc == 3) { - channel = ata_arg(argv[2]); - if (ioctl(fd, IOCATADETACH, &channel) < 0) - err(1, "ioctl(IOCATADETACH)"); - exit(EX_OK); - } - if (!strcmp(argv[1], "attach") && argc == 3) { - channel = ata_arg(argv[2]); - if (ioctl(fd, IOCATAATTACH, &channel) < 0) - err(1, "ioctl(IOCATAATTACH)"); - info_print(fd, channel, 0); - exit(EX_OK); - } - if (!strcmp(argv[1], "reinit") && argc == 3) { - channel = ata_arg(argv[2]); - if (ioctl(fd, IOCATAREINIT, &channel) < 0) - warn("ioctl(IOCATAREINIT)"); - info_print(fd, channel, 0); - exit(EX_OK); - } - if (!strcmp(argv[1], "create")) { - int disk, dev, offset; - struct ata_ioc_raid_config config; - - bzero(&config, sizeof(config)); - if (argc > 2) { - if (!strcasecmp(argv[2], "RAID0") || - !strcasecmp(argv[2], "stripe")) - config.type = AR_RAID0; - if (!strcasecmp(argv[2], "RAID1") || - !strcasecmp(argv[2],"mirror")) - config.type = AR_RAID1; - if (!strcasecmp(argv[2], "RAID0+1") || - !strcasecmp(argv[2],"RAID10")) - config.type = AR_RAID01; - if (!strcasecmp(argv[2], "RAID5")) - config.type = AR_RAID5; - if (!strcasecmp(argv[2], "SPAN")) - config.type = AR_SPAN; - if (!strcasecmp(argv[2], "JBOD")) - config.type = AR_JBOD; - } - if (!config.type) { - fprintf(stderr, "atacontrol: Invalid RAID type %s\n", - argv[2]); - fprintf(stderr, "atacontrol: Valid RAID types: \n"); - fprintf(stderr, " stripe | mirror | " - "RAID0 | RAID1 | RAID0+1 | RAID5 | " - "SPAN | JBOD\n"); - exit(EX_USAGE); - } - - if (config.type == AR_RAID0 || - config.type == AR_RAID01 || - config.type == AR_RAID5) { - if (argc < 4 || - !sscanf(argv[3], "%d", &config.interleave) == 1) { - fprintf(stderr, - "atacontrol: Invalid interleave %s\n", - argv[3]); - exit(EX_USAGE); - } - offset = 4; - } - else - offset = 3; - - for (disk = 0; disk < 16 && (offset + disk) < argc; disk++) { - if (!(sscanf(argv[offset + disk], "ad%d", &dev) == 1)) { - fprintf(stderr, - "atacontrol: Invalid disk %s\n", - argv[offset + disk]); - exit(EX_USAGE); - } - config.disks[disk] = dev; - } - - if ((config.type == AR_RAID1 || config.type == AR_RAID01) && - disk < 2) { - fprintf(stderr, "atacontrol: At least 2 disks must be " - "specified\n"); - exit(EX_USAGE); - } - - config.total_disks = disk; - if (ioctl(fd, IOCATARAIDCREATE, &config) < 0) - err(1, "ioctl(IOCATARAIDCREATE)"); - else - printf("ar%d created\n", config.lun); - exit(EX_OK); - } - if (!strcmp(argv[1], "delete") && argc == 3) { - array = ar_arg(argv[2]); - if (ioctl(fd, IOCATARAIDDELETE, &array) < 0) - warn("ioctl(IOCATARAIDDELETE)"); - exit(EX_OK); - } - if (!strcmp(argv[1], "addspare") && argc == 4) { - struct ata_ioc_raid_config config; - - config.lun = ar_arg(argv[2]); - if (!(sscanf(argv[3], "ad%d", &config.disks[0]) == 1)) { - fprintf(stderr, - "atacontrol: Invalid disk %s\n", argv[3]); - usage(); - } - if (ioctl(fd, IOCATARAIDADDSPARE, &config) < 0) - warn("ioctl(IOCATARAIDADDSPARE)"); - exit(EX_OK); - } - if (!strcmp(argv[1], "rebuild") && argc == 3) { - array = ar_arg(argv[2]); - if (ioctl(fd, IOCATARAIDREBUILD, &array) < 0) - warn("ioctl(IOCATARAIDREBUILD)"); - else { - char device[64]; - char *buffer; - ssize_t len; - int arfd; - - if (daemon(0, 1) == -1) - err(1, "daemon"); - nice(20); - snprintf(device, sizeof(device), "/dev/ar%d", - array); - if ((arfd = open(device, O_RDONLY)) == -1) - err(1, "open %s", device); - if ((buffer = malloc(1024 * 1024)) == NULL) - err(1, "malloc"); - while ((len = read(arfd, buffer, 1024 * 1024)) > 0) - ; - if (len == -1) - err(1, "read"); - else - fprintf(stderr, - "atacontrol: ar%d rebuild completed\n", - array); - free(buffer); - close(arfd); - } - exit(EX_OK); - } - if (!strcmp(argv[1], "status") && argc == 3) { - struct ata_ioc_raid_status status; - int i, lun, state; - - status.lun = ar_arg(argv[2]); - if (ioctl(fd, IOCATARAIDSTATUS, &status) < 0) - err(1, "ioctl(IOCATARAIDSTATUS)"); - - printf("ar%d: ATA ", status.lun); - switch (status.type) { - case AR_RAID0: - printf("RAID0 stripesize=%d", status.interleave); - break; - case AR_RAID1: - printf("RAID1"); - break; - case AR_RAID01: - printf("RAID0+1 stripesize=%d", status.interleave); - break; - case AR_RAID5: - printf("RAID5 stripesize=%d", status.interleave); - break; - case AR_JBOD: - printf("JBOD"); - break; - case AR_SPAN: - printf("SPAN"); - break; - } - printf(" status: "); - switch (status.status) { - case AR_READY: - printf("READY\n"); - break; - case AR_READY | AR_DEGRADED: - printf("DEGRADED\n"); - break; - case AR_READY | AR_DEGRADED | AR_REBUILDING: - printf("REBUILDING %d%% completed\n", - status.progress); - break; - default: - printf("BROKEN\n"); - } - printf(" subdisks:\n"); - for (i = 0; i < status.total_disks; i++) { - printf(" %2d ", i); - lun = status.disks[i].lun; - state = status.disks[i].state; - if (lun < 0) - printf("---- "); - else - printf("ad%-2d ", lun); - if (state & AR_DISK_ONLINE) - printf("ONLINE"); - else if (state & AR_DISK_SPARE) - printf("SPARE"); - else if (state & AR_DISK_PRESENT) - printf("OFFLINE"); - else - printf("MISSING"); - printf("\n"); - } - exit(EX_OK); - } - usage(); - exit(EX_OK); -} Property changes on: head/sbin/atacontrol/atacontrol.c ___________________________________________________________________ Deleted: svn:keywords ## -1 +0,0 ## -FreeBSD=%H \ No newline at end of property Index: head/sbin/atacontrol/Makefile =================================================================== --- head/sbin/atacontrol/Makefile (revision 249082) +++ head/sbin/atacontrol/Makefile (nonexistent) @@ -1,6 +0,0 @@ -#$FreeBSD$ - -PROG= atacontrol -MAN= atacontrol.8 - -.include Property changes on: head/sbin/atacontrol/Makefile ___________________________________________________________________ Deleted: svn:keywords ## -1 +0,0 ## -FreeBSD=%H \ No newline at end of property Index: head/sbin/Makefile =================================================================== --- head/sbin/Makefile (revision 249082) +++ head/sbin/Makefile (revision 249083) @@ -1,122 +1,121 @@ # @(#)Makefile 8.5 (Berkeley) 3/31/94 # $FreeBSD$ .include # XXX MISSING: icheck ncheck SUBDIR=adjkerntz \ - atacontrol \ badsect \ camcontrol \ ccdconfig \ clri \ comcontrol \ conscontrol \ ddb \ devfs \ dhclient \ dmesg \ dump \ dumpfs \ dumpon \ etherswitchcfg \ ffsinfo \ fsck \ fsck_ffs \ fsck_msdosfs \ fsdb \ fsirand \ gbde \ geom \ ggate \ growfs \ gvinum \ hastctl \ hastd \ ifconfig \ init \ iscontrol \ kldconfig \ kldload \ kldstat \ kldunload \ ldconfig \ md5 \ mdconfig \ mdmfs \ mknod \ mksnap_ffs \ mount \ mount_cd9660 \ mount_fusefs \ mount_msdosfs \ mount_nfs \ mount_nullfs \ mount_udf \ mount_unionfs \ newfs \ newfs_msdos \ nfsiod \ nos-tun \ ping \ rcorder \ reboot \ recoverdisk \ resolvconf \ restore \ route \ savecore \ setkey \ shutdown \ spppcontrol \ swapon \ sysctl \ tunefs \ umount \ .if ${MK_ATM} != "no" SUBDIR+= atm .endif .if ${MK_CXX} != "no" SUBDIR+= devd .endif .if ${MK_IPFILTER} != "no" SUBDIR+= ipf .endif .if ${MK_IPFW} != "no" SUBDIR+= ipfw SUBDIR+= natd .endif .if ${MK_NAND} != "no" SUBDIR+= nandfs SUBDIR+= newfs_nandfs .endif .if ${MK_PF} != "no" SUBDIR+= pfctl SUBDIR+= pflogd .endif .if ${MK_INET6} != "no" SUBDIR+= ping6 SUBDIR+= rtsol .endif .if ${MK_QUOTAS} != "no" SUBDIR+= quotacheck .endif .if ${MK_ROUTED} != "no" SUBDIR+= routed .endif .include SUBDIR:= ${SUBDIR:O} .include Index: head/share/man/man4/ataraid.4 =================================================================== --- head/share/man/man4/ataraid.4 (revision 249082) +++ head/share/man/man4/ataraid.4 (nonexistent) @@ -1,148 +0,0 @@ -.\" Copyright (c) 2005 Christian Brueffer -.\" 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. -.\" 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. -.\" -.\" 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. -.\" -.\" $FreeBSD$ -.\" -.Dd February 17, 2006 -.Dt ATARAID 4 -.Os -.Sh NAME -.Nm ataraid -.Nd "ATA software RAID support" -.Sh SYNOPSIS -.Cd "device ata" -.Cd "device ataraid" -.Sh DESCRIPTION -The -.Nm -driver provides support for so-called software RAID -(sometimes referred to as fake RAID or pseudo RAID). -.Pp -When a controller that supports software RAID is instructed to -create a RAID array, its BIOS writes data structures in a specific -metadata format to the disks. -These data structures are picked up by the -.Nm -driver, so that -.Fx -can work with the array. -The -.Nm -driver has to understand the specific metadata format of a -controller BIOS in order to support its RAID capabilities. -.Pp -Read-only support for a metadata format means that -.Fx -can use the given RAID array for normal read/write operations. -Creation and rebuild of such arrays has to be done from the -controller BIOS. -.Pp -Read and write support for a metadata format means that -.Fx -can use the given RAID array for normal read/write operations. -Additionally, the -.Xr atacontrol 8 -utility can be used to create, rebuild, update and fail such -RAID arrays. -.Pp -The -.Nm -driver can read the following metadata formats: -.Pp -.Bl -bullet -compact -.It -Adaptec HostRAID -.It -Highpoint V2 RocketRAID -.It -Highpoint V3 RocketRAID -.It -Intel MatrixRAID -.It -Integrated Technology Express (ITE) -.It -JMicron -.It -LSI Logic V2 MegaRAID -.It -LSI Logic V3 MegaRAID -.It -NVIDIA MediaShield -.It -Promise FastTrak -.It -Silicon Image Medley -.It -Silicon Integrated Systems (SiS) -.It -VIA Tech V-RAID -.It -FreeBSD PseudoRAID -.El -.Pp -The -.Nm -driver can write the following metadata formats: -.Pp -.Bl -bullet -compact -.It -Highpoint V2 RocketRAID -.It -Intel MatrixRAID -.It -JMicron -.It -Promise FastTrak -.It -Silicon Integrated Systems (SiS) -.It -VIA Tech V-RAID -.It -FreeBSD PseudoRAID -.El -.Pp -It is also possible to use software RAID on controllers -that do not have special software RAID capabilities. -See -.Xr atacontrol 8 -for details. -.Sh FILES -.Bl -tag -width ".Pa /dev/ar*" -compact -.It Pa /dev/ar* -ATA RAID device nodes -.El -.Sh SEE ALSO -.Xr ata 4 , -.Xr atacontrol 8 -.Sh AUTHORS -.An -nosplit -The -.Nm -driver was written by -.An S\(/oren Schmidt Aq sos@FreeBSD.org . -This manual page was written by -.An Christian Brueffer Aq brueffer@FreeBSD.org . -.Sh CAVEATS -RAID5 is not supported at this time. -Code exists, but it neither uses nor maintains parity information. Property changes on: head/share/man/man4/ataraid.4 ___________________________________________________________________ Deleted: svn:keywords ## -1 +0,0 ## -FreeBSD=%H \ No newline at end of property Index: head/share/man/man4/atapicam.4 =================================================================== --- head/share/man/man4/atapicam.4 (revision 249082) +++ head/share/man/man4/atapicam.4 (nonexistent) @@ -1,134 +0,0 @@ -.\" Copyright (c) 2002, 2004 -.\" Thomas Quinot . 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. -.\" 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. Neither the name of the author nor the names of any co-contributors -.\" may 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 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. -.\" -.\" $FreeBSD$ -.\" -.Dd October 22, 2009 -.Dt ATAPICAM 4 -.Os -.Sh NAME -.Nm atapicam -.Nd CAM XPT (transport) module for ATAPI devices -.Sh SYNOPSIS -To compile this driver into the kernel, -place the following lines in your -kernel configuration file: -.Bd -ragged -offset indent -.Cd "device scbus" -.Cd "device ata" -.Cd "device atapicam" -.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 -atapicam_load="YES" -.Ed -.Sh DESCRIPTION -The ATAPI/CAM module allows ATAPI devices (CD-ROM, CD-RW, DVD drives, -floppy drives such as Iomega Zip, tape drives) to be accessed through -the SCSI subsystem, -.Xr cam 4 . -.Pp -.Xr ata 4 -and -.Xr scbus 4 -must be configured in the kernel as well. -The SCSI target drivers -.Xr ( cd 4 , -.Xr da 4 , -or -.Xr st 4 ) -can then be used to access the devices. -The generic passthrough device, -.Xr pass 4 , -can also be used to send SCSI commands directly -to the devices through the CAM API. -.Pp -A separate CAM bus is created for each ATA bus in the system. -On each of these buses, target ID 0 is assigned to the master -device, and ID 1 is assigned to the slave -(provided they are ATAPI devices). -.Sh IMPLEMENTATION NOTES -Some SCSI commands are intercepted by the driver, and undergo special -processing in order to work around limitations of ATAPI devices. -Such limitations can be consequences of the ATAPI specification. -For example, ATAPI devices do not implement the 6-byte versions -of -.Dv MODE_SELECT , MODE_SENSE , READ , -or -.Dv WRITE . -They can also be common bugs, such as hanging when queried for -extended -.Dv INQUIRY -information. -.Sh EXAMPLES -.Bd -literal -offset indent -device ata -device atapicam -device scbus -device cd -device pass -.Ed -.Pp -Add the -.Nm -driver to the kernel. -.Pp -.Dl "camcontrol devlist" -.Pp -Print the list of all devices available through CAM. -.Pp -.Dl "mount -t cd9660 /dev/cd0 /mnt" -.Pp -Mount a CD-ROM from an ATAPI CD-ROM drive -(the command above assumes that the ATAPI drive is the only CD-ROM unit). -.Sh SEE ALSO -.Xr ata 4 , -.Xr cam 4 , -.Xr scsi 4 , -.Xr atacontrol 8 , -.Xr camcontrol 8 -.Sh HISTORY -The ATAPI/CAM driver first appeared in -.Fx 4.8 -and -.Fx 5.0 . -.Sh AUTHORS -The ATAPI/CAM driver was written by -.An Thomas Quinot Aq thomas@FreeBSD.org . -.Sh BUGS -.Nm -and ATAPI-specific target drivers -.Xr ( acd 4 , -.Xr ast 4 , -and -.Xr afd 4 ) -can be configured in the same kernel. -Simultaneous access to the same device through the SCSI generic drivers -and the ATAPI-specific drivers may cause problems and is strongly discouraged. Property changes on: head/share/man/man4/atapicam.4 ___________________________________________________________________ Deleted: svn:keywords ## -1 +0,0 ## -FreeBSD=%H \ No newline at end of property Index: head/share/man/man4/Makefile =================================================================== --- head/share/man/man4/Makefile (revision 249082) +++ head/share/man/man4/Makefile (revision 249083) @@ -1,819 +1,817 @@ # @(#)Makefile 8.1 (Berkeley) 6/18/93 # $FreeBSD$ .include MAN= aac.4 \ acpi.4 \ ${_acpi_asus.4} \ ${_acpi_asus_wmi.4} \ ${_acpi_dock.4} \ ${_acpi_fujitsu.4} \ ${_acpi_hp.4} \ ${_acpi_ibm.4} \ ${_acpi_panasonic.4} \ ${_acpi_sony.4} \ acpi_thermal.4 \ ${_acpi_toshiba.4} \ acpi_video.4 \ ${_acpi_wmi.4} \ ada.4 \ adv.4 \ adw.4 \ ae.4 \ ${_aesni.4} \ age.4 \ agp.4 \ aha.4 \ ahb.4 \ ahc.4 \ ahci.4 \ ahd.4 \ ${_aibs.4} \ aio.4 \ alc.4 \ ale.4 \ alpm.4 \ altera_avgen.4 \ altera_jtag_uart.4 \ altera_sdcard.4 \ altq.4 \ amdpm.4 \ ${_amdsbwd.4} \ ${_amdsmb.4} \ ${_amdtemp.4} \ ${_bxe.4} \ amr.4 \ an.4 \ ${_aout.4} \ ${_apic.4} \ arcmsr.4 \ ${_asmc.4} \ asr.4 \ ata.4 \ - atapicam.4 \ - ataraid.4 \ ath.4 \ ath_ahb.4 \ ath_hal.4 \ ath_pci.4 \ atkbd.4 \ atkbdc.4 \ ${_atp.4} \ ${_atf_test_case.4} \ ${_atrtc.4} \ ${_attimer.4} \ audit.4 \ auditpipe.4 \ aue.4 \ axe.4 \ bce.4 \ bfe.4 \ bge.4 \ ${_bhyve.4} \ bktr.4 \ blackhole.4 \ bpf.4 \ bridge.4 \ bt.4 \ bwi.4 \ bwn.4 \ capsicum.4 \ cardbus.4 \ carp.4 \ cas.4 \ cc_chd.4 \ cc_cubic.4 \ cc_hd.4 \ cc_htcp.4 \ cc_newreno.4 \ cc_vegas.4 \ ccd.4 \ cd.4 \ cdce.4 \ ch.4 \ ciss.4 \ cm.4 \ cmx.4 \ ${_coretemp.4} \ ${_cpuctl.4} \ cpufreq.4 \ crypto.4 \ ctl.4 \ cue.4 \ cxgb.4 \ cxgbe.4 \ cy.4 \ da.4 \ dc.4 \ dcons.4 \ dcons_crom.4 \ ddb.4 \ de.4 \ devctl.4 \ digi.4 \ disc.4 \ divert.4 \ ${_dpms.4} \ dpt.4 \ dummynet.4 \ ed.4 \ edsc.4 \ ef.4 \ ehci.4 \ em.4 \ en.4 \ enc.4 \ epair.4 \ esp.4 \ est.4 \ et.4 \ eventtimers.4 \ exca.4 \ faith.4 \ fatm.4 \ fd.4 \ fdc.4 \ fdt.4 \ fdtbus.4 \ ffclock.4 \ filemon.4 \ firewire.4 \ fpa.4 \ fwe.4 \ fwip.4 \ fwohci.4 \ fxp.4 \ gbde.4 \ gdb.4 \ gem.4 \ geom.4 \ geom_fox.4 \ geom_linux_lvm.4 \ geom_map.4 \ geom_uzip.4 \ gif.4 \ gpib.4 \ gre.4 \ h_ertt.4 \ hatm.4 \ hifn.4 \ hme.4 \ hpet.4 \ ${_hpt27xx.4} \ ${_hptiop.4} \ ${_hptmv.4} \ ${_hptrr.4} \ hwpmc.4 \ ichsmb.4 \ ${_ichwd.4} \ icmp.4 \ icmp6.4 \ ida.4 \ ifmib.4 \ igb.4 \ igmp.4 \ iic.4 \ iicbb.4 \ iicbus.4 \ iicsmb.4 \ iir.4 \ inet.4 \ inet6.4 \ intpm.4 \ intro.4 \ ${_io.4} \ ip.4 \ ip6.4 \ ipfirewall.4 \ ${_ipmi.4} \ ips.4 \ ipsec.4 \ ipw.4 \ ipwfw.4 \ isci.4 \ iscsi_initiator.4 \ isf.4 \ isp.4 \ ispfw.4 \ iwi.4 \ iwifw.4 \ iwn.4 \ iwnfw.4 \ ixgb.4 \ ixgbe.4 \ jme.4 \ joy.4 \ kbdmux.4 \ keyboard.4 \ kld.4 \ ksyms.4 \ ktr.4 \ kue.4 \ lagg.4 \ le.4 \ led.4 \ lge.4 \ ${_lindev.4} \ ${_linux.4} \ lmc.4 \ lo.4 \ lp.4 \ lpbb.4 \ lpt.4 \ mac.4 \ mac_biba.4 \ mac_bsdextended.4 \ mac_ifoff.4 \ mac_lomac.4 \ mac_mls.4 \ mac_none.4 \ mac_partition.4 \ mac_portacl.4 \ mac_seeotheruids.4 \ mac_stub.4 \ mac_test.4 \ malo.4 \ mcd.4 \ md.4 \ mem.4 \ meteor.4 \ mfi.4 \ miibus.4 \ mk48txx.4 \ mld.4 \ mlx.4 \ mly.4 \ mmc.4 \ mmcsd.4 \ mn.4 \ mod_cc.4 \ mos.4 \ mouse.4 \ mps.4 \ mpt.4 \ msk.4 \ mtio.4 \ multicast.4 \ mvs.4 \ mwl.4 \ mwlfw.4 \ mxge.4 \ my.4 \ nand.4 \ nandsim.4 \ natm.4 \ natmip.4 \ ncr.4 \ ncv.4 \ ${_ndis.4} \ net80211.4 \ netgraph.4 \ netintro.4 \ netmap.4 \ ${_nfe.4} \ ${_nfsmb.4} \ ng_async.4 \ ng_atm.4 \ ngatmbase.4 \ ng_atmllc.4 \ ng_bluetooth.4 \ ng_bpf.4 \ ng_bridge.4 \ ng_bt3c.4 \ ng_btsocket.4 \ ng_car.4 \ ng_ccatm.4 \ ng_cisco.4 \ ng_deflate.4 \ ng_device.4 \ nge.4 \ ng_echo.4 \ ng_eiface.4 \ ng_etf.4 \ ng_ether.4 \ ng_ether_echo.4 \ ng_fec.4 \ ng_frame_relay.4 \ ng_gif.4 \ ng_gif_demux.4 \ ng_h4.4 \ ng_hci.4 \ ng_hole.4 \ ng_hub.4 \ ng_iface.4 \ ng_ipfw.4 \ ng_ip_input.4 \ ng_ksocket.4 \ ng_l2cap.4 \ ng_l2tp.4 \ ng_lmi.4 \ ng_mppc.4 \ ng_nat.4 \ ng_netflow.4 \ ng_one2many.4 \ ng_patch.4 \ ng_ppp.4 \ ng_pppoe.4 \ ng_pptpgre.4 \ ng_pred1.4 \ ng_rfc1490.4 \ ng_socket.4 \ ng_source.4 \ ng_split.4 \ ng_sppp.4 \ ng_sscfu.4 \ ng_sscop.4 \ ng_tag.4 \ ng_tcpmss.4 \ ng_tee.4 \ ng_tty.4 \ ng_ubt.4 \ ng_UI.4 \ ng_uni.4 \ ng_vjc.4 \ ng_vlan.4 \ nmdm.4 \ nsp.4 \ null.4 \ ${_nvd.4} \ ${_nve.4} \ ${_nvme.4} \ ${_nvram.4} \ ${_nvram2env.4} \ ${_nxge.4} \ oce.4 \ ohci.4 \ orm.4 \ ${_padlock.4} \ pass.4 \ patm.4 \ pccard.4 \ pccbb.4 \ pcf.4 \ pci.4 \ pcib.4 \ pcic.4 \ pcii.4 \ pcm.4 \ pcn.4 \ ${_pf.4} \ ${_pflog.4} \ ${_pfsync.4} \ pim.4 \ polling.4 \ ppbus.4 \ ppc.4 \ ppi.4 \ psm.4 \ pst.4 \ pt.4 \ pts.4 \ pty.4 \ puc.4 \ ${_qlxgb.4} \ ral.4 \ random.4 \ rc.4 \ re.4 \ rgephy.4 \ rl.4 \ rndtest.4 \ route.4 \ rp.4 \ rue.4 \ rum.4 \ run.4 \ runfw.4 \ sa.4 \ safe.4 \ sbp.4 \ sbp_targ.4 \ scc.4 \ scd.4 \ sched_4bsd.4 \ sched_ule.4 \ screen.4 \ scsi.4 \ sctp.4 \ sdhci.4 \ sem.4 \ send.4 \ ses.4 \ sf.4 \ ${_sfxge.4} \ sge.4 \ si.4 \ siba.4 \ siftr.4 \ siis.4 \ simplebus.4 \ sio.4 \ sis.4 \ sk.4 \ smb.4 \ smbus.4 \ smp.4 \ sn.4 \ snd_ad1816.4 \ snd_als4000.4 \ snd_atiixp.4 \ snd_cmi.4 \ snd_cs4281.4 \ snd_csa.4 \ snd_ds1.4 \ snd_emu10k1.4 \ snd_emu10kx.4 \ snd_envy24.4 \ snd_envy24ht.4 \ snd_es137x.4 \ snd_ess.4 \ snd_fm801.4 \ snd_gusc.4 \ snd_hda.4 \ snd_hdspe.4 \ snd_ich.4 \ snd_maestro3.4 \ snd_maestro.4 \ snd_mss.4 \ snd_neomagic.4 \ snd_sbc.4 \ snd_solo.4 \ snd_spicds.4 \ snd_t4dwave.4 \ snd_uaudio.4 \ snd_via8233.4 \ snd_via82c686.4 \ snd_vibes.4 \ snp.4 \ spic.4 \ ${_spkr.4} \ splash.4 \ sppp.4 \ ste.4 \ stf.4 \ stg.4 \ stge.4 \ sym.4 \ syncache.4 \ syncer.4 \ syscons.4 \ sysmouse.4 \ tap.4 \ targ.4 \ tcp.4 \ tdfx.4 \ terasic_mtl.4 \ termios.4 \ textdump.4 \ ti.4 \ timecounters.4 \ tl.4 \ tnt4882.4 \ ${_tpm.4} \ trm.4 \ tty.4 \ tun.4 \ twa.4 \ twe.4 \ tws.4 \ tx.4 \ txp.4 \ u3g.4 \ uark.4 \ uart.4 \ uath.4 \ ubsa.4 \ ubsec.4 \ ubser.4 \ ubtbcmfw.4 \ uchcom.4 \ ucom.4 \ ucycom.4 \ udav.4 \ udbp.4 \ udp.4 \ uep.4 \ ufm.4 \ ufoma.4 \ uftdi.4 \ ugen.4 \ uhci.4 \ uhid.4 \ uhso.4 \ uipaq.4 \ ukbd.4 \ ulpt.4 \ umass.4 \ umcs.4 \ umct.4 \ umodem.4 \ ums.4 \ unix.4 \ upgt.4 \ uplcom.4 \ ural.4 \ urio.4 \ ${_urtw.4} \ usb.4 \ usb_quirk.4 \ uslcom.4 \ utopia.4 \ uvisor.4 \ uvscom.4 \ vale.4 \ vga.4 \ vge.4 \ viapm.4 \ ${_viawd.4} \ ${_virtio.4} \ ${_virtio_balloon.4} \ ${_virtio_blk.4} \ ${_virtio_scsi.4} \ vkbd.4 \ vlan.4 \ vpo.4 \ vr.4 \ vte.4 \ ${_vtnet.4} \ ${_vxge.4} \ watchdog.4 \ wb.4 \ ${_wbwd.4} \ wi.4 \ witness.4 \ wlan.4 \ wlan_acl.4 \ wlan_amrr.4 \ wlan_ccmp.4 \ wlan_tkip.4 \ wlan_wep.4 \ wlan_xauth.4 \ ${_wpi.4} \ xe.4 \ ${_xen.4} \ xhci.4 \ xl.4 \ ${_xnb.4} \ xpt.4 \ zero.4 \ zyd.4 MLINKS= ae.4 if_ae.4 MLINKS+=age.4 if_age.4 MLINKS+=agp.4 agpgart.4 MLINKS+=alc.4 if_alc.4 MLINKS+=ale.4 if_ale.4 MLINKS+=altera_sdcard.4 altera_sdcardc.4 MLINKS+=altq.4 ALTQ.4 MLINKS+=ath.4 if_ath.4 MLINKS+=ath_pci.4 if_ath_pci.4 MLINKS+=an.4 if_an.4 MLINKS+=aue.4 if_aue.4 MLINKS+=axe.4 if_axe.4 MLINKS+=bce.4 if_bce.4 MLINKS+=bfe.4 if_bfe.4 MLINKS+=bge.4 if_bge.4 MLINKS+=bktr.4 brooktree.4 MLINKS+=bridge.4 if_bridge.4 MLINKS+=bwi.4 if_bwi.4 MLINKS+=bwn.4 if_bwn.4 MLINKS+=${_bxe.4} ${_if_bxe.4} MLINKS+=cas.4 if_cas.4 MLINKS+=cdce.4 if_cdce.4 MLINKS+=crypto.4 cryptodev.4 MLINKS+=cue.4 if_cue.4 MLINKS+=cxgb.4 if_cxgb.4 MLINKS+=cxgbe.4 if_cxgbe.4 MLINKS+=dc.4 if_dc.4 MLINKS+=de.4 if_de.4 MLINKS+=disc.4 if_disc.4 MLINKS+=ed.4 if_ed.4 MLINKS+=edsc.4 if_edsc.4 MLINKS+=ef.4 if_ef.4 MLINKS+=em.4 if_em.4 MLINKS+=en.4 if_en.4 MLINKS+=enc.4 if_enc.4 MLINKS+=epair.4 if_epair.4 MLINKS+=et.4 if_et.4 MLINKS+=faith.4 if_faith.4 MLINKS+=fatm.4 if_fatm.4 MLINKS+=fd.4 stderr.4 \ fd.4 stdin.4 \ fd.4 stdout.4 MLINKS+=fdt.4 FDT.4 MLINKS+=firewire.4 ieee1394.4 MLINKS+=fpa.4 fea.4 MLINKS+=fwe.4 if_fwe.4 MLINKS+=fwip.4 if_fwip.4 MLINKS+=fxp.4 if_fxp.4 MLINKS+=gem.4 if_gem.4 MLINKS+=geom.4 GEOM.4 MLINKS+=gif.4 if_gif.4 MLINKS+=gre.4 if_gre.4 MLINKS+=hatm.4 if_hatm.4 MLINKS+=hme.4 if_hme.4 MLINKS+=hpet.4 acpi_hpet.4 MLINKS+=${_hptrr.4} ${_rr232x.4} MLINKS+=${_attimer.4} ${_i8254.4} MLINKS+=igb.4 if_igb.4 MLINKS+=ip.4 rawip.4 MLINKS+=ipfirewall.4 ipaccounting.4 \ ipfirewall.4 ipacct.4 \ ipfirewall.4 ipfw.4 MLINKS+=ipw.4 if_ipw.4 MLINKS+=iwi.4 if_iwi.4 MLINKS+=iwn.4 if_iwn.4 MLINKS+=ixgb.4 if_ixgb.4 MLINKS+=ixgbe.4 if_ixgbe.4 MLINKS+=jme.4 if_jme.4 MLINKS+=kue.4 if_kue.4 MLINKS+=lagg.4 trunk.4 MLINKS+=lagg.4 if_lagg.4 MLINKS+=le.4 if_le.4 MLINKS+=lge.4 if_lge.4 MLINKS+=lmc.4 if_lmc.4 MLINKS+=lo.4 loop.4 MLINKS+=lp.4 plip.4 MLINKS+=malo.4 if_malo.4 MLINKS+=md.4 vn.4 MLINKS+=mem.4 kmem.4 MLINKS+=mn.4 if_mn.4 MLINKS+=mos.4 if_mos.4 MLINKS+=msk.4 if_msk.4 MLINKS+=mwl.4 if_mwl.4 MLINKS+=mxge.4 if_mxge.4 MLINKS+=my.4 if_my.4 MLINKS+=${_ndis.4} ${_if_ndis.4} MLINKS+=netintro.4 net.4 \ netintro.4 networking.4 MLINKS+=${_nfe.4} ${_if_nfe.4} MLINKS+=nge.4 if_nge.4 MLINKS+=${_nve.4} ${_if_nve.4} MLINKS+=${_nxge.4} ${_if_nxge.4} MLINKS+=patm.4 if_patm.4 MLINKS+=pccbb.4 cbb.4 MLINKS+=pcm.4 snd.4 \ pcm.4 sound.4 MLINKS+=pcn.4 if_pcn.4 MLINKS+=ral.4 if_ral.4 MLINKS+=re.4 if_re.4 MLINKS+=rl.4 if_rl.4 MLINKS+=rue.4 if_rue.4 MLINKS+=rum.4 if_rum.4 MLINKS+=run.4 if_run.4 MLINKS+=scsi.4 CAM.4 \ scsi.4 cam.4 \ scsi.4 scbus.4 \ scsi.4 SCSI.4 MLINKS+=sf.4 if_sf.4 MLINKS+=sge.4 if_sge.4 MLINKS+=sis.4 if_sis.4 MLINKS+=sk.4 if_sk.4 MLINKS+=smp.4 SMP.4 MLINKS+=sn.4 if_sn.4 MLINKS+=snd_envy24.4 snd_ak452x.4 MLINKS+=snd_sbc.4 snd_sb16.4 \ snd_sbc.4 snd_sb8.4 MLINKS+=${_spkr.4} ${_speaker.4} MLINKS+=splash.4 screensaver.4 MLINKS+=ste.4 if_ste.4 MLINKS+=stf.4 if_stf.4 MLINKS+=stge.4 if_stge.4 MLINKS+=syncache.4 syncookies.4 MLINKS+=syscons.4 sc.4 MLINKS+=tap.4 if_tap.4 MLINKS+=tdfx.4 tdfx_linux.4 MLINKS+=ti.4 if_ti.4 MLINKS+=tl.4 if_tl.4 MLINKS+=tun.4 if_tun.4 MLINKS+=tx.4 if_tx.4 MLINKS+=txp.4 if_txp.4 MLINKS+=u3g.4 u3gstub.4 MLINKS+=uath.4 if_uath.4 MLINKS+=udav.4 if_udav.4 MLINKS+=upgt.4 if_upgt.4 MLINKS+=ural.4 if_ural.4 MLINKS+=${_urtw.4} ${_if_urtw.4} MLINKS+=vge.4 if_vge.4 MLINKS+=vlan.4 if_vlan.4 MLINKS+=vpo.4 imm.4 MLINKS+=vr.4 if_vr.4 MLINKS+=vte.4 if_vte.4 MLINKS+=${_vtnet.4} ${_if_vtnet.4} MLINKS+=${_vxge.4} ${_if_vxge.4} MLINKS+=watchdog.4 SW_WATCHDOG.4 MLINKS+=wb.4 if_wb.4 MLINKS+=wi.4 if_wi.4 MLINKS+=${_wpi.4} ${_if_wpi.4} MLINKS+=xe.4 if_xe.4 MLINKS+=xl.4 if_xl.4 MLINKS+=zyd.4 if_zyd.4 .if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" _acpi_asus.4= acpi_asus.4 _acpi_asus_wmi.4= acpi_asus_wmi.4 _acpi_dock.4= acpi_dock.4 _acpi_fujitsu.4=acpi_fujitsu.4 _acpi_hp.4= acpi_hp.4 _acpi_ibm.4= acpi_ibm.4 _acpi_panasonic.4=acpi_panasonic.4 _acpi_sony.4= acpi_sony.4 _acpi_toshiba.4=acpi_toshiba.4 _acpi_wmi.4= acpi_wmi.4 _aesni.4= aesni.4 _aout.4= aout.4 _apic.4= apic.4 _atrtc.4= atrtc.4 _attimer.4= attimer.4 _aibs.4= aibs.4 _amdsbwd.4= amdsbwd.4 _amdsmb.4= amdsmb.4 _amdtemp.4= amdtemp.4 _asmc.4= asmc.4 _atp.4= atp.4 _bxe.4= bxe.4 _coretemp.4= coretemp.4 _cpuctl.4= cpuctl.4 _dpms.4= dpms.4 _hpt27xx.4= hpt27xx.4 _hptiop.4= hptiop.4 _hptmv.4= hptmv.4 _hptrr.4= hptrr.4 _i8254.4= i8254.4 _ichwd.4= ichwd.4 _if_bxe.4= if_bxe.4 _if_ndis.4= if_ndis.4 _if_nfe.4= if_nfe.4 _if_nve.4= if_nve.4 _if_nxge.4= if_nxge.4 _if_urtw.4= if_urtw.4 _if_vtnet.4= if_vtnet.4 _if_vxge.4= if_vxge.4 _if_wpi.4= if_wpi.4 _ipmi.4= ipmi.4 _io.4= io.4 _lindev.4= lindev.4 _linux.4= linux.4 _ndis.4= ndis.4 _nfe.4= nfe.4 _nfsmb.4= nfsmb.4 _nvd.4= nvd.4 _nve.4= nve.4 _nvme.4= nvme.4 _nvram.4= nvram.4 _nxge.4= nxge.4 _virtio.4= virtio.4 _virtio_balloon.4=virtio_balloon.4 _virtio_blk.4= virtio_blk.4 _virtio_scsi.4= virtio_scsi.4 _vtnet.4= vtnet.4 _vxge.4= vxge.4 _padlock.4= padlock.4 _rr232x.4= rr232x.4 _speaker.4= speaker.4 _spkr.4= spkr.4 _tpm.4= tpm.4 _urtw.4= urtw.4 _viawd.4= viawd.4 _wbwd.4= wbwd.4 _wpi.4= wpi.4 _xen.4= xen.4 _xnb.4= xnb.4 MLINKS+=lindev.4 full.4 .endif .if ${MACHINE_CPUARCH} == "amd64" _bhyve.4= bhyve.4 _qlxgb.4= qlxgb.4 _sfxge.4= sfxge.4 MLINKS+=qlxgb.4 if_qlxgb.4 MLINKS+=sfxge.4 if_sfxge.4 .endif .if ${MACHINE_CPUARCH} == "powerpc" _atp.4= atp.4 .endif .if ${MACHINE_CPUARCH} == "mips" _nvram2env.4= nvram2env.4 .endif .if exists(${.CURDIR}/man4.${MACHINE_CPUARCH}) SUBDIR= man4.${MACHINE_CPUARCH} .endif .if ${MK_ATF} != "no" ATF= ${.CURDIR}/../../../contrib/atf .PATH: ${ATF}/doc _atf_test_case.4= atf-test-case.4 .endif .if ${MK_PF} != "no" _pf.4= pf.4 _pflog.4= pflog.4 _pfsync.4= pfsync.4 .endif .include Index: head/share/man/man4/ata.4 =================================================================== --- head/share/man/man4/ata.4 (revision 249082) +++ head/share/man/man4/ata.4 (revision 249083) @@ -1,280 +1,273 @@ .\" Copyright (c) 2011 Alexander Motin .\" 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. .\" 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. .\" .\" 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. .\" .\" $FreeBSD$ .\" .Dd October 3, 2012 .Dt ATA 4 .Os .Sh NAME .Nm ata .Nd generic ATA/SATA controller driver .Sh SYNOPSIS To compile this driver into the kernel, place the following lines in your 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, place some of the following lines in .Xr loader.conf 5 : .Bd -literal -offset indent ata_load="YES" atacard_load="YES" ataisa_load="YES" atapci_load="YES" ataacard_load="YES" ataacerlabs_load="YES" ataadaptec_load="YES" ataahci_load="YES" ataamd_load="YES" ataati_load="YES" atacenatek_load="YES" atacypress_load="YES" atacyrix_load="YES" atahighpoint_load="YES" ataintel_load="YES" ataite_load="YES" atajmicron_load="YES" atamarvell_load="YES" atamicron_load="YES" atanational_load="YES" atanetcell_load="YES" atanvidia_load="YES" atapromise_load="YES" ataserverworks_load="YES" atasiliconimage_load="YES" atasis_load="YES" atavia_load="YES" .Ed .Pp The first line is for the common hardware independent code, and is a 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 : .Bl -ohang .It Va hw.ahci.force set to nonzero value for forcing drivers to attach to some known AHCI-capable chips even if they are configured for legacy IDE emulation (the default is 1, force the attach). .It Va hw.ata.ata_dma_check_80pin set to 0 to disable the 80pin cable check (the default is 1, check the cable). .It Va hint.atapci.X.msi set to 1 to allow Message Signalled Interrupts (MSI) to be used by the specified PCI ATA controller, if supported. .It Va hint.ata.X.devX.mode limits the initial ATA mode for the specified device on the specified channel. .It Va hint.ata.X.mode limits the initial ATA mode for every device on the specified channel. .It Va hint.ata.X.pm_level controls SATA interface Power Management for the specified channel, allowing some power savings at the cost of additional command latency. Possible values: .Pp .Bl -tag -width 4n -offset indent -compact .It 0 Interface Power Management is disabled. This is the default value. .It 1 The device is allowed to initiate a PM state change; the host is passive. .It 2 The host initiates a PARTIAL PM state transition every time a port becomes idle. .It 3 host initiates SLUMBER PM state transition every time port becomes idle. .El .Pp Modes 2 and 3 are only supported for AHCI. .It Va hint.ata. Ns Ar X Ns Va .dev Ns Ar X Ns Va .sata_rev limits the initial SATA revision (speed) for the specified device on the specified channel. Values 1, 2 and 3 are respectively 1.5, 3 and 6Gbps. .It Va hint.ata. Ns Ar X Ns Va .sata_rev Same, but for every device on the specified channel. .El .Sh DESCRIPTION The .Nm driver gives the .Xr CAM 4 subsystem access to the ATA (IDE) and SATA ports of many generic controllers. Depending on the controller, each PATA (IDE) port or each one or two SATA ports are represented to CAM as a separate bus with one or two targets. Most of the bus-management details are handled by the ATA/SATA-specific transport of CAM. Connected ATA disks are handled by the ATA protocol disk peripheral driver .Xr ada 4 . ATAPI devices are handled by the SCSI protocol peripheral drivers .Xr cd 4 , .Xr da 4 , .Xr sa 4 , etc. .Pp This driver supports ATA, and for the most of controllers, ATAPI devices. Command queuing and SATA port multipliers are not supported. Device hot-plug and SATA interface power management is supported only on some controllers. .Pp The .Nm driver can change the transfer mode when the system is up and running. See the .Cm negotiate subcommand of .Xr camcontrol 8 . .Pp The .Nm driver sets the maximum transfer mode supported by the hardware as default. However, the .Nm driver sometimes warns: .Dq Sy "DMA limited to UDMA33, non-ATA66 cable or device". This means that the .Nm driver has detected that the required 80 conductor cable is not present or could not be detected properly, or that one of the devices on the channel only accepts up to UDMA2/ATA33. The .Va hw.ata.ata_dma_check_80pin tunable can be set to 0 to disable this check. .Sh HARDWARE The currently supported ATA/SATA controller chips are: .Pp .Bl -tag -width "Silicon Image:" -compact .It Acard: ATP850P, ATP860A, ATP860R, ATP865A, ATP865R. .It ALI: M5228, M5229, M5281, M5283, M5287, M5288, M5289. .It AMD: AMD756, AMD766, AMD768, AMD8111, CS5536. .It ATI: IXP200, IXP300, IXP400, IXP600, IXP700, IXP800. .It CMD: CMD646, CMD646U2, CMD648, CMD649. .It Cypress: Cypress 82C693. .It Cyrix: Cyrix 5530. .It HighPoint: HPT302, HPT366, HPT368, HPT370, HPT371, HPT372, HPT372N, HPT374. .It Intel: 6300ESB, 31244, PIIX, PIIX3, PIIX4, ESB2, ICH, ICH0, ICH2, ICH3, ICH4, ICH5, ICH6, ICH7, ICH8, ICH9, ICH10, SCH, PCH. .It ITE: IT8211F, IT8212F, IT8213F. .It JMicron: JMB360, JMB361, JMB363, JMB365, JMB366, JMB368. .It Marvell 88SX5040, 88SX5041, 88SX5080, 88SX5081, 88SX6041, 88SX6042, 88SX6081, 88SE6101, 88SE6102, 88SE6111, 88SE6121, 88SE6141, 88SE6145, 88SX7042. .It National: SC1100. .It NetCell: NC3000, NC5000. .It nVidia: nForce, nForce2, nForce2 MCP, nForce3, nForce3 MCP, nForce3 Pro, nForce4, MCP51, MCP55, MCP61, MCP65, MCP67, MCP73, MCP77, MCP79, MCP89. .It Promise: PDC20246, PDC20262, PDC20263, PDC20265, PDC20267, PDC20268, PDC20269, PDC20270, PDC20271, PDC20275, PDC20276, PDC20277, PDC20318, PDC20319, PDC20371, PDC20375, PDC20376, PDC20377, PDC20378, PDC20379, PDC20571, PDC20575, PDC20579, PDC20580, PDC20617, PDC20618, PDC20619, PDC20620, PDC20621, PDC20622, PDC40518, PDC40519, PDC40718, PDC40719. .It ServerWorks: HT1000, ROSB4, CSB5, CSB6, K2, Frodo4, Frodo8. .It Silicon Image: SiI0680, SiI3112, SiI3114, SiI3124, SiI3132, SiI3512. .It SiS: SIS180, SIS181, SIS182, SIS5513, SIS530, SIS540, SIS550, SIS620, SIS630, SIS630S, SIS633, SIS635, SIS730, SIS733, SIS735, SIS745, SIS961, SIS962, SIS963, SIS964, SIS965. .It VIA: VT6410, VT6420, VT6421, VT82C586, VT82C586B, VT82C596, VT82C596B, VT82C686, VT82C686A, VT82C686B, VT8231, VT8233, VT8233A, VT8233C, VT8235, VT8237, VT8237A, VT8237S, VT8251, CX700, VX800, VX855, VX900. .El .Pp Some of above chips are also supported by the more featured .Xr ahci 4 , .Xr mvs 4 , and .Xr siis 4 drivers. If both drivers are loaded at the same time, those will have precedence. .Pp Unknown ATA chipsets are supported in PIO modes, and if the standard busmaster DMA registers are present and contain valid setup, DMA is also enabled, although the max mode is limited to UDMA33, as it is not known what the chipset can do and how to program it. .Sh NOTES Please remember that in order to use UDMA4/ATA66 and above modes you .Em must use 80 conductor cables. Please assure that ribbon cables are no longer than 45cm. In case of rounded ATA cables, the length depends on the quality of the cables. SATA cables can be up to 1m long according to the specification. External SATA cables can be 2m long and more, but not all controllers work well on long cables, especially at high speeds. .Sh SEE ALSO .Xr ada 4 , .Xr ahci 4 , .Xr cam 4 , .Xr camcontrol 8 , .Xr cd 4 , .Xr mvs 4 , .Xr siis 4 .Sh HISTORY The .Nm driver first appeared in .Fx 4.0 . It was turned into a .Xr CAM 4 interface module in .Fx 9.0 . .Sh AUTHORS .An Alexander Motin .Aq mav@FreeBSD.org , .An S\(/oren Schmidt .Aq sos@FreeBSD.org Index: head/sys/amd64/conf/GENERIC =================================================================== --- head/sys/amd64/conf/GENERIC (revision 249082) +++ head/sys/amd64/conf/GENERIC (revision 249083) @@ -1,344 +1,343 @@ # # GENERIC -- Generic kernel configuration file for FreeBSD/amd64 # # For more information on this file, please read the config(5) manual page, # and/or 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. # # $FreeBSD$ cpu HAMMER ident GENERIC makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols makeoptions WITH_CTF=1 # Run ctfconvert(1) for DTrace support options SCHED_ULE # ULE scheduler options PREEMPTION # Enable kernel thread preemption options INET # InterNETworking options INET6 # IPv6 communications protocols options TCP_OFFLOAD # TCP offload options SCTP # Stream Control Transmission Protocol options FFS # Berkeley Fast Filesystem 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 QUOTA # Enable disk quotas for UFS options MD_ROOT # MD is a potential root device options NFSCL # New Network Filesystem Client options NFSD # New Network Filesystem Server options NFSLOCKD # Network Lock Manager options NFS_ROOT # NFS usable as /, requires NFSCL options MSDOSFS # MSDOS Filesystem options CD9660 # ISO 9660 Filesystem options PROCFS # Process filesystem (requires PSEUDOFS) options PSEUDOFS # Pseudo-filesystem framework options GEOM_PART_GPT # GUID Partition Tables. options GEOM_RAID # Soft RAID functionality. options GEOM_LABEL # Provides labelization options COMPAT_FREEBSD32 # Compatible with i386 binaries 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 options SYSVMSG # SYSV-style message queues options SYSVSEM # SYSV-style semaphores options _KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time extensions options PRINTF_BUFR_SIZE=128 # Prevent printf output being interspersed. options KBD_INSTALL_CDEV # install a CDEV entry in /dev options HWPMC_HOOKS # Necessary kernel hooks for hwpmc(4) options AUDIT # Security event auditing options CAPABILITY_MODE # Capsicum capability mode options CAPABILITIES # Capsicum capabilities options MAC # TrustedBSD MAC Framework options KDTRACE_FRAME # Ensure frames are compiled in options KDTRACE_HOOKS # Kernel DTrace hooks options DDB_CTF # Kernel ELF linker loads CTF data options INCLUDE_CONFIG_FILE # Include this file in kernel # Debugging support. Always need this: options KDB # Enable kernel debugger support. # For minimum debugger support (stable branch) use: #options KDB_TRACE # Print a stack trace for a panic. # For full debugger support use this instead: options DDB # Support DDB. options GDB # Support remote GDB. options DEADLKRES # Enable the deadlock resolver options INVARIANTS # Enable calls of extra sanity checking options INVARIANT_SUPPORT # Extra sanity checks of internal structures, required by INVARIANTS options WITNESS # Enable checks to detect deadlocks and cycles options WITNESS_SKIPSPIN # Don't run witness on spinlocks for speed options MALLOC_DEBUG_MAXZONES=8 # Separate malloc(9) zones # Make an SMP-capable kernel by default options SMP # Symmetric MultiProcessor Kernel # CPU frequency control device cpufreq # Bus support. device acpi device pci # Floppy drives 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 # SCSI Controllers device ahc # AHA2940 and onboard AIC7xxx devices options AHC_REG_PRETTY_PRINT # Print register bitfields in debug # output. Adds ~128k to driver. device ahd # AHA39320/29320 and onboard AIC79xx devices options AHD_REG_PRETTY_PRINT # Print register bitfields in debug # output. Adds ~215k to driver. device esp # AMD Am53C974 (Tekram DC-390(T)) device hptiop # Highpoint RocketRaid 3xxx series device isp # Qlogic family #device ispfw # Firmware for QLogic HBAs- normally a module device mpt # LSI-Logic MPT-Fusion device mps # LSI-Logic MPT-Fusion 2 #device ncr # NCR/Symbios Logic device sym # NCR/Symbios Logic (newer chipsets + those of `ncr') device trm # Tekram DC395U/UW/F DC315U adapters device adv # Advansys SCSI adapters device adw # Advansys wide SCSI adapters device aic # Adaptec 15[012]x SCSI adapters, AIC-6[23]60. device bt # Buslogic/Mylex MultiMaster SCSI adapters device isci # Intel C600 SAS controller # ATA/SCSI peripherals device scbus # SCSI bus (required for ATA/SCSI) device ch # SCSI media changers device da # Direct Access (disks) device sa # Sequential Access (tape etc) device cd # CD device pass # Passthrough device (direct ATA/SCSI access) device ses # Enclosure Services (SES and SAF-TE) device ctl # CAM Target Layer options CTL_DISABLE # Disable CTL by default to save memory. # Re-enable with kern.cam.ctl.disable=0 in # /boot/loader.conf # RAID controllers interfaced to the SCSI subsystem device amr # AMI MegaRAID device arcmsr # Areca SATA II RAID #XXX it is not 64-bit clean, -scottl #device asr # DPT SmartRAID V, VI and Adaptec SCSI RAID device ciss # Compaq Smart RAID 5* device dpt # DPT Smartcache III, IV - See NOTES for options device hptmv # Highpoint RocketRAID 182x device hptrr # Highpoint RocketRAID 17xx, 22xx, 23xx, 25xx device hpt27xx # Highpoint RocketRAID 27xx device iir # Intel Integrated RAID device ips # IBM (Adaptec) ServeRAID device mly # Mylex AcceleRAID/eXtremeRAID device twa # 3ware 9000 series PATA/SATA RAID device tws # LSI 3ware 9750 SATA+SAS 6Gb/s RAID controller # RAID controllers device aac # Adaptec FSA RAID device aacp # SCSI passthrough for aac (requires CAM) device ida # Compaq Smart RAID device mfi # LSI MegaRAID SAS device mlx # Mylex DAC960 family #XXX pointer/int warnings #device pst # Promise Supertrak SX6000 device twe # 3ware ATA RAID # 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 options VESA # Add support for VESA BIOS Extensions (VBE) device splash # Splash screen and screen saver support # syscons is the default console driver, resembling an SCO console device sc options SC_PIXEL_MODE # add support for the raster text mode device agp # support several AGP chipsets # 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 ppi # Parallel port interface device #device vpo # Requires scbus and da device puc # Multi I/O cards and multi-channel UARTs # PCI Ethernet NICs. device bxe # Broadcom BCM57710/BCM57711/BCM57711E 10Gb Ethernet device de # DEC/Intel DC21x4x (``Tulip'') device em # Intel PRO/1000 Gigabit Ethernet Family device igb # Intel PRO/1000 PCIE Server Gigabit Family device ixgbe # Intel PRO/10GbE PCIE Ethernet Family device le # AMD Am7900 LANCE and Am79C9xx PCnet device ti # Alteon Networks Tigon I/II gigabit Ethernet device txp # 3Com 3cR990 (``Typhoon'') device vx # 3Com 3c590, 3c595 (``Vortex'') # PCI Ethernet NICs that use the common MII bus controller code. # NOTE: Be sure to keep the 'device miibus' line in order to use these NICs! device miibus # MII bus support device ae # Attansic/Atheros L2 FastEthernet device age # Attansic/Atheros L1 Gigabit Ethernet device alc # Atheros AR8131/AR8132 Ethernet device ale # Atheros AR8121/AR8113/AR8114 Ethernet device bce # Broadcom BCM5706/BCM5708 Gigabit Ethernet device bfe # Broadcom BCM440x 10/100 Ethernet device bge # Broadcom BCM570xx Gigabit Ethernet device cas # Sun Cassini/Cassini+ and NS DP83065 Saturn device dc # DEC/Intel 21143 and various workalikes device et # Agere ET1310 10/100/Gigabit Ethernet device fxp # Intel EtherExpress PRO/100B (82557, 82558) device gem # Sun GEM/Sun ERI/Apple GMAC device hme # Sun HME (Happy Meal Ethernet) device jme # JMicron JMC250 Gigabit/JMC260 Fast Ethernet device lge # Level 1 LXT1001 gigabit Ethernet device msk # Marvell/SysKonnect Yukon II Gigabit Ethernet device nfe # nVidia nForce MCP on-board Ethernet device nge # NatSemi DP83820 gigabit Ethernet #device nve # nVidia nForce MCP on-board Ethernet Networking device pcn # AMD Am79C97x PCI 10/100 (precedence over 'le') device re # RealTek 8139C+/8169/8169S/8110S device rl # RealTek 8129/8139 device sf # Adaptec AIC-6915 (``Starfire'') device sge # Silicon Integrated Systems SiS190/191 device sis # Silicon Integrated Systems SiS 900/SiS 7016 device sk # SysKonnect SK-984x & SK-982x gigabit Ethernet device ste # Sundance ST201 (D-Link DFE-550TX) device stge # Sundance/Tamarack TC9021 gigabit Ethernet device tl # Texas Instruments ThunderLAN device tx # SMC EtherPower II (83c170 ``EPIC'') device vge # VIA VT612x gigabit Ethernet device vr # VIA Rhine, Rhine II device wb # Winbond W89C840F device xl # 3Com 3c90x (``Boomerang'', ``Cyclone'') # ISA Ethernet NICs. pccard NICs included. device cs # Crystal Semiconductor CS89x0 NIC # 'device ed' requires 'device miibus' device ed # NE[12]000, SMC Ultra, 3c503, DS8390 cards device ex # Intel EtherExpress Pro/10 and Pro/10+ device ep # Etherlink III based cards device fe # Fujitsu MB8696x based cards device sn # SMC's 9000 series of Ethernet chips device xe # Xircom pccard Ethernet # Wireless NIC cards device wlan # 802.11 support options IEEE80211_DEBUG # enable debug msgs options IEEE80211_AMPDU_AGE # age frames in AMPDU reorder q's options IEEE80211_SUPPORT_MESH # enable 802.11s draft support device wlan_wep # 802.11 WEP support device wlan_ccmp # 802.11 CCMP support device wlan_tkip # 802.11 TKIP support device wlan_amrr # AMRR transmit rate control algorithm device an # Aironet 4500/4800 802.11 wireless NICs. device ath # Atheros NICs device ath_pci # Atheros pci/cardbus glue device ath_hal # pci/cardbus chip support options AH_SUPPORT_AR5416 # enable AR5416 tx/rx descriptors options AH_AR5416_INTERRUPT_MITIGATION # AR5416 interrupt mitigation options ATH_ENABLE_11N # Enable 802.11n support for AR5416 and later device ath_rate_sample # SampleRate tx rate control for ath #device bwi # Broadcom BCM430x/BCM431x wireless NICs. #device bwn # Broadcom BCM43xx wireless NICs. device ipw # Intel 2100 wireless NICs. device iwi # Intel 2200BG/2225BG/2915ABG wireless NICs. device iwn # Intel 4965/1000/5000/6000 wireless NICs. device malo # Marvell Libertas wireless NICs. device mwl # Marvell 88W8363 802.11n wireless NICs. device ral # Ralink Technology RT2500 wireless NICs. device wi # WaveLAN/Intersil/Symbol 802.11 wireless NICs. device wpi # Intel 3945ABG wireless NICs. # Pseudo devices. device loop # Network loopback device random # Entropy device options PADLOCK_RNG # VIA Padlock RNG options RDRAND_RNG # Intel Bull Mountain RNG device ether # Ethernet support device vlan # 802.1Q VLAN support device tun # Packet tunnel. 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! # Note that 'bpf' is required for DHCP. device bpf # Berkeley packet filter # USB support options USB_DEBUG # enable debug msgs device uhci # UHCI PCI->USB interface device ohci # OHCI PCI->USB interface device ehci # EHCI PCI->USB interface (USB 2.0) device xhci # XHCI PCI->USB interface (USB 3.0) device usb # USB Bus (required) device ukbd # Keyboard device umass # Disks/Mass storage - Requires scbus and da # Sound support device sound # Generic sound driver (required) device snd_cmi # CMedia CMI8338/CMI8738 device snd_csa # Crystal Semiconductor CS461x/428x device snd_emu10kx # Creative SoundBlaster Live! and Audigy device snd_es137x # Ensoniq AudioPCI ES137x device snd_hda # Intel High Definition Audio device snd_ich # Intel, NVidia and other ICH AC'97 Audio device snd_via8233 # VIA VT8233x Audio # MMC/SD device mmc # MMC/SD bus device mmcsd # MMC/SD memory card device sdhci # Generic PCI SD Host Controller # VirtIO support device virtio # Generic VirtIO bus (required) device virtio_pci # VirtIO PCI device device vtnet # VirtIO Ethernet device device virtio_blk # VirtIO Block device device virtio_scsi # VirtIO SCSI device device virtio_balloon # VirtIO Memory Balloon device Index: head/sys/arm/conf/AC100 =================================================================== --- head/sys/arm/conf/AC100 (revision 249082) +++ head/sys/arm/conf/AC100 (revision 249083) @@ -1,96 +1,95 @@ # # Custom kernel for Toshiba AC100 # # $FreeBSD$ # ident AC100 include "../tegra/std.tegra2" makeoptions MODULES_OVERRIDE="" makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols makeoptions WERROR="-Werror" #options SCHED_ULE #ULE scheduler options SCHED_4BSD #4BSD scheduler options INET #InterNETworking #options INET6 #IPv6 communications protocols options FFS #Berkeley Fast Filesystem #options NFSCL #Network Filesystem Client #options NFSLOCKD #Network Lock Manager #options NFS_ROOT #NFS usable as /, requires NFSCLIENT #options BOOTP #options BOOTP_NFSROOT #options BOOTP_NFSV3 #options BOOTP_WIRED_TO=mge0 options GEOM_PART_GPT options ROOTDEVNAME=\"ufs:/dev/da0p1\" options SYSVSHM #SYSV-style shared memory options SYSVMSG #SYSV-style message queues options SYSVSEM #SYSV-style semaphores options _KPOSIX_PRIORITY_SCHEDULING #Posix P1003_1B real-time extensions options MUTEX_NOINLINE options RWLOCK_NOINLINE options NO_FFS_SNAPSHOT options NO_SWAPPING #options SMP # Debugging options VERBOSE_SYSINIT #options ALT_BREAK_TO_DEBUGGER options DDB options GDB options DIAGNOSTIC options INVARIANTS #Enable calls of extra sanity checking options INVARIANT_SUPPORT #Extra sanity checks of internal structures, required by INVARIANTS options KDB options KDB_TRACE #options KTR #options KTR_VERBOSE=0 #options KTR_ENTRIES=16384 #options KTR_MASK=(KTR_SPARE2) #options KTR_COMPILE=KTR_ALL options WITNESS #Enable checks to detect deadlocks and cycles options WITNESS_SKIPSPIN #Don't run witness on spinlocks for speed #options WITNESS_KDB options MUTEX_DEBUG # Pseudo devices device random device pty device loop device md # USB #options USB_DEBUG # enable debug msgs #device usb #device ehci #device umass #device scbus #device pass #device da # SATA #device ata -#device atadisk #device mvs # Serial ports device uart # I2C (TWSI) #device iic #device iicbus #Network device ether #FDT options FDT options FDT_DTB_STATIC makeoptions FDT_DTS_FILE=tegra20-paz00.dts Index: head/sys/arm/conf/ARMADAXP =================================================================== --- head/sys/arm/conf/ARMADAXP (revision 249082) +++ head/sys/arm/conf/ARMADAXP (revision 249083) @@ -1,105 +1,104 @@ # # Custom kernel for Marvell Armada XP # # $FreeBSD$ # ident MV-88F78XX0 include "../mv/armadaxp/std.mv78x60" options SOC_MV_ARMADAXP makeoptions MODULES_OVERRIDE="" makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols makeoptions WERROR="-Werror" #options SCHED_ULE #ULE scheduler options SCHED_4BSD #4BSD scheduler options INET #InterNETworking options INET6 #IPv6 communications protocols options FFS #Berkeley Fast Filesystem options NFSCL #Network Filesystem Client options NFSLOCKD #Network Lock Manager options NFS_ROOT #NFS usable as /, requires NFSCLIENT options BOOTP options BOOTP_NFSROOT options BOOTP_NFSV3 options BOOTP_WIRED_TO=mge0 options GEOM_PART_GPT options ROOTDEVNAME=\"ufs:/dev/da0p1\" options SYSVSHM #SYSV-style shared memory options SYSVMSG #SYSV-style message queues options SYSVSEM #SYSV-style semaphores options _KPOSIX_PRIORITY_SCHEDULING #Posix P1003_1B real-time extensions options MUTEX_NOINLINE options RWLOCK_NOINLINE options NO_FFS_SNAPSHOT options NO_SWAPPING options SMP # Debugging #options VERBOSE_SYSINIT options ALT_BREAK_TO_DEBUGGER options DDB options GDB #options DIAGNOSTIC #options INVARIANTS #Enable calls of extra sanity checking #options INVARIANT_SUPPORT #Extra sanity checks of internal structures, required by INVARIANTS options KDB options KDB_TRACE #options KTR #options KTR_VERBOSE=0 #options KTR_ENTRIES=16384 #options KTR_MASK=(KTR_SPARE2) #options KTR_COMPILE=KTR_ALL #options WITNESS #Enable checks to detect deadlocks and cycles #options WITNESS_SKIPSPIN #Don't run witness on spinlocks for speed #options WITNESS_KDB # Pseudo devices device random device pty device loop device md # USB options USB_DEBUG # enable debug msgs device usb device ehci device umass device scbus device pass device da # SATA device ata -device atadisk #device mvs # Serial ports device uart # I2C (TWSI) device iic device iicbus #Network device ether device mge # Marvell Gigabit Ethernet controller device mii device e1000phy device bpf options HZ=1000 options DEVICE_POLLING device vlan #PCI/PCIE device pci #FDT options FDT options FDT_DTB_STATIC makeoptions FDT_DTS_FILE=db78460.dts Index: head/sys/arm/conf/AVILA =================================================================== --- head/sys/arm/conf/AVILA (revision 249082) +++ head/sys/arm/conf/AVILA (revision 249083) @@ -1,157 +1,156 @@ # AVILA -- Gateworks Avila XScale board # kernel configuration file for FreeBSD/arm # # 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. # # $FreeBSD$ ident AVILA include "../xscale/ixp425/std.ixp425" # NB: memory mapping is defined in std.avila include "../xscale/ixp425/std.avila" options XSCALE_CACHE_READ_WRITE_ALLOCATE #options ARM_USE_SMALL_ALLOC #To statically compile in device wiring instead of /boot/device.hints hints "AVILA.hints" #Default places to look for devices. makeoptions MODULES_OVERRIDE="" makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols makeoptions CONF_CFLAGS=-mcpu=xscale #options HZ=1000 options HZ=100 options DEVICE_POLLING # Debugging for use in -current options KDB #options GDB options DDB #Enable the kernel debugger #options DEADLKRES #Enable the deadlock resolver options INVARIANTS #Enable calls of extra sanity checking options INVARIANT_SUPPORT #Extra sanity checks of internal structures, required by INVARIANTS #options WITNESS #Enable checks to detect deadlocks and cycles #options WITNESS_SKIPSPIN #Don't run witness on spinlocks for speed #options DIAGNOSTIC options SCHED_4BSD #4BSD scheduler options INET #InterNETworking options FFS #Berkeley Fast Filesystem options SOFTUPDATES #Enable FFS soft updates support options NFSCL #New Network Filesystem Client options NFS_ROOT #NFS usable as /, requires NFSCL options BOOTP options BOOTP_NFSROOT options BOOTP_NFSV3 options BOOTP_WIRED_TO=npe0 #options BOOTP_WIRED_TO=ath0 #options BOOTP_WIRED_TO=rl0 options BOOTP_COMPAT #options PREEMPTION #options VERBOSE_SYSINIT # Hardware performance counters options HWPMC_HOOKS device hwpmc #device saarm device pci device uart device ixpwdog # watchdog timer device cfi # flash support device cfid # flash disk support device geom_redboot # redboot fis parser # I2C Bus device iicbus device iicbb device iic device ixpiic # I2C bus glue device ds1672 # DS1672 on I2C bus device ad7418 # AD7418 on I2C bus device avila_led device gpio device gpioled 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 device firmware device qmgr # Q Manager (required by npe) device mii # NB: required by npe device ether device bpf device loop device if_bridge device md device random # Entropy device # Wireless NIC cards device wlan # 802.11 support options IEEE80211_DEBUG options IEEE80211_SUPPORT_TDMA options IEEE80211_SUPPORT_MESH device wlan_wep # 802.11 WEP support device wlan_ccmp # 802.11 CCMP support device wlan_tkip # 802.11 TKIP support device wlan_xauth device ath # Atheros NICs device ath_pci # Atheros pci/cardbus glue options ATH_DEBUG options ATH_DIAGAPI #options ATH_TX99_DIAG device ath_rate_sample # SampleRate tx rate control for ath #options AH_DEBUG #options AH_ASSERT #device ath_ar5210 #device ath_ar5211 device ath_ar5212 device ath_rf2413 device ath_rf2417 device ath_rf2425 device ath_rf5111 device ath_rf5112 device ath_rf5413 # device ath_ar5416 options AH_SUPPORT_AR5416 device ath_ar9160 device ath_ar9280 device usb #options USB_DEBUG device ohci device ehci device umass device scbus # SCSI bus (required for ATA/SCSI) device da # Direct Access (disks) device pass # Passthrough device (direct ATA/SCSI access) #device ural #device zyd #device wlan_amrr Index: head/sys/arm/conf/CAMBRIA =================================================================== --- head/sys/arm/conf/CAMBRIA (revision 249082) +++ head/sys/arm/conf/CAMBRIA (revision 249083) @@ -1,151 +1,150 @@ # CAMBRIA -- Gateworks Cambria 235x boards # kernel configuration file for FreeBSD/arm # # 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. # # $FreeBSD$ ident CAMBRIA include "../xscale/ixp425/std.ixp435" # NB: memory mapping is defined in std.avila include "../xscale/ixp425/std.avila" options XSCALE_CACHE_READ_WRITE_ALLOCATE #options ARM_USE_SMALL_ALLOC #To statically compile in device wiring instead of /boot/device.hints hints "CAMBRIA.hints" # Default places to look for devices. makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols makeoptions CONF_CFLAGS=-mcpu=xscale makeoptions MODULES_OVERRIDE="" #options HZ=1000 options HZ=100 options DEVICE_POLLING # Debugging for use in -current options KDB #options GDB options DDB #Enable the kernel debugger #options DEADLKRES #Enable the deadlock resolver options INVARIANTS #Enable calls of extra sanity checking options INVARIANT_SUPPORT #Extra sanity checks of internal structures, required by INVARIANTS #options WITNESS #Enable checks to detect deadlocks and cycles #options WITNESS_SKIPSPIN #Don't run witness on spinlocks for speed #options DIAGNOSTIC options SCHED_4BSD #4BSD scheduler #options PREEMPTION options INET #InterNETworking options FFS #Berkeley Fast Filesystem options SOFTUPDATES #Enable FFS soft updates support options NFSCL #New Network Filesystem Client options NFS_ROOT #NFS usable as /, requires NFSCL options BOOTP options BOOTP_NFSROOT options BOOTP_NFSV3 options BOOTP_WIRED_TO=npe0 options BOOTP_COMPAT # Hardware performance counters options HWPMC_HOOKS device hwpmc #options VERBOSE_SYSINIT options VERBOSE_INIT_ARM #device saarm device pci device uart device ixpwdog # watchdog timer options IXP4XX_FLASH_SIZE=0x02000000 # stock 2358 comes w/ 32M device cfi # flash support device cfid # flash disk support device geom_redboot # redboot fis parser # I2C Bus device iicbus device iicbb device iic device ixpiic # I2C bus glue device ds1672 # DS1672 on I2C bus device ad7418 # AD7418 on I2C bus device cambria_fled # Font Panel LED on I2C bus device cambria_led # 8-LED latch device gpio device gpioled 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 device firmware device qmgr # Q Manager (required by npe) device mii # NB: required by npe device ether device bpf device loop device if_bridge device md device random # Entropy device # Wireless NIC cards device wlan # 802.11 support options IEEE80211_DEBUG options IEEE80211_SUPPORT_TDMA options IEEE80211_SUPPORT_MESH device wlan_wep # 802.11 WEP support device wlan_ccmp # 802.11 CCMP support device wlan_tkip # 802.11 TKIP support device wlan_xauth device ath # Atheros NICs device ath_pci # Atheros pci/cardbus glue options ATH_DEBUG options ATH_DIAGAPI options ATH_ENABLE_DFS options ATH_ENABLE_11N #options ATH_TX99_DIAG device ath_rate_sample # SampleRate tx rate control for ath options AH_DEBUG options AH_PRIVATE_DIAG options AH_SUPPORT_AR5416 # NB: for 11n descriptor format device ath_hal # NB: 2 USB 2.0 ports standard device usb options USB_EHCI_BIG_ENDIAN_DESC # handle big-endian byte order #options USB_DEBUG device ehci device umass device scbus # SCSI bus (required for ATA/SCSI) device da # Direct Access (disks) device pass # Passthrough device (direct ATA/SCSI access) #device ural #device zyd #device wlan_amrr Index: head/sys/arm/conf/CRB =================================================================== --- head/sys/arm/conf/CRB (revision 249082) +++ head/sys/arm/conf/CRB (revision 249083) @@ -1,113 +1,112 @@ # GENERIC -- Generic kernel configuration file for FreeBSD/arm # # 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. # # $FreeBSD$ ident CRB options PHYSADDR=0x00000000 options KERNPHYSADDR=0x00200000 options KERNVIRTADDR=0xc0200000 # Used in ldscript.arm options COUNTS_PER_SEC=400000000 options STARTUP_PAGETABLE_ADDR=0x00000000 include "../xscale/i8134x/std.crb" makeoptions MODULES_OVERRIDE="" #makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols makeoptions CONF_CFLAGS=-mcpu=xscale options HZ=100 options BREAK_TO_DEBUGGER #options DEVICE_POLLING options SCHED_4BSD #4BSD scheduler options INET #InterNETworking options INET6 #IPv6 communications protocols options FFS #Berkeley Fast Filesystem options SOFTUPDATES #Enable FFS soft updates support options UFS_ACL #Support for access control lists options UFS_DIRHASH #Improve performance on big directories options NFSCL #New Network Filesystem Client options NFSD #New Network Filesystem Server options NFSLOCKD #Network Lock Manager options NFS_ROOT #NFS usable as /, requires NFSCL #options MSDOSFS #MSDOS Filesystem options CD9660 #ISO 9660 Filesystem #options PROCFS #Process filesystem (requires PSEUDOFS) options PSEUDOFS #Pseudo-filesystem framework options SCSI_DELAY=5000 #Delay (in ms) before probing SCSI options KTRACE #ktrace(1) support options INTR_FILTER options SYSVSHM #SYSV-style shared memory 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 BOOTP options BOOTP_NFSROOT options BOOTP_NFSV3 options BOOTP_WIRED_TO=em0 options BOOTP_COMPAT #options PREEMPTION device loop device ether #device saarm device miibus device rl device em device uart device pci device ata -options ATA_CAM options ATA_STATIC_ID # Static device numbering device scbus # SCSI bus (required for ATA/SCSI) device cd # CD device da # Direct Access (disks) device pass # Passthrough device (direct ATA/SCSI access) device "7seg" # SCSI Controllers #options AHC_REG_PRETTY_PRINT # Print register bitfields in debug # output. Adds ~128k to driver. #options AHD_REG_PRETTY_PRINT # Print register bitfields in debug # output. Adds ~215k to driver. # Debugging for use in -current options KDB options DDB #Enable the kernel debugger #options DEADLKRES #Enable the deadlock resolver #options INVARIANTS #Enable calls of extra sanity checking #options INVARIANT_SUPPORT #Extra sanity checks of internal structures, required by INVARIANTS #options WITNESS #Enable checks to detect deadlocks and cycles #options WITNESS_SKIPSPIN #Don't run witness on spinlocks for speed #options DIAGNOSTIC # To make an SMP kernel, the next two are needed #options SMP # Symmetric MultiProcessor Kernel #options APIC_IO # Symmetric (APIC) I/O options XSCALE_CACHE_READ_WRITE_ALLOCATE device md device random # Entropy device device iopwdog options ARM_USE_SMALL_ALLOC # Floppy drives Index: head/sys/arm/conf/CUBIEBOARD =================================================================== --- head/sys/arm/conf/CUBIEBOARD (revision 249082) +++ head/sys/arm/conf/CUBIEBOARD (revision 249083) @@ -1,134 +1,133 @@ # CUBIEBOARD -- Custom configuration for the CUBIEBOARD ARM development # platform, check out http://www.cubieboard.org # # 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. # # $FreeBSD$ ident CUBIEBOARD include "../allwinner/std.a10" makeoptions MODULES_OVERRIDE="" makeoptions WITHOUT_MODULES="ahc" options HZ=100 options SCHED_4BSD #4BSD scheduler options INET #InterNETworking options INET6 #IPv6 communications protocols options FFS #Berkeley Fast Filesystem options SOFTUPDATES #Enable FFS soft updates support options UFS_ACL #Support for access control lists options UFS_DIRHASH #Improve performance on big directories options MSDOSFS #MSDOS Filesystem options CD9660 #ISO 9660 Filesystem options PROCFS #Process filesystem (requires PSEUDOFS) options PSEUDOFS #Pseudo-filesystem framework options COMPAT_43 #Compatible with BSD 4.3 [KEEP THIS!] options SCSI_DELAY=5000 #Delay (in ms) before probing SCSI options KTRACE #ktrace(1) support options SYSVSHM #SYSV-style shared memory 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 PREEMPTION options FREEBSD_BOOT_LOADER # Debugging makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols options BREAK_TO_DEBUGGER #options VERBOSE_SYSINIT #Enable verbose sysinit messages options KDB options DDB #Enable the kernel debugger options INVARIANTS #Enable calls of extra sanity checking options INVARIANT_SUPPORT #Extra sanity checks of internal structures, required by INVARIANTS options WITNESS #Enable checks to detect deadlocks and cycles options WITNESS_SKIPSPIN #Don't run witness on spinlocks for speed #options DIAGNOSTIC # NFS support #options NFSCL #options NFSSERVER #Network Filesystem Server #options NFSCLIENT #Network Filesystem Client # Uncomment this for NFS root #options NFS_ROOT #NFS usable as /, requires NFSCLIENT #options BOOTP_NFSROOT #options BOOTP_COMPAT #options BOOTP #options BOOTP_NFSV3 #options BOOTP_WIRED_TO=cpsw0 # MMC/SD/SDIO card slot support #device mmc # mmc/sd bus #device mmcsd # mmc/sd flash cards # Boot device is 2nd slice on MMC/SD card 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 device uart device uart_ns8250 device pty device snp device md device random # Entropy device # I2C support #device iicbus #device iic # GPIO device gpio device scbus # SCSI bus (required for SCSI) device da # Direct Access (disks) device pass # USB support device usb options USB_DEBUG #options USB_REQ_DEBUG #options USB_VERBOSE #device uhci #device ohci device ehci device umass # Ethernet device loop device ether device mii device smscphy #device cpsw device bpf # USB ethernet support, requires miibus device miibus # Flattened Device Tree options FDT options FDT_DTB_STATIC makeoptions FDT_DTS_FILE=cubieboard.dts Index: head/sys/arm/conf/EFIKA_MX =================================================================== --- head/sys/arm/conf/EFIKA_MX (revision 249082) +++ head/sys/arm/conf/EFIKA_MX (revision 249083) @@ -1,177 +1,176 @@ # Kernel configuration for Efika MX Smarttop/Smartbook boards # # For more information on this file, please read the config(5) manual page, # and/or 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. # # $FreeBSD$ ident EFIKA_MX include "../freescale/imx/std.imx" makeoptions WITHOUT_MODULES="ahc" makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols #options DEBUG options SCHED_4BSD # 4BSD scheduler #options PREEMPTION # Enable kernel thread preemption options INET # InterNETworking #options INET6 # IPv6 communications protocols #options SCTP # Stream Control Transmission Protocol options FFS # Berkeley Fast Filesystem 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 NFSCL # New Network Filesystem Client #options NFSD # New Network Filesystem Server options NFSLOCKD # Network Lock Manager options NFS_ROOT # NFS usable as /, requires NFSCL options MSDOSFS # MSDOS Filesystem options CD9660 # ISO 9660 Filesystem #options PROCFS # Process filesystem (requires PSEUDOFS) options PSEUDOFS # Pseudo-filesystem framework options TMPFS # TMP Memory Filesystem options GEOM_PART_GPT # GUID Partition Tables. options GEOM_LABEL # Provides labelization #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 SYSVSHM # SYSV-style shared memory options SYSVMSG # SYSV-style message queues options SYSVSEM # SYSV-style semaphores options _KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time extensions options INCLUDE_CONFIG_FILE # Include this file in kernel # required for netbooting #options BOOTP #options BOOTP_COMPAT #options BOOTP_NFSROOT #options BOOTP_NFSV3 #options BOOTP_WIRED_TO=ue0 # options ROOTDEVNAME=\"ufs:ada0s2a\" # kernel/memory size reduction #options MUTEX_NOINLINE #options NO_FFS_SNAPSHOT #options NO_SWAPPING #options NO_SYSCTL_DESCR #options RWLOCK_NOINLINE # Debugging support. Always need this: options KDB # Enable kernel debugger support. # For minimum debugger support (stable branch) use: #options KDB_TRACE # Print a stack trace for a panic. # For full debugger support use this instead: options DDB # Support DDB. #options GDB # Support remote GDB. options DEADLKRES # Enable the deadlock resolver options INVARIANTS # Enable calls of extra sanity checking options INVARIANT_SUPPORT # Extra sanity checks of internal structures, required by INVARIANTS options WITNESS # Enable checks to detect deadlocks and cycles # The `bpf' device enables the Berkeley Packet Filter. # Be aware of the administrative consequences of enabling this! # Note that 'bpf' is required for DHCP. device bpf # Berkeley packet filter # Pseudo devices. device loop # Network loopback device random # Entropy device device ether # Ethernet support #device vlan # 802.1Q VLAN support #device tun # Packet tunnel. #device md # Memory "disks" #device gif # IPv6 and IPv4 tunneling #device faith # IPv6-to-IPv4 relaying (translation) #device firmware # firmware assist module # Serial (COM) ports device uart # Multi-uart driver 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 device gpio device gpioled device fsliic device iic device iicbus # SCSI peripherals device scbus # SCSI bus (required for SCSI) device da # Direct Access (disks) device cd # CD device pass # Passthrough device (direct SCSI access) # USB support #options USB_DEBUG # enable debug msgs device ehci # OHCI USB interface device usb # USB Bus (required) device umass # Disks/Mass storage - Requires scbus and da device uhid # "Human Interface Devices" device u3g # USB Ethernet, requires miibus device miibus device aue # ADMtek USB Ethernet device axe # ASIX Electronics USB Ethernet device cdce # Generic USB over Ethernet device cue # CATC USB Ethernet device kue # Kawasaki LSI USB Ethernet device rue # RealTek RTL8150 USB Ethernet device udav # Davicom DM9601E USB # USB Wireless device rum # Ralink Technology RT2501USB wireless NICs # Watchdog timer. # WARNING: can't be disabled!!! device imxwdt # Watchdog # Wireless NIC cards device wlan # 802.11 support device wlan_wep # 802.11 WEP support device wlan_ccmp # 802.11 CCMP support device wlan_tkip # 802.11 TKIP support device wlan_amrr # AMRR transmit rate control algorithm # Flattened Device Tree options FDT options FDT_DTB_STATIC makeoptions FDT_DTS_FILE=efikamx.dts # NOTE: serial console will be disabled if syscons enabled # Uncomment following lines for framebuffer/syscons support device sc device kbdmux options SC_DFLT_FONT # compile font in makeoptions SC_DFLT_FONT=cp437 device ukbd # Allow keyboard like HIDs to control console device ums Index: head/sys/arm/conf/EP80219 =================================================================== --- head/sys/arm/conf/EP80219 (revision 249082) +++ head/sys/arm/conf/EP80219 (revision 249083) @@ -1,114 +1,113 @@ # EP80219 -- Custom kernel configuration file for FreeBSD/arm on the EP80219 # # 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. # # $FreeBSD$ ident EP80219 options PHYSADDR=0xa0000000 options KERNPHYSADDR=0xa0200000 options KERNVIRTADDR=0xc0200000 # Used in ldscript.arm options STARTUP_PAGETABLE_ADDR=0xa0000000 #options ARM32_NEW_VM_LAYOUT include "../xscale/i80321/std.ep80219" makeoptions MODULES_OVERRIDE="" makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols makeoptions CONF_CFLAGS=-mcpu=xscale options HZ=100 #options DEVICE_POLLING options SCHED_4BSD #4BSD scheduler options INET #InterNETworking #options INET6 #IPv6 communications protocols options FFS #Berkeley Fast Filesystem options SOFTUPDATES #Enable FFS soft updates support options UFS_ACL #Support for access control lists options UFS_DIRHASH #Improve performance on big directories options NFSCL #New Network Filesystem Client options NFSD #New Network Filesystem Server options NFSLOCKD #Network Lock Manager options NFS_ROOT #NFS usable as /, requires NFSCL #options MSDOSFS #MSDOS Filesystem options CD9660 #ISO 9660 Filesystem #options PROCFS #Process filesystem (requires PSEUDOFS) options PSEUDOFS #Pseudo-filesystem framework options SCSI_DELAY=5000 #Delay (in ms) before probing SCSI options KTRACE #ktrace(1) support options SYSVSHM #SYSV-style shared memory 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 GEOM_PART_GPT # GUID Partition Tables. options GEOM_LABEL # Providers labelization. options BOOTP options BOOTP_NFSROOT options BOOTP_NFSV3 options BOOTP_WIRED_TO=fxp0 options BOOTP_COMPAT #options PREEMPTION device loop device ether #device saarm device miibus device fxp device uart device pci device ata -options ATA_CAM options ATA_STATIC_ID # Static device numbering device scbus # SCSI bus (required for ATA/SCSI) device cd # CD device da # Direct Access (disks) device pass # Passthrough device (direct ATA/SCSI access) # SCSI Controllers device iopwdog # I80321 Watchdog device dma # I80321 DMA Controller # Debugging for use in -current options KDB options DDB #Enable the kernel debugger #options DEADLKRES #Enable the deadlock resolver #options INVARIANTS #Enable calls of extra sanity checking #options INVARIANT_SUPPORT #Extra sanity checks of internal structures, required by INVARIANTS #options WITNESS #Enable checks to detect deadlocks and cycles #options WITNESS_SKIPSPIN #Don't run witness on spinlocks for speed #options DIAGNOSTIC # To make an SMP kernel, the next two are needed #options SMP # Symmetric MultiProcessor Kernel #options APIC_IO # Symmetric (APIC) I/O options XSCALE_CACHE_READ_WRITE_ALLOCATE device md device random # Entropy device options ARM_USE_SMALL_ALLOC # Floppy drives options INCLUDE_CONFIG_FILE # Include this file in kernel #options VERBOSE_SYSINIT options VERBOSE_INIT_ARM device bpf #options ROOTDEVNAME=\"ufs:ada0s1a\" Index: head/sys/arm/conf/IQ31244 =================================================================== --- head/sys/arm/conf/IQ31244 (revision 249082) +++ head/sys/arm/conf/IQ31244 (revision 249083) @@ -1,113 +1,112 @@ # IQ31244 -- Custom kernel configuration file for FreeBSD/arm on the IQ31244 # # 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. # # $FreeBSD$ ident IQ31244 options PHYSADDR=0xa0000000 options KERNPHYSADDR=0xa0200000 options KERNVIRTADDR=0xc0200000 # Used in ldscript.arm options FLASHADDR=0xf0000000 options LOADERRAMADDR=0x00000000 options STARTUP_PAGETABLE_ADDR=0xa0000000 include "../xscale/i80321/std.iq31244" makeoptions MODULES_OVERRIDE="" #makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols makeoptions CONF_CFLAGS=-mcpu=xscale options HZ=100 #options DEVICE_POLLING options SCHED_4BSD #4BSD scheduler options INET #InterNETworking options INET6 #IPv6 communications protocols options FFS #Berkeley Fast Filesystem options SOFTUPDATES #Enable FFS soft updates support options UFS_ACL #Support for access control lists options UFS_DIRHASH #Improve performance on big directories options NFSCL #New Network Filesystem Client options NFSD #New Network Filesystem Server options NFSLOCKD #Network Lock Manager options NFS_ROOT #NFS usable as /, requires NFSCL #options MSDOSFS #MSDOS Filesystem options CD9660 #ISO 9660 Filesystem #options PROCFS #Process filesystem (requires PSEUDOFS) options PSEUDOFS #Pseudo-filesystem framework options SCSI_DELAY=5000 #Delay (in ms) before probing SCSI options KTRACE #ktrace(1) support options SYSVSHM #SYSV-style shared memory 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 BOOTP options BOOTP_NFSROOT options BOOTP_NFSV3 options BOOTP_WIRED_TO=em0 options BOOTP_COMPAT #options PREEMPTION device loop device ether #device saarm device miibus device rl device em device uart device pci device ata -options ATA_CAM options ATA_STATIC_ID # Static device numbering device scbus # SCSI bus (required for ATA/SCSI) device cd # CD device da # Direct Access (disks) device pass # Passthrough device (direct ATA/SCSI access) # SCSI Controllers device iopwdog # I80321 Watchdog device dma # I80321 DMA Controller device aau # I80321 Application Accelerator Unit device "iq31244_7seg" # IQ31244 7 seg #options AHC_REG_PRETTY_PRINT # Print register bitfields in debug # output. Adds ~128k to driver. #options AHD_REG_PRETTY_PRINT # Print register bitfields in debug # output. Adds ~215k to driver. # Debugging for use in -current options KDB options DDB #Enable the kernel debugger #options DEADLKRES #Enable the deadlock resolver #options INVARIANTS #Enable calls of extra sanity checking #options INVARIANT_SUPPORT #Extra sanity checks of internal structures, required by INVARIANTS #options WITNESS #Enable checks to detect deadlocks and cycles #options WITNESS_SKIPSPIN #Don't run witness on spinlocks for speed #options DIAGNOSTIC # To make an SMP kernel, the next two are needed #options SMP # Symmetric MultiProcessor Kernel #options APIC_IO # Symmetric (APIC) I/O options XSCALE_CACHE_READ_WRITE_ALLOCATE device md device random # Entropy device options ARM_USE_SMALL_ALLOC # Floppy drives Index: head/sys/arm/conf/TS7800 =================================================================== --- head/sys/arm/conf/TS7800 (revision 249082) +++ head/sys/arm/conf/TS7800 (revision 249083) @@ -1,79 +1,78 @@ # # Custom kernel for the TS-7800 board. # # $FreeBSD$ # ident TS7800 include "../mv/orion/std.ts7800" options SOC_MV_ORION makeoptions MODULES_OVERRIDE="" #makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols makeoptions WERROR="-Werror" options SCHED_4BSD #4BSD scheduler options INET #InterNETworking options INET6 #IPv6 communications protocols options FFS #Berkeley Fast Filesystem options SOFTUPDATES # Enable FFS soft updates support options NFSCL #New Network Filesystem Client options NFSLOCKD #Network Lock Manager options NFS_ROOT #NFS usable as /, requires NFSCL options BOOTP options BOOTP_NFSROOT options BOOTP_NFSV3 options BOOTP_WIRED_TO=mge0 options SYSVSHM #SYSV-style shared memory options SYSVMSG #SYSV-style message queues options SYSVSEM #SYSV-style semaphores options _KPOSIX_PRIORITY_SCHEDULING #Posix P1003_1B real-time extensions options MUTEX_NOINLINE options RWLOCK_NOINLINE options NO_FFS_SNAPSHOT options NO_SWAPPING # Debugging options ALT_BREAK_TO_DEBUGGER options DDB options KDB options GDB # Support remote GDB. device mvs device pci # Pseudo devices device md device loop device random # Serial ports device uart # Networking device ether device mge # Marvell Gigabit Ethernet controller device mii device e1000phy device bpf options HZ=1000 # USB device usb device ehci device umass device scbus device pass device da # SATA device ata -options ATA_CAM # Flattened Device Tree options FDT options FDT_DTB_STATIC makeoptions FDT_DTS_FILE=ts7800.dts Index: head/sys/cam/ata/ata_da.c =================================================================== --- head/sys/cam/ata/ata_da.c (revision 249082) +++ head/sys/cam/ata/ata_da.c (revision 249083) @@ -1,1996 +1,1992 @@ /*- * Copyright (c) 2009 Alexander Motin * 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. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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. */ #include __FBSDID("$FreeBSD$"); #include "opt_ada.h" #include "opt_ata.h" #include #ifdef _KERNEL #include #include #include #include #include #include #include #include #include #include #include #include #include #include #endif /* _KERNEL */ #ifndef _KERNEL #include #include #endif /* _KERNEL */ #include #include #include #include #include #include #include /* geometry translation */ #ifdef _KERNEL #define ATA_MAX_28BIT_LBA 268435455UL typedef enum { ADA_STATE_RAHEAD, ADA_STATE_WCACHE, ADA_STATE_NORMAL } ada_state; typedef enum { ADA_FLAG_PACK_INVALID = 0x001, ADA_FLAG_CAN_48BIT = 0x002, ADA_FLAG_CAN_FLUSHCACHE = 0x004, ADA_FLAG_CAN_NCQ = 0x008, ADA_FLAG_CAN_DMA = 0x010, ADA_FLAG_NEED_OTAG = 0x020, ADA_FLAG_WENT_IDLE = 0x040, ADA_FLAG_CAN_TRIM = 0x080, ADA_FLAG_OPEN = 0x100, ADA_FLAG_SCTX_INIT = 0x200, ADA_FLAG_CAN_CFA = 0x400, ADA_FLAG_CAN_POWERMGT = 0x800 } ada_flags; typedef enum { ADA_Q_NONE = 0x00, ADA_Q_4K = 0x01, } ada_quirks; typedef enum { ADA_CCB_RAHEAD = 0x01, ADA_CCB_WCACHE = 0x02, ADA_CCB_BUFFER_IO = 0x03, ADA_CCB_WAITING = 0x04, ADA_CCB_DUMP = 0x05, ADA_CCB_TRIM = 0x06, ADA_CCB_TYPE_MASK = 0x0F, } ada_ccb_state; /* Offsets into our private area for storing information */ #define ccb_state ppriv_field0 #define ccb_bp ppriv_ptr1 struct disk_params { u_int8_t heads; u_int8_t secs_per_track; u_int32_t cylinders; u_int32_t secsize; /* Number of bytes/logical sector */ u_int64_t sectors; /* Total number sectors */ }; #define TRIM_MAX_BLOCKS 8 #define TRIM_MAX_RANGES (TRIM_MAX_BLOCKS * 64) #define TRIM_MAX_BIOS (TRIM_MAX_RANGES * 4) struct trim_request { uint8_t data[TRIM_MAX_RANGES * 8]; struct bio *bps[TRIM_MAX_BIOS]; }; struct ada_softc { struct bio_queue_head bio_queue; struct bio_queue_head trim_queue; ada_state state; ada_flags flags; ada_quirks quirks; int sort_io_queue; int ordered_tag_count; int outstanding_cmds; int trim_max_ranges; int trim_running; int read_ahead; int write_cache; #ifdef ADA_TEST_FAILURE int force_read_error; int force_write_error; int periodic_read_error; int periodic_read_count; #endif struct disk_params params; struct disk *disk; struct task sysctl_task; struct sysctl_ctx_list sysctl_ctx; struct sysctl_oid *sysctl_tree; struct callout sendordered_c; struct trim_request trim_req; }; struct ada_quirk_entry { struct scsi_inquiry_pattern inq_pat; ada_quirks quirks; }; static struct ada_quirk_entry ada_quirk_table[] = { { /* Hitachi Advanced Format (4k) drives */ { T_DIRECT, SIP_MEDIA_FIXED, "*", "Hitachi H??????????E3*", "*" }, /*quirks*/ADA_Q_4K }, { /* Samsung Advanced Format (4k) drives */ { T_DIRECT, SIP_MEDIA_FIXED, "*", "SAMSUNG HD155UI*", "*" }, /*quirks*/ADA_Q_4K }, { /* Samsung Advanced Format (4k) drives */ { T_DIRECT, SIP_MEDIA_FIXED, "*", "SAMSUNG HD204UI*", "*" }, /*quirks*/ADA_Q_4K }, { /* Seagate Barracuda Green Advanced Format (4k) drives */ { T_DIRECT, SIP_MEDIA_FIXED, "*", "ST????DL*", "*" }, /*quirks*/ADA_Q_4K }, { /* Seagate Barracuda Advanced Format (4k) drives */ { T_DIRECT, SIP_MEDIA_FIXED, "*", "ST???DM*", "*" }, /*quirks*/ADA_Q_4K }, { /* Seagate Barracuda Advanced Format (4k) drives */ { T_DIRECT, SIP_MEDIA_FIXED, "*", "ST????DM*", "*" }, /*quirks*/ADA_Q_4K }, { /* Seagate Momentus Advanced Format (4k) drives */ { T_DIRECT, SIP_MEDIA_FIXED, "*", "ST9500423AS*", "*" }, /*quirks*/ADA_Q_4K }, { /* Seagate Momentus Advanced Format (4k) drives */ { T_DIRECT, SIP_MEDIA_FIXED, "*", "ST9500424AS*", "*" }, /*quirks*/ADA_Q_4K }, { /* Seagate Momentus Advanced Format (4k) drives */ { T_DIRECT, SIP_MEDIA_FIXED, "*", "ST9640423AS*", "*" }, /*quirks*/ADA_Q_4K }, { /* Seagate Momentus Advanced Format (4k) drives */ { T_DIRECT, SIP_MEDIA_FIXED, "*", "ST9640424AS*", "*" }, /*quirks*/ADA_Q_4K }, { /* Seagate Momentus Advanced Format (4k) drives */ { T_DIRECT, SIP_MEDIA_FIXED, "*", "ST9750420AS*", "*" }, /*quirks*/ADA_Q_4K }, { /* Seagate Momentus Advanced Format (4k) drives */ { T_DIRECT, SIP_MEDIA_FIXED, "*", "ST9750422AS*", "*" }, /*quirks*/ADA_Q_4K }, { /* Seagate Momentus Advanced Format (4k) drives */ { T_DIRECT, SIP_MEDIA_FIXED, "*", "ST9750423AS*", "*" }, /*quirks*/ADA_Q_4K }, { /* Seagate Momentus Thin Advanced Format (4k) drives */ { T_DIRECT, SIP_MEDIA_FIXED, "*", "ST???LT*", "*" }, /*quirks*/ADA_Q_4K }, { /* WDC Caviar Green Advanced Format (4k) drives */ { T_DIRECT, SIP_MEDIA_FIXED, "*", "WDC WD????RS*", "*" }, /*quirks*/ADA_Q_4K }, { /* WDC Caviar Green Advanced Format (4k) drives */ { T_DIRECT, SIP_MEDIA_FIXED, "*", "WDC WD????RX*", "*" }, /*quirks*/ADA_Q_4K }, { /* WDC Caviar Green Advanced Format (4k) drives */ { T_DIRECT, SIP_MEDIA_FIXED, "*", "WDC WD??????RS*", "*" }, /*quirks*/ADA_Q_4K }, { /* WDC Caviar Green Advanced Format (4k) drives */ { T_DIRECT, SIP_MEDIA_FIXED, "*", "WDC WD??????RX*", "*" }, /*quirks*/ADA_Q_4K }, { /* WDC Scorpio Black Advanced Format (4k) drives */ { T_DIRECT, SIP_MEDIA_FIXED, "*", "WDC WD???PKT*", "*" }, /*quirks*/ADA_Q_4K }, { /* WDC Scorpio Black Advanced Format (4k) drives */ { T_DIRECT, SIP_MEDIA_FIXED, "*", "WDC WD?????PKT*", "*" }, /*quirks*/ADA_Q_4K }, { /* WDC Scorpio Blue Advanced Format (4k) drives */ { T_DIRECT, SIP_MEDIA_FIXED, "*", "WDC WD???PVT*", "*" }, /*quirks*/ADA_Q_4K }, { /* WDC Scorpio Blue Advanced Format (4k) drives */ { T_DIRECT, SIP_MEDIA_FIXED, "*", "WDC WD?????PVT*", "*" }, /*quirks*/ADA_Q_4K }, { /* * Corsair Force 2 SSDs * 4k optimised & trim only works in 4k requests + 4k aligned * Submitted by: Steven Hartland * PR: 169974 */ { T_DIRECT, SIP_MEDIA_FIXED, "*", "Corsair CSSD-F*", "*" }, /*quirks*/ADA_Q_4K }, { /* * Corsair Force 3 SSDs * 4k optimised & trim only works in 4k requests + 4k aligned * Submitted by: Steven Hartland * PR: 169974 */ { T_DIRECT, SIP_MEDIA_FIXED, "*", "Corsair Force 3*", "*" }, /*quirks*/ADA_Q_4K }, { /* * OCZ Agility 3 SSDs * 4k optimised & trim only works in 4k requests + 4k aligned * Submitted by: Steven Hartland * PR: 169974 */ { T_DIRECT, SIP_MEDIA_FIXED, "*", "OCZ-AGILITY3*", "*" }, /*quirks*/ADA_Q_4K }, { /* * OCZ Vertex 2 SSDs (inc pro series) * 4k optimised & trim only works in 4k requests + 4k aligned * Submitted by: Steven Hartland * PR: 169974 */ { T_DIRECT, SIP_MEDIA_FIXED, "*", "OCZ?VERTEX2*", "*" }, /*quirks*/ADA_Q_4K }, { /* * OCZ Vertex 3 SSDs * 4k optimised & trim only works in 4k requests + 4k aligned * Submitted by: Steven Hartland * PR: 169974 */ { T_DIRECT, SIP_MEDIA_FIXED, "*", "OCZ-VERTEX3*", "*" }, /*quirks*/ADA_Q_4K }, { /* * SuperTalent TeraDrive CT SSDs * 4k optimised & trim only works in 4k requests + 4k aligned * Submitted by: Steven Hartland * PR: 169974 */ { T_DIRECT, SIP_MEDIA_FIXED, "*", "FTM??CT25H*", "*" }, /*quirks*/ADA_Q_4K }, { /* * Crucial RealSSD C300 SSDs * 4k optimised * Submitted by: Steven Hartland * PR: 169974 */ { T_DIRECT, SIP_MEDIA_FIXED, "*", "C300-CTFDDAC???MAG*", "*" }, /*quirks*/ADA_Q_4K }, { /* * XceedIOPS SATA SSDs * 4k optimised * Submitted by: Steven Hartland * PR: 169974 */ { T_DIRECT, SIP_MEDIA_FIXED, "*", "SG9XCS2D*", "*" }, /*quirks*/ADA_Q_4K }, { /* * Intel 330 Series SSDs * 4k optimised & trim only works in 4k requests + 4k aligned * Submitted by: Steven Hartland * PR: 169974 */ { T_DIRECT, SIP_MEDIA_FIXED, "*", "INTEL SSDSC2ct*", "*" }, /*quirks*/ADA_Q_4K }, { /* * OCZ Deneva R Series SSDs * 4k optimised & trim only works in 4k requests + 4k aligned * Submitted by: Steven Hartland * PR: 169974 */ { T_DIRECT, SIP_MEDIA_FIXED, "*", "DENRSTE251M45*", "*" }, /*quirks*/ADA_Q_4K }, { /* * Kingston HyperX 3k SSDs * 4k optimised & trim only works in 4k requests + 4k aligned * Submitted by: Steven Hartland * PR: 169974 */ { T_DIRECT, SIP_MEDIA_FIXED, "*", "KINGSTON SH103S3*", "*" }, /*quirks*/ADA_Q_4K }, { /* Default */ { T_ANY, SIP_MEDIA_REMOVABLE|SIP_MEDIA_FIXED, /*vendor*/"*", /*product*/"*", /*revision*/"*" }, /*quirks*/0 }, }; static disk_strategy_t adastrategy; static dumper_t adadump; static periph_init_t adainit; static void adaasync(void *callback_arg, u_int32_t code, struct cam_path *path, void *arg); static void adasysctlinit(void *context, int pending); static periph_ctor_t adaregister; static periph_dtor_t adacleanup; static periph_start_t adastart; static periph_oninv_t adaoninvalidate; static void adadone(struct cam_periph *periph, union ccb *done_ccb); static int adaerror(union ccb *ccb, u_int32_t cam_flags, u_int32_t sense_flags); static void adagetparams(struct cam_periph *periph, struct ccb_getdev *cgd); static timeout_t adasendorderedtag; static void adashutdown(void *arg, int howto); 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 #define ADA_DEFAULT_TIMEOUT 30 /* Timeout in seconds */ #endif #ifndef ADA_DEFAULT_RETRY #define ADA_DEFAULT_RETRY 4 #endif #ifndef ADA_DEFAULT_SEND_ORDERED #define ADA_DEFAULT_SEND_ORDERED 1 #endif #ifndef ADA_DEFAULT_SPINDOWN_SHUTDOWN #define ADA_DEFAULT_SPINDOWN_SHUTDOWN 1 #endif #ifndef ADA_DEFAULT_SPINDOWN_SUSPEND #define ADA_DEFAULT_SPINDOWN_SUSPEND 1 #endif #ifndef ADA_DEFAULT_READ_AHEAD #define ADA_DEFAULT_READ_AHEAD 1 #endif #ifndef ADA_DEFAULT_WRITE_CACHE #define ADA_DEFAULT_WRITE_CACHE 1 #endif #define ADA_RA (softc->read_ahead >= 0 ? \ softc->read_ahead : ada_read_ahead) #define ADA_WC (softc->write_cache >= 0 ? \ softc->write_cache : ada_write_cache) #define ADA_SIO (softc->sort_io_queue >= 0 ? \ softc->sort_io_queue : cam_sort_io_queues) /* * Most platforms map firmware geometry to actual, but some don't. If * not overridden, default to nothing. */ #ifndef ata_disk_firmware_geom_adjust #define ata_disk_firmware_geom_adjust(disk) #endif static int ada_legacy_aliases = ADA_DEFAULT_LEGACY_ALIASES; static int ada_retry_count = ADA_DEFAULT_RETRY; static int ada_default_timeout = ADA_DEFAULT_TIMEOUT; static int ada_send_ordered = ADA_DEFAULT_SEND_ORDERED; static int ada_spindown_shutdown = ADA_DEFAULT_SPINDOWN_SHUTDOWN; static int ada_spindown_suspend = ADA_DEFAULT_SPINDOWN_SUSPEND; static int ada_read_ahead = ADA_DEFAULT_READ_AHEAD; static int ada_write_cache = ADA_DEFAULT_WRITE_CACHE; static SYSCTL_NODE(_kern_cam, OID_AUTO, ada, CTLFLAG_RD, 0, "CAM Direct Access Disk driver"); SYSCTL_INT(_kern_cam_ada, OID_AUTO, legacy_aliases, CTLFLAG_RW, &ada_legacy_aliases, 0, "Create legacy-like device aliases"); TUNABLE_INT("kern.cam.ada.legacy_aliases", &ada_legacy_aliases); SYSCTL_INT(_kern_cam_ada, OID_AUTO, retry_count, CTLFLAG_RW, &ada_retry_count, 0, "Normal I/O retry count"); TUNABLE_INT("kern.cam.ada.retry_count", &ada_retry_count); SYSCTL_INT(_kern_cam_ada, OID_AUTO, default_timeout, CTLFLAG_RW, &ada_default_timeout, 0, "Normal I/O timeout (in seconds)"); TUNABLE_INT("kern.cam.ada.default_timeout", &ada_default_timeout); SYSCTL_INT(_kern_cam_ada, OID_AUTO, send_ordered, CTLFLAG_RW, &ada_send_ordered, 0, "Send Ordered Tags"); TUNABLE_INT("kern.cam.ada.send_ordered", &ada_send_ordered); SYSCTL_INT(_kern_cam_ada, OID_AUTO, spindown_shutdown, CTLFLAG_RW, &ada_spindown_shutdown, 0, "Spin down upon shutdown"); TUNABLE_INT("kern.cam.ada.spindown_shutdown", &ada_spindown_shutdown); SYSCTL_INT(_kern_cam_ada, OID_AUTO, spindown_suspend, CTLFLAG_RW, &ada_spindown_suspend, 0, "Spin down upon suspend"); TUNABLE_INT("kern.cam.ada.spindown_suspend", &ada_spindown_suspend); SYSCTL_INT(_kern_cam_ada, OID_AUTO, read_ahead, CTLFLAG_RW, &ada_read_ahead, 0, "Enable disk read-ahead"); TUNABLE_INT("kern.cam.ada.read_ahead", &ada_read_ahead); SYSCTL_INT(_kern_cam_ada, OID_AUTO, write_cache, CTLFLAG_RW, &ada_write_cache, 0, "Enable disk write cache"); TUNABLE_INT("kern.cam.ada.write_cache", &ada_write_cache); /* * ADA_ORDEREDTAG_INTERVAL determines how often, relative * to the default timeout, we check to see whether an ordered * tagged transaction is appropriate to prevent simple tag * starvation. Since we'd like to ensure that there is at least * 1/2 of the timeout length left for a starved transaction to * complete after we've sent an ordered tag, we must poll at least * four times in every timeout period. This takes care of the worst * case where a starved transaction starts during an interval that * meets the requirement "don't send an ordered tag" test so it takes * us two intervals to determine that a tag must be sent. */ #ifndef ADA_ORDEREDTAG_INTERVAL #define ADA_ORDEREDTAG_INTERVAL 4 #endif static struct periph_driver adadriver = { adainit, "ada", TAILQ_HEAD_INITIALIZER(adadriver.units), /* generation */ 0 }; PERIPHDRIVER_DECLARE(ada, adadriver); static MALLOC_DEFINE(M_ATADA, "ata_da", "ata_da buffers"); static int adaopen(struct disk *dp) { struct cam_periph *periph; struct ada_softc *softc; int error; periph = (struct cam_periph *)dp->d_drv1; if (periph == NULL) { return (ENXIO); } if (cam_periph_acquire(periph) != CAM_REQ_CMP) { return(ENXIO); } cam_periph_lock(periph); if ((error = cam_periph_hold(periph, PRIBIO|PCATCH)) != 0) { cam_periph_unlock(periph); cam_periph_release(periph); return (error); } softc = (struct ada_softc *)periph->softc; softc->flags |= ADA_FLAG_OPEN; CAM_DEBUG(periph->path, CAM_DEBUG_TRACE | CAM_DEBUG_PERIPH, ("adaopen\n")); if ((softc->flags & ADA_FLAG_PACK_INVALID) != 0) { /* Invalidate our pack information. */ softc->flags &= ~ADA_FLAG_PACK_INVALID; } cam_periph_unhold(periph); cam_periph_unlock(periph); return (0); } static int adaclose(struct disk *dp) { struct cam_periph *periph; struct ada_softc *softc; union ccb *ccb; periph = (struct cam_periph *)dp->d_drv1; if (periph == NULL) return (ENXIO); cam_periph_lock(periph); if (cam_periph_hold(periph, PRIBIO) != 0) { cam_periph_unlock(periph); cam_periph_release(periph); return (0); } softc = (struct ada_softc *)periph->softc; CAM_DEBUG(periph->path, CAM_DEBUG_TRACE | CAM_DEBUG_PERIPH, ("adaclose\n")); /* We only sync the cache if the drive is capable of it. */ if ((softc->flags & ADA_FLAG_CAN_FLUSHCACHE) != 0 && (softc->flags & ADA_FLAG_PACK_INVALID) == 0) { ccb = cam_periph_getccb(periph, CAM_PRIORITY_NORMAL); cam_fill_ataio(&ccb->ataio, 1, adadone, CAM_DIR_NONE, 0, NULL, 0, ada_default_timeout*1000); if (softc->flags & ADA_FLAG_CAN_48BIT) ata_48bit_cmd(&ccb->ataio, ATA_FLUSHCACHE48, 0, 0, 0); else ata_28bit_cmd(&ccb->ataio, ATA_FLUSHCACHE, 0, 0, 0); cam_periph_runccb(ccb, adaerror, /*cam_flags*/0, /*sense_flags*/0, softc->disk->d_devstat); if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) xpt_print(periph->path, "Synchronize cache failed\n"); xpt_release_ccb(ccb); } softc->flags &= ~ADA_FLAG_OPEN; cam_periph_unhold(periph); cam_periph_unlock(periph); cam_periph_release(periph); return (0); } static void adaschedule(struct cam_periph *periph) { struct ada_softc *softc = (struct ada_softc *)periph->softc; uint32_t prio; /* Check if cam_periph_getccb() was called. */ prio = periph->immediate_priority; /* Check if we have more work to do. */ if (bioq_first(&softc->bio_queue) || (!softc->trim_running && bioq_first(&softc->trim_queue))) { prio = CAM_PRIORITY_NORMAL; } /* Schedule CCB if any of above is true. */ if (prio != CAM_PRIORITY_NONE) xpt_schedule(periph, prio); } /* * Actually translate the requested transfer into one the physical driver * can understand. The transfer is described by a buf and will include * only one physical transfer. */ static void adastrategy(struct bio *bp) { struct cam_periph *periph; struct ada_softc *softc; periph = (struct cam_periph *)bp->bio_disk->d_drv1; if (periph == NULL) { biofinish(bp, NULL, ENXIO); return; } softc = (struct ada_softc *)periph->softc; cam_periph_lock(periph); CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("adastrategy(%p)\n", bp)); /* * If the device has been made invalid, error out */ if ((softc->flags & ADA_FLAG_PACK_INVALID)) { cam_periph_unlock(periph); biofinish(bp, NULL, ENXIO); return; } /* * Place it in the queue of disk activities for this disk */ if (bp->bio_cmd == BIO_DELETE && (softc->flags & ADA_FLAG_CAN_TRIM)) { if (ADA_SIO) bioq_disksort(&softc->trim_queue, bp); else bioq_insert_tail(&softc->trim_queue, bp); } else { if (ADA_SIO) bioq_disksort(&softc->bio_queue, bp); else bioq_insert_tail(&softc->bio_queue, bp); } /* * Schedule ourselves for performing the work. */ adaschedule(periph); cam_periph_unlock(periph); return; } static int adadump(void *arg, void *virtual, vm_offset_t physical, off_t offset, size_t length) { struct cam_periph *periph; struct ada_softc *softc; u_int secsize; union ccb ccb; struct disk *dp; uint64_t lba; uint16_t count; int error = 0; dp = arg; periph = dp->d_drv1; if (periph == NULL) return (ENXIO); softc = (struct ada_softc *)periph->softc; cam_periph_lock(periph); secsize = softc->params.secsize; lba = offset / secsize; count = length / secsize; if ((softc->flags & ADA_FLAG_PACK_INVALID) != 0) { cam_periph_unlock(periph); return (ENXIO); } if (length > 0) { xpt_setup_ccb(&ccb.ccb_h, periph->path, CAM_PRIORITY_NORMAL); ccb.ccb_h.ccb_state = ADA_CCB_DUMP; cam_fill_ataio(&ccb.ataio, 0, adadone, CAM_DIR_OUT, 0, (u_int8_t *) virtual, length, ada_default_timeout*1000); if ((softc->flags & ADA_FLAG_CAN_48BIT) && (lba + count >= ATA_MAX_28BIT_LBA || count >= 256)) { ata_48bit_cmd(&ccb.ataio, ATA_WRITE_DMA48, 0, lba, count); } else { ata_28bit_cmd(&ccb.ataio, ATA_WRITE_DMA, 0, lba, count); } xpt_polled_action(&ccb); error = cam_periph_error(&ccb, 0, SF_NO_RECOVERY | SF_NO_RETRY, NULL); if ((ccb.ccb_h.status & CAM_DEV_QFRZN) != 0) cam_release_devq(ccb.ccb_h.path, /*relsim_flags*/0, /*reduction*/0, /*timeout*/0, /*getcount_only*/0); if (error != 0) printf("Aborting dump due to I/O error.\n"); cam_periph_unlock(periph); return (error); } if (softc->flags & ADA_FLAG_CAN_FLUSHCACHE) { xpt_setup_ccb(&ccb.ccb_h, periph->path, CAM_PRIORITY_NORMAL); ccb.ccb_h.ccb_state = ADA_CCB_DUMP; cam_fill_ataio(&ccb.ataio, 0, adadone, CAM_DIR_NONE, 0, NULL, 0, ada_default_timeout*1000); if (softc->flags & ADA_FLAG_CAN_48BIT) ata_48bit_cmd(&ccb.ataio, ATA_FLUSHCACHE48, 0, 0, 0); else ata_28bit_cmd(&ccb.ataio, ATA_FLUSHCACHE, 0, 0, 0); xpt_polled_action(&ccb); error = cam_periph_error(&ccb, 0, SF_NO_RECOVERY | SF_NO_RETRY, NULL); if ((ccb.ccb_h.status & CAM_DEV_QFRZN) != 0) cam_release_devq(ccb.ccb_h.path, /*relsim_flags*/0, /*reduction*/0, /*timeout*/0, /*getcount_only*/0); if (error != 0) xpt_print(periph->path, "Synchronize cache failed\n"); } cam_periph_unlock(periph); return (error); } static void adainit(void) { cam_status status; /* * Install a global async callback. This callback will * receive async callbacks like "new device found". */ status = xpt_register_async(AC_FOUND_DEVICE, adaasync, NULL, NULL); if (status != CAM_REQ_CMP) { printf("ada: Failed to attach master async callback " "due to status 0x%x!\n", status); } else if (ada_send_ordered) { /* Register our event handlers */ if ((EVENTHANDLER_REGISTER(power_suspend, adasuspend, NULL, EVENTHANDLER_PRI_LAST)) == NULL) printf("adainit: power event registration failed!\n"); if ((EVENTHANDLER_REGISTER(power_resume, adaresume, NULL, EVENTHANDLER_PRI_LAST)) == NULL) printf("adainit: power event registration failed!\n"); if ((EVENTHANDLER_REGISTER(shutdown_post_sync, adashutdown, NULL, SHUTDOWN_PRI_DEFAULT)) == NULL) printf("adainit: shutdown event registration failed!\n"); } } static void adaoninvalidate(struct cam_periph *periph) { struct ada_softc *softc; softc = (struct ada_softc *)periph->softc; /* * De-register any async callbacks. */ xpt_register_async(0, adaasync, periph, periph->path); softc->flags |= ADA_FLAG_PACK_INVALID; /* * Return all queued I/O with ENXIO. * XXX Handle any transactions queued to the card * with XPT_ABORT_CCB. */ bioq_flush(&softc->bio_queue, NULL, ENXIO); bioq_flush(&softc->trim_queue, NULL, ENXIO); disk_gone(softc->disk); xpt_print(periph->path, "lost device\n"); } static void adacleanup(struct cam_periph *periph) { struct ada_softc *softc; softc = (struct ada_softc *)periph->softc; xpt_print(periph->path, "removing device entry\n"); cam_periph_unlock(periph); /* * If we can't free the sysctl tree, oh well... */ if ((softc->flags & ADA_FLAG_SCTX_INIT) != 0 && sysctl_ctx_free(&softc->sysctl_ctx) != 0) { xpt_print(periph->path, "can't remove sysctl context\n"); } disk_destroy(softc->disk); callout_drain(&softc->sendordered_c); free(softc, M_DEVBUF); cam_periph_lock(periph); } static void adaasync(void *callback_arg, u_int32_t code, struct cam_path *path, void *arg) { struct ccb_getdev cgd; struct cam_periph *periph; struct ada_softc *softc; periph = (struct cam_periph *)callback_arg; switch (code) { case AC_FOUND_DEVICE: { struct ccb_getdev *cgd; cam_status status; cgd = (struct ccb_getdev *)arg; if (cgd == NULL) break; if (cgd->protocol != PROTO_ATA) break; /* * Allocate a peripheral instance for * this device and start the probe * process. */ status = cam_periph_alloc(adaregister, adaoninvalidate, adacleanup, adastart, "ada", CAM_PERIPH_BIO, cgd->ccb_h.path, adaasync, AC_FOUND_DEVICE, cgd); if (status != CAM_REQ_CMP && status != CAM_REQ_INPROG) printf("adaasync: Unable to attach to new device " "due to status 0x%x\n", status); break; } case AC_GETDEV_CHANGED: { softc = (struct ada_softc *)periph->softc; xpt_setup_ccb(&cgd.ccb_h, periph->path, CAM_PRIORITY_NORMAL); cgd.ccb_h.func_code = XPT_GDEV_TYPE; xpt_action((union ccb *)&cgd); if ((cgd.ident_data.capabilities1 & ATA_SUPPORT_DMA) && (cgd.inq_flags & SID_DMA)) softc->flags |= ADA_FLAG_CAN_DMA; else softc->flags &= ~ADA_FLAG_CAN_DMA; if ((cgd.ident_data.satacapabilities & ATA_SUPPORT_NCQ) && (cgd.inq_flags & SID_DMA) && (cgd.inq_flags & SID_CmdQue)) softc->flags |= ADA_FLAG_CAN_NCQ; else softc->flags &= ~ADA_FLAG_CAN_NCQ; if ((cgd.ident_data.support_dsm & ATA_SUPPORT_DSM_TRIM) && (cgd.inq_flags & SID_DMA)) softc->flags |= ADA_FLAG_CAN_TRIM; else softc->flags &= ~ADA_FLAG_CAN_TRIM; cam_periph_async(periph, code, path, arg); break; } case AC_ADVINFO_CHANGED: { uintptr_t buftype; buftype = (uintptr_t)arg; if (buftype == CDAI_TYPE_PHYS_PATH) { struct ada_softc *softc; softc = periph->softc; disk_attr_changed(softc->disk, "GEOM::physpath", M_NOWAIT); } break; } case AC_SENT_BDR: case AC_BUS_RESET: { softc = (struct ada_softc *)periph->softc; cam_periph_async(periph, code, path, arg); if (softc->state != ADA_STATE_NORMAL) break; xpt_setup_ccb(&cgd.ccb_h, periph->path, CAM_PRIORITY_NORMAL); cgd.ccb_h.func_code = XPT_GDEV_TYPE; xpt_action((union ccb *)&cgd); if (ADA_RA >= 0 && cgd.ident_data.support.command1 & ATA_SUPPORT_LOOKAHEAD) softc->state = ADA_STATE_RAHEAD; else if (ADA_WC >= 0 && cgd.ident_data.support.command1 & ATA_SUPPORT_WRITECACHE) softc->state = ADA_STATE_WCACHE; else break; cam_periph_acquire(periph); cam_freeze_devq_arg(periph->path, RELSIM_RELEASE_RUNLEVEL, CAM_RL_DEV + 1); xpt_schedule(periph, CAM_PRIORITY_DEV); } default: cam_periph_async(periph, code, path, arg); break; } } static void adasysctlinit(void *context, int pending) { struct cam_periph *periph; struct ada_softc *softc; char tmpstr[80], tmpstr2[80]; periph = (struct cam_periph *)context; /* periph was held for us when this task was enqueued */ if (periph->flags & CAM_PERIPH_INVALID) { cam_periph_release(periph); return; } softc = (struct ada_softc *)periph->softc; snprintf(tmpstr, sizeof(tmpstr), "CAM ADA unit %d", periph->unit_number); snprintf(tmpstr2, sizeof(tmpstr2), "%d", periph->unit_number); sysctl_ctx_init(&softc->sysctl_ctx); softc->flags |= ADA_FLAG_SCTX_INIT; softc->sysctl_tree = SYSCTL_ADD_NODE(&softc->sysctl_ctx, SYSCTL_STATIC_CHILDREN(_kern_cam_ada), OID_AUTO, tmpstr2, CTLFLAG_RD, 0, tmpstr); if (softc->sysctl_tree == NULL) { printf("adasysctlinit: unable to allocate sysctl tree\n"); cam_periph_release(periph); return; } SYSCTL_ADD_INT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), OID_AUTO, "read_ahead", CTLFLAG_RW | CTLFLAG_MPSAFE, &softc->read_ahead, 0, "Enable disk read ahead."); SYSCTL_ADD_INT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), OID_AUTO, "write_cache", CTLFLAG_RW | CTLFLAG_MPSAFE, &softc->write_cache, 0, "Enable disk write cache."); SYSCTL_ADD_INT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), OID_AUTO, "sort_io_queue", CTLFLAG_RW | CTLFLAG_MPSAFE, &softc->sort_io_queue, 0, "Sort IO queue to try and optimise disk access patterns"); #ifdef ADA_TEST_FAILURE /* * Add a 'door bell' sysctl which allows one to set it from userland * and cause something bad to happen. For the moment, we only allow * whacking the next read or write. */ SYSCTL_ADD_INT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), OID_AUTO, "force_read_error", CTLFLAG_RW | CTLFLAG_MPSAFE, &softc->force_read_error, 0, "Force a read error for the next N reads."); SYSCTL_ADD_INT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), OID_AUTO, "force_write_error", CTLFLAG_RW | CTLFLAG_MPSAFE, &softc->force_write_error, 0, "Force a write error for the next N writes."); SYSCTL_ADD_INT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), OID_AUTO, "periodic_read_error", CTLFLAG_RW | CTLFLAG_MPSAFE, &softc->periodic_read_error, 0, "Force a read error every N reads (don't set too low)."); #endif cam_periph_release(periph); } static int adagetattr(struct bio *bp) { int ret; struct cam_periph *periph; periph = (struct cam_periph *)bp->bio_disk->d_drv1; if (periph == NULL) return (ENXIO); cam_periph_lock(periph); ret = xpt_getattr(bp->bio_data, bp->bio_length, bp->bio_attribute, periph->path); cam_periph_unlock(periph); if (ret == 0) bp->bio_completed = bp->bio_length; return ret; } static cam_status adaregister(struct cam_periph *periph, void *arg) { struct ada_softc *softc; struct ccb_pathinq cpi; struct ccb_getdev *cgd; char announce_buf[80], buf1[32]; struct disk_params *dp; caddr_t match; u_int maxio; int legacy_id, quirks; cgd = (struct ccb_getdev *)arg; if (cgd == NULL) { printf("adaregister: no getdev CCB, can't register device\n"); return(CAM_REQ_CMP_ERR); } softc = (struct ada_softc *)malloc(sizeof(*softc), M_DEVBUF, M_NOWAIT|M_ZERO); if (softc == NULL) { printf("adaregister: Unable to probe new device. " "Unable to allocate softc\n"); return(CAM_REQ_CMP_ERR); } bioq_init(&softc->bio_queue); bioq_init(&softc->trim_queue); if ((cgd->ident_data.capabilities1 & ATA_SUPPORT_DMA) && (cgd->inq_flags & SID_DMA)) softc->flags |= ADA_FLAG_CAN_DMA; if (cgd->ident_data.support.command2 & ATA_SUPPORT_ADDRESS48) softc->flags |= ADA_FLAG_CAN_48BIT; if (cgd->ident_data.support.command2 & ATA_SUPPORT_FLUSHCACHE) softc->flags |= ADA_FLAG_CAN_FLUSHCACHE; if (cgd->ident_data.support.command1 & ATA_SUPPORT_POWERMGT) softc->flags |= ADA_FLAG_CAN_POWERMGT; if ((cgd->ident_data.satacapabilities & ATA_SUPPORT_NCQ) && (cgd->inq_flags & SID_DMA) && (cgd->inq_flags & SID_CmdQue)) softc->flags |= ADA_FLAG_CAN_NCQ; if ((cgd->ident_data.support_dsm & ATA_SUPPORT_DSM_TRIM) && (cgd->inq_flags & SID_DMA)) { softc->flags |= ADA_FLAG_CAN_TRIM; softc->trim_max_ranges = TRIM_MAX_RANGES; if (cgd->ident_data.max_dsm_blocks != 0) { softc->trim_max_ranges = min(cgd->ident_data.max_dsm_blocks * 64, softc->trim_max_ranges); } } if (cgd->ident_data.support.command2 & ATA_SUPPORT_CFA) softc->flags |= ADA_FLAG_CAN_CFA; periph->softc = softc; /* * See if this device has any quirks. */ match = cam_quirkmatch((caddr_t)&cgd->ident_data, (caddr_t)ada_quirk_table, sizeof(ada_quirk_table)/sizeof(*ada_quirk_table), sizeof(*ada_quirk_table), ata_identify_match); if (match != NULL) softc->quirks = ((struct ada_quirk_entry *)match)->quirks; else softc->quirks = ADA_Q_NONE; bzero(&cpi, sizeof(cpi)); xpt_setup_ccb(&cpi.ccb_h, periph->path, CAM_PRIORITY_NONE); cpi.ccb_h.func_code = XPT_PATH_INQ; xpt_action((union ccb *)&cpi); TASK_INIT(&softc->sysctl_task, 0, adasysctlinit, periph); /* * Register this media as a disk */ (void)cam_periph_hold(periph, PRIBIO); mtx_unlock(periph->sim->mtx); snprintf(announce_buf, sizeof(announce_buf), "kern.cam.ada.%d.quirks", periph->unit_number); quirks = softc->quirks; TUNABLE_INT_FETCH(announce_buf, &quirks); softc->quirks = quirks; softc->read_ahead = -1; snprintf(announce_buf, sizeof(announce_buf), "kern.cam.ada.%d.read_ahead", periph->unit_number); TUNABLE_INT_FETCH(announce_buf, &softc->read_ahead); softc->write_cache = -1; snprintf(announce_buf, sizeof(announce_buf), "kern.cam.ada.%d.write_cache", periph->unit_number); TUNABLE_INT_FETCH(announce_buf, &softc->write_cache); softc->sort_io_queue = -1; adagetparams(periph, cgd); softc->disk = disk_alloc(); softc->disk->d_devstat = devstat_new_entry(periph->periph_name, periph->unit_number, softc->params.secsize, DEVSTAT_ALL_SUPPORTED, DEVSTAT_TYPE_DIRECT | XPORT_DEVSTAT_TYPE(cpi.transport), DEVSTAT_PRIORITY_DISK); softc->disk->d_open = adaopen; softc->disk->d_close = adaclose; softc->disk->d_strategy = adastrategy; softc->disk->d_getattr = adagetattr; softc->disk->d_dump = adadump; softc->disk->d_name = "ada"; softc->disk->d_drv1 = periph; maxio = cpi.maxio; /* Honor max I/O size of SIM */ if (maxio == 0) maxio = DFLTPHYS; /* traditional default */ else if (maxio > MAXPHYS) maxio = MAXPHYS; /* for safety */ if (softc->flags & ADA_FLAG_CAN_48BIT) maxio = min(maxio, 65536 * softc->params.secsize); else /* 28bit ATA command limit */ maxio = min(maxio, 256 * softc->params.secsize); softc->disk->d_maxsize = maxio; softc->disk->d_unit = periph->unit_number; softc->disk->d_flags = 0; if (softc->flags & ADA_FLAG_CAN_FLUSHCACHE) softc->disk->d_flags |= DISKFLAG_CANFLUSHCACHE; if ((softc->flags & ADA_FLAG_CAN_TRIM) || ((softc->flags & ADA_FLAG_CAN_CFA) && !(softc->flags & ADA_FLAG_CAN_48BIT))) softc->disk->d_flags |= DISKFLAG_CANDELETE; if ((cpi.hba_misc & PIM_UNMAPPED) != 0) softc->disk->d_flags |= DISKFLAG_UNMAPPED_BIO; strlcpy(softc->disk->d_descr, cgd->ident_data.model, MIN(sizeof(softc->disk->d_descr), sizeof(cgd->ident_data.model))); strlcpy(softc->disk->d_ident, cgd->ident_data.serial, MIN(sizeof(softc->disk->d_ident), sizeof(cgd->ident_data.serial))); softc->disk->d_hba_vendor = cpi.hba_vendor; softc->disk->d_hba_device = cpi.hba_device; softc->disk->d_hba_subvendor = cpi.hba_subvendor; softc->disk->d_hba_subdevice = cpi.hba_subdevice; softc->disk->d_sectorsize = softc->params.secsize; softc->disk->d_mediasize = (off_t)softc->params.sectors * softc->params.secsize; if (ata_physical_sector_size(&cgd->ident_data) != softc->params.secsize) { softc->disk->d_stripesize = ata_physical_sector_size(&cgd->ident_data); softc->disk->d_stripeoffset = (softc->disk->d_stripesize - ata_logical_sector_offset(&cgd->ident_data)) % softc->disk->d_stripesize; } else if (softc->quirks & ADA_Q_4K) { softc->disk->d_stripesize = 4096; softc->disk->d_stripeoffset = 0; } softc->disk->d_fwsectors = softc->params.secs_per_track; softc->disk->d_fwheads = softc->params.heads; ata_disk_firmware_geom_adjust(softc->disk); if (ada_legacy_aliases) { #ifdef ATA_STATIC_ID legacy_id = xpt_path_legacy_ata_id(periph->path); #else legacy_id = softc->disk->d_unit; #endif if (legacy_id >= 0) { snprintf(announce_buf, sizeof(announce_buf), "kern.devalias.%s%d", softc->disk->d_name, softc->disk->d_unit); snprintf(buf1, sizeof(buf1), "ad%d", legacy_id); setenv(announce_buf, buf1); } } else legacy_id = -1; disk_create(softc->disk, DISK_VERSION); mtx_lock(periph->sim->mtx); cam_periph_unhold(periph); dp = &softc->params; snprintf(announce_buf, sizeof(announce_buf), "%juMB (%ju %u byte sectors: %dH %dS/T %dC)", (uintmax_t)(((uintmax_t)dp->secsize * dp->sectors) / (1024*1024)), (uintmax_t)dp->sectors, dp->secsize, dp->heads, dp->secs_per_track, dp->cylinders); xpt_announce_periph(periph, announce_buf); if (legacy_id >= 0) printf("%s%d: Previously was known as ad%d\n", periph->periph_name, periph->unit_number, legacy_id); /* * Create our sysctl variables, now that we know * we have successfully attached. */ cam_periph_acquire(periph); taskqueue_enqueue(taskqueue_thread, &softc->sysctl_task); /* * Add async callbacks for bus reset and * bus device reset calls. I don't bother * checking if this fails as, in most cases, * the system will function just fine without * them and the only alternative would be to * not attach the device on failure. */ xpt_register_async(AC_SENT_BDR | AC_BUS_RESET | AC_LOST_DEVICE | AC_GETDEV_CHANGED | AC_ADVINFO_CHANGED, adaasync, periph, periph->path); /* * Schedule a periodic event to occasionally send an * ordered tag to a device. */ callout_init_mtx(&softc->sendordered_c, periph->sim->mtx, 0); callout_reset(&softc->sendordered_c, (ada_default_timeout * hz) / ADA_ORDEREDTAG_INTERVAL, adasendorderedtag, softc); if (ADA_RA >= 0 && cgd->ident_data.support.command1 & ATA_SUPPORT_LOOKAHEAD) { softc->state = ADA_STATE_RAHEAD; cam_periph_acquire(periph); cam_freeze_devq_arg(periph->path, RELSIM_RELEASE_RUNLEVEL, CAM_RL_DEV + 1); xpt_schedule(periph, CAM_PRIORITY_DEV); } else if (ADA_WC >= 0 && cgd->ident_data.support.command1 & ATA_SUPPORT_WRITECACHE) { softc->state = ADA_STATE_WCACHE; cam_periph_acquire(periph); cam_freeze_devq_arg(periph->path, RELSIM_RELEASE_RUNLEVEL, CAM_RL_DEV + 1); xpt_schedule(periph, CAM_PRIORITY_DEV); } else softc->state = ADA_STATE_NORMAL; return(CAM_REQ_CMP); } static void adastart(struct cam_periph *periph, union ccb *start_ccb) { struct ada_softc *softc = (struct ada_softc *)periph->softc; struct ccb_ataio *ataio = &start_ccb->ataio; CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("adastart\n")); switch (softc->state) { case ADA_STATE_NORMAL: { struct bio *bp; u_int8_t tag_code; /* Execute immediate CCB if waiting. */ if (periph->immediate_priority <= periph->pinfo.priority) { CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, ("queuing for immediate ccb\n")); start_ccb->ccb_h.ccb_state = ADA_CCB_WAITING; SLIST_INSERT_HEAD(&periph->ccb_list, &start_ccb->ccb_h, periph_links.sle); periph->immediate_priority = CAM_PRIORITY_NONE; wakeup(&periph->ccb_list); /* Have more work to do, so ensure we stay scheduled */ adaschedule(periph); break; } /* Run TRIM if not running yet. */ if (!softc->trim_running && (bp = bioq_first(&softc->trim_queue)) != 0) { struct trim_request *req = &softc->trim_req; struct bio *bp1; uint64_t lastlba = (uint64_t)-1; int bps = 0, c, lastcount = 0, off, ranges = 0; softc->trim_running = 1; bzero(req, sizeof(*req)); bp1 = bp; do { uint64_t lba = bp1->bio_pblkno; int count = bp1->bio_bcount / softc->params.secsize; bioq_remove(&softc->trim_queue, bp1); /* Try to extend the previous range. */ if (lba == lastlba) { c = min(count, 0xffff - lastcount); lastcount += c; off = (ranges - 1) * 8; req->data[off + 6] = lastcount & 0xff; req->data[off + 7] = (lastcount >> 8) & 0xff; count -= c; lba += c; } while (count > 0) { c = min(count, 0xffff); off = ranges * 8; req->data[off + 0] = lba & 0xff; req->data[off + 1] = (lba >> 8) & 0xff; req->data[off + 2] = (lba >> 16) & 0xff; req->data[off + 3] = (lba >> 24) & 0xff; req->data[off + 4] = (lba >> 32) & 0xff; req->data[off + 5] = (lba >> 40) & 0xff; req->data[off + 6] = c & 0xff; req->data[off + 7] = (c >> 8) & 0xff; lba += c; count -= c; lastcount = c; ranges++; } lastlba = lba; req->bps[bps++] = bp1; bp1 = bioq_first(&softc->trim_queue); if (bps >= TRIM_MAX_BIOS || bp1 == NULL || bp1->bio_bcount / softc->params.secsize > (softc->trim_max_ranges - ranges) * 0xffff) break; } while (1); cam_fill_ataio(ataio, ada_retry_count, adadone, CAM_DIR_OUT, 0, req->data, ((ranges + 63) / 64) * 512, ada_default_timeout * 1000); ata_48bit_cmd(ataio, ATA_DATA_SET_MANAGEMENT, ATA_DSM_TRIM, 0, (ranges + 63) / 64); start_ccb->ccb_h.ccb_state = ADA_CCB_TRIM; goto out; } /* Run regular command. */ bp = bioq_first(&softc->bio_queue); if (bp == NULL) { xpt_release_ccb(start_ccb); break; } bioq_remove(&softc->bio_queue, bp); if ((bp->bio_flags & BIO_ORDERED) != 0 || (softc->flags & ADA_FLAG_NEED_OTAG) != 0) { softc->flags &= ~ADA_FLAG_NEED_OTAG; softc->ordered_tag_count++; tag_code = 0; } else { tag_code = 1; } switch (bp->bio_cmd) { case BIO_READ: case BIO_WRITE: { uint64_t lba = bp->bio_pblkno; uint16_t count = bp->bio_bcount / softc->params.secsize; #ifdef ADA_TEST_FAILURE int fail = 0; /* * Support the failure ioctls. If the command is a * read, and there are pending forced read errors, or * if a write and pending write errors, then fail this * operation with EIO. This is useful for testing * purposes. Also, support having every Nth read fail. * * This is a rather blunt tool. */ if (bp->bio_cmd == BIO_READ) { if (softc->force_read_error) { softc->force_read_error--; fail = 1; } if (softc->periodic_read_error > 0) { if (++softc->periodic_read_count >= softc->periodic_read_error) { softc->periodic_read_count = 0; fail = 1; } } } else { if (softc->force_write_error) { softc->force_write_error--; fail = 1; } } if (fail) { bp->bio_error = EIO; bp->bio_flags |= BIO_ERROR; biodone(bp); xpt_release_ccb(start_ccb); adaschedule(periph); return; } #endif KASSERT((bp->bio_flags & BIO_UNMAPPED) == 0 || round_page(bp->bio_bcount + bp->bio_ma_offset) / PAGE_SIZE == bp->bio_ma_n, ("Short bio %p", bp)); cam_fill_ataio(ataio, ada_retry_count, adadone, (bp->bio_cmd == BIO_READ ? CAM_DIR_IN : CAM_DIR_OUT) | ((bp->bio_flags & BIO_UNMAPPED) != 0 ? CAM_DATA_BIO : 0), tag_code, ((bp->bio_flags & BIO_UNMAPPED) != 0) ? (void *)bp : bp->bio_data, bp->bio_bcount, ada_default_timeout*1000); if ((softc->flags & ADA_FLAG_CAN_NCQ) && tag_code) { if (bp->bio_cmd == BIO_READ) { ata_ncq_cmd(ataio, ATA_READ_FPDMA_QUEUED, lba, count); } else { ata_ncq_cmd(ataio, ATA_WRITE_FPDMA_QUEUED, lba, count); } } else if ((softc->flags & ADA_FLAG_CAN_48BIT) && (lba + count >= ATA_MAX_28BIT_LBA || count > 256)) { if (softc->flags & ADA_FLAG_CAN_DMA) { if (bp->bio_cmd == BIO_READ) { ata_48bit_cmd(ataio, ATA_READ_DMA48, 0, lba, count); } else { ata_48bit_cmd(ataio, ATA_WRITE_DMA48, 0, lba, count); } } else { if (bp->bio_cmd == BIO_READ) { ata_48bit_cmd(ataio, ATA_READ_MUL48, 0, lba, count); } else { ata_48bit_cmd(ataio, ATA_WRITE_MUL48, 0, lba, count); } } } else { if (count == 256) count = 0; if (softc->flags & ADA_FLAG_CAN_DMA) { if (bp->bio_cmd == BIO_READ) { ata_28bit_cmd(ataio, ATA_READ_DMA, 0, lba, count); } else { ata_28bit_cmd(ataio, ATA_WRITE_DMA, 0, lba, count); } } else { if (bp->bio_cmd == BIO_READ) { ata_28bit_cmd(ataio, ATA_READ_MUL, 0, lba, count); } else { ata_28bit_cmd(ataio, ATA_WRITE_MUL, 0, lba, count); } } } break; } case BIO_DELETE: { uint64_t lba = bp->bio_pblkno; uint16_t count = bp->bio_bcount / softc->params.secsize; cam_fill_ataio(ataio, ada_retry_count, adadone, CAM_DIR_NONE, 0, NULL, 0, ada_default_timeout*1000); if (count >= 256) count = 0; ata_28bit_cmd(ataio, ATA_CFA_ERASE, 0, lba, count); break; } case BIO_FLUSH: cam_fill_ataio(ataio, 1, adadone, CAM_DIR_NONE, 0, NULL, 0, ada_default_timeout*1000); if (softc->flags & ADA_FLAG_CAN_48BIT) ata_48bit_cmd(ataio, ATA_FLUSHCACHE48, 0, 0, 0); else ata_28bit_cmd(ataio, ATA_FLUSHCACHE, 0, 0, 0); break; } start_ccb->ccb_h.ccb_state = ADA_CCB_BUFFER_IO; out: start_ccb->ccb_h.ccb_bp = bp; softc->outstanding_cmds++; xpt_action(start_ccb); /* May have more work to do, so ensure we stay scheduled */ adaschedule(periph); break; } case ADA_STATE_RAHEAD: case ADA_STATE_WCACHE: { if (softc->flags & ADA_FLAG_PACK_INVALID) { softc->state = ADA_STATE_NORMAL; xpt_release_ccb(start_ccb); cam_release_devq(periph->path, RELSIM_RELEASE_RUNLEVEL, 0, CAM_RL_DEV + 1, FALSE); adaschedule(periph); cam_periph_release_locked(periph); return; } cam_fill_ataio(ataio, 1, adadone, CAM_DIR_NONE, 0, NULL, 0, ada_default_timeout*1000); if (softc->state == ADA_STATE_RAHEAD) { ata_28bit_cmd(ataio, ATA_SETFEATURES, ADA_RA ? ATA_SF_ENAB_RCACHE : ATA_SF_DIS_RCACHE, 0, 0); start_ccb->ccb_h.ccb_state = ADA_CCB_RAHEAD; } else { ata_28bit_cmd(ataio, ATA_SETFEATURES, ADA_WC ? ATA_SF_ENAB_WCACHE : ATA_SF_DIS_WCACHE, 0, 0); start_ccb->ccb_h.ccb_state = ADA_CCB_WCACHE; } xpt_action(start_ccb); break; } } } static void adadone(struct cam_periph *periph, union ccb *done_ccb) { struct ada_softc *softc; struct ccb_ataio *ataio; struct ccb_getdev *cgd; softc = (struct ada_softc *)periph->softc; ataio = &done_ccb->ataio; CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("adadone\n")); switch (ataio->ccb_h.ccb_state & ADA_CCB_TYPE_MASK) { case ADA_CCB_BUFFER_IO: case ADA_CCB_TRIM: { struct bio *bp; bp = (struct bio *)done_ccb->ccb_h.ccb_bp; if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { int error; error = adaerror(done_ccb, 0, 0); if (error == ERESTART) { /* A retry was scheduled, so just return. */ return; } if (error != 0) { if (error == ENXIO && (softc->flags & ADA_FLAG_PACK_INVALID) == 0) { /* * Catastrophic error. Mark our pack as * invalid. */ /* * XXX See if this is really a media * XXX change first? */ xpt_print(periph->path, "Invalidating pack\n"); softc->flags |= ADA_FLAG_PACK_INVALID; } bp->bio_error = error; bp->bio_resid = bp->bio_bcount; bp->bio_flags |= BIO_ERROR; } else { bp->bio_resid = ataio->resid; bp->bio_error = 0; if (bp->bio_resid != 0) bp->bio_flags |= BIO_ERROR; } if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) cam_release_devq(done_ccb->ccb_h.path, /*relsim_flags*/0, /*reduction*/0, /*timeout*/0, /*getcount_only*/0); } else { if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) panic("REQ_CMP with QFRZN"); bp->bio_resid = ataio->resid; if (ataio->resid > 0) bp->bio_flags |= BIO_ERROR; } softc->outstanding_cmds--; if (softc->outstanding_cmds == 0) softc->flags |= ADA_FLAG_WENT_IDLE; if ((ataio->ccb_h.ccb_state & ADA_CCB_TYPE_MASK) == ADA_CCB_TRIM) { struct trim_request *req = (struct trim_request *)ataio->data_ptr; int i; for (i = 1; i < TRIM_MAX_BIOS && req->bps[i]; i++) { struct bio *bp1 = req->bps[i]; bp1->bio_resid = bp->bio_resid; bp1->bio_error = bp->bio_error; if (bp->bio_flags & BIO_ERROR) bp1->bio_flags |= BIO_ERROR; biodone(bp1); } softc->trim_running = 0; biodone(bp); adaschedule(periph); } else biodone(bp); break; } case ADA_CCB_RAHEAD: { if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { if (adaerror(done_ccb, 0, 0) == ERESTART) { return; } else if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) { cam_release_devq(done_ccb->ccb_h.path, /*relsim_flags*/0, /*reduction*/0, /*timeout*/0, /*getcount_only*/0); } } /* * Since our peripheral may be invalidated by an error * above or an external event, we must release our CCB * before releasing the reference on the peripheral. * The peripheral will only go away once the last reference * is removed, and we need it around for the CCB release * operation. */ cgd = (struct ccb_getdev *)done_ccb; xpt_setup_ccb(&cgd->ccb_h, periph->path, CAM_PRIORITY_NORMAL); cgd->ccb_h.func_code = XPT_GDEV_TYPE; xpt_action((union ccb *)cgd); if (ADA_WC >= 0 && cgd->ident_data.support.command1 & ATA_SUPPORT_WRITECACHE) { softc->state = ADA_STATE_WCACHE; xpt_release_ccb(done_ccb); xpt_schedule(periph, CAM_PRIORITY_DEV); return; } softc->state = ADA_STATE_NORMAL; xpt_release_ccb(done_ccb); cam_release_devq(periph->path, RELSIM_RELEASE_RUNLEVEL, 0, CAM_RL_DEV + 1, FALSE); adaschedule(periph); cam_periph_release_locked(periph); return; } case ADA_CCB_WCACHE: { if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { if (adaerror(done_ccb, 0, 0) == ERESTART) { return; } else if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) { cam_release_devq(done_ccb->ccb_h.path, /*relsim_flags*/0, /*reduction*/0, /*timeout*/0, /*getcount_only*/0); } } softc->state = ADA_STATE_NORMAL; /* * Since our peripheral may be invalidated by an error * above or an external event, we must release our CCB * before releasing the reference on the peripheral. * The peripheral will only go away once the last reference * is removed, and we need it around for the CCB release * operation. */ xpt_release_ccb(done_ccb); cam_release_devq(periph->path, RELSIM_RELEASE_RUNLEVEL, 0, CAM_RL_DEV + 1, FALSE); adaschedule(periph); cam_periph_release_locked(periph); return; } case ADA_CCB_WAITING: { /* Caller will release the CCB */ wakeup(&done_ccb->ccb_h.cbfcnp); return; } case ADA_CCB_DUMP: /* No-op. We're polling */ return; default: break; } xpt_release_ccb(done_ccb); } static int adaerror(union ccb *ccb, u_int32_t cam_flags, u_int32_t sense_flags) { return(cam_periph_error(ccb, cam_flags, sense_flags, NULL)); } static void adagetparams(struct cam_periph *periph, struct ccb_getdev *cgd) { struct ada_softc *softc = (struct ada_softc *)periph->softc; struct disk_params *dp = &softc->params; u_int64_t lbasize48; u_int32_t lbasize; dp->secsize = ata_logical_sector_size(&cgd->ident_data); if ((cgd->ident_data.atavalid & ATA_FLAG_54_58) && cgd->ident_data.current_heads && cgd->ident_data.current_sectors) { dp->heads = cgd->ident_data.current_heads; dp->secs_per_track = cgd->ident_data.current_sectors; dp->cylinders = cgd->ident_data.cylinders; dp->sectors = (u_int32_t)cgd->ident_data.current_size_1 | ((u_int32_t)cgd->ident_data.current_size_2 << 16); } else { dp->heads = cgd->ident_data.heads; dp->secs_per_track = cgd->ident_data.sectors; dp->cylinders = cgd->ident_data.cylinders; dp->sectors = cgd->ident_data.cylinders * dp->heads * dp->secs_per_track; } lbasize = (u_int32_t)cgd->ident_data.lba_size_1 | ((u_int32_t)cgd->ident_data.lba_size_2 << 16); /* use the 28bit LBA size if valid or bigger than the CHS mapping */ if (cgd->ident_data.cylinders == 16383 || dp->sectors < lbasize) dp->sectors = lbasize; /* use the 48bit LBA size if valid */ lbasize48 = ((u_int64_t)cgd->ident_data.lba_size48_1) | ((u_int64_t)cgd->ident_data.lba_size48_2 << 16) | ((u_int64_t)cgd->ident_data.lba_size48_3 << 32) | ((u_int64_t)cgd->ident_data.lba_size48_4 << 48); if ((cgd->ident_data.support.command2 & ATA_SUPPORT_ADDRESS48) && lbasize48 > ATA_MAX_28BIT_LBA) dp->sectors = lbasize48; } static void adasendorderedtag(void *arg) { struct ada_softc *softc = arg; if (ada_send_ordered) { if ((softc->ordered_tag_count == 0) && ((softc->flags & ADA_FLAG_WENT_IDLE) == 0)) { softc->flags |= ADA_FLAG_NEED_OTAG; } if (softc->outstanding_cmds > 0) softc->flags &= ~ADA_FLAG_WENT_IDLE; softc->ordered_tag_count = 0; } /* Queue us up again */ callout_reset(&softc->sendordered_c, (ada_default_timeout * hz) / ADA_ORDEREDTAG_INTERVAL, adasendorderedtag, softc); } /* * Step through all ADA peripheral drivers, and if the device is still open, * sync the disk cache to physical media. */ static void adaflush(void) { struct cam_periph *periph; struct ada_softc *softc; union ccb *ccb; int error; CAM_PERIPH_FOREACH(periph, &adadriver) { /* If we paniced with lock held - not recurse here. */ if (cam_periph_owned(periph)) continue; cam_periph_lock(periph); softc = (struct ada_softc *)periph->softc; /* * We only sync the cache if the drive is still open, and * if the drive is capable of it.. */ if (((softc->flags & ADA_FLAG_OPEN) == 0) || (softc->flags & ADA_FLAG_CAN_FLUSHCACHE) == 0) { cam_periph_unlock(periph); continue; } ccb = cam_periph_getccb(periph, CAM_PRIORITY_NORMAL); cam_fill_ataio(&ccb->ataio, 0, adadone, CAM_DIR_NONE, 0, NULL, 0, ada_default_timeout*1000); if (softc->flags & ADA_FLAG_CAN_48BIT) ata_48bit_cmd(&ccb->ataio, ATA_FLUSHCACHE48, 0, 0, 0); else ata_28bit_cmd(&ccb->ataio, ATA_FLUSHCACHE, 0, 0, 0); error = cam_periph_runccb(ccb, adaerror, /*cam_flags*/0, /*sense_flags*/ SF_NO_RECOVERY | SF_NO_RETRY, softc->disk->d_devstat); if (error != 0) xpt_print(periph->path, "Synchronize cache failed\n"); xpt_release_ccb(ccb); cam_periph_unlock(periph); } } static void adaspindown(uint8_t cmd, int flags) { struct cam_periph *periph; struct ada_softc *softc; union ccb *ccb; int error; CAM_PERIPH_FOREACH(periph, &adadriver) { /* If we paniced with lock held - not recurse here. */ if (cam_periph_owned(periph)) continue; cam_periph_lock(periph); softc = (struct ada_softc *)periph->softc; /* * We only spin-down the drive if it is capable of it.. */ if ((softc->flags & ADA_FLAG_CAN_POWERMGT) == 0) { cam_periph_unlock(periph); continue; } if (bootverbose) xpt_print(periph->path, "spin-down\n"); ccb = cam_periph_getccb(periph, CAM_PRIORITY_NORMAL); cam_fill_ataio(&ccb->ataio, 0, adadone, CAM_DIR_NONE | flags, 0, NULL, 0, ada_default_timeout*1000); ata_28bit_cmd(&ccb->ataio, cmd, 0, 0, 0); error = cam_periph_runccb(ccb, adaerror, /*cam_flags*/0, /*sense_flags*/ SF_NO_RECOVERY | SF_NO_RETRY, softc->disk->d_devstat); if (error != 0) xpt_print(periph->path, "Spin-down disk failed\n"); xpt_release_ccb(ccb); cam_periph_unlock(periph); } } static void adashutdown(void *arg, int howto) { adaflush(); if (ada_spindown_shutdown != 0 && (howto & (RB_HALT | RB_POWEROFF)) != 0) adaspindown(ATA_STANDBY_IMMEDIATE, 0); } static void adasuspend(void *arg) { adaflush(); if (ada_spindown_suspend != 0) adaspindown(ATA_SLEEP, CAM_DEV_QFREEZE); } static void adaresume(void *arg) { struct cam_periph *periph; struct ada_softc *softc; if (ada_spindown_suspend == 0) return; CAM_PERIPH_FOREACH(periph, &adadriver) { cam_periph_lock(periph); softc = (struct ada_softc *)periph->softc; /* * We only spin-down the drive if it is capable of it.. */ if ((softc->flags & ADA_FLAG_CAN_POWERMGT) == 0) { cam_periph_unlock(periph); continue; } if (bootverbose) xpt_print(periph->path, "resume\n"); /* * Drop freeze taken due to CAM_DEV_QFREEZE flag set on * sleep request. */ cam_release_devq(periph->path, /*relsim_flags*/0, /*openings*/0, /*timeout*/0, /*getcount_only*/0); cam_periph_unlock(periph); } } #endif /* _KERNEL */ Index: head/sys/conf/NOTES =================================================================== --- head/sys/conf/NOTES (revision 249082) +++ head/sys/conf/NOTES (revision 249083) @@ -1,2984 +1,2971 @@ # $FreeBSD$ # # NOTES -- Lines that can be cut/pasted into kernel and hints configs. # # Lines that begin with 'device', 'options', 'machine', 'ident', 'maxusers', # 'makeoptions', 'hints', etc. go into the kernel configuration that you # run config(8) with. # # Lines that begin with 'hint.' are NOT for config(8), they go into your # hints file. See /boot/device.hints and/or the 'hints' config(8) directive. # # Please use ``make LINT'' to create an old-style LINT file if you want to # do kernel test-builds. # # This file contains machine independent kernel configuration notes. For # machine dependent notes, look in /sys//conf/NOTES. # # # NOTES conventions and style guide: # # Large block comments should begin and end with a line containing only a # comment character. # # To describe a particular object, a block comment (if it exists) should # come first. Next should come device, options, and hints lines in that # order. All device and option lines must be described by a comment that # doesn't just expand the device or option name. Use only a concise # comment on the same line if possible. Very detailed descriptions of # devices and subsystems belong in man pages. # # A space followed by a tab separates 'options' from an option name. Two # spaces followed by a tab separate 'device' from a device name. Comments # after an option or device should use one space after the comment character. # To comment out a negative option that disables code and thus should not be # enabled for LINT builds, precede 'options' with "#!". # # # This is the ``identification'' of the kernel. Usually this should # be the same as the name of your kernel. # ident LINT # # The `maxusers' parameter controls the static sizing of a number of # internal system tables by a formula defined in subr_param.c. # Omitting this parameter or setting it to 0 will cause the system to # auto-size based on physical memory. # maxusers 10 # To statically compile in device wiring instead of /boot/device.hints #hints "LINT.hints" # Default places to look for devices. # Use the following to compile in values accessible to the kernel # through getenv() (or kenv(1) in userland). The format of the file # is 'variable=value', see kenv(1) # #env "LINT.env" # # The `makeoptions' parameter allows variables to be passed to the # generated Makefile in the build area. # # CONF_CFLAGS gives some extra compiler flags that are added to ${CFLAGS} # after most other flags. Here we use it to inhibit use of non-optimal # gcc built-in functions (e.g., memcmp). # # DEBUG happens to be magic. # The following is equivalent to 'config -g KERNELNAME' and creates # 'kernel.debug' compiled with -g debugging as well as a normal # 'kernel'. Use 'make install.debug' to install the debug kernel # but that isn't normally necessary as the debug symbols are not loaded # by the kernel and are not useful there anyway. # # KERNEL can be overridden so that you can change the default name of your # kernel. # # MODULES_OVERRIDE can be used to limit modules built to a specific list. # makeoptions CONF_CFLAGS=-fno-builtin #Don't allow use of memcmp, etc. #makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols #makeoptions KERNEL=foo #Build kernel "foo" and install "/foo" # Only build ext2fs module plus those parts of the sound system I need. #makeoptions MODULES_OVERRIDE="ext2fs sound/sound sound/driver/maestro3" makeoptions DESTDIR=/tmp # # FreeBSD processes are subject to certain limits to their consumption # of system resources. See getrlimit(2) for more details. Each # resource limit has two values, a "soft" limit and a "hard" limit. # The soft limits can be modified during normal system operation, but # the hard limits are set at boot time. Their default values are # in sys//include/vmparam.h. There are two ways to change them: # # 1. Set the values at kernel build time. The options below are one # way to allow that limit to grow to 1GB. They can be increased # further by changing the parameters: # # 2. In /boot/loader.conf, set the tunables kern.maxswzone, # kern.maxbcache, kern.maxtsiz, kern.dfldsiz, kern.maxdsiz, # kern.dflssiz, kern.maxssiz and kern.sgrowsiz. # # The options in /boot/loader.conf override anything in the kernel # configuration file. See the function init_param1 in # sys/kern/subr_param.c for more details. # options MAXDSIZ=(1024UL*1024*1024) options MAXSSIZ=(128UL*1024*1024) options DFLDSIZ=(1024UL*1024*1024) # # BLKDEV_IOSIZE sets the default block size used in user block # device I/O. Note that this value will be overridden by the label # when specifying a block device from a label with a non-0 # partition blocksize. The default is PAGE_SIZE. # options BLKDEV_IOSIZE=8192 # # MAXPHYS and DFLTPHYS # # These are the maximal and safe 'raw' I/O block device access sizes. # Reads and writes will be split into MAXPHYS chunks for known good # devices and DFLTPHYS for the rest. Some applications have better # performance with larger raw I/O access sizes. Note that certain VM # parameters are derived from these values and making them too large # can make an an unbootable kernel. # # The defaults are 64K and 128K respectively. options DFLTPHYS=(64*1024) options MAXPHYS=(128*1024) # This allows you to actually store this configuration file into # the kernel binary itself. See config(8) for more details. # options INCLUDE_CONFIG_FILE # Include this file in kernel # # Compile-time defaults for various boot parameters # options BOOTVERBOSE=1 options BOOTHOWTO=RB_MULTIPLE options GEOM_AES # Don't use, use GEOM_BDE options GEOM_BDE # Disk encryption. options GEOM_BSD # BSD disklabels options GEOM_CACHE # Disk cache. options GEOM_CONCAT # Disk concatenation. options GEOM_ELI # Disk encryption. options GEOM_FOX # Redundant path mitigation options GEOM_GATE # Userland services. options GEOM_JOURNAL # Journaling. options GEOM_LABEL # Providers labelization. options GEOM_LINUX_LVM # Linux LVM2 volumes options GEOM_MBR # DOS/MBR partitioning options GEOM_MIRROR # Disk mirroring. options GEOM_MULTIPATH # Disk multipath options GEOM_NOP # Test class. options GEOM_PART_APM # Apple partitioning options GEOM_PART_BSD # BSD disklabel options GEOM_PART_EBR # Extended Boot Records options GEOM_PART_EBR_COMPAT # Backward compatible partition names options GEOM_PART_GPT # GPT partitioning options GEOM_PART_LDM # Logical Disk Manager options GEOM_PART_MBR # MBR partitioning options GEOM_PART_PC98 # PC-9800 disk partitioning options GEOM_PART_VTOC8 # SMI VTOC8 disk label options GEOM_PC98 # NEC PC9800 partitioning options GEOM_RAID # Soft RAID functionality. options GEOM_RAID3 # RAID3 functionality. options GEOM_SHSEC # Shared secret. options GEOM_STRIPE # Disk striping. options GEOM_SUNLABEL # Sun/Solaris partitioning options GEOM_UZIP # Read-only compressed disks options GEOM_VIRSTOR # Virtual storage. options GEOM_VOL # Volume names from UFS superblock options GEOM_ZERO # Performance testing helper. # # The root device and filesystem type can be compiled in; # this provides a fallback option if the root device cannot # be correctly guessed by the bootstrap code, or an override if # the RB_DFLTROOT flag (-r) is specified when booting the kernel. # options ROOTDEVNAME=\"ufs:da0s2e\" ##################################################################### # Scheduler options: # # Specifying one of SCHED_4BSD or SCHED_ULE is mandatory. These options # select which scheduler is compiled in. # # SCHED_4BSD is the historical, proven, BSD scheduler. It has a global run # queue and no CPU affinity which makes it suboptimal for SMP. It has very # good interactivity and priority selection. # # SCHED_ULE provides significant performance advantages over 4BSD on many # workloads on SMP machines. It supports cpu-affinity, per-cpu runqueues # and scheduler locks. It also has a stronger notion of interactivity # which leads to better responsiveness even on uniprocessor machines. This # is the default scheduler. # # SCHED_STATS is a debugging option which keeps some stats in the sysctl # tree at 'kern.sched.stats' and is useful for debugging scheduling decisions. # options SCHED_4BSD options SCHED_STATS #options SCHED_ULE ##################################################################### # SMP OPTIONS: # # SMP enables building of a Symmetric MultiProcessor Kernel. # Mandatory: options SMP # Symmetric MultiProcessor Kernel # MAXCPU defines the maximum number of CPUs that can boot in the system. # A default value should be already present, for every architecture. options MAXCPU=32 # ADAPTIVE_MUTEXES changes the behavior of blocking mutexes to spin # if the thread that currently owns the mutex is executing on another # CPU. This behavior is enabled by default, so this option can be used # to disable it. options NO_ADAPTIVE_MUTEXES # ADAPTIVE_RWLOCKS changes the behavior of reader/writer locks to spin # if the thread that currently owns the rwlock is executing on another # CPU. This behavior is enabled by default, so this option can be used # to disable it. options NO_ADAPTIVE_RWLOCKS # ADAPTIVE_SX changes the behavior of sx locks to spin if the thread that # currently owns the sx lock is executing on another CPU. # This behavior is enabled by default, so this option can be used to # disable it. options NO_ADAPTIVE_SX # MUTEX_NOINLINE forces mutex operations to call functions to perform each # operation rather than inlining the simple cases. This can be used to # shrink the size of the kernel text segment. Note that this behavior is # already implied by the INVARIANT_SUPPORT, INVARIANTS, KTR, LOCK_PROFILING, # and WITNESS options. options MUTEX_NOINLINE # RWLOCK_NOINLINE forces rwlock operations to call functions to perform each # operation rather than inlining the simple cases. This can be used to # shrink the size of the kernel text segment. Note that this behavior is # already implied by the INVARIANT_SUPPORT, INVARIANTS, KTR, LOCK_PROFILING, # and WITNESS options. options RWLOCK_NOINLINE # SX_NOINLINE forces sx lock operations to call functions to perform each # operation rather than inlining the simple cases. This can be used to # shrink the size of the kernel text segment. Note that this behavior is # already implied by the INVARIANT_SUPPORT, INVARIANTS, KTR, LOCK_PROFILING, # and WITNESS options. options SX_NOINLINE # SMP Debugging Options: # # CALLOUT_PROFILING enables rudimentary profiling of the callwheel data # structure used as backend in callout(9). # PREEMPTION allows the threads that are in the kernel to be preempted by # higher priority [interrupt] threads. It helps with interactivity # and allows interrupt threads to run sooner rather than waiting. # WARNING! Only tested on amd64 and i386. # FULL_PREEMPTION instructs the kernel to preempt non-realtime kernel # threads. Its sole use is to expose race conditions and other # bugs during development. Enabling this option will reduce # performance and increase the frequency of kernel panics by # design. If you aren't sure that you need it then you don't. # Relies on the PREEMPTION option. DON'T TURN THIS ON. # MUTEX_DEBUG enables various extra assertions in the mutex code. # SLEEPQUEUE_PROFILING enables rudimentary profiling of the hash table # used to hold active sleep queues as well as sleep wait message # frequency. # TURNSTILE_PROFILING enables rudimentary profiling of the hash table # used to hold active lock queues. # UMTX_PROFILING enables rudimentary profiling of the hash table used to hold active lock queues. # WITNESS enables the witness code which detects deadlocks and cycles # during locking operations. # WITNESS_KDB causes the witness code to drop into the kernel debugger if # a lock hierarchy violation occurs or if locks are held when going to # sleep. # WITNESS_SKIPSPIN disables the witness checks on spin mutexes. options PREEMPTION options FULL_PREEMPTION options MUTEX_DEBUG options WITNESS options WITNESS_KDB options WITNESS_SKIPSPIN # LOCK_PROFILING - Profiling locks. See LOCK_PROFILING(9) for details. options LOCK_PROFILING # Set the number of buffers and the hash size. The hash size MUST be larger # than the number of buffers. Hash size should be prime. options MPROF_BUFFERS="1536" options MPROF_HASH_SIZE="1543" # Profiling for the callout(9) backend. options CALLOUT_PROFILING # Profiling for internal hash tables. options SLEEPQUEUE_PROFILING options TURNSTILE_PROFILING options UMTX_PROFILING ##################################################################### # COMPATIBILITY OPTIONS # # Implement system calls compatible with 4.3BSD and older versions of # FreeBSD. You probably do NOT want to remove this as much current code # still relies on the 4.3 emulation. Note that some architectures that # are supported by FreeBSD do not include support for certain important # aspects of this compatibility option, namely those related to the # signal delivery mechanism. # options COMPAT_43 # Old tty interface. options COMPAT_43TTY # Note that as a general rule, COMPAT_FREEBSD depends on # COMPAT_FREEBSD, COMPAT_FREEBSD, etc. # Enable FreeBSD4 compatibility syscalls options COMPAT_FREEBSD4 # Enable FreeBSD5 compatibility syscalls options COMPAT_FREEBSD5 # Enable FreeBSD6 compatibility syscalls options COMPAT_FREEBSD6 # Enable FreeBSD7 compatibility syscalls options COMPAT_FREEBSD7 # # These three options provide support for System V Interface # Definition-style interprocess communication, in the form of shared # memory, semaphores, and message queues, respectively. # options SYSVSHM options SYSVSEM options SYSVMSG ##################################################################### # DEBUGGING OPTIONS # # Compile with kernel debugger related code. # options KDB # # Print a stack trace of the current thread on the console for a panic. # options KDB_TRACE # # Don't enter the debugger for a panic. Intended for unattended operation # where you may want to enter the debugger from the console, but still want # the machine to recover from a panic. # options KDB_UNATTENDED # # Enable the ddb debugger backend. # options DDB # # Print the numerical value of symbols in addition to the symbolic # representation. # options DDB_NUMSYM # # Enable the remote gdb debugger backend. # options GDB # # SYSCTL_DEBUG enables a 'sysctl' debug tree that can be used to dump the # contents of the registered sysctl nodes on the console. It is disabled by # default because it generates excessively verbose console output that can # interfere with serial console operation. # options SYSCTL_DEBUG # # Enable textdump by default, this disables kernel core dumps. # options TEXTDUMP_PREFERRED # # Enable extra debug messages while performing textdumps. # options TEXTDUMP_VERBOSE # # NO_SYSCTL_DESCR omits the sysctl node descriptions to save space in the # resulting kernel. options NO_SYSCTL_DESCR # # MALLOC_DEBUG_MAXZONES enables multiple uma zones for malloc(9) # allocations that are smaller than a page. The purpose is to isolate # different malloc types into hash classes, so that any buffer # overruns or use-after-free will usually only affect memory from # malloc types in that hash class. This is purely a debugging tool; # by varying the hash function and tracking which hash class was # corrupted, the intersection of the hash classes from each instance # will point to a single malloc type that is being misused. At this # point inspection or memguard(9) can be used to catch the offending # code. # options MALLOC_DEBUG_MAXZONES=8 # # DEBUG_MEMGUARD builds and enables memguard(9), a replacement allocator # for the kernel used to detect modify-after-free scenarios. See the # memguard(9) man page for more information on usage. # options DEBUG_MEMGUARD # # DEBUG_REDZONE enables buffer underflows and buffer overflows detection for # malloc(9). # options DEBUG_REDZONE # # KTRACE enables the system-call tracing facility ktrace(2). To be more # SMP-friendly, KTRACE uses a worker thread to process most trace events # asynchronously to the thread generating the event. This requires a # pre-allocated store of objects representing trace events. The # KTRACE_REQUEST_POOL option specifies the initial size of this store. # The size of the pool can be adjusted both at boottime and runtime via # the kern.ktrace_request_pool tunable and sysctl. # options KTRACE #kernel tracing options KTRACE_REQUEST_POOL=101 # # KTR is a kernel tracing facility imported from BSD/OS. It is # enabled with the KTR option. KTR_ENTRIES defines the number of # entries in the circular trace buffer; it may be an arbitrary number. # KTR_BOOT_ENTRIES defines the number of entries during the early boot, # before malloc(9) is functional. # KTR_COMPILE defines the mask of events to compile into the kernel as # defined by the KTR_* constants in . KTR_MASK defines the # initial value of the ktr_mask variable which determines at runtime # what events to trace. KTR_CPUMASK determines which CPU's log # events, with bit X corresponding to CPU X. The layout of the string # passed as KTR_CPUMASK must match a series of bitmasks each of them # separated by the "," character (ie: # KTR_CPUMASK=0xAF,0xFFFFFFFFFFFFFFFF). KTR_VERBOSE enables # dumping of KTR events to the console by default. This functionality # can be toggled via the debug.ktr_verbose sysctl and defaults to off # if KTR_VERBOSE is not defined. See ktr(4) and ktrdump(8) for details. # options KTR options KTR_BOOT_ENTRIES=1024 options KTR_ENTRIES=(128*1024) options KTR_COMPILE=(KTR_INTR|KTR_PROC) options KTR_MASK=KTR_INTR options KTR_CPUMASK=0x3 options KTR_VERBOSE # # ALQ(9) is a facility for the asynchronous queuing of records from the kernel # to a vnode, and is employed by services such as ktr(4) to produce trace # files based on a kernel event stream. Records are written asynchronously # in a worker thread. # options ALQ options KTR_ALQ # # The INVARIANTS option is used in a number of source files to enable # extra sanity checking of internal structures. This support is not # enabled by default because of the extra time it would take to check # for these conditions, which can only occur as a result of # programming errors. # options INVARIANTS # # The INVARIANT_SUPPORT option makes us compile in support for # verifying some of the internal structures. It is a prerequisite for # 'INVARIANTS', as enabling 'INVARIANTS' will make these functions be # called. The intent is that you can set 'INVARIANTS' for single # source files (by changing the source file or specifying it on the # command line) if you have 'INVARIANT_SUPPORT' enabled. Also, if you # wish to build a kernel module with 'INVARIANTS', then adding # 'INVARIANT_SUPPORT' to your kernel will provide all the necessary # infrastructure without the added overhead. # options INVARIANT_SUPPORT # # The DIAGNOSTIC option is used to enable extra debugging information # from some parts of the kernel. As this makes everything more noisy, # it is disabled by default. # options DIAGNOSTIC # # REGRESSION causes optional kernel interfaces necessary only for regression # testing to be enabled. These interfaces may constitute security risks # when enabled, as they permit processes to easily modify aspects of the # run-time environment to reproduce unlikely or unusual (possibly normally # impossible) scenarios. # options REGRESSION # # This option lets some drivers co-exist that can't co-exist in a running # system. This is used to be able to compile all kernel code in one go for # quality assurance purposes (like this file, which the option takes it name # from.) # options COMPILING_LINT # # STACK enables the stack(9) facility, allowing the capture of kernel stack # for the purpose of procinfo(1), etc. stack(9) will also be compiled in # automatically if DDB(4) is compiled into the kernel. # options STACK ##################################################################### # PERFORMANCE MONITORING OPTIONS # # The hwpmc driver that allows the use of in-CPU performance monitoring # counters for performance monitoring. The base kernel needs to be configured # with the 'options' line, while the hwpmc device can be either compiled # in or loaded as a loadable kernel module. # # Additional configuration options may be required on specific architectures, # please see hwpmc(4). device hwpmc # Driver (also a loadable module) options HWPMC_HOOKS # Other necessary kernel hooks ##################################################################### # NETWORKING OPTIONS # # Protocol families # options INET #Internet communications protocols options INET6 #IPv6 communications protocols options ROUTETABLES=2 # max 16. 1 is back compatible. options TCP_OFFLOAD # TCP offload support. # In order to enable IPSEC you MUST also add device crypto to # your kernel configuration options IPSEC #IP security (requires device crypto) #options IPSEC_DEBUG #debug for IP security # # #DEPRECATED# # Set IPSEC_FILTERTUNNEL to change the default of the sysctl to force packets # coming through a tunnel to be processed by any configured packet filtering # twice. The default is that packets coming out of a tunnel are _not_ processed; # they are assumed trusted. # # IPSEC history is preserved for such packets, and can be filtered # using ipfw(8)'s 'ipsec' keyword, when this option is enabled. # #options IPSEC_FILTERTUNNEL #filter ipsec packets from a tunnel # # Set IPSEC_NAT_T to enable NAT-Traversal support. This enables # optional UDP encapsulation of ESP packets. # options IPSEC_NAT_T #NAT-T support, UDP encap of ESP options IPX #IPX/SPX communications protocols options NETATALK #Appletalk communications protocols options NETATALKDEBUG #Appletalk debugging # mchain library. It can be either loaded as KLD or compiled into kernel options LIBMCHAIN # libalias library, performing NAT options LIBALIAS # flowtable cache options FLOWTABLE # # SCTP is a NEW transport protocol defined by # RFC2960 updated by RFC3309 and RFC3758.. and # soon to have a new base RFC and many many more # extensions. This release supports all the extensions # including many drafts (most about to become RFC's). # It is the reference implementation of SCTP # and is quite well tested. # # Note YOU MUST have both INET and INET6 defined. # You don't have to enable V6, but SCTP is # dual stacked and so far we have not torn apart # the V6 and V4.. since an association can span # both a V6 and V4 address at the SAME time :-) # options SCTP # There are bunches of options: # this one turns on all sorts of # nastily printing that you can # do. It's all controlled by a # bit mask (settable by socket opt and # by sysctl). Including will not cause # logging until you set the bits.. but it # can be quite verbose.. so without this # option we don't do any of the tests for # bits and prints.. which makes the code run # faster.. if you are not debugging don't use. options SCTP_DEBUG # # This option turns off the CRC32c checksum. Basically, # you will not be able to talk to anyone else who # has not done this. Its more for experimentation to # see how much CPU the CRC32c really takes. Most new # cards for TCP support checksum offload.. so this # option gives you a "view" into what SCTP would be # like with such an offload (which only exists in # high in iSCSI boards so far). With the new # splitting 8's algorithm its not as bad as it used # to be.. but it does speed things up try only # for in a captured lab environment :-) options SCTP_WITH_NO_CSUM # # # All that options after that turn on specific types of # logging. You can monitor CWND growth, flight size # and all sorts of things. Go look at the code and # see. I have used this to produce interesting # charts and graphs as well :-> # # I have not yet committed the tools to get and print # the logs, I will do that eventually .. before then # if you want them send me an email rrs@freebsd.org # You basically must have ktr(4) enabled for these # and you then set the sysctl to turn on/off various # logging bits. Use ktrdump(8) to pull the log and run # it through a display program.. and graphs and other # things too. # options SCTP_LOCK_LOGGING options SCTP_MBUF_LOGGING options SCTP_MBCNT_LOGGING options SCTP_PACKET_LOGGING options SCTP_LTRACE_CHUNKS options SCTP_LTRACE_ERRORS # altq(9). Enable the base part of the hooks with the ALTQ option. # Individual disciplines must be built into the base system and can not be # loaded as modules at this point. ALTQ requires a stable TSC so if yours is # broken or changes with CPU throttling then you must also have the ALTQ_NOPCC # option. options ALTQ options ALTQ_CBQ # Class Based Queueing options ALTQ_RED # Random Early Detection options ALTQ_RIO # RED In/Out options ALTQ_HFSC # Hierarchical Packet Scheduler options ALTQ_CDNR # Traffic conditioner options ALTQ_PRIQ # Priority Queueing options ALTQ_NOPCC # Required if the TSC is unusable options ALTQ_DEBUG # netgraph(4). Enable the base netgraph code with the NETGRAPH option. # Individual node types can be enabled with the corresponding option # listed below; however, this is not strictly necessary as netgraph # will automatically load the corresponding KLD module if the node type # is not already compiled into the kernel. Each type below has a # corresponding man page, e.g., ng_async(8). options NETGRAPH # netgraph(4) system options NETGRAPH_DEBUG # enable extra debugging, this # affects netgraph(4) and nodes # Node types options NETGRAPH_ASYNC options NETGRAPH_ATMLLC options NETGRAPH_ATM_ATMPIF options NETGRAPH_BLUETOOTH # ng_bluetooth(4) options NETGRAPH_BLUETOOTH_BT3C # ng_bt3c(4) options NETGRAPH_BLUETOOTH_HCI # ng_hci(4) options NETGRAPH_BLUETOOTH_L2CAP # ng_l2cap(4) options NETGRAPH_BLUETOOTH_SOCKET # ng_btsocket(4) options NETGRAPH_BLUETOOTH_UBT # ng_ubt(4) options NETGRAPH_BLUETOOTH_UBTBCMFW # ubtbcmfw(4) options NETGRAPH_BPF options NETGRAPH_BRIDGE options NETGRAPH_CAR options NETGRAPH_CISCO options NETGRAPH_DEFLATE options NETGRAPH_DEVICE options NETGRAPH_ECHO options NETGRAPH_EIFACE options NETGRAPH_ETHER options NETGRAPH_FEC options NETGRAPH_FRAME_RELAY options NETGRAPH_GIF options NETGRAPH_GIF_DEMUX options NETGRAPH_HOLE options NETGRAPH_IFACE options NETGRAPH_IP_INPUT options NETGRAPH_IPFW options NETGRAPH_KSOCKET options NETGRAPH_L2TP options NETGRAPH_LMI # MPPC compression requires proprietary files (not included) #options NETGRAPH_MPPC_COMPRESSION options NETGRAPH_MPPC_ENCRYPTION options NETGRAPH_NETFLOW options NETGRAPH_NAT options NETGRAPH_ONE2MANY options NETGRAPH_PATCH options NETGRAPH_PIPE options NETGRAPH_PPP options NETGRAPH_PPPOE options NETGRAPH_PPTPGRE options NETGRAPH_PRED1 options NETGRAPH_RFC1490 options NETGRAPH_SOCKET options NETGRAPH_SPLIT options NETGRAPH_SPPP options NETGRAPH_TAG options NETGRAPH_TCPMSS options NETGRAPH_TEE options NETGRAPH_UI options NETGRAPH_VJC options NETGRAPH_VLAN # NgATM - Netgraph ATM options NGATM_ATM options NGATM_ATMBASE options NGATM_SSCOP options NGATM_SSCFU options NGATM_UNI options NGATM_CCATM device mn # Munich32x/Falc54 Nx64kbit/sec cards. # Network stack virtualization. #options VIMAGE #options VNET_DEBUG # debug for VIMAGE # # Network interfaces: # The `loop' device is MANDATORY when networking is enabled. device loop # The `ether' device provides generic code to handle # Ethernets; it is MANDATORY when an Ethernet device driver is # configured or token-ring is enabled. device ether # The `vlan' device implements the VLAN tagging of Ethernet frames # according to IEEE 802.1Q. device vlan # The `wlan' device provides generic code to support 802.11 # drivers, including host AP mode; it is MANDATORY for the wi, # and ath drivers and will eventually be required by all 802.11 drivers. device wlan options IEEE80211_DEBUG #enable debugging msgs options IEEE80211_AMPDU_AGE #age frames in AMPDU reorder q's options IEEE80211_SUPPORT_MESH #enable 802.11s D3.0 support options IEEE80211_SUPPORT_TDMA #enable TDMA support # The `wlan_wep', `wlan_tkip', and `wlan_ccmp' devices provide # support for WEP, TKIP, and AES-CCMP crypto protocols optionally # used with 802.11 devices that depend on the `wlan' module. device wlan_wep device wlan_ccmp device wlan_tkip # The `wlan_xauth' device provides support for external (i.e. user-mode) # authenticators for use with 802.11 drivers that use the `wlan' # module and support 802.1x and/or WPA security protocols. device wlan_xauth # The `wlan_acl' device provides a MAC-based access control mechanism # for use with 802.11 drivers operating in ap mode and using the # `wlan' module. # The 'wlan_amrr' device provides AMRR transmit rate control algorithm device wlan_acl device wlan_amrr # Generic TokenRing device token # The `fddi' device provides generic code to support FDDI. device fddi # The `arcnet' device provides generic code to support Arcnet. device arcnet # The `sppp' device serves a similar role for certain types # of synchronous PPP links (like `cx', `ar'). device sppp # The `bpf' device enables the Berkeley Packet Filter. Be # aware of the legal and administrative consequences of enabling this # option. DHCP requires bpf. device bpf # The `netmap' device implements memory-mapped access to network # devices from userspace, enabling wire-speed packet capture and # generation even at 10Gbit/s. Requires support in the device # driver. Supported drivers are ixgbe, e1000, re. device netmap # The `disc' device implements a minimal network interface, # which throws away all packets sent and never receives any. It is # included for testing and benchmarking purposes. device disc # The `epair' device implements a virtual back-to-back connected Ethernet # like interface pair. device epair # The `edsc' device implements a minimal Ethernet interface, # which discards all packets sent and receives none. device edsc # The `tap' device is a pty-like virtual Ethernet interface device tap # The `tun' device implements (user-)ppp and nos-tun(8) device tun # The `gif' device implements IPv6 over IP4 tunneling, # IPv4 over IPv6 tunneling, IPv4 over IPv4 tunneling and # IPv6 over IPv6 tunneling. # The `gre' device implements two types of IP4 over IP4 tunneling: # GRE and MOBILE, as specified in the RFC1701 and RFC2004. # The XBONEHACK option allows the same pair of addresses to be configured on # multiple gif interfaces. device gif device gre options XBONEHACK # The `faith' device captures packets sent to it and diverts them # to the IPv4/IPv6 translation daemon. # The `stf' device implements 6to4 encapsulation. device faith device stf # The `ef' device provides support for multiple ethernet frame types # specified via ETHER_* options. See ef(4) for details. device ef options ETHER_II # enable Ethernet_II frame options ETHER_8023 # enable Ethernet_802.3 (Novell) frame options ETHER_8022 # enable Ethernet_802.2 frame options ETHER_SNAP # enable Ethernet_802.2/SNAP frame # The pf packet filter consists of three devices: # The `pf' device provides /dev/pf and the firewall code itself. # The `pflog' device provides the pflog0 interface which logs packets. # The `pfsync' device provides the pfsync0 interface used for # synchronization of firewall state tables (over the net). device pf device pflog device pfsync # Bridge interface. device if_bridge # Common Address Redundancy Protocol. See carp(4) for more details. device carp # IPsec interface. device enc # Link aggregation interface. device lagg # # Internet family options: # # MROUTING enables the kernel multicast packet forwarder, which works # with mrouted and XORP. # # IPFIREWALL enables support for IP firewall construction, in # conjunction with the `ipfw' program. IPFIREWALL_VERBOSE sends # logged packets to the system logger. IPFIREWALL_VERBOSE_LIMIT # limits the number of times a matching entry can be logged. # # WARNING: IPFIREWALL defaults to a policy of "deny ip from any to any" # and if you do not add other rules during startup to allow access, # YOU WILL LOCK YOURSELF OUT. It is suggested that you set firewall_type=open # in /etc/rc.conf when first enabling this feature, then refining the # firewall rules in /etc/rc.firewall after you've tested that the new kernel # feature works properly. # # IPFIREWALL_DEFAULT_TO_ACCEPT causes the default rule (at boot) to # allow everything. Use with care, if a cracker can crash your # firewall machine, they can get to your protected machines. However, # if you are using it as an as-needed filter for specific problems as # they arise, then this may be for you. Changing the default to 'allow' # means that you won't get stuck if the kernel and /sbin/ipfw binary get # out of sync. # # IPDIVERT enables the divert IP sockets, used by ``ipfw divert''. It # depends on IPFIREWALL if compiled into the kernel. # # IPFIREWALL_NAT adds support for in kernel nat in ipfw, and it requires # LIBALIAS. # # IPSTEALTH enables code to support stealth forwarding (i.e., forwarding # packets without touching the TTL). This can be useful to hide firewalls # from traceroute and similar tools. # # PF_DEFAULT_TO_DROP causes the default pf(4) rule to deny everything. # # TCPDEBUG enables code which keeps traces of the TCP state machine # for sockets with the SO_DEBUG option set, which can then be examined # using the trpt(8) utility. # # RADIX_MPATH provides support for equal-cost multi-path routing. # options MROUTING # Multicast routing options IPFIREWALL #firewall options IPFIREWALL_VERBOSE #enable logging to syslogd(8) options IPFIREWALL_VERBOSE_LIMIT=100 #limit verbosity options IPFIREWALL_DEFAULT_TO_ACCEPT #allow everything by default options IPFIREWALL_NAT #ipfw kernel nat support options IPDIVERT #divert sockets options IPFILTER #ipfilter support options IPFILTER_LOG #ipfilter logging options IPFILTER_LOOKUP #ipfilter pools options IPFILTER_DEFAULT_BLOCK #block all packets by default options IPSTEALTH #support for stealth forwarding options PF_DEFAULT_TO_DROP #drop everything by default options TCPDEBUG options RADIX_MPATH # The MBUF_STRESS_TEST option enables options which create # various random failures / extreme cases related to mbuf # functions. See mbuf(9) for a list of available test cases. # MBUF_PROFILING enables code to profile the mbuf chains # exiting the system (via participating interfaces) and # return a logarithmic histogram of monitored parameters # (e.g. packet size, wasted space, number of mbufs in chain). options MBUF_STRESS_TEST options MBUF_PROFILING # Statically link in accept filters options ACCEPT_FILTER_DATA options ACCEPT_FILTER_DNS options ACCEPT_FILTER_HTTP # TCP_SIGNATURE adds support for RFC 2385 (TCP-MD5) digests. These are # carried in TCP option 19. This option is commonly used to protect # TCP sessions (e.g. BGP) where IPSEC is not available nor desirable. # This is enabled on a per-socket basis using the TCP_MD5SIG socket option. # This requires the use of 'device crypto', 'options IPSEC' # or 'device cryptodev'. options TCP_SIGNATURE #include support for RFC 2385 # DUMMYNET enables the "dummynet" bandwidth limiter. You need IPFIREWALL # as well. See dummynet(4) and ipfw(8) for more info. When you run # DUMMYNET it is advisable to also have at least "options HZ=1000" to achieve # a smooth scheduling of the traffic. options DUMMYNET # "Zero copy" sockets support is split into the send and receive path # which operate very differently. # For the send path the VM page with the data is wired into the kernel # and marked as COW (copy-on-write). If the application touches the # data while it is still in the send socket buffer the page is copied # and divorced from its kernel wiring (no longer zero copy). # The receive side requires explicit NIC driver support to create # disposable pages which are flipped from kernel to user-space VM. # See zero_copy(9) for more details. # XXX: The COW based send mechanism is not safe and may result in # kernel crashes. # XXX: None of the current NIC drivers support disposable pages. options SOCKET_SEND_COW options SOCKET_RECV_PFLIP ##################################################################### # FILESYSTEM OPTIONS # # Only the root filesystem needs to be statically compiled or preloaded # as module; everything else will be automatically loaded at mount # time. Some people still prefer to statically compile other # filesystems as well. # # NB: The UNION filesystem was known to be buggy in the past. It is now # being actively maintained, although there are still some issues being # resolved. # # One of these is mandatory: options FFS #Fast filesystem options NFSCLIENT #Network File System client # The rest are optional: options CD9660 #ISO 9660 filesystem options FDESCFS #File descriptor filesystem options FUSE #FUSE support module options MSDOSFS #MS DOS File System (FAT, FAT32) options NFSSERVER #Network File System server options NFSLOCKD #Network Lock Manager options NFSCL #New Network Filesystem Client options NFSD #New Network Filesystem Server options KGSSAPI #Kernel GSSAPI implementation options NULLFS #NULL filesystem options PROCFS #Process filesystem (requires PSEUDOFS) options PSEUDOFS #Pseudo-filesystem framework options PSEUDOFS_TRACE #Debugging support for PSEUDOFS options TMPFS #Efficient memory filesystem options UDF #Universal Disk Format options UNIONFS #Union filesystem # The xFS_ROOT options REQUIRE the associated ``options xFS'' options NFS_ROOT #NFS usable as root device # Soft updates is a technique for improving filesystem speed and # making abrupt shutdown less risky. # options SOFTUPDATES # Extended attributes allow additional data to be associated with files, # and is used for ACLs, Capabilities, and MAC labels. # See src/sys/ufs/ufs/README.extattr for more information. options UFS_EXTATTR options UFS_EXTATTR_AUTOSTART # Access Control List support for UFS filesystems. The current ACL # implementation requires extended attribute support, UFS_EXTATTR, # for the underlying filesystem. # See src/sys/ufs/ufs/README.acls for more information. options UFS_ACL # Directory hashing improves the speed of operations on very large # directories at the expense of some memory. options UFS_DIRHASH # Gjournal-based UFS journaling support. options UFS_GJOURNAL # Make space in the kernel for a root filesystem on a md device. # Define to the number of kilobytes to reserve for the filesystem. options MD_ROOT_SIZE=10 # Make the md device a potential root device, either with preloaded # images of type mfs_root or md_root. options MD_ROOT # Disk quotas are supported when this option is enabled. options QUOTA #enable disk quotas # If you are running a machine just as a fileserver for PC and MAC # users, using SAMBA or Netatalk, you may consider setting this option # and keeping all those users' directories on a filesystem that is # mounted with the suiddir option. This gives new files the same # ownership as the directory (similar to group). It's a security hole # if you let these users run programs, so confine it to file-servers # (but it'll save you lots of headaches in those cases). Root owned # directories are exempt and X bits are cleared. The suid bit must be # set on the directory as well; see chmod(1). PC owners can't see/set # ownerships so they keep getting their toes trodden on. This saves # you all the support calls as the filesystem it's used on will act as # they expect: "It's my dir so it must be my file". # options SUIDDIR # NFS options: options NFS_MINATTRTIMO=3 # VREG attrib cache timeout in sec options NFS_MAXATTRTIMO=60 options NFS_MINDIRATTRTIMO=30 # VDIR attrib cache timeout in sec options NFS_MAXDIRATTRTIMO=60 options NFS_GATHERDELAY=10 # Default write gather delay (msec) options NFS_WDELAYHASHSIZ=16 # and with this options NFS_DEBUG # Enable NFS Debugging # # Add support for the EXT2FS filesystem of Linux fame. Be a bit # careful with this - the ext2fs code has a tendency to lag behind # changes and not be exercised very much, so mounting read/write could # be dangerous (and even mounting read only could result in panics.) # options EXT2FS # # Add support for the ReiserFS filesystem (used in Linux). Currently, # this is limited to read-only access. # options REISERFS # Use real implementations of the aio_* system calls. There are numerous # stability and security issues in the current aio code that make it # unsuitable for inclusion on machines with untrusted local users. options VFS_AIO # Cryptographically secure random number generator; /dev/random device random # The system memory devices; /dev/mem, /dev/kmem device mem # The kernel symbol table device; /dev/ksyms device ksyms # Optional character code conversion support with LIBICONV. # Each option requires their base file system and LIBICONV. options CD9660_ICONV options MSDOSFS_ICONV options UDF_ICONV ##################################################################### # POSIX P1003.1B # Real time extensions added in the 1993 POSIX # _KPOSIX_PRIORITY_SCHEDULING: Build in _POSIX_PRIORITY_SCHEDULING options _KPOSIX_PRIORITY_SCHEDULING # p1003_1b_semaphores are very experimental, # user should be ready to assist in debugging if problems arise. options P1003_1B_SEMAPHORES # POSIX message queue options P1003_1B_MQUEUE ##################################################################### # SECURITY POLICY PARAMETERS # Support for BSM audit options AUDIT # Support for Mandatory Access Control (MAC): options MAC options MAC_BIBA options MAC_BSDEXTENDED options MAC_IFOFF options MAC_LOMAC options MAC_MLS options MAC_NONE options MAC_PARTITION options MAC_PORTACL options MAC_SEEOTHERUIDS options MAC_STUB options MAC_TEST # Support for Capsicum options CAPABILITIES # fine-grained rights on file descriptors options CAPABILITY_MODE # sandboxes with no global namespace access # Support for process descriptors options PROCDESC ##################################################################### # CLOCK OPTIONS # The granularity of operation is controlled by the kernel option HZ whose # default value (1000 on most architectures) means a granularity of 1ms # (1s/HZ). Historically, the default was 100, but finer granularity is # required for DUMMYNET and other systems on modern hardware. There are # reasonable arguments that HZ should, in fact, be 100 still; consider, # that reducing the granularity too much might cause excessive overhead in # clock interrupt processing, potentially causing ticks to be missed and thus # actually reducing the accuracy of operation. options HZ=100 # Enable support for the kernel PLL to use an external PPS signal, # under supervision of [x]ntpd(8) # More info in ntpd documentation: http://www.eecis.udel.edu/~ntp options PPS_SYNC # Enable support for generic feed-forward clocks in the kernel. # The feed-forward clock support is an alternative to the feedback oriented # ntpd/system clock approach, and is to be used with a feed-forward # synchronization algorithm such as the RADclock: # More info here: http://www.synclab.org/radclock options FFCLOCK ##################################################################### # SCSI DEVICES # SCSI DEVICE CONFIGURATION # The SCSI subsystem consists of the `base' SCSI code, a number of # high-level SCSI device `type' drivers, and the low-level host-adapter # device drivers. The host adapters are listed in the ISA and PCI # device configuration sections below. # # It is possible to wire down your SCSI devices so that a given bus, # target, and LUN always come on line as the same device unit. In # earlier versions the unit numbers were assigned in the order that # the devices were probed on the SCSI bus. This means that if you # removed a disk drive, you may have had to rewrite your /etc/fstab # file, and also that you had to be careful when adding a new disk # as it may have been probed earlier and moved your device configuration # around. (See also option GEOM_VOL for a different solution to this # problem.) # This old behavior is maintained as the default behavior. The unit # assignment begins with the first non-wired down unit for a device # type. For example, if you wire a disk as "da3" then the first # non-wired disk will be assigned da4. # The syntax for wiring down devices is: hint.scbus.0.at="ahc0" hint.scbus.1.at="ahc1" hint.scbus.1.bus="0" hint.scbus.3.at="ahc2" hint.scbus.3.bus="0" hint.scbus.2.at="ahc2" hint.scbus.2.bus="1" hint.da.0.at="scbus0" hint.da.0.target="0" hint.da.0.unit="0" hint.da.1.at="scbus3" hint.da.1.target="1" hint.da.2.at="scbus2" hint.da.2.target="3" hint.sa.1.at="scbus1" hint.sa.1.target="6" # "units" (SCSI logical unit number) that are not specified are # treated as if specified as LUN 0. # All SCSI devices allocate as many units as are required. # The ch driver drives SCSI Media Changer ("jukebox") devices. # # The da driver drives SCSI Direct Access ("disk") and Optical Media # ("WORM") devices. # # The sa driver drives SCSI Sequential Access ("tape") devices. # # The cd driver drives SCSI Read Only Direct Access ("cd") devices. # # The ses driver drives SCSI Environment Services ("ses") and # SAF-TE ("SCSI Accessible Fault-Tolerant Enclosure") devices. # # The pt driver drives SCSI Processor devices. # # The sg driver provides a passthrough API that is compatible with the # Linux SG driver. It will work in conjunction with the COMPAT_LINUX # option to run linux SG apps. It can also stand on its own and provide # source level API compatibility for porting apps to FreeBSD. # # Target Mode support is provided here but also requires that a SIM # (SCSI Host Adapter Driver) provide support as well. # # The targ driver provides target mode support as a Processor type device. # It exists to give the minimal context necessary to respond to Inquiry # commands. There is a sample user application that shows how the rest # of the command support might be done in /usr/share/examples/scsi_target. # # The targbh driver provides target mode support and exists to respond # to incoming commands that do not otherwise have a logical unit assigned # to them. # # The "unknown" device (uk? in pre-2.0.5) is now part of the base SCSI # configuration as the "pass" driver. device scbus #base SCSI code device ch #SCSI media changers device da #SCSI direct access devices (aka disks) device sa #SCSI tapes device cd #SCSI CD-ROMs device ses #Enclosure Services (SES and SAF-TE) device pt #SCSI processor device targ #SCSI Target Mode Code device targbh #SCSI Target Mode Blackhole Device device pass #CAM passthrough driver device sg #Linux SCSI passthrough device ctl #CAM Target Layer # CAM OPTIONS: # debugging options: # CAMDEBUG Compile in all possible debugging. # CAM_DEBUG_COMPILE Debug levels to compile in. # CAM_DEBUG_FLAGS Debug levels to enable on boot. # CAM_DEBUG_BUS Limit debugging to the given bus. # CAM_DEBUG_TARGET Limit debugging to the given target. # CAM_DEBUG_LUN Limit debugging to the given lun. # CAM_DEBUG_DELAY Delay in us after printing each debug line. # # CAM_MAX_HIGHPOWER: Maximum number of concurrent high power (start unit) cmds # SCSI_NO_SENSE_STRINGS: When defined disables sense descriptions # SCSI_NO_OP_STRINGS: When defined disables opcode descriptions # SCSI_DELAY: The number of MILLISECONDS to freeze the SIM (scsi adapter) # queue after a bus reset, and the number of milliseconds to # freeze the device queue after a bus device reset. This # can be changed at boot and runtime with the # kern.cam.scsi_delay tunable/sysctl. options CAMDEBUG options CAM_DEBUG_COMPILE=-1 options CAM_DEBUG_FLAGS=(CAM_DEBUG_INFO|CAM_DEBUG_PROBE|CAM_DEBUG_PERIPH) options CAM_DEBUG_BUS=-1 options CAM_DEBUG_TARGET=-1 options CAM_DEBUG_LUN=-1 options CAM_DEBUG_DELAY=1 options CAM_MAX_HIGHPOWER=4 options SCSI_NO_SENSE_STRINGS options SCSI_NO_OP_STRINGS options SCSI_DELAY=5000 # Be pessimistic about Joe SCSI device # Options for the CAM CDROM driver: # CHANGER_MIN_BUSY_SECONDS: Guaranteed minimum time quantum for a changer LUN # CHANGER_MAX_BUSY_SECONDS: Maximum time quantum per changer LUN, only # enforced if there is I/O waiting for another LUN # The compiled in defaults for these variables are 2 and 10 seconds, # respectively. # # These can also be changed on the fly with the following sysctl variables: # kern.cam.cd.changer.min_busy_seconds # kern.cam.cd.changer.max_busy_seconds # options CHANGER_MIN_BUSY_SECONDS=2 options CHANGER_MAX_BUSY_SECONDS=10 # Options for the CAM sequential access driver: # SA_IO_TIMEOUT: Timeout for read/write/wfm operations, in minutes # SA_SPACE_TIMEOUT: Timeout for space operations, in minutes # SA_REWIND_TIMEOUT: Timeout for rewind operations, in minutes # SA_ERASE_TIMEOUT: Timeout for erase operations, in minutes # SA_1FM_AT_EOD: Default to model which only has a default one filemark at EOT. options SA_IO_TIMEOUT=4 options SA_SPACE_TIMEOUT=60 options SA_REWIND_TIMEOUT=(2*60) options SA_ERASE_TIMEOUT=(4*60) options SA_1FM_AT_EOD # Optional timeout for the CAM processor target (pt) device # This is specified in seconds. The default is 60 seconds. options SCSI_PT_DEFAULT_TIMEOUT=60 # Optional enable of doing SES passthrough on other devices (e.g., disks) # # Normally disabled because a lot of newer SCSI disks report themselves # as having SES capabilities, but this can then clot up attempts to build # a topology with the SES device that's on the box these drives are in.... options SES_ENABLE_PASSTHROUGH ##################################################################### # MISCELLANEOUS DEVICES AND OPTIONS device pty #BSD-style compatibility pseudo ttys device nmdm #back-to-back tty devices device md #Memory/malloc disk device snp #Snoop device - to look at pty/vty/etc.. device ccd #Concatenated disk driver device firmware #firmware(9) support # Kernel side iconv library options LIBICONV # Size of the kernel message buffer. Should be N * pagesize. options MSGBUF_SIZE=40960 ##################################################################### # HARDWARE DEVICE CONFIGURATION # For ISA the required hints are listed. # EISA, MCA, PCI, CardBus, SD/MMC and pccard are self identifying buses, so # no hints are needed. # # Mandatory devices: # # These options are valid for other keyboard drivers as well. options KBD_DISABLE_KEYMAP_LOAD # refuse to load a keymap options KBD_INSTALL_CDEV # install a CDEV entry in /dev options FB_DEBUG # Frame buffer debugging device splash # Splash screen and screen saver support # Various screen savers. device blank_saver device daemon_saver device dragon_saver device fade_saver device fire_saver device green_saver device logo_saver device rain_saver device snake_saver device star_saver device warp_saver # The syscons console driver (SCO color console compatible). device sc hint.sc.0.at="isa" options MAXCONS=16 # number of virtual consoles options SC_ALT_MOUSE_IMAGE # simplified mouse cursor in text mode options SC_DFLT_FONT # compile font in makeoptions SC_DFLT_FONT=cp850 options SC_DISABLE_KDBKEY # disable `debug' key options SC_DISABLE_REBOOT # disable reboot key sequence options SC_HISTORY_SIZE=200 # number of history buffer lines options SC_MOUSE_CHAR=0x3 # char code for text mode mouse cursor options SC_PIXEL_MODE # add support for the raster text mode # The following options will let you change the default colors of syscons. options SC_NORM_ATTR=(FG_GREEN|BG_BLACK) options SC_NORM_REV_ATTR=(FG_YELLOW|BG_GREEN) options SC_KERNEL_CONS_ATTR=(FG_RED|BG_BLACK) options SC_KERNEL_CONS_REV_ATTR=(FG_BLACK|BG_RED) # The following options will let you change the default behavior of # cut-n-paste feature options SC_CUT_SPACES2TABS # convert leading spaces into tabs options SC_CUT_SEPCHARS=\"x09\" # set of characters that delimit words # (default is single space - \"x20\") # If you have a two button mouse, you may want to add the following option # to use the right button of the mouse to paste text. options SC_TWOBUTTON_MOUSE # You can selectively disable features in syscons. options SC_NO_CUTPASTE options SC_NO_FONT_LOADING options SC_NO_HISTORY options SC_NO_MODE_CHANGE options SC_NO_SYSMOUSE options SC_NO_SUSPEND_VTYSWITCH # `flags' for sc # 0x80 Put the video card in the VESA 800x600 dots, 16 color mode # 0x100 Probe for a keyboard device periodically if one is not present # Enable experimental features of the syscons terminal emulator (teken). options TEKEN_CONS25 # cons25-style terminal emulation options TEKEN_UTF8 # UTF-8 output handling # # Optional devices: # # # SCSI host adapters: # # adv: All Narrow SCSI bus AdvanSys controllers. # adw: Second Generation AdvanSys controllers including the ADV940UW. # aha: Adaptec 154x/1535/1640 # ahb: Adaptec 174x EISA controllers # ahc: Adaptec 274x/284x/2910/293x/294x/394x/3950x/3960x/398X/4944/ # 19160x/29160x, aic7770/aic78xx # ahd: Adaptec 29320/39320 Controllers. # aic: Adaptec 6260/6360, APA-1460 (PC Card), NEC PC9801-100 (C-BUS) # bt: Most Buslogic controllers: including BT-445, BT-54x, BT-64x, BT-74x, # BT-75x, BT-946, BT-948, BT-956, BT-958, SDC3211B, SDC3211F, SDC3222F # esp: Emulex ESP, NCR 53C9x and QLogic FAS families based controllers # including the AMD Am53C974 (found on devices such as the Tekram # DC-390(T)) and the Sun ESP and FAS families of controllers # isp: Qlogic ISP 1020, 1040 and 1040B PCI SCSI host adapters, # ISP 1240 Dual Ultra SCSI, ISP 1080 and 1280 (Dual) Ultra2, # ISP 12160 Ultra3 SCSI, # Qlogic ISP 2100 and ISP 2200 1Gb Fibre Channel host adapters. # Qlogic ISP 2300 and ISP 2312 2Gb Fibre Channel host adapters. # Qlogic ISP 2322 and ISP 6322 2Gb Fibre Channel host adapters. # ispfw: Firmware module for Qlogic host adapters # mpt: LSI-Logic MPT/Fusion 53c1020 or 53c1030 Ultra4 # or FC9x9 Fibre Channel host adapters. # ncr: NCR 53C810, 53C825 self-contained SCSI host adapters. # sym: Symbios/Logic 53C8XX family of PCI-SCSI I/O processors: # 53C810, 53C810A, 53C815, 53C825, 53C825A, 53C860, 53C875, # 53C876, 53C885, 53C895, 53C895A, 53C896, 53C897, 53C1510D, # 53C1010-33, 53C1010-66. # trm: Tekram DC395U/UW/F DC315U adapters. # wds: WD7000 # # Note that the order is important in order for Buslogic ISA/EISA cards to be # probed correctly. # device bt hint.bt.0.at="isa" hint.bt.0.port="0x330" device adv hint.adv.0.at="isa" device adw device aha hint.aha.0.at="isa" device aic hint.aic.0.at="isa" device ahb device ahc device ahd device esp device iscsi_initiator device isp hint.isp.0.disable="1" hint.isp.0.role="3" hint.isp.0.prefer_iomap="1" hint.isp.0.prefer_memmap="1" hint.isp.0.fwload_disable="1" hint.isp.0.ignore_nvram="1" hint.isp.0.fullduplex="1" hint.isp.0.topology="lport" hint.isp.0.topology="nport" hint.isp.0.topology="lport-only" hint.isp.0.topology="nport-only" # we can't get u_int64_t types, nor can we get strings if it's got # a leading 0x, hence this silly dodge. hint.isp.0.portwnn="w50000000aaaa0000" hint.isp.0.nodewnn="w50000000aaaa0001" device ispfw device mpt device ncr device sym device trm device wds hint.wds.0.at="isa" hint.wds.0.port="0x350" hint.wds.0.irq="11" hint.wds.0.drq="6" # The aic7xxx driver will attempt to use memory mapped I/O for all PCI # controllers that have it configured only if this option is set. Unfortunately, # this doesn't work on some motherboards, which prevents it from being the # default. options AHC_ALLOW_MEMIO # Dump the contents of the ahc controller configuration PROM. options AHC_DUMP_EEPROM # Bitmap of units to enable targetmode operations. options AHC_TMODE_ENABLE # Compile in Aic7xxx Debugging code. options AHC_DEBUG # Aic7xxx driver debugging options. See sys/dev/aic7xxx/aic7xxx.h options AHC_DEBUG_OPTS # Print register bitfields in debug output. Adds ~128k to driver # See ahc(4). options AHC_REG_PRETTY_PRINT # Compile in aic79xx debugging code. options AHD_DEBUG # Aic79xx driver debugging options. Adds ~215k to driver. See ahd(4). options AHD_DEBUG_OPTS=0xFFFFFFFF # Print human-readable register definitions when debugging options AHD_REG_PRETTY_PRINT # Bitmap of units to enable targetmode operations. options AHD_TMODE_ENABLE # The adw driver will attempt to use memory mapped I/O for all PCI # controllers that have it configured only if this option is set. options ADW_ALLOW_MEMIO # Options used in dev/iscsi (Software iSCSI stack) # options ISCSI_INITIATOR_DEBUG=9 # Options used in dev/isp/ (Qlogic SCSI/FC driver). # # ISP_TARGET_MODE - enable target mode operation # options ISP_TARGET_MODE=1 # # ISP_DEFAULT_ROLES - default role # none=0 # target=1 # initiator=2 # both=3 (not supported currently) # # ISP_INTERNAL_TARGET (trivial internal disk target, for testing) # options ISP_DEFAULT_ROLES=0 # Options used in dev/sym/ (Symbios SCSI driver). #options SYM_SETUP_LP_PROBE_MAP #-Low Priority Probe Map (bits) # Allows the ncr to take precedence # 1 (1<<0) -> 810a, 860 # 2 (1<<1) -> 825a, 875, 885, 895 # 4 (1<<2) -> 895a, 896, 1510d #options SYM_SETUP_SCSI_DIFF #-HVD support for 825a, 875, 885 # disabled:0 (default), enabled:1 #options SYM_SETUP_PCI_PARITY #-PCI parity checking # disabled:0, enabled:1 (default) #options SYM_SETUP_MAX_LUN #-Number of LUNs supported # default:8, range:[1..64] # The 'dpt' driver provides support for old DPT controllers (http://www.dpt.com/). # These have hardware RAID-{0,1,5} support, and do multi-initiator I/O. # The DPT controllers are commonly re-licensed under other brand-names - # some controllers by Olivetti, Dec, HP, AT&T, SNI, AST, Alphatronic, NEC and # Compaq are actually DPT controllers. # # See src/sys/dev/dpt for debugging and other subtle options. # DPT_MEASURE_PERFORMANCE Enables a set of (semi)invasive metrics. Various # instruments are enabled. The tools in # /usr/sbin/dpt_* assume these to be enabled. # DPT_HANDLE_TIMEOUTS Normally device timeouts are handled by the DPT. # If you want the driver to handle timeouts, enable # this option. If your system is very busy, this # option will create more trouble than solve. # DPT_TIMEOUT_FACTOR Used to compute the excessive amount of time to # wait when timing out with the above option. # DPT_DEBUG_xxxx These are controllable from sys/dev/dpt/dpt.h # DPT_LOST_IRQ When enabled, will try, once per second, to catch # any interrupt that got lost. Seems to help in some # DPT-firmware/Motherboard combinations. Minimal # cost, great benefit. # DPT_RESET_HBA Make "reset" actually reset the controller # instead of fudging it. Only enable this if you # are 100% certain you need it. device dpt # DPT options #!CAM# options DPT_MEASURE_PERFORMANCE #!CAM# options DPT_HANDLE_TIMEOUTS options DPT_TIMEOUT_FACTOR=4 options DPT_LOST_IRQ options DPT_RESET_HBA # # Compaq "CISS" RAID controllers (SmartRAID 5* series) # These controllers have a SCSI-like interface, and require the # CAM infrastructure. # 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" and # "Leubner, Achim" . # device iir # # Mylex AcceleRAID and eXtremeRAID controllers with v6 and later # firmware. These controllers have a SCSI-like interface, and require # the CAM infrastructure. # device mly # # Compaq Smart RAID, Mylex DAC960 and AMI MegaRAID controllers. Only # one entry is needed; the code will find and configure all supported # controllers. # 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 # # 3ware ATA RAID # device twe # 3ware ATA RAID # # Serial ATA host controllers: # # ahci: Advanced Host Controller Interface (AHCI) compatible # mvs: Marvell 88SX50XX/88SX60XX/88SX70XX/SoC controllers # siis: SiliconImage SiI3124/SiI3132/SiI3531 controllers # # These drivers are part of cam(4) subsystem. They supersede less featured # ata(4) subsystem drivers, supporting same hardware. device ahci 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 #device atacard # CARDBUS support #device atabus # PC98 cbus support #device ataisa # ISA bus support #device atapci # PCI bus support; only generic chipset support # PCI ATA chipsets #device ataahci # AHCI SATA #device ataacard # ACARD #device ataacerlabs # Acer Labs Inc. (ALI) #device ataadaptec # Adaptec #device ataamd # American Micro Devices (AMD) #device ataati # ATI #device atacenatek # Cenatek #device atacypress # Cypress #device atacyrix # Cyrix #device atahighpoint # HighPoint #device ataintel # Intel #device ataite # Integrated Technology Inc. (ITE) #device atajmicron # JMicron #device atamarvell # Marvell #device atamicron # Micron #device atanational # National #device atanetcell # NetCell #device atanvidia # nVidia #device atapromise # Promise #device ataserverworks # ServerWorks #device atasiliconimage # Silicon Image Inc. (SiI) (formerly CMD) #device atasis # Silicon Integrated Systems Corp.(SiS) #device atavia # VIA Technologies Inc. # # For older non-PCI, non-PnPBIOS systems, these are the hints lines to add: hint.ata.0.at="isa" hint.ata.0.port="0x1f0" hint.ata.0.irq="14" hint.ata.1.at="isa" hint.ata.1.port="0x170" hint.ata.1.irq="15" # # The following options are valid on the ATA driver: # # ATA_STATIC_ID: controller numbering is static ie depends on location # 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 # the Y-E DATA External FDD (PC Card) # device fdc hint.fdc.0.at="isa" hint.fdc.0.port="0x3F0" hint.fdc.0.irq="6" hint.fdc.0.drq="2" # # FDC_DEBUG enables floppy debugging. Since the debug output is huge, you # gotta turn it actually on by setting the variable fd_debug with DDB, # however. options FDC_DEBUG # # Activate this line if you happen to have an Insight floppy tape. # Probing them proved to be dangerous for people with floppy disks only, # so it's "hidden" behind a flag: #hint.fdc.0.flags="1" # Specify floppy devices hint.fd.0.at="fdc0" hint.fd.0.drive="0" hint.fd.1.at="fdc0" hint.fd.1.drive="1" # # uart: newbusified driver for serial interfaces. It consolidates the sio(4), # sab(4) and zs(4) drivers. # device uart # Options for uart(4) options UART_PPS_ON_CTS # Do time pulse capturing using CTS # instead of DCD. # The following hint should only be used for pure ISA devices. It is not # needed otherwise. Use of hints is strongly discouraged. hint.uart.0.at="isa" # The following 3 hints are used when the UART is a system device (i.e., a # console or debug port), but only on platforms that don't have any other # means to pass the information to the kernel. The unit number of the hint # is only used to bundle the hints together. There is no relation to the # unit number of the probed UART. hint.uart.0.port="0x3f8" hint.uart.0.flags="0x10" hint.uart.0.baud="115200" # `flags' for serial drivers that support consoles like sio(4) and uart(4): # 0x10 enable console support for this unit. Other console flags # (if applicable) are ignored unless this is set. Enabling # console support does not make the unit the preferred console. # Boot with -h or set boot_serial=YES in the loader. For sio(4) # specifically, the 0x20 flag can also be set (see above). # Currently, at most one unit can have console support; the # first one (in config file order) with this flag set is # preferred. Setting this flag for sio0 gives the old behavior. # 0x80 use this port for serial line gdb support in ddb. Also known # as debug port. # # Options for serial drivers that support consoles: options BREAK_TO_DEBUGGER # A BREAK on a serial console goes to # ddb, if available. # Solaris implements a new BREAK which is initiated by a character # sequence CR ~ ^b which is similar to a familiar pattern used on # Sun servers by the Remote Console. There are FreeBSD extensions: # CR ~ ^p requests force panic and CR ~ ^r requests a clean reboot. options ALT_BREAK_TO_DEBUGGER # Serial Communications Controller # Supports the Siemens SAB 82532 and Zilog Z8530 multi-channel # communications controllers. device scc # PCI Universal Communications driver # Supports various multi port PCI I/O cards. device puc # # Network interfaces: # # MII bus support is required for many PCI Ethernet NICs, # namely those which use MII-compliant transceivers or implement # transceiver control interfaces that operate like an MII. Adding # "device miibus" to the kernel config pulls in support for the generic # miibus API, the common support for for bit-bang'ing the MII and all # of the PHY drivers, including a generic one for PHYs that aren't # specifically handled by an individual driver. Support for specific # PHYs may be built by adding "device mii", "device mii_bitbang" if # needed by the NIC driver and then adding the appropriate PHY driver. device mii # Minimal MII support device mii_bitbang # Common module for bit-bang'ing the MII device miibus # MII support w/ bit-bang'ing and all PHYs device acphy # Altima Communications AC101 device amphy # AMD AM79c873 / Davicom DM910{1,2} device atphy # Attansic/Atheros F1 device axphy # Asix Semiconductor AX88x9x device bmtphy # Broadcom BCM5201/BCM5202 and 3Com 3c905C device brgphy # Broadcom BCM54xx/57xx 1000baseTX device ciphy # Cicada/Vitesse CS/VSC8xxx device e1000phy # Marvell 88E1000 1000/100/10-BT device gentbi # Generic 10-bit 1000BASE-{LX,SX} fiber ifaces device icsphy # ICS ICS1889-1893 device ip1000phy # IC Plus IP1000A/IP1001 device jmphy # JMicron JMP211/JMP202 device lxtphy # Level One LXT-970 device mlphy # Micro Linear 6692 device nsgphy # NatSemi DP8361/DP83865/DP83891 device nsphy # NatSemi DP83840A device nsphyter # NatSemi DP83843/DP83815 device pnaphy # HomePNA device qsphy # Quality Semiconductor QS6612 device rdcphy # RDC Semiconductor R6040 device rgephy # RealTek 8169S/8110S/8211B/8211C device rlphy # RealTek 8139 device rlswitch # RealTek 8305 device smcphy # SMSC LAN91C111 device tdkphy # TDK 89Q2120 device tlphy # Texas Instruments ThunderLAN device truephy # LSI TruePHY device xmphy # XaQti XMAC II # an: Aironet 4500/4800 802.11 wireless adapters. Supports the PCMCIA, # PCI and ISA varieties. # ae: Support for gigabit ethernet adapters based on the Attansic/Atheros # L2 PCI-Express FastEthernet controllers. # age: Support for gigabit ethernet adapters based on the Attansic/Atheros # L1 PCI express gigabit ethernet controllers. # alc: Support for Atheros AR8131/AR8132 PCIe ethernet controllers. # ale: Support for Atheros AR8121/AR8113/AR8114 PCIe ethernet controllers. # ath: Atheros a/b/g WiFi adapters (requires ath_hal and wlan) # bce: Broadcom NetXtreme II (BCM5706/BCM5708) PCI/PCIe Gigabit Ethernet # adapters. # bfe: Broadcom BCM4401 Ethernet adapter. # bge: Support for gigabit ethernet adapters based on the Broadcom # BCM570x family of controllers, including the 3Com 3c996-T, # the Netgear GA302T, the SysKonnect SK-9D21 and SK-9D41, and # the embedded gigE NICs on Dell PowerEdge 2550 servers. # bxe: Broadcom NetXtreme II (BCM57710/57711/57711E) PCIe 10b Ethernet # adapters. # bwi: Broadcom BCM430* and BCM431* family of wireless adapters. # bwn: Broadcom BCM43xx family of wireless adapters. # cas: Sun Cassini/Cassini+ and National Semiconductor DP83065 Saturn # cm: Arcnet SMC COM90c26 / SMC COM90c56 # (and SMC COM90c66 in '56 compatibility mode) adapters. # cxgbe: Support for PCI express 10Gb/1Gb adapters based on the Chelsio T4 # (Terminator 4) ASIC. # dc: Support for PCI fast ethernet adapters based on the DEC/Intel 21143 # and various workalikes including: # the ADMtek AL981 Comet and AN985 Centaur, the ASIX Electronics # AX88140A and AX88141, the Davicom DM9100 and DM9102, the Lite-On # 82c168 and 82c169 PNIC, the Lite-On/Macronix LC82C115 PNIC II # and the Macronix 98713/98713A/98715/98715A/98725 PMAC. This driver # replaces the old al, ax, dm, pn and mx drivers. List of brands: # Digital DE500-BA, Kingston KNE100TX, D-Link DFE-570TX, SOHOware SFA110, # SVEC PN102-TX, CNet Pro110B, 120A, and 120B, Compex RL100-TX, # LinkSys LNE100TX, LNE100TX V2.0, Jaton XpressNet, Alfa Inc GFC2204, # KNE110TX. # de: Digital Equipment DC21040 # em: Intel Pro/1000 Gigabit Ethernet 82542, 82543, 82544 based adapters. # igb: Intel Pro/1000 PCI Express Gigabit Ethernet: 82575 and later adapters. # ep: 3Com 3C509, 3C529, 3C556, 3C562D, 3C563D, 3C572, 3C574X, 3C579, 3C589 # and PC Card devices using these chipsets. # ex: Intel EtherExpress Pro/10 and other i82595-based adapters, # Olicom Ethernet PC Card devices. # fe: Fujitsu MB86960A/MB86965A Ethernet # fea: DEC DEFEA EISA FDDI adapter # fpa: Support for the Digital DEFPA PCI FDDI. `device fddi' is also needed. # fxp: Intel EtherExpress Pro/100B # (hint of prefer_iomap can be done to prefer I/O instead of Mem mapping) # gem: Apple GMAC/Sun ERI/Sun GEM # hme: Sun HME (Happy Meal Ethernet) # jme: JMicron JMC260 Fast Ethernet/JMC250 Gigabit Ethernet based adapters. # le: AMD Am7900 LANCE and Am79C9xx PCnet # lge: Support for PCI gigabit ethernet adapters based on the Level 1 # LXT1001 NetCellerator chipset. This includes the D-Link DGE-500SX, # SMC TigerCard 1000 (SMC9462SX), and some Addtron cards. # malo: Marvell Libertas wireless NICs. # mwl: Marvell 88W8363 802.11n wireless NICs. # Requires the mwl firmware module # mwlfw: Marvell 88W8363 firmware # msk: Support for gigabit ethernet adapters based on the Marvell/SysKonnect # Yukon II Gigabit controllers, including 88E8021, 88E8022, 88E8061, # 88E8062, 88E8035, 88E8036, 88E8038, 88E8050, 88E8052, 88E8053, # 88E8055, 88E8056 and D-Link 560T/550SX. # lmc: Support for the LMC/SBE wide-area network interface cards. # my: Myson Fast Ethernet (MTD80X, MTD89X) # nge: Support for PCI gigabit ethernet adapters based on the National # Semiconductor DP83820 and DP83821 chipset. This includes the # SMC EZ Card 1000 (SMC9462TX), D-Link DGE-500T, Asante FriendlyNet # GigaNIX 1000TA and 1000TPC, the Addtron AEG320T, the Surecom # EP-320G-TX and the Netgear GA622T. # oce: Emulex 10 Gbit adapters (OneConnect Ethernet) # pcn: Support for PCI fast ethernet adapters based on the AMD Am79c97x # PCnet-FAST, PCnet-FAST+, PCnet-FAST III, PCnet-PRO and PCnet-Home # chipsets. These can also be handled by the le(4) driver if the # pcn(4) driver is left out of the kernel. The le(4) driver does not # support the additional features like the MII bus and burst mode of # the PCnet-FAST and greater chipsets though. # ral: Ralink Technology IEEE 802.11 wireless adapter # re: RealTek 8139C+/8169/816xS/811xS/8101E PCI/PCIe Ethernet adapter # rl: Support for PCI fast ethernet adapters based on the RealTek 8129/8139 # chipset. Note that the RealTek driver defaults to using programmed # I/O to do register accesses because memory mapped mode seems to cause # severe lockups on SMP hardware. This driver also supports the # Accton EN1207D `Cheetah' adapter, which uses a chip called # the MPX 5030/5038, which is either a RealTek in disguise or a # RealTek workalike. Note that the D-Link DFE-530TX+ uses the RealTek # chipset and is supported by this driver, not the 'vr' driver. # sf: Support for Adaptec Duralink PCI fast ethernet adapters based on the # Adaptec AIC-6915 "starfire" controller. # This includes dual and quad port cards, as well as one 100baseFX card. # Most of these are 64-bit PCI devices, except for one single port # card which is 32-bit. # sge: Silicon Integrated Systems SiS190/191 Fast/Gigabit Ethernet adapter # sis: Support for NICs based on the Silicon Integrated Systems SiS 900, # SiS 7016 and NS DP83815 PCI fast ethernet controller chips. # sk: Support for the SysKonnect SK-984x series PCI gigabit ethernet NICs. # This includes the SK-9841 and SK-9842 single port cards (single mode # and multimode fiber) and the SK-9843 and SK-9844 dual port cards # (also single mode and multimode). # The driver will autodetect the number of ports on the card and # attach each one as a separate network interface. # sn: Support for ISA and PC Card Ethernet devices using the # SMC91C90/92/94/95 chips. # ste: Sundance Technologies ST201 PCI fast ethernet controller, includes # the D-Link DFE-550TX. # stge: Support for gigabit ethernet adapters based on the Sundance/Tamarack # TC9021 family of controllers, including the Sundance ST2021/ST2023, # the Sundance/Tamarack TC9021, the D-Link DL-4000 and ASUS NX1101. # ti: Support for PCI gigabit ethernet NICs based on the Alteon Networks # Tigon 1 and Tigon 2 chipsets. This includes the Alteon AceNIC, the # 3Com 3c985, the Netgear GA620 and various others. Note that you will # probably want to bump up kern.ipc.nmbclusters a lot to use this driver. # tl: Support for the Texas Instruments TNETE100 series 'ThunderLAN' # cards and integrated ethernet controllers. This includes several # Compaq Netelligent 10/100 cards and the built-in ethernet controllers # in several Compaq Prosignia, Proliant and Deskpro systems. It also # supports several Olicom 10Mbps and 10/100 boards. # tx: SMC 9432 TX, BTX and FTX cards. (SMC EtherPower II series) # txp: Support for 3Com 3cR990 cards with the "Typhoon" chipset # vr: Support for various fast ethernet adapters based on the VIA # Technologies VT3043 `Rhine I' and VT86C100A `Rhine II' chips, # including the D-Link DFE520TX and D-Link DFE530TX (see 'rl' for # DFE530TX+), the Hawking Technologies PN102TX, and the AOpen/Acer ALN-320. # vte: DM&P Vortex86 RDC R6040 Fast Ethernet # vx: 3Com 3C590 and 3C595 # wb: Support for fast ethernet adapters based on the Winbond W89C840F chip. # Note: this is not the same as the Winbond W89C940F, which is a # NE2000 clone. # wi: Lucent WaveLAN/IEEE 802.11 PCMCIA adapters. Note: this supports both # the PCMCIA and ISA cards: the ISA card is really a PCMCIA to ISA # bridge with a PCMCIA adapter plugged into it. # xe: Xircom/Intel EtherExpress Pro100/16 PC Card ethernet controller, # Accton Fast EtherCard-16, Compaq Netelligent 10/100 PC Card, # Toshiba 10/100 Ethernet PC Card, Xircom 16-bit Ethernet + Modem 56 # xl: Support for the 3Com 3c900, 3c905, 3c905B and 3c905C (Fast) # Etherlink XL cards and integrated controllers. This includes the # integrated 3c905B-TX chips in certain Dell Optiplex and Dell # Precision desktop machines and the integrated 3c905-TX chips # in Dell Latitude laptop docking stations. # Also supported: 3Com 3c980(C)-TX, 3Com 3cSOHO100-TX, 3Com 3c450-TX # Order for ISA/EISA devices is important here device cm hint.cm.0.at="isa" hint.cm.0.port="0x2e0" hint.cm.0.irq="9" hint.cm.0.maddr="0xdc000" device ep device ex device fe hint.fe.0.at="isa" hint.fe.0.port="0x300" device fea device sn hint.sn.0.at="isa" hint.sn.0.port="0x300" hint.sn.0.irq="10" device an device wi device xe # PCI Ethernet NICs that use the common MII bus controller code. device ae # Attansic/Atheros L2 FastEthernet device age # Attansic/Atheros L1 Gigabit Ethernet device alc # Atheros AR8131/AR8132 Ethernet device ale # Atheros AR8121/AR8113/AR8114 Ethernet device bce # Broadcom BCM5706/BCM5708 Gigabit Ethernet device bfe # Broadcom BCM440x 10/100 Ethernet device bge # Broadcom BCM570xx Gigabit Ethernet device cas # Sun Cassini/Cassini+ and NS DP83065 Saturn device cxgb # Chelsio T3 10 Gigabit Ethernet device cxgb_t3fw # Chelsio T3 10 Gigabit Ethernet firmware device dc # DEC/Intel 21143 and various workalikes device et # Agere ET1310 10/100/Gigabit Ethernet device fxp # Intel EtherExpress PRO/100B (82557, 82558) hint.fxp.0.prefer_iomap="0" device gem # Apple GMAC/Sun ERI/Sun GEM device hme # Sun HME (Happy Meal Ethernet) device jme # JMicron JMC250 Gigabit/JMC260 Fast Ethernet device lge # Level 1 LXT1001 gigabit Ethernet device msk # Marvell/SysKonnect Yukon II Gigabit Ethernet device my # Myson Fast Ethernet (MTD80X, MTD89X) device nge # NatSemi DP83820 gigabit Ethernet device re # RealTek 8139C+/8169/8169S/8110S device rl # RealTek 8129/8139 device pcn # AMD Am79C97x PCI 10/100 NICs device sf # Adaptec AIC-6915 (``Starfire'') device sge # Silicon Integrated Systems SiS190/191 device sis # Silicon Integrated Systems SiS 900/SiS 7016 device sk # SysKonnect SK-984x & SK-982x gigabit Ethernet device ste # Sundance ST201 (D-Link DFE-550TX) device stge # Sundance/Tamarack TC9021 gigabit Ethernet device tl # Texas Instruments ThunderLAN device tx # SMC EtherPower II (83c170 ``EPIC'') device vr # VIA Rhine, Rhine II device vte # DM&P Vortex86 RDC R6040 Fast Ethernet device wb # Winbond W89C840F device xl # 3Com 3c90x (``Boomerang'', ``Cyclone'') # PCI Ethernet NICs. device bxe # Broadcom BCM57710/BCM57711/BCM57711E 10Gb Ethernet device cxgbe # Chelsio T4 10GbE PCIe adapter device de # DEC/Intel DC21x4x (``Tulip'') device em # Intel Pro/1000 Gigabit Ethernet device igb # Intel Pro/1000 PCIE Gigabit Ethernet device ixgb # Intel Pro/10Gbe PCI-X Ethernet device ixgbe # Intel Pro/10Gbe PCIE Ethernet device le # AMD Am7900 LANCE and Am79C9xx PCnet device mxge # Myricom Myri-10G 10GbE NIC device nxge # Neterion Xframe 10GbE Server/Storage Adapter device oce # Emulex 10 GbE (OneConnect Ethernet) device ti # Alteon Networks Tigon I/II gigabit Ethernet device txp # 3Com 3cR990 (``Typhoon'') device vx # 3Com 3c590, 3c595 (``Vortex'') device vxge # Exar/Neterion XFrame 3100 10GbE # PCI FDDI NICs. device fpa # PCI WAN adapters. device lmc # PCI IEEE 802.11 Wireless NICs device ath # Atheros pci/cardbus NIC's device ath_hal # pci/cardbus chip support #device ath_ar5210 # AR5210 chips #device ath_ar5211 # AR5211 chips #device ath_ar5212 # AR5212 chips #device ath_rf2413 #device ath_rf2417 #device ath_rf2425 #device ath_rf5111 #device ath_rf5112 #device ath_rf5413 #device ath_ar5416 # AR5416 chips options AH_SUPPORT_AR5416 # enable AR5416 tx/rx descriptors # All of the AR5212 parts have a problem when paired with the AR71xx # CPUS. These parts have a bug that triggers a fatal bus error on the AR71xx # only. Details of the exact nature of the bug are sketchy, but some can be # found at https://forum.openwrt.org/viewtopic.php?pid=70060 on pages 4, 5 and # 6. This option enables this workaround. There is a performance penalty # for this work around, but without it things don't work at all. The DMA # from the card usually bursts 128 bytes, but on the affected CPUs, only # 4 are safe. options AH_RXCFG_SDMAMW_4BYTES #device ath_ar9160 # AR9160 chips #device ath_ar9280 # AR9280 chips #device ath_ar9285 # AR9285 chips device ath_rate_sample # SampleRate tx rate control for ath device bwi # Broadcom BCM430* BCM431* device bwn # Broadcom BCM43xx device malo # Marvell Libertas wireless NICs. device mwl # Marvell 88W8363 802.11n wireless NICs. device mwlfw device ral # Ralink Technology RT2500 wireless NICs. # Use sf_buf(9) interface for jumbo buffers on ti(4) controllers. #options TI_SF_BUF_JUMBO # Turn on the header splitting option for the ti(4) driver firmware. This # only works for Tigon II chips, and has no effect for Tigon I chips. # This option requires the TI_SF_BUF_JUMBO option above. #options TI_JUMBO_HDRSPLIT # These two options allow manipulating the mbuf cluster size and mbuf size, # respectively. Be very careful with NIC driver modules when changing # these from their default values, because that can potentially cause a # mismatch between the mbuf size assumed by the kernel and the mbuf size # assumed by a module. The only driver that currently has the ability to # detect a mismatch is ti(4). options MCLSHIFT=12 # mbuf cluster shift in bits, 12 == 4KB options MSIZE=512 # mbuf size in bytes # # ATM related options (Cranor version) # (note: this driver cannot be used with the HARP ATM stack) # # The `en' device provides support for Efficient Networks (ENI) # ENI-155 PCI midway cards, and the Adaptec 155Mbps PCI ATM cards (ANA-59x0). # # The `hatm' device provides support for Fore/Marconi HE155 and HE622 # ATM PCI cards. # # The `fatm' device provides support for Fore PCA200E ATM PCI cards. # # The `patm' device provides support for IDT77252 based cards like # ProSum's ProATM-155 and ProATM-25 and IDT's evaluation boards. # # atm device provides generic atm functions and is required for # atm devices. # NATM enables the netnatm protocol family that can be used to # bypass TCP/IP. # # utopia provides the access to the ATM PHY chips and is required for en, # hatm and fatm. # # the current driver supports only PVC operations (no atm-arp, no multicast). # for more details, please read the original documents at # http://www.ccrc.wustl.edu/pub/chuck/tech/bsdatm/bsdatm.html # device atm device en device fatm #Fore PCA200E device hatm #Fore/Marconi HE155/622 device patm #IDT77252 cards (ProATM and IDT) device utopia #ATM PHY driver options NATM #native ATM options LIBMBPOOL #needed by patm, iatm # # Sound drivers # # sound: The generic sound driver. # device sound # # snd_*: Device-specific drivers. # # The flags of the device tell the device a bit more info about the # device that normally is obtained through the PnP interface. # bit 2..0 secondary DMA channel; # bit 4 set if the board uses two dma channels; # bit 15..8 board type, overrides autodetection; leave it # zero if don't know what to put in (and you don't, # since this is unsupported at the moment...). # # snd_ad1816: Analog Devices AD1816 ISA PnP/non-PnP. # snd_als4000: Avance Logic ALS4000 PCI. # snd_atiixp: ATI IXP 200/300/400 PCI. # snd_audiocs: Crystal Semiconductor CS4231 SBus/EBus. Only # for sparc64. # snd_cmi: CMedia CMI8338/CMI8738 PCI. # snd_cs4281: Crystal Semiconductor CS4281 PCI. # snd_csa: Crystal Semiconductor CS461x/428x PCI. (except # 4281) # snd_ds1: Yamaha DS-1 PCI. # snd_emu10k1: Creative EMU10K1 PCI and EMU10K2 (Audigy) PCI. # snd_emu10kx: Creative SoundBlaster Live! and Audigy # snd_envy24: VIA Envy24 and compatible, needs snd_spicds. # snd_envy24ht: VIA Envy24HT and compatible, needs snd_spicds. # snd_es137x: Ensoniq AudioPCI ES137x PCI. # snd_ess: Ensoniq ESS ISA PnP/non-PnP, to be used in # conjunction with snd_sbc. # snd_fm801: Forte Media FM801 PCI. # snd_gusc: Gravis UltraSound ISA PnP/non-PnP. # snd_hda: Intel High Definition Audio (Controller) and # compatible. # snd_hdspe: RME HDSPe AIO and RayDAT. # snd_ich: Intel ICH AC'97 and some more audio controllers # embedded in a chipset, for example nVidia # nForce controllers. # snd_maestro: ESS Technology Maestro-1/2x PCI. # snd_maestro3: ESS Technology Maestro-3/Allegro PCI. # snd_mss: Microsoft Sound System ISA PnP/non-PnP. # snd_neomagic: Neomagic 256 AV/ZX PCI. # snd_sb16: Creative SoundBlaster16, to be used in # conjunction with snd_sbc. # snd_sb8: Creative SoundBlaster (pre-16), to be used in # conjunction with snd_sbc. # snd_sbc: Creative SoundBlaster ISA PnP/non-PnP. # Supports ESS and Avance ISA chips as well. # snd_solo: ESS Solo-1x PCI. # snd_spicds: SPI codec driver, needed by Envy24/Envy24HT drivers. # snd_t4dwave: Trident 4DWave DX/NX PCI, Sis 7018 PCI and Acer Labs # M5451 PCI. # snd_uaudio: USB audio. # snd_via8233: VIA VT8233x PCI. # snd_via82c686: VIA VT82C686A PCI. # snd_vibes: S3 Sonicvibes PCI. device snd_ad1816 device snd_als4000 device snd_atiixp #device snd_audiocs device snd_cmi device snd_cs4281 device snd_csa device snd_ds1 device snd_emu10k1 device snd_emu10kx device snd_envy24 device snd_envy24ht device snd_es137x device snd_ess device snd_fm801 device snd_gusc device snd_hda device snd_hdspe device snd_ich device snd_maestro device snd_maestro3 device snd_mss device snd_neomagic device snd_sb16 device snd_sb8 device snd_sbc device snd_solo device snd_spicds device snd_t4dwave device snd_uaudio device snd_via8233 device snd_via82c686 device snd_vibes # For non-PnP sound cards: hint.pcm.0.at="isa" hint.pcm.0.irq="10" hint.pcm.0.drq="1" hint.pcm.0.flags="0x0" hint.sbc.0.at="isa" hint.sbc.0.port="0x220" hint.sbc.0.irq="5" hint.sbc.0.drq="1" hint.sbc.0.flags="0x15" hint.gusc.0.at="isa" hint.gusc.0.port="0x220" hint.gusc.0.irq="5" hint.gusc.0.drq="1" hint.gusc.0.flags="0x13" # # Following options are intended for debugging/testing purposes: # # SND_DEBUG Enable extra debugging code that includes # sanity checking and possible increase of # verbosity. # # SND_DIAGNOSTIC Similar in a spirit of INVARIANTS/DIAGNOSTIC, # zero tolerance against inconsistencies. # # SND_FEEDER_MULTIFORMAT By default, only 16/32 bit feeders are compiled # in. This options enable most feeder converters # except for 8bit. WARNING: May bloat the kernel. # # SND_FEEDER_FULL_MULTIFORMAT Ditto, but includes 8bit feeders as well. # # SND_FEEDER_RATE_HP (feeder_rate) High precision 64bit arithmetic # as much as possible (the default trying to # avoid it). Possible slowdown. # # SND_PCM_64 (Only applicable for i386/32bit arch) # Process 32bit samples through 64bit # integer/arithmetic. Slight increase of dynamic # range at a cost of possible slowdown. # # SND_OLDSTEREO Only 2 channels are allowed, effectively # disabling multichannel processing. # options SND_DEBUG options SND_DIAGNOSTIC options SND_FEEDER_MULTIFORMAT options SND_FEEDER_FULL_MULTIFORMAT options SND_FEEDER_RATE_HP options SND_PCM_64 options SND_OLDSTEREO # # IEEE-488 hardware: # pcii: PCIIA cards (uPD7210 based isa cards) # tnt4882: National Instruments PCI-GPIB card. device pcii hint.pcii.0.at="isa" hint.pcii.0.port="0x2e1" hint.pcii.0.irq="5" hint.pcii.0.drq="1" device tnt4882 # # Miscellaneous hardware: # # scd: Sony CD-ROM using proprietary (non-ATAPI) interface # mcd: Mitsumi CD-ROM using proprietary (non-ATAPI) interface # bktr: Brooktree bt848/848a/849a/878/879 video capture and TV Tuner board # joy: joystick (including IO DATA PCJOY PC Card joystick) # cmx: OmniKey CardMan 4040 pccard smartcard reader # Mitsumi CD-ROM device mcd hint.mcd.0.at="isa" hint.mcd.0.port="0x300" # for the Sony CDU31/33A CDROM device scd hint.scd.0.at="isa" hint.scd.0.port="0x230" device joy # PnP aware, hints for non-PnP only hint.joy.0.at="isa" hint.joy.0.port="0x201" device cmx # # The 'bktr' device is a PCI video capture device using the Brooktree # bt848/bt848a/bt849a/bt878/bt879 chipset. When used with a TV Tuner it forms a # TV card, e.g. Miro PC/TV, Hauppauge WinCast/TV WinTV, VideoLogic Captivator, # Intel Smart Video III, AverMedia, IMS Turbo, FlyVideo. # # options OVERRIDE_CARD=xxx # options OVERRIDE_TUNER=xxx # options OVERRIDE_MSP=1 # options OVERRIDE_DBX=1 # These options can be used to override the auto detection # The current values for xxx are found in src/sys/dev/bktr/bktr_card.h # Using sysctl(8) run-time overrides on a per-card basis can be made # # options BROOKTREE_SYSTEM_DEFAULT=BROOKTREE_PAL # or # options BROOKTREE_SYSTEM_DEFAULT=BROOKTREE_NTSC # Specifies the default video capture mode. # This is required for Dual Crystal (28&35MHz) boards where PAL is used # to prevent hangs during initialization, e.g. VideoLogic Captivator PCI. # # options BKTR_USE_PLL # This is required for PAL or SECAM boards with a 28MHz crystal and no 35MHz # crystal, e.g. some new Bt878 cards. # # options BKTR_GPIO_ACCESS # This enables IOCTLs which give user level access to the GPIO port. # # options BKTR_NO_MSP_RESET # Prevents the MSP34xx reset. Good if you initialize the MSP in another OS first # # options BKTR_430_FX_MODE # Switch Bt878/879 cards into Intel 430FX chipset compatibility mode. # # options BKTR_SIS_VIA_MODE # Switch Bt878/879 cards into SIS/VIA chipset compatibility mode which is # needed for some old SiS and VIA chipset motherboards. # This also allows Bt878/879 chips to work on old OPTi (<1997) chipset # motherboards and motherboards with bad or incomplete PCI 2.1 support. # As a rough guess, old = before 1998 # # options BKTR_NEW_MSP34XX_DRIVER # Use new, more complete initialization scheme for the msp34* soundchip. # Should fix stereo autodetection if the old driver does only output # mono sound. # # options BKTR_USE_FREEBSD_SMBUS # Compile with FreeBSD SMBus implementation # # Brooktree driver has been ported to the new I2C framework. Thus, # you'll need to have the following 3 lines in the kernel config. # device smbus # device iicbus # device iicbb # device iicsmb # The iic and smb devices are only needed if you want to control other # I2C slaves connected to the external connector of some cards. # device bktr # # PC Card/PCMCIA and Cardbus # # cbb: pci/cardbus bridge implementing YENTA interface # pccard: pccard slots # cardbus: cardbus slots device cbb device pccard device cardbus # # MMC/SD # # mmc MMC/SD bus # mmcsd MMC/SD memory card # sdhci Generic PCI SD Host Controller # device mmc device mmcsd device sdhci # # SMB bus # # System Management Bus support is provided by the 'smbus' device. # Access to the SMBus device is via the 'smb' device (/dev/smb*), # which is a child of the 'smbus' device. # # Supported devices: # smb standard I/O through /dev/smb* # # Supported SMB interfaces: # iicsmb I2C to SMB bridge with any iicbus interface # bktr brooktree848 I2C hardware interface # intpm Intel PIIX4 (82371AB, 82443MX) Power Management Unit # alpm Acer Aladdin-IV/V/Pro2 Power Management Unit # ichsmb Intel ICH SMBus controller chips (82801AA, 82801AB, 82801BA) # viapm VIA VT82C586B/596B/686A and VT8233 Power Management Unit # amdpm AMD 756 Power Management Unit # amdsmb AMD 8111 SMBus 2.0 Controller # nfpm NVIDIA nForce Power Management Unit # nfsmb NVIDIA nForce2/3/4 MCP SMBus 2.0 Controller # device smbus # Bus support, required for smb below. device intpm device alpm device ichsmb device viapm device amdpm device amdsmb device nfpm device nfsmb device smb # # I2C Bus # # Philips i2c bus support is provided by the `iicbus' device. # # Supported devices: # ic i2c network interface # iic i2c standard io # iicsmb i2c to smb bridge. Allow i2c i/o with smb commands. # iicoc simple polling driver for OpenCores I2C controller # # Supported interfaces: # bktr brooktree848 I2C software interface # # Other: # iicbb generic I2C bit-banging code (needed by lpbb, bktr) # device iicbus # Bus support, required for ic/iic/iicsmb below. device iicbb device ic device iic device iicsmb # smb over i2c bridge device iicoc # OpenCores I2C controller support # I2C peripheral devices # # ds133x Dallas Semiconductor DS1337, DS1338 and DS1339 RTC # ds1374 Dallas Semiconductor DS1374 RTC # ds1672 Dallas Semiconductor DS1672 RTC # s35390a Seiko Instruments S-35390A RTC # device ds133x device ds1374 device ds1672 device s35390a # Parallel-Port Bus # # Parallel port bus support is provided by the `ppbus' device. # Multiple devices may be attached to the parallel port, devices # are automatically probed and attached when found. # # Supported devices: # vpo Iomega Zip Drive # Requires SCSI disk support ('scbus' and 'da'), best # performance is achieved with ports in EPP 1.9 mode. # lpt Parallel Printer # plip Parallel network interface # ppi General-purpose I/O ("Geek Port") + IEEE1284 I/O # pps Pulse per second Timing Interface # lpbb Philips official parallel port I2C bit-banging interface # pcfclock Parallel port clock driver. # # Supported interfaces: # ppc ISA-bus parallel port interfaces. # options PPC_PROBE_CHIPSET # Enable chipset specific detection # (see flags in ppc(4)) options DEBUG_1284 # IEEE1284 signaling protocol debug options PERIPH_1284 # Makes your computer act as an IEEE1284 # compliant peripheral options DONTPROBE_1284 # Avoid boot detection of PnP parallel devices options VP0_DEBUG # ZIP/ZIP+ debug options LPT_DEBUG # Printer driver debug options PPC_DEBUG # Parallel chipset level debug options PLIP_DEBUG # Parallel network IP interface debug options PCFCLOCK_VERBOSE # Verbose pcfclock driver options PCFCLOCK_MAX_RETRIES=5 # Maximum read tries (default 10) device ppc hint.ppc.0.at="isa" hint.ppc.0.irq="7" device ppbus device vpo device lpt device plip device ppi device pps device lpbb device pcfclock # Kernel BOOTP support options BOOTP # Use BOOTP to obtain IP address/hostname # Requires NFSCLIENT and NFS_ROOT options BOOTP_NFSROOT # NFS mount root filesystem using BOOTP info options BOOTP_NFSV3 # Use NFS v3 to NFS mount root options BOOTP_COMPAT # Workaround for broken bootp daemons. options BOOTP_WIRED_TO=fxp0 # Use interface fxp0 for BOOTP options BOOTP_BLOCKSIZE=8192 # Override NFS block size # # Add software watchdog routines. # options SW_WATCHDOG # # Add the software deadlock resolver thread. # options DEADLKRES # # Disable swapping of stack pages. This option removes all # code which actually performs swapping, so it's not possible to turn # it back on at run-time. # # This is sometimes usable for systems which don't have any swap space # (see also sysctls "vm.defer_swapspace_pageouts" and # "vm.disable_swapspace_pageouts") # #options NO_SWAPPING # Set the number of sf_bufs to allocate. sf_bufs are virtual buffers # for sendfile(2) that are used to map file VM pages, and normally # default to a quantity that is roughly 16*MAXUSERS+512. You would # typically want about 4 of these for each simultaneous file send. # options NSFBUFS=1024 # # Enable extra debugging code for locks. This stores the filename and # line of whatever acquired the lock in the lock itself, and changes a # number of function calls to pass around the relevant data. This is # not at all useful unless you are debugging lock code. Also note # that it is likely to break e.g. fstat(1) unless you recompile your # userland with -DDEBUG_LOCKS as well. # options DEBUG_LOCKS ##################################################################### # USB support # UHCI controller device uhci # OHCI controller device ohci # EHCI controller device ehci # XHCI controller device xhci # SL811 Controller #device slhci # General USB code (mandatory for USB) device usb # # USB Double Bulk Pipe devices device udbp # USB Fm Radio device ufm # Human Interface Device (anything with buttons and dials) device uhid # USB keyboard device ukbd # USB printer device ulpt # USB mass storage driver (Requires scbus and da) device umass # USB mass storage driver for device-side mode device usfs # USB support for Belkin F5U109 and Magic Control Technology serial adapters device umct # USB modem support device umodem # USB mouse device ums # eGalax USB touch screen device uep # Diamond Rio 500 MP3 player device urio # # USB serial support device ucom # USB support for 3G modem cards by Option, Novatel, Huawei and Sierra device u3g # USB support for Technologies ARK3116 based serial adapters device uark # USB support for Belkin F5U103 and compatible serial adapters device ubsa # USB support for serial adapters based on the FT8U100AX and FT8U232AM device uftdi # USB support for some Windows CE based serial communication. device uipaq # USB support for Prolific PL-2303 serial adapters device uplcom # USB support for Silicon Laboratories CP2101/CP2102 based USB serial adapters device uslcom # USB Visor and Palm devices device uvisor # USB serial support for DDI pocket's PHS device uvscom # # ADMtek USB ethernet. Supports the LinkSys USB100TX, # the Billionton USB100, the Melco LU-ATX, the D-Link DSB-650TX # and the SMC 2202USB. Also works with the ADMtek AN986 Pegasus # eval board. device aue # ASIX Electronics AX88172 USB 2.0 ethernet driver. Used in the # LinkSys USB200M and various other adapters. device axe # # Devices which communicate using Ethernet over USB, particularly # Communication Device Class (CDC) Ethernet specification. Supports # Sharp Zaurus PDAs, some DOCSIS cable modems and so on. device cdce # # CATC USB-EL1201A USB ethernet. Supports the CATC Netmate # and Netmate II, and the Belkin F5U111. device cue # # Kawasaki LSI ethernet. Supports the LinkSys USB10T, # Entrega USB-NET-E45, Peracom Ethernet Adapter, the # 3Com 3c19250, the ADS Technologies USB-10BT, the ATen UC10T, # the Netgear EA101, the D-Link DSB-650, the SMC 2102USB # and 2104USB, and the Corega USB-T. device kue # # RealTek RTL8150 USB to fast ethernet. Supports the Melco LUA-KTX # and the GREEN HOUSE GH-USB100B. device rue # # Davicom DM9601E USB to fast ethernet. Supports the Corega FEther USB-TXC. device udav # # Moschip MCS7730/MCS7840 USB to fast ethernet. Supports the Sitecom LN030. device mos # # HSxPA devices from Option N.V device uhso # # Ralink Technology RT2501USB/RT2601USB wireless driver device rum # Ralink Technology RT2700U/RT2800U/RT3000U wireless driver device run # # Atheros AR5523 wireless driver device uath # # Conexant/Intersil PrismGT wireless driver device upgt # # Ralink Technology RT2500USB wireless driver device ural # # Realtek RTL8187B/L wireless driver device urtw # # ZyDas ZD1211/ZD1211B wireless driver device zyd # # debugging options for the USB subsystem # options USB_DEBUG options U3G_DEBUG # options for ukbd: options UKBD_DFLT_KEYMAP # specify the built-in keymap makeoptions UKBD_DFLT_KEYMAP=it.iso # options for uplcom: options UPLCOM_INTR_INTERVAL=100 # interrupt pipe interval # in milliseconds # options for uvscom: options UVSCOM_DEFAULT_OPKTSIZE=8 # default output packet size options UVSCOM_INTR_INTERVAL=100 # interrupt pipe interval # in milliseconds ##################################################################### # FireWire support device firewire # FireWire bus code device sbp # SCSI over Firewire (Requires scbus and da) device sbp_targ # SBP-2 Target mode (Requires scbus and targ) device fwe # Ethernet over FireWire (non-standard!) device fwip # IP over FireWire (RFC2734 and RFC3146) ##################################################################### # dcons support (Dumb Console Device) device dcons # dumb console driver device dcons_crom # FireWire attachment options DCONS_BUF_SIZE=16384 # buffer size options DCONS_POLL_HZ=100 # polling rate options DCONS_FORCE_CONSOLE=0 # force to be the primary console options DCONS_FORCE_GDB=1 # force to be the gdb device ##################################################################### # crypto subsystem # # This is a port of the OpenBSD crypto framework. Include this when # configuring IPSEC and when you have a h/w crypto device to accelerate # user applications that link to OpenSSL. # # Drivers are ports from OpenBSD with some simple enhancements that have # been fed back to OpenBSD. device crypto # core crypto support device cryptodev # /dev/crypto for access to h/w device rndtest # FIPS 140-2 entropy tester device hifn # Hifn 7951, 7781, etc. options HIFN_DEBUG # enable debugging support: hw.hifn.debug options HIFN_RNDTEST # enable rndtest support device ubsec # Broadcom 5501, 5601, 58xx options UBSEC_DEBUG # enable debugging support: hw.ubsec.debug options UBSEC_RNDTEST # enable rndtest support ##################################################################### # # Embedded system options: # # An embedded system might want to run something other than init. options INIT_PATH=/sbin/init:/rescue/init # Debug options options BUS_DEBUG # enable newbus debugging options DEBUG_VFS_LOCKS # enable VFS lock debugging options SOCKBUF_DEBUG # enable sockbuf last record/mb tail checking # # Verbose SYSINIT # # Make the SYSINIT process performed by mi_startup() verbose. This is very # useful when porting to a new architecture. If DDB is also enabled, this # will print function names instead of addresses. options VERBOSE_SYSINIT ##################################################################### # SYSV IPC KERNEL PARAMETERS # # Maximum number of System V semaphores that can be used on the system at # one time. options SEMMNI=11 # Total number of semaphores system wide options SEMMNS=61 # Total number of undo structures in system options SEMMNU=31 # Maximum number of System V semaphores that can be used by a single process # at one time. options SEMMSL=61 # Maximum number of operations that can be outstanding on a single System V # semaphore at one time. options SEMOPM=101 # Maximum number of undo operations that can be outstanding on a single # System V semaphore at one time. options SEMUME=11 # Maximum number of shared memory pages system wide. options SHMALL=1025 # Maximum size, in bytes, of a single System V shared memory region. options SHMMAX=(SHMMAXPGS*PAGE_SIZE+1) options SHMMAXPGS=1025 # Minimum size, in bytes, of a single System V shared memory region. options SHMMIN=2 # Maximum number of shared memory regions that can be used on the system # at one time. options SHMMNI=33 # Maximum number of System V shared memory regions that can be attached to # a single process at one time. options SHMSEG=9 # Compress user core dumps. options COMPRESS_USER_CORES # required to compress file output from kernel for COMPRESS_USER_CORES. device gzio # Set the amount of time (in seconds) the system will wait before # rebooting automatically when a kernel panic occurs. If set to (-1), # the system will wait indefinitely until a key is pressed on the # console. options PANIC_REBOOT_WAIT_TIME=16 # Attempt to bypass the buffer cache and put data directly into the # userland buffer for read operation when O_DIRECT flag is set on the # file. Both offset and length of the read operation must be # multiples of the physical media sector size. # options DIRECTIO # Specify a lower limit for the number of swap I/O buffers. They are # (among other things) used when bypassing the buffer cache due to # DIRECTIO kernel option enabled and O_DIRECT flag set on file. # options NSWBUF_MIN=120 ##################################################################### # More undocumented options for linting. # Note that documenting these is not considered an affront. options CAM_DEBUG_DELAY # VFS cluster debugging. options CLUSTERDEBUG options DEBUG # Kernel filelock debugging. options LOCKF_DEBUG # System V compatible message queues # Please note that the values provided here are used to test kernel # building. The defaults in the sources provide almost the same numbers. # MSGSSZ must be a power of 2 between 8 and 1024. options MSGMNB=2049 # Max number of chars in queue options MSGMNI=41 # Max number of message queue identifiers options MSGSEG=2049 # Max number of message segments options MSGSSZ=16 # Size of a message segment options MSGTQL=41 # Max number of messages in system options NBUF=512 # Number of buffer headers options SCSI_NCR_DEBUG options SCSI_NCR_MAX_SYNC=10000 options SCSI_NCR_MAX_WIDE=1 options SCSI_NCR_MYADDR=7 options SC_DEBUG_LEVEL=5 # Syscons debug level options SC_RENDER_DEBUG # syscons rendering debugging options VFS_BIO_DEBUG # VFS buffer I/O debugging options KSTACK_MAX_PAGES=32 # Maximum pages to give the kernel stack # Adaptec Array Controller driver options options AAC_DEBUG # Debugging levels: # 0 - quiet, only emit warnings # 1 - noisy, emit major function # points and things done # 2 - extremely noisy, emit trace # items in loops, etc. # Resource Accounting options RACCT # Resource Limits options RCTL # Yet more undocumented options for linting. # BKTR_ALLOC_PAGES has no effect except to cause warnings, and # BROOKTREE_ALLOC_PAGES hasn't actually been superseded by it, since the # driver still mostly spells this option BROOKTREE_ALLOC_PAGES. ##options BKTR_ALLOC_PAGES=(217*4+1) options BROOKTREE_ALLOC_PAGES=(217*4+1) options MAXFILES=999 Index: head/sys/conf/files =================================================================== --- head/sys/conf/files (revision 249082) +++ head/sys/conf/files (revision 249083) @@ -1,3658 +1,3652 @@ # $FreeBSD$ # # The long compile-with and dependency lines are required because of # limitations in config: backslash-newline doesn't work in strings, and # dependency lines other than the first are silently ignored. # acpi_quirks.h optional acpi \ dependency "$S/tools/acpi_quirks2h.awk $S/dev/acpica/acpi_quirks" \ compile-with "${AWK} -f $S/tools/acpi_quirks2h.awk $S/dev/acpica/acpi_quirks" \ no-obj no-implicit-rule before-depend \ clean "acpi_quirks.h" aicasm optional ahc | ahd \ dependency "$S/dev/aic7xxx/aicasm/*.[chyl]" \ compile-with "CC='${CC}' ${MAKE} -f $S/dev/aic7xxx/aicasm/Makefile MAKESRCPATH=$S/dev/aic7xxx/aicasm" \ no-obj no-implicit-rule \ clean "aicasm* y.tab.h" aic7xxx_seq.h optional ahc \ compile-with "./aicasm ${INCLUDES} -I$S/cam/scsi -I$S/dev/aic7xxx -o aic7xxx_seq.h -r aic7xxx_reg.h -p aic7xxx_reg_print.c -i $S/dev/aic7xxx/aic7xxx_osm.h $S/dev/aic7xxx/aic7xxx.seq" \ no-obj no-implicit-rule before-depend local \ clean "aic7xxx_seq.h" \ dependency "$S/dev/aic7xxx/aic7xxx.{reg,seq} $S/cam/scsi/scsi_message.h aicasm" aic7xxx_reg.h optional ahc \ compile-with "./aicasm ${INCLUDES} -I$S/cam/scsi -I$S/dev/aic7xxx -o aic7xxx_seq.h -r aic7xxx_reg.h -p aic7xxx_reg_print.c -i $S/dev/aic7xxx/aic7xxx_osm.h $S/dev/aic7xxx/aic7xxx.seq" \ no-obj no-implicit-rule before-depend local \ clean "aic7xxx_reg.h" \ dependency "$S/dev/aic7xxx/aic7xxx.{reg,seq} $S/cam/scsi/scsi_message.h aicasm" aic7xxx_reg_print.c optional ahc \ compile-with "./aicasm ${INCLUDES} -I$S/cam/scsi -I$S/dev/aic7xxx -o aic7xxx_seq.h -r aic7xxx_reg.h -p aic7xxx_reg_print.c -i $S/dev/aic7xxx/aic7xxx_osm.h $S/dev/aic7xxx/aic7xxx.seq" \ no-obj no-implicit-rule local \ clean "aic7xxx_reg_print.c" \ dependency "$S/dev/aic7xxx/aic7xxx.{reg,seq} $S/cam/scsi/scsi_message.h aicasm" aic7xxx_reg_print.o optional ahc ahc_reg_pretty_print \ compile-with "${NORMAL_C}" \ no-implicit-rule local aic79xx_seq.h optional ahd pci \ compile-with "./aicasm ${INCLUDES} -I$S/cam/scsi -I$S/dev/aic7xxx -o aic79xx_seq.h -r aic79xx_reg.h -p aic79xx_reg_print.c -i $S/dev/aic7xxx/aic79xx_osm.h $S/dev/aic7xxx/aic79xx.seq" \ no-obj no-implicit-rule before-depend local \ clean "aic79xx_seq.h" \ dependency "$S/dev/aic7xxx/aic79xx.{reg,seq} $S/cam/scsi/scsi_message.h aicasm" aic79xx_reg.h optional ahd pci \ compile-with "./aicasm ${INCLUDES} -I$S/cam/scsi -I$S/dev/aic7xxx -o aic79xx_seq.h -r aic79xx_reg.h -p aic79xx_reg_print.c -i $S/dev/aic7xxx/aic79xx_osm.h $S/dev/aic7xxx/aic79xx.seq" \ no-obj no-implicit-rule before-depend local \ clean "aic79xx_reg.h" \ dependency "$S/dev/aic7xxx/aic79xx.{reg,seq} $S/cam/scsi/scsi_message.h aicasm" aic79xx_reg_print.c optional ahd pci \ compile-with "./aicasm ${INCLUDES} -I$S/cam/scsi -I$S/dev/aic7xxx -o aic79xx_seq.h -r aic79xx_reg.h -p aic79xx_reg_print.c -i $S/dev/aic7xxx/aic79xx_osm.h $S/dev/aic7xxx/aic79xx.seq" \ no-obj no-implicit-rule local \ clean "aic79xx_reg_print.c" \ dependency "$S/dev/aic7xxx/aic79xx.{reg,seq} $S/cam/scsi/scsi_message.h aicasm" aic79xx_reg_print.o optional ahd pci ahd_reg_pretty_print \ compile-with "${NORMAL_C}" \ no-implicit-rule local # # The 'fdt_dtb_file' target covers an actual DTB file name, which is derived # from the specified source (DTS) file: .dts -> .dtb # fdt_dtb_file optional fdt \ compile-with "if [ -f $S/boot/fdt/dts/${FDT_DTS_FILE} ]; then dtc -O dtb -o ${FDT_DTS_FILE:R}.dtb -b 0 -p 1024 $S/boot/fdt/dts/${FDT_DTS_FILE}; fi" \ no-obj no-implicit-rule before-depend \ clean "${FDT_DTS_FILE:R}.dtb" fdt_static_dtb.h optional fdt fdt_dtb_static \ compile-with "sh $S/tools/fdt/make_dtbh.sh ${FDT_DTS_FILE} ." \ no-obj no-implicit-rule before-depend \ clean "fdt_static_dtb.h" feeder_eq_gen.h optional sound \ dependency "$S/tools/sound/feeder_eq_mkfilter.awk" \ compile-with "${AWK} -f $S/tools/sound/feeder_eq_mkfilter.awk -- ${FEEDER_EQ_PRESETS} > feeder_eq_gen.h" \ no-obj no-implicit-rule before-depend \ clean "feeder_eq_gen.h" feeder_rate_gen.h optional sound \ dependency "$S/tools/sound/feeder_rate_mkfilter.awk" \ compile-with "${AWK} -f $S/tools/sound/feeder_rate_mkfilter.awk -- ${FEEDER_RATE_PRESETS} > feeder_rate_gen.h" \ no-obj no-implicit-rule before-depend \ clean "feeder_rate_gen.h" snd_fxdiv_gen.h optional sound \ dependency "$S/tools/sound/snd_fxdiv_gen.awk" \ compile-with "${AWK} -f $S/tools/sound/snd_fxdiv_gen.awk -- > snd_fxdiv_gen.h" \ no-obj no-implicit-rule before-depend \ clean "snd_fxdiv_gen.h" miidevs.h optional miibus | mii \ dependency "$S/tools/miidevs2h.awk $S/dev/mii/miidevs" \ compile-with "${AWK} -f $S/tools/miidevs2h.awk $S/dev/mii/miidevs" \ no-obj no-implicit-rule before-depend \ clean "miidevs.h" pccarddevs.h standard \ dependency "$S/tools/pccarddevs2h.awk $S/dev/pccard/pccarddevs" \ compile-with "${AWK} -f $S/tools/pccarddevs2h.awk $S/dev/pccard/pccarddevs" \ no-obj no-implicit-rule before-depend \ clean "pccarddevs.h" teken_state.h optional sc \ dependency "$S/teken/gensequences $S/teken/sequences" \ compile-with "${AWK} -f $S/teken/gensequences $S/teken/sequences > teken_state.h" \ no-obj no-implicit-rule before-depend \ clean "teken_state.h" usbdevs.h optional usb \ dependency "$S/tools/usbdevs2h.awk $S/dev/usb/usbdevs" \ compile-with "${AWK} -f $S/tools/usbdevs2h.awk $S/dev/usb/usbdevs -h" \ no-obj no-implicit-rule before-depend \ clean "usbdevs.h" usbdevs_data.h optional usb \ dependency "$S/tools/usbdevs2h.awk $S/dev/usb/usbdevs" \ compile-with "${AWK} -f $S/tools/usbdevs2h.awk $S/dev/usb/usbdevs -d" \ no-obj no-implicit-rule before-depend \ clean "usbdevs_data.h" cam/cam.c optional scbus cam/cam_periph.c optional scbus cam/cam_queue.c optional scbus cam/cam_sim.c optional scbus cam/cam_xpt.c optional scbus cam/ata/ata_all.c optional scbus cam/ata/ata_xpt.c optional scbus cam/ata/ata_pmp.c optional scbus cam/scsi/scsi_xpt.c optional scbus cam/scsi/scsi_all.c optional scbus cam/scsi/scsi_cd.c optional cd cam/scsi/scsi_ch.c optional ch cam/ata/ata_da.c optional ada | da cam/ctl/ctl.c optional ctl cam/ctl/ctl_backend.c optional ctl cam/ctl/ctl_backend_block.c optional ctl cam/ctl/ctl_backend_ramdisk.c optional ctl cam/ctl/ctl_cmd_table.c optional ctl cam/ctl/ctl_frontend.c optional ctl cam/ctl/ctl_frontend_cam_sim.c optional ctl cam/ctl/ctl_frontend_internal.c optional ctl cam/ctl/ctl_mem_pool.c optional ctl cam/ctl/ctl_scsi_all.c optional ctl cam/ctl/ctl_error.c optional ctl cam/ctl/ctl_util.c optional ctl cam/ctl/scsi_ctl.c optional ctl cam/scsi/scsi_da.c optional da cam/scsi/scsi_low.c optional ct | ncv | nsp | stg cam/scsi/scsi_pass.c optional pass cam/scsi/scsi_pt.c optional pt cam/scsi/scsi_sa.c optional sa cam/scsi/scsi_enc.c optional ses cam/scsi/scsi_enc_ses.c optional ses cam/scsi/scsi_enc_safte.c optional ses cam/scsi/scsi_sg.c optional sg cam/scsi/scsi_targ_bh.c optional targbh cam/scsi/scsi_target.c optional targ cam/scsi/smp_all.c optional scbus # shared between zfs and dtrace cddl/compat/opensolaris/kern/opensolaris.c optional zfs compile-with "${ZFS_C}" cddl/compat/opensolaris/kern/opensolaris_cmn_err.c optional zfs compile-with "${ZFS_C}" cddl/compat/opensolaris/kern/opensolaris_kmem.c optional zfs compile-with "${ZFS_C}" cddl/compat/opensolaris/kern/opensolaris_misc.c optional zfs compile-with "${ZFS_C}" cddl/compat/opensolaris/kern/opensolaris_sunddi.c optional zfs compile-with "${ZFS_C}" # zfs specific cddl/compat/opensolaris/kern/opensolaris_acl.c optional zfs compile-with "${ZFS_C}" cddl/compat/opensolaris/kern/opensolaris_kobj.c optional zfs compile-with "${ZFS_C}" cddl/compat/opensolaris/kern/opensolaris_kstat.c optional zfs compile-with "${ZFS_C}" cddl/compat/opensolaris/kern/opensolaris_lookup.c optional zfs compile-with "${ZFS_C}" cddl/compat/opensolaris/kern/opensolaris_policy.c optional zfs compile-with "${ZFS_C}" cddl/compat/opensolaris/kern/opensolaris_string.c optional zfs compile-with "${ZFS_C}" cddl/compat/opensolaris/kern/opensolaris_sysevent.c optional zfs compile-with "${ZFS_C}" cddl/compat/opensolaris/kern/opensolaris_taskq.c optional zfs compile-with "${ZFS_C}" cddl/compat/opensolaris/kern/opensolaris_uio.c optional zfs compile-with "${ZFS_C}" cddl/compat/opensolaris/kern/opensolaris_vfs.c optional zfs compile-with "${ZFS_C}" cddl/compat/opensolaris/kern/opensolaris_vm.c optional zfs compile-with "${ZFS_C}" cddl/compat/opensolaris/kern/opensolaris_zone.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/common/acl/acl_common.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/common/avl/avl.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/common/nvpair/fnvpair.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/common/nvpair/nvpair.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/common/nvpair/nvpair_alloc_fixed.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/common/unicode/u8_textprep.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/common/zfs/zfeature_common.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/common/zfs/zfs_comutil.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/common/zfs/zfs_deleg.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/common/zfs/zfs_fletcher.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/common/zfs/zfs_ioctl_compat.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/common/zfs/zfs_namecheck.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/common/zfs/zfs_prop.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/common/zfs/zpool_prop.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/common/zfs/zprop_common.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/gfs.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/vnode.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/bplist.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/bpobj.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/bptree.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/ddt.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/ddt_zap.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_diff.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_object.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_traverse.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_zfetch.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c optional zfs compile-with "${ZFS_C}" \ warning "kernel contains CDDL licensed ZFS filesystem" cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_deadlist.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_deleg.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_prop.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_userhold.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_synctask.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/gzip.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/lz4.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/lzjb.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/refcount.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/rrwlock.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/sa.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/sha256.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/spa_errlog.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/spa_history.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/space_map.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/trim_map.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/uberblock.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/unique.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_cache.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_missing.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_root.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/zap.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/zap_leaf.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/zfeature.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_byteswap.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_debug.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_fm.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_fuid.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_log.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_onexit.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_replay.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_rlock.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_sa.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/zio_checksum.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/zio_compress.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/zio_inject.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/zle.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/zrlock.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/os/callb.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/os/fm.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/os/list.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/os/nvpair_alloc_system.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/zmod/adler32.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/zmod/deflate.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/zmod/inffast.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/zmod/inflate.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/zmod/inftrees.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/zmod/opensolaris_crc32.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/zmod/trees.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/zmod/zmod.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/zmod/zmod_subr.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/zmod/zutil.c optional zfs compile-with "${ZFS_C}" compat/freebsd32/freebsd32_ioctl.c optional compat_freebsd32 compat/freebsd32/freebsd32_misc.c optional compat_freebsd32 compat/freebsd32/freebsd32_syscalls.c optional compat_freebsd32 compat/freebsd32/freebsd32_sysent.c optional compat_freebsd32 contrib/altq/altq/altq_cbq.c optional altq contrib/altq/altq/altq_cdnr.c optional altq contrib/altq/altq/altq_hfsc.c optional altq contrib/altq/altq/altq_priq.c optional altq contrib/altq/altq/altq_red.c optional altq contrib/altq/altq/altq_rio.c optional altq contrib/altq/altq/altq_rmclass.c optional altq contrib/altq/altq/altq_subr.c optional altq contrib/dev/acpica/components/debugger/dbcmds.c optional acpi acpi_debug contrib/dev/acpica/components/debugger/dbconvert.c optional acpi acpi_debug contrib/dev/acpica/components/debugger/dbdisply.c optional acpi acpi_debug contrib/dev/acpica/components/debugger/dbexec.c optional acpi acpi_debug contrib/dev/acpica/components/debugger/dbfileio.c optional acpi acpi_debug contrib/dev/acpica/components/debugger/dbhistry.c optional acpi acpi_debug contrib/dev/acpica/components/debugger/dbinput.c optional acpi acpi_debug contrib/dev/acpica/components/debugger/dbmethod.c optional acpi acpi_debug contrib/dev/acpica/components/debugger/dbnames.c optional acpi acpi_debug contrib/dev/acpica/components/debugger/dbstats.c optional acpi acpi_debug contrib/dev/acpica/components/debugger/dbutils.c optional acpi acpi_debug contrib/dev/acpica/components/debugger/dbxface.c optional acpi acpi_debug contrib/dev/acpica/components/disassembler/dmbuffer.c optional acpi acpi_debug contrib/dev/acpica/components/disassembler/dmdeferred.c optional acpi acpi_debug contrib/dev/acpica/components/disassembler/dmnames.c optional acpi acpi_debug contrib/dev/acpica/components/disassembler/dmopcode.c optional acpi acpi_debug contrib/dev/acpica/components/disassembler/dmobject.c optional acpi acpi_debug contrib/dev/acpica/components/disassembler/dmresrc.c optional acpi acpi_debug contrib/dev/acpica/components/disassembler/dmresrcl.c optional acpi acpi_debug contrib/dev/acpica/components/disassembler/dmresrcl2.c optional acpi acpi_debug contrib/dev/acpica/components/disassembler/dmresrcs.c optional acpi acpi_debug contrib/dev/acpica/components/disassembler/dmutils.c optional acpi acpi_debug contrib/dev/acpica/components/disassembler/dmwalk.c optional acpi acpi_debug contrib/dev/acpica/components/dispatcher/dsargs.c optional acpi contrib/dev/acpica/components/dispatcher/dscontrol.c optional acpi contrib/dev/acpica/components/dispatcher/dsfield.c optional acpi contrib/dev/acpica/components/dispatcher/dsinit.c optional acpi contrib/dev/acpica/components/dispatcher/dsmethod.c optional acpi contrib/dev/acpica/components/dispatcher/dsmthdat.c optional acpi contrib/dev/acpica/components/dispatcher/dsobject.c optional acpi contrib/dev/acpica/components/dispatcher/dsopcode.c optional acpi contrib/dev/acpica/components/dispatcher/dsutils.c optional acpi contrib/dev/acpica/components/dispatcher/dswexec.c optional acpi contrib/dev/acpica/components/dispatcher/dswload.c optional acpi contrib/dev/acpica/components/dispatcher/dswload2.c optional acpi contrib/dev/acpica/components/dispatcher/dswscope.c optional acpi contrib/dev/acpica/components/dispatcher/dswstate.c optional acpi contrib/dev/acpica/components/events/evevent.c optional acpi contrib/dev/acpica/components/events/evglock.c optional acpi contrib/dev/acpica/components/events/evgpe.c optional acpi contrib/dev/acpica/components/events/evgpeblk.c optional acpi contrib/dev/acpica/components/events/evgpeinit.c optional acpi contrib/dev/acpica/components/events/evgpeutil.c optional acpi contrib/dev/acpica/components/events/evhandler.c optional acpi contrib/dev/acpica/components/events/evmisc.c optional acpi contrib/dev/acpica/components/events/evregion.c optional acpi contrib/dev/acpica/components/events/evrgnini.c optional acpi contrib/dev/acpica/components/events/evsci.c optional acpi contrib/dev/acpica/components/events/evxface.c optional acpi contrib/dev/acpica/components/events/evxfevnt.c optional acpi contrib/dev/acpica/components/events/evxfgpe.c optional acpi contrib/dev/acpica/components/events/evxfregn.c optional acpi contrib/dev/acpica/components/executer/exconfig.c optional acpi contrib/dev/acpica/components/executer/exconvrt.c optional acpi contrib/dev/acpica/components/executer/excreate.c optional acpi contrib/dev/acpica/components/executer/exdebug.c optional acpi contrib/dev/acpica/components/executer/exdump.c optional acpi contrib/dev/acpica/components/executer/exfield.c optional acpi contrib/dev/acpica/components/executer/exfldio.c optional acpi contrib/dev/acpica/components/executer/exmisc.c optional acpi contrib/dev/acpica/components/executer/exmutex.c optional acpi contrib/dev/acpica/components/executer/exnames.c optional acpi contrib/dev/acpica/components/executer/exoparg1.c optional acpi contrib/dev/acpica/components/executer/exoparg2.c optional acpi contrib/dev/acpica/components/executer/exoparg3.c optional acpi contrib/dev/acpica/components/executer/exoparg6.c optional acpi contrib/dev/acpica/components/executer/exprep.c optional acpi contrib/dev/acpica/components/executer/exregion.c optional acpi contrib/dev/acpica/components/executer/exresnte.c optional acpi contrib/dev/acpica/components/executer/exresolv.c optional acpi contrib/dev/acpica/components/executer/exresop.c optional acpi contrib/dev/acpica/components/executer/exstore.c optional acpi contrib/dev/acpica/components/executer/exstoren.c optional acpi contrib/dev/acpica/components/executer/exstorob.c optional acpi contrib/dev/acpica/components/executer/exsystem.c optional acpi contrib/dev/acpica/components/executer/exutils.c optional acpi contrib/dev/acpica/components/hardware/hwacpi.c optional acpi contrib/dev/acpica/components/hardware/hwesleep.c optional acpi contrib/dev/acpica/components/hardware/hwgpe.c optional acpi contrib/dev/acpica/components/hardware/hwpci.c optional acpi contrib/dev/acpica/components/hardware/hwregs.c optional acpi contrib/dev/acpica/components/hardware/hwsleep.c optional acpi contrib/dev/acpica/components/hardware/hwtimer.c optional acpi contrib/dev/acpica/components/hardware/hwvalid.c optional acpi contrib/dev/acpica/components/hardware/hwxface.c optional acpi contrib/dev/acpica/components/hardware/hwxfsleep.c optional acpi contrib/dev/acpica/components/namespace/nsaccess.c optional acpi contrib/dev/acpica/components/namespace/nsalloc.c optional acpi contrib/dev/acpica/components/namespace/nsconvert.c optional acpi contrib/dev/acpica/components/namespace/nsdump.c optional acpi contrib/dev/acpica/components/namespace/nseval.c optional acpi contrib/dev/acpica/components/namespace/nsinit.c optional acpi contrib/dev/acpica/components/namespace/nsload.c optional acpi contrib/dev/acpica/components/namespace/nsnames.c optional acpi contrib/dev/acpica/components/namespace/nsobject.c optional acpi contrib/dev/acpica/components/namespace/nsparse.c optional acpi contrib/dev/acpica/components/namespace/nspredef.c optional acpi contrib/dev/acpica/components/namespace/nsprepkg.c optional acpi contrib/dev/acpica/components/namespace/nsrepair.c optional acpi contrib/dev/acpica/components/namespace/nsrepair2.c optional acpi contrib/dev/acpica/components/namespace/nssearch.c optional acpi contrib/dev/acpica/components/namespace/nsutils.c optional acpi contrib/dev/acpica/components/namespace/nswalk.c optional acpi contrib/dev/acpica/components/namespace/nsxfeval.c optional acpi contrib/dev/acpica/components/namespace/nsxfname.c optional acpi contrib/dev/acpica/components/namespace/nsxfobj.c optional acpi contrib/dev/acpica/components/parser/psargs.c optional acpi contrib/dev/acpica/components/parser/psloop.c optional acpi contrib/dev/acpica/components/parser/psobject.c optional acpi contrib/dev/acpica/components/parser/psopcode.c optional acpi contrib/dev/acpica/components/parser/psopinfo.c optional acpi contrib/dev/acpica/components/parser/psparse.c optional acpi contrib/dev/acpica/components/parser/psscope.c optional acpi contrib/dev/acpica/components/parser/pstree.c optional acpi contrib/dev/acpica/components/parser/psutils.c optional acpi contrib/dev/acpica/components/parser/pswalk.c optional acpi contrib/dev/acpica/components/parser/psxface.c optional acpi contrib/dev/acpica/components/resources/rsaddr.c optional acpi contrib/dev/acpica/components/resources/rscalc.c optional acpi contrib/dev/acpica/components/resources/rscreate.c optional acpi contrib/dev/acpica/components/resources/rsdump.c optional acpi contrib/dev/acpica/components/resources/rsdumpinfo.c optional acpi contrib/dev/acpica/components/resources/rsinfo.c optional acpi contrib/dev/acpica/components/resources/rsio.c optional acpi contrib/dev/acpica/components/resources/rsirq.c optional acpi contrib/dev/acpica/components/resources/rslist.c optional acpi contrib/dev/acpica/components/resources/rsmemory.c optional acpi contrib/dev/acpica/components/resources/rsmisc.c optional acpi contrib/dev/acpica/components/resources/rsserial.c optional acpi contrib/dev/acpica/components/resources/rsutils.c optional acpi contrib/dev/acpica/components/resources/rsxface.c optional acpi contrib/dev/acpica/components/tables/tbfadt.c optional acpi contrib/dev/acpica/components/tables/tbfind.c optional acpi contrib/dev/acpica/components/tables/tbinstal.c optional acpi contrib/dev/acpica/components/tables/tbutils.c optional acpi contrib/dev/acpica/components/tables/tbxface.c optional acpi contrib/dev/acpica/components/tables/tbxfload.c optional acpi contrib/dev/acpica/components/tables/tbxfroot.c optional acpi contrib/dev/acpica/components/utilities/utaddress.c optional acpi contrib/dev/acpica/components/utilities/utalloc.c optional acpi contrib/dev/acpica/components/utilities/utcache.c optional acpi contrib/dev/acpica/components/utilities/utcopy.c optional acpi contrib/dev/acpica/components/utilities/utdebug.c optional acpi contrib/dev/acpica/components/utilities/utdecode.c optional acpi contrib/dev/acpica/components/utilities/utdelete.c optional acpi contrib/dev/acpica/components/utilities/uteval.c optional acpi contrib/dev/acpica/components/utilities/utexcep.c optional acpi contrib/dev/acpica/components/utilities/utglobal.c optional acpi contrib/dev/acpica/components/utilities/utids.c optional acpi contrib/dev/acpica/components/utilities/utinit.c optional acpi contrib/dev/acpica/components/utilities/utlock.c optional acpi contrib/dev/acpica/components/utilities/utmath.c optional acpi contrib/dev/acpica/components/utilities/utmisc.c optional acpi contrib/dev/acpica/components/utilities/utmutex.c optional acpi contrib/dev/acpica/components/utilities/utobject.c optional acpi contrib/dev/acpica/components/utilities/utosi.c optional acpi contrib/dev/acpica/components/utilities/utownerid.c optional acpi contrib/dev/acpica/components/utilities/utresrc.c optional acpi contrib/dev/acpica/components/utilities/utstate.c optional acpi contrib/dev/acpica/components/utilities/utstring.c optional acpi contrib/dev/acpica/components/utilities/utxface.c optional acpi contrib/dev/acpica/components/utilities/utxferror.c optional acpi contrib/dev/acpica/components/utilities/utxfinit.c optional acpi #contrib/dev/acpica/components/utilities/utxfmutex.c optional acpi contrib/ipfilter/netinet/fil.c optional ipfilter inet \ compile-with "${NORMAL_C} ${NO_WSELF_ASSIGN} -I$S/contrib/ipfilter" contrib/ipfilter/netinet/ip_auth.c optional ipfilter inet \ compile-with "${NORMAL_C} -I$S/contrib/ipfilter" contrib/ipfilter/netinet/ip_fil_freebsd.c optional ipfilter inet \ compile-with "${NORMAL_C} -I$S/contrib/ipfilter" contrib/ipfilter/netinet/ip_frag.c optional ipfilter inet \ compile-with "${NORMAL_C} -I$S/contrib/ipfilter" contrib/ipfilter/netinet/ip_log.c optional ipfilter inet \ compile-with "${NORMAL_C} -I$S/contrib/ipfilter" contrib/ipfilter/netinet/ip_nat.c optional ipfilter inet \ compile-with "${NORMAL_C} -I$S/contrib/ipfilter" contrib/ipfilter/netinet/ip_proxy.c optional ipfilter inet \ compile-with "${NORMAL_C} ${NO_WSELF_ASSIGN} -I$S/contrib/ipfilter" contrib/ipfilter/netinet/ip_state.c optional ipfilter inet \ compile-with "${NORMAL_C} -I$S/contrib/ipfilter" contrib/ipfilter/netinet/ip_lookup.c optional ipfilter inet \ compile-with "${NORMAL_C} ${NO_WSELF_ASSIGN} -Wno-error -I$S/contrib/ipfilter" contrib/ipfilter/netinet/ip_pool.c optional ipfilter inet \ compile-with "${NORMAL_C} -I$S/contrib/ipfilter" contrib/ipfilter/netinet/ip_htable.c optional ipfilter inet \ compile-with "${NORMAL_C} -I$S/contrib/ipfilter" contrib/ipfilter/netinet/ip_sync.c optional ipfilter inet \ compile-with "${NORMAL_C} -I$S/contrib/ipfilter" contrib/ipfilter/netinet/mlfk_ipl.c optional ipfilter inet \ compile-with "${NORMAL_C} -I$S/contrib/ipfilter" contrib/libfdt/fdt.c optional fdt contrib/libfdt/fdt_ro.c optional fdt contrib/libfdt/fdt_rw.c optional fdt contrib/libfdt/fdt_strerror.c optional fdt contrib/libfdt/fdt_sw.c optional fdt contrib/libfdt/fdt_wip.c optional fdt contrib/ngatm/netnatm/api/cc_conn.c optional ngatm_ccatm \ compile-with "${NORMAL_C_NOWERROR} -I$S/contrib/ngatm" contrib/ngatm/netnatm/api/cc_data.c optional ngatm_ccatm \ compile-with "${NORMAL_C} -I$S/contrib/ngatm" contrib/ngatm/netnatm/api/cc_dump.c optional ngatm_ccatm \ compile-with "${NORMAL_C} -I$S/contrib/ngatm" contrib/ngatm/netnatm/api/cc_port.c optional ngatm_ccatm \ compile-with "${NORMAL_C} -I$S/contrib/ngatm" contrib/ngatm/netnatm/api/cc_sig.c optional ngatm_ccatm \ compile-with "${NORMAL_C} -I$S/contrib/ngatm" contrib/ngatm/netnatm/api/cc_user.c optional ngatm_ccatm \ compile-with "${NORMAL_C} -I$S/contrib/ngatm" contrib/ngatm/netnatm/api/unisap.c optional ngatm_ccatm \ compile-with "${NORMAL_C} -I$S/contrib/ngatm" contrib/ngatm/netnatm/misc/straddr.c optional ngatm_atmbase \ compile-with "${NORMAL_C} -I$S/contrib/ngatm" contrib/ngatm/netnatm/misc/unimsg_common.c optional ngatm_atmbase \ compile-with "${NORMAL_C} -I$S/contrib/ngatm" contrib/ngatm/netnatm/msg/traffic.c optional ngatm_atmbase \ compile-with "${NORMAL_C} -I$S/contrib/ngatm" contrib/ngatm/netnatm/msg/uni_ie.c optional ngatm_atmbase \ compile-with "${NORMAL_C} -I$S/contrib/ngatm" contrib/ngatm/netnatm/msg/uni_msg.c optional ngatm_atmbase \ compile-with "${NORMAL_C} -I$S/contrib/ngatm" contrib/ngatm/netnatm/saal/saal_sscfu.c optional ngatm_sscfu \ compile-with "${NORMAL_C} -I$S/contrib/ngatm" contrib/ngatm/netnatm/saal/saal_sscop.c optional ngatm_sscop \ compile-with "${NORMAL_C} -I$S/contrib/ngatm" contrib/ngatm/netnatm/sig/sig_call.c optional ngatm_uni \ compile-with "${NORMAL_C} -I$S/contrib/ngatm" contrib/ngatm/netnatm/sig/sig_coord.c optional ngatm_uni \ compile-with "${NORMAL_C} -I$S/contrib/ngatm" contrib/ngatm/netnatm/sig/sig_party.c optional ngatm_uni \ compile-with "${NORMAL_C} -I$S/contrib/ngatm" contrib/ngatm/netnatm/sig/sig_print.c optional ngatm_uni \ compile-with "${NORMAL_C} -I$S/contrib/ngatm" contrib/ngatm/netnatm/sig/sig_reset.c optional ngatm_uni \ compile-with "${NORMAL_C} -I$S/contrib/ngatm" contrib/ngatm/netnatm/sig/sig_uni.c optional ngatm_uni \ compile-with "${NORMAL_C} -I$S/contrib/ngatm" contrib/ngatm/netnatm/sig/sig_unimsgcpy.c optional ngatm_uni \ compile-with "${NORMAL_C} -I$S/contrib/ngatm" contrib/ngatm/netnatm/sig/sig_verify.c optional ngatm_uni \ compile-with "${NORMAL_C} -I$S/contrib/ngatm" crypto/blowfish/bf_ecb.c optional ipsec crypto/blowfish/bf_skey.c optional crypto | ipsec crypto/camellia/camellia.c optional crypto | ipsec crypto/camellia/camellia-api.c optional crypto | ipsec crypto/des/des_ecb.c optional crypto | ipsec crypto/des/des_setkey.c optional crypto | ipsec crypto/rc4/rc4.c optional netgraph_mppc_encryption | kgssapi crypto/rijndael/rijndael-alg-fst.c optional crypto | geom_bde | \ ipsec | random | wlan_ccmp crypto/rijndael/rijndael-api-fst.c optional geom_bde | random crypto/rijndael/rijndael-api.c optional crypto | ipsec | wlan_ccmp crypto/sha1.c optional carp | crypto | ipsec | \ netgraph_mppc_encryption | sctp crypto/sha2/sha2.c optional crypto | geom_bde | ipsec | random | \ sctp | zfs ddb/db_access.c optional ddb ddb/db_break.c optional ddb ddb/db_capture.c optional ddb ddb/db_command.c optional ddb ddb/db_examine.c optional ddb ddb/db_expr.c optional ddb ddb/db_input.c optional ddb ddb/db_lex.c optional ddb ddb/db_main.c optional ddb ddb/db_output.c optional ddb ddb/db_print.c optional ddb ddb/db_ps.c optional ddb ddb/db_run.c optional ddb ddb/db_script.c optional ddb ddb/db_sym.c optional ddb ddb/db_thread.c optional ddb ddb/db_textdump.c optional ddb ddb/db_variables.c optional ddb ddb/db_watch.c optional ddb ddb/db_write_cmd.c optional ddb #dev/dpt/dpt_control.c optional dpt dev/aac/aac.c optional aac dev/aac/aac_cam.c optional aacp aac dev/aac/aac_debug.c optional aac dev/aac/aac_disk.c optional aac dev/aac/aac_linux.c optional aac compat_linux dev/aac/aac_pci.c optional aac pci dev/acpi_support/acpi_wmi.c optional acpi_wmi acpi dev/acpi_support/acpi_asus.c optional acpi_asus acpi dev/acpi_support/acpi_asus_wmi.c optional acpi_asus_wmi acpi dev/acpi_support/acpi_fujitsu.c optional acpi_fujitsu acpi dev/acpi_support/acpi_hp.c optional acpi_hp acpi dev/acpi_support/acpi_ibm.c optional acpi_ibm acpi dev/acpi_support/acpi_panasonic.c optional acpi_panasonic acpi dev/acpi_support/acpi_sony.c optional acpi_sony acpi dev/acpi_support/acpi_toshiba.c optional acpi_toshiba acpi dev/acpi_support/atk0110.c optional aibs acpi dev/acpica/Osd/OsdDebug.c optional acpi dev/acpica/Osd/OsdHardware.c optional acpi dev/acpica/Osd/OsdInterrupt.c optional acpi dev/acpica/Osd/OsdMemory.c optional acpi dev/acpica/Osd/OsdSchedule.c optional acpi dev/acpica/Osd/OsdStream.c optional acpi dev/acpica/Osd/OsdSynch.c optional acpi dev/acpica/Osd/OsdTable.c optional acpi dev/acpica/acpi.c optional acpi dev/acpica/acpi_acad.c optional acpi dev/acpica/acpi_battery.c optional acpi dev/acpica/acpi_button.c optional acpi dev/acpica/acpi_cmbat.c optional acpi dev/acpica/acpi_cpu.c optional acpi dev/acpica/acpi_ec.c optional acpi dev/acpica/acpi_hpet.c optional acpi dev/acpica/acpi_isab.c optional acpi isa dev/acpica/acpi_lid.c optional acpi dev/acpica/acpi_package.c optional acpi dev/acpica/acpi_pci.c optional acpi pci dev/acpica/acpi_pci_link.c optional acpi pci dev/acpica/acpi_pcib.c optional acpi pci dev/acpica/acpi_pcib_acpi.c optional acpi pci dev/acpica/acpi_pcib_pci.c optional acpi pci dev/acpica/acpi_perf.c optional acpi dev/acpica/acpi_powerres.c optional acpi dev/acpica/acpi_quirk.c optional acpi dev/acpica/acpi_resource.c optional acpi dev/acpica/acpi_smbat.c optional acpi dev/acpica/acpi_thermal.c optional acpi dev/acpica/acpi_throttle.c optional acpi dev/acpica/acpi_timer.c optional acpi dev/acpica/acpi_video.c optional acpi_video acpi dev/acpica/acpi_dock.c optional acpi_dock acpi dev/adlink/adlink.c optional adlink dev/advansys/adv_eisa.c optional adv eisa dev/advansys/adv_pci.c optional adv pci dev/advansys/advansys.c optional adv dev/advansys/advlib.c optional adv dev/advansys/advmcode.c optional adv dev/advansys/adw_pci.c optional adw pci dev/advansys/adwcam.c optional adw dev/advansys/adwlib.c optional adw dev/advansys/adwmcode.c optional adw dev/ae/if_ae.c optional ae pci dev/age/if_age.c optional age pci dev/agp/agp.c optional agp pci dev/agp/agp_if.m optional agp pci dev/aha/aha.c optional aha dev/aha/aha_isa.c optional aha isa dev/aha/aha_mca.c optional aha mca dev/ahb/ahb.c optional ahb eisa dev/ahci/ahci.c optional ahci pci dev/ahci/ahciem.c optional ahci pci dev/aic/aic.c optional aic dev/aic/aic_pccard.c optional aic pccard dev/aic7xxx/ahc_eisa.c optional ahc eisa dev/aic7xxx/ahc_isa.c optional ahc isa dev/aic7xxx/ahc_pci.c optional ahc pci \ compile-with "${NORMAL_C} ${NO_WCONSTANT_CONVERSION}" dev/aic7xxx/ahd_pci.c optional ahd pci \ compile-with "${NORMAL_C} ${NO_WCONSTANT_CONVERSION}" dev/aic7xxx/aic7770.c optional ahc dev/aic7xxx/aic79xx.c optional ahd pci dev/aic7xxx/aic79xx_osm.c optional ahd pci dev/aic7xxx/aic79xx_pci.c optional ahd pci dev/aic7xxx/aic7xxx.c optional ahc dev/aic7xxx/aic7xxx_93cx6.c optional ahc dev/aic7xxx/aic7xxx_osm.c optional ahc dev/aic7xxx/aic7xxx_pci.c optional ahc pci dev/alc/if_alc.c optional alc pci dev/ale/if_ale.c optional ale pci dev/altera/avgen/altera_avgen.c optional altera_avgen dev/altera/avgen/altera_avgen_fdt.c optional altera_avgen fdt dev/altera/avgen/altera_avgen_nexus.c optional altera_avgen dev/altera/sdcard/altera_sdcard.c optional altera_sdcard dev/altera/sdcard/altera_sdcard_disk.c optional altera_sdcard dev/altera/sdcard/altera_sdcard_io.c optional altera_sdcard dev/altera/sdcard/altera_sdcard_fdt.c optional altera_sdcard fdt dev/altera/sdcard/altera_sdcard_nexus.c optional altera_sdcard dev/amr/amr.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 dev/an/if_an.c optional an dev/an/if_an_isa.c optional an isa dev/an/if_an_pccard.c optional an pccard dev/an/if_an_pci.c optional an pci dev/asr/asr.c optional asr pci \ compile-with "${NORMAL_C} ${NO_WARRAY_BOUNDS}" # dev/ata/ata_if.m optional ata | atacore dev/ata/ata-all.c optional ata | atacore dev/ata/ata-dma.c optional ata | atacore dev/ata/ata-lowlevel.c optional ata | atacore dev/ata/ata-queue.c optional ata | atacore dev/ata/ata-sata.c optional ata | atacore dev/ata/ata-card.c optional ata pccard | atapccard dev/ata/ata-cbus.c optional ata pc98 | atapc98 dev/ata/ata-isa.c optional ata isa | ataisa dev/ata/ata-pci.c optional ata pci | atapci dev/ata/chipsets/ata-ahci.c optional ata pci | ataahci | ataacerlabs | \ ataati | ataintel | atajmicron | \ atavia | atanvidia dev/ata/chipsets/ata-acard.c optional ata pci | ataacard dev/ata/chipsets/ata-acerlabs.c optional ata pci | ataacerlabs dev/ata/chipsets/ata-adaptec.c optional ata pci | ataadaptec dev/ata/chipsets/ata-amd.c optional ata pci | ataamd dev/ata/chipsets/ata-ati.c optional ata pci | ataati dev/ata/chipsets/ata-cenatek.c optional ata pci | atacenatek dev/ata/chipsets/ata-cypress.c optional ata pci | atacypress dev/ata/chipsets/ata-cyrix.c optional ata pci | atacyrix dev/ata/chipsets/ata-highpoint.c optional ata pci | atahighpoint dev/ata/chipsets/ata-intel.c optional ata pci | ataintel dev/ata/chipsets/ata-ite.c optional ata pci | ataite dev/ata/chipsets/ata-jmicron.c optional ata pci | atajmicron dev/ata/chipsets/ata-marvell.c optional ata pci | atamarvell | ataadaptec dev/ata/chipsets/ata-micron.c optional ata pci | atamicron dev/ata/chipsets/ata-national.c optional ata pci | atanational dev/ata/chipsets/ata-netcell.c optional ata pci | atanetcell dev/ata/chipsets/ata-nvidia.c optional ata pci | atanvidia dev/ata/chipsets/ata-promise.c optional ata pci | atapromise dev/ata/chipsets/ata-serverworks.c optional ata pci | ataserverworks 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" # dev/ath/if_ath_ahb.c optional ath_ahb \ compile-with "${NORMAL_C} -I$S/dev/ath" # dev/ath/if_ath.c optional ath \ compile-with "${NORMAL_C} -I$S/dev/ath" dev/ath/if_ath_beacon.c optional ath \ compile-with "${NORMAL_C} -I$S/dev/ath" dev/ath/if_ath_debug.c optional ath \ compile-with "${NORMAL_C} -I$S/dev/ath" dev/ath/if_ath_keycache.c optional ath \ compile-with "${NORMAL_C} -I$S/dev/ath" dev/ath/if_ath_led.c optional ath \ compile-with "${NORMAL_C} -I$S/dev/ath" dev/ath/if_ath_tx.c optional ath \ compile-with "${NORMAL_C} -I$S/dev/ath" dev/ath/if_ath_tx_edma.c optional ath \ compile-with "${NORMAL_C} -I$S/dev/ath" dev/ath/if_ath_tx_ht.c optional ath \ compile-with "${NORMAL_C} -I$S/dev/ath" dev/ath/if_ath_tdma.c optional ath \ compile-with "${NORMAL_C} -I$S/dev/ath" dev/ath/if_ath_sysctl.c optional ath \ compile-with "${NORMAL_C} -I$S/dev/ath" dev/ath/if_ath_rx.c optional ath \ compile-with "${NORMAL_C} -I$S/dev/ath" dev/ath/if_ath_rx_edma.c optional ath \ compile-with "${NORMAL_C} -I$S/dev/ath" dev/ath/if_ath_spectral.c optional ath \ compile-with "${NORMAL_C} -I$S/dev/ath" dev/ath/ah_osdep.c optional ath \ compile-with "${NORMAL_C} -I$S/dev/ath" # dev/ath/ath_hal/ah.c optional ath \ compile-with "${NORMAL_C} -I$S/dev/ath" dev/ath/ath_hal/ah_eeprom_v1.c optional ath_hal | ath_ar5210 \ compile-with "${NORMAL_C} -I$S/dev/ath" dev/ath/ath_hal/ah_eeprom_v3.c optional ath_hal | ath_ar5211 | ath_ar5212 \ compile-with "${NORMAL_C} -I$S/dev/ath" dev/ath/ath_hal/ah_eeprom_v14.c \ optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 \ compile-with "${NORMAL_C} -I$S/dev/ath" dev/ath/ath_hal/ah_eeprom_v4k.c \ optional ath_hal | ath_ar9285 \ compile-with "${NORMAL_C} -I$S/dev/ath" dev/ath/ath_hal/ah_eeprom_9287.c \ optional ath_hal | ath_ar9287 \ compile-with "${NORMAL_C} -I$S/dev/ath" dev/ath/ath_hal/ah_regdomain.c optional ath \ compile-with "${NORMAL_C} ${NO_WSHIFT_COUNT_NEGATIVE} ${NO_WSHIFT_COUNT_OVERFLOW} -I$S/dev/ath" # ar5210 dev/ath/ath_hal/ar5210/ar5210_attach.c optional ath_hal | ath_ar5210 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5210/ar5210_beacon.c optional ath_hal | ath_ar5210 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5210/ar5210_interrupts.c optional ath_hal | ath_ar5210 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5210/ar5210_keycache.c optional ath_hal | ath_ar5210 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5210/ar5210_misc.c optional ath_hal | ath_ar5210 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5210/ar5210_phy.c optional ath_hal | ath_ar5210 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5210/ar5210_power.c optional ath_hal | ath_ar5210 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5210/ar5210_recv.c optional ath_hal | ath_ar5210 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5210/ar5210_reset.c optional ath_hal | ath_ar5210 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5210/ar5210_xmit.c optional ath_hal | ath_ar5210 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" # ar5211 dev/ath/ath_hal/ar5211/ar5211_attach.c optional ath_hal | ath_ar5211 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5211/ar5211_beacon.c optional ath_hal | ath_ar5211 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5211/ar5211_interrupts.c optional ath_hal | ath_ar5211 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5211/ar5211_keycache.c optional ath_hal | ath_ar5211 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5211/ar5211_misc.c optional ath_hal | ath_ar5211 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5211/ar5211_phy.c optional ath_hal | ath_ar5211 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5211/ar5211_power.c optional ath_hal | ath_ar5211 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5211/ar5211_recv.c optional ath_hal | ath_ar5211 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5211/ar5211_reset.c optional ath_hal | ath_ar5211 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5211/ar5211_xmit.c optional ath_hal | ath_ar5211 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" # ar5212 dev/ath/ath_hal/ar5212/ar5212_ani.c \ optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 | \ ath_ar9285 ath_ar9287 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5212/ar5212_attach.c \ optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 | \ ath_ar9285 ath_ar9287 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5212/ar5212_beacon.c \ optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 | \ ath_ar9285 ath_ar9287 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5212/ar5212_eeprom.c \ optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 | \ ath_ar9285 ath_ar9287 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5212/ar5212_gpio.c \ optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 | \ ath_ar9285 ath_ar9287 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5212/ar5212_interrupts.c \ optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 | \ ath_ar9285 ath_ar9287 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5212/ar5212_keycache.c \ optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 | \ ath_ar9285 ath_ar9287 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5212/ar5212_misc.c \ optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 | \ ath_ar9285 ath_ar9287 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5212/ar5212_phy.c \ optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 | \ ath_ar9285 ath_ar9287 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5212/ar5212_power.c \ optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 | \ ath_ar9285 ath_ar9287 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5212/ar5212_recv.c \ optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 | \ ath_ar9285 ath_ar9287 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5212/ar5212_reset.c \ optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 | \ ath_ar9285 ath_ar9287 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5212/ar5212_rfgain.c \ optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 | \ ath_ar9285 ath_ar9287 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5212/ar5212_xmit.c \ optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 | \ ath_ar9285 ath_ar9287 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" # ar5416 (depends on ar5212) dev/ath/ath_hal/ar5416/ar5416_ani.c \ optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 | \ ath_ar9287 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5416/ar5416_attach.c \ optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 | \ ath_ar9287 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5416/ar5416_beacon.c \ optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 | \ ath_ar9287 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5416/ar5416_btcoex.c \ optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 | \ ath_ar9287 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5416/ar5416_cal.c \ optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 | \ ath_ar9287 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5416/ar5416_cal_iq.c \ optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 | \ ath_ar9287 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5416/ar5416_cal_adcgain.c \ optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 | \ ath_ar9287 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5416/ar5416_cal_adcdc.c \ optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 | \ ath_ar9287 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5416/ar5416_eeprom.c \ optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 | \ ath_ar9287 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5416/ar5416_gpio.c \ optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 | \ ath_ar9287 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5416/ar5416_interrupts.c \ optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 | \ ath_ar9287 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5416/ar5416_keycache.c \ optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 | \ ath_ar9287 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5416/ar5416_misc.c \ optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 | \ ath_ar9287 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5416/ar5416_phy.c \ optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 | \ ath_ar9287 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5416/ar5416_power.c \ optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 | \ ath_ar9287 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5416/ar5416_radar.c \ optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 | \ ath_ar9287 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5416/ar5416_recv.c \ optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 | \ ath_ar9287 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5416/ar5416_reset.c \ optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 | \ ath_ar9287 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5416/ar5416_spectral.c \ optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 | \ ath_ar9287 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5416/ar5416_xmit.c \ optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 | \ ath_ar9287 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" # ar9130 (depends upon ar5416) - also requires AH_SUPPORT_AR9130 # # Since this is an embedded MAC SoC, there's no need to compile it into the # default HAL. dev/ath/ath_hal/ar9001/ar9130_attach.c optional ath_ar9130 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar9001/ar9130_phy.c optional ath_ar9130 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar9001/ar9130_eeprom.c optional ath_ar9130 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" # ar9160 (depends on ar5416) dev/ath/ath_hal/ar9001/ar9160_attach.c optional ath_hal | ath_ar9160 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" # ar9280 (depends on ar5416) dev/ath/ath_hal/ar9002/ar9280_attach.c optional ath_hal | ath_ar9280 | \ ath_ar9285 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar9002/ar9280_olc.c optional ath_hal | ath_ar9280 | \ ath_ar9285 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" # ar9285 (depends on ar5416 and ar9280) dev/ath/ath_hal/ar9002/ar9285_attach.c optional ath_hal | ath_ar9285 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar9002/ar9285_btcoex.c optional ath_hal | ath_ar9285 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar9002/ar9285_reset.c optional ath_hal | ath_ar9285 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar9002/ar9285_cal.c optional ath_hal | ath_ar9285 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar9002/ar9285_phy.c optional ath_hal | ath_ar9285 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar9002/ar9285_diversity.c optional ath_hal | ath_ar9285 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" # ar9287 (depends on ar5416) dev/ath/ath_hal/ar9002/ar9287_attach.c optional ath_hal | ath_ar9287 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar9002/ar9287_reset.c optional ath_hal | ath_ar9287 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar9002/ar9287_cal.c optional ath_hal | ath_ar9287 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar9002/ar9287_olc.c optional ath_hal | ath_ar9287 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" # rf backends dev/ath/ath_hal/ar5212/ar2316.c optional ath_rf2316 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5212/ar2317.c optional ath_rf2317 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5212/ar2413.c optional ath_hal | ath_rf2413 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5212/ar2425.c optional ath_hal | ath_rf2425 | ath_rf2417 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5212/ar5111.c optional ath_hal | ath_rf5111 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5212/ar5112.c optional ath_hal | ath_rf5112 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5212/ar5413.c optional ath_hal | ath_rf5413 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5416/ar2133.c optional ath_hal | ath_ar5416 | \ ath_ar9130 | ath_ar9160 | ath_ar9280 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar9002/ar9280.c optional ath_hal | ath_ar9280 | ath_ar9285 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar9002/ar9285.c optional ath_hal | ath_ar9285 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar9002/ar9287.c optional ath_hal | ath_ar9287 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" # ath rate control algorithms dev/ath/ath_rate/amrr/amrr.c optional ath_rate_amrr \ compile-with "${NORMAL_C} -I$S/dev/ath" dev/ath/ath_rate/onoe/onoe.c optional ath_rate_onoe \ compile-with "${NORMAL_C} -I$S/dev/ath" dev/ath/ath_rate/sample/sample.c optional ath_rate_sample \ compile-with "${NORMAL_C} -I$S/dev/ath" # ath DFS modules dev/ath/ath_dfs/null/dfs_null.c optional ath \ compile-with "${NORMAL_C} -I$S/dev/ath" # dev/bce/if_bce.c optional bce dev/bfe/if_bfe.c optional bfe dev/bge/if_bge.c optional bge dev/bktr/bktr_audio.c optional bktr pci dev/bktr/bktr_card.c optional bktr pci dev/bktr/bktr_core.c optional bktr pci dev/bktr/bktr_i2c.c optional bktr pci smbus dev/bktr/bktr_os.c optional bktr pci dev/bktr/bktr_tuner.c optional bktr pci dev/bktr/msp34xx.c optional bktr pci dev/buslogic/bt.c optional bt dev/buslogic/bt_eisa.c optional bt eisa dev/buslogic/bt_isa.c optional bt isa dev/buslogic/bt_mca.c optional bt mca dev/buslogic/bt_pci.c optional bt pci dev/bwi/bwimac.c optional bwi dev/bwi/bwiphy.c optional bwi dev/bwi/bwirf.c optional bwi dev/bwi/if_bwi.c optional bwi dev/bwi/if_bwi_pci.c optional bwi pci # XXX Work around clang warning, until maintainer approves fix. dev/bwn/if_bwn.c optional bwn siba_bwn \ compile-with "${NORMAL_C} ${NO_WSOMETIMES_UNINITIALIZED}" dev/bxe/if_bxe.c optional bxe dev/bxe/bxe_link.c optional bxe dev/cardbus/cardbus.c optional cardbus dev/cardbus/cardbus_cis.c optional cardbus dev/cardbus/cardbus_device.c optional cardbus dev/cas/if_cas.c optional cas dev/cfi/cfi_bus_nexus.c optional cfi dev/cfi/cfi_core.c optional cfi dev/cfi/cfi_dev.c optional cfi dev/cfi/cfi_disk.c optional cfid dev/ciss/ciss.c optional ciss dev/cm/smc90cx6.c optional cm dev/cmx/cmx.c optional cmx dev/cmx/cmx_pccard.c optional cmx pccard dev/cpufreq/ichss.c optional cpufreq dev/cs/if_cs.c optional cs dev/cs/if_cs_isa.c optional cs isa dev/cs/if_cs_pccard.c optional cs pccard dev/cxgb/cxgb_main.c optional cxgb pci \ compile-with "${NORMAL_C} -I$S/dev/cxgb" dev/cxgb/cxgb_sge.c optional cxgb pci \ compile-with "${NORMAL_C} -I$S/dev/cxgb" dev/cxgb/common/cxgb_mc5.c optional cxgb pci \ compile-with "${NORMAL_C} -I$S/dev/cxgb" dev/cxgb/common/cxgb_vsc7323.c optional cxgb pci \ compile-with "${NORMAL_C} -I$S/dev/cxgb" dev/cxgb/common/cxgb_vsc8211.c optional cxgb pci \ compile-with "${NORMAL_C} -I$S/dev/cxgb" dev/cxgb/common/cxgb_ael1002.c optional cxgb pci \ compile-with "${NORMAL_C} -I$S/dev/cxgb" dev/cxgb/common/cxgb_aq100x.c optional cxgb pci \ compile-with "${NORMAL_C} -I$S/dev/cxgb" dev/cxgb/common/cxgb_mv88e1xxx.c optional cxgb pci \ compile-with "${NORMAL_C} -I$S/dev/cxgb" dev/cxgb/common/cxgb_xgmac.c optional cxgb pci \ compile-with "${NORMAL_C} -I$S/dev/cxgb" dev/cxgb/common/cxgb_t3_hw.c optional cxgb pci \ compile-with "${NORMAL_C} -I$S/dev/cxgb" dev/cxgb/common/cxgb_tn1010.c optional cxgb pci \ compile-with "${NORMAL_C} -I$S/dev/cxgb" dev/cxgb/sys/uipc_mvec.c optional cxgb pci \ compile-with "${NORMAL_C} -I$S/dev/cxgb" dev/cxgb/cxgb_t3fw.c optional cxgb cxgb_t3fw \ compile-with "${NORMAL_C} -I$S/dev/cxgb" dev/cxgbe/t4_main.c optional cxgbe pci \ compile-with "${NORMAL_C} -I$S/dev/cxgbe" dev/cxgbe/t4_sge.c optional cxgbe pci \ compile-with "${NORMAL_C} -I$S/dev/cxgbe" dev/cxgbe/t4_l2t.c optional cxgbe pci \ compile-with "${NORMAL_C} -I$S/dev/cxgbe" dev/cxgbe/common/t4_hw.c optional cxgbe pci \ compile-with "${NORMAL_C} -I$S/dev/cxgbe" t4fw_cfg.c optional cxgbe \ compile-with "${AWK} -f $S/tools/fw_stub.awk t4fw_cfg.fw:t4fw_cfg t4fw_cfg_uwire.fw:t4fw_cfg_uwire t4fw.fw:t4fw -mt4fw_cfg -c${.TARGET}" \ no-implicit-rule before-depend local \ clean "t4fw_cfg.c" t4fw_cfg.fwo optional cxgbe \ dependency "t4fw_cfg.fw" \ compile-with "${NORMAL_FWO}" \ no-implicit-rule \ clean "t4fw_cfg.fwo" t4fw_cfg.fw optional cxgbe \ dependency "$S/dev/cxgbe/firmware/t4fw_cfg.txt" \ compile-with "${CP} ${.ALLSRC} ${.TARGET}" \ no-obj no-implicit-rule \ clean "t4fw_cfg.fw" t4fw_cfg_uwire.fwo optional cxgbe \ dependency "t4fw_cfg_uwire.fw" \ compile-with "${NORMAL_FWO}" \ no-implicit-rule \ clean "t4fw_cfg_uwire.fwo" t4fw_cfg_uwire.fw optional cxgbe \ dependency "$S/dev/cxgbe/firmware/t4fw_cfg_uwire.txt" \ compile-with "${CP} ${.ALLSRC} ${.TARGET}" \ no-obj no-implicit-rule \ clean "t4fw_cfg_uwire.fw" t4fw.fwo optional cxgbe \ dependency "t4fw.fw" \ compile-with "${NORMAL_FWO}" \ no-implicit-rule \ clean "t4fw.fwo" t4fw.fw optional cxgbe \ dependency "$S/dev/cxgbe/firmware/t4fw-1.8.4.0.bin.uu" \ compile-with "${NORMAL_FW}" \ no-obj no-implicit-rule \ clean "t4fw.fw" dev/cy/cy.c optional cy dev/cy/cy_isa.c optional cy isa dev/cy/cy_pci.c optional cy pci dev/dc/if_dc.c optional dc pci dev/dc/dcphy.c optional dc pci dev/dc/pnphy.c optional dc pci dev/dcons/dcons.c optional dcons dev/dcons/dcons_crom.c optional dcons_crom dev/dcons/dcons_os.c optional dcons dev/de/if_de.c optional de pci dev/digi/CX.c optional digi_CX dev/digi/CX_PCI.c optional digi_CX_PCI dev/digi/EPCX.c optional digi_EPCX dev/digi/EPCX_PCI.c optional digi_EPCX_PCI dev/digi/Xe.c optional digi_Xe dev/digi/Xem.c optional digi_Xem dev/digi/Xr.c optional digi_Xr dev/digi/digi.c optional digi dev/digi/digi_isa.c optional digi isa dev/digi/digi_pci.c optional digi pci dev/dpt/dpt_eisa.c optional dpt eisa dev/dpt/dpt_pci.c optional dpt pci dev/dpt/dpt_scsi.c optional dpt dev/drm/ati_pcigart.c optional drm dev/drm/drm_agpsupport.c optional drm dev/drm/drm_auth.c optional drm dev/drm/drm_bufs.c optional drm dev/drm/drm_context.c optional drm dev/drm/drm_dma.c optional drm dev/drm/drm_drawable.c optional drm dev/drm/drm_drv.c optional drm dev/drm/drm_fops.c optional drm dev/drm/drm_hashtab.c optional drm dev/drm/drm_ioctl.c optional drm dev/drm/drm_irq.c optional drm dev/drm/drm_lock.c optional drm dev/drm/drm_memory.c optional drm dev/drm/drm_mm.c optional drm dev/drm/drm_pci.c optional drm dev/drm/drm_scatter.c optional drm dev/drm/drm_sman.c optional drm dev/drm/drm_sysctl.c optional drm dev/drm/drm_vm.c optional drm dev/drm/i915_dma.c optional i915drm dev/drm/i915_drv.c optional i915drm dev/drm/i915_irq.c optional i915drm dev/drm/i915_mem.c optional i915drm dev/drm/i915_suspend.c optional i915drm dev/drm/mach64_dma.c optional mach64drm dev/drm/mach64_drv.c optional mach64drm dev/drm/mach64_irq.c optional mach64drm dev/drm/mach64_state.c optional mach64drm dev/drm/mga_dma.c optional mgadrm dev/drm/mga_drv.c optional mgadrm dev/drm/mga_irq.c optional mgadrm dev/drm/mga_state.c optional mgadrm dev/drm/mga_warp.c optional mgadrm dev/drm/r128_cce.c optional r128drm \ compile-with "${NORMAL_C} ${NO_WUNUSED_VALUE} ${NO_WCONSTANT_CONVERSION}" dev/drm/r128_drv.c optional r128drm dev/drm/r128_irq.c optional r128drm dev/drm/r128_state.c optional r128drm \ compile-with "${NORMAL_C} ${NO_WUNUSED_VALUE}" dev/drm/r300_cmdbuf.c optional radeondrm dev/drm/r600_blit.c optional radeondrm dev/drm/r600_cp.c optional radeondrm \ compile-with "${NORMAL_C} ${NO_WUNUSED_VALUE} ${NO_WCONSTANT_CONVERSION}" dev/drm/radeon_cp.c optional radeondrm \ compile-with "${NORMAL_C} ${NO_WUNUSED_VALUE} ${NO_WCONSTANT_CONVERSION}" dev/drm/radeon_cs.c optional radeondrm dev/drm/radeon_drv.c optional radeondrm dev/drm/radeon_irq.c optional radeondrm dev/drm/radeon_mem.c optional radeondrm dev/drm/radeon_state.c optional radeondrm dev/drm/savage_bci.c optional savagedrm dev/drm/savage_drv.c optional savagedrm dev/drm/savage_state.c optional savagedrm dev/drm/sis_drv.c optional sisdrm dev/drm/sis_ds.c optional sisdrm dev/drm/sis_mm.c optional sisdrm dev/drm/tdfx_drv.c optional tdfxdrm dev/drm/via_dma.c optional viadrm dev/drm/via_dmablit.c optional viadrm dev/drm/via_drv.c optional viadrm dev/drm/via_irq.c optional viadrm dev/drm/via_map.c optional viadrm dev/drm/via_mm.c optional viadrm dev/drm/via_verifier.c optional viadrm dev/drm/via_video.c optional viadrm dev/ed/if_ed.c optional ed dev/ed/if_ed_novell.c optional ed dev/ed/if_ed_rtl80x9.c optional ed dev/ed/if_ed_pccard.c optional ed pccard dev/ed/if_ed_pci.c optional ed pci dev/eisa/eisa_if.m standard dev/eisa/eisaconf.c optional eisa dev/e1000/if_em.c optional em \ compile-with "${NORMAL_C} -I$S/dev/e1000" dev/e1000/if_lem.c optional em \ compile-with "${NORMAL_C} -I$S/dev/e1000" dev/e1000/if_igb.c optional igb \ compile-with "${NORMAL_C} -I$S/dev/e1000" dev/e1000/e1000_80003es2lan.c optional em | igb \ compile-with "${NORMAL_C} -I$S/dev/e1000" dev/e1000/e1000_82540.c optional em | igb \ compile-with "${NORMAL_C} -I$S/dev/e1000" dev/e1000/e1000_82541.c optional em | igb \ compile-with "${NORMAL_C} -I$S/dev/e1000" dev/e1000/e1000_82542.c optional em | igb \ compile-with "${NORMAL_C} -I$S/dev/e1000" dev/e1000/e1000_82543.c optional em | igb \ compile-with "${NORMAL_C} -I$S/dev/e1000" dev/e1000/e1000_82571.c optional em | igb \ compile-with "${NORMAL_C} -I$S/dev/e1000" dev/e1000/e1000_82575.c optional em | igb \ compile-with "${NORMAL_C} -I$S/dev/e1000" dev/e1000/e1000_ich8lan.c optional em | igb \ compile-with "${NORMAL_C} -I$S/dev/e1000" dev/e1000/e1000_i210.c optional em | igb \ compile-with "${NORMAL_C} -I$S/dev/e1000" dev/e1000/e1000_api.c optional em | igb \ compile-with "${NORMAL_C} -I$S/dev/e1000" dev/e1000/e1000_mac.c optional em | igb \ compile-with "${NORMAL_C} -I$S/dev/e1000" dev/e1000/e1000_manage.c optional em | igb \ compile-with "${NORMAL_C} -I$S/dev/e1000" dev/e1000/e1000_nvm.c optional em | igb \ compile-with "${NORMAL_C} -I$S/dev/e1000" dev/e1000/e1000_phy.c optional em | igb \ compile-with "${NORMAL_C} -I$S/dev/e1000" dev/e1000/e1000_vf.c optional em | igb \ compile-with "${NORMAL_C} -I$S/dev/e1000" dev/e1000/e1000_mbx.c optional em | igb \ compile-with "${NORMAL_C} -I$S/dev/e1000" dev/e1000/e1000_osdep.c optional em | igb \ compile-with "${NORMAL_C} -I$S/dev/e1000" dev/et/if_et.c optional et dev/en/if_en_pci.c optional en pci dev/en/midway.c optional en dev/ep/if_ep.c optional ep dev/ep/if_ep_eisa.c optional ep eisa dev/ep/if_ep_isa.c optional ep isa dev/ep/if_ep_mca.c optional ep mca dev/ep/if_ep_pccard.c optional ep pccard dev/esp/esp_pci.c optional esp pci dev/esp/ncr53c9x.c optional esp dev/etherswitch/arswitch/arswitch.c optional arswitch dev/etherswitch/arswitch/arswitch_reg.c optional arswitch dev/etherswitch/arswitch/arswitch_phy.c optional arswitch dev/etherswitch/arswitch/arswitch_8216.c optional arswitch dev/etherswitch/arswitch/arswitch_8226.c optional arswitch dev/etherswitch/arswitch/arswitch_8316.c optional arswitch dev/etherswitch/arswitch/arswitch_7240.c optional arswitch dev/etherswitch/etherswitch.c optional etherswitch dev/etherswitch/etherswitch_if.m optional etherswitch dev/etherswitch/mdio_if.m optional miiproxy dev/etherswitch/mdio.c optional miiproxy dev/etherswitch/miiproxy.c optional miiproxy dev/etherswitch/rtl8366/rtl8366rb.c optional rtl8366rb dev/ex/if_ex.c optional ex dev/ex/if_ex_isa.c optional ex isa dev/ex/if_ex_pccard.c optional ex pccard dev/exca/exca.c optional cbb dev/fatm/if_fatm.c optional fatm pci dev/fb/splash.c optional splash dev/fdt/fdt_common.c optional fdt dev/fdt/fdt_pci.c optional fdt pci dev/fdt/fdt_slicer.c optional fdt cfi | fdt nand dev/fdt/fdt_static_dtb.S optional fdt fdt_dtb_static \ dependency "$S/boot/fdt/dts/${FDT_DTS_FILE}" dev/fdt/fdtbus.c optional fdt dev/fdt/simplebus.c optional fdt dev/fe/if_fe.c optional fe dev/fe/if_fe_pccard.c optional fe pccard dev/firewire/firewire.c optional firewire dev/firewire/fwcrom.c optional firewire dev/firewire/fwdev.c optional firewire dev/firewire/fwdma.c optional firewire dev/firewire/fwmem.c optional firewire dev/firewire/fwohci.c optional firewire dev/firewire/fwohci_pci.c optional firewire pci dev/firewire/if_fwe.c optional fwe dev/firewire/if_fwip.c optional fwip dev/firewire/sbp.c optional sbp dev/firewire/sbp_targ.c optional sbp_targ dev/flash/at45d.c optional at45d dev/flash/mx25l.c optional mx25l dev/fxp/if_fxp.c optional fxp dev/fxp/inphy.c optional fxp dev/gem/if_gem.c optional gem dev/gem/if_gem_pci.c optional gem pci dev/gem/if_gem_sbus.c optional gem sbus dev/gpio/gpiobus.c optional gpio \ dependency "gpiobus_if.h" dev/gpio/gpioc.c optional gpio \ dependency "gpio_if.h" dev/gpio/gpioiic.c optional gpioiic dev/gpio/gpioled.c optional gpioled dev/gpio/gpio_if.m optional gpio dev/gpio/gpiobus_if.m optional gpio dev/hatm/if_hatm.c optional hatm pci dev/hatm/if_hatm_intr.c optional hatm pci dev/hatm/if_hatm_ioctl.c optional hatm pci dev/hatm/if_hatm_rx.c optional hatm pci dev/hatm/if_hatm_tx.c optional hatm pci dev/hifn/hifn7751.c optional hifn dev/hme/if_hme.c optional hme dev/hme/if_hme_pci.c optional hme pci dev/hme/if_hme_sbus.c optional hme sbus dev/hptiop/hptiop.c optional hptiop scbus dev/hwpmc/hwpmc_logging.c optional hwpmc dev/hwpmc/hwpmc_mod.c optional hwpmc dev/hwpmc/hwpmc_soft.c optional hwpmc dev/ichsmb/ichsmb.c optional ichsmb dev/ichsmb/ichsmb_pci.c optional ichsmb pci dev/ida/ida.c optional ida dev/ida/ida_disk.c optional ida dev/ida/ida_eisa.c optional ida eisa dev/ida/ida_pci.c optional ida pci dev/ie/if_ie.c optional ie isa nowerror dev/ie/if_ie_isa.c optional ie isa dev/ieee488/ibfoo.c optional pcii | tnt4882 dev/ieee488/pcii.c optional pcii dev/ieee488/tnt4882.c optional tnt4882 dev/ieee488/upd7210.c optional pcii | tnt4882 dev/iicbus/ad7418.c optional ad7418 dev/iicbus/ds133x.c optional ds133x dev/iicbus/ds1374.c optional ds1374 dev/iicbus/ds1672.c optional ds1672 dev/iicbus/icee.c optional icee dev/iicbus/if_ic.c optional ic dev/iicbus/iic.c optional iic dev/iicbus/iicbb.c optional iicbb dev/iicbus/iicbb_if.m optional iicbb dev/iicbus/iicbus.c optional iicbus dev/iicbus/iicbus_if.m optional iicbus dev/iicbus/iiconf.c optional iicbus dev/iicbus/iicsmb.c optional iicsmb \ dependency "iicbus_if.h" dev/iicbus/iicoc.c optional iicoc dev/iicbus/pcf8563.c optional pcf8563 dev/iicbus/s35390a.c optional s35390a dev/iir/iir.c optional iir dev/iir/iir_ctrl.c optional iir dev/iir/iir_pci.c optional iir pci # XXX Work around clang warning, until maintainer approves fix. dev/ips/ips.c optional ips \ compile-with "${NORMAL_C} ${NO_WSOMETIMES_UNINITIALIZED}" dev/ips/ips_commands.c optional ips dev/ips/ips_disk.c optional ips dev/ips/ips_ioctl.c optional ips dev/ips/ips_pci.c optional ips pci dev/ipw/if_ipw.c optional ipw ipwbssfw.c optional ipwbssfw | ipwfw \ compile-with "${AWK} -f $S/tools/fw_stub.awk ipw_bss.fw:ipw_bss:130 -lintel_ipw -mipw_bss -c${.TARGET}" \ no-implicit-rule before-depend local \ clean "ipwbssfw.c" ipw_bss.fwo optional ipwbssfw | ipwfw \ dependency "ipw_bss.fw" \ compile-with "${NORMAL_FWO}" \ no-implicit-rule \ clean "ipw_bss.fwo" ipw_bss.fw optional ipwbssfw | ipwfw \ dependency "$S/contrib/dev/ipw/ipw2100-1.3.fw.uu" \ compile-with "${NORMAL_FW}" \ no-obj no-implicit-rule \ clean "ipw_bss.fw" ipwibssfw.c optional ipwibssfw | ipwfw \ compile-with "${AWK} -f $S/tools/fw_stub.awk ipw_ibss.fw:ipw_ibss:130 -lintel_ipw -mipw_ibss -c${.TARGET}" \ no-implicit-rule before-depend local \ clean "ipwibssfw.c" ipw_ibss.fwo optional ipwibssfw | ipwfw \ dependency "ipw_ibss.fw" \ compile-with "${NORMAL_FWO}" \ no-implicit-rule \ clean "ipw_ibss.fwo" ipw_ibss.fw optional ipwibssfw | ipwfw \ dependency "$S/contrib/dev/ipw/ipw2100-1.3-i.fw.uu" \ compile-with "${NORMAL_FW}" \ no-obj no-implicit-rule \ clean "ipw_ibss.fw" ipwmonitorfw.c optional ipwmonitorfw | ipwfw \ compile-with "${AWK} -f $S/tools/fw_stub.awk ipw_monitor.fw:ipw_monitor:130 -lintel_ipw -mipw_monitor -c${.TARGET}" \ no-implicit-rule before-depend local \ clean "ipwmonitorfw.c" ipw_monitor.fwo optional ipwmonitorfw | ipwfw \ dependency "ipw_monitor.fw" \ compile-with "${NORMAL_FWO}" \ no-implicit-rule \ clean "ipw_monitor.fwo" ipw_monitor.fw optional ipwmonitorfw | ipwfw \ dependency "$S/contrib/dev/ipw/ipw2100-1.3-p.fw.uu" \ compile-with "${NORMAL_FW}" \ no-obj no-implicit-rule \ clean "ipw_monitor.fw" dev/iscsi/initiator/iscsi.c optional iscsi_initiator scbus dev/iscsi/initiator/iscsi_subr.c optional iscsi_initiator scbus dev/iscsi/initiator/isc_cam.c optional iscsi_initiator scbus dev/iscsi/initiator/isc_soc.c optional iscsi_initiator scbus dev/iscsi/initiator/isc_sm.c optional iscsi_initiator scbus dev/iscsi/initiator/isc_subr.c optional iscsi_initiator scbus dev/isf/isf.c optional isf dev/isf/isf_fdt.c optional isf fdt dev/isf/isf_nexus.c optional isf dev/isp/isp.c optional isp dev/isp/isp_freebsd.c optional isp dev/isp/isp_library.c optional isp dev/isp/isp_pci.c optional isp pci dev/isp/isp_sbus.c optional isp sbus dev/isp/isp_target.c optional isp dev/ispfw/ispfw.c optional ispfw dev/iwi/if_iwi.c optional iwi iwibssfw.c optional iwibssfw | iwifw \ compile-with "${AWK} -f $S/tools/fw_stub.awk iwi_bss.fw:iwi_bss:300 -lintel_iwi -miwi_bss -c${.TARGET}" \ no-implicit-rule before-depend local \ clean "iwibssfw.c" iwi_bss.fwo optional iwibssfw | iwifw \ dependency "iwi_bss.fw" \ compile-with "${NORMAL_FWO}" \ no-implicit-rule \ clean "iwi_bss.fwo" iwi_bss.fw optional iwibssfw | iwifw \ dependency "$S/contrib/dev/iwi/ipw2200-bss.fw.uu" \ compile-with "${NORMAL_FW}" \ no-obj no-implicit-rule \ clean "iwi_bss.fw" iwiibssfw.c optional iwiibssfw | iwifw \ compile-with "${AWK} -f $S/tools/fw_stub.awk iwi_ibss.fw:iwi_ibss:300 -lintel_iwi -miwi_ibss -c${.TARGET}" \ no-implicit-rule before-depend local \ clean "iwiibssfw.c" iwi_ibss.fwo optional iwiibssfw | iwifw \ dependency "iwi_ibss.fw" \ compile-with "${NORMAL_FWO}" \ no-implicit-rule \ clean "iwi_ibss.fwo" iwi_ibss.fw optional iwiibssfw | iwifw \ dependency "$S/contrib/dev/iwi/ipw2200-ibss.fw.uu" \ compile-with "${NORMAL_FW}" \ no-obj no-implicit-rule \ clean "iwi_ibss.fw" iwimonitorfw.c optional iwimonitorfw | iwifw \ compile-with "${AWK} -f $S/tools/fw_stub.awk iwi_monitor.fw:iwi_monitor:300 -lintel_iwi -miwi_monitor -c${.TARGET}" \ no-implicit-rule before-depend local \ clean "iwimonitorfw.c" iwi_monitor.fwo optional iwimonitorfw | iwifw \ dependency "iwi_monitor.fw" \ compile-with "${NORMAL_FWO}" \ no-implicit-rule \ clean "iwi_monitor.fwo" iwi_monitor.fw optional iwimonitorfw | iwifw \ dependency "$S/contrib/dev/iwi/ipw2200-sniffer.fw.uu" \ compile-with "${NORMAL_FW}" \ no-obj no-implicit-rule \ clean "iwi_monitor.fw" dev/iwn/if_iwn.c optional iwn iwn1000fw.c optional iwn1000fw | iwnfw \ compile-with "${AWK} -f $S/tools/fw_stub.awk iwn1000.fw:iwn1000fw -miwn1000fw -c${.TARGET}" \ no-implicit-rule before-depend local \ clean "iwn1000fw.c" iwn1000fw.fwo optional iwn1000fw | iwnfw \ dependency "iwn1000.fw" \ compile-with "${NORMAL_FWO}" \ no-implicit-rule \ clean "iwn1000fw.fwo" iwn1000.fw optional iwn1000fw | iwnfw \ dependency "$S/contrib/dev/iwn/iwlwifi-1000-39.31.5.1.fw.uu" \ compile-with "${NORMAL_FW}" \ no-obj no-implicit-rule \ clean "iwn1000.fw" iwn4965fw.c optional iwn4965fw | iwnfw \ compile-with "${AWK} -f $S/tools/fw_stub.awk iwn4965.fw:iwn4965fw -miwn4965fw -c${.TARGET}" \ no-implicit-rule before-depend local \ clean "iwn4965fw.c" iwn4965fw.fwo optional iwn4965fw | iwnfw \ dependency "iwn4965.fw" \ compile-with "${NORMAL_FWO}" \ no-implicit-rule \ clean "iwn4965fw.fwo" iwn4965.fw optional iwn4965fw | iwnfw \ dependency "$S/contrib/dev/iwn/iwlwifi-4965-228.61.2.24.fw.uu" \ compile-with "${NORMAL_FW}" \ no-obj no-implicit-rule \ clean "iwn4965.fw" iwn5000fw.c optional iwn5000fw | iwnfw \ compile-with "${AWK} -f $S/tools/fw_stub.awk iwn5000.fw:iwn5000fw -miwn5000fw -c${.TARGET}" \ no-implicit-rule before-depend local \ clean "iwn5000fw.c" iwn5000fw.fwo optional iwn5000fw | iwnfw \ dependency "iwn5000.fw" \ compile-with "${NORMAL_FWO}" \ no-implicit-rule \ clean "iwn5000fw.fwo" iwn5000.fw optional iwn5000fw | iwnfw \ dependency "$S/contrib/dev/iwn/iwlwifi-5000-8.83.5.1.fw.uu" \ compile-with "${NORMAL_FW}" \ no-obj no-implicit-rule \ clean "iwn5000.fw" iwn5150fw.c optional iwn5150fw | iwnfw \ compile-with "${AWK} -f $S/tools/fw_stub.awk iwn5150.fw:iwn5150fw -miwn5150fw -c${.TARGET}" \ no-implicit-rule before-depend local \ clean "iwn5150fw.c" iwn5150fw.fwo optional iwn5150fw | iwnfw \ dependency "iwn5150.fw" \ compile-with "${NORMAL_FWO}" \ no-implicit-rule \ clean "iwn5150fw.fwo" iwn5150.fw optional iwn5150fw | iwnfw \ dependency "$S/contrib/dev/iwn/iwlwifi-5150-8.24.2.2.fw.uu"\ compile-with "${NORMAL_FW}" \ no-obj no-implicit-rule \ clean "iwn5150.fw" iwn6000fw.c optional iwn6000fw | iwnfw \ compile-with "${AWK} -f $S/tools/fw_stub.awk iwn6000.fw:iwn6000fw -miwn6000fw -c${.TARGET}" \ no-implicit-rule before-depend local \ clean "iwn6000fw.c" iwn6000fw.fwo optional iwn6000fw | iwnfw \ dependency "iwn6000.fw" \ compile-with "${NORMAL_FWO}" \ no-implicit-rule \ clean "iwn6000fw.fwo" iwn6000.fw optional iwn6000fw | iwnfw \ dependency "$S/contrib/dev/iwn/iwlwifi-6000-9.221.4.1.fw.uu" \ compile-with "${NORMAL_FW}" \ no-obj no-implicit-rule \ clean "iwn6000.fw" iwn6000g2afw.c optional iwn6000g2afw | iwnfw \ compile-with "${AWK} -f $S/tools/fw_stub.awk iwn6000g2a.fw:iwn6000g2afw -miwn6000g2afw -c${.TARGET}" \ no-implicit-rule before-depend local \ clean "iwn6000g2afw.c" iwn6000g2afw.fwo optional iwn6000g2afw | iwnfw \ dependency "iwn6000g2a.fw" \ compile-with "${NORMAL_FWO}" \ no-implicit-rule \ clean "iwn6000g2afw.fwo" iwn6000g2a.fw optional iwn6000g2afw | iwnfw \ dependency "$S/contrib/dev/iwn/iwlwifi-6000g2a-17.168.5.2.fw.uu" \ compile-with "${NORMAL_FW}" \ no-obj no-implicit-rule \ clean "iwn6000g2a.fw" iwn6000g2bfw.c optional iwn6000g2bfw | iwnfw \ compile-with "${AWK} -f $S/tools/fw_stub.awk iwn6000g2b.fw:iwn6000g2bfw -miwn6000g2bfw -c${.TARGET}" \ no-implicit-rule before-depend local \ clean "iwn6000g2bfw.c" iwn6000g2bfw.fwo optional iwn6000g2bfw | iwnfw \ dependency "iwn6000g2b.fw" \ compile-with "${NORMAL_FWO}" \ no-implicit-rule \ clean "iwn6000g2bfw.fwo" iwn6000g2b.fw optional iwn6000g2bfw | iwnfw \ dependency "$S/contrib/dev/iwn/iwlwifi-6000g2b-17.168.5.2.fw.uu" \ compile-with "${NORMAL_FW}" \ no-obj no-implicit-rule \ clean "iwn6000g2b.fw" iwn6050fw.c optional iwn6050fw | iwnfw \ compile-with "${AWK} -f $S/tools/fw_stub.awk iwn6050.fw:iwn6050fw -miwn6050fw -c${.TARGET}" \ no-implicit-rule before-depend local \ clean "iwn6050fw.c" iwn6050fw.fwo optional iwn6050fw | iwnfw \ dependency "iwn6050.fw" \ compile-with "${NORMAL_FWO}" \ no-implicit-rule \ clean "iwn6050fw.fwo" iwn6050.fw optional iwn6050fw | iwnfw \ dependency "$S/contrib/dev/iwn/iwlwifi-6050-41.28.5.1.fw.uu" \ compile-with "${NORMAL_FW}" \ no-obj no-implicit-rule \ clean "iwn6050.fw" dev/ixgb/if_ixgb.c optional ixgb dev/ixgb/ixgb_ee.c optional ixgb dev/ixgb/ixgb_hw.c optional ixgb dev/ixgbe/ixgbe.c optional ixgbe inet \ compile-with "${NORMAL_C} -I$S/dev/ixgbe -DSMP -DIXGBE_FDIR" dev/ixgbe/ixv.c optional ixgbe inet \ compile-with "${NORMAL_C} -I$S/dev/ixgbe" dev/ixgbe/ixgbe_phy.c optional ixgbe inet \ compile-with "${NORMAL_C} -I$S/dev/ixgbe" dev/ixgbe/ixgbe_api.c optional ixgbe inet \ compile-with "${NORMAL_C} -I$S/dev/ixgbe" dev/ixgbe/ixgbe_common.c optional ixgbe inet \ compile-with "${NORMAL_C} -I$S/dev/ixgbe" dev/ixgbe/ixgbe_mbx.c optional ixgbe inet \ compile-with "${NORMAL_C} -I$S/dev/ixgbe" dev/ixgbe/ixgbe_vf.c optional ixgbe inet \ compile-with "${NORMAL_C} -I$S/dev/ixgbe" dev/ixgbe/ixgbe_82598.c optional ixgbe inet \ compile-with "${NORMAL_C} -I$S/dev/ixgbe" dev/ixgbe/ixgbe_82599.c optional ixgbe inet \ compile-with "${NORMAL_C} -I$S/dev/ixgbe" dev/ixgbe/ixgbe_x540.c optional ixgbe inet \ compile-with "${NORMAL_C} -I$S/dev/ixgbe" dev/jme/if_jme.c optional jme pci dev/joy/joy.c optional joy dev/joy/joy_isa.c optional joy isa dev/joy/joy_pccard.c optional joy pccard dev/kbdmux/kbdmux.c optional kbdmux dev/ksyms/ksyms.c optional ksyms dev/le/am7990.c optional le dev/le/am79900.c optional le dev/le/if_le_pci.c optional le pci dev/le/lance.c optional le dev/led/led.c standard dev/lge/if_lge.c optional lge dev/lmc/if_lmc.c optional lmc dev/malo/if_malo.c optional malo dev/malo/if_malohal.c optional malo dev/malo/if_malo_pci.c optional malo pci dev/mc146818/mc146818.c optional mc146818 dev/mca/mca_bus.c optional mca dev/mcd/mcd.c optional mcd isa nowerror dev/mcd/mcd_isa.c optional mcd isa nowerror dev/md/md.c optional md dev/mem/memdev.c optional mem dev/mem/memutil.c optional mem dev/mfi/mfi.c optional mfi dev/mfi/mfi_debug.c optional mfi dev/mfi/mfi_pci.c optional mfi pci dev/mfi/mfi_disk.c optional mfi dev/mfi/mfi_syspd.c optional mfi dev/mfi/mfi_tbolt.c optional mfi dev/mfi/mfi_linux.c optional mfi compat_linux dev/mfi/mfi_cam.c optional mfip scbus dev/mii/acphy.c optional miibus | acphy dev/mii/amphy.c optional miibus | amphy dev/mii/atphy.c optional miibus | atphy dev/mii/axphy.c optional miibus | axphy dev/mii/bmtphy.c optional miibus | bmtphy dev/mii/brgphy.c optional miibus | brgphy dev/mii/ciphy.c optional miibus | ciphy dev/mii/e1000phy.c optional miibus | e1000phy dev/mii/gentbi.c optional miibus | gentbi dev/mii/icsphy.c optional miibus | icsphy dev/mii/ip1000phy.c optional miibus | ip1000phy dev/mii/jmphy.c optional miibus | jmphy dev/mii/lxtphy.c optional miibus | lxtphy dev/mii/mii.c optional miibus | mii dev/mii/mii_bitbang.c optional miibus | mii_bitbang dev/mii/mii_physubr.c optional miibus | mii dev/mii/miibus_if.m optional miibus | mii dev/mii/mlphy.c optional miibus | mlphy dev/mii/nsgphy.c optional miibus | nsgphy dev/mii/nsphy.c optional miibus | nsphy dev/mii/nsphyter.c optional miibus | nsphyter dev/mii/pnaphy.c optional miibus | pnaphy dev/mii/qsphy.c optional miibus | qsphy dev/mii/rdcphy.c optional miibus | rdcphy dev/mii/rgephy.c optional miibus | rgephy dev/mii/rlphy.c optional miibus | rlphy dev/mii/rlswitch.c optional rlswitch dev/mii/smcphy.c optional miibus | smcphy dev/mii/smscphy.c optional miibus | smscphy dev/mii/tdkphy.c optional miibus | tdkphy dev/mii/tlphy.c optional miibus | tlphy dev/mii/truephy.c optional miibus | truephy dev/mii/ukphy.c optional miibus | mii dev/mii/ukphy_subr.c optional miibus | mii dev/mii/xmphy.c optional miibus | xmphy dev/mk48txx/mk48txx.c optional mk48txx dev/mlx/mlx.c optional mlx dev/mlx/mlx_disk.c optional mlx dev/mlx/mlx_pci.c optional mlx pci dev/mly/mly.c optional mly dev/mmc/mmc.c optional mmc dev/mmc/mmcbr_if.m standard dev/mmc/mmcbus_if.m standard dev/mmc/mmcsd.c optional mmcsd dev/mn/if_mn.c optional mn pci dev/mps/mps.c optional mps dev/mps/mps_config.c optional mps # XXX Work around clang warning, until maintainer approves fix. dev/mps/mps_mapping.c optional mps \ compile-with "${NORMAL_C} ${NO_WSOMETIMES_UNINITIALIZED}" dev/mps/mps_pci.c optional mps pci dev/mps/mps_sas.c optional mps \ compile-with "${NORMAL_C} ${NO_WUNNEEDED_INTERNAL_DECL}" dev/mps/mps_sas_lsi.c optional mps dev/mps/mps_table.c optional mps dev/mps/mps_user.c optional mps dev/mpt/mpt.c optional mpt dev/mpt/mpt_cam.c optional mpt dev/mpt/mpt_debug.c optional mpt dev/mpt/mpt_pci.c optional mpt pci dev/mpt/mpt_raid.c optional mpt dev/mpt/mpt_user.c optional mpt dev/msk/if_msk.c optional msk dev/mvs/mvs.c optional mvs dev/mvs/mvs_if.m optional mvs dev/mvs/mvs_pci.c optional mvs pci dev/mwl/if_mwl.c optional mwl dev/mwl/if_mwl_pci.c optional mwl pci dev/mwl/mwlhal.c optional mwl mwlfw.c optional mwlfw \ compile-with "${AWK} -f $S/tools/fw_stub.awk mw88W8363.fw:mw88W8363fw mwlboot.fw:mwlboot -mmwl -c${.TARGET}" \ no-implicit-rule before-depend local \ clean "mwlfw.c" mw88W8363.fwo optional mwlfw \ dependency "mw88W8363.fw" \ compile-with "${NORMAL_FWO}" \ no-implicit-rule \ clean "mw88W8363.fwo" mw88W8363.fw optional mwlfw \ dependency "$S/contrib/dev/mwl/mw88W8363.fw.uu" \ compile-with "${NORMAL_FW}" \ no-obj no-implicit-rule \ clean "mw88W8363.fw" mwlboot.fwo optional mwlfw \ dependency "mwlboot.fw" \ compile-with "${NORMAL_FWO}" \ no-implicit-rule \ clean "mwlboot.fwo" mwlboot.fw optional mwlfw \ dependency "$S/contrib/dev/mwl/mwlboot.fw.uu" \ compile-with "${NORMAL_FW}" \ no-obj no-implicit-rule \ clean "mwlboot.fw" dev/mxge/if_mxge.c optional mxge pci dev/mxge/mxge_eth_z8e.c optional mxge pci dev/mxge/mxge_ethp_z8e.c optional mxge pci dev/mxge/mxge_rss_eth_z8e.c optional mxge pci dev/mxge/mxge_rss_ethp_z8e.c optional mxge pci dev/my/if_my.c optional my dev/nand/nand.c optional nand dev/nand/nand_bbt.c optional nand dev/nand/nand_cdev.c optional nand dev/nand/nand_generic.c optional nand dev/nand/nand_geom.c optional nand dev/nand/nand_id.c optional nand dev/nand/nandbus.c optional nand dev/nand/nandbus_if.m optional nand dev/nand/nand_if.m optional nand dev/nand/nandsim.c optional nandsim nand dev/nand/nandsim_chip.c optional nandsim nand dev/nand/nandsim_ctrl.c optional nandsim nand dev/nand/nandsim_log.c optional nandsim nand dev/nand/nandsim_swap.c optional nandsim nand dev/nand/nfc_if.m optional nand dev/ncv/ncr53c500.c optional ncv dev/ncv/ncr53c500_pccard.c optional ncv pccard dev/netmap/netmap.c optional netmap dev/nge/if_nge.c optional nge dev/nxge/if_nxge.c optional nxge \ compile-with "${NORMAL_C} ${NO_WSELF_ASSIGN}" dev/nxge/xgehal/xgehal-device.c optional nxge \ compile-with "${NORMAL_C} ${NO_WSELF_ASSIGN}" dev/nxge/xgehal/xgehal-mm.c optional nxge dev/nxge/xgehal/xge-queue.c optional nxge dev/nxge/xgehal/xgehal-driver.c optional nxge \ compile-with "${NORMAL_C} ${NO_WSELF_ASSIGN}" dev/nxge/xgehal/xgehal-ring.c optional nxge \ compile-with "${NORMAL_C} ${NO_WSELF_ASSIGN}" dev/nxge/xgehal/xgehal-channel.c optional nxge \ compile-with "${NORMAL_C} ${NO_WSELF_ASSIGN}" dev/nxge/xgehal/xgehal-fifo.c optional nxge \ compile-with "${NORMAL_C} ${NO_WSELF_ASSIGN}" dev/nxge/xgehal/xgehal-stats.c optional nxge \ compile-with "${NORMAL_C} ${NO_WSELF_ASSIGN}" dev/nxge/xgehal/xgehal-config.c optional nxge dev/nxge/xgehal/xgehal-mgmt.c optional nxge \ compile-with "${NORMAL_C} ${NO_WSELF_ASSIGN}" dev/nmdm/nmdm.c optional nmdm dev/nsp/nsp.c optional nsp dev/nsp/nsp_pccard.c optional nsp pccard dev/null/null.c standard dev/oce/oce_hw.c optional oce pci dev/oce/oce_if.c optional oce pci dev/oce/oce_mbox.c optional oce pci dev/oce/oce_queue.c optional oce pci dev/oce/oce_sysctl.c optional oce pci dev/oce/oce_util.c optional oce pci dev/ofw/ofw_bus_if.m optional fdt dev/ofw/ofw_bus_subr.c optional fdt dev/ofw/ofw_fdt.c optional fdt dev/ofw/ofw_if.m optional fdt dev/ofw/openfirm.c optional fdt dev/ofw/openfirmio.c optional fdt dev/patm/if_patm.c optional patm pci dev/patm/if_patm_attach.c optional patm pci dev/patm/if_patm_intr.c optional patm pci dev/patm/if_patm_ioctl.c optional patm pci dev/patm/if_patm_rtables.c optional patm pci dev/patm/if_patm_rx.c optional patm pci dev/patm/if_patm_tx.c optional patm pci dev/pbio/pbio.c optional pbio isa dev/pccard/card_if.m standard dev/pccard/pccard.c optional pccard dev/pccard/pccard_cis.c optional pccard dev/pccard/pccard_cis_quirks.c optional pccard dev/pccard/pccard_device.c optional pccard dev/pccard/power_if.m standard dev/pccbb/pccbb.c optional cbb dev/pccbb/pccbb_isa.c optional cbb isa dev/pccbb/pccbb_pci.c optional cbb pci dev/pcf/pcf.c optional pcf dev/pci/eisa_pci.c optional pci eisa dev/pci/fixup_pci.c optional pci dev/pci/hostb_pci.c optional pci dev/pci/ignore_pci.c optional pci dev/pci/isa_pci.c optional pci isa dev/pci/pci.c optional pci dev/pci/pci_if.m standard dev/pci/pci_pci.c optional pci dev/pci/pci_subr.c optional pci dev/pci/pci_user.c optional pci dev/pci/pcib_if.m standard dev/pci/vga_pci.c optional pci dev/pcn/if_pcn.c optional pcn pci dev/pdq/if_fea.c optional fea eisa dev/pdq/if_fpa.c optional fpa pci dev/pdq/pdq.c optional nowerror fea eisa | fpa pci dev/pdq/pdq_ifsubr.c optional nowerror fea eisa | fpa pci dev/ppbus/if_plip.c optional plip dev/ppbus/immio.c optional vpo dev/ppbus/lpbb.c optional lpbb dev/ppbus/lpt.c optional lpt dev/ppbus/pcfclock.c optional pcfclock dev/ppbus/ppb_1284.c optional ppbus dev/ppbus/ppb_base.c optional ppbus dev/ppbus/ppb_msq.c optional ppbus dev/ppbus/ppbconf.c optional ppbus dev/ppbus/ppbus_if.m optional ppbus dev/ppbus/ppi.c optional ppi dev/ppbus/pps.c optional pps dev/ppbus/vpo.c optional vpo dev/ppbus/vpoio.c optional vpo dev/ppc/ppc.c optional ppc dev/ppc/ppc_acpi.c optional ppc acpi dev/ppc/ppc_isa.c optional ppc isa dev/ppc/ppc_pci.c optional ppc pci dev/ppc/ppc_puc.c optional ppc puc dev/pst/pst-iop.c optional pst dev/pst/pst-pci.c optional pst pci dev/pst/pst-raid.c optional pst dev/pty/pty.c optional pty dev/puc/puc.c optional puc dev/puc/puc_cfg.c optional puc dev/puc/puc_pccard.c optional puc pccard dev/puc/puc_pci.c optional puc pci dev/puc/pucdata.c optional puc pci dev/quicc/quicc_core.c optional quicc dev/ral/rt2560.c optional ral dev/ral/rt2661.c optional ral dev/ral/rt2860.c optional ral dev/ral/if_ral_pci.c optional ral pci rt2561fw.c optional rt2561fw | ralfw \ compile-with "${AWK} -f $S/tools/fw_stub.awk rt2561.fw:rt2561fw -mrt2561 -c${.TARGET}" \ no-implicit-rule before-depend local \ clean "rt2561fw.c" rt2561fw.fwo optional rt2561fw | ralfw \ dependency "rt2561.fw" \ compile-with "${NORMAL_FWO}" \ no-implicit-rule \ clean "rt2561fw.fwo" rt2561.fw optional rt2561fw | ralfw \ dependency "$S/contrib/dev/ral/rt2561.fw.uu" \ compile-with "${NORMAL_FW}" \ no-obj no-implicit-rule \ clean "rt2561.fw" rt2561sfw.c optional rt2561sfw | ralfw \ compile-with "${AWK} -f $S/tools/fw_stub.awk rt2561s.fw:rt2561sfw -mrt2561s -c${.TARGET}" \ no-implicit-rule before-depend local \ clean "rt2561sfw.c" rt2561sfw.fwo optional rt2561sfw | ralfw \ dependency "rt2561s.fw" \ compile-with "${NORMAL_FWO}" \ no-implicit-rule \ clean "rt2561sfw.fwo" rt2561s.fw optional rt2561sfw | ralfw \ dependency "$S/contrib/dev/ral/rt2561s.fw.uu" \ compile-with "${NORMAL_FW}" \ no-obj no-implicit-rule \ clean "rt2561s.fw" rt2661fw.c optional rt2661fw | ralfw \ compile-with "${AWK} -f $S/tools/fw_stub.awk rt2661.fw:rt2661fw -mrt2661 -c${.TARGET}" \ no-implicit-rule before-depend local \ clean "rt2661fw.c" rt2661fw.fwo optional rt2661fw | ralfw \ dependency "rt2661.fw" \ compile-with "${NORMAL_FWO}" \ no-implicit-rule \ clean "rt2661fw.fwo" rt2661.fw optional rt2661fw | ralfw \ dependency "$S/contrib/dev/ral/rt2661.fw.uu" \ compile-with "${NORMAL_FW}" \ no-obj no-implicit-rule \ clean "rt2661.fw" rt2860fw.c optional rt2860fw | ralfw \ compile-with "${AWK} -f $S/tools/fw_stub.awk rt2860.fw:rt2860fw -mrt2860 -c${.TARGET}" \ no-implicit-rule before-depend local \ clean "rt2860fw.c" rt2860fw.fwo optional rt2860fw | ralfw \ dependency "rt2860.fw" \ compile-with "${NORMAL_FWO}" \ no-implicit-rule \ clean "rt2860fw.fwo" rt2860.fw optional rt2860fw | ralfw \ dependency "$S/contrib/dev/ral/rt2860.fw.uu" \ compile-with "${NORMAL_FW}" \ no-obj no-implicit-rule \ clean "rt2860.fw" dev/random/harvest.c standard dev/random/hash.c optional random dev/random/probe.c optional random dev/random/randomdev.c optional random dev/random/randomdev_soft.c optional random dev/random/yarrow.c optional random dev/rc/rc.c optional rc dev/re/if_re.c optional re dev/rndtest/rndtest.c optional rndtest dev/rp/rp.c optional rp dev/rp/rp_isa.c optional rp isa dev/rp/rp_pci.c optional rp pci dev/safe/safe.c optional safe dev/scc/scc_if.m optional scc dev/scc/scc_bfe_ebus.c optional scc ebus dev/scc/scc_bfe_quicc.c optional scc quicc dev/scc/scc_bfe_sbus.c optional scc fhc | scc sbus dev/scc/scc_core.c optional scc dev/scc/scc_dev_quicc.c optional scc quicc dev/scc/scc_dev_sab82532.c optional scc dev/scc/scc_dev_z8530.c optional scc dev/scd/scd.c optional scd isa dev/scd/scd_isa.c optional scd isa dev/sdhci/sdhci.c optional sdhci dev/sdhci/sdhci_if.m optional sdhci dev/sdhci/sdhci_pci.c optional sdhci pci dev/sf/if_sf.c optional sf pci dev/sge/if_sge.c optional sge pci dev/si/si.c optional si dev/si/si2_z280.c optional si dev/si/si3_t225.c optional si dev/si/si_eisa.c optional si eisa dev/si/si_isa.c optional si isa dev/si/si_pci.c optional si pci dev/siba/siba.c optional siba dev/siba/siba_bwn.c optional siba_bwn pci dev/siba/siba_cc.c optional siba dev/siba/siba_core.c optional siba | siba_bwn pci dev/siba/siba_pcib.c optional siba pci dev/siis/siis.c optional siis pci dev/sis/if_sis.c optional sis pci dev/sk/if_sk.c optional sk pci dev/smbus/smb.c optional smb dev/smbus/smbconf.c optional smbus dev/smbus/smbus.c optional smbus dev/smbus/smbus_if.m optional smbus dev/smc/if_smc.c optional smc dev/sn/if_sn.c optional sn dev/sn/if_sn_isa.c optional sn isa dev/sn/if_sn_pccard.c optional sn pccard dev/snp/snp.c optional snp dev/sound/clone.c optional sound dev/sound/unit.c optional sound dev/sound/isa/ad1816.c optional snd_ad1816 isa dev/sound/isa/ess.c optional snd_ess isa dev/sound/isa/gusc.c optional snd_gusc isa dev/sound/isa/mss.c optional snd_mss isa dev/sound/isa/sb16.c optional snd_sb16 isa dev/sound/isa/sb8.c optional snd_sb8 isa dev/sound/isa/sbc.c optional snd_sbc isa dev/sound/isa/sndbuf_dma.c optional sound isa dev/sound/pci/als4000.c optional snd_als4000 pci dev/sound/pci/atiixp.c optional snd_atiixp pci dev/sound/pci/cmi.c optional snd_cmi pci dev/sound/pci/cs4281.c optional snd_cs4281 pci dev/sound/pci/csa.c optional snd_csa pci dev/sound/pci/csapcm.c optional snd_csa pci dev/sound/pci/ds1.c optional snd_ds1 pci dev/sound/pci/emu10k1.c optional snd_emu10k1 pci dev/sound/pci/emu10kx.c optional snd_emu10kx pci dev/sound/pci/emu10kx-pcm.c optional snd_emu10kx pci dev/sound/pci/emu10kx-midi.c optional snd_emu10kx pci dev/sound/pci/envy24.c optional snd_envy24 pci dev/sound/pci/envy24ht.c optional snd_envy24ht pci dev/sound/pci/es137x.c optional snd_es137x pci dev/sound/pci/fm801.c optional snd_fm801 pci dev/sound/pci/ich.c optional snd_ich pci dev/sound/pci/maestro.c optional snd_maestro pci dev/sound/pci/maestro3.c optional snd_maestro3 pci dev/sound/pci/neomagic.c optional snd_neomagic pci dev/sound/pci/solo.c optional snd_solo pci dev/sound/pci/spicds.c optional snd_spicds pci dev/sound/pci/t4dwave.c optional snd_t4dwave pci dev/sound/pci/via8233.c optional snd_via8233 pci dev/sound/pci/via82c686.c optional snd_via82c686 pci dev/sound/pci/vibes.c optional snd_vibes pci dev/sound/pci/hda/hdaa.c optional snd_hda pci dev/sound/pci/hda/hdaa_patches.c optional snd_hda pci dev/sound/pci/hda/hdac.c optional snd_hda pci dev/sound/pci/hda/hdac_if.m optional snd_hda pci dev/sound/pci/hda/hdacc.c optional snd_hda pci dev/sound/pci/hdspe.c optional snd_hdspe pci dev/sound/pci/hdspe-pcm.c optional snd_hdspe pci dev/sound/pcm/ac97.c optional sound dev/sound/pcm/ac97_if.m optional sound dev/sound/pcm/ac97_patch.c optional sound dev/sound/pcm/buffer.c optional sound \ dependency "snd_fxdiv_gen.h" dev/sound/pcm/channel.c optional sound dev/sound/pcm/channel_if.m optional sound dev/sound/pcm/dsp.c optional sound dev/sound/pcm/feeder.c optional sound dev/sound/pcm/feeder_chain.c optional sound dev/sound/pcm/feeder_eq.c optional sound \ dependency "feeder_eq_gen.h" \ dependency "snd_fxdiv_gen.h" dev/sound/pcm/feeder_if.m optional sound dev/sound/pcm/feeder_format.c optional sound \ dependency "snd_fxdiv_gen.h" dev/sound/pcm/feeder_matrix.c optional sound \ dependency "snd_fxdiv_gen.h" dev/sound/pcm/feeder_mixer.c optional sound \ dependency "snd_fxdiv_gen.h" dev/sound/pcm/feeder_rate.c optional sound \ dependency "feeder_rate_gen.h" \ dependency "snd_fxdiv_gen.h" dev/sound/pcm/feeder_volume.c optional sound \ dependency "snd_fxdiv_gen.h" dev/sound/pcm/mixer.c optional sound dev/sound/pcm/mixer_if.m optional sound dev/sound/pcm/sndstat.c optional sound dev/sound/pcm/sound.c optional sound dev/sound/pcm/vchan.c optional sound dev/sound/usb/uaudio.c optional snd_uaudio usb dev/sound/usb/uaudio_pcm.c optional snd_uaudio usb dev/sound/midi/midi.c optional sound dev/sound/midi/mpu401.c optional sound dev/sound/midi/mpu_if.m optional sound dev/sound/midi/mpufoi_if.m optional sound dev/sound/midi/sequencer.c optional sound dev/sound/midi/synth_if.m optional sound dev/spibus/spibus.c optional spibus \ dependency "spibus_if.h" dev/spibus/spibus_if.m optional spibus dev/ste/if_ste.c optional ste pci dev/stg/tmc18c30.c optional stg dev/stg/tmc18c30_isa.c optional stg isa dev/stg/tmc18c30_pccard.c optional stg pccard dev/stg/tmc18c30_pci.c optional stg pci dev/stg/tmc18c30_subr.c optional stg dev/stge/if_stge.c optional stge dev/streams/streams.c optional streams dev/sym/sym_hipd.c optional sym \ dependency "$S/dev/sym/sym_{conf,defs}.h" dev/syscons/blank/blank_saver.c optional blank_saver dev/syscons/daemon/daemon_saver.c optional daemon_saver dev/syscons/dragon/dragon_saver.c optional dragon_saver dev/syscons/fade/fade_saver.c optional fade_saver dev/syscons/fire/fire_saver.c optional fire_saver dev/syscons/green/green_saver.c optional green_saver dev/syscons/logo/logo.c optional logo_saver dev/syscons/logo/logo_saver.c optional logo_saver dev/syscons/rain/rain_saver.c optional rain_saver dev/syscons/schistory.c optional sc dev/syscons/scmouse.c optional sc dev/syscons/scterm.c optional sc dev/syscons/scvidctl.c optional sc dev/syscons/snake/snake_saver.c optional snake_saver dev/syscons/star/star_saver.c optional star_saver dev/syscons/syscons.c optional sc dev/syscons/sysmouse.c optional sc dev/syscons/warp/warp_saver.c optional warp_saver dev/tdfx/tdfx_linux.c optional tdfx_linux tdfx compat_linux dev/tdfx/tdfx_pci.c optional tdfx pci dev/ti/if_ti.c optional ti pci dev/tl/if_tl.c optional tl pci dev/trm/trm.c optional trm dev/twa/tw_cl_init.c optional twa \ compile-with "${NORMAL_C} -I$S/dev/twa" dev/twa/tw_cl_intr.c optional twa \ compile-with "${NORMAL_C} -I$S/dev/twa" dev/twa/tw_cl_io.c optional twa \ compile-with "${NORMAL_C} -I$S/dev/twa" dev/twa/tw_cl_misc.c optional twa \ compile-with "${NORMAL_C} -I$S/dev/twa" dev/twa/tw_osl_cam.c optional twa \ compile-with "${NORMAL_C} -I$S/dev/twa" dev/twa/tw_osl_freebsd.c optional twa \ compile-with "${NORMAL_C} -I$S/dev/twa" dev/twe/twe.c optional twe dev/twe/twe_freebsd.c optional twe dev/tws/tws.c optional tws dev/tws/tws_cam.c optional tws dev/tws/tws_hdm.c optional tws dev/tws/tws_services.c optional tws dev/tws/tws_user.c optional tws dev/tx/if_tx.c optional tx dev/txp/if_txp.c optional txp dev/uart/uart_bus_acpi.c optional uart acpi #dev/uart/uart_bus_cbus.c optional uart cbus dev/uart/uart_bus_ebus.c optional uart ebus dev/uart/uart_bus_fdt.c optional uart fdt dev/uart/uart_bus_isa.c optional uart isa dev/uart/uart_bus_pccard.c optional uart pccard dev/uart/uart_bus_pci.c optional uart pci dev/uart/uart_bus_puc.c optional uart puc dev/uart/uart_bus_scc.c optional uart scc dev/uart/uart_core.c optional uart dev/uart/uart_dbg.c optional uart gdb dev/uart/uart_dev_ns8250.c optional uart uart_ns8250 dev/uart/uart_dev_pl011.c optional uart pl011 dev/uart/uart_dev_quicc.c optional uart quicc dev/uart/uart_dev_sab82532.c optional uart uart_sab82532 dev/uart/uart_dev_sab82532.c optional uart scc dev/uart/uart_dev_z8530.c optional uart uart_z8530 dev/uart/uart_dev_z8530.c optional uart scc dev/uart/uart_if.m optional uart dev/uart/uart_subr.c optional uart dev/uart/uart_tty.c optional uart dev/ubsec/ubsec.c optional ubsec # # USB controller drivers # dev/usb/controller/at91dci.c optional at91dci dev/usb/controller/at91dci_atmelarm.c optional at91dci at91rm9200 dev/usb/controller/musb_otg.c optional musb dev/usb/controller/musb_otg_atmelarm.c optional musb at91rm9200 dev/usb/controller/dwc_otg.c optional dwcotg dev/usb/controller/ehci.c optional ehci dev/usb/controller/ehci_pci.c optional ehci pci dev/usb/controller/ohci.c optional ohci dev/usb/controller/ohci_atmelarm.c optional ohci at91rm9200 dev/usb/controller/ohci_pci.c optional ohci pci dev/usb/controller/uhci.c optional uhci dev/usb/controller/uhci_pci.c optional uhci pci dev/usb/controller/xhci.c optional xhci dev/usb/controller/xhci_pci.c optional xhci pci dev/usb/controller/uss820dci.c optional uss820dci dev/usb/controller/uss820dci_atmelarm.c optional uss820dci at91rm9200 dev/usb/controller/usb_controller.c optional usb # # USB storage drivers # dev/usb/storage/umass.c optional umass dev/usb/storage/urio.c optional urio dev/usb/storage/ustorage_fs.c optional usfs # # USB core # dev/usb/usb_busdma.c optional usb dev/usb/usb_compat_linux.c optional usb dev/usb/usb_core.c optional usb dev/usb/usb_debug.c optional usb dev/usb/usb_dev.c optional usb dev/usb/usb_device.c optional usb dev/usb/usb_dynamic.c optional usb dev/usb/usb_error.c optional usb dev/usb/usb_generic.c optional usb dev/usb/usb_handle_request.c optional usb dev/usb/usb_hid.c optional usb dev/usb/usb_hub.c optional usb dev/usb/usb_if.m optional usb dev/usb/usb_lookup.c optional usb dev/usb/usb_mbuf.c optional usb dev/usb/usb_msctest.c optional usb dev/usb/usb_parse.c optional usb dev/usb/usb_pf.c optional usb dev/usb/usb_process.c optional usb dev/usb/usb_request.c optional usb dev/usb/usb_transfer.c optional usb dev/usb/usb_util.c optional usb # # USB network drivers # dev/usb/net/if_aue.c optional aue dev/usb/net/if_axe.c optional axe dev/usb/net/if_cdce.c optional cdce dev/usb/net/if_cue.c optional cue dev/usb/net/if_ipheth.c optional ipheth dev/usb/net/if_kue.c optional kue dev/usb/net/if_mos.c optional mos dev/usb/net/if_rue.c optional rue dev/usb/net/if_smsc.c optional smsc dev/usb/net/if_udav.c optional udav dev/usb/net/if_usie.c optional usie dev/usb/net/ruephy.c optional rue dev/usb/net/usb_ethernet.c optional aue | axe | cdce | cue | kue | mos | \ rue | smsc | udav | ipheth dev/usb/net/uhso.c optional uhso # # USB WLAN drivers # dev/usb/wlan/if_rum.c optional rum dev/usb/wlan/if_run.c optional run runfw.c optional runfw \ compile-with "${AWK} -f $S/tools/fw_stub.awk runfw:runfw -mrunfw -c${.TARGET}" \ no-implicit-rule before-depend local \ clean "runfw.c" runfw.fwo optional runfw \ dependency "runfw" \ compile-with "${NORMAL_FWO}" \ no-implicit-rule \ clean "runfw.fwo" runfw optional runfw \ dependency "$S/contrib/dev/run/rt2870.fw.uu" \ compile-with "${NORMAL_FW}" \ no-obj no-implicit-rule \ clean "runfw" dev/usb/wlan/if_uath.c optional uath dev/usb/wlan/if_upgt.c optional upgt dev/usb/wlan/if_ural.c optional ural dev/usb/wlan/if_urtw.c optional urtw dev/usb/wlan/if_zyd.c optional zyd # # USB serial and parallel port drivers # dev/usb/serial/u3g.c optional u3g dev/usb/serial/uark.c optional uark dev/usb/serial/ubsa.c optional ubsa dev/usb/serial/ubser.c optional ubser dev/usb/serial/uchcom.c optional uchcom dev/usb/serial/ucycom.c optional ucycom dev/usb/serial/ufoma.c optional ufoma dev/usb/serial/uftdi.c optional uftdi dev/usb/serial/ugensa.c optional ugensa dev/usb/serial/uipaq.c optional uipaq dev/usb/serial/ulpt.c optional ulpt dev/usb/serial/umcs.c optional umcs dev/usb/serial/umct.c optional umct dev/usb/serial/umodem.c optional umodem dev/usb/serial/umoscom.c optional umoscom dev/usb/serial/uplcom.c optional uplcom dev/usb/serial/uslcom.c optional uslcom dev/usb/serial/uvisor.c optional uvisor dev/usb/serial/uvscom.c optional uvscom dev/usb/serial/usb_serial.c optional ucom | u3g | uark | ubsa | ubser | \ uchcom | ucycom | ufoma | uftdi | \ ugensa | uipaq | umcs | umct | \ umodem | umoscom | uplcom | usie | \ uslcom | uvisor | uvscom # # USB misc drivers # dev/usb/misc/ufm.c optional ufm dev/usb/misc/udbp.c optional udbp # # USB input drivers # dev/usb/input/atp.c optional atp dev/usb/input/uep.c optional uep dev/usb/input/uhid.c optional uhid dev/usb/input/ukbd.c optional ukbd dev/usb/input/ums.c optional ums # # USB quirks # dev/usb/quirk/usb_quirk.c optional usb # # USB templates # dev/usb/template/usb_template.c optional usb_template dev/usb/template/usb_template_audio.c optional usb_template dev/usb/template/usb_template_cdce.c optional usb_template dev/usb/template/usb_template_kbd.c optional usb_template dev/usb/template/usb_template_modem.c optional usb_template dev/usb/template/usb_template_mouse.c optional usb_template dev/usb/template/usb_template_msc.c optional usb_template dev/usb/template/usb_template_mtp.c optional usb_template # # USB END # dev/utopia/idtphy.c optional utopia dev/utopia/suni.c optional utopia dev/utopia/utopia.c optional utopia dev/vge/if_vge.c optional vge dev/vkbd/vkbd.c optional vkbd dev/vr/if_vr.c optional vr pci dev/vte/if_vte.c optional vte pci dev/vx/if_vx.c optional vx dev/vx/if_vx_eisa.c optional vx eisa dev/vx/if_vx_pci.c optional vx pci dev/vxge/vxge.c optional vxge dev/vxge/vxgehal/vxgehal-ifmsg.c optional vxge dev/vxge/vxgehal/vxgehal-mrpcim.c optional vxge dev/vxge/vxgehal/vxge-queue.c optional vxge dev/vxge/vxgehal/vxgehal-ring.c optional vxge dev/vxge/vxgehal/vxgehal-swapper.c optional vxge dev/vxge/vxgehal/vxgehal-mgmt.c optional vxge dev/vxge/vxgehal/vxgehal-srpcim.c optional vxge dev/vxge/vxgehal/vxgehal-config.c optional vxge dev/vxge/vxgehal/vxgehal-blockpool.c optional vxge dev/vxge/vxgehal/vxgehal-doorbells.c optional vxge dev/vxge/vxgehal/vxgehal-mgmtaux.c optional vxge dev/vxge/vxgehal/vxgehal-device.c optional vxge dev/vxge/vxgehal/vxgehal-mm.c optional vxge dev/vxge/vxgehal/vxgehal-driver.c optional vxge dev/vxge/vxgehal/vxgehal-virtualpath.c optional vxge dev/vxge/vxgehal/vxgehal-channel.c optional vxge dev/vxge/vxgehal/vxgehal-fifo.c optional vxge dev/watchdog/watchdog.c standard dev/wb/if_wb.c optional wb pci dev/wds/wd7000.c optional wds isa dev/wi/if_wi.c optional wi dev/wi/if_wi_pccard.c optional wi pccard dev/wi/if_wi_pci.c optional wi pci dev/wl/if_wl.c optional wl isa dev/wpi/if_wpi.c optional wpi pci wpifw.c optional wpifw \ compile-with "${AWK} -f $S/tools/fw_stub.awk wpi.fw:wpifw:153229 -mwpi -c${.TARGET}" \ no-implicit-rule before-depend local \ clean "wpifw.c" wpifw.fwo optional wpifw \ dependency "wpi.fw" \ compile-with "${NORMAL_FWO}" \ no-implicit-rule \ clean "wpifw.fwo" wpi.fw optional wpifw \ dependency "$S/contrib/dev/wpi/iwlwifi-3945-15.32.2.9.fw.uu" \ compile-with "${NORMAL_FW}" \ no-obj no-implicit-rule \ clean "wpi.fw" dev/xe/if_xe.c optional xe dev/xe/if_xe_pccard.c optional xe pccard dev/xen/balloon/balloon.c optional xen | xenhvm dev/xen/blkfront/blkfront.c optional xen | xenhvm dev/xen/blkback/blkback.c optional xen | xenhvm dev/xen/console/console.c optional xen dev/xen/console/xencons_ring.c optional xen dev/xen/control/control.c optional xen | xenhvm dev/xen/netback/netback.c optional xen | xenhvm dev/xen/netfront/netfront.c optional xen | xenhvm dev/xen/xenpci/xenpci.c optional xenpci dev/xen/xenpci/evtchn.c optional xenpci dev/xl/if_xl.c optional xl pci dev/xl/xlphy.c optional xl pci fs/deadfs/dead_vnops.c standard fs/devfs/devfs_devs.c standard fs/devfs/devfs_dir.c standard fs/devfs/devfs_rule.c standard fs/devfs/devfs_vfsops.c standard fs/devfs/devfs_vnops.c standard fs/fdescfs/fdesc_vfsops.c optional fdescfs fs/fdescfs/fdesc_vnops.c optional fdescfs fs/fifofs/fifo_vnops.c standard fs/fuse/fuse_device.c optional fuse fs/fuse/fuse_file.c optional fuse fs/fuse/fuse_internal.c optional fuse fs/fuse/fuse_io.c optional fuse fs/fuse/fuse_ipc.c optional fuse fs/fuse/fuse_main.c optional fuse fs/fuse/fuse_node.c optional fuse fs/fuse/fuse_vfsops.c optional fuse fs/fuse/fuse_vnops.c optional fuse fs/msdosfs/msdosfs_conv.c optional msdosfs fs/msdosfs/msdosfs_denode.c optional msdosfs fs/msdosfs/msdosfs_fat.c optional msdosfs fs/msdosfs/msdosfs_fileno.c optional msdosfs fs/msdosfs/msdosfs_iconv.c optional msdosfs_iconv fs/msdosfs/msdosfs_lookup.c optional msdosfs fs/msdosfs/msdosfs_vfsops.c optional msdosfs fs/msdosfs/msdosfs_vnops.c optional msdosfs fs/nandfs/bmap.c optional nandfs fs/nandfs/nandfs_alloc.c optional nandfs fs/nandfs/nandfs_bmap.c optional nandfs fs/nandfs/nandfs_buffer.c optional nandfs fs/nandfs/nandfs_cleaner.c optional nandfs fs/nandfs/nandfs_cpfile.c optional nandfs fs/nandfs/nandfs_dat.c optional nandfs fs/nandfs/nandfs_dir.c optional nandfs fs/nandfs/nandfs_ifile.c optional nandfs fs/nandfs/nandfs_segment.c optional nandfs fs/nandfs/nandfs_subr.c optional nandfs fs/nandfs/nandfs_sufile.c optional nandfs fs/nandfs/nandfs_vfsops.c optional nandfs fs/nandfs/nandfs_vnops.c optional nandfs fs/nfs/nfs_commonkrpc.c optional nfscl | nfsd fs/nfs/nfs_commonsubs.c optional nfscl | nfsd fs/nfs/nfs_commonport.c optional nfscl | nfsd fs/nfs/nfs_commonacl.c optional nfscl | nfsd fs/nfsclient/nfs_clcomsubs.c optional nfscl fs/nfsclient/nfs_clsubs.c optional nfscl fs/nfsclient/nfs_clstate.c optional nfscl fs/nfsclient/nfs_clkrpc.c optional nfscl fs/nfsclient/nfs_clrpcops.c optional nfscl fs/nfsclient/nfs_clvnops.c optional nfscl fs/nfsclient/nfs_clnode.c optional nfscl fs/nfsclient/nfs_clvfsops.c optional nfscl fs/nfsclient/nfs_clport.c optional nfscl fs/nfsclient/nfs_clbio.c optional nfscl fs/nfsclient/nfs_clnfsiod.c optional nfscl fs/nfsserver/nfs_nfsdsocket.c optional nfsd inet fs/nfsserver/nfs_nfsdsubs.c optional nfsd inet fs/nfsserver/nfs_nfsdstate.c optional nfsd inet fs/nfsserver/nfs_nfsdkrpc.c optional nfsd inet fs/nfsserver/nfs_nfsdserv.c optional nfsd inet fs/nfsserver/nfs_nfsdport.c optional nfsd inet fs/nfsserver/nfs_nfsdcache.c optional nfsd inet fs/nullfs/null_subr.c optional nullfs fs/nullfs/null_vfsops.c optional nullfs fs/nullfs/null_vnops.c optional nullfs fs/procfs/procfs.c optional procfs fs/procfs/procfs_ctl.c optional procfs fs/procfs/procfs_dbregs.c optional procfs fs/procfs/procfs_fpregs.c optional procfs fs/procfs/procfs_ioctl.c optional procfs fs/procfs/procfs_map.c optional procfs fs/procfs/procfs_mem.c optional procfs fs/procfs/procfs_note.c optional procfs fs/procfs/procfs_osrel.c optional procfs fs/procfs/procfs_regs.c optional procfs fs/procfs/procfs_rlimit.c optional procfs fs/procfs/procfs_status.c optional procfs fs/procfs/procfs_type.c optional procfs fs/pseudofs/pseudofs.c optional pseudofs fs/pseudofs/pseudofs_fileno.c optional pseudofs fs/pseudofs/pseudofs_vncache.c optional pseudofs fs/pseudofs/pseudofs_vnops.c optional pseudofs fs/udf/osta.c optional udf fs/udf/udf_iconv.c optional udf_iconv fs/udf/udf_vfsops.c optional udf fs/udf/udf_vnops.c optional udf fs/unionfs/union_subr.c optional unionfs fs/unionfs/union_vfsops.c optional unionfs fs/unionfs/union_vnops.c optional unionfs fs/tmpfs/tmpfs_vnops.c optional tmpfs fs/tmpfs/tmpfs_fifoops.c optional tmpfs fs/tmpfs/tmpfs_vfsops.c optional tmpfs fs/tmpfs/tmpfs_subr.c optional tmpfs gdb/gdb_cons.c optional gdb gdb/gdb_main.c optional gdb gdb/gdb_packet.c optional gdb geom/bde/g_bde.c optional geom_bde geom/bde/g_bde_crypt.c optional geom_bde geom/bde/g_bde_lock.c optional geom_bde geom/bde/g_bde_work.c optional geom_bde geom/cache/g_cache.c optional geom_cache geom/concat/g_concat.c optional geom_concat geom/eli/g_eli.c optional geom_eli geom/eli/g_eli_crypto.c optional geom_eli geom/eli/g_eli_ctl.c optional geom_eli geom/eli/g_eli_integrity.c optional geom_eli geom/eli/g_eli_key.c optional geom_eli geom/eli/g_eli_key_cache.c optional geom_eli geom/eli/g_eli_privacy.c optional geom_eli geom/eli/pkcs5v2.c optional geom_eli geom/gate/g_gate.c optional geom_gate geom/geom_aes.c optional geom_aes geom/geom_bsd.c optional geom_bsd geom/geom_bsd_enc.c optional geom_bsd geom/geom_ccd.c optional ccd | geom_ccd geom/geom_ctl.c standard geom/geom_dev.c standard geom/geom_disk.c standard geom/geom_dump.c standard geom/geom_event.c standard geom/geom_fox.c optional geom_fox geom/geom_flashmap.c optional fdt cfi | fdt nand geom/geom_io.c standard geom/geom_kern.c standard geom/geom_map.c optional geom_map geom/geom_mbr.c optional geom_mbr geom/geom_mbr_enc.c optional geom_mbr geom/geom_pc98.c optional geom_pc98 geom/geom_pc98_enc.c optional geom_pc98 geom/geom_redboot.c optional geom_redboot geom/geom_slice.c standard geom/geom_subr.c standard geom/geom_sunlabel.c optional geom_sunlabel geom/geom_sunlabel_enc.c optional geom_sunlabel geom/geom_vfs.c standard geom/geom_vol_ffs.c optional geom_vol geom/journal/g_journal.c optional geom_journal geom/journal/g_journal_ufs.c optional geom_journal geom/label/g_label.c optional geom_label geom/label/g_label_ext2fs.c optional geom_label geom/label/g_label_iso9660.c optional geom_label geom/label/g_label_msdosfs.c optional geom_label geom/label/g_label_ntfs.c optional geom_label geom/label/g_label_reiserfs.c optional geom_label geom/label/g_label_ufs.c optional geom_label geom/label/g_label_gpt.c optional geom_label geom/linux_lvm/g_linux_lvm.c optional geom_linux_lvm geom/mirror/g_mirror.c optional geom_mirror geom/mirror/g_mirror_ctl.c optional geom_mirror geom/mountver/g_mountver.c optional geom_mountver geom/multipath/g_multipath.c optional geom_multipath geom/nop/g_nop.c optional geom_nop geom/part/g_part.c standard geom/part/g_part_if.m standard geom/part/g_part_apm.c optional geom_part_apm geom/part/g_part_bsd.c optional geom_part_bsd geom/part/g_part_ebr.c optional geom_part_ebr geom/part/g_part_gpt.c optional geom_part_gpt geom/part/g_part_ldm.c optional geom_part_ldm geom/part/g_part_mbr.c optional geom_part_mbr geom/part/g_part_pc98.c optional geom_part_pc98 geom/part/g_part_vtoc8.c optional geom_part_vtoc8 geom/raid/g_raid.c optional geom_raid geom/raid/g_raid_ctl.c optional geom_raid geom/raid/g_raid_md_if.m optional geom_raid geom/raid/g_raid_tr_if.m optional geom_raid geom/raid/md_ddf.c optional geom_raid geom/raid/md_intel.c optional geom_raid geom/raid/md_jmicron.c optional geom_raid geom/raid/md_nvidia.c optional geom_raid geom/raid/md_promise.c optional geom_raid geom/raid/md_sii.c optional geom_raid geom/raid/tr_concat.c optional geom_raid geom/raid/tr_raid0.c optional geom_raid geom/raid/tr_raid1.c optional geom_raid geom/raid/tr_raid1e.c optional geom_raid geom/raid/tr_raid5.c optional geom_raid geom/raid3/g_raid3.c optional geom_raid3 geom/raid3/g_raid3_ctl.c optional geom_raid3 geom/shsec/g_shsec.c optional geom_shsec geom/stripe/g_stripe.c optional geom_stripe geom/uncompress/g_uncompress.c optional geom_uncompress contrib/xz-embedded/freebsd/xz_malloc.c \ optional xz_embedded | geom_uncompress \ compile-with "${NORMAL_C} -I$S/contrib/xz-embedded/freebsd/ -I$S/contrib/xz-embedded/linux/lib/xz/ -I$S/contrib/xz-embedded/linux/include/linux/" contrib/xz-embedded/linux/lib/xz/xz_crc32.c \ optional xz_embedded | geom_uncompress \ compile-with "${NORMAL_C} -I$S/contrib/xz-embedded/freebsd/ -I$S/contrib/xz-embedded/linux/lib/xz/ -I$S/contrib/xz-embedded/linux/include/linux/" contrib/xz-embedded/linux/lib/xz/xz_dec_bcj.c \ optional xz_embedded | geom_uncompress \ compile-with "${NORMAL_C} -I$S/contrib/xz-embedded/freebsd/ -I$S/contrib/xz-embedded/linux/lib/xz/ -I$S/contrib/xz-embedded/linux/include/linux/" contrib/xz-embedded/linux/lib/xz/xz_dec_lzma2.c \ optional xz_embedded | geom_uncompress \ compile-with "${NORMAL_C} -I$S/contrib/xz-embedded/freebsd/ -I$S/contrib/xz-embedded/linux/lib/xz/ -I$S/contrib/xz-embedded/linux/include/linux/" contrib/xz-embedded/linux/lib/xz/xz_dec_stream.c \ optional xz_embedded | geom_uncompress \ compile-with "${NORMAL_C} -I$S/contrib/xz-embedded/freebsd/ -I$S/contrib/xz-embedded/linux/lib/xz/ -I$S/contrib/xz-embedded/linux/include/linux/" geom/uzip/g_uzip.c optional geom_uzip geom/virstor/binstream.c optional geom_virstor geom/virstor/g_virstor.c optional geom_virstor geom/virstor/g_virstor_md.c optional geom_virstor geom/zero/g_zero.c optional geom_zero fs/ext2fs/ext2_alloc.c optional ext2fs fs/ext2fs/ext2_balloc.c optional ext2fs fs/ext2fs/ext2_bmap.c optional ext2fs fs/ext2fs/ext2_inode.c optional ext2fs fs/ext2fs/ext2_inode_cnv.c optional ext2fs fs/ext2fs/ext2_lookup.c optional ext2fs fs/ext2fs/ext2_subr.c optional ext2fs fs/ext2fs/ext2_vfsops.c optional ext2fs fs/ext2fs/ext2_vnops.c optional ext2fs gnu/fs/reiserfs/reiserfs_hashes.c optional reiserfs \ warning "kernel contains GPL contaminated ReiserFS filesystem" gnu/fs/reiserfs/reiserfs_inode.c optional reiserfs gnu/fs/reiserfs/reiserfs_item_ops.c optional reiserfs gnu/fs/reiserfs/reiserfs_namei.c optional reiserfs gnu/fs/reiserfs/reiserfs_prints.c optional reiserfs gnu/fs/reiserfs/reiserfs_stree.c optional reiserfs gnu/fs/reiserfs/reiserfs_vfsops.c optional reiserfs gnu/fs/reiserfs/reiserfs_vnops.c optional reiserfs # isa/isa_if.m standard isa/isa_common.c optional isa isa/isahint.c optional isa isa/pnp.c optional isa isapnp isa/pnpparse.c optional isa isapnp fs/cd9660/cd9660_bmap.c optional cd9660 fs/cd9660/cd9660_lookup.c optional cd9660 fs/cd9660/cd9660_node.c optional cd9660 fs/cd9660/cd9660_rrip.c optional cd9660 fs/cd9660/cd9660_util.c optional cd9660 fs/cd9660/cd9660_vfsops.c optional cd9660 fs/cd9660/cd9660_vnops.c optional cd9660 fs/cd9660/cd9660_iconv.c optional cd9660_iconv kern/bus_if.m standard kern/clock_if.m standard kern/cpufreq_if.m standard kern/device_if.m standard kern/imgact_elf.c standard kern/imgact_elf32.c optional compat_freebsd32 kern/imgact_shell.c standard kern/inflate.c optional gzip kern/init_main.c standard kern/init_sysent.c standard kern/ksched.c optional _kposix_priority_scheduling kern/kern_acct.c standard kern/kern_alq.c optional alq kern/kern_clock.c standard kern/kern_condvar.c standard kern/kern_conf.c standard kern/kern_cons.c standard kern/kern_cpu.c standard kern/kern_cpuset.c standard kern/kern_context.c standard kern/kern_descrip.c standard kern/kern_dtrace.c optional kdtrace_hooks kern/kern_environment.c standard kern/kern_et.c standard kern/kern_event.c standard kern/kern_exec.c standard kern/kern_exit.c standard kern/kern_fail.c standard kern/kern_ffclock.c standard kern/kern_fork.c standard kern/kern_gzio.c optional gzio kern/kern_hhook.c standard kern/kern_idle.c standard kern/kern_intr.c standard kern/kern_jail.c standard kern/kern_khelp.c standard kern/kern_kthread.c standard kern/kern_ktr.c optional ktr kern/kern_ktrace.c standard kern/kern_linker.c standard kern/kern_lock.c standard kern/kern_lockf.c standard kern/kern_lockstat.c optional kdtrace_hooks kern/kern_loginclass.c standard kern/kern_malloc.c standard kern/kern_mbuf.c standard kern/kern_mib.c standard kern/kern_module.c standard kern/kern_mtxpool.c standard kern/kern_mutex.c standard kern/kern_ntptime.c standard kern/kern_osd.c standard kern/kern_physio.c standard kern/kern_pmc.c standard kern/kern_poll.c optional device_polling kern/kern_priv.c standard kern/kern_proc.c standard kern/kern_prot.c standard kern/kern_racct.c standard kern/kern_rangelock.c standard kern/kern_rctl.c standard kern/kern_resource.c standard kern/kern_rmlock.c standard kern/kern_rwlock.c standard kern/kern_sdt.c optional kdtrace_hooks kern/kern_sema.c standard kern/kern_sharedpage.c standard kern/kern_shutdown.c standard kern/kern_sig.c standard kern/kern_switch.c standard kern/kern_sx.c standard kern/kern_synch.c standard kern/kern_syscalls.c standard kern/kern_sysctl.c standard kern/kern_tc.c standard kern/kern_thr.c standard kern/kern_thread.c standard kern/kern_time.c standard kern/kern_timeout.c standard kern/kern_umtx.c standard kern/kern_uuid.c standard kern/kern_xxx.c standard kern/link_elf.c standard kern/linker_if.m standard kern/md5c.c standard kern/p1003_1b.c standard kern/posix4_mib.c standard kern/sched_4bsd.c optional sched_4bsd kern/sched_ule.c optional sched_ule kern/serdev_if.m standard kern/stack_protector.c standard \ compile-with "${NORMAL_C:N-fstack-protector*}" kern/subr_acl_nfs4.c optional ufs_acl | zfs kern/subr_acl_posix1e.c optional ufs_acl kern/subr_autoconf.c standard kern/subr_blist.c standard kern/subr_bus.c standard kern/subr_bus_dma.c standard kern/subr_bufring.c standard kern/subr_clock.c standard kern/subr_devstat.c standard kern/subr_disk.c standard kern/subr_eventhandler.c standard kern/subr_fattime.c standard kern/subr_firmware.c optional firmware kern/subr_hash.c standard kern/subr_hints.c standard kern/subr_kdb.c standard kern/subr_kobj.c standard kern/subr_lock.c standard kern/subr_log.c standard kern/subr_mbpool.c optional libmbpool kern/subr_mchain.c optional libmchain kern/subr_module.c standard kern/subr_msgbuf.c standard kern/subr_param.c standard kern/subr_pcpu.c standard kern/subr_power.c standard kern/subr_prf.c standard kern/subr_prof.c standard kern/subr_rman.c standard kern/subr_rtc.c standard kern/subr_sbuf.c standard kern/subr_scanf.c standard kern/subr_sglist.c standard kern/subr_sleepqueue.c standard kern/subr_smp.c standard kern/subr_stack.c optional ddb | stack | ktr kern/subr_taskqueue.c standard kern/subr_trap.c standard kern/subr_turnstile.c standard kern/subr_uio.c standard kern/subr_unit.c standard kern/subr_witness.c optional witness kern/sys_capability.c standard kern/sys_generic.c standard kern/sys_pipe.c standard kern/sys_procdesc.c standard kern/sys_process.c standard kern/sys_socket.c standard kern/syscalls.c standard kern/sysv_ipc.c standard kern/sysv_msg.c optional sysvmsg kern/sysv_sem.c optional sysvsem kern/sysv_shm.c optional sysvshm kern/tty.c standard kern/tty_compat.c optional compat_43tty kern/tty_info.c standard kern/tty_inq.c standard kern/tty_outq.c standard kern/tty_pts.c standard kern/tty_tty.c standard kern/tty_ttydisc.c standard kern/uipc_accf.c optional inet kern/uipc_cow.c optional socket_send_cow kern/uipc_debug.c optional ddb kern/uipc_domain.c standard kern/uipc_mbuf.c standard kern/uipc_mbuf2.c standard kern/uipc_mqueue.c optional p1003_1b_mqueue kern/uipc_sem.c optional p1003_1b_semaphores kern/uipc_shm.c standard kern/uipc_sockbuf.c standard kern/uipc_socket.c standard kern/uipc_syscalls.c standard kern/uipc_usrreq.c standard kern/vfs_acl.c standard kern/vfs_aio.c optional vfs_aio kern/vfs_bio.c standard kern/vfs_cache.c standard kern/vfs_cluster.c standard kern/vfs_default.c standard kern/vfs_export.c standard kern/vfs_extattr.c standard kern/vfs_hash.c standard kern/vfs_init.c standard kern/vfs_lookup.c standard kern/vfs_mount.c standard kern/vfs_mountroot.c standard kern/vfs_subr.c standard kern/vfs_syscalls.c standard kern/vfs_vnops.c standard # # Kernel GSS-API # gssd.h optional kgssapi \ dependency "$S/kgssapi/gssd.x" \ compile-with "RPCGEN_CPP='${CPP}' rpcgen -hM $S/kgssapi/gssd.x | grep -v pthread.h > gssd.h" \ no-obj no-implicit-rule before-depend local \ clean "gssd.h" gssd_xdr.c optional kgssapi \ dependency "$S/kgssapi/gssd.x gssd.h" \ compile-with "RPCGEN_CPP='${CPP}' rpcgen -c $S/kgssapi/gssd.x -o gssd_xdr.c" \ no-implicit-rule before-depend local \ clean "gssd_xdr.c" gssd_clnt.c optional kgssapi \ dependency "$S/kgssapi/gssd.x gssd.h" \ compile-with "RPCGEN_CPP='${CPP}' rpcgen -lM $S/kgssapi/gssd.x | grep -v string.h > gssd_clnt.c" \ no-implicit-rule before-depend local \ clean "gssd_clnt.c" kgssapi/gss_accept_sec_context.c optional kgssapi kgssapi/gss_add_oid_set_member.c optional kgssapi kgssapi/gss_acquire_cred.c optional kgssapi kgssapi/gss_canonicalize_name.c optional kgssapi kgssapi/gss_create_empty_oid_set.c optional kgssapi kgssapi/gss_delete_sec_context.c optional kgssapi kgssapi/gss_display_status.c optional kgssapi kgssapi/gss_export_name.c optional kgssapi kgssapi/gss_get_mic.c optional kgssapi kgssapi/gss_init_sec_context.c optional kgssapi kgssapi/gss_impl.c optional kgssapi kgssapi/gss_import_name.c optional kgssapi kgssapi/gss_names.c optional kgssapi kgssapi/gss_pname_to_uid.c optional kgssapi kgssapi/gss_release_buffer.c optional kgssapi kgssapi/gss_release_cred.c optional kgssapi kgssapi/gss_release_name.c optional kgssapi kgssapi/gss_release_oid_set.c optional kgssapi kgssapi/gss_set_cred_option.c optional kgssapi kgssapi/gss_test_oid_set_member.c optional kgssapi kgssapi/gss_unwrap.c optional kgssapi kgssapi/gss_verify_mic.c optional kgssapi kgssapi/gss_wrap.c optional kgssapi kgssapi/gss_wrap_size_limit.c optional kgssapi kgssapi/gssd_prot.c optional kgssapi kgssapi/krb5/krb5_mech.c optional kgssapi kgssapi/krb5/kcrypto.c optional kgssapi kgssapi/krb5/kcrypto_aes.c optional kgssapi kgssapi/krb5/kcrypto_arcfour.c optional kgssapi kgssapi/krb5/kcrypto_des.c optional kgssapi kgssapi/krb5/kcrypto_des3.c optional kgssapi kgssapi/kgss_if.m optional kgssapi kgssapi/gsstest.c optional kgssapi_debug # These files in libkern/ are those needed by all architectures. Some # of the files in libkern/ are only needed on some architectures, e.g., # libkern/divdi3.c is needed by i386 but not alpha. Also, some of these # routines may be optimized for a particular platform. In either case, # the file should be moved to conf/files. from here. # libkern/arc4random.c standard libkern/bcd.c standard libkern/bsearch.c standard libkern/crc32.c standard libkern/fnmatch.c standard libkern/iconv.c optional libiconv libkern/iconv_converter_if.m optional libiconv libkern/iconv_ucs.c optional libiconv libkern/iconv_xlat.c optional libiconv libkern/iconv_xlat16.c optional libiconv libkern/inet_aton.c standard libkern/inet_ntoa.c standard libkern/inet_ntop.c standard libkern/inet_pton.c standard libkern/jenkins_hash.c standard libkern/mcount.c optional profiling-routine libkern/memcchr.c standard libkern/memcmp.c standard libkern/qsort.c standard libkern/qsort_r.c standard libkern/random.c standard libkern/scanc.c standard libkern/strcasecmp.c standard libkern/strcat.c standard libkern/strchr.c standard libkern/strcmp.c standard libkern/strcpy.c standard libkern/strcspn.c standard libkern/strdup.c standard libkern/strlcat.c standard libkern/strlcpy.c standard libkern/strlen.c standard libkern/strncmp.c standard libkern/strncpy.c standard libkern/strnlen.c standard libkern/strrchr.c standard libkern/strsep.c standard libkern/strspn.c standard libkern/strstr.c standard libkern/strtol.c standard libkern/strtoq.c standard libkern/strtoul.c standard libkern/strtouq.c standard libkern/strvalid.c standard net/bpf.c standard net/bpf_buffer.c optional bpf net/bpf_jitter.c optional bpf_jitter net/bpf_filter.c optional bpf | netgraph_bpf net/bpf_zerocopy.c optional bpf net/bridgestp.c optional bridge | if_bridge net/flowtable.c optional flowtable inet | flowtable inet6 net/ieee8023ad_lacp.c optional lagg net/if.c standard net/if_arcsubr.c optional arcnet net/if_atmsubr.c optional atm net/if_bridge.c optional bridge inet | if_bridge inet net/if_clone.c standard net/if_dead.c standard net/if_debug.c optional ddb net/if_disc.c optional disc net/if_edsc.c optional edsc net/if_ef.c optional ef net/if_enc.c optional enc ipsec inet | enc ipsec inet6 net/if_epair.c optional epair net/if_ethersubr.c optional ether net/if_faith.c optional faith net/if_fddisubr.c optional fddi net/if_fwsubr.c optional fwip net/if_gif.c optional gif | netgraph_gif net/if_gre.c optional gre inet net/if_iso88025subr.c optional token net/if_lagg.c optional lagg net/if_loop.c optional loop net/if_llatbl.c standard net/if_media.c standard net/if_mib.c standard net/if_spppfr.c optional sppp | netgraph_sppp net/if_spppsubr.c optional sppp | netgraph_sppp net/if_stf.c optional stf inet inet6 net/if_tun.c optional tun net/if_tap.c optional tap net/if_vlan.c optional vlan net/mppcc.c optional netgraph_mppc_compression net/mppcd.c optional netgraph_mppc_compression net/netisr.c standard net/pfil.c optional ether | inet net/radix.c standard net/radix_mpath.c standard net/raw_cb.c standard net/raw_usrreq.c standard net/route.c standard net/rtsock.c standard net/slcompress.c optional netgraph_vjc | sppp | \ netgraph_sppp net/vnet.c optional vimage net/zlib.c optional crypto | geom_uzip | ipsec | \ mxge | netgraph_deflate | \ ddb_ctf | gzio | geom_uncompress net80211/ieee80211.c optional wlan net80211/ieee80211_acl.c optional wlan wlan_acl net80211/ieee80211_action.c optional wlan net80211/ieee80211_ageq.c optional wlan net80211/ieee80211_adhoc.c optional wlan net80211/ieee80211_ageq.c optional wlan net80211/ieee80211_amrr.c optional wlan | wlan_amrr net80211/ieee80211_crypto.c optional wlan net80211/ieee80211_crypto_ccmp.c optional wlan wlan_ccmp net80211/ieee80211_crypto_none.c optional wlan net80211/ieee80211_crypto_tkip.c optional wlan wlan_tkip net80211/ieee80211_crypto_wep.c optional wlan wlan_wep net80211/ieee80211_ddb.c optional wlan ddb net80211/ieee80211_dfs.c optional wlan net80211/ieee80211_freebsd.c optional wlan net80211/ieee80211_hostap.c optional wlan net80211/ieee80211_ht.c optional wlan net80211/ieee80211_hwmp.c optional wlan ieee80211_support_mesh net80211/ieee80211_input.c optional wlan net80211/ieee80211_ioctl.c optional wlan net80211/ieee80211_mesh.c optional wlan ieee80211_support_mesh net80211/ieee80211_monitor.c optional wlan net80211/ieee80211_node.c optional wlan net80211/ieee80211_output.c optional wlan net80211/ieee80211_phy.c optional wlan net80211/ieee80211_power.c optional wlan net80211/ieee80211_proto.c optional wlan net80211/ieee80211_radiotap.c optional wlan net80211/ieee80211_ratectl.c optional wlan net80211/ieee80211_ratectl_none.c optional wlan net80211/ieee80211_regdomain.c optional wlan net80211/ieee80211_rssadapt.c optional wlan wlan_rssadapt net80211/ieee80211_scan.c optional wlan net80211/ieee80211_scan_sta.c optional wlan net80211/ieee80211_sta.c optional wlan net80211/ieee80211_superg.c optional wlan ieee80211_support_superg net80211/ieee80211_tdma.c optional wlan ieee80211_support_tdma net80211/ieee80211_wds.c optional wlan net80211/ieee80211_xauth.c optional wlan wlan_xauth net80211/ieee80211_alq.c optional wlan ieee80211_alq netatalk/aarp.c optional netatalk netatalk/at_control.c optional netatalk netatalk/at_proto.c optional netatalk netatalk/at_rmx.c optional netatalk netatalk/ddp_input.c optional netatalk netatalk/ddp_output.c optional netatalk netatalk/ddp_pcb.c optional netatalk netatalk/ddp_usrreq.c optional netatalk netgraph/atm/ccatm/ng_ccatm.c optional ngatm_ccatm \ compile-with "${NORMAL_C} -I$S/contrib/ngatm" netgraph/atm/ng_atm.c optional ngatm_atm netgraph/atm/ngatmbase.c optional ngatm_atmbase \ compile-with "${NORMAL_C} -I$S/contrib/ngatm" netgraph/atm/sscfu/ng_sscfu.c optional ngatm_sscfu \ compile-with "${NORMAL_C} -I$S/contrib/ngatm" netgraph/atm/sscop/ng_sscop.c optional ngatm_sscop \ compile-with "${NORMAL_C} -I$S/contrib/ngatm" netgraph/atm/uni/ng_uni.c optional ngatm_uni \ compile-with "${NORMAL_C} -I$S/contrib/ngatm" netgraph/bluetooth/common/ng_bluetooth.c optional netgraph_bluetooth netgraph/bluetooth/drivers/bt3c/ng_bt3c_pccard.c optional netgraph_bluetooth_bt3c netgraph/bluetooth/drivers/h4/ng_h4.c optional netgraph_bluetooth_h4 netgraph/bluetooth/drivers/ubt/ng_ubt.c optional netgraph_bluetooth_ubt usb netgraph/bluetooth/drivers/ubtbcmfw/ubtbcmfw.c optional netgraph_bluetooth_ubtbcmfw usb netgraph/bluetooth/hci/ng_hci_cmds.c optional netgraph_bluetooth_hci netgraph/bluetooth/hci/ng_hci_evnt.c optional netgraph_bluetooth_hci netgraph/bluetooth/hci/ng_hci_main.c optional netgraph_bluetooth_hci netgraph/bluetooth/hci/ng_hci_misc.c optional netgraph_bluetooth_hci netgraph/bluetooth/hci/ng_hci_ulpi.c optional netgraph_bluetooth_hci netgraph/bluetooth/l2cap/ng_l2cap_cmds.c optional netgraph_bluetooth_l2cap netgraph/bluetooth/l2cap/ng_l2cap_evnt.c optional netgraph_bluetooth_l2cap netgraph/bluetooth/l2cap/ng_l2cap_llpi.c optional netgraph_bluetooth_l2cap netgraph/bluetooth/l2cap/ng_l2cap_main.c optional netgraph_bluetooth_l2cap netgraph/bluetooth/l2cap/ng_l2cap_misc.c optional netgraph_bluetooth_l2cap netgraph/bluetooth/l2cap/ng_l2cap_ulpi.c optional netgraph_bluetooth_l2cap netgraph/bluetooth/socket/ng_btsocket.c optional netgraph_bluetooth_socket netgraph/bluetooth/socket/ng_btsocket_hci_raw.c optional netgraph_bluetooth_socket netgraph/bluetooth/socket/ng_btsocket_l2cap.c optional netgraph_bluetooth_socket netgraph/bluetooth/socket/ng_btsocket_l2cap_raw.c optional netgraph_bluetooth_socket netgraph/bluetooth/socket/ng_btsocket_rfcomm.c optional netgraph_bluetooth_socket netgraph/bluetooth/socket/ng_btsocket_sco.c optional netgraph_bluetooth_socket netgraph/netflow/netflow.c optional netgraph_netflow netgraph/netflow/netflow_v9.c optional netgraph_netflow netgraph/netflow/ng_netflow.c optional netgraph_netflow netgraph/ng_UI.c optional netgraph_UI netgraph/ng_async.c optional netgraph_async netgraph/ng_atmllc.c optional netgraph_atmllc netgraph/ng_base.c optional netgraph netgraph/ng_bpf.c optional netgraph_bpf netgraph/ng_bridge.c optional netgraph_bridge netgraph/ng_car.c optional netgraph_car netgraph/ng_cisco.c optional netgraph_cisco netgraph/ng_deflate.c optional netgraph_deflate netgraph/ng_device.c optional netgraph_device netgraph/ng_echo.c optional netgraph_echo netgraph/ng_eiface.c optional netgraph_eiface netgraph/ng_ether.c optional netgraph_ether netgraph/ng_ether_echo.c optional netgraph_ether_echo netgraph/ng_fec.c optional netgraph_fec netgraph/ng_frame_relay.c optional netgraph_frame_relay netgraph/ng_gif.c optional netgraph_gif netgraph/ng_gif_demux.c optional netgraph_gif_demux netgraph/ng_hole.c optional netgraph_hole netgraph/ng_iface.c optional netgraph_iface netgraph/ng_ip_input.c optional netgraph_ip_input netgraph/ng_ipfw.c optional netgraph_ipfw inet ipfirewall netgraph/ng_ksocket.c optional netgraph_ksocket netgraph/ng_l2tp.c optional netgraph_l2tp netgraph/ng_lmi.c optional netgraph_lmi netgraph/ng_mppc.c optional netgraph_mppc_compression | \ netgraph_mppc_encryption netgraph/ng_nat.c optional netgraph_nat inet libalias netgraph/ng_one2many.c optional netgraph_one2many netgraph/ng_parse.c optional netgraph netgraph/ng_patch.c optional netgraph_patch netgraph/ng_pipe.c optional netgraph_pipe netgraph/ng_ppp.c optional netgraph_ppp netgraph/ng_pppoe.c optional netgraph_pppoe netgraph/ng_pptpgre.c optional netgraph_pptpgre netgraph/ng_pred1.c optional netgraph_pred1 netgraph/ng_rfc1490.c optional netgraph_rfc1490 netgraph/ng_socket.c optional netgraph_socket netgraph/ng_split.c optional netgraph_split netgraph/ng_sppp.c optional netgraph_sppp netgraph/ng_tag.c optional netgraph_tag netgraph/ng_tcpmss.c optional netgraph_tcpmss netgraph/ng_tee.c optional netgraph_tee netgraph/ng_tty.c optional netgraph_tty netgraph/ng_vjc.c optional netgraph_vjc netgraph/ng_vlan.c optional netgraph_vlan netinet/accf_data.c optional accept_filter_data inet netinet/accf_dns.c optional accept_filter_dns inet netinet/accf_http.c optional accept_filter_http inet netinet/if_atm.c optional atm netinet/if_ether.c optional inet ether netinet/igmp.c optional inet netinet/in.c optional inet netinet/in_debug.c optional inet ddb netinet/ip_carp.c optional inet carp | inet6 carp netinet/in_gif.c optional gif inet | netgraph_gif inet netinet/ip_gre.c optional gre inet netinet/ip_id.c optional inet netinet/in_mcast.c optional inet netinet/in_pcb.c optional inet | inet6 netinet/in_pcbgroup.c optional inet pcbgroup | inet6 pcbgroup netinet/in_proto.c optional inet | inet6 netinet/in_rmx.c optional inet netinet/ip_divert.c optional inet ipdivert ipfirewall netinet/ip_ecn.c optional inet | inet6 netinet/ip_encap.c optional inet | inet6 netinet/ip_fastfwd.c optional inet netinet/ip_icmp.c optional inet | inet6 netinet/ip_input.c optional inet netinet/ip_ipsec.c optional inet ipsec netinet/ip_mroute.c optional mrouting inet netinet/ip_options.c optional inet netinet/ip_output.c optional inet netinet/raw_ip.c optional inet | inet6 netinet/cc/cc.c optional inet | inet6 netinet/cc/cc_newreno.c optional inet | inet6 netinet/sctp_asconf.c optional inet sctp | inet6 sctp netinet/sctp_auth.c optional inet sctp | inet6 sctp netinet/sctp_bsd_addr.c optional inet sctp | inet6 sctp netinet/sctp_cc_functions.c optional inet sctp | inet6 sctp netinet/sctp_crc32.c optional inet sctp | inet6 sctp netinet/sctp_indata.c optional inet sctp | inet6 sctp netinet/sctp_input.c optional inet sctp | inet6 sctp netinet/sctp_output.c optional inet sctp | inet6 sctp netinet/sctp_pcb.c optional inet sctp | inet6 sctp netinet/sctp_peeloff.c optional inet sctp | inet6 sctp netinet/sctp_ss_functions.c optional inet sctp | inet6 sctp netinet/sctp_sysctl.c optional inet sctp | inet6 sctp netinet/sctp_timer.c optional inet sctp | inet6 sctp netinet/sctp_usrreq.c optional inet sctp | inet6 sctp netinet/sctputil.c optional inet sctp | inet6 sctp netinet/tcp_debug.c optional tcpdebug netinet/tcp_hostcache.c optional inet | inet6 netinet/tcp_input.c optional inet | inet6 netinet/tcp_lro.c optional inet | inet6 netinet/tcp_output.c optional inet | inet6 netinet/tcp_offload.c optional tcp_offload inet | tcp_offload inet6 netinet/tcp_reass.c optional inet | inet6 netinet/tcp_sack.c optional inet | inet6 netinet/tcp_subr.c optional inet | inet6 netinet/tcp_syncache.c optional inet | inet6 netinet/tcp_timer.c optional inet | inet6 netinet/tcp_timewait.c optional inet | inet6 netinet/tcp_usrreq.c optional inet | inet6 netinet/udp_usrreq.c optional inet | inet6 netinet/libalias/alias.c optional libalias inet | netgraph_nat inet netinet/libalias/alias_db.c optional libalias inet | netgraph_nat inet netinet/libalias/alias_mod.c optional libalias | netgraph_nat netinet/libalias/alias_proxy.c optional libalias inet | netgraph_nat inet netinet/libalias/alias_util.c optional libalias inet | netgraph_nat inet netinet/libalias/alias_sctp.c optional libalias inet | netgraph_nat inet netinet6/dest6.c optional inet6 netinet6/frag6.c optional inet6 netinet6/icmp6.c optional inet6 netinet6/in6.c optional inet6 netinet6/in6_cksum.c optional inet6 netinet6/in6_gif.c optional gif inet6 | netgraph_gif inet6 netinet6/in6_ifattach.c optional inet6 netinet6/in6_mcast.c optional inet6 netinet6/in6_pcb.c optional inet6 netinet6/in6_pcbgroup.c optional inet6 pcbgroup netinet6/in6_proto.c optional inet6 netinet6/in6_rmx.c optional inet6 netinet6/in6_src.c optional inet6 netinet6/ip6_forward.c optional inet6 netinet6/ip6_id.c optional inet6 netinet6/ip6_input.c optional inet6 netinet6/ip6_mroute.c optional mrouting inet6 netinet6/ip6_output.c optional inet6 netinet6/ip6_ipsec.c optional inet6 ipsec netinet6/mld6.c optional inet6 netinet6/nd6.c optional inet6 netinet6/nd6_nbr.c optional inet6 netinet6/nd6_rtr.c optional inet6 netinet6/raw_ip6.c optional inet6 netinet6/route6.c optional inet6 netinet6/scope6.c optional inet6 netinet6/sctp6_usrreq.c optional inet6 sctp netinet6/udp6_usrreq.c optional inet6 netipsec/ipsec.c optional ipsec inet | ipsec inet6 netipsec/ipsec_input.c optional ipsec inet | ipsec inet6 netipsec/ipsec_mbuf.c optional ipsec inet | ipsec inet6 netipsec/ipsec_output.c optional ipsec inet | ipsec inet6 netipsec/key.c optional ipsec inet | ipsec inet6 netipsec/key_debug.c optional ipsec inet | ipsec inet6 netipsec/keysock.c optional ipsec inet | ipsec inet6 netipsec/xform_ah.c optional ipsec inet | ipsec inet6 netipsec/xform_esp.c optional ipsec inet | ipsec inet6 netipsec/xform_ipcomp.c optional ipsec inet | ipsec inet6 netipsec/xform_ipip.c optional ipsec inet | ipsec inet6 netipsec/xform_tcp.c optional ipsec inet tcp_signature | \ ipsec inet6 tcp_signature netipx/ipx.c optional ipx netipx/ipx_cksum.c optional ipx netipx/ipx_input.c optional ipx netipx/ipx_outputfl.c optional ipx netipx/ipx_pcb.c optional ipx netipx/ipx_proto.c optional ipx netipx/ipx_usrreq.c optional ipx netipx/spx_debug.c optional ipx netipx/spx_reass.c optional ipx netipx/spx_usrreq.c optional ipx netnatm/natm.c optional natm netnatm/natm_pcb.c optional natm netnatm/natm_proto.c optional natm netpfil/ipfw/dn_heap.c optional inet dummynet netpfil/ipfw/dn_sched_fifo.c optional inet dummynet netpfil/ipfw/dn_sched_prio.c optional inet dummynet netpfil/ipfw/dn_sched_qfq.c optional inet dummynet netpfil/ipfw/dn_sched_rr.c optional inet dummynet netpfil/ipfw/dn_sched_wf2q.c optional inet dummynet netpfil/ipfw/ip_dummynet.c optional inet dummynet netpfil/ipfw/ip_dn_io.c optional inet dummynet netpfil/ipfw/ip_dn_glue.c optional inet dummynet netpfil/ipfw/ip_fw2.c optional inet ipfirewall netpfil/ipfw/ip_fw_dynamic.c optional inet ipfirewall netpfil/ipfw/ip_fw_log.c optional inet ipfirewall netpfil/ipfw/ip_fw_pfil.c optional inet ipfirewall netpfil/ipfw/ip_fw_sockopt.c optional inet ipfirewall netpfil/ipfw/ip_fw_table.c optional inet ipfirewall netpfil/ipfw/ip_fw_nat.c optional inet ipfirewall_nat netpfil/pf/if_pflog.c optional pflog pf inet netpfil/pf/if_pfsync.c optional pfsync pf inet netpfil/pf/pf.c optional pf inet netpfil/pf/pf_if.c optional pf inet netpfil/pf/pf_ioctl.c optional pf inet netpfil/pf/pf_lb.c optional pf inet netpfil/pf/pf_norm.c optional pf inet netpfil/pf/pf_osfp.c optional pf inet netpfil/pf/pf_ruleset.c optional pf inet netpfil/pf/pf_table.c optional pf inet netpfil/pf/in4_cksum.c optional pf inet nfs/bootp_subr.c optional bootp nfsclient | bootp nfscl nfs/krpc_subr.c optional bootp nfsclient | bootp nfscl nfs/nfs_common.c optional nfsclient | nfsserver nfs/nfs_diskless.c optional nfsclient nfs_root | nfscl nfs_root nfs/nfs_lock.c optional nfsclient | nfscl | nfslockd | nfsd nfsclient/nfs_bio.c optional nfsclient nfsclient/nfs_node.c optional nfsclient nfsclient/nfs_krpc.c optional nfsclient nfsclient/nfs_subs.c optional nfsclient nfsclient/nfs_nfsiod.c optional nfsclient nfsclient/nfs_vfsops.c optional nfsclient nfsclient/nfs_vnops.c optional nfsclient nfsserver/nfs_fha.c optional nfsserver nfsserver/nfs_serv.c optional nfsserver nfsserver/nfs_srvkrpc.c optional nfsserver nfsserver/nfs_srvsubs.c optional nfsserver nfs/nfs_nfssvc.c optional nfsserver | nfscl | nfsd nlm/nlm_advlock.c optional nfslockd | nfsd nlm/nlm_prot_clnt.c optional nfslockd | nfsd nlm/nlm_prot_impl.c optional nfslockd | nfsd nlm/nlm_prot_server.c optional nfslockd | nfsd nlm/nlm_prot_svc.c optional nfslockd | nfsd nlm/nlm_prot_xdr.c optional nfslockd | nfsd nlm/sm_inter_xdr.c optional nfslockd | nfsd # OpenFabrics Enterprise Distribution (Infiniband) ofed/include/linux/linux_compat.c optional ofed \ no-depend compile-with "${OFED_C}" ofed/include/linux/linux_idr.c optional ofed \ no-depend compile-with "${OFED_C}" ofed/include/linux/linux_radix.c optional ofed \ no-depend compile-with "${OFED_C}" ofed/drivers/infiniband/core/addr.c optional ofed \ no-depend \ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/" ofed/drivers/infiniband/core/agent.c optional ofed \ no-depend \ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/" ofed/drivers/infiniband/core/cache.c optional ofed \ no-depend \ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/" # XXX Mad.c must be ordered before cm.c for sysinit sets to occur in # the correct order. ofed/drivers/infiniband/core/mad.c optional ofed \ no-depend \ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/" ofed/drivers/infiniband/core/cm.c optional ofed \ no-depend \ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/" ofed/drivers/infiniband/core/cma.c optional ofed \ no-depend \ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/" ofed/drivers/infiniband/core/device.c optional ofed \ no-depend \ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/" ofed/drivers/infiniband/core/fmr_pool.c optional ofed \ no-depend \ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/" ofed/drivers/infiniband/core/iwcm.c optional ofed \ no-depend \ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/" ofed/drivers/infiniband/core/local_sa.c optional ofed \ no-depend \ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/" ofed/drivers/infiniband/core/mad_rmpp.c optional ofed \ no-depend \ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/" ofed/drivers/infiniband/core/multicast.c optional ofed \ no-depend \ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/" ofed/drivers/infiniband/core/notice.c optional ofed \ no-depend \ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/" ofed/drivers/infiniband/core/packer.c optional ofed \ no-depend \ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/" ofed/drivers/infiniband/core/sa_query.c optional ofed \ no-depend \ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/" ofed/drivers/infiniband/core/smi.c optional ofed \ no-depend \ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/" ofed/drivers/infiniband/core/sysfs.c optional ofed \ no-depend \ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/" ofed/drivers/infiniband/core/ucm.c optional ofed \ no-depend \ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/" ofed/drivers/infiniband/core/ucma.c optional ofed \ no-depend \ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/" ofed/drivers/infiniband/core/ud_header.c optional ofed \ no-depend \ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/" ofed/drivers/infiniband/core/umem.c optional ofed \ no-depend \ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/" ofed/drivers/infiniband/core/user_mad.c optional ofed \ no-depend \ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/" ofed/drivers/infiniband/core/uverbs_cmd.c optional ofed \ no-depend \ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/" ofed/drivers/infiniband/core/uverbs_main.c optional ofed \ no-depend \ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/" ofed/drivers/infiniband/core/uverbs_marshall.c optional ofed \ no-depend \ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/" ofed/drivers/infiniband/core/verbs.c optional ofed \ no-depend \ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/" ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c optional ipoib \ no-depend \ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/ulp/ipoib/" #ofed/drivers/infiniband/ulp/ipoib/ipoib_fs.c optional ipoib \ # no-depend \ # compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/ulp/ipoib/" ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c optional ipoib \ no-depend \ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/ulp/ipoib/" ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c optional ipoib \ no-depend \ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/ulp/ipoib/" ofed/drivers/infiniband/ulp/ipoib/ipoib_multicast.c optional ipoib \ no-depend \ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/ulp/ipoib/" ofed/drivers/infiniband/ulp/ipoib/ipoib_verbs.c optional ipoib \ no-depend \ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/ulp/ipoib/" #ofed/drivers/infiniband/ulp/ipoib/ipoib_vlan.c optional ipoib \ # no-depend \ # compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/ulp/ipoib/" ofed/drivers/infiniband/ulp/sdp/sdp_bcopy.c optional sdp inet \ no-depend \ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/ulp/sdp/" ofed/drivers/infiniband/ulp/sdp/sdp_main.c optional sdp inet \ no-depend \ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/ulp/sdp/" ofed/drivers/infiniband/ulp/sdp/sdp_rx.c optional sdp inet \ no-depend \ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/ulp/sdp/" ofed/drivers/infiniband/ulp/sdp/sdp_cma.c optional sdp inet \ no-depend \ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/ulp/sdp/" ofed/drivers/infiniband/ulp/sdp/sdp_tx.c optional sdp inet \ no-depend \ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/ulp/sdp/" ofed/drivers/infiniband/hw/mlx4/ah.c optional mlx4ib \ no-depend obj-prefix "mlx4ib_" \ compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/infiniband/hw/mlx4/" ofed/drivers/infiniband/hw/mlx4/cq.c optional mlx4ib \ no-depend obj-prefix "mlx4ib_" \ compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/infiniband/hw/mlx4/" ofed/drivers/infiniband/hw/mlx4/doorbell.c optional mlx4ib \ no-depend obj-prefix "mlx4ib_" \ compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/infiniband/hw/mlx4/" ofed/drivers/infiniband/hw/mlx4/mad.c optional mlx4ib \ no-depend obj-prefix "mlx4ib_" \ compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/infiniband/hw/mlx4/" ofed/drivers/infiniband/hw/mlx4/main.c optional mlx4ib \ no-depend obj-prefix "mlx4ib_" \ compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/infiniband/hw/mlx4/" ofed/drivers/infiniband/hw/mlx4/mr.c optional mlx4ib \ no-depend obj-prefix "mlx4ib_" \ compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/infiniband/hw/mlx4/" ofed/drivers/infiniband/hw/mlx4/qp.c optional mlx4ib \ no-depend obj-prefix "mlx4ib_" \ compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/infiniband/hw/mlx4/" ofed/drivers/infiniband/hw/mlx4/srq.c optional mlx4ib \ no-depend obj-prefix "mlx4ib_" \ compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/infiniband/hw/mlx4/" ofed/drivers/infiniband/hw/mlx4/wc.c optional mlx4ib \ no-depend obj-prefix "mlx4ib_" \ compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/infiniband/hw/mlx4/" ofed/drivers/net/mlx4/alloc.c optional mlx4ib | mlxen \ no-depend obj-prefix "mlx4_" \ compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/" ofed/drivers/net/mlx4/catas.c optional mlx4ib | mlxen \ no-depend obj-prefix "mlx4_" \ compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/" ofed/drivers/net/mlx4/cmd.c optional mlx4ib | mlxen \ no-depend obj-prefix "mlx4_" \ compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/" ofed/drivers/net/mlx4/cq.c optional mlx4ib | mlxen \ no-depend obj-prefix "mlx4_" \ compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/" ofed/drivers/net/mlx4/eq.c optional mlx4ib | mlxen \ no-depend obj-prefix "mlx4_" \ compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/" ofed/drivers/net/mlx4/fw.c optional mlx4ib | mlxen \ no-depend obj-prefix "mlx4_" \ compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/" ofed/drivers/net/mlx4/icm.c optional mlx4ib | mlxen \ no-depend obj-prefix "mlx4_" \ compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/" ofed/drivers/net/mlx4/intf.c optional mlx4ib | mlxen \ no-depend obj-prefix "mlx4_" \ compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/" ofed/drivers/net/mlx4/main.c optional mlx4ib | mlxen \ no-depend obj-prefix "mlx4_" \ compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/" ofed/drivers/net/mlx4/mcg.c optional mlx4ib | mlxen \ no-depend obj-prefix "mlx4_" \ compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/" ofed/drivers/net/mlx4/mr.c optional mlx4ib | mlxen \ no-depend obj-prefix "mlx4_" \ compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/" ofed/drivers/net/mlx4/pd.c optional mlx4ib | mlxen \ no-depend obj-prefix "mlx4_" \ compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/" ofed/drivers/net/mlx4/port.c optional mlx4ib | mlxen \ no-depend obj-prefix "mlx4_" \ compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/" ofed/drivers/net/mlx4/profile.c optional mlx4ib | mlxen \ no-depend obj-prefix "mlx4_" \ compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/" ofed/drivers/net/mlx4/qp.c optional mlx4ib | mlxen \ no-depend obj-prefix "mlx4_" \ compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/" ofed/drivers/net/mlx4/reset.c optional mlx4ib | mlxen \ no-depend obj-prefix "mlx4_" \ compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/" ofed/drivers/net/mlx4/sense.c optional mlx4ib | mlxen \ no-depend obj-prefix "mlx4_" \ compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/" ofed/drivers/net/mlx4/srq.c optional mlx4ib | mlxen \ no-depend obj-prefix "mlx4_" \ compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/" ofed/drivers/net/mlx4/xrcd.c optional mlx4ib | mlxen \ no-depend obj-prefix "mlx4_" \ compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/" ofed/drivers/net/mlx4/en_cq.c optional mlxen \ no-depend obj-prefix "mlx4_" \ compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/" ofed/drivers/net/mlx4/en_frag.c optional mlxen \ no-depend obj-prefix "mlx4_" \ compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/" ofed/drivers/net/mlx4/en_main.c optional mlxen \ no-depend obj-prefix "mlx4_" \ compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/" ofed/drivers/net/mlx4/en_netdev.c optional mlxen \ no-depend obj-prefix "mlx4_" \ compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/" ofed/drivers/net/mlx4/en_port.c optional mlxen \ no-depend obj-prefix "mlx4_" \ compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/" ofed/drivers/net/mlx4/en_resources.c optional mlxen \ no-depend obj-prefix "mlx4_" \ compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/" ofed/drivers/net/mlx4/en_rx.c optional mlxen \ no-depend obj-prefix "mlx4_" \ compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/" ofed/drivers/net/mlx4/en_tx.c optional mlxen \ no-depend obj-prefix "mlx4_" \ compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/" ofed/drivers/infiniband/hw/mthca/mthca_allocator.c optional mthca \ no-depend compile-with "${OFED_C}" ofed/drivers/infiniband/hw/mthca/mthca_av.c optional mthca \ no-depend compile-with "${OFED_C}" ofed/drivers/infiniband/hw/mthca/mthca_catas.c optional mthca \ no-depend compile-with "${OFED_C}" ofed/drivers/infiniband/hw/mthca/mthca_cmd.c optional mthca \ no-depend compile-with "${OFED_C}" ofed/drivers/infiniband/hw/mthca/mthca_cq.c optional mthca \ no-depend compile-with "${OFED_C}" ofed/drivers/infiniband/hw/mthca/mthca_eq.c optional mthca \ no-depend compile-with "${OFED_C}" ofed/drivers/infiniband/hw/mthca/mthca_mad.c optional mthca \ no-depend compile-with "${OFED_C}" ofed/drivers/infiniband/hw/mthca/mthca_main.c optional mthca \ no-depend compile-with "${OFED_C}" ofed/drivers/infiniband/hw/mthca/mthca_mcg.c optional mthca \ no-depend compile-with "${OFED_C}" ofed/drivers/infiniband/hw/mthca/mthca_memfree.c optional mthca \ no-depend compile-with "${OFED_C}" ofed/drivers/infiniband/hw/mthca/mthca_mr.c optional mthca \ no-depend compile-with "${OFED_C}" ofed/drivers/infiniband/hw/mthca/mthca_pd.c optional mthca \ no-depend compile-with "${OFED_C}" ofed/drivers/infiniband/hw/mthca/mthca_profile.c optional mthca \ no-depend compile-with "${OFED_C}" ofed/drivers/infiniband/hw/mthca/mthca_provider.c optional mthca \ no-depend compile-with "${OFED_C}" ofed/drivers/infiniband/hw/mthca/mthca_qp.c optional mthca \ no-depend compile-with "${OFED_C}" ofed/drivers/infiniband/hw/mthca/mthca_reset.c optional mthca \ no-depend compile-with "${OFED_C}" ofed/drivers/infiniband/hw/mthca/mthca_srq.c optional mthca \ no-depend compile-with "${OFED_C}" ofed/drivers/infiniband/hw/mthca/mthca_uar.c optional mthca \ no-depend compile-with "${OFED_C}" # crypto support opencrypto/cast.c optional crypto | ipsec opencrypto/criov.c optional crypto opencrypto/crypto.c optional crypto opencrypto/cryptodev.c optional cryptodev opencrypto/cryptodev_if.m optional crypto opencrypto/cryptosoft.c optional crypto opencrypto/deflate.c optional crypto opencrypto/rmd160.c optional crypto | ipsec opencrypto/skipjack.c optional crypto opencrypto/xform.c optional crypto pci/alpm.c optional alpm pci pci/amdpm.c optional amdpm pci | nfpm pci pci/amdsmb.c optional amdsmb pci pci/if_rl.c optional rl pci pci/intpm.c optional intpm pci pci/ncr.c optional ncr pci pci/nfsmb.c optional nfsmb pci pci/viapm.c optional viapm pci rpc/auth_none.c optional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd rpc/auth_unix.c optional krpc | nfslockd | nfsclient | nfscl | nfsd rpc/authunix_prot.c optional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd rpc/clnt_dg.c optional krpc | nfslockd | nfsclient | nfscl | nfsd rpc/clnt_rc.c optional krpc | nfslockd | nfsclient | nfscl | nfsd rpc/clnt_vc.c optional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd rpc/getnetconfig.c optional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd rpc/replay.c optional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd rpc/rpc_callmsg.c optional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd rpc/rpc_generic.c optional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd rpc/rpc_prot.c optional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd rpc/rpcb_clnt.c optional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd rpc/rpcb_prot.c optional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd rpc/svc.c optional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd rpc/svc_auth.c optional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd rpc/svc_auth_unix.c optional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd rpc/svc_dg.c optional krpc | nfslockd | nfsserver | nfscl | nfsd rpc/svc_generic.c optional krpc | nfslockd | nfsserver | nfscl | nfsd rpc/svc_vc.c optional krpc | nfslockd | nfsserver | nfscl | nfsd rpc/rpcsec_gss/rpcsec_gss.c optional krpc kgssapi | nfslockd kgssapi | nfscl kgssapi | nfsd kgssapi rpc/rpcsec_gss/rpcsec_gss_conf.c optional krpc kgssapi | nfslockd kgssapi | nfscl kgssapi | nfsd kgssapi rpc/rpcsec_gss/rpcsec_gss_misc.c optional krpc kgssapi | nfslockd kgssapi | nfscl kgssapi | nfsd kgssapi rpc/rpcsec_gss/rpcsec_gss_prot.c optional krpc kgssapi | nfslockd kgssapi | nfscl kgssapi | nfsd kgssapi rpc/rpcsec_gss/svc_rpcsec_gss.c optional krpc kgssapi | nfslockd kgssapi | nfscl kgssapi | nfsd kgssapi security/audit/audit.c optional audit security/audit/audit_arg.c optional audit security/audit/audit_bsm.c optional audit security/audit/audit_bsm_klib.c optional audit security/audit/audit_pipe.c optional audit security/audit/audit_syscalls.c standard security/audit/audit_trigger.c optional audit security/audit/audit_worker.c optional audit security/audit/bsm_domain.c optional audit security/audit/bsm_errno.c optional audit security/audit/bsm_fcntl.c optional audit security/audit/bsm_socket_type.c optional audit security/audit/bsm_token.c optional audit security/mac/mac_atalk.c optional mac netatalk security/mac/mac_audit.c optional mac audit security/mac/mac_cred.c optional mac security/mac/mac_framework.c optional mac security/mac/mac_inet.c optional mac inet | mac inet6 security/mac/mac_inet6.c optional mac inet6 security/mac/mac_label.c optional mac security/mac/mac_net.c optional mac security/mac/mac_pipe.c optional mac security/mac/mac_posix_sem.c optional mac security/mac/mac_posix_shm.c optional mac security/mac/mac_priv.c optional mac security/mac/mac_process.c optional mac security/mac/mac_socket.c optional mac security/mac/mac_syscalls.c standard security/mac/mac_system.c optional mac security/mac/mac_sysv_msg.c optional mac security/mac/mac_sysv_sem.c optional mac security/mac/mac_sysv_shm.c optional mac security/mac/mac_vfs.c optional mac security/mac_biba/mac_biba.c optional mac_biba security/mac_bsdextended/mac_bsdextended.c optional mac_bsdextended security/mac_bsdextended/ugidfw_system.c optional mac_bsdextended security/mac_bsdextended/ugidfw_vnode.c optional mac_bsdextended security/mac_ifoff/mac_ifoff.c optional mac_ifoff security/mac_lomac/mac_lomac.c optional mac_lomac security/mac_mls/mac_mls.c optional mac_mls security/mac_none/mac_none.c optional mac_none security/mac_partition/mac_partition.c optional mac_partition security/mac_portacl/mac_portacl.c optional mac_portacl security/mac_seeotheruids/mac_seeotheruids.c optional mac_seeotheruids security/mac_stub/mac_stub.c optional mac_stub security/mac_test/mac_test.c optional mac_test teken/teken.c optional sc ufs/ffs/ffs_alloc.c optional ffs ufs/ffs/ffs_balloc.c optional ffs ufs/ffs/ffs_inode.c optional ffs ufs/ffs/ffs_snapshot.c optional ffs ufs/ffs/ffs_softdep.c optional ffs ufs/ffs/ffs_subr.c optional ffs ufs/ffs/ffs_tables.c optional ffs ufs/ffs/ffs_vfsops.c optional ffs ufs/ffs/ffs_vnops.c optional ffs ufs/ffs/ffs_rawread.c optional directio ufs/ffs/ffs_suspend.c optional ffs ufs/ufs/ufs_acl.c optional ffs ufs/ufs/ufs_bmap.c optional ffs ufs/ufs/ufs_dirhash.c optional ffs ufs/ufs/ufs_extattr.c optional ffs ufs/ufs/ufs_gjournal.c optional ffs UFS_GJOURNAL ufs/ufs/ufs_inode.c optional ffs ufs/ufs/ufs_lookup.c optional ffs ufs/ufs/ufs_quota.c optional ffs ufs/ufs/ufs_vfsops.c optional ffs ufs/ufs/ufs_vnops.c optional ffs vm/default_pager.c standard vm/device_pager.c standard vm/phys_pager.c standard vm/redzone.c optional DEBUG_REDZONE vm/sg_pager.c standard vm/swap_pager.c standard vm/uma_core.c standard vm/uma_dbg.c standard vm/memguard.c optional DEBUG_MEMGUARD vm/vm_fault.c standard vm/vm_glue.c standard vm/vm_init.c standard vm/vm_kern.c standard vm/vm_map.c standard vm/vm_meter.c standard vm/vm_mmap.c standard vm/vm_object.c standard vm/vm_page.c standard vm/vm_pageout.c standard vm/vm_pager.c standard vm/vm_phys.c standard vm/vm_radix.c standard vm/vm_reserv.c standard vm/vm_unix.c standard vm/vm_zeroidle.c standard vm/vnode_pager.c standard xen/gnttab.c optional xen | xenhvm xen/features.c optional xen | xenhvm xen/evtchn/evtchn.c optional xen xen/evtchn/evtchn_dev.c optional xen | xenhvm xen/xenbus/xenbus_if.m optional xen | xenhvm xen/xenbus/xenbus.c optional xen | xenhvm xen/xenbus/xenbusb_if.m optional xen | xenhvm xen/xenbus/xenbusb.c optional xen | xenhvm xen/xenbus/xenbusb_front.c optional xen | xenhvm xen/xenbus/xenbusb_back.c optional xen | xenhvm xen/xenstore/xenstore.c optional xen | xenhvm xen/xenstore/xenstore_dev.c optional xen | xenhvm xdr/xdr.c optional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd xdr/xdr_array.c optional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd xdr/xdr_mbuf.c optional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd xdr/xdr_mem.c optional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd xdr/xdr_reference.c optional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd xdr/xdr_sizeof.c optional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd Index: head/sys/conf/files.sparc64 =================================================================== --- head/sys/conf/files.sparc64 (revision 249082) +++ head/sys/conf/files.sparc64 (revision 249083) @@ -1,146 +1,146 @@ # This file tells config what files go into building a kernel, # files marked standard are always included. # # $FreeBSD$ # # The long compile-with and dependency lines are required because of # limitations in config: backslash-newline doesn't work in strings, and # dependency lines other than the first are silently ignored. # atkbdmap.h optional atkbd_dflt_keymap \ compile-with "/usr/sbin/kbdcontrol -L ${ATKBD_DFLT_KEYMAP} | sed -e 's/^static keymap_t.* = /static keymap_t key_map = /' -e 's/^static accentmap_t.* = /static accentmap_t accent_map = /' > atkbdmap.h" \ no-obj no-implicit-rule before-depend \ clean "atkbdmap.h" # sunkbdmap.h optional sunkbd_dflt_keymap \ compile-with "/usr/sbin/kbdcontrol -L ${SUNKBD_DFLT_KEYMAP} | sed -e 's/^static keymap_t.* = /static keymap_t key_map = /' -e 's/^static accentmap_t.* = /static accentmap_t accent_map = /' > sunkbdmap.h" \ no-obj no-implicit-rule before-depend \ clean "sunkbdmap.h" # ukbdmap.h optional ukbd_dflt_keymap \ compile-with "/usr/sbin/kbdcontrol -L ${UKBD_DFLT_KEYMAP} | sed -e 's/^static keymap_t.* = /static keymap_t key_map = /' -e 's/^static accentmap_t.* = /static accentmap_t accent_map = /' > ukbdmap.h" \ no-obj no-implicit-rule before-depend \ clean "ukbdmap.h" # cddl/contrib/opensolaris/common/atomic/sparc64/opensolaris_atomic.S optional zfs compile-with "${ZFS_S}" crypto/blowfish/bf_enc.c optional crypto | ipsec crypto/des/des_enc.c optional crypto | ipsec dev/atkbdc/atkbd.c optional atkbd atkbdc dev/atkbdc/atkbd_atkbdc.c optional atkbd atkbdc dev/atkbdc/atkbdc.c optional atkbdc dev/atkbdc/atkbdc_ebus.c optional atkbdc ebus dev/atkbdc/atkbdc_isa.c optional atkbdc isa dev/atkbdc/atkbdc_subr.c optional atkbdc dev/atkbdc/psm.c optional psm atkbdc dev/auxio/auxio.c optional auxio sbus | auxio ebus dev/esp/esp_sbus.c optional esp sbus dev/fb/creator.c optional creator sc dev/fb/fb.c optional sc dev/fb/gallant12x22.c optional sc dev/fb/machfb.c optional machfb sc dev/hwpmc/hwpmc_sparc64.c optional hwpmc dev/kbd/kbd.c optional atkbd | sc | ukbd dev/le/if_le_lebuffer.c optional le sbus dev/le/if_le_ledma.c optional le sbus dev/le/lebuffer_sbus.c optional le sbus dev/ofw/ofw_bus_if.m standard dev/ofw/ofw_bus_subr.c standard dev/ofw/ofw_console.c optional ofw_console dev/ofw/ofw_if.m standard dev/ofw/ofw_standard.c standard dev/ofw/openfirm.c standard dev/ofw/openfirmio.c standard dev/ofw/openpromio.c standard dev/pcf/envctrl.c optional pcf ebus dev/pcf/pcf_ebus.c optional pcf ebus dev/sound/sbus/cs4231.c optional snd_audiocs ebus | \ snd_audiocs sbus dev/syscons/scgfbrndr.c optional sc dev/syscons/scterm-teken.c optional sc dev/syscons/scvtb.c optional sc dev/uart/uart_cpu_sparc64.c optional uart dev/uart/uart_kbd_sun.c optional uart sc kern/kern_clocksource.c standard kern/subr_dummy_vdso_tc.c standard kern/syscalls.c optional ktr libkern/ffs.c standard libkern/ffsl.c standard libkern/fls.c standard libkern/flsl.c standard libkern/memmove.c standard sparc64/central/central.c optional central sparc64/ebus/ebus.c optional ebus sparc64/ebus/epic.c optional epic ebus sparc64/fhc/clkbrd.c optional fhc sparc64/fhc/fhc.c optional fhc sparc64/isa/isa.c optional isa sparc64/isa/isa_dma.c optional isa sparc64/isa/ofw_isa.c optional ebus | isa sparc64/pci/apb.c optional pci sparc64/pci/fire.c optional pci sparc64/pci/ofw_pcib.c optional pci sparc64/pci/ofw_pcib_subr.c optional pci sparc64/pci/ofw_pcibus.c optional pci sparc64/pci/ofw_pci_if.m optional pci sparc64/pci/psycho.c optional pci sparc64/pci/sbbc.c optional sbbc uart 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 sparc64/sparc64/cam_machdep.c optional scbus sparc64/sparc64/cheetah.c standard sparc64/sparc64/clock.c standard sparc64/sparc64/counter.c standard sparc64/sparc64/db_disasm.c optional ddb sparc64/sparc64/db_interface.c optional ddb sparc64/sparc64/db_trace.c optional ddb sparc64/sparc64/db_hwwatch.c optional ddb sparc64/sparc64/dump_machdep.c standard sparc64/sparc64/elf_machdep.c standard sparc64/sparc64/exception.S standard no-obj \ compile-with "${NORMAL_S} -mcpu=ultrasparc" sparc64/sparc64/eeprom.c optional eeprom ebus | eeprom fhc | \ eeprom sbus sparc64/sparc64/gdb_machdep.c optional gdb sparc64/sparc64/identcpu.c standard sparc64/sparc64/in_cksum.c optional inet | inet6 sparc64/sparc64/interrupt.S standard no-obj \ compile-with "${NORMAL_S} -mcpu=ultrasparc" sparc64/sparc64/intr_machdep.c standard sparc64/sparc64/iommu.c standard sparc64/sparc64/jbusppm.c standard sparc64/sparc64/locore.S standard no-obj sparc64/sparc64/machdep.c standard sparc64/sparc64/mem.c optional mem sparc64/sparc64/mp_exception.S optional smp \ compile-with "${NORMAL_S} -mcpu=ultrasparc" sparc64/sparc64/mp_locore.S optional smp sparc64/sparc64/mp_machdep.c optional smp sparc64/sparc64/nexus.c standard sparc64/sparc64/ofw_machdep.c standard sparc64/sparc64/pmap.c standard sparc64/sparc64/prof_machdep.c optional profiling-routine sparc64/sparc64/rtc.c optional rtc ebus | rtc isa sparc64/sparc64/rwindow.c standard sparc64/sparc64/sc_machdep.c optional sc sparc64/sparc64/schppm.c standard sparc64/sparc64/spitfire.c standard sparc64/sparc64/ssm.c standard sparc64/sparc64/stack_machdep.c optional ddb | stack sparc64/sparc64/support.S standard \ compile-with "${NORMAL_S} -mcpu=ultrasparc" sparc64/sparc64/sys_machdep.c standard sparc64/sparc64/swtch.S standard sparc64/sparc64/tick.c standard sparc64/sparc64/tlb.c standard sparc64/sparc64/trap.c standard sparc64/sparc64/tsb.c standard sparc64/sparc64/uio_machdep.c standard sparc64/sparc64/upa.c optional creator sparc64/sparc64/vm_machdep.c standard sparc64/sparc64/zeus.c standard Index: head/sys/conf/options =================================================================== --- head/sys/conf/options (revision 249082) +++ head/sys/conf/options (revision 249083) @@ -1,906 +1,905 @@ # $FreeBSD$ # # On the handling of kernel options # # All kernel options should be listed in NOTES, with suitable # descriptions. Negative options (options that make some code not # compile) should be commented out; LINT (generated from NOTES) should # compile as much code as possible. Try to structure option-using # code so that a single option only switch code on, or only switch # code off, to make it possible to have a full compile-test. If # necessary, you can check for COMPILING_LINT to get maximum code # coverage. # # All new options shall also be listed in either "conf/options" or # "conf/options.". Options that affect a single source-file # .[c|s] should be directed into "opt_.h", while options # that affect multiple files should either go in "opt_global.h" if # this is a kernel-wide option (used just about everywhere), or in # "opt_.h" if it affects only some files. # Note that the effect of listing only an option without a # header-file-name in conf/options (and cousins) is that the last # convention is followed. # # This handling scheme is not yet fully implemented. # # # Format of this file: # Option name filename # # If filename is missing, the default is # opt_.h AAC_DEBUG opt_aac.h AHC_ALLOW_MEMIO opt_aic7xxx.h AHC_TMODE_ENABLE opt_aic7xxx.h AHC_DUMP_EEPROM opt_aic7xxx.h AHC_DEBUG opt_aic7xxx.h AHC_DEBUG_OPTS opt_aic7xxx.h AHC_REG_PRETTY_PRINT opt_aic7xxx.h AHD_DEBUG opt_aic79xx.h AHD_DEBUG_OPTS opt_aic79xx.h AHD_TMODE_ENABLE opt_aic79xx.h AHD_REG_PRETTY_PRINT opt_aic79xx.h ADW_ALLOW_MEMIO opt_adw.h TWA_DEBUG opt_twa.h TWA_FLASH_FIRMWARE opt_twa.h # Debugging options. ALT_BREAK_TO_DEBUGGER opt_kdb.h BREAK_TO_DEBUGGER opt_kdb.h DDB DDB_BUFR_SIZE opt_ddb.h DDB_CAPTURE_DEFAULTBUFSIZE opt_ddb.h DDB_CAPTURE_MAXBUFSIZE opt_ddb.h DDB_CTF opt_ddb.h DDB_NUMSYM opt_ddb.h GDB KDB opt_global.h KDB_TRACE opt_kdb.h KDB_UNATTENDED opt_kdb.h KLD_DEBUG opt_kld.h SYSCTL_DEBUG opt_sysctl.h TEXTDUMP_PREFERRED opt_ddb.h TEXTDUMP_VERBOSE opt_ddb.h # Miscellaneous options. ADAPTIVE_LOCKMGRS ALQ AUDIT opt_global.h BOOTHOWTO opt_global.h BOOTVERBOSE opt_global.h CALLOUT_PROFILING CAPABILITIES opt_capsicum.h CAPABILITY_MODE opt_capsicum.h COMPAT_43 opt_compat.h COMPAT_43TTY opt_compat.h COMPAT_FREEBSD4 opt_compat.h COMPAT_FREEBSD5 opt_compat.h COMPAT_FREEBSD6 opt_compat.h COMPAT_FREEBSD7 opt_compat.h COMPILING_LINT opt_global.h COMPRESS_USER_CORES opt_core.h CY_PCI_FASTINTR DEADLKRES opt_watchdog.h DIRECTIO FFCLOCK FULL_PREEMPTION opt_sched.h IPI_PREEMPTION opt_sched.h GEOM_AES opt_geom.h GEOM_BDE opt_geom.h GEOM_BSD opt_geom.h GEOM_CACHE opt_geom.h GEOM_CONCAT opt_geom.h GEOM_ELI opt_geom.h GEOM_FOX opt_geom.h GEOM_GATE opt_geom.h GEOM_JOURNAL opt_geom.h GEOM_LABEL opt_geom.h GEOM_LINUX_LVM opt_geom.h GEOM_MBR opt_geom.h GEOM_MIRROR opt_geom.h GEOM_MULTIPATH opt_geom.h GEOM_NOP opt_geom.h GEOM_PART_APM opt_geom.h GEOM_PART_BSD opt_geom.h GEOM_PART_EBR opt_geom.h GEOM_PART_EBR_COMPAT opt_geom.h GEOM_PART_GPT opt_geom.h GEOM_PART_LDM opt_geom.h GEOM_PART_MBR opt_geom.h GEOM_PART_PC98 opt_geom.h GEOM_PART_VTOC8 opt_geom.h GEOM_PC98 opt_geom.h GEOM_RAID opt_geom.h GEOM_RAID3 opt_geom.h GEOM_SHSEC opt_geom.h GEOM_STRIPE opt_geom.h GEOM_SUNLABEL opt_geom.h GEOM_UNCOMPRESS opt_geom.h GEOM_UZIP opt_geom.h GEOM_VIRSTOR opt_geom.h GEOM_VOL opt_geom.h GEOM_ZERO opt_geom.h KDTRACE_HOOKS opt_kdtrace.h KSTACK_MAX_PAGES KSTACK_PAGES KTRACE KTRACE_REQUEST_POOL opt_ktrace.h LIBICONV MAC opt_global.h MAC_BIBA opt_dontuse.h MAC_BSDEXTENDED opt_dontuse.h MAC_IFOFF opt_dontuse.h MAC_LOMAC opt_dontuse.h MAC_MLS opt_dontuse.h MAC_NONE opt_dontuse.h MAC_PARTITION opt_dontuse.h MAC_PORTACL opt_dontuse.h MAC_SEEOTHERUIDS opt_dontuse.h MAC_STATIC opt_mac.h MAC_STUB opt_dontuse.h MAC_TEST opt_dontuse.h MD_ROOT opt_md.h MD_ROOT_FSTYPE opt_md.h MD_ROOT_SIZE opt_md.h MFI_DEBUG opt_mfi.h MFI_DECODE_LOG opt_mfi.h MPROF_BUFFERS opt_mprof.h MPROF_HASH_SIZE opt_mprof.h NEW_PCIB opt_global.h NO_ADAPTIVE_MUTEXES opt_adaptive_mutexes.h NO_ADAPTIVE_RWLOCKS NO_ADAPTIVE_SX NO_SYSCTL_DESCR opt_global.h NSWBUF_MIN opt_swap.h MBUF_PACKET_ZONE_DISABLE opt_global.h PANIC_REBOOT_WAIT_TIME opt_panic.h PPC_DEBUG opt_ppc.h PPC_PROBE_CHIPSET opt_ppc.h PPS_SYNC opt_ntp.h PREEMPTION opt_sched.h PROCDESC opt_procdesc.h QUOTA SCHED_4BSD opt_sched.h SCHED_STATS opt_sched.h SCHED_ULE opt_sched.h SLEEPQUEUE_PROFILING SLHCI_DEBUG opt_slhci.h SPX_HACK STACK opt_stack.h SUIDDIR MSGMNB opt_sysvipc.h MSGMNI opt_sysvipc.h MSGSEG opt_sysvipc.h MSGSSZ opt_sysvipc.h MSGTQL opt_sysvipc.h SEMMNI opt_sysvipc.h SEMMNS opt_sysvipc.h SEMMNU opt_sysvipc.h SEMMSL opt_sysvipc.h SEMOPM opt_sysvipc.h SEMUME opt_sysvipc.h SHMALL opt_sysvipc.h SHMMAX opt_sysvipc.h SHMMAXPGS opt_sysvipc.h SHMMIN opt_sysvipc.h SHMMNI opt_sysvipc.h SHMSEG opt_sysvipc.h SYSVMSG opt_sysvipc.h SYSVSEM opt_sysvipc.h SYSVSHM opt_sysvipc.h SW_WATCHDOG opt_watchdog.h TURNSTILE_PROFILING UMTX_PROFILING VFS_AIO VERBOSE_SYSINIT opt_global.h WLCACHE opt_wavelan.h WLDEBUG opt_wavelan.h # POSIX kernel options P1003_1B_MQUEUE opt_posix.h P1003_1B_SEMAPHORES opt_posix.h _KPOSIX_PRIORITY_SCHEDULING opt_posix.h # Do we want the config file compiled into the kernel? INCLUDE_CONFIG_FILE opt_config.h # Options for static filesystems. These should only be used at config # time, since the corresponding lkms cannot work if there are any static # dependencies. Unusability is enforced by hiding the defines for the # options in a never-included header. CD9660 opt_dontuse.h EXT2FS opt_dontuse.h FDESCFS opt_dontuse.h FFS opt_dontuse.h FUSE opt_dontuse.h MSDOSFS opt_dontuse.h NANDFS opt_dontuse.h NULLFS opt_dontuse.h PROCFS opt_dontuse.h PSEUDOFS opt_dontuse.h REISERFS opt_dontuse.h TMPFS opt_dontuse.h UDF opt_dontuse.h UNIONFS opt_dontuse.h # Pseudofs debugging PSEUDOFS_TRACE opt_pseudofs.h # In-kernel GSS-API KGSSAPI opt_kgssapi.h KGSSAPI_DEBUG opt_kgssapi.h # These static filesystems have one slightly bogus static dependency in # sys/i386/i386/autoconf.c. If any of these filesystems are # statically compiled into the kernel, code for mounting them as root # filesystems will be enabled - but look below. NFSCLIENT opt_nfs.h NFSSERVER opt_nfs.h # Use these options to compile the experimental nfs client and/or # server that supports NFSv4 into a kernel. # NFSCL - client # NFSD - server NFSCL opt_nfs.h NFSD opt_nfs.h # filesystems and libiconv bridge CD9660_ICONV opt_dontuse.h MSDOSFS_ICONV opt_dontuse.h UDF_ICONV opt_dontuse.h # If you are following the conditions in the copyright, # you can enable soft-updates which will speed up a lot of thigs # and make the system safer from crashes at the same time. # otherwise a STUB module will be compiled in. SOFTUPDATES opt_ffs.h # On small, embedded systems, it can be useful to turn off support for # snapshots. It saves about 30-40k for a feature that would be lightly # used, if it is used at all. NO_FFS_SNAPSHOT opt_ffs.h # Enabling this option turns on support for Access Control Lists in UFS, # which can be used to support high security configurations. Depends on # UFS_EXTATTR. UFS_ACL opt_ufs.h # Enabling this option turns on support for extended attributes in UFS-based # filesystems, which can be used to support high security configurations # as well as new filesystem features. UFS_EXTATTR opt_ufs.h UFS_EXTATTR_AUTOSTART opt_ufs.h # Enable fast hash lookups for large directories on UFS-based filesystems. UFS_DIRHASH opt_ufs.h # Enable gjournal-based UFS journal. UFS_GJOURNAL opt_ufs.h # The below sentence is not in English, and neither is this one. # We plan to remove the static dependences above, with a # _ROOT option to control if it usable as root. This list # allows these options to be present in config files already (though # they won't make any difference yet). NFS_ROOT opt_nfsroot.h # Options used only in subr_param.c. HZ opt_param.h MAXFILES opt_param.h NBUF opt_param.h NSFBUFS opt_param.h VM_BCACHE_SIZE_MAX opt_param.h VM_SWZONE_SIZE_MAX opt_param.h MAXUSERS DFLDSIZ opt_param.h MAXDSIZ opt_param.h MAXSSIZ opt_param.h # Generic SCSI options. CAM_MAX_HIGHPOWER opt_cam.h CAMDEBUG opt_cam.h CAM_DEBUG_COMPILE opt_cam.h CAM_DEBUG_DELAY opt_cam.h CAM_DEBUG_BUS opt_cam.h CAM_DEBUG_TARGET opt_cam.h CAM_DEBUG_LUN opt_cam.h CAM_DEBUG_FLAGS opt_cam.h SCSI_DELAY opt_scsi.h SCSI_NO_SENSE_STRINGS opt_scsi.h SCSI_NO_OP_STRINGS opt_scsi.h # Options used only in cam/ata/ata_da.c ADA_TEST_FAILURE opt_ada.h # Options used only in cam/scsi/scsi_cd.c CHANGER_MIN_BUSY_SECONDS opt_cd.h CHANGER_MAX_BUSY_SECONDS opt_cd.h # Options used only in cam/scsi/scsi_sa.c. SA_IO_TIMEOUT opt_sa.h SA_SPACE_TIMEOUT opt_sa.h SA_REWIND_TIMEOUT opt_sa.h SA_ERASE_TIMEOUT opt_sa.h SA_1FM_AT_EOD opt_sa.h # Options used only in cam/scsi/scsi_pt.c SCSI_PT_DEFAULT_TIMEOUT opt_pt.h # Options used only in cam/scsi/scsi_ses.c SES_ENABLE_PASSTHROUGH opt_ses.h # Options used only in cam/ctl CTL_DISABLE opt_ctl.h # Options used in dev/sym/ (Symbios SCSI driver). SYM_SETUP_LP_PROBE_MAP opt_sym.h #-Low Priority Probe Map (bits) # Allows the ncr to take precedence # 1 (1<<0) -> 810a, 860 # 2 (1<<1) -> 825a, 875, 885, 895 # 4 (1<<2) -> 895a, 896, 1510d SYM_SETUP_SCSI_DIFF opt_sym.h #-HVD support for 825a, 875, 885 # disabled:0 (default), enabled:1 SYM_SETUP_PCI_PARITY opt_sym.h #-PCI parity checking # disabled:0, enabled:1 (default) SYM_SETUP_MAX_LUN opt_sym.h #-Number of LUNs supported # default:8, range:[1..64] # Options used only in pci/ncr.c SCSI_NCR_DEBUG opt_ncr.h SCSI_NCR_MAX_SYNC opt_ncr.h SCSI_NCR_MAX_WIDE opt_ncr.h SCSI_NCR_MYADDR opt_ncr.h # Options used only in dev/isp/* ISP_TARGET_MODE opt_isp.h ISP_FW_CRASH_DUMP opt_isp.h ISP_DEFAULT_ROLES opt_isp.h ISP_INTERNAL_TARGET opt_isp.h # Options used only in dev/iscsi ISCSI_INITIATOR_DEBUG opt_iscsi_initiator.h # Options used in the 'ata' ATA/ATAPI driver 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 ACCEPT_FILTER_DNS ACCEPT_FILTER_HTTP ALTQ opt_global.h ALTQ_CBQ opt_altq.h ALTQ_CDNR opt_altq.h ALTQ_DEBUG opt_altq.h ALTQ_HFSC opt_altq.h ALTQ_NOPCC opt_altq.h ALTQ_PRIQ opt_altq.h ALTQ_RED opt_altq.h ALTQ_RIO opt_altq.h BOOTP opt_bootp.h BOOTP_BLOCKSIZE opt_bootp.h BOOTP_COMPAT opt_bootp.h BOOTP_NFSROOT opt_bootp.h BOOTP_NFSV3 opt_bootp.h BOOTP_WIRED_TO opt_bootp.h DEVICE_POLLING DEV_ENC opt_enc.h DEV_PF opt_pf.h DEV_PFLOG opt_pf.h DEV_PFSYNC opt_pf.h DEV_VLAN opt_vlan.h DUMMYNET opt_ipdn.h ETHER_8022 opt_ef.h ETHER_8023 opt_ef.h ETHER_II opt_ef.h ETHER_SNAP opt_ef.h INET opt_inet.h INET6 opt_inet6.h IPDIVERT IPFILTER opt_ipfilter.h IPFILTER_DEFAULT_BLOCK opt_ipfilter.h IPFILTER_LOG opt_ipfilter.h IPFILTER_LOOKUP opt_ipfilter.h IPFIREWALL opt_ipfw.h IPFIREWALL_DEFAULT_TO_ACCEPT opt_ipfw.h IPFIREWALL_NAT opt_ipfw.h IPFIREWALL_VERBOSE opt_ipfw.h IPFIREWALL_VERBOSE_LIMIT opt_ipfw.h IPSEC opt_ipsec.h IPSEC_DEBUG opt_ipsec.h IPSEC_FILTERTUNNEL opt_ipsec.h IPSEC_NAT_T opt_ipsec.h IPSTEALTH IPX KRPC LIBALIAS LIBMBPOOL LIBMCHAIN MBUF_PROFILING MBUF_STRESS_TEST MROUTING opt_mrouting.h NETATALK opt_atalk.h NFSLOCKD PCBGROUP opt_pcbgroup.h PF_DEFAULT_TO_DROP opt_pf.h RADIX_MPATH opt_mpath.h ROUTETABLES opt_route.h SLIP_IFF_OPTS opt_slip.h TCPDEBUG TCP_OFFLOAD opt_inet.h # Enable code to dispatch TCP offloading TCP_SIGNATURE opt_inet.h VLAN_ARRAY opt_vlan.h XBONEHACK FLOWTABLE opt_route.h # # SCTP # SCTP opt_sctp.h SCTP_DEBUG opt_sctp.h # Enable debug printfs SCTP_WITH_NO_CSUM opt_sctp.h # Use this at your peril SCTP_LOCK_LOGGING opt_sctp.h # Log to KTR lock activity SCTP_MBUF_LOGGING opt_sctp.h # Log to KTR general mbuf aloc/free SCTP_MBCNT_LOGGING opt_sctp.h # Log to KTR mbcnt activity SCTP_PACKET_LOGGING opt_sctp.h # Log to a packet buffer last N packets SCTP_LTRACE_CHUNKS opt_sctp.h # Log to KTR chunks processed SCTP_LTRACE_ERRORS opt_sctp.h # Log to KTR error returns. SCTP_USE_PERCPU_STAT opt_sctp.h # Use per cpu stats. SCTP_MCORE_INPUT opt_sctp.h # Have multiple input threads for input mbufs # # # # Netgraph(4). Use option NETGRAPH to enable the base netgraph code. # Each netgraph node type can be either be compiled into the kernel # or loaded dynamically. To get the former, include the corresponding # option below. Each type has its own man page, e.g. ng_async(4). NETGRAPH NETGRAPH_DEBUG opt_netgraph.h NETGRAPH_ASYNC opt_netgraph.h NETGRAPH_ATMLLC opt_netgraph.h NETGRAPH_ATM_ATMPIF opt_netgraph.h NETGRAPH_BLUETOOTH opt_netgraph.h NETGRAPH_BLUETOOTH_BT3C opt_netgraph.h NETGRAPH_BLUETOOTH_H4 opt_netgraph.h NETGRAPH_BLUETOOTH_HCI opt_netgraph.h NETGRAPH_BLUETOOTH_L2CAP opt_netgraph.h NETGRAPH_BLUETOOTH_SOCKET opt_netgraph.h NETGRAPH_BLUETOOTH_UBT opt_netgraph.h NETGRAPH_BLUETOOTH_UBTBCMFW opt_netgraph.h NETGRAPH_BPF opt_netgraph.h NETGRAPH_BRIDGE opt_netgraph.h NETGRAPH_CAR opt_netgraph.h NETGRAPH_CISCO opt_netgraph.h NETGRAPH_DEFLATE opt_netgraph.h NETGRAPH_DEVICE opt_netgraph.h NETGRAPH_ECHO opt_netgraph.h NETGRAPH_EIFACE opt_netgraph.h NETGRAPH_ETHER opt_netgraph.h NETGRAPH_ETHER_ECHO opt_netgraph.h NETGRAPH_FEC opt_netgraph.h NETGRAPH_FRAME_RELAY opt_netgraph.h NETGRAPH_GIF opt_netgraph.h NETGRAPH_GIF_DEMUX opt_netgraph.h NETGRAPH_HOLE opt_netgraph.h NETGRAPH_IFACE opt_netgraph.h NETGRAPH_IP_INPUT opt_netgraph.h NETGRAPH_IPFW opt_netgraph.h NETGRAPH_KSOCKET opt_netgraph.h NETGRAPH_L2TP opt_netgraph.h NETGRAPH_LMI opt_netgraph.h # MPPC compression requires proprietary files (not included) NETGRAPH_MPPC_COMPRESSION opt_netgraph.h NETGRAPH_MPPC_ENCRYPTION opt_netgraph.h NETGRAPH_NAT opt_netgraph.h NETGRAPH_NETFLOW opt_netgraph.h NETGRAPH_ONE2MANY opt_netgraph.h NETGRAPH_PATCH opt_netgraph.h NETGRAPH_PIPE opt_netgraph.h NETGRAPH_PPP opt_netgraph.h NETGRAPH_PPPOE opt_netgraph.h NETGRAPH_PPTPGRE opt_netgraph.h NETGRAPH_PRED1 opt_netgraph.h NETGRAPH_RFC1490 opt_netgraph.h NETGRAPH_SOCKET opt_netgraph.h NETGRAPH_SPLIT opt_netgraph.h NETGRAPH_SPPP opt_netgraph.h NETGRAPH_TAG opt_netgraph.h NETGRAPH_TCPMSS opt_netgraph.h NETGRAPH_TEE opt_netgraph.h NETGRAPH_TTY opt_netgraph.h NETGRAPH_UI opt_netgraph.h NETGRAPH_VJC opt_netgraph.h NETGRAPH_VLAN opt_netgraph.h # NgATM options NGATM_ATM opt_netgraph.h NGATM_ATMBASE opt_netgraph.h NGATM_SSCOP opt_netgraph.h NGATM_SSCFU opt_netgraph.h NGATM_UNI opt_netgraph.h NGATM_CCATM opt_netgraph.h # DRM options DRM_DEBUG opt_drm.h SOCKET_SEND_COW opt_zero.h SOCKET_RECV_PFLIP opt_zero.h TI_SF_BUF_JUMBO opt_ti.h TI_JUMBO_HDRSPLIT opt_ti.h # XXX Conflict: # of devices vs network protocol (Native ATM). # This makes "atm.h" unusable. NATM # DPT driver debug flags DPT_MEASURE_PERFORMANCE opt_dpt.h DPT_HANDLE_TIMEOUTS opt_dpt.h DPT_TIMEOUT_FACTOR opt_dpt.h DPT_LOST_IRQ opt_dpt.h DPT_RESET_HBA opt_dpt.h # Misc debug flags. Most of these should probably be replaced with # 'DEBUG', and then let people recompile just the interesting modules # with 'make CC="cc -DDEBUG"'. CLUSTERDEBUG opt_debug_cluster.h DEBUG_1284 opt_ppb_1284.h VP0_DEBUG opt_vpo.h LPT_DEBUG opt_lpt.h PLIP_DEBUG opt_plip.h LOCKF_DEBUG opt_debug_lockf.h NETATALKDEBUG opt_atalk.h SI_DEBUG opt_debug_si.h # Fb options FB_DEBUG opt_fb.h FB_INSTALL_CDEV opt_fb.h # ppbus related options PERIPH_1284 opt_ppb_1284.h DONTPROBE_1284 opt_ppb_1284.h # smbus related options ENABLE_ALART opt_intpm.h # These cause changes all over the kernel BLKDEV_IOSIZE opt_global.h BURN_BRIDGES opt_global.h DEBUG opt_global.h DEBUG_LOCKS opt_global.h DEBUG_VFS_LOCKS opt_global.h DFLTPHYS opt_global.h DIAGNOSTIC opt_global.h INVARIANT_SUPPORT opt_global.h INVARIANTS opt_global.h MAXCPU opt_global.h MAXPHYS opt_global.h MCLSHIFT opt_global.h MUTEX_DEBUG opt_global.h MUTEX_NOINLINE opt_global.h LOCK_PROFILING opt_global.h LOCK_PROFILING_FAST opt_global.h MSIZE opt_global.h REGRESSION opt_global.h RWLOCK_NOINLINE opt_global.h SX_NOINLINE opt_global.h VFS_BIO_DEBUG opt_global.h # These are VM related options VM_KMEM_SIZE opt_vm.h VM_KMEM_SIZE_SCALE opt_vm.h VM_KMEM_SIZE_MAX opt_vm.h VM_NDOMAIN opt_vm.h VM_NRESERVLEVEL opt_vm.h VM_LEVEL_0_ORDER opt_vm.h NO_SWAPPING opt_vm.h MALLOC_MAKE_FAILURES opt_vm.h MALLOC_PROFILE opt_vm.h MALLOC_DEBUG_MAXZONES opt_vm.h # The MemGuard replacement allocator used for tamper-after-free detection DEBUG_MEMGUARD opt_vm.h # The RedZone malloc(9) protection DEBUG_REDZONE opt_vm.h # Standard SMP options SMP opt_global.h # Size of the kernel message buffer MSGBUF_SIZE opt_msgbuf.h # NFS options NFS_MINATTRTIMO opt_nfs.h NFS_MAXATTRTIMO opt_nfs.h NFS_MINDIRATTRTIMO opt_nfs.h NFS_MAXDIRATTRTIMO opt_nfs.h NFS_GATHERDELAY opt_nfs.h NFS_WDELAYHASHSIZ opt_nfs.h NFS_DEBUG opt_nfs.h # For the Bt848/Bt848A/Bt849/Bt878/Bt879 driver OVERRIDE_CARD opt_bktr.h OVERRIDE_TUNER opt_bktr.h OVERRIDE_DBX opt_bktr.h OVERRIDE_MSP opt_bktr.h BROOKTREE_SYSTEM_DEFAULT opt_bktr.h BROOKTREE_ALLOC_PAGES opt_bktr.h BKTR_OVERRIDE_CARD opt_bktr.h BKTR_OVERRIDE_TUNER opt_bktr.h BKTR_OVERRIDE_DBX opt_bktr.h BKTR_OVERRIDE_MSP opt_bktr.h BKTR_SYSTEM_DEFAULT opt_bktr.h BKTR_ALLOC_PAGES opt_bktr.h BKTR_USE_PLL opt_bktr.h BKTR_GPIO_ACCESS opt_bktr.h BKTR_NO_MSP_RESET opt_bktr.h BKTR_430_FX_MODE opt_bktr.h BKTR_SIS_VIA_MODE opt_bktr.h BKTR_USE_FREEBSD_SMBUS opt_bktr.h BKTR_NEW_MSP34XX_DRIVER opt_bktr.h # Options to support PPS UART_PPS_ON_CTS opt_uart.h # options for bus/device framework BUS_DEBUG opt_bus.h # options for USB support USB_DEBUG opt_usb.h USB_HOST_ALIGN opt_usb.h USB_REQ_DEBUG opt_usb.h USB_VERBOSE opt_usb.h USB_EHCI_BIG_ENDIAN_DESC opt_usb.h U3G_DEBUG opt_u3g.h UKBD_DFLT_KEYMAP opt_ukbd.h UPLCOM_INTR_INTERVAL opt_uplcom.h UVSCOM_DEFAULT_OPKTSIZE opt_uvscom.h UVSCOM_INTR_INTERVAL opt_uvscom.h # Embedded system options INIT_PATH ROOTDEVNAME FDC_DEBUG opt_fdc.h PCFCLOCK_VERBOSE opt_pcfclock.h PCFCLOCK_MAX_RETRIES opt_pcfclock.h KTR opt_global.h KTR_ALQ opt_ktr.h KTR_MASK opt_ktr.h KTR_CPUMASK opt_ktr.h KTR_COMPILE opt_global.h KTR_BOOT_ENTRIES opt_global.h KTR_ENTRIES opt_global.h KTR_VERBOSE opt_ktr.h WITNESS opt_global.h WITNESS_KDB opt_witness.h WITNESS_SKIPSPIN opt_witness.h # options for ACPI support ACPI_DEBUG opt_acpi.h ACPI_MAX_TASKS opt_acpi.h ACPI_MAX_THREADS opt_acpi.h # ISA support DEV_ISA opt_isa.h ISAPNP opt_isa.h # various 'device presence' options. DEV_BPF opt_bpf.h DEV_NETMAP opt_global.h DEV_MCA opt_mca.h DEV_CARP opt_carp.h DEV_SPLASH opt_splash.h # EISA support DEV_EISA opt_eisa.h EISA_SLOTS opt_eisa.h # ed driver ED_HPP opt_ed.h ED_3C503 opt_ed.h ED_SIC opt_ed.h # bce driver BCE_DEBUG opt_bce.h BCE_NVRAM_WRITE_SUPPORT opt_bce.h # bxe driver BXE_DEBUG opt_bxe.h BXE_NVRAM_WRITE_SUPPORT opt_bxe.h SOCKBUF_DEBUG opt_global.h # options for ubsec driver UBSEC_DEBUG opt_ubsec.h UBSEC_RNDTEST opt_ubsec.h UBSEC_NO_RNG opt_ubsec.h # options for hifn driver HIFN_DEBUG opt_hifn.h HIFN_RNDTEST opt_hifn.h # options for safenet driver SAFE_DEBUG opt_safe.h SAFE_NO_RNG opt_safe.h SAFE_RNDTEST opt_safe.h # syscons options MAXCONS opt_syscons.h SC_ALT_MOUSE_IMAGE opt_syscons.h SC_CUT_SPACES2TABS opt_syscons.h SC_CUT_SEPCHARS opt_syscons.h SC_DEBUG_LEVEL opt_syscons.h SC_DFLT_FONT opt_syscons.h SC_DISABLE_KDBKEY opt_syscons.h SC_DISABLE_REBOOT opt_syscons.h SC_HISTORY_SIZE opt_syscons.h SC_KERNEL_CONS_ATTR opt_syscons.h SC_KERNEL_CONS_REV_ATTR opt_syscons.h SC_MOUSE_CHAR opt_syscons.h SC_NO_CUTPASTE opt_syscons.h SC_NO_FONT_LOADING opt_syscons.h SC_NO_HISTORY opt_syscons.h SC_NO_MODE_CHANGE opt_syscons.h SC_NO_SUSPEND_VTYSWITCH opt_syscons.h SC_NO_SYSMOUSE opt_syscons.h SC_NORM_ATTR opt_syscons.h SC_NORM_REV_ATTR opt_syscons.h SC_PIXEL_MODE opt_syscons.h SC_RENDER_DEBUG opt_syscons.h SC_TWOBUTTON_MOUSE opt_syscons.h # teken terminal emulator options TEKEN_CONS25 opt_teken.h TEKEN_UTF8 opt_teken.h # options for printf PRINTF_BUFR_SIZE opt_printf.h # kbd options KBD_DISABLE_KEYMAP_LOAD opt_kbd.h KBD_INSTALL_CDEV opt_kbd.h KBD_MAXRETRY opt_kbd.h KBD_MAXWAIT opt_kbd.h KBD_RESETDELAY opt_kbd.h KBDIO_DEBUG opt_kbd.h # options for the Atheros driver ATH_DEBUG opt_ath.h ATH_TXBUF opt_ath.h ATH_RXBUF opt_ath.h ATH_DIAGAPI opt_ath.h ATH_TX99_DIAG opt_ath.h ATH_ENABLE_11N opt_ath.h ATH_ENABLE_DFS opt_ath.h ATH_EEPROM_FIRMWARE opt_ath.h ATH_ENABLE_RADIOTAP_VENDOR_EXT opt_ath.h ATH_DEBUG_ALQ opt_ath.h ATH_KTR_INTR_DEBUG opt_ath.h # options for the Atheros hal AH_SUPPORT_AR5416 opt_ah.h # XXX For now, this breaks non-AR9130 chipsets, so only use it # XXX when actually targetting AR9130. AH_SUPPORT_AR9130 opt_ah.h AH_DEBUG opt_ah.h AH_ASSERT opt_ah.h AH_DEBUG_ALQ opt_ah.h AH_REGOPS_FUNC opt_ah.h AH_WRITE_REGDOMAIN opt_ah.h AH_DEBUG_COUNTRY opt_ah.h AH_WRITE_EEPROM opt_ah.h AH_PRIVATE_DIAG opt_ah.h AH_NEED_DESC_SWAP opt_ah.h AH_USE_INIPDGAIN opt_ah.h AH_MAXCHAN opt_ah.h AH_RXCFG_SDMAMW_4BYTES opt_ah.h AH_INTERRUPT_DEBUGGING opt_ah.h # AR5416 and later interrupt mitigation # XXX do not use this for AR9130 AH_AR5416_INTERRUPT_MITIGATION opt_ah.h # options for the Broadcom BCM43xx driver (bwi) BWI_DEBUG opt_bwi.h BWI_DEBUG_VERBOSE opt_bwi.h # options for the Marvell 8335 wireless driver MALO_DEBUG opt_malo.h MALO_TXBUF opt_malo.h MALO_RXBUF opt_malo.h # options for the Marvell wireless driver MWL_DEBUG opt_mwl.h MWL_TXBUF opt_mwl.h MWL_RXBUF opt_mwl.h MWL_DIAGAPI opt_mwl.h MWL_AGGR_SIZE opt_mwl.h MWL_TX_NODROP opt_mwl.h # dcons options DCONS_BUF_SIZE opt_dcons.h DCONS_POLL_HZ opt_dcons.h DCONS_FORCE_CONSOLE opt_dcons.h DCONS_FORCE_GDB opt_dcons.h # HWPMC options HWPMC_HOOKS HWPMC_MIPS_BACKTRACE opt_hwpmc_hooks.h # XBOX options for FreeBSD/i386, but some files are MI XBOX opt_xbox.h ZFS opt_dontuse.h # Interrupt filtering INTR_FILTER # 802.11 support layer IEEE80211_DEBUG opt_wlan.h IEEE80211_DEBUG_REFCNT opt_wlan.h IEEE80211_AMPDU_AGE opt_wlan.h IEEE80211_SUPPORT_MESH opt_wlan.h IEEE80211_SUPPORT_SUPERG opt_wlan.h IEEE80211_SUPPORT_TDMA opt_wlan.h IEEE80211_ALQ opt_wlan.h IEEE80211_DFS_DEBUG opt_wlan.h # 802.11 TDMA support TDMA_SLOTLEN_DEFAULT opt_tdma.h TDMA_SLOTCNT_DEFAULT opt_tdma.h TDMA_BINTVAL_DEFAULT opt_tdma.h TDMA_TXRATE_11B_DEFAULT opt_tdma.h TDMA_TXRATE_11G_DEFAULT opt_tdma.h TDMA_TXRATE_11A_DEFAULT opt_tdma.h TDMA_TXRATE_TURBO_DEFAULT opt_tdma.h TDMA_TXRATE_HALF_DEFAULT opt_tdma.h TDMA_TXRATE_QUARTER_DEFAULT opt_tdma.h TDMA_TXRATE_11NA_DEFAULT opt_tdma.h TDMA_TXRATE_11NG_DEFAULT opt_tdma.h # Network stack virtualization options VIMAGE opt_global.h VNET_DEBUG opt_global.h # Common Flash Interface (CFI) options CFI_SUPPORT_STRATAFLASH opt_cfi.h CFI_ARMEDANDDANGEROUS opt_cfi.h # Sound options SND_DEBUG opt_snd.h SND_DIAGNOSTIC opt_snd.h SND_FEEDER_MULTIFORMAT opt_snd.h SND_FEEDER_FULL_MULTIFORMAT opt_snd.h SND_FEEDER_RATE_HP opt_snd.h SND_PCM_64 opt_snd.h SND_OLDSTEREO opt_snd.h X86BIOS # Flattened device tree options FDT opt_platform.h FDT_DTB_STATIC opt_platform.h # OFED Infiniband stack OFED opt_ofed.h OFED_DEBUG_INIT opt_ofed.h SDP opt_ofed.h SDP_DEBUG opt_ofed.h IPOIB opt_ofed.h IPOIB_DEBUG opt_ofed.h IPOIB_CM opt_ofed.h # Resource Accounting RACCT opt_global.h # Resource Limits RCTL opt_global.h Index: head/sys/dev/ata/atapi-cd.h =================================================================== --- head/sys/dev/ata/atapi-cd.h (revision 249082) +++ head/sys/dev/ata/atapi-cd.h (nonexistent) @@ -1,315 +0,0 @@ -/*- - * Copyright (c) 1998 - 2008 Søren Schmidt - * 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. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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. - * - * $FreeBSD$ - */ - -/* CDROM Table Of Contents */ -#define MAXTRK 99 -struct toc { - struct ioc_toc_header hdr; - struct cd_toc_entry tab[MAXTRK + 1]; -}; - -/* DVD CSS authentication */ -struct dvd_miscauth { - u_int16_t length; - u_int16_t reserved; - u_int8_t data[2048]; -}; - -/* CDROM Audio Control Parameters Page */ -struct audiopage { - /* mode page data header */ - u_int16_t data_length; - u_int8_t medium_type; - u_int8_t dev_spec; - u_int8_t unused[2]; - u_int16_t blk_desc_len; - - /* audio control page */ - u_int8_t page_code; -#define ATAPI_CDROM_AUDIO_PAGE 0x0e -#define ATAPI_CDROM_AUDIO_PAGE_MASK 0x4e - - u_int8_t param_len; - u_int8_t flags; -#define CD_PA_SOTC 0x02 -#define CD_PA_IMMED 0x04 - - u_int8_t reserved3; - u_int8_t reserved4; - u_int8_t reserved5; - u_int16_t lb_per_sec; - struct port_control { - u_int8_t channels:4; -#define CHANNEL_0 1 -#define CHANNEL_1 2 -#define CHANNEL_2 4 -#define CHANNEL_3 8 - - u_int8_t volume; - } port[4]; -}; - - -/* CDROM Capabilities and Mechanical Status Page */ -struct cappage { - /* mode page data header */ - u_int16_t data_length; - u_int8_t medium_type; -#define MST_TYPE_MASK_LOW 0x0f -#define MST_FMT_NONE 0x00 -#define MST_DATA_120 0x01 -#define MST_AUDIO_120 0x02 -#define MST_COMB_120 0x03 -#define MST_PHOTO_120 0x04 -#define MST_DATA_80 0x05 -#define MST_AUDIO_80 0x06 -#define MST_COMB_80 0x07 -#define MST_PHOTO_80 0x08 - -#define MST_TYPE_MASK_HIGH 0x70 -#define MST_CDROM 0x00 -#define MST_CDR 0x10 -#define MST_CDRW 0x20 -#define MST_DVD 0x40 - -#define MST_NO_DISC 0x70 -#define MST_DOOR_OPEN 0x71 -#define MST_FMT_ERROR 0x72 - - u_int8_t dev_spec; - u_int16_t unused; - u_int16_t blk_desc_len; - - /* capabilities page */ - u_int8_t page_code; -#define ATAPI_CDROM_CAP_PAGE 0x2a - - u_int8_t param_len; - - u_int16_t media; -#define MST_READ_CDR 0x0100 -#define MST_READ_CDRW 0x0200 -#define MST_READ_PACKET 0x0400 -#define MST_READ_DVDROM 0x0800 -#define MST_READ_DVDR 0x1000 -#define MST_READ_DVDRAM 0x2000 -#define MST_WRITE_CDR 0x0001 -#define MST_WRITE_CDRW 0x0002 -#define MST_WRITE_TEST 0x0004 -#define MST_WRITE_DVDR 0x0010 -#define MST_WRITE_DVDRAM 0x0020 - - u_int16_t capabilities; -#define MST_AUDIO_PLAY 0x0100 -#define MST_COMPOSITE 0x0200 -#define MST_AUDIO_P1 0x0400 -#define MST_AUDIO_P2 0x0800 -#define MST_MODE2_f1 0x1000 -#define MST_MODE2_f2 0x2000 -#define MST_MULTISESSION 0x4000 -#define MST_BURNPROOF 0x8000 -#define MST_READ_CDDA 0x0001 -#define MST_CDDA_STREAM 0x0002 -#define MST_COMBINED_RW 0x0004 -#define MST_CORRECTED_RW 0x0008 -#define MST_SUPPORT_C2 0x0010 -#define MST_ISRC 0x0020 -#define MST_UPC 0x0040 - - u_int8_t mechanism; -#define MST_LOCKABLE 0x01 -#define MST_LOCKED 0x02 -#define MST_PREVENT 0x04 -#define MST_EJECT 0x08 -#define MST_MECH_MASK 0xe0 -#define MST_MECH_CADDY 0x00 -#define MST_MECH_TRAY 0x20 -#define MST_MECH_POPUP 0x40 -#define MST_MECH_CHANGER 0x80 -#define MST_MECH_CARTRIDGE 0xa0 - - uint8_t audio; -#define MST_SEP_VOL 0x01 -#define MST_SEP_MUTE 0x02 - - u_int16_t max_read_speed; /* max raw data rate in bytes/1000 */ - u_int16_t max_vol_levels; /* number of discrete volume levels */ - u_int16_t buf_size; /* internal buffer size in bytes/1024 */ - u_int16_t cur_read_speed; /* current data rate in bytes/1000 */ - - u_int8_t reserved3; - u_int8_t misc; - - u_int16_t max_write_speed; /* max raw data rate in bytes/1000 */ - u_int16_t cur_write_speed; /* current data rate in bytes/1000 */ - u_int16_t copy_protect_rev; - u_int16_t reserved4; -}; - -#define CH_READY 0 -#define CH_LOADING 1 -#define CH_UNLOADING 2 -#define CH_INITIALIZING 3 - -#define CD_IDLE 0 -#define CD_AUDIO_ACTIVE 1 -#define CD_AUDIO_SCAN 2 -#define CD_HOST_ACTIVE 3 -#define CD_NO_STATE 7 - -/* CDROM Changer mechanism status structure */ -struct changer { - u_int8_t current_slot :5; /* active changer slot */ - u_int8_t mech_state :2; /* current changer state */ - - u_int8_t fault :1; /* fault in last operation */ - u_int8_t reserved0 :5; - u_int8_t cd_state :3; /* current mechanism state */ - - u_int8_t current_lba[3]; /* current LBA */ - u_int8_t slots; /* number of available slots */ - u_int16_t table_length; /* slot table length */ - struct { - u_int8_t changed :1; /* media has changed in this slot */ - u_int8_t unused :6; - u_int8_t present :1; /* slot has a CD present */ - u_int8_t reserved0; - u_int8_t reserved1; - u_int8_t reserved2; - } slot[32]; -}; - -/* CDROM Write Parameters Mode Page (Burners ONLY) */ -struct write_param { - /* mode page data header */ - u_int16_t data_length; - u_int8_t medium_type; - u_int8_t dev_spec; - u_int8_t unused[2]; - u_int16_t blk_desc_len; - - /* write parameters page */ - u_int8_t page_code; -#define ATAPI_CDROM_WRITE_PARAMETERS_PAGE 0x05 - - u_int8_t page_length; /* 0x32 */ - u_int8_t write_type :4; /* write stream type */ -#define CDR_WTYPE_PACKET 0x00 -#define CDR_WTYPE_TRACK 0x01 -#define CDR_WTYPE_SESSION 0x02 -#define CDR_WTYPE_RAW 0x03 - - u_int8_t test_write :1; /* test write enable */ - u_int8_t link_size_valid :1; - u_int8_t burnproof :1; /* BurnProof enable */ - u_int8_t reserved2_7 :1; - u_int8_t track_mode :4; /* track mode */ -#define CDR_TMODE_AUDIO 0x00 -#define CDR_TMODE_AUDIO_PREEMP 0x01 -#define CDR_TMODE_ALLOW_COPY 0x02 -#define CDR_TMODE_DATA 0x04 -#define CDR_TMODE_QUAD_AUDIO 0x08 - - u_int8_t copy :1; /* generation stamp */ - u_int8_t fp :1; /* fixed packet type */ - u_int8_t session_type :2; /* session type */ -#define CDR_SESS_NONE 0x00 -#define CDR_SESS_FINAL 0x01 -#define CDR_SESS_RESERVED 0x02 -#define CDR_SESS_MULTI 0x03 - - u_int8_t datablock_type :4; /* data type code (see cdrio.h) */ - u_int8_t reserved4_4567 :4; - u_int8_t link_size; - u_int8_t reserved6; - u_int8_t host_app_code :6; /* host application code */ - u_int8_t reserved7_67 :2; - u_int8_t session_format; /* session format */ -#define CDR_SESS_CDROM 0x00 -#define CDR_SESS_CDI 0x10 -#define CDR_SESS_CDROM_XA 0x20 - - u_int8_t reserved9; - u_int32_t packet_size; /* packet size in bytes */ - u_int16_t audio_pause_length; /* audio pause length in secs */ - u_int8_t media_catalog_number[16]; - u_int8_t isr_code[16]; - u_int8_t sub_hdr_byte0; - u_int8_t sub_hdr_byte1; - u_int8_t sub_hdr_byte2; - u_int8_t sub_hdr_byte3; - u_int8_t vendor_specific_byte0; - u_int8_t vendor_specific_byte1; - u_int8_t vendor_specific_byte2; - u_int8_t vendor_specific_byte3; -} __packed; - -/* CDROM Read Track Information structure */ -struct acd_track_info { - u_int16_t data_length; - u_int8_t track_number; /* current track number */ - u_int8_t session_number; /* current session number */ - u_int8_t reserved4; - u_int8_t track_mode :4; /* mode of this track */ - u_int8_t copy :1; /* generation stamp */ - u_int8_t damage :1; /* damaged track */ - u_int8_t reserved5_67 :2; - u_int8_t data_mode :4; /* data mode of this disc */ - u_int8_t fp :1; /* fixed packet */ - u_int8_t packet :1; /* packet track */ - u_int8_t blank :1; /* blank (empty) track */ - u_int8_t rt :1; /* reserved track */ - u_int8_t nwa_valid :1; /* next_writeable_addr field valid */ - u_int8_t reserved7_17 :7; - u_int track_start_addr; /* start of this track */ - u_int next_writeable_addr; /* next writeable addr on this disc */ - u_int free_blocks; /* free block on this disc */ - u_int fixed_packet_size; /* size of packets on this track */ - u_int track_length; /* length of this track */ -}; - -/* Structure describing an ATAPI CDROM device */ -struct acd_softc { - int flags; /* device state flags */ -#define F_LOCKED 0x0001 /* this unit is locked */ - - struct toc toc; /* table of disc contents */ - struct audiopage au; /* audio page info */ - struct audiopage aumask; /* audio page mask */ - struct cappage cap; /* capabilities page info */ - struct cd_sub_channel_info subchan; /* subchannel info */ - struct changer *changer_info; /* changer info */ - struct acd_softc **driver; /* softc's of changer slots */ - int slot; /* this instance slot number */ - time_t timestamp; /* this instance timestamp */ - u_int32_t disk_size; /* size of current media */ - u_int32_t block_size; /* blocksize currently used */ - u_int32_t iomax; /* Max I/O request (bytes) */ - struct g_geom *gp; /* geom instance */ - struct g_provider *pp[MAXTRK+1]; /* providers */ -}; Property changes on: head/sys/dev/ata/atapi-cd.h ___________________________________________________________________ Deleted: svn:keywords ## -1 +0,0 ## -FreeBSD=%H \ No newline at end of property Index: head/sys/dev/ata/atapi-fd.h =================================================================== --- head/sys/dev/ata/atapi-fd.h (revision 249082) +++ head/sys/dev/ata/atapi-fd.h (nonexistent) @@ -1,86 +0,0 @@ -/*- - * Copyright (c) 1998 - 2008 Søren Schmidt - * 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. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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. - * - * $FreeBSD$ - */ - -/* ATAPI Rewriteable drive Capabilities and Mechanical Status Page */ -struct afd_capabilities { - u_int16_t data_length; - u_int8_t medium_type; -#define MFD_2DD_UN 0x10 -#define MFD_2DD 0x11 -#define MFD_HD_UN 0x20 -#define MFD_HD_12_98 0x22 -#define MFD_HD_12 0x23 -#define MFD_HD_144 0x24 -#define MFD_UHD 0x31 - -#define MFD_UNKNOWN 0x00 -#define MFD_NO_DISC 0x70 -#define MFD_DOOR_OPEN 0x71 -#define MFD_FMT_ERROR 0x72 - - u_int8_t reserved0 :7; - u_int8_t wp :1; /* write protect */ - u_int8_t unused[4]; - - /* capabilities page */ - u_int8_t page_code :6; -#define ATAPI_REWRITEABLE_CAP_PAGE 0x05 - - u_int8_t reserved1_6 :1; - u_int8_t ps :1; /* page save supported */ - u_int8_t page_length; /* page length */ - u_int16_t transfer_rate; /* in kilobits per second */ - u_int8_t heads; /* number of heads */ - u_int8_t sectors; /* number of sectors pr track */ - u_int16_t sector_size; /* number of bytes per sector */ - u_int16_t cylinders; /* number of cylinders */ - u_int8_t reserved10[10]; - u_int8_t motor_delay; /* motor off delay */ - u_int8_t reserved21[7]; - u_int16_t rpm; /* rotations per minute */ - u_int8_t reserved30[2]; -}; - -struct afd_capacity { - u_int32_t capacity; - u_int32_t blocksize; -}; - -struct afd_capacity_big { - u_int64_t capacity; - u_int32_t blocksize; -}; - -struct afd_softc { - u_int64_t mediasize; - u_int32_t heads; - u_int32_t sectors; - u_int32_t sectorsize; - struct disk *disk; /* virtual drives */ -}; - Property changes on: head/sys/dev/ata/atapi-fd.h ___________________________________________________________________ Deleted: svn:keywords ## -1 +0,0 ## -FreeBSD=%H \ No newline at end of property Index: head/sys/dev/ata/ata-disk.h =================================================================== --- head/sys/dev/ata/ata-disk.h (revision 249082) +++ head/sys/dev/ata/ata-disk.h (nonexistent) @@ -1,47 +0,0 @@ -/*- - * Copyright (c) 1998 - 2008 Søren Schmidt - * 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. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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. - * - * $FreeBSD$ - */ - -/* structure describing an ATA disk */ -struct ad_softc { - u_int64_t total_secs; /* total # of sectors (LBA) */ - u_int8_t heads; - u_int8_t sectors; - u_int32_t transfersize; /* size of each transfer */ - int num_tags; /* number of tags supported */ - int flags; /* drive flags */ -#define AD_F_LABELLING 0x0001 -#define AD_F_CHS_USED 0x0002 -#define AD_F_32B_ENABLED 0x0004 -#define AD_F_TAG_ENABLED 0x0008 -#define AD_F_RAID_SUBDISK 0x0010 - - struct disk *disk; /* disklabel/slice stuff */ -}; - -extern devclass_t ad_devclass; - Property changes on: head/sys/dev/ata/ata-disk.h ___________________________________________________________________ Deleted: svn:keywords ## -1 +0,0 ## -FreeBSD=%H \ No newline at end of property Index: head/sys/dev/ata/ata-raid.c =================================================================== --- head/sys/dev/ata/ata-raid.c (revision 249082) +++ head/sys/dev/ata/ata-raid.c (nonexistent) @@ -1,5462 +0,0 @@ -/*- - * Copyright (c) 2000 - 2008 Søren Schmidt - * 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. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include "opt_ata.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* prototypes */ -static void ata_raid_done(struct ata_request *request); -static void ata_raid_config_changed(struct ar_softc *rdp, int writeback); -static int ata_raid_status(struct ata_ioc_raid_status *status); -static int ata_raid_create(struct ata_ioc_raid_config *config); -static int ata_raid_delete(int array); -static int ata_raid_addspare(struct ata_ioc_raid_config *config); -static int ata_raid_rebuild(int array); -static int ata_raid_read_metadata(device_t subdisk); -static int ata_raid_write_metadata(struct ar_softc *rdp); -static int ata_raid_wipe_metadata(struct ar_softc *rdp); -static int ata_raid_adaptec_read_meta(device_t dev, struct ar_softc **raidp); -static int ata_raid_ddf_read_meta(device_t dev, struct ar_softc **raidp); -static int ata_raid_hptv2_read_meta(device_t dev, struct ar_softc **raidp); -static int ata_raid_hptv2_write_meta(struct ar_softc *rdp); -static int ata_raid_hptv3_read_meta(device_t dev, struct ar_softc **raidp); -static int ata_raid_intel_read_meta(device_t dev, struct ar_softc **raidp); -static int ata_raid_intel_write_meta(struct ar_softc *rdp); -static int ata_raid_ite_read_meta(device_t dev, struct ar_softc **raidp); -static int ata_raid_jmicron_read_meta(device_t dev, struct ar_softc **raidp); -static int ata_raid_jmicron_write_meta(struct ar_softc *rdp); -static int ata_raid_lsiv2_read_meta(device_t dev, struct ar_softc **raidp); -static int ata_raid_lsiv3_read_meta(device_t dev, struct ar_softc **raidp); -static int ata_raid_nvidia_read_meta(device_t dev, struct ar_softc **raidp); -static int ata_raid_promise_read_meta(device_t dev, struct ar_softc **raidp, int native); -static int ata_raid_promise_write_meta(struct ar_softc *rdp); -static int ata_raid_sii_read_meta(device_t dev, struct ar_softc **raidp); -static int ata_raid_sis_read_meta(device_t dev, struct ar_softc **raidp); -static int ata_raid_sis_write_meta(struct ar_softc *rdp); -static int ata_raid_via_read_meta(device_t dev, struct ar_softc **raidp); -static int ata_raid_via_write_meta(struct ar_softc *rdp); -static struct ata_request *ata_raid_init_request(device_t dev, struct ar_softc *rdp, struct bio *bio); -static int ata_raid_send_request(struct ata_request *request); -static int ata_raid_rw(device_t dev, u_int64_t lba, void *data, u_int bcount, int flags); -static char * ata_raid_format(struct ar_softc *rdp); -static char * ata_raid_type(struct ar_softc *rdp); -static char * ata_raid_flags(struct ar_softc *rdp); - -/* debugging only */ -static void ata_raid_print_meta(struct ar_softc *meta); -static void ata_raid_adaptec_print_meta(struct adaptec_raid_conf *meta); -static void ata_raid_ddf_print_meta(uint8_t *meta); -static void ata_raid_hptv2_print_meta(struct hptv2_raid_conf *meta); -static void ata_raid_hptv3_print_meta(struct hptv3_raid_conf *meta); -static void ata_raid_intel_print_meta(struct intel_raid_conf *meta); -static void ata_raid_ite_print_meta(struct ite_raid_conf *meta); -static void ata_raid_jmicron_print_meta(struct jmicron_raid_conf *meta); -static void ata_raid_lsiv2_print_meta(struct lsiv2_raid_conf *meta); -static void ata_raid_lsiv3_print_meta(struct lsiv3_raid_conf *meta); -static void ata_raid_nvidia_print_meta(struct nvidia_raid_conf *meta); -static void ata_raid_promise_print_meta(struct promise_raid_conf *meta); -static void ata_raid_sii_print_meta(struct sii_raid_conf *meta); -static void ata_raid_sis_print_meta(struct sis_raid_conf *meta); -static void ata_raid_via_print_meta(struct via_raid_conf *meta); - -/* internal vars */ -static struct ar_softc *ata_raid_arrays[MAX_ARRAYS]; -static MALLOC_DEFINE(M_AR, "ar_driver", "ATA PseudoRAID driver"); -static devclass_t ata_raid_sub_devclass; -static int testing = 0; - -/* device structures */ -static disk_strategy_t ata_raid_strategy; -static dumper_t ata_raid_dump; - -static void -ata_raid_attach(struct ar_softc *rdp, int writeback) -{ - char buffer[32]; - int disk; - - mtx_init(&rdp->lock, "ATA PseudoRAID metadata lock", NULL, MTX_DEF); - ata_raid_config_changed(rdp, writeback); - - /* sanitize arrays total_size % (width * interleave) == 0 */ - if (rdp->type == AR_T_RAID0 || rdp->type == AR_T_RAID01 || - rdp->type == AR_T_RAID5) { - rdp->total_sectors = (rdp->total_sectors/(rdp->interleave*rdp->width))* - (rdp->interleave * rdp->width); - sprintf(buffer, " (stripe %d KB)", - (rdp->interleave * DEV_BSIZE) / 1024); - } - else - buffer[0] = '\0'; - rdp->disk = disk_alloc(); - rdp->disk->d_strategy = ata_raid_strategy; - rdp->disk->d_dump = ata_raid_dump; - rdp->disk->d_name = "ar"; - rdp->disk->d_sectorsize = DEV_BSIZE; - rdp->disk->d_mediasize = (off_t)rdp->total_sectors * DEV_BSIZE; - rdp->disk->d_fwsectors = rdp->sectors; - rdp->disk->d_fwheads = rdp->heads; - rdp->disk->d_maxsize = 128 * DEV_BSIZE; - rdp->disk->d_drv1 = rdp; - rdp->disk->d_unit = rdp->lun; - /* we support flushing cache if all components support it */ - /* XXX: not all components can be connected at this point */ - rdp->disk->d_flags = DISKFLAG_CANFLUSHCACHE; - for (disk = 0; disk < rdp->total_disks; disk++) { - struct ata_device *atadev; - - if (rdp->disks[disk].dev == NULL) - continue; - if ((atadev = device_get_softc(rdp->disks[disk].dev)) == NULL) - continue; - if (atadev->param.support.command2 & ATA_SUPPORT_FLUSHCACHE) - continue; - rdp->disk->d_flags = 0; - break; - } - disk_create(rdp->disk, DISK_VERSION); - - printf("ar%d: %juMB <%s %s%s> status: %s\n", rdp->lun, - rdp->total_sectors / ((1024L * 1024L) / DEV_BSIZE), - ata_raid_format(rdp), ata_raid_type(rdp), - buffer, ata_raid_flags(rdp)); - - if (testing || bootverbose) - printf("ar%d: %ju sectors [%dC/%dH/%dS] <%s> subdisks defined as:\n", - rdp->lun, rdp->total_sectors, - rdp->cylinders, rdp->heads, rdp->sectors, rdp->name); - - for (disk = 0; disk < rdp->total_disks; disk++) { - printf("ar%d: disk%d ", rdp->lun, disk); - if (rdp->disks[disk].dev) { - if (rdp->disks[disk].flags & AR_DF_PRESENT) { - /* status of this disk in the array */ - if (rdp->disks[disk].flags & AR_DF_ONLINE) - printf("READY "); - else if (rdp->disks[disk].flags & AR_DF_SPARE) - printf("SPARE "); - else - printf("FREE "); - - /* what type of disk is this in the array */ - switch (rdp->type) { - case AR_T_RAID1: - case AR_T_RAID01: - if (disk < rdp->width) - printf("(master) "); - else - printf("(mirror) "); - } - - /* which physical disk is used */ - printf("using %s at ata%d-%s\n", - device_get_nameunit(rdp->disks[disk].dev), - device_get_unit(device_get_parent(rdp->disks[disk].dev)), - (((struct ata_device *) - device_get_softc(rdp->disks[disk].dev))->unit == - ATA_MASTER) ? "master" : "slave"); - } - else if (rdp->disks[disk].flags & AR_DF_ASSIGNED) - printf("DOWN\n"); - else - printf("INVALID no RAID config on this subdisk\n"); - } - else - printf("DOWN no device found for this subdisk\n"); - } -} - -static int -ata_raid_ioctl(u_long cmd, caddr_t data) -{ - struct ata_ioc_raid_status *status = (struct ata_ioc_raid_status *)data; - struct ata_ioc_raid_config *config = (struct ata_ioc_raid_config *)data; - int *lun = (int *)data; - int error = EOPNOTSUPP; - - switch (cmd) { - case IOCATARAIDSTATUS: - error = ata_raid_status(status); - break; - - case IOCATARAIDCREATE: - error = ata_raid_create(config); - break; - - case IOCATARAIDDELETE: - error = ata_raid_delete(*lun); - break; - - case IOCATARAIDADDSPARE: - error = ata_raid_addspare(config); - break; - - case IOCATARAIDREBUILD: - error = ata_raid_rebuild(*lun); - break; - } - return error; -} - -static int -ata_raid_flush(struct bio *bp) -{ - struct ar_softc *rdp = bp->bio_disk->d_drv1; - struct ata_request *request; - device_t dev; - int disk, error; - - error = 0; - bp->bio_pflags = 0; - - for (disk = 0; disk < rdp->total_disks; disk++) { - if ((dev = rdp->disks[disk].dev) != NULL) - bp->bio_pflags++; - } - for (disk = 0; disk < rdp->total_disks; disk++) { - if ((dev = rdp->disks[disk].dev) == NULL) - continue; - if (!(request = ata_raid_init_request(dev, rdp, bp))) - return ENOMEM; - request->dev = dev; - request->u.ata.command = ATA_FLUSHCACHE; - request->u.ata.lba = 0; - request->u.ata.count = 0; - request->u.ata.feature = 0; - request->timeout = ATA_REQUEST_TIMEOUT; - request->retries = 0; - request->flags |= ATA_R_ORDERED | ATA_R_DIRECT; - ata_queue_request(request); - } - return 0; -} - -static void -ata_raid_strategy(struct bio *bp) -{ - struct ar_softc *rdp = bp->bio_disk->d_drv1; - struct ata_request *request; - caddr_t data; - u_int64_t blkno, lba, blk = 0; - int count, chunk, drv, par = 0, change = 0; - - if (bp->bio_cmd == BIO_FLUSH) { - int error; - - error = ata_raid_flush(bp); - if (error != 0) - biofinish(bp, NULL, error); - return; - } - - if (!(rdp->status & AR_S_READY) || - (bp->bio_cmd != BIO_READ && bp->bio_cmd != BIO_WRITE)) { - biofinish(bp, NULL, EIO); - return; - } - - bp->bio_resid = bp->bio_bcount; - for (count = howmany(bp->bio_bcount, DEV_BSIZE), - blkno = bp->bio_pblkno, data = bp->bio_data; - count > 0; - count -= chunk, blkno += chunk, data += (chunk * DEV_BSIZE)) { - - switch (rdp->type) { - case AR_T_RAID1: - drv = 0; - lba = blkno; - chunk = count; - break; - - case AR_T_JBOD: - case AR_T_SPAN: - drv = 0; - lba = blkno; - while (lba >= rdp->disks[drv].sectors) - lba -= rdp->disks[drv++].sectors; - chunk = min(rdp->disks[drv].sectors - lba, count); - break; - - case AR_T_RAID0: - case AR_T_RAID01: - chunk = blkno % rdp->interleave; - drv = (blkno / rdp->interleave) % rdp->width; - lba = (((blkno/rdp->interleave)/rdp->width)*rdp->interleave)+chunk; - chunk = min(count, rdp->interleave - chunk); - break; - - case AR_T_RAID5: - drv = (blkno / rdp->interleave) % (rdp->width - 1); - par = rdp->width - 1 - - (blkno / (rdp->interleave * (rdp->width - 1))) % rdp->width; - if (drv >= par) - drv++; - lba = ((blkno/rdp->interleave)/(rdp->width-1))*(rdp->interleave) + - ((blkno%(rdp->interleave*(rdp->width-1)))%rdp->interleave); - chunk = min(count, rdp->interleave - (lba % rdp->interleave)); - break; - - default: - printf("ar%d: unknown array type in ata_raid_strategy\n", rdp->lun); - biofinish(bp, NULL, EIO); - return; - } - - /* offset on all but "first on HPTv2" */ - if (!(drv == 0 && rdp->format == AR_F_HPTV2_RAID)) - lba += rdp->offset_sectors; - - if (!(request = ata_raid_init_request(rdp->disks[drv].dev, rdp, bp))) { - biofinish(bp, NULL, EIO); - return; - } - request->data = data; - request->bytecount = chunk * DEV_BSIZE; - request->u.ata.lba = lba; - request->u.ata.count = request->bytecount / DEV_BSIZE; - - switch (rdp->type) { - case AR_T_JBOD: - case AR_T_SPAN: - case AR_T_RAID0: - if (((rdp->disks[drv].flags & (AR_DF_PRESENT|AR_DF_ONLINE)) == - (AR_DF_PRESENT|AR_DF_ONLINE) && !rdp->disks[drv].dev)) { - rdp->disks[drv].flags &= ~AR_DF_ONLINE; - ata_raid_config_changed(rdp, 1); - ata_free_request(request); - biofinish(bp, NULL, EIO); - return; - } - request->this = drv; - request->dev = rdp->disks[drv].dev; - ata_raid_send_request(request); - break; - - case AR_T_RAID1: - case AR_T_RAID01: - if ((rdp->disks[drv].flags & - (AR_DF_PRESENT|AR_DF_ONLINE))==(AR_DF_PRESENT|AR_DF_ONLINE) && - !rdp->disks[drv].dev) { - rdp->disks[drv].flags &= ~AR_DF_ONLINE; - change = 1; - } - if ((rdp->disks[drv + rdp->width].flags & - (AR_DF_PRESENT|AR_DF_ONLINE))==(AR_DF_PRESENT|AR_DF_ONLINE) && - !rdp->disks[drv + rdp->width].dev) { - rdp->disks[drv + rdp->width].flags &= ~AR_DF_ONLINE; - change = 1; - } - if (change) - ata_raid_config_changed(rdp, 1); - if (!(rdp->status & AR_S_READY)) { - ata_free_request(request); - biofinish(bp, NULL, EIO); - return; - } - - if (rdp->status & AR_S_REBUILDING) - blk = ((lba / rdp->interleave) * rdp->width) * rdp->interleave + - (rdp->interleave * (drv % rdp->width)) + - lba % rdp->interleave; - - if (bp->bio_cmd == BIO_READ) { - int src_online = - (rdp->disks[drv].flags & AR_DF_ONLINE); - int mir_online = - (rdp->disks[drv+rdp->width].flags & AR_DF_ONLINE); - - /* if mirror gone or close to last access on source */ - if (!mir_online || - ((src_online) && - bp->bio_pblkno >= - (rdp->disks[drv].last_lba - AR_PROXIMITY) && - bp->bio_pblkno <= - (rdp->disks[drv].last_lba + AR_PROXIMITY))) { - rdp->toggle = 0; - } - /* if source gone or close to last access on mirror */ - else if (!src_online || - ((mir_online) && - bp->bio_pblkno >= - (rdp->disks[drv+rdp->width].last_lba-AR_PROXIMITY) && - bp->bio_pblkno <= - (rdp->disks[drv+rdp->width].last_lba+AR_PROXIMITY))) { - drv += rdp->width; - rdp->toggle = 1; - } - /* not close to any previous access, toggle */ - else { - if (rdp->toggle) - rdp->toggle = 0; - else { - drv += rdp->width; - rdp->toggle = 1; - } - } - - if ((rdp->status & AR_S_REBUILDING) && - (blk <= rdp->rebuild_lba) && - ((blk + chunk) > rdp->rebuild_lba)) { - struct ata_composite *composite; - struct ata_request *rebuild; - int this; - - /* figure out what part to rebuild */ - if (drv < rdp->width) - this = drv + rdp->width; - else - this = drv - rdp->width; - - /* do we have a spare to rebuild on ? */ - if (rdp->disks[this].flags & AR_DF_SPARE) { - if ((composite = ata_alloc_composite())) { - if ((rebuild = ata_raid_init_request( - rdp->disks[this].dev, rdp, bp))) { - rdp->rebuild_lba = blk + chunk; - rebuild->data = request->data; - rebuild->bytecount = request->bytecount; - rebuild->u.ata.lba = request->u.ata.lba; - rebuild->u.ata.count = request->u.ata.count; - rebuild->this = this; - rebuild->flags &= ~ATA_R_READ; - rebuild->flags |= ATA_R_WRITE; - mtx_init(&composite->lock, - "ATA PseudoRAID rebuild lock", - NULL, MTX_DEF); - composite->residual = request->bytecount; - composite->rd_needed |= (1 << drv); - composite->wr_depend |= (1 << drv); - composite->wr_needed |= (1 << this); - composite->request[drv] = request; - composite->request[this] = rebuild; - request->composite = composite; - rebuild->composite = composite; - ata_raid_send_request(rebuild); - } - else { - ata_free_composite(composite); - printf("DOH! ata_alloc_request failed!\n"); - } - } - else { - printf("DOH! ata_alloc_composite failed!\n"); - } - } - else if (rdp->disks[this].flags & AR_DF_ONLINE) { - /* - * if we got here we are a chunk of a RAID01 that - * does not need a rebuild, but we need to increment - * the rebuild_lba address to get the rebuild to - * move to the next chunk correctly - */ - rdp->rebuild_lba = blk + chunk; - } - else - printf("DOH! we didn't find the rebuild part\n"); - } - } - if (bp->bio_cmd == BIO_WRITE) { - if ((rdp->disks[drv+rdp->width].flags & AR_DF_ONLINE) || - ((rdp->status & AR_S_REBUILDING) && - (rdp->disks[drv+rdp->width].flags & AR_DF_SPARE) && - ((blk < rdp->rebuild_lba) || - ((blk <= rdp->rebuild_lba) && - ((blk + chunk) > rdp->rebuild_lba))))) { - if ((rdp->disks[drv].flags & AR_DF_ONLINE) || - ((rdp->status & AR_S_REBUILDING) && - (rdp->disks[drv].flags & AR_DF_SPARE) && - ((blk < rdp->rebuild_lba) || - ((blk <= rdp->rebuild_lba) && - ((blk + chunk) > rdp->rebuild_lba))))) { - struct ata_request *mirror; - struct ata_composite *composite; - int this = drv + rdp->width; - - if ((composite = ata_alloc_composite())) { - if ((mirror = ata_raid_init_request( - rdp->disks[this].dev, rdp, bp))) { - if ((blk <= rdp->rebuild_lba) && - ((blk + chunk) > rdp->rebuild_lba)) - rdp->rebuild_lba = blk + chunk; - mirror->data = request->data; - mirror->bytecount = request->bytecount; - mirror->u.ata.lba = request->u.ata.lba; - mirror->u.ata.count = request->u.ata.count; - mirror->this = this; - mtx_init(&composite->lock, - "ATA PseudoRAID mirror lock", - NULL, MTX_DEF); - composite->residual = request->bytecount; - composite->wr_needed |= (1 << drv); - composite->wr_needed |= (1 << this); - composite->request[drv] = request; - composite->request[this] = mirror; - request->composite = composite; - mirror->composite = composite; - ata_raid_send_request(mirror); - rdp->disks[this].last_lba = - bp->bio_pblkno + chunk; - } - else { - ata_free_composite(composite); - printf("DOH! ata_alloc_request failed!\n"); - } - } - else { - printf("DOH! ata_alloc_composite failed!\n"); - } - } - else - drv += rdp->width; - } - } - request->this = drv; - request->dev = rdp->disks[request->this].dev; - ata_raid_send_request(request); - rdp->disks[request->this].last_lba = bp->bio_pblkno + chunk; - break; - - case AR_T_RAID5: - if (((rdp->disks[drv].flags & (AR_DF_PRESENT|AR_DF_ONLINE)) == - (AR_DF_PRESENT|AR_DF_ONLINE) && !rdp->disks[drv].dev)) { - rdp->disks[drv].flags &= ~AR_DF_ONLINE; - change = 1; - } - if (((rdp->disks[par].flags & (AR_DF_PRESENT|AR_DF_ONLINE)) == - (AR_DF_PRESENT|AR_DF_ONLINE) && !rdp->disks[par].dev)) { - rdp->disks[par].flags &= ~AR_DF_ONLINE; - change = 1; - } - if (change) - ata_raid_config_changed(rdp, 1); - if (!(rdp->status & AR_S_READY)) { - ata_free_request(request); - biofinish(bp, NULL, EIO); - return; - } - if (rdp->status & AR_S_DEGRADED) { - /* do the XOR game if possible */ - } - else { - request->this = drv; - request->dev = rdp->disks[request->this].dev; - if (bp->bio_cmd == BIO_READ) { - ata_raid_send_request(request); - } - if (bp->bio_cmd == BIO_WRITE) { - ata_raid_send_request(request); - // sikre at læs-modify-skriv til hver disk er atomarisk. - // par kopi af request - // læse orgdata fra drv - // skriv nydata til drv - // læse parorgdata fra par - // skriv orgdata xor parorgdata xor nydata til par - } - } - break; - - default: - printf("ar%d: unknown array type in ata_raid_strategy\n", rdp->lun); - } - } -} - -static void -ata_raid_done(struct ata_request *request) -{ - struct ar_softc *rdp = request->driver; - struct ata_composite *composite = NULL; - struct bio *bp = request->bio; - int i, mirror, finished = 0; - - if (bp->bio_cmd == BIO_FLUSH) { - if (bp->bio_error == 0) - bp->bio_error = request->result; - ata_free_request(request); - if (--bp->bio_pflags == 0) - biodone(bp); - return; - } - - switch (rdp->type) { - case AR_T_JBOD: - case AR_T_SPAN: - case AR_T_RAID0: - if (request->result) { - rdp->disks[request->this].flags &= ~AR_DF_ONLINE; - ata_raid_config_changed(rdp, 1); - bp->bio_error = request->result; - finished = 1; - } - else { - bp->bio_resid -= request->donecount; - if (!bp->bio_resid) - finished = 1; - } - break; - - case AR_T_RAID1: - case AR_T_RAID01: - if (request->this < rdp->width) - mirror = request->this + rdp->width; - else - mirror = request->this - rdp->width; - if (request->result) { - rdp->disks[request->this].flags &= ~AR_DF_ONLINE; - ata_raid_config_changed(rdp, 1); - } - if (rdp->status & AR_S_READY) { - u_int64_t blk = 0; - - if (rdp->status & AR_S_REBUILDING) - blk = ((request->u.ata.lba / rdp->interleave) * rdp->width) * - rdp->interleave + (rdp->interleave * - (request->this % rdp->width)) + - request->u.ata.lba % rdp->interleave; - - if (bp->bio_cmd == BIO_READ) { - - /* is this a rebuild composite */ - if ((composite = request->composite)) { - mtx_lock(&composite->lock); - - /* handle the read part of a rebuild composite */ - if (request->flags & ATA_R_READ) { - - /* if read failed array is now broken */ - if (request->result) { - rdp->disks[request->this].flags &= ~AR_DF_ONLINE; - ata_raid_config_changed(rdp, 1); - bp->bio_error = request->result; - rdp->rebuild_lba = blk; - finished = 1; - } - - /* good data, update how far we've gotten */ - else { - bp->bio_resid -= request->donecount; - composite->residual -= request->donecount; - if (!composite->residual) { - if (composite->wr_done & (1 << mirror)) - finished = 1; - } - } - } - - /* handle the write part of a rebuild composite */ - else if (request->flags & ATA_R_WRITE) { - if (composite->rd_done & (1 << mirror)) { - if (request->result) { - printf("DOH! rebuild failed\n"); /* XXX SOS */ - rdp->rebuild_lba = blk; - } - if (!composite->residual) - finished = 1; - } - } - mtx_unlock(&composite->lock); - } - - /* if read failed retry on the mirror */ - else if (request->result) { - request->dev = rdp->disks[mirror].dev; - request->flags &= ~ATA_R_TIMEOUT; - ata_raid_send_request(request); - return; - } - - /* we have good data */ - else { - bp->bio_resid -= request->donecount; - if (!bp->bio_resid) - finished = 1; - } - } - else if (bp->bio_cmd == BIO_WRITE) { - /* do we have a mirror or rebuild to deal with ? */ - if ((composite = request->composite)) { - mtx_lock(&composite->lock); - if (composite->wr_done & (1 << mirror)) { - if (request->result) { - if (composite->request[mirror]->result) { - printf("DOH! all disks failed and got here\n"); - bp->bio_error = EIO; - } - if (rdp->status & AR_S_REBUILDING) { - rdp->rebuild_lba = blk; - printf("DOH! rebuild failed\n"); /* XXX SOS */ - } - bp->bio_resid -= - composite->request[mirror]->donecount; - composite->residual -= - composite->request[mirror]->donecount; - } - else { - bp->bio_resid -= request->donecount; - composite->residual -= request->donecount; - } - if (!composite->residual) - finished = 1; - } - mtx_unlock(&composite->lock); - } - /* no mirror we are done */ - else { - bp->bio_resid -= request->donecount; - if (!bp->bio_resid) - finished = 1; - } - } - } - else - biofinish(bp, NULL, request->result); - break; - - case AR_T_RAID5: - if (request->result) { - rdp->disks[request->this].flags &= ~AR_DF_ONLINE; - ata_raid_config_changed(rdp, 1); - if (rdp->status & AR_S_READY) { - if (bp->bio_cmd == BIO_READ) { - /* do the XOR game to recover data */ - } - if (bp->bio_cmd == BIO_WRITE) { - /* if the parity failed we're OK sortof */ - /* otherwise wee need to do the XOR long dance */ - } - finished = 1; - } - else - biofinish(bp, NULL, request->result); - } - else { - // did we have an XOR game going ?? - bp->bio_resid -= request->donecount; - if (!bp->bio_resid) - finished = 1; - } - break; - - default: - printf("ar%d: unknown array type in ata_raid_done\n", rdp->lun); - } - - if (finished) { - if ((rdp->status & AR_S_REBUILDING) && - rdp->rebuild_lba >= rdp->total_sectors) { - int disk; - - for (disk = 0; disk < rdp->total_disks; disk++) { - if ((rdp->disks[disk].flags & - (AR_DF_PRESENT | AR_DF_ASSIGNED | AR_DF_SPARE)) == - (AR_DF_PRESENT | AR_DF_ASSIGNED | AR_DF_SPARE)) { - rdp->disks[disk].flags &= ~AR_DF_SPARE; - rdp->disks[disk].flags |= AR_DF_ONLINE; - } - } - rdp->status &= ~AR_S_REBUILDING; - ata_raid_config_changed(rdp, 1); - } - if (!bp->bio_resid) - biodone(bp); - } - - if (composite) { - if (finished) { - /* we are done with this composite, free all resources */ - for (i = 0; i < 32; i++) { - if (composite->rd_needed & (1 << i) || - composite->wr_needed & (1 << i)) { - ata_free_request(composite->request[i]); - } - } - mtx_destroy(&composite->lock); - ata_free_composite(composite); - } - } - else - ata_free_request(request); -} - -static int -ata_raid_dump(void *arg, void *virtual, vm_offset_t physical, - off_t offset, size_t length) -{ - struct disk *dp = arg; - struct ar_softc *rdp = dp->d_drv1; - struct bio bp; - - /* length zero is special and really means flush buffers to media */ - if (!length) { - int disk, error; - - for (disk = 0, error = 0; disk < rdp->total_disks; disk++) - if (rdp->disks[disk].dev) - error |= ata_controlcmd(rdp->disks[disk].dev, - ATA_FLUSHCACHE, 0, 0, 0); - return (error ? EIO : 0); - } - - bzero(&bp, sizeof(struct bio)); - bp.bio_disk = dp; - bp.bio_pblkno = offset / DEV_BSIZE; - bp.bio_bcount = length; - bp.bio_data = virtual; - bp.bio_cmd = BIO_WRITE; - ata_raid_strategy(&bp); - return bp.bio_error; -} - -static void -ata_raid_config_changed(struct ar_softc *rdp, int writeback) -{ - int disk, count, status; - - mtx_lock(&rdp->lock); - - /* set default all working mode */ - status = rdp->status; - rdp->status &= ~AR_S_DEGRADED; - rdp->status |= AR_S_READY; - - /* make sure all lost drives are accounted for */ - for (disk = 0; disk < rdp->total_disks; disk++) { - if (!(rdp->disks[disk].flags & AR_DF_PRESENT)) - rdp->disks[disk].flags &= ~AR_DF_ONLINE; - } - - /* depending on RAID type figure out our health status */ - switch (rdp->type) { - case AR_T_JBOD: - case AR_T_SPAN: - case AR_T_RAID0: - for (disk = 0; disk < rdp->total_disks; disk++) - if (!(rdp->disks[disk].flags & AR_DF_ONLINE)) - rdp->status &= ~AR_S_READY; - break; - - case AR_T_RAID1: - case AR_T_RAID01: - for (disk = 0; disk < rdp->width; disk++) { - if (!(rdp->disks[disk].flags & AR_DF_ONLINE) && - !(rdp->disks[disk + rdp->width].flags & AR_DF_ONLINE)) { - rdp->status &= ~AR_S_READY; - } - else if (((rdp->disks[disk].flags & AR_DF_ONLINE) && - !(rdp->disks[disk + rdp->width].flags & AR_DF_ONLINE)) || - (!(rdp->disks[disk].flags & AR_DF_ONLINE) && - (rdp->disks [disk + rdp->width].flags & AR_DF_ONLINE))) { - rdp->status |= AR_S_DEGRADED; - } - } - break; - - case AR_T_RAID5: - for (count = 0, disk = 0; disk < rdp->total_disks; disk++) { - if (!(rdp->disks[disk].flags & AR_DF_ONLINE)) - count++; - } - if (count) { - if (count > 1) - rdp->status &= ~AR_S_READY; - else - rdp->status |= AR_S_DEGRADED; - } - break; - default: - rdp->status &= ~AR_S_READY; - } - - if (rdp->status != status) { - - /* raid status has changed, update metadata */ - writeback = 1; - - /* announce we have trouble ahead */ - if (!(rdp->status & AR_S_READY)) { - printf("ar%d: FAILURE - %s array broken\n", - rdp->lun, ata_raid_type(rdp)); - } - else if (rdp->status & AR_S_DEGRADED) { - if (rdp->type & (AR_T_RAID1 | AR_T_RAID01)) - printf("ar%d: WARNING - mirror", rdp->lun); - else - printf("ar%d: WARNING - parity", rdp->lun); - printf(" protection lost. %s array in DEGRADED mode\n", - ata_raid_type(rdp)); - } - } - mtx_unlock(&rdp->lock); - if (writeback) - ata_raid_write_metadata(rdp); - -} - -static int -ata_raid_status(struct ata_ioc_raid_status *status) -{ - struct ar_softc *rdp; - int i; - - if (!(rdp = ata_raid_arrays[status->lun])) - return ENXIO; - - status->type = rdp->type; - status->total_disks = rdp->total_disks; - for (i = 0; i < rdp->total_disks; i++ ) { - status->disks[i].state = 0; - if ((rdp->disks[i].flags & AR_DF_PRESENT) && rdp->disks[i].dev) { - status->disks[i].lun = device_get_unit(rdp->disks[i].dev); - if (rdp->disks[i].flags & AR_DF_PRESENT) - status->disks[i].state |= AR_DISK_PRESENT; - if (rdp->disks[i].flags & AR_DF_ONLINE) - status->disks[i].state |= AR_DISK_ONLINE; - if (rdp->disks[i].flags & AR_DF_SPARE) - status->disks[i].state |= AR_DISK_SPARE; - } else - status->disks[i].lun = -1; - } - status->interleave = rdp->interleave; - status->status = rdp->status; - status->progress = 100 * rdp->rebuild_lba / rdp->total_sectors; - return 0; -} - -static int -ata_raid_create(struct ata_ioc_raid_config *config) -{ - struct ar_softc *rdp; - device_t subdisk; - int array, disk; - int ctlr = 0, disk_size = 0, total_disks = 0; - - for (array = 0; array < MAX_ARRAYS; array++) { - if (!ata_raid_arrays[array]) - break; - } - if (array >= MAX_ARRAYS) - return ENOSPC; - - if (!(rdp = (struct ar_softc*)malloc(sizeof(struct ar_softc), M_AR, - M_NOWAIT | M_ZERO))) { - printf("ar%d: no memory for metadata storage\n", array); - return ENOMEM; - } - - for (disk = 0; disk < config->total_disks; disk++) { - if ((subdisk = devclass_get_device(ata_raid_sub_devclass, - config->disks[disk]))) { - struct ata_raid_subdisk *ars = device_get_softc(subdisk); - - /* is device already assigned to another array ? */ - if (ars->raid[rdp->volume]) { - config->disks[disk] = -1; - free(rdp, M_AR); - return EBUSY; - } - rdp->disks[disk].dev = device_get_parent(subdisk); - - switch (pci_get_vendor(GRANDPARENT(rdp->disks[disk].dev))) { - case ATA_HIGHPOINT_ID: - /* - * we need some way to decide if it should be v2 or v3 - * for now just use v2 since the v3 BIOS knows how to - * handle that as well. - */ - ctlr = AR_F_HPTV2_RAID; - rdp->disks[disk].sectors = HPTV3_LBA(rdp->disks[disk].dev); - break; - - case ATA_INTEL_ID: - ctlr = AR_F_INTEL_RAID; - rdp->disks[disk].sectors = INTEL_LBA(rdp->disks[disk].dev); - break; - - case ATA_ITE_ID: - ctlr = AR_F_ITE_RAID; - rdp->disks[disk].sectors = ITE_LBA(rdp->disks[disk].dev); - break; - - case ATA_JMICRON_ID: - ctlr = AR_F_JMICRON_RAID; - rdp->disks[disk].sectors = JMICRON_LBA(rdp->disks[disk].dev); - break; - - case 0: /* XXX SOS cover up for bug in our PCI code */ - case ATA_PROMISE_ID: - ctlr = AR_F_PROMISE_RAID; - rdp->disks[disk].sectors = PROMISE_LBA(rdp->disks[disk].dev); - break; - - case ATA_SIS_ID: - ctlr = AR_F_SIS_RAID; - rdp->disks[disk].sectors = SIS_LBA(rdp->disks[disk].dev); - break; - - case ATA_ATI_ID: - case ATA_VIA_ID: - ctlr = AR_F_VIA_RAID; - rdp->disks[disk].sectors = VIA_LBA(rdp->disks[disk].dev); - break; - - default: - /* XXX SOS - * right, so here we are, we have an ATA chip and we want - * to create a RAID and store the metadata. - * we need to find a way to tell what kind of metadata this - * hardware's BIOS might be using (good ideas are welcomed) - * for now we just use our own native FreeBSD format. - * the only way to get support for the BIOS format is to - * setup the RAID from there, in that case we pickup the - * metadata format from the disks (if we support it). - */ - printf("WARNING!! - not able to determine metadata format\n" - "WARNING!! - Using FreeBSD PseudoRAID metadata\n" - "If that is not what you want, use the BIOS to " - "create the array\n"); - ctlr = AR_F_FREEBSD_RAID; - rdp->disks[disk].sectors = PROMISE_LBA(rdp->disks[disk].dev); - break; - } - - /* we need all disks to be of the same format */ - if ((rdp->format & AR_F_FORMAT_MASK) && - (rdp->format & AR_F_FORMAT_MASK) != (ctlr & AR_F_FORMAT_MASK)) { - free(rdp, M_AR); - return EXDEV; - } - else - rdp->format = ctlr; - - /* use the smallest disk of the lots size */ - /* gigabyte boundry ??? XXX SOS */ - if (disk_size) - disk_size = min(rdp->disks[disk].sectors, disk_size); - else - disk_size = rdp->disks[disk].sectors; - rdp->disks[disk].flags = - (AR_DF_PRESENT | AR_DF_ASSIGNED | AR_DF_ONLINE); - - total_disks++; - } - else { - config->disks[disk] = -1; - free(rdp, M_AR); - return ENXIO; - } - } - - if (total_disks != config->total_disks) { - free(rdp, M_AR); - return ENODEV; - } - - switch (config->type) { - case AR_T_JBOD: - case AR_T_SPAN: - case AR_T_RAID0: - break; - - case AR_T_RAID1: - if (total_disks != 2) { - free(rdp, M_AR); - return EPERM; - } - break; - - case AR_T_RAID01: - if (total_disks % 2 != 0) { - free(rdp, M_AR); - return EPERM; - } - break; - - case AR_T_RAID5: - if (total_disks < 3) { - free(rdp, M_AR); - return EPERM; - } - break; - - default: - free(rdp, M_AR); - return EOPNOTSUPP; - } - rdp->type = config->type; - rdp->lun = array; - if (rdp->type == AR_T_RAID0 || rdp->type == AR_T_RAID01 || - rdp->type == AR_T_RAID5) { - int bit = 0; - - while (config->interleave >>= 1) - bit++; - rdp->interleave = 1 << bit; - } - rdp->offset_sectors = 0; - - /* values that depend on metadata format */ - switch (rdp->format) { - case AR_F_ADAPTEC_RAID: - rdp->interleave = min(max(32, rdp->interleave), 128); /*+*/ - break; - - case AR_F_HPTV2_RAID: - rdp->interleave = min(max(8, rdp->interleave), 128); /*+*/ - rdp->offset_sectors = HPTV2_LBA(x) + 1; - break; - - case AR_F_HPTV3_RAID: - rdp->interleave = min(max(32, rdp->interleave), 4096); /*+*/ - break; - - case AR_F_INTEL_RAID: - rdp->interleave = min(max(8, rdp->interleave), 256); /*+*/ - break; - - case AR_F_ITE_RAID: - rdp->interleave = min(max(2, rdp->interleave), 128); /*+*/ - break; - - case AR_F_JMICRON_RAID: - rdp->interleave = min(max(8, rdp->interleave), 256); /*+*/ - break; - - case AR_F_LSIV2_RAID: - rdp->interleave = min(max(2, rdp->interleave), 4096); - break; - - case AR_F_LSIV3_RAID: - rdp->interleave = min(max(2, rdp->interleave), 256); - break; - - case AR_F_PROMISE_RAID: - rdp->interleave = min(max(2, rdp->interleave), 2048); /*+*/ - break; - - case AR_F_SII_RAID: - rdp->interleave = min(max(8, rdp->interleave), 256); /*+*/ - break; - - case AR_F_SIS_RAID: - rdp->interleave = min(max(32, rdp->interleave), 512); /*+*/ - break; - - case AR_F_VIA_RAID: - rdp->interleave = min(max(8, rdp->interleave), 128); /*+*/ - break; - } - - rdp->total_disks = total_disks; - rdp->width = total_disks / (rdp->type & (AR_RAID1 | AR_T_RAID01) ? 2 : 1); - rdp->total_sectors = disk_size * (rdp->width - (rdp->type == AR_RAID5)); - rdp->heads = 255; - rdp->sectors = 63; - rdp->cylinders = rdp->total_sectors / (255 * 63); - rdp->rebuild_lba = 0; - rdp->status |= AR_S_READY; - - /* we are committed to this array, grap the subdisks */ - for (disk = 0; disk < config->total_disks; disk++) { - if ((subdisk = devclass_get_device(ata_raid_sub_devclass, - config->disks[disk]))) { - struct ata_raid_subdisk *ars = device_get_softc(subdisk); - - ars->raid[rdp->volume] = rdp; - ars->disk_number[rdp->volume] = disk; - } - } - ata_raid_attach(rdp, 1); - ata_raid_arrays[array] = rdp; - config->lun = array; - return 0; -} - -static int -ata_raid_delete(int array) -{ - struct ar_softc *rdp; - device_t subdisk; - int disk; - - if (!(rdp = ata_raid_arrays[array])) - return ENXIO; - - rdp->status &= ~AR_S_READY; - if (rdp->disk) - disk_destroy(rdp->disk); - - for (disk = 0; disk < rdp->total_disks; disk++) { - if ((rdp->disks[disk].flags & AR_DF_PRESENT) && rdp->disks[disk].dev) { - if ((subdisk = devclass_get_device(ata_raid_sub_devclass, - device_get_unit(rdp->disks[disk].dev)))) { - struct ata_raid_subdisk *ars = device_get_softc(subdisk); - - if (ars->raid[rdp->volume] != rdp) /* XXX SOS */ - device_printf(subdisk, "DOH! this disk doesn't belong\n"); - if (ars->disk_number[rdp->volume] != disk) /* XXX SOS */ - device_printf(subdisk, "DOH! this disk number is wrong\n"); - ars->raid[rdp->volume] = NULL; - ars->disk_number[rdp->volume] = -1; - } - rdp->disks[disk].flags = 0; - } - } - ata_raid_wipe_metadata(rdp); - ata_raid_arrays[array] = NULL; - free(rdp, M_AR); - return 0; -} - -static int -ata_raid_addspare(struct ata_ioc_raid_config *config) -{ - struct ar_softc *rdp; - device_t subdisk; - int disk; - - if (!(rdp = ata_raid_arrays[config->lun])) - return ENXIO; - if (!(rdp->status & AR_S_DEGRADED) || !(rdp->status & AR_S_READY)) - return ENXIO; - if (rdp->status & AR_S_REBUILDING) - return EBUSY; - switch (rdp->type) { - case AR_T_RAID1: - case AR_T_RAID01: - case AR_T_RAID5: - for (disk = 0; disk < rdp->total_disks; disk++ ) { - - if (((rdp->disks[disk].flags & (AR_DF_PRESENT | AR_DF_ONLINE)) == - (AR_DF_PRESENT | AR_DF_ONLINE)) && rdp->disks[disk].dev) - continue; - - if ((subdisk = devclass_get_device(ata_raid_sub_devclass, - config->disks[0] ))) { - struct ata_raid_subdisk *ars = device_get_softc(subdisk); - - if (ars->raid[rdp->volume]) - return EBUSY; - - /* XXX SOS validate size etc etc */ - ars->raid[rdp->volume] = rdp; - ars->disk_number[rdp->volume] = disk; - rdp->disks[disk].dev = device_get_parent(subdisk); - rdp->disks[disk].flags = - (AR_DF_PRESENT | AR_DF_ASSIGNED | AR_DF_SPARE); - - device_printf(rdp->disks[disk].dev, - "inserted into ar%d disk%d as spare\n", - rdp->lun, disk); - ata_raid_config_changed(rdp, 1); - return 0; - } - } - return ENXIO; - - default: - return EPERM; - } -} - -static int -ata_raid_rebuild(int array) -{ - struct ar_softc *rdp; - int disk, count; - - if (!(rdp = ata_raid_arrays[array])) - return ENXIO; - /* XXX SOS we should lock the rdp softc here */ - if (!(rdp->status & AR_S_DEGRADED) || !(rdp->status & AR_S_READY)) - return ENXIO; - if (rdp->status & AR_S_REBUILDING) - return EBUSY; - - switch (rdp->type) { - case AR_T_RAID1: - case AR_T_RAID01: - case AR_T_RAID5: - for (count = 0, disk = 0; disk < rdp->total_disks; disk++ ) { - if (((rdp->disks[disk].flags & - (AR_DF_PRESENT|AR_DF_ASSIGNED|AR_DF_ONLINE|AR_DF_SPARE)) == - (AR_DF_PRESENT | AR_DF_ASSIGNED | AR_DF_SPARE)) && - rdp->disks[disk].dev) { - count++; - } - } - - if (count) { - rdp->rebuild_lba = 0; - rdp->status |= AR_S_REBUILDING; - return 0; - } - return EIO; - - default: - return EPERM; - } -} - -static int -ata_raid_read_metadata(device_t subdisk) -{ - devclass_t pci_devclass = devclass_find("pci"); - devclass_t atapci_devclass = devclass_find("atapci"); - devclass_t devclass=device_get_devclass(GRANDPARENT(GRANDPARENT(subdisk))); - - /* prioritize vendor native metadata layout if possible */ - if (devclass == pci_devclass || devclass == atapci_devclass) { - switch (pci_get_vendor(GRANDPARENT(device_get_parent(subdisk)))) { - case ATA_HIGHPOINT_ID: - if (ata_raid_hptv3_read_meta(subdisk, ata_raid_arrays)) - return 0; - if (ata_raid_hptv2_read_meta(subdisk, ata_raid_arrays)) - return 0; - break; - - case ATA_INTEL_ID: - if (ata_raid_intel_read_meta(subdisk, ata_raid_arrays)) - return 0; - break; - - case ATA_ITE_ID: - if (ata_raid_ite_read_meta(subdisk, ata_raid_arrays)) - return 0; - break; - - case ATA_JMICRON_ID: - if (ata_raid_jmicron_read_meta(subdisk, ata_raid_arrays)) - return 0; - break; - - case ATA_NVIDIA_ID: - if (ata_raid_nvidia_read_meta(subdisk, ata_raid_arrays)) - return 0; - break; - - case 0: /* XXX SOS cover up for bug in our PCI code */ - case ATA_PROMISE_ID: - if (ata_raid_promise_read_meta(subdisk, ata_raid_arrays, 0)) - return 0; - break; - - case ATA_ATI_ID: - case ATA_SILICON_IMAGE_ID: - if (ata_raid_sii_read_meta(subdisk, ata_raid_arrays)) - return 0; - break; - - case ATA_SIS_ID: - if (ata_raid_sis_read_meta(subdisk, ata_raid_arrays)) - return 0; - break; - - case ATA_VIA_ID: - if (ata_raid_via_read_meta(subdisk, ata_raid_arrays)) - return 0; - break; - } - } - - /* handle controllers that have multiple layout possibilities */ - /* NOTE: the order of these are not insignificant */ - - /* Adaptec HostRAID */ - if (ata_raid_adaptec_read_meta(subdisk, ata_raid_arrays)) - return 0; - - /* LSILogic v3 and v2 */ - if (ata_raid_lsiv3_read_meta(subdisk, ata_raid_arrays)) - return 0; - if (ata_raid_lsiv2_read_meta(subdisk, ata_raid_arrays)) - return 0; - - /* DDF (used by Adaptec, maybe others) */ - if (ata_raid_ddf_read_meta(subdisk, ata_raid_arrays)) - return 0; - - /* if none of the above matched, try FreeBSD native format */ - return ata_raid_promise_read_meta(subdisk, ata_raid_arrays, 1); -} - -static int -ata_raid_write_metadata(struct ar_softc *rdp) -{ - switch (rdp->format) { - case AR_F_FREEBSD_RAID: - case AR_F_PROMISE_RAID: - return ata_raid_promise_write_meta(rdp); - - case AR_F_HPTV3_RAID: - case AR_F_HPTV2_RAID: - /* - * always write HPT v2 metadata, the v3 BIOS knows it as well. - * this is handy since we cannot know what version BIOS is on there - */ - return ata_raid_hptv2_write_meta(rdp); - - case AR_F_INTEL_RAID: - return ata_raid_intel_write_meta(rdp); - - case AR_F_JMICRON_RAID: - return ata_raid_jmicron_write_meta(rdp); - - case AR_F_SIS_RAID: - return ata_raid_sis_write_meta(rdp); - - case AR_F_VIA_RAID: - return ata_raid_via_write_meta(rdp); -#if 0 - case AR_F_HPTV3_RAID: - return ata_raid_hptv3_write_meta(rdp); - - case AR_F_ADAPTEC_RAID: - return ata_raid_adaptec_write_meta(rdp); - - case AR_F_ITE_RAID: - return ata_raid_ite_write_meta(rdp); - - case AR_F_LSIV2_RAID: - return ata_raid_lsiv2_write_meta(rdp); - - case AR_F_LSIV3_RAID: - return ata_raid_lsiv3_write_meta(rdp); - - case AR_F_NVIDIA_RAID: - return ata_raid_nvidia_write_meta(rdp); - - case AR_F_SII_RAID: - return ata_raid_sii_write_meta(rdp); - -#endif - default: - printf("ar%d: writing of %s metadata is NOT supported yet\n", - rdp->lun, ata_raid_format(rdp)); - } - return -1; -} - -static int -ata_raid_wipe_metadata(struct ar_softc *rdp) -{ - int disk, error = 0; - u_int64_t lba; - u_int32_t size; - u_int8_t *meta; - - for (disk = 0; disk < rdp->total_disks; disk++) { - if (rdp->disks[disk].dev) { - switch (rdp->format) { - case AR_F_ADAPTEC_RAID: - lba = ADP_LBA(rdp->disks[disk].dev); - size = sizeof(struct adaptec_raid_conf); - break; - - case AR_F_HPTV2_RAID: - lba = HPTV2_LBA(rdp->disks[disk].dev); - size = sizeof(struct hptv2_raid_conf); - break; - - case AR_F_HPTV3_RAID: - lba = HPTV3_LBA(rdp->disks[disk].dev); - size = sizeof(struct hptv3_raid_conf); - break; - - case AR_F_INTEL_RAID: - lba = INTEL_LBA(rdp->disks[disk].dev); - size = 3 * 512; /* XXX SOS */ - break; - - case AR_F_ITE_RAID: - lba = ITE_LBA(rdp->disks[disk].dev); - size = sizeof(struct ite_raid_conf); - break; - - case AR_F_JMICRON_RAID: - lba = JMICRON_LBA(rdp->disks[disk].dev); - size = sizeof(struct jmicron_raid_conf); - break; - - case AR_F_LSIV2_RAID: - lba = LSIV2_LBA(rdp->disks[disk].dev); - size = sizeof(struct lsiv2_raid_conf); - break; - - case AR_F_LSIV3_RAID: - lba = LSIV3_LBA(rdp->disks[disk].dev); - size = sizeof(struct lsiv3_raid_conf); - break; - - case AR_F_NVIDIA_RAID: - lba = NVIDIA_LBA(rdp->disks[disk].dev); - size = sizeof(struct nvidia_raid_conf); - break; - - case AR_F_FREEBSD_RAID: - case AR_F_PROMISE_RAID: - lba = PROMISE_LBA(rdp->disks[disk].dev); - size = sizeof(struct promise_raid_conf); - break; - - case AR_F_SII_RAID: - lba = SII_LBA(rdp->disks[disk].dev); - size = sizeof(struct sii_raid_conf); - break; - - case AR_F_SIS_RAID: - lba = SIS_LBA(rdp->disks[disk].dev); - size = sizeof(struct sis_raid_conf); - break; - - case AR_F_VIA_RAID: - lba = VIA_LBA(rdp->disks[disk].dev); - size = sizeof(struct via_raid_conf); - break; - - default: - printf("ar%d: wiping of %s metadata is NOT supported yet\n", - rdp->lun, ata_raid_format(rdp)); - return ENXIO; - } - if (!(meta = malloc(size, M_AR, M_NOWAIT | M_ZERO))) - return ENOMEM; - if (ata_raid_rw(rdp->disks[disk].dev, lba, meta, size, - ATA_R_WRITE | ATA_R_DIRECT)) { - device_printf(rdp->disks[disk].dev, "wipe metadata failed\n"); - error = EIO; - } - free(meta, M_AR); - } - } - return error; -} - -/* Adaptec HostRAID Metadata */ -static int -ata_raid_adaptec_read_meta(device_t dev, struct ar_softc **raidp) -{ - struct ata_raid_subdisk *ars = device_get_softc(dev); - device_t parent = device_get_parent(dev); - struct adaptec_raid_conf *meta; - struct ar_softc *raid; - int array, disk, retval = 0; - - if (!(meta = (struct adaptec_raid_conf *) - malloc(sizeof(struct adaptec_raid_conf), M_AR, M_NOWAIT | M_ZERO))) - return ENOMEM; - - if (ata_raid_rw(parent, ADP_LBA(parent), - meta, sizeof(struct adaptec_raid_conf), ATA_R_READ)) { - if (testing || bootverbose) - device_printf(parent, "Adaptec read metadata failed\n"); - goto adaptec_out; - } - - /* check if this is a Adaptec RAID struct */ - if (meta->magic_0 != ADP_MAGIC_0 || meta->magic_3 != ADP_MAGIC_3) { - if (testing || bootverbose) - device_printf(parent, "Adaptec check1 failed\n"); - goto adaptec_out; - } - - if (testing || bootverbose) - ata_raid_adaptec_print_meta(meta); - - /* now convert Adaptec metadata into our generic form */ - for (array = 0; array < MAX_ARRAYS; array++) { - if (!raidp[array]) { - raidp[array] = - (struct ar_softc *)malloc(sizeof(struct ar_softc), M_AR, - M_NOWAIT | M_ZERO); - if (!raidp[array]) { - device_printf(parent, "failed to allocate metadata storage\n"); - goto adaptec_out; - } - } - raid = raidp[array]; - if (raid->format && (raid->format != AR_F_ADAPTEC_RAID)) - continue; - - if (raid->magic_0 && raid->magic_0 != meta->configs[0].magic_0) - continue; - - if (!meta->generation || be32toh(meta->generation) > raid->generation) { - switch (meta->configs[0].type) { - case ADP_T_RAID0: - raid->magic_0 = meta->configs[0].magic_0; - raid->type = AR_T_RAID0; - raid->interleave = 1 << (meta->configs[0].stripe_shift >> 1); - raid->width = be16toh(meta->configs[0].total_disks); - break; - - case ADP_T_RAID1: - raid->magic_0 = meta->configs[0].magic_0; - raid->type = AR_T_RAID1; - raid->width = be16toh(meta->configs[0].total_disks) / 2; - break; - - default: - device_printf(parent, "Adaptec unknown RAID type 0x%02x\n", - meta->configs[0].type); - free(raidp[array], M_AR); - raidp[array] = NULL; - goto adaptec_out; - } - - raid->format = AR_F_ADAPTEC_RAID; - raid->generation = be32toh(meta->generation); - raid->total_disks = be16toh(meta->configs[0].total_disks); - raid->total_sectors = be32toh(meta->configs[0].sectors); - raid->heads = 255; - raid->sectors = 63; - raid->cylinders = raid->total_sectors / (63 * 255); - raid->offset_sectors = 0; - raid->rebuild_lba = 0; - raid->lun = array; - strncpy(raid->name, meta->configs[0].name, - min(sizeof(raid->name), sizeof(meta->configs[0].name))); - - /* clear out any old info */ - if (raid->generation) { - for (disk = 0; disk < raid->total_disks; disk++) { - raid->disks[disk].dev = NULL; - raid->disks[disk].flags = 0; - } - } - } - if (be32toh(meta->generation) >= raid->generation) { - struct ata_device *atadev = device_get_softc(parent); - struct ata_channel *ch = device_get_softc(GRANDPARENT(dev)); - int disk_number = - (ch->unit << !(ch->flags & ATA_NO_SLAVE)) + atadev->unit; - raid->disks[disk_number].dev = parent; - raid->disks[disk_number].sectors = - be32toh(meta->configs[disk_number + 1].sectors); - raid->disks[disk_number].flags = - (AR_DF_ONLINE | AR_DF_PRESENT | AR_DF_ASSIGNED); - ars->raid[raid->volume] = raid; - ars->disk_number[raid->volume] = disk_number; - retval = 1; - } - break; - } - -adaptec_out: - free(meta, M_AR); - return retval; -} - -static uint64_t -ddfbe64toh(uint64_t val) -{ - return (be64toh(val)); -} - -static uint32_t -ddfbe32toh(uint32_t val) -{ - return (be32toh(val)); -} - -static uint16_t -ddfbe16toh(uint16_t val) -{ - return (be16toh(val)); -} - -static uint64_t -ddfle64toh(uint64_t val) -{ - return (le64toh(val)); -} - -static uint32_t -ddfle32toh(uint32_t val) -{ - return (le32toh(val)); -} - -static uint16_t -ddfle16toh(uint16_t val) -{ - return (le16toh(val)); -} - -static int -ata_raid_ddf_read_meta(device_t dev, struct ar_softc **raidp) -{ - struct ata_raid_subdisk *ars; - device_t parent = device_get_parent(dev); - struct ddf_header *hdr; - struct ddf_pd_record *pdr; - struct ddf_pd_entry *pde = NULL; - struct ddf_vd_record *vdr; - struct ddf_pdd_record *pdd; - struct ddf_sa_record *sa = NULL; - struct ddf_vdc_record *vdcr = NULL; - struct ddf_vd_entry *vde = NULL; - struct ar_softc *raid; - uint64_t pri_lba; - uint32_t pd_ref, pd_pos; - uint8_t *meta, *cr; - int hdr_len, vd_state = 0, pd_state = 0; - int i, disk, array, retval = 0; - uintptr_t max_cr_addr; - uint64_t (*ddf64toh)(uint64_t) = NULL; - uint32_t (*ddf32toh)(uint32_t) = NULL; - uint16_t (*ddf16toh)(uint16_t) = NULL; - - ars = device_get_softc(dev); - raid = NULL; - - /* Read in the anchor header */ - if (!(meta = malloc(DDF_HEADER_LENGTH, M_AR, M_NOWAIT | M_ZERO))) - return ENOMEM; - - if (ata_raid_rw(parent, DDF_LBA(parent), - meta, DDF_HEADER_LENGTH, ATA_R_READ)) { - if (testing || bootverbose) - device_printf(parent, "DDF read metadata failed\n"); - goto ddf_out; - } - - /* - * Check if this is a DDF RAID struct. Note the apparent "flexibility" - * regarding endianness. - */ - hdr = (struct ddf_header *)meta; - if (be32toh(hdr->Signature) == DDF_HEADER_SIGNATURE) { - ddf64toh = ddfbe64toh; - ddf32toh = ddfbe32toh; - ddf16toh = ddfbe16toh; - } else if (le32toh(hdr->Signature) == DDF_HEADER_SIGNATURE) { - ddf64toh = ddfle64toh; - ddf32toh = ddfle32toh; - ddf16toh = ddfle16toh; - } else - goto ddf_out; - - if (hdr->Header_Type != DDF_HEADER_ANCHOR) { - if (testing || bootverbose) - device_printf(parent, "DDF check1 failed\n"); - goto ddf_out; - } - - pri_lba = ddf64toh(hdr->Primary_Header_LBA); - hdr_len = ddf32toh(hdr->cd_section) + ddf32toh(hdr->cd_length); - hdr_len = max(hdr_len,ddf32toh(hdr->pdr_section)+ddf32toh(hdr->pdr_length)); - hdr_len = max(hdr_len,ddf32toh(hdr->vdr_section)+ddf32toh(hdr->vdr_length)); - hdr_len = max(hdr_len,ddf32toh(hdr->cr_section) +ddf32toh(hdr->cr_length)); - hdr_len = max(hdr_len,ddf32toh(hdr->pdd_section)+ddf32toh(hdr->pdd_length)); - if (testing || bootverbose) - device_printf(parent, "DDF pri_lba= %llu length= %d blocks\n", - (unsigned long long)pri_lba, hdr_len); - if ((pri_lba + hdr_len) > DDF_LBA(parent)) { - device_printf(parent, "DDF exceeds length of disk\n"); - goto ddf_out; - } - - /* Don't need the anchor anymore, read the rest of the metadata */ - free(meta, M_AR); - if (!(meta = malloc(hdr_len * DEV_BSIZE, M_AR, M_NOWAIT | M_ZERO))) - return ENOMEM; - - if (ata_raid_rw(parent, pri_lba, meta, hdr_len * DEV_BSIZE, ATA_R_READ)) { - if (testing || bootverbose) - device_printf(parent, "DDF read full metadata failed\n"); - goto ddf_out; - } - - /* Check that we got a Primary Header */ - hdr = (struct ddf_header *)meta; - if ((ddf32toh(hdr->Signature) != DDF_HEADER_SIGNATURE) || - (hdr->Header_Type != DDF_HEADER_PRIMARY)) { - if (testing || bootverbose) - device_printf(parent, "DDF check2 failed\n"); - goto ddf_out; - } - - if (testing || bootverbose) - ata_raid_ddf_print_meta(meta); - - if ((hdr->Open_Flag >= 0x01) && (hdr->Open_Flag <= 0x0f)) { - device_printf(parent, "DDF Header open, possibly corrupt metadata\n"); - goto ddf_out; - } - - pdr = (struct ddf_pd_record*)(meta + ddf32toh(hdr->pdr_section)*DEV_BSIZE); - vdr = (struct ddf_vd_record*)(meta + ddf32toh(hdr->vdr_section)*DEV_BSIZE); - cr = (uint8_t *)(meta + ddf32toh(hdr->cr_section)*DEV_BSIZE); - pdd = (struct ddf_pdd_record*)(meta + ddf32toh(hdr->pdd_section)*DEV_BSIZE); - - /* Verify the Physical Disk Device Record */ - if (ddf32toh(pdd->Signature) != DDF_PDD_SIGNATURE) { - device_printf(parent, "Invalid PD Signature\n"); - goto ddf_out; - } - pd_ref = ddf32toh(pdd->PD_Reference); - pd_pos = -1; - - /* Verify the Physical Disk Record and make sure the disk is usable */ - if (ddf32toh(pdr->Signature) != DDF_PDR_SIGNATURE) { - device_printf(parent, "Invalid PDR Signature\n"); - goto ddf_out; - } - for (i = 0; i < ddf16toh(pdr->Populated_PDEs); i++) { - if (ddf32toh(pdr->entry[i].PD_Reference) != pd_ref) - continue; - pde = &pdr->entry[i]; - pd_state = ddf16toh(pde->PD_State); - } - if ((pde == NULL) || - ((pd_state & DDF_PDE_ONLINE) == 0) || - (pd_state & (DDF_PDE_FAILED|DDF_PDE_MISSING|DDF_PDE_UNRECOVERED))) { - device_printf(parent, "Physical disk not usable\n"); - goto ddf_out; - } - - /* Parse out the configuration record, look for spare and VD records. - * While DDF supports a disk being part of more than one array, and - * thus having more than one VDCR record, that feature is not supported - * by ATA-RAID. Therefore, the first record found takes precedence. - */ - max_cr_addr = (uintptr_t)cr + ddf32toh(hdr->cr_length) * DEV_BSIZE - 1; - for ( ; (uintptr_t)cr < max_cr_addr; - cr += ddf16toh(hdr->Configuration_Record_Length) * DEV_BSIZE) { - switch (ddf32toh(((uint32_t *)cr)[0])) { - case DDF_VDCR_SIGNATURE: - vdcr = (struct ddf_vdc_record *)cr; - goto cr_found; - break; - case DDF_VUCR_SIGNATURE: - /* Don't care about this record */ - break; - case DDF_SA_SIGNATURE: - sa = (struct ddf_sa_record *)cr; - goto cr_found; - break; - case DDF_CR_INVALID: - /* A record was deliberately invalidated */ - break; - default: - device_printf(parent, "Invalid CR signature found\n"); - } - } -cr_found: - if ((vdcr == NULL) /* && (sa == NULL) * Spares not supported yet */) { - device_printf(parent, "No usable configuration record found\n"); - goto ddf_out; - } - - if (vdcr != NULL) { - if (vdcr->Secondary_Element_Count != 1) { - device_printf(parent, "Unsupported multi-level Virtual Disk\n"); - goto ddf_out; - } - - /* Find the Virtual Disk Entry for this array */ - if (ddf32toh(vdr->Signature) != DDF_VD_RECORD_SIGNATURE) { - device_printf(parent, "Invalid VDR Signature\n"); - goto ddf_out; - } - for (i = 0; i < ddf16toh(vdr->Populated_VDEs); i++) { - if (bcmp(vdr->entry[i].VD_GUID, vdcr->VD_GUID, 24)) - continue; - vde = &vdr->entry[i]; - vd_state = vde->VD_State & DDF_VDE_STATE_MASK; - } - if ((vde == NULL) || - ((vd_state != DDF_VDE_OPTIMAL) && (vd_state != DDF_VDE_DEGRADED))) { - device_printf(parent, "Unusable Virtual Disk\n"); - goto ddf_out; - } - for (i = 0; i < ddf16toh(hdr->Max_Primary_Element_Entries); i++) { - uint32_t pd_tmp; - - pd_tmp = ddf32toh(vdcr->Physical_Disk_Sequence[i]); - if ((pd_tmp == 0x00000000) || (pd_tmp == 0xffffffff)) - continue; - if (pd_tmp == pd_ref) { - pd_pos = i; - break; - } - } - if (pd_pos == -1) { - device_printf(parent, "Physical device not part of array\n"); - goto ddf_out; - } - } - - /* now convert DDF metadata into our generic form */ - for (array = 0; array < MAX_ARRAYS; array++) { - if (!raidp[array]) { - raid = (struct ar_softc *)malloc(sizeof(struct ar_softc), M_AR, - M_NOWAIT | M_ZERO); - if (!raid) { - device_printf(parent, "failed to allocate metadata storage\n"); - goto ddf_out; - } - } else - raid = raidp[array]; - - if (raid->format && (raid->format != AR_F_DDF_RAID)) - continue; - - if (raid->magic_0 && (raid->magic_0 != crc32(vde->VD_GUID, 24))) - continue; - - if (!raidp[array]) { - raidp[array] = raid; - - switch (vdcr->Primary_RAID_Level) { - case DDF_VDCR_RAID0: - raid->magic_0 = crc32(vde->VD_GUID, 24); - raid->magic_1 = ddf16toh(vde->VD_Number); - raid->type = AR_T_RAID0; - raid->interleave = 1 << vdcr->Stripe_Size; - raid->width = ddf16toh(vdcr->Primary_Element_Count); - break; - - case DDF_VDCR_RAID1: - raid->magic_0 = crc32(vde->VD_GUID, 24); - raid->magic_1 = ddf16toh(vde->VD_Number); - raid->type = AR_T_RAID1; - raid->width = 1; - break; - - default: - device_printf(parent, "DDF unsupported RAID type 0x%02x\n", - vdcr->Primary_RAID_Level); - free(raidp[array], M_AR); - raidp[array] = NULL; - goto ddf_out; - } - - raid->format = AR_F_DDF_RAID; - raid->generation = ddf32toh(vdcr->Sequence_Number); - raid->total_disks = ddf16toh(vdcr->Primary_Element_Count); - raid->total_sectors = ddf64toh(vdcr->VD_Size); - raid->heads = 255; - raid->sectors = 63; - raid->cylinders = raid->total_sectors / (63 * 255); - raid->offset_sectors = 0; - raid->rebuild_lba = 0; - raid->lun = array; - strncpy(raid->name, vde->VD_Name, - min(sizeof(raid->name), sizeof(vde->VD_Name))); - - /* clear out any old info */ - if (raid->generation) { - for (disk = 0; disk < raid->total_disks; disk++) { - raid->disks[disk].dev = NULL; - raid->disks[disk].flags = 0; - } - } - } - if (ddf32toh(vdcr->Sequence_Number) >= raid->generation) { - int disk_number = pd_pos; - - raid->disks[disk_number].dev = parent; - - /* Adaptec appears to not set vdcr->Block_Count, yet again in - * gross violation of the spec. - */ - raid->disks[disk_number].sectors = ddf64toh(vdcr->Block_Count); - if (raid->disks[disk_number].sectors == 0) - raid->disks[disk_number].sectors=ddf64toh(pde->Configured_Size); - raid->disks[disk_number].flags = - (AR_DF_ONLINE | AR_DF_PRESENT | AR_DF_ASSIGNED); - ars->raid[raid->volume] = raid; - ars->disk_number[raid->volume] = disk_number; - retval = 1; - } - break; - } - -ddf_out: - free(meta, M_AR); - return retval; -} - -/* Highpoint V2 RocketRAID Metadata */ -static int -ata_raid_hptv2_read_meta(device_t dev, struct ar_softc **raidp) -{ - struct ata_raid_subdisk *ars = device_get_softc(dev); - device_t parent = device_get_parent(dev); - struct hptv2_raid_conf *meta; - struct ar_softc *raid = NULL; - int array, disk_number = 0, retval = 0; - - if (!(meta = (struct hptv2_raid_conf *) - malloc(sizeof(struct hptv2_raid_conf), M_AR, M_NOWAIT | M_ZERO))) - return ENOMEM; - - if (ata_raid_rw(parent, HPTV2_LBA(parent), - meta, sizeof(struct hptv2_raid_conf), ATA_R_READ)) { - if (testing || bootverbose) - device_printf(parent, "HighPoint (v2) read metadata failed\n"); - goto hptv2_out; - } - - /* check if this is a HighPoint v2 RAID struct */ - if (meta->magic != HPTV2_MAGIC_OK && meta->magic != HPTV2_MAGIC_BAD) { - if (testing || bootverbose) - device_printf(parent, "HighPoint (v2) check1 failed\n"); - goto hptv2_out; - } - - /* is this disk defined, or an old leftover/spare ? */ - if (!meta->magic_0) { - if (testing || bootverbose) - device_printf(parent, "HighPoint (v2) check2 failed\n"); - goto hptv2_out; - } - - if (testing || bootverbose) - ata_raid_hptv2_print_meta(meta); - - /* now convert HighPoint (v2) metadata into our generic form */ - for (array = 0; array < MAX_ARRAYS; array++) { - if (!raidp[array]) { - raidp[array] = - (struct ar_softc *)malloc(sizeof(struct ar_softc), M_AR, - M_NOWAIT | M_ZERO); - if (!raidp[array]) { - device_printf(parent, "failed to allocate metadata storage\n"); - goto hptv2_out; - } - } - raid = raidp[array]; - if (raid->format && (raid->format != AR_F_HPTV2_RAID)) - continue; - - switch (meta->type) { - case HPTV2_T_RAID0: - if ((meta->order & (HPTV2_O_RAID0|HPTV2_O_OK)) == - (HPTV2_O_RAID0|HPTV2_O_OK)) - goto highpoint_raid1; - if (meta->order & (HPTV2_O_RAID0 | HPTV2_O_RAID1)) - goto highpoint_raid01; - if (raid->magic_0 && raid->magic_0 != meta->magic_0) - continue; - raid->magic_0 = meta->magic_0; - raid->type = AR_T_RAID0; - raid->interleave = 1 << meta->stripe_shift; - disk_number = meta->disk_number; - if (!(meta->order & HPTV2_O_OK)) - meta->magic = 0; /* mark bad */ - break; - - case HPTV2_T_RAID1: -highpoint_raid1: - if (raid->magic_0 && raid->magic_0 != meta->magic_0) - continue; - raid->magic_0 = meta->magic_0; - raid->type = AR_T_RAID1; - disk_number = (meta->disk_number > 0); - break; - - case HPTV2_T_RAID01_RAID0: -highpoint_raid01: - if (meta->order & HPTV2_O_RAID0) { - if ((raid->magic_0 && raid->magic_0 != meta->magic_0) || - (raid->magic_1 && raid->magic_1 != meta->magic_1)) - continue; - raid->magic_0 = meta->magic_0; - raid->magic_1 = meta->magic_1; - raid->type = AR_T_RAID01; - raid->interleave = 1 << meta->stripe_shift; - disk_number = meta->disk_number; - } - else { - if (raid->magic_1 && raid->magic_1 != meta->magic_1) - continue; - raid->magic_1 = meta->magic_1; - raid->type = AR_T_RAID01; - raid->interleave = 1 << meta->stripe_shift; - disk_number = meta->disk_number + meta->array_width; - if (!(meta->order & HPTV2_O_RAID1)) - meta->magic = 0; /* mark bad */ - } - break; - - case HPTV2_T_SPAN: - if (raid->magic_0 && raid->magic_0 != meta->magic_0) - continue; - raid->magic_0 = meta->magic_0; - raid->type = AR_T_SPAN; - disk_number = meta->disk_number; - break; - - default: - device_printf(parent, "Highpoint (v2) unknown RAID type 0x%02x\n", - meta->type); - free(raidp[array], M_AR); - raidp[array] = NULL; - goto hptv2_out; - } - - raid->format |= AR_F_HPTV2_RAID; - raid->disks[disk_number].dev = parent; - raid->disks[disk_number].flags = (AR_DF_PRESENT | AR_DF_ASSIGNED); - raid->lun = array; - strncpy(raid->name, meta->name_1, - min(sizeof(raid->name), sizeof(meta->name_1))); - if (meta->magic == HPTV2_MAGIC_OK) { - raid->disks[disk_number].flags |= AR_DF_ONLINE; - raid->width = meta->array_width; - raid->total_sectors = meta->total_sectors; - raid->heads = 255; - raid->sectors = 63; - raid->cylinders = raid->total_sectors / (63 * 255); - raid->offset_sectors = HPTV2_LBA(parent) + 1; - raid->rebuild_lba = meta->rebuild_lba; - raid->disks[disk_number].sectors = - raid->total_sectors / raid->width; - } - else - raid->disks[disk_number].flags &= ~AR_DF_ONLINE; - - if ((raid->type & AR_T_RAID0) && (raid->total_disks < raid->width)) - raid->total_disks = raid->width; - if (disk_number >= raid->total_disks) - raid->total_disks = disk_number + 1; - ars->raid[raid->volume] = raid; - ars->disk_number[raid->volume] = disk_number; - retval = 1; - break; - } - -hptv2_out: - free(meta, M_AR); - return retval; -} - -static int -ata_raid_hptv2_write_meta(struct ar_softc *rdp) -{ - struct hptv2_raid_conf *meta; - struct timeval timestamp; - int disk, error = 0; - - if (!(meta = (struct hptv2_raid_conf *) - malloc(sizeof(struct hptv2_raid_conf), M_AR, M_NOWAIT | M_ZERO))) { - printf("ar%d: failed to allocate metadata storage\n", rdp->lun); - return ENOMEM; - } - - microtime(×tamp); - rdp->magic_0 = timestamp.tv_sec + 2; - rdp->magic_1 = timestamp.tv_sec; - - for (disk = 0; disk < rdp->total_disks; disk++) { - if ((rdp->disks[disk].flags & (AR_DF_PRESENT | AR_DF_ONLINE)) == - (AR_DF_PRESENT | AR_DF_ONLINE)) - meta->magic = HPTV2_MAGIC_OK; - if (rdp->disks[disk].flags & AR_DF_ASSIGNED) { - meta->magic_0 = rdp->magic_0; - if (strlen(rdp->name)) - strncpy(meta->name_1, rdp->name, sizeof(meta->name_1)); - else - strcpy(meta->name_1, "FreeBSD"); - } - meta->disk_number = disk; - - switch (rdp->type) { - case AR_T_RAID0: - meta->type = HPTV2_T_RAID0; - strcpy(meta->name_2, "RAID 0"); - if (rdp->disks[disk].flags & AR_DF_ONLINE) - meta->order = HPTV2_O_OK; - break; - - case AR_T_RAID1: - meta->type = HPTV2_T_RAID0; - strcpy(meta->name_2, "RAID 1"); - meta->disk_number = (disk < rdp->width) ? disk : disk + 5; - meta->order = HPTV2_O_RAID0 | HPTV2_O_OK; - break; - - case AR_T_RAID01: - meta->type = HPTV2_T_RAID01_RAID0; - strcpy(meta->name_2, "RAID 0+1"); - if (rdp->disks[disk].flags & AR_DF_ONLINE) { - if (disk < rdp->width) { - meta->order = (HPTV2_O_RAID0 | HPTV2_O_RAID1); - meta->magic_0 = rdp->magic_0 - 1; - } - else { - meta->order = HPTV2_O_RAID1; - meta->disk_number -= rdp->width; - } - } - else - meta->magic_0 = rdp->magic_0 - 1; - meta->magic_1 = rdp->magic_1; - break; - - case AR_T_SPAN: - meta->type = HPTV2_T_SPAN; - strcpy(meta->name_2, "SPAN"); - break; - default: - free(meta, M_AR); - return ENODEV; - } - - meta->array_width = rdp->width; - meta->stripe_shift = (rdp->width > 1) ? (ffs(rdp->interleave)-1) : 0; - meta->total_sectors = rdp->total_sectors; - meta->rebuild_lba = rdp->rebuild_lba; - if (testing || bootverbose) - ata_raid_hptv2_print_meta(meta); - if (rdp->disks[disk].dev) { - if (ata_raid_rw(rdp->disks[disk].dev, - HPTV2_LBA(rdp->disks[disk].dev), meta, - sizeof(struct promise_raid_conf), - ATA_R_WRITE | ATA_R_DIRECT)) { - device_printf(rdp->disks[disk].dev, "write metadata failed\n"); - error = EIO; - } - } - } - free(meta, M_AR); - return error; -} - -/* Highpoint V3 RocketRAID Metadata */ -static int -ata_raid_hptv3_read_meta(device_t dev, struct ar_softc **raidp) -{ - struct ata_raid_subdisk *ars = device_get_softc(dev); - device_t parent = device_get_parent(dev); - struct hptv3_raid_conf *meta; - struct ar_softc *raid = NULL; - int array, disk_number, retval = 0; - - if (!(meta = (struct hptv3_raid_conf *) - malloc(sizeof(struct hptv3_raid_conf), M_AR, M_NOWAIT | M_ZERO))) - return ENOMEM; - - if (ata_raid_rw(parent, HPTV3_LBA(parent), - meta, sizeof(struct hptv3_raid_conf), ATA_R_READ)) { - if (testing || bootverbose) - device_printf(parent, "HighPoint (v3) read metadata failed\n"); - goto hptv3_out; - } - - /* check if this is a HighPoint v3 RAID struct */ - if (meta->magic != HPTV3_MAGIC) { - if (testing || bootverbose) - device_printf(parent, "HighPoint (v3) check1 failed\n"); - goto hptv3_out; - } - - /* check if there are any config_entries */ - if (meta->config_entries < 1) { - if (testing || bootverbose) - device_printf(parent, "HighPoint (v3) check2 failed\n"); - goto hptv3_out; - } - - if (testing || bootverbose) - ata_raid_hptv3_print_meta(meta); - - /* now convert HighPoint (v3) metadata into our generic form */ - for (array = 0; array < MAX_ARRAYS; array++) { - if (!raidp[array]) { - raidp[array] = - (struct ar_softc *)malloc(sizeof(struct ar_softc), M_AR, - M_NOWAIT | M_ZERO); - if (!raidp[array]) { - device_printf(parent, "failed to allocate metadata storage\n"); - goto hptv3_out; - } - } - raid = raidp[array]; - if (raid->format && (raid->format != AR_F_HPTV3_RAID)) - continue; - - if ((raid->format & AR_F_HPTV3_RAID) && raid->magic_0 != meta->magic_0) - continue; - - switch (meta->configs[0].type) { - case HPTV3_T_RAID0: - raid->type = AR_T_RAID0; - raid->width = meta->configs[0].total_disks; - disk_number = meta->configs[0].disk_number; - break; - - case HPTV3_T_RAID1: - raid->type = AR_T_RAID1; - raid->width = meta->configs[0].total_disks / 2; - disk_number = meta->configs[0].disk_number; - break; - - case HPTV3_T_RAID5: - raid->type = AR_T_RAID5; - raid->width = meta->configs[0].total_disks; - disk_number = meta->configs[0].disk_number; - break; - - case HPTV3_T_SPAN: - raid->type = AR_T_SPAN; - raid->width = meta->configs[0].total_disks; - disk_number = meta->configs[0].disk_number; - break; - - default: - device_printf(parent, "Highpoint (v3) unknown RAID type 0x%02x\n", - meta->configs[0].type); - free(raidp[array], M_AR); - raidp[array] = NULL; - goto hptv3_out; - } - if (meta->config_entries == 2) { - switch (meta->configs[1].type) { - case HPTV3_T_RAID1: - if (raid->type == AR_T_RAID0) { - raid->type = AR_T_RAID01; - disk_number = meta->configs[1].disk_number + - (meta->configs[0].disk_number << 1); - break; - } - default: - device_printf(parent, "Highpoint (v3) unknown level 2 0x%02x\n", - meta->configs[1].type); - free(raidp[array], M_AR); - raidp[array] = NULL; - goto hptv3_out; - } - } - - raid->magic_0 = meta->magic_0; - raid->format = AR_F_HPTV3_RAID; - raid->generation = meta->timestamp; - raid->interleave = 1 << meta->configs[0].stripe_shift; - raid->total_disks = meta->configs[0].total_disks + - meta->configs[1].total_disks; - raid->total_sectors = meta->configs[0].total_sectors + - ((u_int64_t)meta->configs_high[0].total_sectors << 32); - raid->heads = 255; - raid->sectors = 63; - raid->cylinders = raid->total_sectors / (63 * 255); - raid->offset_sectors = 0; - raid->rebuild_lba = meta->configs[0].rebuild_lba + - ((u_int64_t)meta->configs_high[0].rebuild_lba << 32); - raid->lun = array; - strncpy(raid->name, meta->name, - min(sizeof(raid->name), sizeof(meta->name))); - raid->disks[disk_number].sectors = raid->total_sectors / - (raid->type == AR_T_RAID5 ? raid->width - 1 : raid->width); - raid->disks[disk_number].dev = parent; - raid->disks[disk_number].flags = - (AR_DF_PRESENT | AR_DF_ASSIGNED | AR_DF_ONLINE); - ars->raid[raid->volume] = raid; - ars->disk_number[raid->volume] = disk_number; - retval = 1; - break; - } - -hptv3_out: - free(meta, M_AR); - return retval; -} - -/* Intel MatrixRAID Metadata */ -static int -ata_raid_intel_read_meta(device_t dev, struct ar_softc **raidp) -{ - struct ata_raid_subdisk *ars = device_get_softc(dev); - device_t parent = device_get_parent(dev); - struct intel_raid_conf *meta; - struct intel_raid_mapping *map; - struct ar_softc *raid = NULL; - u_int32_t checksum, *ptr; - int array, count, disk, volume = 1, retval = 0; - char *tmp; - - if (!(meta = (struct intel_raid_conf *) - malloc(1536, M_AR, M_NOWAIT | M_ZERO))) - return ENOMEM; - - if (ata_raid_rw(parent, INTEL_LBA(parent), meta, 1024, ATA_R_READ)) { - if (testing || bootverbose) - device_printf(parent, "Intel read metadata failed\n"); - goto intel_out; - } - tmp = (char *)meta; - bcopy(tmp, tmp+1024, 512); - bcopy(tmp+512, tmp, 1024); - bzero(tmp+1024, 512); - - /* check if this is a Intel RAID struct */ - if (strncmp(meta->intel_id, INTEL_MAGIC, strlen(INTEL_MAGIC))) { - if (testing || bootverbose) - device_printf(parent, "Intel check1 failed\n"); - goto intel_out; - } - - for (checksum = 0, ptr = (u_int32_t *)meta, count = 0; - count < (meta->config_size / sizeof(u_int32_t)); count++) { - checksum += *ptr++; - } - checksum -= meta->checksum; - if (checksum != meta->checksum) { - if (testing || bootverbose) - device_printf(parent, "Intel check2 failed\n"); - goto intel_out; - } - - if (testing || bootverbose) - ata_raid_intel_print_meta(meta); - - map = (struct intel_raid_mapping *)&meta->disk[meta->total_disks]; - - /* now convert Intel metadata into our generic form */ - for (array = 0; array < MAX_ARRAYS; array++) { - if (!raidp[array]) { - raidp[array] = - (struct ar_softc *)malloc(sizeof(struct ar_softc), M_AR, - M_NOWAIT | M_ZERO); - if (!raidp[array]) { - device_printf(parent, "failed to allocate metadata storage\n"); - goto intel_out; - } - } - raid = raidp[array]; - if (raid->format && (raid->format != AR_F_INTEL_RAID)) - continue; - - if ((raid->format & AR_F_INTEL_RAID) && - (raid->magic_0 != meta->config_id)) - continue; - - /* - * update our knowledge about the array config based on generation - * NOTE: there can be multiple volumes on a disk set - */ - if (!meta->generation || meta->generation > raid->generation) { - switch (map->type) { - case INTEL_T_RAID0: - raid->type = AR_T_RAID0; - raid->width = map->total_disks; - break; - - case INTEL_T_RAID1: - if (map->total_disks == 4) - raid->type = AR_T_RAID01; - else - raid->type = AR_T_RAID1; - raid->width = map->total_disks / 2; - break; - - case INTEL_T_RAID5: - raid->type = AR_T_RAID5; - raid->width = map->total_disks; - break; - - default: - device_printf(parent, "Intel unknown RAID type 0x%02x\n", - map->type); - free(raidp[array], M_AR); - raidp[array] = NULL; - goto intel_out; - } - - switch (map->status) { - case INTEL_S_READY: - raid->status = AR_S_READY; - break; - case INTEL_S_DEGRADED: - raid->status |= AR_S_DEGRADED; - break; - case INTEL_S_DISABLED: - case INTEL_S_FAILURE: - raid->status = 0; - } - - raid->magic_0 = meta->config_id; - raid->format = AR_F_INTEL_RAID; - raid->generation = meta->generation; - raid->interleave = map->stripe_sectors; - raid->total_disks = map->total_disks; - raid->total_sectors = map->total_sectors; - raid->heads = 255; - raid->sectors = 63; - raid->cylinders = raid->total_sectors / (63 * 255); - raid->offset_sectors = map->offset; - raid->rebuild_lba = 0; - raid->lun = array; - raid->volume = volume - 1; - strncpy(raid->name, map->name, - min(sizeof(raid->name), sizeof(map->name))); - - /* clear out any old info */ - for (disk = 0; disk < raid->total_disks; disk++) { - u_int disk_idx = map->disk_idx[disk] & 0xffff; - - raid->disks[disk].dev = NULL; - bcopy(meta->disk[disk_idx].serial, - raid->disks[disk].serial, - sizeof(raid->disks[disk].serial)); - raid->disks[disk].sectors = - meta->disk[disk_idx].sectors; - raid->disks[disk].flags = 0; - if (meta->disk[disk_idx].flags & INTEL_F_ONLINE) - raid->disks[disk].flags |= AR_DF_ONLINE; - if (meta->disk[disk_idx].flags & INTEL_F_ASSIGNED) - raid->disks[disk].flags |= AR_DF_ASSIGNED; - if (meta->disk[disk_idx].flags & INTEL_F_SPARE) { - raid->disks[disk].flags &= ~(AR_DF_ONLINE | AR_DF_ASSIGNED); - raid->disks[disk].flags |= AR_DF_SPARE; - } - if (meta->disk[disk_idx].flags & INTEL_F_DOWN) - raid->disks[disk].flags &= ~AR_DF_ONLINE; - } - } - if (meta->generation >= raid->generation) { - for (disk = 0; disk < raid->total_disks; disk++) { - struct ata_device *atadev = device_get_softc(parent); - int len; - - for (len = 0; len < sizeof(atadev->param.serial); len++) { - if (atadev->param.serial[len] < 0x20) - break; - } - len = (len > sizeof(raid->disks[disk].serial)) ? - len - sizeof(raid->disks[disk].serial) : 0; - if (!strncmp(raid->disks[disk].serial, atadev->param.serial + len, - sizeof(raid->disks[disk].serial))) { - raid->disks[disk].dev = parent; - raid->disks[disk].flags |= (AR_DF_PRESENT | AR_DF_ONLINE); - ars->raid[raid->volume] = raid; - ars->disk_number[raid->volume] = disk; - retval = 1; - } - } - } - else - goto intel_out; - - if (retval) { - if (volume < meta->total_volumes) { - map = (struct intel_raid_mapping *) - &map->disk_idx[map->total_disks]; - volume++; - retval = 0; - continue; - } - break; - } - else { - free(raidp[array], M_AR); - raidp[array] = NULL; - if (volume == 2) - retval = 1; - } - } - -intel_out: - free(meta, M_AR); - return retval; -} - -static int -ata_raid_intel_write_meta(struct ar_softc *rdp) -{ - struct intel_raid_conf *meta; - struct intel_raid_mapping *map; - struct timeval timestamp; - u_int32_t checksum, *ptr; - int count, disk, error = 0; - char *tmp; - - if (!(meta = (struct intel_raid_conf *) - malloc(1536, M_AR, M_NOWAIT | M_ZERO))) { - printf("ar%d: failed to allocate metadata storage\n", rdp->lun); - return ENOMEM; - } - - rdp->generation++; - if (!rdp->magic_0) { - microtime(×tamp); - rdp->magic_0 = timestamp.tv_sec ^ timestamp.tv_usec; - } - - bcopy(INTEL_MAGIC, meta->intel_id, sizeof(meta->intel_id)); - bcopy(INTEL_VERSION_1100, meta->version, sizeof(meta->version)); - meta->config_id = rdp->magic_0; - meta->generation = rdp->generation; - meta->total_disks = rdp->total_disks; - meta->total_volumes = 1; /* XXX SOS */ - for (disk = 0; disk < rdp->total_disks; disk++) { - if (rdp->disks[disk].dev) { - struct ata_channel *ch = - device_get_softc(device_get_parent(rdp->disks[disk].dev)); - struct ata_device *atadev = - device_get_softc(rdp->disks[disk].dev); - int len; - - for (len = 0; len < sizeof(atadev->param.serial); len++) { - if (atadev->param.serial[len] < 0x20) - break; - } - len = (len > sizeof(rdp->disks[disk].serial)) ? - len - sizeof(rdp->disks[disk].serial) : 0; - bcopy(atadev->param.serial + len, meta->disk[disk].serial, - sizeof(rdp->disks[disk].serial)); - meta->disk[disk].sectors = rdp->disks[disk].sectors; - meta->disk[disk].id = (ch->unit << 16) | atadev->unit; - } - else - meta->disk[disk].sectors = rdp->total_sectors / rdp->width; - meta->disk[disk].flags = 0; - if (rdp->disks[disk].flags & AR_DF_SPARE) - meta->disk[disk].flags |= INTEL_F_SPARE; - else { - if (rdp->disks[disk].flags & AR_DF_ONLINE) - meta->disk[disk].flags |= INTEL_F_ONLINE; - else - meta->disk[disk].flags |= INTEL_F_DOWN; - if (rdp->disks[disk].flags & AR_DF_ASSIGNED) - meta->disk[disk].flags |= INTEL_F_ASSIGNED; - } - } - map = (struct intel_raid_mapping *)&meta->disk[meta->total_disks]; - - bcopy(rdp->name, map->name, sizeof(rdp->name)); - map->total_sectors = rdp->total_sectors; - map->state = 12; /* XXX SOS */ - map->offset = rdp->offset_sectors; - map->stripe_count = rdp->total_sectors / (rdp->interleave*rdp->total_disks); - map->stripe_sectors = rdp->interleave; - map->disk_sectors = rdp->total_sectors / rdp->width; - map->status = INTEL_S_READY; /* XXX SOS */ - switch (rdp->type) { - case AR_T_RAID0: - map->type = INTEL_T_RAID0; - break; - case AR_T_RAID1: - map->type = INTEL_T_RAID1; - break; - case AR_T_RAID01: - map->type = INTEL_T_RAID1; - break; - case AR_T_RAID5: - map->type = INTEL_T_RAID5; - break; - default: - free(meta, M_AR); - return ENODEV; - } - map->total_disks = rdp->total_disks; - map->magic[0] = 0x02; - map->magic[1] = 0xff; - map->magic[2] = 0x01; - for (disk = 0; disk < rdp->total_disks; disk++) - map->disk_idx[disk] = disk; - - meta->config_size = (char *)&map->disk_idx[disk] - (char *)meta; - for (checksum = 0, ptr = (u_int32_t *)meta, count = 0; - count < (meta->config_size / sizeof(u_int32_t)); count++) { - checksum += *ptr++; - } - meta->checksum = checksum; - - if (testing || bootverbose) - ata_raid_intel_print_meta(meta); - - tmp = (char *)meta; - bcopy(tmp, tmp+1024, 512); - bcopy(tmp+512, tmp, 1024); - bzero(tmp+1024, 512); - - for (disk = 0; disk < rdp->total_disks; disk++) { - if (rdp->disks[disk].dev) { - if (ata_raid_rw(rdp->disks[disk].dev, - INTEL_LBA(rdp->disks[disk].dev), - meta, 1024, ATA_R_WRITE | ATA_R_DIRECT)) { - device_printf(rdp->disks[disk].dev, "write metadata failed\n"); - error = EIO; - } - } - } - free(meta, M_AR); - return error; -} - - -/* Integrated Technology Express Metadata */ -static int -ata_raid_ite_read_meta(device_t dev, struct ar_softc **raidp) -{ - struct ata_raid_subdisk *ars = device_get_softc(dev); - device_t parent = device_get_parent(dev); - struct ite_raid_conf *meta; - struct ar_softc *raid = NULL; - int array, disk_number, count, retval = 0; - u_int16_t *ptr; - - if (!(meta = (struct ite_raid_conf *) - malloc(sizeof(struct ite_raid_conf), M_AR, M_NOWAIT | M_ZERO))) - return ENOMEM; - - if (ata_raid_rw(parent, ITE_LBA(parent), - meta, sizeof(struct ite_raid_conf), ATA_R_READ)) { - if (testing || bootverbose) - device_printf(parent, "ITE read metadata failed\n"); - goto ite_out; - } - - /* check if this is a ITE RAID struct */ - for (ptr = (u_int16_t *)meta->ite_id, count = 0; - count < sizeof(meta->ite_id)/sizeof(uint16_t); count++) - ptr[count] = be16toh(ptr[count]); - - if (strncmp(meta->ite_id, ITE_MAGIC, strlen(ITE_MAGIC))) { - if (testing || bootverbose) - device_printf(parent, "ITE check1 failed\n"); - goto ite_out; - } - - if (testing || bootverbose) - ata_raid_ite_print_meta(meta); - - /* now convert ITE metadata into our generic form */ - for (array = 0; array < MAX_ARRAYS; array++) { - if ((raid = raidp[array])) { - if (raid->format != AR_F_ITE_RAID) - continue; - if (raid->magic_0 != *((u_int64_t *)meta->timestamp_0)) - continue; - } - - /* if we dont have a disks timestamp the RAID is invalidated */ - if (*((u_int64_t *)meta->timestamp_1) == 0) - goto ite_out; - - if (!raid) { - raidp[array] = (struct ar_softc *)malloc(sizeof(struct ar_softc), - M_AR, M_NOWAIT | M_ZERO); - if (!(raid = raidp[array])) { - device_printf(parent, "failed to allocate metadata storage\n"); - goto ite_out; - } - } - - switch (meta->type) { - case ITE_T_RAID0: - raid->type = AR_T_RAID0; - raid->width = meta->array_width; - raid->total_disks = meta->array_width; - disk_number = meta->disk_number; - break; - - case ITE_T_RAID1: - raid->type = AR_T_RAID1; - raid->width = 1; - raid->total_disks = 2; - disk_number = meta->disk_number; - break; - - case ITE_T_RAID01: - raid->type = AR_T_RAID01; - raid->width = meta->array_width; - raid->total_disks = 4; - disk_number = ((meta->disk_number & 0x02) >> 1) | - ((meta->disk_number & 0x01) << 1); - break; - - case ITE_T_SPAN: - raid->type = AR_T_SPAN; - raid->width = 1; - raid->total_disks = meta->array_width; - disk_number = meta->disk_number; - break; - - default: - device_printf(parent, "ITE unknown RAID type 0x%02x\n", meta->type); - free(raidp[array], M_AR); - raidp[array] = NULL; - goto ite_out; - } - - raid->magic_0 = *((u_int64_t *)meta->timestamp_0); - raid->format = AR_F_ITE_RAID; - raid->generation = 0; - raid->interleave = meta->stripe_sectors; - raid->total_sectors = meta->total_sectors; - raid->heads = 255; - raid->sectors = 63; - raid->cylinders = raid->total_sectors / (63 * 255); - raid->offset_sectors = 0; - raid->rebuild_lba = 0; - raid->lun = array; - - raid->disks[disk_number].dev = parent; - raid->disks[disk_number].sectors = raid->total_sectors / raid->width; - raid->disks[disk_number].flags = - (AR_DF_PRESENT | AR_DF_ASSIGNED | AR_DF_ONLINE); - ars->raid[raid->volume] = raid; - ars->disk_number[raid->volume] = disk_number; - retval = 1; - break; - } -ite_out: - free(meta, M_AR); - return retval; -} - -/* JMicron Technology Corp Metadata */ -static int -ata_raid_jmicron_read_meta(device_t dev, struct ar_softc **raidp) -{ - struct ata_raid_subdisk *ars = device_get_softc(dev); - device_t parent = device_get_parent(dev); - struct jmicron_raid_conf *meta; - struct ar_softc *raid = NULL; - u_int16_t checksum, *ptr; - u_int64_t disk_size; - int count, array, disk, total_disks, retval = 0; - - if (!(meta = (struct jmicron_raid_conf *) - malloc(sizeof(struct jmicron_raid_conf), M_AR, M_NOWAIT | M_ZERO))) - return ENOMEM; - - if (ata_raid_rw(parent, JMICRON_LBA(parent), - meta, sizeof(struct jmicron_raid_conf), ATA_R_READ)) { - if (testing || bootverbose) - device_printf(parent, - "JMicron read metadata failed\n"); - } - - /* check for JMicron signature */ - if (strncmp(meta->signature, JMICRON_MAGIC, 2)) { - if (testing || bootverbose) - device_printf(parent, "JMicron check1 failed\n"); - goto jmicron_out; - } - - /* calculate checksum and compare for valid */ - for (checksum = 0, ptr = (u_int16_t *)meta, count = 0; count < 64; count++) - checksum += *ptr++; - if (checksum) { - if (testing || bootverbose) - device_printf(parent, "JMicron check2 failed\n"); - goto jmicron_out; - } - - if (testing || bootverbose) - ata_raid_jmicron_print_meta(meta); - - /* now convert JMicron meta into our generic form */ - for (array = 0; array < MAX_ARRAYS; array++) { -jmicron_next: - if (!raidp[array]) { - raidp[array] = - (struct ar_softc *)malloc(sizeof(struct ar_softc), M_AR, - M_NOWAIT | M_ZERO); - if (!raidp[array]) { - device_printf(parent, "failed to allocate metadata storage\n"); - goto jmicron_out; - } - } - raid = raidp[array]; - if (raid->format && (raid->format != AR_F_JMICRON_RAID)) - continue; - - for (total_disks = 0, disk = 0; disk < JM_MAX_DISKS; disk++) { - if (meta->disks[disk]) { - if (raid->format == AR_F_JMICRON_RAID) { - if (bcmp(&meta->disks[disk], - raid->disks[disk].serial, sizeof(u_int32_t))) { - array++; - goto jmicron_next; - } - } - else - bcopy(&meta->disks[disk], - raid->disks[disk].serial, sizeof(u_int32_t)); - total_disks++; - } - } - /* handle spares XXX SOS */ - - switch (meta->type) { - case JM_T_RAID0: - raid->type = AR_T_RAID0; - raid->width = total_disks; - break; - - case JM_T_RAID1: - raid->type = AR_T_RAID1; - raid->width = 1; - break; - - case JM_T_RAID01: - raid->type = AR_T_RAID01; - raid->width = total_disks / 2; - break; - - case JM_T_RAID5: - raid->type = AR_T_RAID5; - raid->width = total_disks; - break; - - case JM_T_JBOD: - raid->type = AR_T_SPAN; - raid->width = 1; - break; - - default: - device_printf(parent, - "JMicron unknown RAID type 0x%02x\n", meta->type); - free(raidp[array], M_AR); - raidp[array] = NULL; - goto jmicron_out; - } - disk_size = (meta->disk_sectors_high << 16) + meta->disk_sectors_low; - raid->format = AR_F_JMICRON_RAID; - strncpy(raid->name, meta->name, sizeof(meta->name)); - raid->generation = 0; - raid->interleave = 2 << meta->stripe_shift; - raid->total_disks = total_disks; - raid->total_sectors = disk_size * (raid->width-(raid->type==AR_RAID5)); - raid->heads = 255; - raid->sectors = 63; - raid->cylinders = raid->total_sectors / (63 * 255); - raid->offset_sectors = meta->offset * 16; - raid->rebuild_lba = 0; - raid->lun = array; - - for (disk = 0; disk < raid->total_disks; disk++) { - if (meta->disks[disk] == meta->disk_id) { - raid->disks[disk].dev = parent; - raid->disks[disk].sectors = disk_size; - raid->disks[disk].flags = - (AR_DF_ONLINE | AR_DF_PRESENT | AR_DF_ASSIGNED); - ars->raid[raid->volume] = raid; - ars->disk_number[raid->volume] = disk; - retval = 1; - break; - } - } - break; - } -jmicron_out: - free(meta, M_AR); - return retval; -} - -static int -ata_raid_jmicron_write_meta(struct ar_softc *rdp) -{ - struct jmicron_raid_conf *meta; - u_int64_t disk_sectors; - int disk, error = 0; - - if (!(meta = (struct jmicron_raid_conf *) - malloc(sizeof(struct jmicron_raid_conf), M_AR, M_NOWAIT | M_ZERO))) { - printf("ar%d: failed to allocate metadata storage\n", rdp->lun); - return ENOMEM; - } - - rdp->generation++; - switch (rdp->type) { - case AR_T_JBOD: - meta->type = JM_T_JBOD; - break; - - case AR_T_RAID0: - meta->type = JM_T_RAID0; - break; - - case AR_T_RAID1: - meta->type = JM_T_RAID1; - break; - - case AR_T_RAID5: - meta->type = JM_T_RAID5; - break; - - case AR_T_RAID01: - meta->type = JM_T_RAID01; - break; - - default: - free(meta, M_AR); - return ENODEV; - } - bcopy(JMICRON_MAGIC, meta->signature, sizeof(JMICRON_MAGIC)); - meta->version = JMICRON_VERSION; - meta->offset = rdp->offset_sectors / 16; - disk_sectors = rdp->total_sectors / (rdp->width - (rdp->type == AR_RAID5)); - meta->disk_sectors_low = disk_sectors & 0xffff; - meta->disk_sectors_high = disk_sectors >> 16; - strncpy(meta->name, rdp->name, sizeof(meta->name)); - meta->stripe_shift = ffs(rdp->interleave) - 2; - - for (disk = 0; disk < rdp->total_disks; disk++) { - if (rdp->disks[disk].serial[0]) - bcopy(rdp->disks[disk].serial,&meta->disks[disk],sizeof(u_int32_t)); - else - meta->disks[disk] = (u_int32_t)(uintptr_t)rdp->disks[disk].dev; - } - - for (disk = 0; disk < rdp->total_disks; disk++) { - if (rdp->disks[disk].dev) { - u_int16_t checksum = 0, *ptr; - int count; - - meta->disk_id = meta->disks[disk]; - meta->checksum = 0; - for (ptr = (u_int16_t *)meta, count = 0; count < 64; count++) - checksum += *ptr++; - meta->checksum -= checksum; - - if (testing || bootverbose) - ata_raid_jmicron_print_meta(meta); - - if (ata_raid_rw(rdp->disks[disk].dev, - JMICRON_LBA(rdp->disks[disk].dev), - meta, sizeof(struct jmicron_raid_conf), - ATA_R_WRITE | ATA_R_DIRECT)) { - device_printf(rdp->disks[disk].dev, "write metadata failed\n"); - error = EIO; - } - } - } - /* handle spares XXX SOS */ - - free(meta, M_AR); - return error; -} - -/* LSILogic V2 MegaRAID Metadata */ -static int -ata_raid_lsiv2_read_meta(device_t dev, struct ar_softc **raidp) -{ - struct ata_raid_subdisk *ars = device_get_softc(dev); - device_t parent = device_get_parent(dev); - struct lsiv2_raid_conf *meta; - struct ar_softc *raid = NULL; - int array, retval = 0; - - if (!(meta = (struct lsiv2_raid_conf *) - malloc(sizeof(struct lsiv2_raid_conf), M_AR, M_NOWAIT | M_ZERO))) - return ENOMEM; - - if (ata_raid_rw(parent, LSIV2_LBA(parent), - meta, sizeof(struct lsiv2_raid_conf), ATA_R_READ)) { - if (testing || bootverbose) - device_printf(parent, "LSI (v2) read metadata failed\n"); - goto lsiv2_out; - } - - /* check if this is a LSI RAID struct */ - if (strncmp(meta->lsi_id, LSIV2_MAGIC, strlen(LSIV2_MAGIC))) { - if (testing || bootverbose) - device_printf(parent, "LSI (v2) check1 failed\n"); - goto lsiv2_out; - } - - if (testing || bootverbose) - ata_raid_lsiv2_print_meta(meta); - - /* now convert LSI (v2) config meta into our generic form */ - for (array = 0; array < MAX_ARRAYS; array++) { - int raid_entry, conf_entry; - - if (!raidp[array + meta->raid_number]) { - raidp[array + meta->raid_number] = - (struct ar_softc *)malloc(sizeof(struct ar_softc), M_AR, - M_NOWAIT | M_ZERO); - if (!raidp[array + meta->raid_number]) { - device_printf(parent, "failed to allocate metadata storage\n"); - goto lsiv2_out; - } - } - raid = raidp[array + meta->raid_number]; - if (raid->format && (raid->format != AR_F_LSIV2_RAID)) - continue; - - if (raid->magic_0 && - ((raid->magic_0 != meta->timestamp) || - (raid->magic_1 != meta->raid_number))) - continue; - - array += meta->raid_number; - - raid_entry = meta->raid_number; - conf_entry = (meta->configs[raid_entry].raid.config_offset >> 4) + - meta->disk_number - 1; - - switch (meta->configs[raid_entry].raid.type) { - case LSIV2_T_RAID0: - raid->magic_0 = meta->timestamp; - raid->magic_1 = meta->raid_number; - raid->type = AR_T_RAID0; - raid->interleave = meta->configs[raid_entry].raid.stripe_sectors; - raid->width = meta->configs[raid_entry].raid.array_width; - break; - - case LSIV2_T_RAID1: - raid->magic_0 = meta->timestamp; - raid->magic_1 = meta->raid_number; - raid->type = AR_T_RAID1; - raid->width = meta->configs[raid_entry].raid.array_width; - break; - - case LSIV2_T_RAID0 | LSIV2_T_RAID1: - raid->magic_0 = meta->timestamp; - raid->magic_1 = meta->raid_number; - raid->type = AR_T_RAID01; - raid->interleave = meta->configs[raid_entry].raid.stripe_sectors; - raid->width = meta->configs[raid_entry].raid.array_width; - break; - - default: - device_printf(parent, "LSI v2 unknown RAID type 0x%02x\n", - meta->configs[raid_entry].raid.type); - free(raidp[array], M_AR); - raidp[array] = NULL; - goto lsiv2_out; - } - - raid->format = AR_F_LSIV2_RAID; - raid->generation = 0; - raid->total_disks = meta->configs[raid_entry].raid.disk_count; - raid->total_sectors = meta->configs[raid_entry].raid.total_sectors; - raid->heads = 255; - raid->sectors = 63; - raid->cylinders = raid->total_sectors / (63 * 255); - raid->offset_sectors = 0; - raid->rebuild_lba = 0; - raid->lun = array; - - if (meta->configs[conf_entry].disk.device != LSIV2_D_NONE) { - raid->disks[meta->disk_number].dev = parent; - raid->disks[meta->disk_number].sectors = - meta->configs[conf_entry].disk.disk_sectors; - raid->disks[meta->disk_number].flags = - (AR_DF_ONLINE | AR_DF_PRESENT | AR_DF_ASSIGNED); - ars->raid[raid->volume] = raid; - ars->disk_number[raid->volume] = meta->disk_number; - retval = 1; - } - else - raid->disks[meta->disk_number].flags &= ~AR_DF_ONLINE; - - break; - } - -lsiv2_out: - free(meta, M_AR); - return retval; -} - -/* LSILogic V3 MegaRAID Metadata */ -static int -ata_raid_lsiv3_read_meta(device_t dev, struct ar_softc **raidp) -{ - struct ata_raid_subdisk *ars = device_get_softc(dev); - device_t parent = device_get_parent(dev); - struct lsiv3_raid_conf *meta; - struct ar_softc *raid = NULL; - u_int8_t checksum, *ptr; - int array, entry, count, disk_number, retval = 0; - - if (!(meta = (struct lsiv3_raid_conf *) - malloc(sizeof(struct lsiv3_raid_conf), M_AR, M_NOWAIT | M_ZERO))) - return ENOMEM; - - if (ata_raid_rw(parent, LSIV3_LBA(parent), - meta, sizeof(struct lsiv3_raid_conf), ATA_R_READ)) { - if (testing || bootverbose) - device_printf(parent, "LSI (v3) read metadata failed\n"); - goto lsiv3_out; - } - - /* check if this is a LSI RAID struct */ - if (strncmp(meta->lsi_id, LSIV3_MAGIC, strlen(LSIV3_MAGIC))) { - if (testing || bootverbose) - device_printf(parent, "LSI (v3) check1 failed\n"); - goto lsiv3_out; - } - - /* check if the checksum is OK */ - for (checksum = 0, ptr = meta->lsi_id, count = 0; count < 512; count++) - checksum += *ptr++; - if (checksum) { - if (testing || bootverbose) - device_printf(parent, "LSI (v3) check2 failed\n"); - goto lsiv3_out; - } - - if (testing || bootverbose) - ata_raid_lsiv3_print_meta(meta); - - /* now convert LSI (v3) config meta into our generic form */ - for (array = 0, entry = 0; array < MAX_ARRAYS && entry < 8;) { - if (!raidp[array]) { - raidp[array] = - (struct ar_softc *)malloc(sizeof(struct ar_softc), M_AR, - M_NOWAIT | M_ZERO); - if (!raidp[array]) { - device_printf(parent, "failed to allocate metadata storage\n"); - goto lsiv3_out; - } - } - raid = raidp[array]; - if (raid->format && (raid->format != AR_F_LSIV3_RAID)) { - array++; - continue; - } - - if ((raid->format == AR_F_LSIV3_RAID) && - (raid->magic_0 != meta->timestamp)) { - array++; - continue; - } - - switch (meta->raid[entry].total_disks) { - case 0: - entry++; - continue; - case 1: - if (meta->raid[entry].device == meta->device) { - disk_number = 0; - break; - } - if (raid->format) - array++; - entry++; - continue; - case 2: - disk_number = (meta->device & (LSIV3_D_DEVICE|LSIV3_D_CHANNEL))?1:0; - break; - default: - device_printf(parent, "lsiv3 > 2 disk support untested!!\n"); - disk_number = (meta->device & LSIV3_D_DEVICE ? 1 : 0) + - (meta->device & LSIV3_D_CHANNEL ? 2 : 0); - break; - } - - switch (meta->raid[entry].type) { - case LSIV3_T_RAID0: - raid->type = AR_T_RAID0; - raid->width = meta->raid[entry].total_disks; - break; - - case LSIV3_T_RAID1: - raid->type = AR_T_RAID1; - raid->width = meta->raid[entry].array_width; - break; - - default: - device_printf(parent, "LSI v3 unknown RAID type 0x%02x\n", - meta->raid[entry].type); - free(raidp[array], M_AR); - raidp[array] = NULL; - entry++; - continue; - } - - raid->magic_0 = meta->timestamp; - raid->format = AR_F_LSIV3_RAID; - raid->generation = 0; - raid->interleave = meta->raid[entry].stripe_pages * 8; - raid->total_disks = meta->raid[entry].total_disks; - raid->total_sectors = raid->width * meta->raid[entry].sectors; - raid->heads = 255; - raid->sectors = 63; - raid->cylinders = raid->total_sectors / (63 * 255); - raid->offset_sectors = meta->raid[entry].offset; - raid->rebuild_lba = 0; - raid->lun = array; - - raid->disks[disk_number].dev = parent; - raid->disks[disk_number].sectors = raid->total_sectors / raid->width; - raid->disks[disk_number].flags = - (AR_DF_PRESENT | AR_DF_ASSIGNED | AR_DF_ONLINE); - ars->raid[raid->volume] = raid; - ars->disk_number[raid->volume] = disk_number; - retval = 1; - entry++; - array++; - } - -lsiv3_out: - free(meta, M_AR); - return retval; -} - -/* nVidia MediaShield Metadata */ -static int -ata_raid_nvidia_read_meta(device_t dev, struct ar_softc **raidp) -{ - struct ata_raid_subdisk *ars = device_get_softc(dev); - device_t parent = device_get_parent(dev); - struct nvidia_raid_conf *meta; - struct ar_softc *raid = NULL; - u_int32_t checksum, *ptr; - int array, count, retval = 0; - - if (!(meta = (struct nvidia_raid_conf *) - malloc(sizeof(struct nvidia_raid_conf), M_AR, M_NOWAIT | M_ZERO))) - return ENOMEM; - - if (ata_raid_rw(parent, NVIDIA_LBA(parent), - meta, sizeof(struct nvidia_raid_conf), ATA_R_READ)) { - if (testing || bootverbose) - device_printf(parent, "nVidia read metadata failed\n"); - goto nvidia_out; - } - - /* check if this is a nVidia RAID struct */ - if (strncmp(meta->nvidia_id, NV_MAGIC, strlen(NV_MAGIC))) { - if (testing || bootverbose) - device_printf(parent, "nVidia check1 failed\n"); - goto nvidia_out; - } - - /* check if the checksum is OK */ - for (checksum = 0, ptr = (u_int32_t*)meta, count = 0; - count < meta->config_size; count++) - checksum += *ptr++; - if (checksum) { - if (testing || bootverbose) - device_printf(parent, "nVidia check2 failed\n"); - goto nvidia_out; - } - - if (testing || bootverbose) - ata_raid_nvidia_print_meta(meta); - - /* now convert nVidia meta into our generic form */ - for (array = 0; array < MAX_ARRAYS; array++) { - if (!raidp[array]) { - raidp[array] = - (struct ar_softc *)malloc(sizeof(struct ar_softc), M_AR, - M_NOWAIT | M_ZERO); - if (!raidp[array]) { - device_printf(parent, "failed to allocate metadata storage\n"); - goto nvidia_out; - } - } - raid = raidp[array]; - if (raid->format && (raid->format != AR_F_NVIDIA_RAID)) - continue; - - if (raid->format == AR_F_NVIDIA_RAID && - ((raid->magic_0 != meta->magic_1) || - (raid->magic_1 != meta->magic_2))) { - continue; - } - - switch (meta->type) { - case NV_T_SPAN: - raid->type = AR_T_SPAN; - break; - - case NV_T_RAID0: - raid->type = AR_T_RAID0; - break; - - case NV_T_RAID1: - raid->type = AR_T_RAID1; - break; - - case NV_T_RAID5: - raid->type = AR_T_RAID5; - break; - - case NV_T_RAID01: - raid->type = AR_T_RAID01; - break; - - default: - device_printf(parent, "nVidia unknown RAID type 0x%02x\n", - meta->type); - free(raidp[array], M_AR); - raidp[array] = NULL; - goto nvidia_out; - } - raid->magic_0 = meta->magic_1; - raid->magic_1 = meta->magic_2; - raid->format = AR_F_NVIDIA_RAID; - raid->generation = 0; - raid->interleave = meta->stripe_sectors; - raid->width = meta->array_width; - raid->total_disks = meta->total_disks; - raid->total_sectors = meta->total_sectors; - raid->heads = 255; - raid->sectors = 63; - raid->cylinders = raid->total_sectors / (63 * 255); - raid->offset_sectors = 0; - raid->rebuild_lba = meta->rebuild_lba; - raid->lun = array; - raid->status = AR_S_READY; - if (meta->status & NV_S_DEGRADED) - raid->status |= AR_S_DEGRADED; - - raid->disks[meta->disk_number].dev = parent; - raid->disks[meta->disk_number].sectors = - raid->total_sectors / raid->width; - raid->disks[meta->disk_number].flags = - (AR_DF_PRESENT | AR_DF_ASSIGNED | AR_DF_ONLINE); - ars->raid[raid->volume] = raid; - ars->disk_number[raid->volume] = meta->disk_number; - retval = 1; - break; - } - -nvidia_out: - free(meta, M_AR); - return retval; -} - -/* Promise FastTrak Metadata */ -static int -ata_raid_promise_read_meta(device_t dev, struct ar_softc **raidp, int native) -{ - struct ata_raid_subdisk *ars = device_get_softc(dev); - device_t parent = device_get_parent(dev); - struct promise_raid_conf *meta; - struct ar_softc *raid; - u_int32_t checksum, *ptr; - int array, count, disk, disksum = 0, retval = 0; - - if (!(meta = (struct promise_raid_conf *) - malloc(sizeof(struct promise_raid_conf), M_AR, M_NOWAIT | M_ZERO))) - return ENOMEM; - - if (ata_raid_rw(parent, PROMISE_LBA(parent), - meta, sizeof(struct promise_raid_conf), ATA_R_READ)) { - if (testing || bootverbose) - device_printf(parent, "%s read metadata failed\n", - native ? "FreeBSD" : "Promise"); - goto promise_out; - } - - /* check the signature */ - if (native) { - if (strncmp(meta->promise_id, ATA_MAGIC, strlen(ATA_MAGIC))) { - if (testing || bootverbose) - device_printf(parent, "FreeBSD check1 failed\n"); - goto promise_out; - } - } - else { - if (strncmp(meta->promise_id, PR_MAGIC, strlen(PR_MAGIC))) { - if (testing || bootverbose) - device_printf(parent, "Promise check1 failed\n"); - goto promise_out; - } - } - - /* check if the checksum is OK */ - for (checksum = 0, ptr = (u_int32_t *)meta, count = 0; count < 511; count++) - checksum += *ptr++; - if (checksum != *ptr) { - if (testing || bootverbose) - device_printf(parent, "%s check2 failed\n", - native ? "FreeBSD" : "Promise"); - goto promise_out; - } - - /* check on disk integrity status */ - if (meta->raid.integrity != PR_I_VALID) { - if (testing || bootverbose) - device_printf(parent, "%s check3 failed\n", - native ? "FreeBSD" : "Promise"); - goto promise_out; - } - - if (testing || bootverbose) - ata_raid_promise_print_meta(meta); - - /* now convert Promise metadata into our generic form */ - for (array = 0; array < MAX_ARRAYS; array++) { - if (!raidp[array]) { - raidp[array] = - (struct ar_softc *)malloc(sizeof(struct ar_softc), M_AR, - M_NOWAIT | M_ZERO); - if (!raidp[array]) { - device_printf(parent, "failed to allocate metadata storage\n"); - goto promise_out; - } - } - raid = raidp[array]; - if (raid->format && - (raid->format != (native ? AR_F_FREEBSD_RAID : AR_F_PROMISE_RAID))) - continue; - - if ((raid->format == (native ? AR_F_FREEBSD_RAID : AR_F_PROMISE_RAID))&& - !(meta->raid.magic_1 == (raid->magic_1))) - continue; - - /* update our knowledge about the array config based on generation */ - if (!meta->raid.generation || meta->raid.generation > raid->generation){ - switch (meta->raid.type) { - case PR_T_SPAN: - raid->type = AR_T_SPAN; - break; - - case PR_T_JBOD: - raid->type = AR_T_JBOD; - break; - - case PR_T_RAID0: - raid->type = AR_T_RAID0; - break; - - case PR_T_RAID1: - raid->type = AR_T_RAID1; - if (meta->raid.array_width > 1) - raid->type = AR_T_RAID01; - break; - - case PR_T_RAID5: - raid->type = AR_T_RAID5; - break; - - default: - device_printf(parent, "%s unknown RAID type 0x%02x\n", - native ? "FreeBSD" : "Promise", meta->raid.type); - free(raidp[array], M_AR); - raidp[array] = NULL; - goto promise_out; - } - raid->magic_1 = meta->raid.magic_1; - raid->format = (native ? AR_F_FREEBSD_RAID : AR_F_PROMISE_RAID); - raid->generation = meta->raid.generation; - raid->interleave = 1 << meta->raid.stripe_shift; - raid->width = meta->raid.array_width; - raid->total_disks = meta->raid.total_disks; - raid->heads = meta->raid.heads + 1; - raid->sectors = meta->raid.sectors; - raid->cylinders = meta->raid.cylinders + 1; - raid->total_sectors = meta->raid.total_sectors; - raid->offset_sectors = 0; - raid->rebuild_lba = meta->raid.rebuild_lba; - raid->lun = array; - if ((meta->raid.status & - (PR_S_VALID | PR_S_ONLINE | PR_S_INITED | PR_S_READY)) == - (PR_S_VALID | PR_S_ONLINE | PR_S_INITED | PR_S_READY)) { - raid->status |= AR_S_READY; - if (meta->raid.status & PR_S_DEGRADED) - raid->status |= AR_S_DEGRADED; - } - else - raid->status &= ~AR_S_READY; - - /* convert disk flags to our internal types */ - for (disk = 0; disk < meta->raid.total_disks; disk++) { - raid->disks[disk].dev = NULL; - raid->disks[disk].flags = 0; - *((u_int64_t *)(raid->disks[disk].serial)) = - meta->raid.disk[disk].magic_0; - disksum += meta->raid.disk[disk].flags; - if (meta->raid.disk[disk].flags & PR_F_ONLINE) - raid->disks[disk].flags |= AR_DF_ONLINE; - if (meta->raid.disk[disk].flags & PR_F_ASSIGNED) - raid->disks[disk].flags |= AR_DF_ASSIGNED; - if (meta->raid.disk[disk].flags & PR_F_SPARE) { - raid->disks[disk].flags &= ~(AR_DF_ONLINE | AR_DF_ASSIGNED); - raid->disks[disk].flags |= AR_DF_SPARE; - } - if (meta->raid.disk[disk].flags & (PR_F_REDIR | PR_F_DOWN)) - raid->disks[disk].flags &= ~AR_DF_ONLINE; - } - if (!disksum) { - device_printf(parent, "%s subdisks has no flags\n", - native ? "FreeBSD" : "Promise"); - free(raidp[array], M_AR); - raidp[array] = NULL; - goto promise_out; - } - } - if (meta->raid.generation >= raid->generation) { - int disk_number = meta->raid.disk_number; - - if (raid->disks[disk_number].flags && (meta->magic_0 == - *((u_int64_t *)(raid->disks[disk_number].serial)))) { - raid->disks[disk_number].dev = parent; - raid->disks[disk_number].flags |= AR_DF_PRESENT; - raid->disks[disk_number].sectors = meta->raid.disk_sectors; - if ((raid->disks[disk_number].flags & - (AR_DF_PRESENT | AR_DF_ASSIGNED | AR_DF_ONLINE)) == - (AR_DF_PRESENT | AR_DF_ASSIGNED | AR_DF_ONLINE)) { - ars->raid[raid->volume] = raid; - ars->disk_number[raid->volume] = disk_number; - retval = 1; - } - } - } - break; - } - -promise_out: - free(meta, M_AR); - return retval; -} - -static int -ata_raid_promise_write_meta(struct ar_softc *rdp) -{ - struct promise_raid_conf *meta; - struct timeval timestamp; - u_int32_t *ckptr; - int count, disk, drive, error = 0; - - if (!(meta = (struct promise_raid_conf *) - malloc(sizeof(struct promise_raid_conf), M_AR, M_NOWAIT))) { - printf("ar%d: failed to allocate metadata storage\n", rdp->lun); - return ENOMEM; - } - - rdp->generation++; - microtime(×tamp); - - for (disk = 0; disk < rdp->total_disks; disk++) { - for (count = 0; count < sizeof(struct promise_raid_conf); count++) - *(((u_int8_t *)meta) + count) = 255 - (count % 256); - meta->dummy_0 = 0x00020000; - meta->raid.disk_number = disk; - - if (rdp->disks[disk].dev) { - struct ata_device *atadev = device_get_softc(rdp->disks[disk].dev); - struct ata_channel *ch = - device_get_softc(device_get_parent(rdp->disks[disk].dev)); - - meta->raid.channel = ch->unit; - meta->raid.device = atadev->unit; - meta->raid.disk_sectors = rdp->disks[disk].sectors; - meta->raid.disk_offset = rdp->offset_sectors; - } - else { - meta->raid.channel = 0; - meta->raid.device = 0; - meta->raid.disk_sectors = 0; - meta->raid.disk_offset = 0; - } - meta->magic_0 = PR_MAGIC0(meta->raid) | timestamp.tv_sec; - meta->magic_1 = timestamp.tv_sec >> 16; - meta->magic_2 = timestamp.tv_sec; - meta->raid.integrity = PR_I_VALID; - meta->raid.magic_0 = meta->magic_0; - meta->raid.rebuild_lba = rdp->rebuild_lba; - meta->raid.generation = rdp->generation; - - if (rdp->status & AR_S_READY) { - meta->raid.flags = (PR_F_VALID | PR_F_ASSIGNED | PR_F_ONLINE); - meta->raid.status = - (PR_S_VALID | PR_S_ONLINE | PR_S_INITED | PR_S_READY); - if (rdp->status & AR_S_DEGRADED) - meta->raid.status |= PR_S_DEGRADED; - else - meta->raid.status |= PR_S_FUNCTIONAL; - } - else { - meta->raid.flags = PR_F_DOWN; - meta->raid.status = 0; - } - - switch (rdp->type) { - case AR_T_RAID0: - meta->raid.type = PR_T_RAID0; - break; - case AR_T_RAID1: - meta->raid.type = PR_T_RAID1; - break; - case AR_T_RAID01: - meta->raid.type = PR_T_RAID1; - break; - case AR_T_RAID5: - meta->raid.type = PR_T_RAID5; - break; - case AR_T_SPAN: - meta->raid.type = PR_T_SPAN; - break; - case AR_T_JBOD: - meta->raid.type = PR_T_JBOD; - break; - default: - free(meta, M_AR); - return ENODEV; - } - - meta->raid.total_disks = rdp->total_disks; - meta->raid.stripe_shift = ffs(rdp->interleave) - 1; - meta->raid.array_width = rdp->width; - meta->raid.array_number = rdp->lun; - meta->raid.total_sectors = rdp->total_sectors; - meta->raid.cylinders = rdp->cylinders - 1; - meta->raid.heads = rdp->heads - 1; - meta->raid.sectors = rdp->sectors; - meta->raid.magic_1 = (u_int64_t)meta->magic_2<<16 | meta->magic_1; - - bzero(&meta->raid.disk, 8 * 12); - for (drive = 0; drive < rdp->total_disks; drive++) { - meta->raid.disk[drive].flags = 0; - if (rdp->disks[drive].flags & AR_DF_PRESENT) - meta->raid.disk[drive].flags |= PR_F_VALID; - if (rdp->disks[drive].flags & AR_DF_ASSIGNED) - meta->raid.disk[drive].flags |= PR_F_ASSIGNED; - if (rdp->disks[drive].flags & AR_DF_ONLINE) - meta->raid.disk[drive].flags |= PR_F_ONLINE; - else - if (rdp->disks[drive].flags & AR_DF_PRESENT) - meta->raid.disk[drive].flags = (PR_F_REDIR | PR_F_DOWN); - if (rdp->disks[drive].flags & AR_DF_SPARE) - meta->raid.disk[drive].flags |= PR_F_SPARE; - meta->raid.disk[drive].dummy_0 = 0x0; - if (rdp->disks[drive].dev) { - struct ata_channel *ch = - device_get_softc(device_get_parent(rdp->disks[drive].dev)); - struct ata_device *atadev = - device_get_softc(rdp->disks[drive].dev); - - meta->raid.disk[drive].channel = ch->unit; - meta->raid.disk[drive].device = atadev->unit; - } - meta->raid.disk[drive].magic_0 = - PR_MAGIC0(meta->raid.disk[drive]) | timestamp.tv_sec; - } - - if (rdp->disks[disk].dev) { - if ((rdp->disks[disk].flags & (AR_DF_PRESENT | AR_DF_ONLINE)) == - (AR_DF_PRESENT | AR_DF_ONLINE)) { - if (rdp->format == AR_F_FREEBSD_RAID) - bcopy(ATA_MAGIC, meta->promise_id, sizeof(ATA_MAGIC)); - else - bcopy(PR_MAGIC, meta->promise_id, sizeof(PR_MAGIC)); - } - else - bzero(meta->promise_id, sizeof(meta->promise_id)); - meta->checksum = 0; - for (ckptr = (int32_t *)meta, count = 0; count < 511; count++) - meta->checksum += *ckptr++; - if (testing || bootverbose) - ata_raid_promise_print_meta(meta); - if (ata_raid_rw(rdp->disks[disk].dev, - PROMISE_LBA(rdp->disks[disk].dev), - meta, sizeof(struct promise_raid_conf), - ATA_R_WRITE | ATA_R_DIRECT)) { - device_printf(rdp->disks[disk].dev, "write metadata failed\n"); - error = EIO; - } - } - } - free(meta, M_AR); - return error; -} - -/* Silicon Image Medley Metadata */ -static int -ata_raid_sii_read_meta(device_t dev, struct ar_softc **raidp) -{ - struct ata_raid_subdisk *ars = device_get_softc(dev); - device_t parent = device_get_parent(dev); - struct sii_raid_conf *meta; - struct ar_softc *raid = NULL; - u_int16_t checksum, *ptr; - int array, count, disk, retval = 0; - - if (!(meta = (struct sii_raid_conf *) - malloc(sizeof(struct sii_raid_conf), M_AR, M_NOWAIT | M_ZERO))) - return ENOMEM; - - if (ata_raid_rw(parent, SII_LBA(parent), - meta, sizeof(struct sii_raid_conf), ATA_R_READ)) { - if (testing || bootverbose) - device_printf(parent, "Silicon Image read metadata failed\n"); - goto sii_out; - } - - /* check if this is a Silicon Image (Medley) RAID struct */ - for (checksum = 0, ptr = (u_int16_t *)meta, count = 0; count < 160; count++) - checksum += *ptr++; - if (checksum) { - if (testing || bootverbose) - device_printf(parent, "Silicon Image check1 failed\n"); - goto sii_out; - } - - for (checksum = 0, ptr = (u_int16_t *)meta, count = 0; count < 256; count++) - checksum += *ptr++; - if (checksum != meta->checksum_1) { - if (testing || bootverbose) - device_printf(parent, "Silicon Image check2 failed\n"); - goto sii_out; - } - - /* check verison */ - if (meta->version_major != 0x0002 || - (meta->version_minor != 0x0000 && meta->version_minor != 0x0001)) { - if (testing || bootverbose) - device_printf(parent, "Silicon Image check3 failed\n"); - goto sii_out; - } - - if (testing || bootverbose) - ata_raid_sii_print_meta(meta); - - /* now convert Silicon Image meta into our generic form */ - for (array = 0; array < MAX_ARRAYS; array++) { - if (!raidp[array]) { - raidp[array] = - (struct ar_softc *)malloc(sizeof(struct ar_softc), M_AR, - M_NOWAIT | M_ZERO); - if (!raidp[array]) { - device_printf(parent, "failed to allocate metadata storage\n"); - goto sii_out; - } - } - raid = raidp[array]; - if (raid->format && (raid->format != AR_F_SII_RAID)) - continue; - - if (raid->format == AR_F_SII_RAID && - (raid->magic_0 != *((u_int64_t *)meta->timestamp))) { - continue; - } - - /* update our knowledge about the array config based on generation */ - if (!meta->generation || meta->generation > raid->generation) { - switch (meta->type) { - case SII_T_RAID0: - raid->type = AR_T_RAID0; - break; - - case SII_T_RAID1: - raid->type = AR_T_RAID1; - break; - - case SII_T_RAID01: - raid->type = AR_T_RAID01; - break; - - case SII_T_SPARE: - device_printf(parent, "Silicon Image SPARE disk\n"); - free(raidp[array], M_AR); - raidp[array] = NULL; - goto sii_out; - - default: - device_printf(parent,"Silicon Image unknown RAID type 0x%02x\n", - meta->type); - free(raidp[array], M_AR); - raidp[array] = NULL; - goto sii_out; - } - raid->magic_0 = *((u_int64_t *)meta->timestamp); - raid->format = AR_F_SII_RAID; - raid->generation = meta->generation; - raid->interleave = meta->stripe_sectors; - raid->width = (meta->raid0_disks != 0xff) ? meta->raid0_disks : 1; - raid->total_disks = - ((meta->raid0_disks != 0xff) ? meta->raid0_disks : 0) + - ((meta->raid1_disks != 0xff) ? meta->raid1_disks : 0); - raid->total_sectors = meta->total_sectors; - raid->heads = 255; - raid->sectors = 63; - raid->cylinders = raid->total_sectors / (63 * 255); - raid->offset_sectors = 0; - raid->rebuild_lba = meta->rebuild_lba; - raid->lun = array; - strncpy(raid->name, meta->name, - min(sizeof(raid->name), sizeof(meta->name))); - - /* clear out any old info */ - if (raid->generation) { - for (disk = 0; disk < raid->total_disks; disk++) { - raid->disks[disk].dev = NULL; - raid->disks[disk].flags = 0; - } - } - } - if (meta->generation >= raid->generation) { - /* XXX SOS add check for the right physical disk by serial# */ - if (meta->status & SII_S_READY) { - int disk_number = (raid->type == AR_T_RAID01) ? - meta->raid1_ident + (meta->raid0_ident << 1) : - meta->disk_number; - - raid->disks[disk_number].dev = parent; - raid->disks[disk_number].sectors = - raid->total_sectors / raid->width; - raid->disks[disk_number].flags = - (AR_DF_ONLINE | AR_DF_PRESENT | AR_DF_ASSIGNED); - ars->raid[raid->volume] = raid; - ars->disk_number[raid->volume] = disk_number; - retval = 1; - } - } - break; - } - -sii_out: - free(meta, M_AR); - return retval; -} - -/* Silicon Integrated Systems Metadata */ -static int -ata_raid_sis_read_meta(device_t dev, struct ar_softc **raidp) -{ - struct ata_raid_subdisk *ars = device_get_softc(dev); - device_t parent = device_get_parent(dev); - struct sis_raid_conf *meta; - struct ar_softc *raid = NULL; - int array, disk_number, drive, retval = 0; - - if (!(meta = (struct sis_raid_conf *) - malloc(sizeof(struct sis_raid_conf), M_AR, M_NOWAIT | M_ZERO))) - return ENOMEM; - - if (ata_raid_rw(parent, SIS_LBA(parent), - meta, sizeof(struct sis_raid_conf), ATA_R_READ)) { - if (testing || bootverbose) - device_printf(parent, - "Silicon Integrated Systems read metadata failed\n"); - } - - /* check for SiS magic */ - if (meta->magic != SIS_MAGIC) { - if (testing || bootverbose) - device_printf(parent, - "Silicon Integrated Systems check1 failed\n"); - goto sis_out; - } - - if (testing || bootverbose) - ata_raid_sis_print_meta(meta); - - /* now convert SiS meta into our generic form */ - for (array = 0; array < MAX_ARRAYS; array++) { - if (!raidp[array]) { - raidp[array] = - (struct ar_softc *)malloc(sizeof(struct ar_softc), M_AR, - M_NOWAIT | M_ZERO); - if (!raidp[array]) { - device_printf(parent, "failed to allocate metadata storage\n"); - goto sis_out; - } - } - - raid = raidp[array]; - if (raid->format && (raid->format != AR_F_SIS_RAID)) - continue; - - if ((raid->format == AR_F_SIS_RAID) && - ((raid->magic_0 != meta->controller_pci_id) || - (raid->magic_1 != meta->timestamp))) { - continue; - } - - switch (meta->type_total_disks & SIS_T_MASK) { - case SIS_T_JBOD: - raid->type = AR_T_JBOD; - raid->width = (meta->type_total_disks & SIS_D_MASK); - raid->total_sectors += SIS_LBA(parent); - break; - - case SIS_T_RAID0: - raid->type = AR_T_RAID0; - raid->width = (meta->type_total_disks & SIS_D_MASK); - if (!raid->total_sectors || - (raid->total_sectors > (raid->width * SIS_LBA(parent)))) - raid->total_sectors = raid->width * SIS_LBA(parent); - break; - - case SIS_T_RAID1: - raid->type = AR_T_RAID1; - raid->width = 1; - if (!raid->total_sectors || (raid->total_sectors > SIS_LBA(parent))) - raid->total_sectors = SIS_LBA(parent); - break; - - default: - device_printf(parent, "Silicon Integrated Systems " - "unknown RAID type 0x%08x\n", meta->magic); - free(raidp[array], M_AR); - raidp[array] = NULL; - goto sis_out; - } - raid->magic_0 = meta->controller_pci_id; - raid->magic_1 = meta->timestamp; - raid->format = AR_F_SIS_RAID; - raid->generation = 0; - raid->interleave = meta->stripe_sectors; - raid->total_disks = (meta->type_total_disks & SIS_D_MASK); - raid->heads = 255; - raid->sectors = 63; - raid->cylinders = raid->total_sectors / (63 * 255); - raid->offset_sectors = 0; - raid->rebuild_lba = 0; - raid->lun = array; - /* XXX SOS if total_disks > 2 this doesn't float */ - if (((meta->disks & SIS_D_MASTER) >> 4) == meta->disk_number) - disk_number = 0; - else - disk_number = 1; - - for (drive = 0; drive < raid->total_disks; drive++) { - raid->disks[drive].sectors = raid->total_sectors/raid->width; - if (drive == disk_number) { - raid->disks[disk_number].dev = parent; - raid->disks[disk_number].flags = - (AR_DF_ONLINE | AR_DF_PRESENT | AR_DF_ASSIGNED); - ars->raid[raid->volume] = raid; - ars->disk_number[raid->volume] = disk_number; - } - } - retval = 1; - break; - } - -sis_out: - free(meta, M_AR); - return retval; -} - -static int -ata_raid_sis_write_meta(struct ar_softc *rdp) -{ - struct sis_raid_conf *meta; - struct timeval timestamp; - int disk, error = 0; - - if (!(meta = (struct sis_raid_conf *) - malloc(sizeof(struct sis_raid_conf), M_AR, M_NOWAIT | M_ZERO))) { - printf("ar%d: failed to allocate metadata storage\n", rdp->lun); - return ENOMEM; - } - - rdp->generation++; - microtime(×tamp); - - meta->magic = SIS_MAGIC; - /* XXX SOS if total_disks > 2 this doesn't float */ - for (disk = 0; disk < rdp->total_disks; disk++) { - if (rdp->disks[disk].dev) { - struct ata_channel *ch = - device_get_softc(device_get_parent(rdp->disks[disk].dev)); - struct ata_device *atadev = device_get_softc(rdp->disks[disk].dev); - int disk_number = 1 + atadev->unit + (ch->unit << 1); - - meta->disks |= disk_number << ((1 - disk) << 2); - } - } - switch (rdp->type) { - case AR_T_JBOD: - meta->type_total_disks = SIS_T_JBOD; - break; - - case AR_T_RAID0: - meta->type_total_disks = SIS_T_RAID0; - break; - - case AR_T_RAID1: - meta->type_total_disks = SIS_T_RAID1; - break; - - default: - free(meta, M_AR); - return ENODEV; - } - meta->type_total_disks |= (rdp->total_disks & SIS_D_MASK); - meta->stripe_sectors = rdp->interleave; - meta->timestamp = timestamp.tv_sec; - - for (disk = 0; disk < rdp->total_disks; disk++) { - if (rdp->disks[disk].dev) { - struct ata_channel *ch = - device_get_softc(device_get_parent(rdp->disks[disk].dev)); - struct ata_device *atadev = device_get_softc(rdp->disks[disk].dev); - - meta->controller_pci_id = - (pci_get_vendor(GRANDPARENT(rdp->disks[disk].dev)) << 16) | - pci_get_device(GRANDPARENT(rdp->disks[disk].dev)); - bcopy(atadev->param.model, meta->model, sizeof(meta->model)); - - /* XXX SOS if total_disks > 2 this may not float */ - meta->disk_number = 1 + atadev->unit + (ch->unit << 1); - - if (testing || bootverbose) - ata_raid_sis_print_meta(meta); - - if (ata_raid_rw(rdp->disks[disk].dev, - SIS_LBA(rdp->disks[disk].dev), - meta, sizeof(struct sis_raid_conf), - ATA_R_WRITE | ATA_R_DIRECT)) { - device_printf(rdp->disks[disk].dev, "write metadata failed\n"); - error = EIO; - } - } - } - free(meta, M_AR); - return error; -} - -/* VIA Tech V-RAID Metadata */ -static int -ata_raid_via_read_meta(device_t dev, struct ar_softc **raidp) -{ - struct ata_raid_subdisk *ars = device_get_softc(dev); - device_t parent = device_get_parent(dev); - struct via_raid_conf *meta; - struct ar_softc *raid = NULL; - u_int8_t checksum, *ptr; - int array, count, disk, retval = 0; - - if (!(meta = (struct via_raid_conf *) - malloc(sizeof(struct via_raid_conf), M_AR, M_NOWAIT | M_ZERO))) - return ENOMEM; - - if (ata_raid_rw(parent, VIA_LBA(parent), - meta, sizeof(struct via_raid_conf), ATA_R_READ)) { - if (testing || bootverbose) - device_printf(parent, "VIA read metadata failed\n"); - goto via_out; - } - - /* check if this is a VIA RAID struct */ - if (meta->magic != VIA_MAGIC) { - if (testing || bootverbose) - device_printf(parent, "VIA check1 failed\n"); - goto via_out; - } - - /* calculate checksum and compare for valid */ - for (checksum = 0, ptr = (u_int8_t *)meta, count = 0; count < 50; count++) - checksum += *ptr++; - if (checksum != meta->checksum) { - if (testing || bootverbose) - device_printf(parent, "VIA check2 failed\n"); - goto via_out; - } - - if (testing || bootverbose) - ata_raid_via_print_meta(meta); - - /* now convert VIA meta into our generic form */ - for (array = 0; array < MAX_ARRAYS; array++) { - if (!raidp[array]) { - raidp[array] = - (struct ar_softc *)malloc(sizeof(struct ar_softc), M_AR, - M_NOWAIT | M_ZERO); - if (!raidp[array]) { - device_printf(parent, "failed to allocate metadata storage\n"); - goto via_out; - } - } - raid = raidp[array]; - if (raid->format && (raid->format != AR_F_VIA_RAID)) - continue; - - if (raid->format == AR_F_VIA_RAID && (raid->magic_0 != meta->disks[0])) - continue; - - switch (meta->type & VIA_T_MASK) { - case VIA_T_RAID0: - raid->type = AR_T_RAID0; - raid->width = meta->stripe_layout & VIA_L_DISKS; - if (!raid->total_sectors || - (raid->total_sectors > (raid->width * meta->disk_sectors))) - raid->total_sectors = raid->width * meta->disk_sectors; - break; - - case VIA_T_RAID1: - raid->type = AR_T_RAID1; - raid->width = 1; - raid->total_sectors = meta->disk_sectors; - break; - - case VIA_T_RAID01: - raid->type = AR_T_RAID01; - raid->width = meta->stripe_layout & VIA_L_DISKS; - if (!raid->total_sectors || - (raid->total_sectors > (raid->width * meta->disk_sectors))) - raid->total_sectors = raid->width * meta->disk_sectors; - break; - - case VIA_T_RAID5: - raid->type = AR_T_RAID5; - raid->width = meta->stripe_layout & VIA_L_DISKS; - if (!raid->total_sectors || - (raid->total_sectors > ((raid->width - 1)*meta->disk_sectors))) - raid->total_sectors = (raid->width - 1) * meta->disk_sectors; - break; - - case VIA_T_SPAN: - raid->type = AR_T_SPAN; - raid->width = 1; - raid->total_sectors += meta->disk_sectors; - break; - - default: - device_printf(parent,"VIA unknown RAID type 0x%02x\n", meta->type); - free(raidp[array], M_AR); - raidp[array] = NULL; - goto via_out; - } - raid->magic_0 = meta->disks[0]; - raid->format = AR_F_VIA_RAID; - raid->generation = 0; - raid->interleave = - 0x08 << ((meta->stripe_layout & VIA_L_MASK) >> VIA_L_SHIFT); - for (count = 0, disk = 0; disk < 8; disk++) - if (meta->disks[disk]) - count++; - raid->total_disks = count; - raid->heads = 255; - raid->sectors = 63; - raid->cylinders = raid->total_sectors / (63 * 255); - raid->offset_sectors = 0; - raid->rebuild_lba = 0; - raid->lun = array; - - for (disk = 0; disk < raid->total_disks; disk++) { - if (meta->disks[disk] == meta->disk_id) { - raid->disks[disk].dev = parent; - bcopy(&meta->disk_id, raid->disks[disk].serial, - sizeof(u_int32_t)); - raid->disks[disk].sectors = meta->disk_sectors; - raid->disks[disk].flags = - (AR_DF_ONLINE | AR_DF_PRESENT | AR_DF_ASSIGNED); - ars->raid[raid->volume] = raid; - ars->disk_number[raid->volume] = disk; - retval = 1; - break; - } - } - break; - } - -via_out: - free(meta, M_AR); - return retval; -} - -static int -ata_raid_via_write_meta(struct ar_softc *rdp) -{ - struct via_raid_conf *meta; - int disk, error = 0; - - if (!(meta = (struct via_raid_conf *) - malloc(sizeof(struct via_raid_conf), M_AR, M_NOWAIT | M_ZERO))) { - printf("ar%d: failed to allocate metadata storage\n", rdp->lun); - return ENOMEM; - } - - rdp->generation++; - - meta->magic = VIA_MAGIC; - meta->dummy_0 = 0x02; - switch (rdp->type) { - case AR_T_SPAN: - meta->type = VIA_T_SPAN; - meta->stripe_layout = (rdp->total_disks & VIA_L_DISKS); - break; - - case AR_T_RAID0: - meta->type = VIA_T_RAID0; - meta->stripe_layout = ((rdp->interleave >> 1) & VIA_L_MASK); - meta->stripe_layout |= (rdp->total_disks & VIA_L_DISKS); - break; - - case AR_T_RAID1: - meta->type = VIA_T_RAID1; - meta->stripe_layout = (rdp->total_disks & VIA_L_DISKS); - break; - - case AR_T_RAID5: - meta->type = VIA_T_RAID5; - meta->stripe_layout = ((rdp->interleave >> 1) & VIA_L_MASK); - meta->stripe_layout |= (rdp->total_disks & VIA_L_DISKS); - break; - - case AR_T_RAID01: - meta->type = VIA_T_RAID01; - meta->stripe_layout = ((rdp->interleave >> 1) & VIA_L_MASK); - meta->stripe_layout |= (rdp->width & VIA_L_DISKS); - break; - - default: - free(meta, M_AR); - return ENODEV; - } - meta->type |= VIA_T_BOOTABLE; /* XXX SOS */ - meta->disk_sectors = - rdp->total_sectors / (rdp->width - (rdp->type == AR_RAID5)); - for (disk = 0; disk < rdp->total_disks; disk++) - meta->disks[disk] = (u_int32_t)(uintptr_t)rdp->disks[disk].dev; - - for (disk = 0; disk < rdp->total_disks; disk++) { - if (rdp->disks[disk].dev) { - u_int8_t *ptr; - int count; - - meta->disk_index = disk * sizeof(u_int32_t); - if (rdp->type == AR_T_RAID01) - meta->disk_index = ((meta->disk_index & 0x08) << 2) | - (meta->disk_index & ~0x08); - meta->disk_id = meta->disks[disk]; - meta->checksum = 0; - for (ptr = (u_int8_t *)meta, count = 0; count < 50; count++) - meta->checksum += *ptr++; - - if (testing || bootverbose) - ata_raid_via_print_meta(meta); - - if (ata_raid_rw(rdp->disks[disk].dev, - VIA_LBA(rdp->disks[disk].dev), - meta, sizeof(struct via_raid_conf), - ATA_R_WRITE | ATA_R_DIRECT)) { - device_printf(rdp->disks[disk].dev, "write metadata failed\n"); - error = EIO; - } - } - } - free(meta, M_AR); - return error; -} - -static struct ata_request * -ata_raid_init_request(device_t dev, struct ar_softc *rdp, struct bio *bio) -{ - struct ata_request *request; - - if (!(request = ata_alloc_request())) { - printf("FAILURE - out of memory in ata_raid_init_request\n"); - return NULL; - } - request->dev = dev; - request->timeout = ATA_REQUEST_TIMEOUT; - request->retries = 2; - request->callback = ata_raid_done; - request->driver = rdp; - request->bio = bio; - switch (request->bio->bio_cmd) { - case BIO_READ: - request->flags = ATA_R_READ; - break; - case BIO_WRITE: - request->flags = ATA_R_WRITE; - break; - case BIO_FLUSH: - request->flags = ATA_R_CONTROL; - break; - } - return request; -} - -static int -ata_raid_send_request(struct ata_request *request) -{ - struct ata_device *atadev = device_get_softc(request->dev); - - request->transfersize = min(request->bytecount, atadev->max_iosize); - if (request->flags & ATA_R_READ) { - if (atadev->mode >= ATA_DMA) { - request->flags |= ATA_R_DMA; - request->u.ata.command = ATA_READ_DMA; - } - else if (atadev->max_iosize > DEV_BSIZE) - request->u.ata.command = ATA_READ_MUL; - else - request->u.ata.command = ATA_READ; - } - else if (request->flags & ATA_R_WRITE) { - if (atadev->mode >= ATA_DMA) { - request->flags |= ATA_R_DMA; - request->u.ata.command = ATA_WRITE_DMA; - } - else if (atadev->max_iosize > DEV_BSIZE) - request->u.ata.command = ATA_WRITE_MUL; - else - request->u.ata.command = ATA_WRITE; - } - else { - device_printf(request->dev, "FAILURE - unknown IO operation\n"); - ata_free_request(request); - return EIO; - } - request->flags |= (ATA_R_ORDERED | ATA_R_THREAD); - ata_queue_request(request); - return 0; -} - -static int -ata_raid_rw(device_t dev, u_int64_t lba, void *data, u_int bcount, int flags) -{ - struct ata_device *atadev = device_get_softc(dev); - struct ata_request *request; - int error; - - if (bcount % DEV_BSIZE) { - device_printf(dev, "FAILURE - transfers must be modulo sectorsize\n"); - return ENOMEM; - } - - if (!(request = ata_alloc_request())) { - device_printf(dev, "FAILURE - out of memory in ata_raid_rw\n"); - return ENOMEM; - } - - /* setup request */ - request->dev = dev; - request->timeout = ATA_REQUEST_TIMEOUT; - request->retries = 0; - request->data = data; - request->bytecount = bcount; - request->transfersize = DEV_BSIZE; - request->u.ata.lba = lba; - request->u.ata.count = request->bytecount / DEV_BSIZE; - request->flags = flags; - - if (flags & ATA_R_READ) { - if (atadev->mode >= ATA_DMA) { - request->u.ata.command = ATA_READ_DMA; - request->flags |= ATA_R_DMA; - } - else - request->u.ata.command = ATA_READ; - ata_queue_request(request); - } - else if (flags & ATA_R_WRITE) { - if (atadev->mode >= ATA_DMA) { - request->u.ata.command = ATA_WRITE_DMA; - request->flags |= ATA_R_DMA; - } - else - request->u.ata.command = ATA_WRITE; - ata_queue_request(request); - } - else { - device_printf(dev, "FAILURE - unknown IO operation\n"); - request->result = EIO; - } - error = request->result; - ata_free_request(request); - return error; -} - -/* - * module handeling - */ -static int -ata_raid_subdisk_probe(device_t dev) -{ - device_quiet(dev); - return 0; -} - -static int -ata_raid_subdisk_attach(device_t dev) -{ - struct ata_raid_subdisk *ars = device_get_softc(dev); - int volume; - - for (volume = 0; volume < MAX_VOLUMES; volume++) { - ars->raid[volume] = NULL; - ars->disk_number[volume] = -1; - } - ata_raid_read_metadata(dev); - return 0; -} - -static int -ata_raid_subdisk_detach(device_t dev) -{ - struct ata_raid_subdisk *ars = device_get_softc(dev); - int volume; - - for (volume = 0; volume < MAX_VOLUMES; volume++) { - if (ars->raid[volume]) { - ars->raid[volume]->disks[ars->disk_number[volume]].flags &= - ~(AR_DF_PRESENT | AR_DF_ONLINE); - ars->raid[volume]->disks[ars->disk_number[volume]].dev = NULL; - if (mtx_initialized(&ars->raid[volume]->lock)) - ata_raid_config_changed(ars->raid[volume], 1); - ars->raid[volume] = NULL; - ars->disk_number[volume] = -1; - } - } - return 0; -} - -static device_method_t ata_raid_sub_methods[] = { - /* device interface */ - DEVMETHOD(device_probe, ata_raid_subdisk_probe), - DEVMETHOD(device_attach, ata_raid_subdisk_attach), - DEVMETHOD(device_detach, ata_raid_subdisk_detach), - DEVMETHOD_END -}; - -static driver_t ata_raid_sub_driver = { - "subdisk", - ata_raid_sub_methods, - sizeof(struct ata_raid_subdisk) -}; - -DRIVER_MODULE(subdisk, ad, ata_raid_sub_driver, ata_raid_sub_devclass, NULL, NULL); - -static int -ata_raid_module_event_handler(module_t mod, int what, void *arg) -{ - int i; - - switch (what) { - case MOD_LOAD: - if (testing || bootverbose) - printf("ATA PseudoRAID loaded\n"); -#if 0 - /* setup table to hold metadata for all ATA PseudoRAID arrays */ - ata_raid_arrays = malloc(sizeof(struct ar_soft *) * MAX_ARRAYS, - M_AR, M_NOWAIT | M_ZERO); - if (!ata_raid_arrays) { - printf("ataraid: no memory for metadata storage\n"); - return ENOMEM; - } -#endif - /* attach found PseudoRAID arrays */ - for (i = 0; i < MAX_ARRAYS; i++) { - struct ar_softc *rdp = ata_raid_arrays[i]; - - if (!rdp || !rdp->format) - continue; - if (testing || bootverbose) - ata_raid_print_meta(rdp); - ata_raid_attach(rdp, 0); - } - ata_raid_ioctl_func = ata_raid_ioctl; - return 0; - - case MOD_UNLOAD: - /* detach found PseudoRAID arrays */ - for (i = 0; i < MAX_ARRAYS; i++) { - struct ar_softc *rdp = ata_raid_arrays[i]; - - if (!rdp || !rdp->status) - continue; - if (mtx_initialized(&rdp->lock)) - mtx_destroy(&rdp->lock); - if (rdp->disk) - disk_destroy(rdp->disk); - } - if (testing || bootverbose) - printf("ATA PseudoRAID unloaded\n"); -#if 0 - free(ata_raid_arrays, M_AR); -#endif - ata_raid_ioctl_func = NULL; - return 0; - - default: - return EOPNOTSUPP; - } -} - -static moduledata_t ata_raid_moduledata = - { "ataraid", ata_raid_module_event_handler, NULL }; -DECLARE_MODULE(ata, ata_raid_moduledata, SI_SUB_RAID, SI_ORDER_FIRST); -MODULE_VERSION(ataraid, 1); -MODULE_DEPEND(ataraid, ata, 1, 1, 1); -MODULE_DEPEND(ataraid, ad, 1, 1, 1); - -static char * -ata_raid_format(struct ar_softc *rdp) -{ - switch (rdp->format) { - case AR_F_FREEBSD_RAID: return "FreeBSD PseudoRAID"; - case AR_F_ADAPTEC_RAID: return "Adaptec HostRAID"; - case AR_F_DDF_RAID: return "DDF"; - case AR_F_HPTV2_RAID: return "HighPoint v2 RocketRAID"; - case AR_F_HPTV3_RAID: return "HighPoint v3 RocketRAID"; - case AR_F_INTEL_RAID: return "Intel MatrixRAID"; - case AR_F_ITE_RAID: return "Integrated Technology Express"; - case AR_F_JMICRON_RAID: return "JMicron Technology Corp"; - case AR_F_LSIV2_RAID: return "LSILogic v2 MegaRAID"; - case AR_F_LSIV3_RAID: return "LSILogic v3 MegaRAID"; - case AR_F_NVIDIA_RAID: return "nVidia MediaShield"; - case AR_F_PROMISE_RAID: return "Promise Fasttrak"; - case AR_F_SII_RAID: return "Silicon Image Medley"; - case AR_F_SIS_RAID: return "Silicon Integrated Systems"; - case AR_F_VIA_RAID: return "VIA Tech V-RAID"; - default: return "UNKNOWN"; - } -} - -static char * -ata_raid_type(struct ar_softc *rdp) -{ - switch (rdp->type) { - case AR_T_JBOD: return "JBOD"; - case AR_T_SPAN: return "SPAN"; - case AR_T_RAID0: return "RAID0"; - case AR_T_RAID1: return "RAID1"; - case AR_T_RAID3: return "RAID3"; - case AR_T_RAID4: return "RAID4"; - case AR_T_RAID5: return "RAID5"; - case AR_T_RAID01: return "RAID0+1"; - default: return "UNKNOWN"; - } -} - -static char * -ata_raid_flags(struct ar_softc *rdp) -{ - switch (rdp->status & (AR_S_READY | AR_S_DEGRADED | AR_S_REBUILDING)) { - case AR_S_READY: return "READY"; - case AR_S_READY | AR_S_DEGRADED: return "DEGRADED"; - case AR_S_READY | AR_S_REBUILDING: - case AR_S_READY | AR_S_DEGRADED | AR_S_REBUILDING: return "REBUILDING"; - default: return "BROKEN"; - } -} - -/* debugging gunk */ -static void -ata_raid_print_meta(struct ar_softc *raid) -{ - int i; - - printf("********** ATA PseudoRAID ar%d Metadata **********\n", raid->lun); - printf("=================================================\n"); - printf("format %s\n", ata_raid_format(raid)); - printf("type %s\n", ata_raid_type(raid)); - printf("flags 0x%02x %b\n", raid->status, raid->status, - "\20\3REBUILDING\2DEGRADED\1READY\n"); - printf("magic_0 0x%016jx\n", raid->magic_0); - printf("magic_1 0x%016jx\n",raid->magic_1); - printf("generation %u\n", raid->generation); - printf("total_sectors %ju\n", raid->total_sectors); - printf("offset_sectors %ju\n", raid->offset_sectors); - printf("heads %u\n", raid->heads); - printf("sectors %u\n", raid->sectors); - printf("cylinders %u\n", raid->cylinders); - printf("width %u\n", raid->width); - printf("interleave %u\n", raid->interleave); - printf("total_disks %u\n", raid->total_disks); - for (i = 0; i < raid->total_disks; i++) { - printf(" disk %d: flags = 0x%02x %b\n", i, raid->disks[i].flags, - raid->disks[i].flags, "\20\4ONLINE\3SPARE\2ASSIGNED\1PRESENT\n"); - if (raid->disks[i].dev) { - printf(" "); - device_printf(raid->disks[i].dev, " sectors %jd\n", - raid->disks[i].sectors); - } - } - printf("=================================================\n"); -} - -static char * -ata_raid_adaptec_type(int type) -{ - static char buffer[16]; - - switch (type) { - case ADP_T_RAID0: return "RAID0"; - case ADP_T_RAID1: return "RAID1"; - default: sprintf(buffer, "UNKNOWN 0x%02x", type); - return buffer; - } -} - -static void -ata_raid_adaptec_print_meta(struct adaptec_raid_conf *meta) -{ - int i; - - printf("********* ATA Adaptec HostRAID Metadata *********\n"); - printf("magic_0 <0x%08x>\n", be32toh(meta->magic_0)); - printf("generation 0x%08x\n", be32toh(meta->generation)); - printf("dummy_0 0x%04x\n", be16toh(meta->dummy_0)); - printf("total_configs %u\n", be16toh(meta->total_configs)); - printf("dummy_1 0x%04x\n", be16toh(meta->dummy_1)); - printf("checksum 0x%04x\n", be16toh(meta->checksum)); - printf("dummy_2 0x%08x\n", be32toh(meta->dummy_2)); - printf("dummy_3 0x%08x\n", be32toh(meta->dummy_3)); - printf("flags 0x%08x\n", be32toh(meta->flags)); - printf("timestamp 0x%08x\n", be32toh(meta->timestamp)); - printf("dummy_4 0x%08x 0x%08x 0x%08x 0x%08x\n", - be32toh(meta->dummy_4[0]), be32toh(meta->dummy_4[1]), - be32toh(meta->dummy_4[2]), be32toh(meta->dummy_4[3])); - printf("dummy_5 0x%08x 0x%08x 0x%08x 0x%08x\n", - be32toh(meta->dummy_5[0]), be32toh(meta->dummy_5[1]), - be32toh(meta->dummy_5[2]), be32toh(meta->dummy_5[3])); - - for (i = 0; i < be16toh(meta->total_configs); i++) { - printf(" %d total_disks %u\n", i, - be16toh(meta->configs[i].disk_number)); - printf(" %d generation %u\n", i, - be16toh(meta->configs[i].generation)); - printf(" %d magic_0 0x%08x\n", i, - be32toh(meta->configs[i].magic_0)); - printf(" %d dummy_0 0x%02x\n", i, meta->configs[i].dummy_0); - printf(" %d type %s\n", i, - ata_raid_adaptec_type(meta->configs[i].type)); - printf(" %d dummy_1 0x%02x\n", i, meta->configs[i].dummy_1); - printf(" %d flags %d\n", i, - be32toh(meta->configs[i].flags)); - printf(" %d dummy_2 0x%02x\n", i, meta->configs[i].dummy_2); - printf(" %d dummy_3 0x%02x\n", i, meta->configs[i].dummy_3); - printf(" %d dummy_4 0x%02x\n", i, meta->configs[i].dummy_4); - printf(" %d dummy_5 0x%02x\n", i, meta->configs[i].dummy_5); - printf(" %d disk_number %u\n", i, - be32toh(meta->configs[i].disk_number)); - printf(" %d dummy_6 0x%08x\n", i, - be32toh(meta->configs[i].dummy_6)); - printf(" %d sectors %u\n", i, - be32toh(meta->configs[i].sectors)); - printf(" %d stripe_shift %u\n", i, - be16toh(meta->configs[i].stripe_shift)); - printf(" %d dummy_7 0x%08x\n", i, - be32toh(meta->configs[i].dummy_7)); - printf(" %d dummy_8 0x%08x 0x%08x 0x%08x 0x%08x\n", i, - be32toh(meta->configs[i].dummy_8[0]), - be32toh(meta->configs[i].dummy_8[1]), - be32toh(meta->configs[i].dummy_8[2]), - be32toh(meta->configs[i].dummy_8[3])); - printf(" %d name <%s>\n", i, meta->configs[i].name); - } - printf("magic_1 <0x%08x>\n", be32toh(meta->magic_1)); - printf("magic_2 <0x%08x>\n", be32toh(meta->magic_2)); - printf("magic_3 <0x%08x>\n", be32toh(meta->magic_3)); - printf("magic_4 <0x%08x>\n", be32toh(meta->magic_4)); - printf("=================================================\n"); -} - -static void -ata_raid_ddf_print_meta(uint8_t *meta) -{ - struct ddf_header *hdr; - struct ddf_cd_record *cd; - struct ddf_pd_record *pdr; - struct ddf_pd_entry *pde; - struct ddf_vd_record *vdr; - struct ddf_vd_entry *vde; - struct ddf_pdd_record *pdd; - uint64_t (*ddf64toh)(uint64_t) = NULL; - uint32_t (*ddf32toh)(uint32_t) = NULL; - uint16_t (*ddf16toh)(uint16_t) = NULL; - uint8_t *cr; - char *r; - - /* Check if this is a DDF RAID struct */ - hdr = (struct ddf_header *)meta; - if (be32toh(hdr->Signature) == DDF_HEADER_SIGNATURE) { - ddf64toh = ddfbe64toh; - ddf32toh = ddfbe32toh; - ddf16toh = ddfbe16toh; - } else { - ddf64toh = ddfle64toh; - ddf32toh = ddfle32toh; - ddf16toh = ddfle16toh; - } - - hdr = (struct ddf_header*)meta; - cd = (struct ddf_cd_record*)(meta + ddf32toh(hdr->cd_section) *DEV_BSIZE); - pdr = (struct ddf_pd_record*)(meta + ddf32toh(hdr->pdr_section)*DEV_BSIZE); - vdr = (struct ddf_vd_record*)(meta + ddf32toh(hdr->vdr_section)*DEV_BSIZE); - cr = (uint8_t *)(meta + ddf32toh(hdr->cr_section) * DEV_BSIZE); - pdd = (struct ddf_pdd_record*)(meta + ddf32toh(hdr->pdd_section)*DEV_BSIZE); - pde = NULL; - vde = NULL; - - printf("********* ATA DDF Metadata *********\n"); - printf("**** Header ****\n"); - r = (char *)&hdr->DDF_rev[0]; - printf("DDF_rev= %8.8s Sequence_Number= 0x%x Open_Flag= 0x%x\n", r, - ddf32toh(hdr->Sequence_Number), hdr->Open_Flag); - printf("Primary Header LBA= %llu Header_Type = 0x%x\n", - (unsigned long long)ddf64toh(hdr->Primary_Header_LBA), - hdr->Header_Type); - printf("Max_PD_Entries= %d Max_VD_Entries= %d Max_Partitions= %d " - "CR_Length= %d\n", ddf16toh(hdr->Max_PD_Entries), - ddf16toh(hdr->Max_VD_Entries), ddf16toh(hdr->Max_Partitions), - ddf16toh(hdr->Configuration_Record_Length)); - printf("CD= %d:%d PDR= %d:%d VDR= %d:%d CR= %d:%d PDD= %d%d\n", - ddf32toh(hdr->cd_section), ddf32toh(hdr->cd_length), - ddf32toh(hdr->pdr_section), ddf32toh(hdr->pdr_length), - ddf32toh(hdr->vdr_section), ddf32toh(hdr->vdr_length), - ddf32toh(hdr->cr_section), ddf32toh(hdr->cr_length), - ddf32toh(hdr->pdd_section), ddf32toh(hdr->pdd_length)); - printf("**** Controler Data ****\n"); - r = (char *)&cd->Product_ID[0]; - printf("Product_ID: %16.16s\n", r); - printf("Vendor 0x%x, Device 0x%x, SubVendor 0x%x, Sub_Device 0x%x\n", - ddf16toh(cd->Controller_Type.Vendor_ID), - ddf16toh(cd->Controller_Type.Device_ID), - ddf16toh(cd->Controller_Type.SubVendor_ID), - ddf16toh(cd->Controller_Type.SubDevice_ID)); -} - -static char * -ata_raid_hptv2_type(int type) -{ - static char buffer[16]; - - switch (type) { - case HPTV2_T_RAID0: return "RAID0"; - case HPTV2_T_RAID1: return "RAID1"; - case HPTV2_T_RAID01_RAID0: return "RAID01_RAID0"; - case HPTV2_T_SPAN: return "SPAN"; - case HPTV2_T_RAID_3: return "RAID3"; - case HPTV2_T_RAID_5: return "RAID5"; - case HPTV2_T_JBOD: return "JBOD"; - case HPTV2_T_RAID01_RAID1: return "RAID01_RAID1"; - default: sprintf(buffer, "UNKNOWN 0x%02x", type); - return buffer; - } -} - -static void -ata_raid_hptv2_print_meta(struct hptv2_raid_conf *meta) -{ - int i; - - printf("****** ATA Highpoint V2 RocketRAID Metadata *****\n"); - printf("magic 0x%08x\n", meta->magic); - printf("magic_0 0x%08x\n", meta->magic_0); - printf("magic_1 0x%08x\n", meta->magic_1); - printf("order 0x%08x\n", meta->order); - printf("array_width %u\n", meta->array_width); - printf("stripe_shift %u\n", meta->stripe_shift); - printf("type %s\n", ata_raid_hptv2_type(meta->type)); - printf("disk_number %u\n", meta->disk_number); - printf("total_sectors %u\n", meta->total_sectors); - printf("disk_mode 0x%08x\n", meta->disk_mode); - printf("boot_mode 0x%08x\n", meta->boot_mode); - printf("boot_disk 0x%02x\n", meta->boot_disk); - printf("boot_protect 0x%02x\n", meta->boot_protect); - printf("log_entries 0x%02x\n", meta->error_log_entries); - printf("log_index 0x%02x\n", meta->error_log_index); - if (meta->error_log_entries) { - printf(" timestamp reason disk status sectors lba\n"); - for (i = meta->error_log_index; - i < meta->error_log_index + meta->error_log_entries; i++) - printf(" 0x%08x 0x%02x 0x%02x 0x%02x 0x%02x 0x%08x\n", - meta->errorlog[i%32].timestamp, - meta->errorlog[i%32].reason, - meta->errorlog[i%32].disk, meta->errorlog[i%32].status, - meta->errorlog[i%32].sectors, meta->errorlog[i%32].lba); - } - printf("rebuild_lba 0x%08x\n", meta->rebuild_lba); - printf("dummy_1 0x%02x\n", meta->dummy_1); - printf("name_1 <%.15s>\n", meta->name_1); - printf("dummy_2 0x%02x\n", meta->dummy_2); - printf("name_2 <%.15s>\n", meta->name_2); - printf("=================================================\n"); -} - -static char * -ata_raid_hptv3_type(int type) -{ - static char buffer[16]; - - switch (type) { - case HPTV3_T_SPARE: return "SPARE"; - case HPTV3_T_JBOD: return "JBOD"; - case HPTV3_T_SPAN: return "SPAN"; - case HPTV3_T_RAID0: return "RAID0"; - case HPTV3_T_RAID1: return "RAID1"; - case HPTV3_T_RAID3: return "RAID3"; - case HPTV3_T_RAID5: return "RAID5"; - default: sprintf(buffer, "UNKNOWN 0x%02x", type); - return buffer; - } -} - -static void -ata_raid_hptv3_print_meta(struct hptv3_raid_conf *meta) -{ - int i; - - printf("****** ATA Highpoint V3 RocketRAID Metadata *****\n"); - printf("magic 0x%08x\n", meta->magic); - printf("magic_0 0x%08x\n", meta->magic_0); - printf("checksum_0 0x%02x\n", meta->checksum_0); - printf("mode 0x%02x\n", meta->mode); - printf("user_mode 0x%02x\n", meta->user_mode); - printf("config_entries 0x%02x\n", meta->config_entries); - for (i = 0; i < meta->config_entries; i++) { - printf("config %d:\n", i); - printf(" total_sectors %ju\n", - meta->configs[0].total_sectors + - ((u_int64_t)meta->configs_high[0].total_sectors << 32)); - printf(" type %s\n", - ata_raid_hptv3_type(meta->configs[i].type)); - printf(" total_disks %u\n", meta->configs[i].total_disks); - printf(" disk_number %u\n", meta->configs[i].disk_number); - printf(" stripe_shift %u\n", meta->configs[i].stripe_shift); - printf(" status %b\n", meta->configs[i].status, - "\20\2RAID5\1NEED_REBUILD\n"); - printf(" critical_disks %u\n", meta->configs[i].critical_disks); - printf(" rebuild_lba %ju\n", - meta->configs_high[0].rebuild_lba + - ((u_int64_t)meta->configs_high[0].rebuild_lba << 32)); - } - printf("name <%.16s>\n", meta->name); - printf("timestamp 0x%08x\n", meta->timestamp); - printf("description <%.16s>\n", meta->description); - printf("creator <%.16s>\n", meta->creator); - printf("checksum_1 0x%02x\n", meta->checksum_1); - printf("dummy_0 0x%02x\n", meta->dummy_0); - printf("dummy_1 0x%02x\n", meta->dummy_1); - printf("flags %b\n", meta->flags, - "\20\4RCACHE\3WCACHE\2NCQ\1TCQ\n"); - printf("=================================================\n"); -} - -static char * -ata_raid_intel_type(int type) -{ - static char buffer[16]; - - switch (type) { - case INTEL_T_RAID0: return "RAID0"; - case INTEL_T_RAID1: return "RAID1"; - case INTEL_T_RAID5: return "RAID5"; - default: sprintf(buffer, "UNKNOWN 0x%02x", type); - return buffer; - } -} - -static void -ata_raid_intel_print_meta(struct intel_raid_conf *meta) -{ - struct intel_raid_mapping *map; - int i, j; - - printf("********* ATA Intel MatrixRAID Metadata *********\n"); - printf("intel_id <%.24s>\n", meta->intel_id); - printf("version <%.6s>\n", meta->version); - printf("checksum 0x%08x\n", meta->checksum); - printf("config_size 0x%08x\n", meta->config_size); - printf("config_id 0x%08x\n", meta->config_id); - printf("generation 0x%08x\n", meta->generation); - printf("total_disks %u\n", meta->total_disks); - printf("total_volumes %u\n", meta->total_volumes); - printf("DISK# serial disk_sectors disk_id flags\n"); - for (i = 0; i < meta->total_disks; i++ ) { - printf(" %d <%.16s> %u 0x%08x 0x%08x\n", i, - meta->disk[i].serial, meta->disk[i].sectors, - meta->disk[i].id, meta->disk[i].flags); - } - map = (struct intel_raid_mapping *)&meta->disk[meta->total_disks]; - for (j = 0; j < meta->total_volumes; j++) { - printf("name %.16s\n", map->name); - printf("total_sectors %ju\n", map->total_sectors); - printf("state %u\n", map->state); - printf("reserved %u\n", map->reserved); - printf("offset %u\n", map->offset); - printf("disk_sectors %u\n", map->disk_sectors); - printf("stripe_count %u\n", map->stripe_count); - printf("stripe_sectors %u\n", map->stripe_sectors); - printf("status %u\n", map->status); - printf("type %s\n", ata_raid_intel_type(map->type)); - printf("total_disks %u\n", map->total_disks); - printf("magic[0] 0x%02x\n", map->magic[0]); - printf("magic[1] 0x%02x\n", map->magic[1]); - printf("magic[2] 0x%02x\n", map->magic[2]); - for (i = 0; i < map->total_disks; i++ ) { - printf(" disk %d at disk_idx 0x%08x\n", i, map->disk_idx[i]); - } - map = (struct intel_raid_mapping *)&map->disk_idx[map->total_disks]; - } - printf("=================================================\n"); -} - -static char * -ata_raid_ite_type(int type) -{ - static char buffer[16]; - - switch (type) { - case ITE_T_RAID0: return "RAID0"; - case ITE_T_RAID1: return "RAID1"; - case ITE_T_RAID01: return "RAID0+1"; - case ITE_T_SPAN: return "SPAN"; - default: sprintf(buffer, "UNKNOWN 0x%02x", type); - return buffer; - } -} - -static void -ata_raid_ite_print_meta(struct ite_raid_conf *meta) -{ - printf("*** ATA Integrated Technology Express Metadata **\n"); - printf("ite_id <%.40s>\n", meta->ite_id); - printf("timestamp_0 %04x/%02x/%02x %02x:%02x:%02x.%02x\n", - *((u_int16_t *)meta->timestamp_0), meta->timestamp_0[2], - meta->timestamp_0[3], meta->timestamp_0[5], meta->timestamp_0[4], - meta->timestamp_0[7], meta->timestamp_0[6]); - printf("total_sectors %jd\n", meta->total_sectors); - printf("type %s\n", ata_raid_ite_type(meta->type)); - printf("stripe_1kblocks %u\n", meta->stripe_1kblocks); - printf("timestamp_1 %04x/%02x/%02x %02x:%02x:%02x.%02x\n", - *((u_int16_t *)meta->timestamp_1), meta->timestamp_1[2], - meta->timestamp_1[3], meta->timestamp_1[5], meta->timestamp_1[4], - meta->timestamp_1[7], meta->timestamp_1[6]); - printf("stripe_sectors %u\n", meta->stripe_sectors); - printf("array_width %u\n", meta->array_width); - printf("disk_number %u\n", meta->disk_number); - printf("disk_sectors %u\n", meta->disk_sectors); - printf("=================================================\n"); -} - -static char * -ata_raid_jmicron_type(int type) -{ - static char buffer[16]; - - switch (type) { - case JM_T_RAID0: return "RAID0"; - case JM_T_RAID1: return "RAID1"; - case JM_T_RAID01: return "RAID0+1"; - case JM_T_JBOD: return "JBOD"; - case JM_T_RAID5: return "RAID5"; - default: sprintf(buffer, "UNKNOWN 0x%02x", type); - return buffer; - } -} - -static void -ata_raid_jmicron_print_meta(struct jmicron_raid_conf *meta) -{ - int i; - - printf("***** ATA JMicron Technology Corp Metadata ******\n"); - printf("signature %.2s\n", meta->signature); - printf("version 0x%04x\n", meta->version); - printf("checksum 0x%04x\n", meta->checksum); - printf("disk_id 0x%08x\n", meta->disk_id); - printf("offset 0x%08x\n", meta->offset); - printf("disk_sectors_low 0x%08x\n", meta->disk_sectors_low); - printf("disk_sectors_high 0x%08x\n", meta->disk_sectors_high); - printf("name %.16s\n", meta->name); - printf("type %s\n", ata_raid_jmicron_type(meta->type)); - printf("stripe_shift %d\n", meta->stripe_shift); - printf("flags 0x%04x\n", meta->flags); - printf("spare:\n"); - for (i=0; i < 2 && meta->spare[i]; i++) - printf(" %d 0x%08x\n", i, meta->spare[i]); - printf("disks:\n"); - for (i=0; i < 8 && meta->disks[i]; i++) - printf(" %d 0x%08x\n", i, meta->disks[i]); - printf("=================================================\n"); -} - -static char * -ata_raid_lsiv2_type(int type) -{ - static char buffer[16]; - - switch (type) { - case LSIV2_T_RAID0: return "RAID0"; - case LSIV2_T_RAID1: return "RAID1"; - case LSIV2_T_SPARE: return "SPARE"; - default: sprintf(buffer, "UNKNOWN 0x%02x", type); - return buffer; - } -} - -static void -ata_raid_lsiv2_print_meta(struct lsiv2_raid_conf *meta) -{ - int i; - - printf("******* ATA LSILogic V2 MegaRAID Metadata *******\n"); - printf("lsi_id <%s>\n", meta->lsi_id); - printf("dummy_0 0x%02x\n", meta->dummy_0); - printf("flags 0x%02x\n", meta->flags); - printf("version 0x%04x\n", meta->version); - printf("config_entries 0x%02x\n", meta->config_entries); - printf("raid_count 0x%02x\n", meta->raid_count); - printf("total_disks 0x%02x\n", meta->total_disks); - printf("dummy_1 0x%02x\n", meta->dummy_1); - printf("dummy_2 0x%04x\n", meta->dummy_2); - for (i = 0; i < meta->config_entries; i++) { - printf(" type %s\n", - ata_raid_lsiv2_type(meta->configs[i].raid.type)); - printf(" dummy_0 %02x\n", meta->configs[i].raid.dummy_0); - printf(" stripe_sectors %u\n", - meta->configs[i].raid.stripe_sectors); - printf(" array_width %u\n", - meta->configs[i].raid.array_width); - printf(" disk_count %u\n", meta->configs[i].raid.disk_count); - printf(" config_offset %u\n", - meta->configs[i].raid.config_offset); - printf(" dummy_1 %u\n", meta->configs[i].raid.dummy_1); - printf(" flags %02x\n", meta->configs[i].raid.flags); - printf(" total_sectors %u\n", - meta->configs[i].raid.total_sectors); - } - printf("disk_number 0x%02x\n", meta->disk_number); - printf("raid_number 0x%02x\n", meta->raid_number); - printf("timestamp 0x%08x\n", meta->timestamp); - printf("=================================================\n"); -} - -static char * -ata_raid_lsiv3_type(int type) -{ - static char buffer[16]; - - switch (type) { - case LSIV3_T_RAID0: return "RAID0"; - case LSIV3_T_RAID1: return "RAID1"; - default: sprintf(buffer, "UNKNOWN 0x%02x", type); - return buffer; - } -} - -static void -ata_raid_lsiv3_print_meta(struct lsiv3_raid_conf *meta) -{ - int i; - - printf("******* ATA LSILogic V3 MegaRAID Metadata *******\n"); - printf("lsi_id <%.6s>\n", meta->lsi_id); - printf("dummy_0 0x%04x\n", meta->dummy_0); - printf("version 0x%04x\n", meta->version); - printf("dummy_0 0x%04x\n", meta->dummy_1); - printf("RAID configs:\n"); - for (i = 0; i < 8; i++) { - if (meta->raid[i].total_disks) { - printf("%02d stripe_pages %u\n", i, - meta->raid[i].stripe_pages); - printf("%02d type %s\n", i, - ata_raid_lsiv3_type(meta->raid[i].type)); - printf("%02d total_disks %u\n", i, - meta->raid[i].total_disks); - printf("%02d array_width %u\n", i, - meta->raid[i].array_width); - printf("%02d sectors %u\n", i, meta->raid[i].sectors); - printf("%02d offset %u\n", i, meta->raid[i].offset); - printf("%02d device 0x%02x\n", i, - meta->raid[i].device); - } - } - printf("DISK configs:\n"); - for (i = 0; i < 6; i++) { - if (meta->disk[i].disk_sectors) { - printf("%02d disk_sectors %u\n", i, - meta->disk[i].disk_sectors); - printf("%02d flags 0x%02x\n", i, meta->disk[i].flags); - } - } - printf("device 0x%02x\n", meta->device); - printf("timestamp 0x%08x\n", meta->timestamp); - printf("checksum_1 0x%02x\n", meta->checksum_1); - printf("=================================================\n"); -} - -static char * -ata_raid_nvidia_type(int type) -{ - static char buffer[16]; - - switch (type) { - case NV_T_SPAN: return "SPAN"; - case NV_T_RAID0: return "RAID0"; - case NV_T_RAID1: return "RAID1"; - case NV_T_RAID3: return "RAID3"; - case NV_T_RAID5: return "RAID5"; - case NV_T_RAID01: return "RAID0+1"; - default: sprintf(buffer, "UNKNOWN 0x%02x", type); - return buffer; - } -} - -static void -ata_raid_nvidia_print_meta(struct nvidia_raid_conf *meta) -{ - printf("******** ATA nVidia MediaShield Metadata ********\n"); - printf("nvidia_id <%.8s>\n", meta->nvidia_id); - printf("config_size %d\n", meta->config_size); - printf("checksum 0x%08x\n", meta->checksum); - printf("version 0x%04x\n", meta->version); - printf("disk_number %d\n", meta->disk_number); - printf("dummy_0 0x%02x\n", meta->dummy_0); - printf("total_sectors %d\n", meta->total_sectors); - printf("sectors_size %d\n", meta->sector_size); - printf("serial %.16s\n", meta->serial); - printf("revision %.4s\n", meta->revision); - printf("dummy_1 0x%08x\n", meta->dummy_1); - printf("magic_0 0x%08x\n", meta->magic_0); - printf("magic_1 0x%016jx\n", meta->magic_1); - printf("magic_2 0x%016jx\n", meta->magic_2); - printf("flags 0x%02x\n", meta->flags); - printf("array_width %d\n", meta->array_width); - printf("total_disks %d\n", meta->total_disks); - printf("dummy_2 0x%02x\n", meta->dummy_2); - printf("type %s\n", ata_raid_nvidia_type(meta->type)); - printf("dummy_3 0x%04x\n", meta->dummy_3); - printf("stripe_sectors %d\n", meta->stripe_sectors); - printf("stripe_bytes %d\n", meta->stripe_bytes); - printf("stripe_shift %d\n", meta->stripe_shift); - printf("stripe_mask 0x%08x\n", meta->stripe_mask); - printf("stripe_sizesectors %d\n", meta->stripe_sizesectors); - printf("stripe_sizebytes %d\n", meta->stripe_sizebytes); - printf("rebuild_lba %d\n", meta->rebuild_lba); - printf("dummy_4 0x%08x\n", meta->dummy_4); - printf("dummy_5 0x%08x\n", meta->dummy_5); - printf("status 0x%08x\n", meta->status); - printf("=================================================\n"); -} - -static char * -ata_raid_promise_type(int type) -{ - static char buffer[16]; - - switch (type) { - case PR_T_RAID0: return "RAID0"; - case PR_T_RAID1: return "RAID1"; - case PR_T_RAID3: return "RAID3"; - case PR_T_RAID5: return "RAID5"; - case PR_T_SPAN: return "SPAN"; - default: sprintf(buffer, "UNKNOWN 0x%02x", type); - return buffer; - } -} - -static void -ata_raid_promise_print_meta(struct promise_raid_conf *meta) -{ - int i; - - printf("********* ATA Promise FastTrak Metadata *********\n"); - printf("promise_id <%s>\n", meta->promise_id); - printf("dummy_0 0x%08x\n", meta->dummy_0); - printf("magic_0 0x%016jx\n", meta->magic_0); - printf("magic_1 0x%04x\n", meta->magic_1); - printf("magic_2 0x%08x\n", meta->magic_2); - printf("integrity 0x%08x %b\n", meta->raid.integrity, - meta->raid.integrity, "\20\10VALID\n" ); - printf("flags 0x%02x %b\n", - meta->raid.flags, meta->raid.flags, - "\20\10READY\7DOWN\6REDIR\5DUPLICATE\4SPARE" - "\3ASSIGNED\2ONLINE\1VALID\n"); - printf("disk_number %d\n", meta->raid.disk_number); - printf("channel 0x%02x\n", meta->raid.channel); - printf("device 0x%02x\n", meta->raid.device); - printf("magic_0 0x%016jx\n", meta->raid.magic_0); - printf("disk_offset %u\n", meta->raid.disk_offset); - printf("disk_sectors %u\n", meta->raid.disk_sectors); - printf("rebuild_lba 0x%08x\n", meta->raid.rebuild_lba); - printf("generation 0x%04x\n", meta->raid.generation); - printf("status 0x%02x %b\n", - meta->raid.status, meta->raid.status, - "\20\6MARKED\5DEGRADED\4READY\3INITED\2ONLINE\1VALID\n"); - printf("type %s\n", ata_raid_promise_type(meta->raid.type)); - printf("total_disks %u\n", meta->raid.total_disks); - printf("stripe_shift %u\n", meta->raid.stripe_shift); - printf("array_width %u\n", meta->raid.array_width); - printf("array_number %u\n", meta->raid.array_number); - printf("total_sectors %u\n", meta->raid.total_sectors); - printf("cylinders %u\n", meta->raid.cylinders); - printf("heads %u\n", meta->raid.heads); - printf("sectors %u\n", meta->raid.sectors); - printf("magic_1 0x%016jx\n", meta->raid.magic_1); - printf("DISK# flags dummy_0 channel device magic_0\n"); - for (i = 0; i < 8; i++) { - printf(" %d %b 0x%02x 0x%02x 0x%02x ", - i, meta->raid.disk[i].flags, - "\20\10READY\7DOWN\6REDIR\5DUPLICATE\4SPARE" - "\3ASSIGNED\2ONLINE\1VALID\n", meta->raid.disk[i].dummy_0, - meta->raid.disk[i].channel, meta->raid.disk[i].device); - printf("0x%016jx\n", meta->raid.disk[i].magic_0); - } - printf("checksum 0x%08x\n", meta->checksum); - printf("=================================================\n"); -} - -static char * -ata_raid_sii_type(int type) -{ - static char buffer[16]; - - switch (type) { - case SII_T_RAID0: return "RAID0"; - case SII_T_RAID1: return "RAID1"; - case SII_T_RAID01: return "RAID0+1"; - case SII_T_SPARE: return "SPARE"; - default: sprintf(buffer, "UNKNOWN 0x%02x", type); - return buffer; - } -} - -static void -ata_raid_sii_print_meta(struct sii_raid_conf *meta) -{ - printf("******* ATA Silicon Image Medley Metadata *******\n"); - printf("total_sectors %ju\n", meta->total_sectors); - printf("dummy_0 0x%04x\n", meta->dummy_0); - printf("dummy_1 0x%04x\n", meta->dummy_1); - printf("controller_pci_id 0x%08x\n", meta->controller_pci_id); - printf("version_minor 0x%04x\n", meta->version_minor); - printf("version_major 0x%04x\n", meta->version_major); - printf("timestamp 20%02x/%02x/%02x %02x:%02x:%02x\n", - meta->timestamp[5], meta->timestamp[4], meta->timestamp[3], - meta->timestamp[2], meta->timestamp[1], meta->timestamp[0]); - printf("stripe_sectors %u\n", meta->stripe_sectors); - printf("dummy_2 0x%04x\n", meta->dummy_2); - printf("disk_number %u\n", meta->disk_number); - printf("type %s\n", ata_raid_sii_type(meta->type)); - printf("raid0_disks %u\n", meta->raid0_disks); - printf("raid0_ident %u\n", meta->raid0_ident); - printf("raid1_disks %u\n", meta->raid1_disks); - printf("raid1_ident %u\n", meta->raid1_ident); - printf("rebuild_lba %ju\n", meta->rebuild_lba); - printf("generation 0x%08x\n", meta->generation); - printf("status 0x%02x %b\n", - meta->status, meta->status, - "\20\1READY\n"); - printf("base_raid1_position %02x\n", meta->base_raid1_position); - printf("base_raid0_position %02x\n", meta->base_raid0_position); - printf("position %02x\n", meta->position); - printf("dummy_3 %04x\n", meta->dummy_3); - printf("name <%.16s>\n", meta->name); - printf("checksum_0 0x%04x\n", meta->checksum_0); - printf("checksum_1 0x%04x\n", meta->checksum_1); - printf("=================================================\n"); -} - -static char * -ata_raid_sis_type(int type) -{ - static char buffer[16]; - - switch (type) { - case SIS_T_JBOD: return "JBOD"; - case SIS_T_RAID0: return "RAID0"; - case SIS_T_RAID1: return "RAID1"; - default: sprintf(buffer, "UNKNOWN 0x%02x", type); - return buffer; - } -} - -static void -ata_raid_sis_print_meta(struct sis_raid_conf *meta) -{ - printf("**** ATA Silicon Integrated Systems Metadata ****\n"); - printf("magic 0x%04x\n", meta->magic); - printf("disks 0x%02x\n", meta->disks); - printf("type %s\n", - ata_raid_sis_type(meta->type_total_disks & SIS_T_MASK)); - printf("total_disks %u\n", meta->type_total_disks & SIS_D_MASK); - printf("dummy_0 0x%08x\n", meta->dummy_0); - printf("controller_pci_id 0x%08x\n", meta->controller_pci_id); - printf("stripe_sectors %u\n", meta->stripe_sectors); - printf("dummy_1 0x%04x\n", meta->dummy_1); - printf("timestamp 0x%08x\n", meta->timestamp); - printf("model %.40s\n", meta->model); - printf("disk_number %u\n", meta->disk_number); - printf("dummy_2 0x%02x 0x%02x 0x%02x\n", - meta->dummy_2[0], meta->dummy_2[1], meta->dummy_2[2]); - printf("=================================================\n"); -} - -static char * -ata_raid_via_type(int type) -{ - static char buffer[16]; - - switch (type) { - case VIA_T_RAID0: return "RAID0"; - case VIA_T_RAID1: return "RAID1"; - case VIA_T_RAID5: return "RAID5"; - case VIA_T_RAID01: return "RAID0+1"; - case VIA_T_SPAN: return "SPAN"; - default: sprintf(buffer, "UNKNOWN 0x%02x", type); - return buffer; - } -} - -static void -ata_raid_via_print_meta(struct via_raid_conf *meta) -{ - int i; - - printf("*************** ATA VIA Metadata ****************\n"); - printf("magic 0x%02x\n", meta->magic); - printf("dummy_0 0x%02x\n", meta->dummy_0); - printf("type %s\n", - ata_raid_via_type(meta->type & VIA_T_MASK)); - printf("bootable %d\n", meta->type & VIA_T_BOOTABLE); - printf("unknown %d\n", meta->type & VIA_T_UNKNOWN); - printf("disk_index 0x%02x\n", meta->disk_index); - printf("stripe_layout 0x%02x\n", meta->stripe_layout); - printf(" stripe_disks %d\n", meta->stripe_layout & VIA_L_DISKS); - printf(" stripe_sectors %d\n", - 0x08 << ((meta->stripe_layout & VIA_L_MASK) >> VIA_L_SHIFT)); - printf("disk_sectors %ju\n", meta->disk_sectors); - printf("disk_id 0x%08x\n", meta->disk_id); - printf("DISK# disk_id\n"); - for (i = 0; i < 8; i++) { - if (meta->disks[i]) - printf(" %d 0x%08x\n", i, meta->disks[i]); - } - printf("checksum 0x%02x\n", meta->checksum); - printf("=================================================\n"); -} Property changes on: head/sys/dev/ata/ata-raid.c ___________________________________________________________________ Deleted: svn:keywords ## -1 +0,0 ## -FreeBSD=%H \ No newline at end of property Index: head/sys/dev/ata/atapi-cam.c =================================================================== --- head/sys/dev/ata/atapi-cam.c (revision 249082) +++ head/sys/dev/ata/atapi-cam.c (nonexistent) @@ -1,919 +0,0 @@ -/*- - * Copyright (c) 2001-2007 Thomas Quinot - * 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 ``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 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. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -/* private data associated with an ATA bus */ -struct atapi_xpt_softc { - struct ata_device atapi_cam_dev; /* must be first */ - device_t dev; - device_t parent; - struct ata_channel *ata_ch; - struct cam_path *path; - struct cam_sim *sim; - int flags; -#define BUS_REGISTERED 0x01 -#define RESOURCE_SHORTAGE 0x02 -#define DETACHING 0x04 - - TAILQ_HEAD(,atapi_hcb) pending_hcbs; - struct ata_device *atadev[2]; - struct mtx state_lock; -}; - -/* hardware command descriptor block */ -struct atapi_hcb { - struct atapi_xpt_softc *softc; - int unit; - int bus; - int target; - int lun; - union ccb *ccb; - int flags; -#define QUEUED 0x0001 -#define AUTOSENSE 0x0002 - char *dxfer_alloc; - TAILQ_ENTRY(atapi_hcb) chain; -}; - -enum reinit_reason { BOOT_ATTACH, ATTACH, RESET }; - -/* Device methods */ -static void atapi_cam_identify(driver_t *dev, device_t parent); -static int atapi_cam_probe(device_t dev); -static int atapi_cam_attach(device_t dev); -static int atapi_cam_detach(device_t dev); -static int atapi_cam_reinit(device_t dev); - -/* CAM XPT methods */ -static void atapi_action(struct cam_sim *, union ccb *); -static void atapi_poll(struct cam_sim *); -static void atapi_async(void *, u_int32_t, struct cam_path *, void *); -static void atapi_cb(struct ata_request *); - -/* Module methods */ -static int atapi_cam_event_handler(module_t mod, int what, void *arg); - -/* internal functions */ -static void reinit_bus(struct atapi_xpt_softc *scp, enum reinit_reason reason); -static void setup_async_cb(struct atapi_xpt_softc *, uint32_t); -static void cam_rescan(struct cam_sim *); -static void free_hcb_and_ccb_done(struct atapi_hcb *, u_int32_t); -static struct atapi_hcb *allocate_hcb(struct atapi_xpt_softc *, int, int, union ccb *); -static void free_hcb(struct atapi_hcb *hcb); -static void free_softc(struct atapi_xpt_softc *scp); - -static MALLOC_DEFINE(M_ATACAM, "ata_cam", "ATA driver CAM-XPT layer"); - -static device_method_t atapi_cam_methods[] = { - DEVMETHOD(device_identify, atapi_cam_identify), - DEVMETHOD(device_probe, atapi_cam_probe), - DEVMETHOD(device_attach, atapi_cam_attach), - DEVMETHOD(device_detach, atapi_cam_detach), - DEVMETHOD(ata_reinit, atapi_cam_reinit), - DEVMETHOD_END -}; - -static driver_t atapi_cam_driver = { - "atapicam", - atapi_cam_methods, - sizeof(struct atapi_xpt_softc) -}; - -static devclass_t atapi_cam_devclass; -DRIVER_MODULE(atapicam, ata, - atapi_cam_driver, - atapi_cam_devclass, - atapi_cam_event_handler, - /*arg*/NULL); -MODULE_VERSION(atapicam, 1); -MODULE_DEPEND(atapicam, ata, 1, 1, 1); -MODULE_DEPEND(atapicam, cam, 1, 1, 1); - -static void -atapi_cam_identify(driver_t *driver, device_t parent) -{ - struct atapi_xpt_softc *scp = - malloc (sizeof (struct atapi_xpt_softc), M_ATACAM, M_NOWAIT|M_ZERO); - device_t child; - - if (scp == NULL) { - printf ("atapi_cam_identify: out of memory"); - return; - } - - /* Assume one atapicam instance per parent channel instance. */ - child = device_add_child(parent, "atapicam", -1); - if (child == NULL) { - printf ("atapi_cam_identify: out of memory, can't add child"); - free (scp, M_ATACAM); - return; - } - scp->atapi_cam_dev.unit = -1; - scp->atapi_cam_dev.dev = child; - device_quiet(child); - device_set_softc(child, scp); -} - -static int -atapi_cam_probe(device_t dev) -{ - struct ata_device *atadev = device_get_softc (dev); - - KASSERT(atadev != NULL, ("expect valid struct ata_device")); - if (atadev->unit < 0) { - device_set_desc(dev, "ATAPI CAM Attachment"); - return (0); - } else { - return ENXIO; - } -} - -static int -atapi_cam_attach(device_t dev) -{ - struct atapi_xpt_softc *scp = NULL; - struct cam_devq *devq = NULL; - struct cam_sim *sim = NULL; - struct cam_path *path = NULL; - int unit, error; - - scp = (struct atapi_xpt_softc *)device_get_softc(dev); - if (scp == NULL) { - device_printf(dev, "Cannot get softc\n"); - return (ENOMEM); - } - - mtx_init(&scp->state_lock, "ATAPICAM lock", NULL, MTX_DEF); - - scp->dev = dev; - scp->parent = device_get_parent(dev); - scp->ata_ch = device_get_softc(scp->parent); - TAILQ_INIT(&scp->pending_hcbs); - unit = device_get_unit(device_get_parent(dev)); - - if ((devq = cam_simq_alloc(16)) == NULL) { - error = ENOMEM; - goto out; - } - - if ((sim = cam_sim_alloc(atapi_action, atapi_poll, "ata", - (void *)scp, unit, &scp->state_lock, 1, 1, devq)) == NULL) { - error = ENOMEM; - goto out; - } - scp->sim = sim; - - mtx_lock(&scp->state_lock); - if (xpt_bus_register(sim, dev, 0) != CAM_SUCCESS) { - error = EINVAL; - mtx_unlock(&scp->state_lock); - goto out; - } - scp->flags |= BUS_REGISTERED; - - if (xpt_create_path(&path, /*periph*/ NULL, - cam_sim_path(sim), CAM_TARGET_WILDCARD, - CAM_LUN_WILDCARD) != CAM_REQ_CMP) { - error = ENOMEM; - mtx_unlock(&scp->state_lock); - goto out; - } - scp->path = path; - - CAM_DEBUG(path, CAM_DEBUG_TRACE, ("Registered SIM for ata%d\n", unit)); - - setup_async_cb(scp, AC_LOST_DEVICE); - reinit_bus(scp, cold ? BOOT_ATTACH : ATTACH); - error = 0; - mtx_unlock(&scp->state_lock); - -out: - if (error != 0) - free_softc(scp); - - return (error); -} - -static int -atapi_cam_detach(device_t dev) -{ - struct atapi_xpt_softc *scp = device_get_softc(dev); - - mtx_lock(&scp->state_lock); - if (xpt_sim_opened(scp->sim)) { - mtx_unlock(&scp->state_lock); - return (EBUSY); - } - xpt_freeze_simq(scp->sim, 1 /*count*/); - scp->flags |= DETACHING; - mtx_unlock(&scp->state_lock); - free_softc(scp); - return (0); -} - -static int -atapi_cam_reinit(device_t dev) { - struct atapi_xpt_softc *scp = device_get_softc(dev); - - /* - * scp might be null if the bus is being reinitialised during - * the boot-up sequence, before the ATAPI bus is registered. - */ - - if (scp != NULL) { - mtx_lock(&scp->state_lock); - reinit_bus(scp, RESET); - mtx_unlock(&scp->state_lock); - } - return (0); -} - -static void -reinit_bus(struct atapi_xpt_softc *scp, enum reinit_reason reason) { - struct ata_device *old_atadev[2], *atadev; - device_t *children; - int nchildren, i, dev_changed; - - if (device_get_children(scp->parent, &children, &nchildren) != 0) { - return; - } - - old_atadev[0] = scp->atadev[0]; - old_atadev[1] = scp->atadev[1]; - scp->atadev[0] = NULL; - scp->atadev[1] = NULL; - - for (i = 0; i < nchildren; i++) { - /* XXX Does the child need to actually be attached yet? */ - if (children[i] != NULL) { - atadev = device_get_softc(children[i]); - if ((atadev->unit == ATA_MASTER) && - (scp->ata_ch->devices & ATA_ATAPI_MASTER) != 0) - scp->atadev[0] = atadev; - if ((atadev->unit == ATA_SLAVE) && - (scp->ata_ch->devices & ATA_ATAPI_SLAVE) != 0) - scp->atadev[1] = atadev; - } - } - dev_changed = (old_atadev[0] != scp->atadev[0]) - || (old_atadev[1] != scp->atadev[1]); - free(children, M_TEMP); - - switch (reason) { - case BOOT_ATTACH: - case ATTACH: - break; - case RESET: - xpt_async(AC_BUS_RESET, scp->path, NULL); - - if (!dev_changed) - break; - - cam_rescan(scp->sim); - break; - } -} - -static void -setup_async_cb(struct atapi_xpt_softc *scp, uint32_t events) -{ - struct ccb_setasync csa; - - xpt_setup_ccb(&csa.ccb_h, scp->path, /*priority*/ 5); - csa.ccb_h.func_code = XPT_SASYNC_CB; - csa.event_enable = events; - csa.callback = &atapi_async; - csa.callback_arg = scp->sim; - xpt_action((union ccb *) &csa); -} - -static void -atapi_action(struct cam_sim *sim, union ccb *ccb) -{ - struct atapi_xpt_softc *softc = (struct atapi_xpt_softc*)cam_sim_softc(sim); - struct ccb_hdr *ccb_h = &ccb->ccb_h; - struct atapi_hcb *hcb = NULL; - struct ata_request *request = NULL; - int unit = cam_sim_unit(sim); - int bus = cam_sim_bus(sim); - int len; - char *buf; - - switch (ccb_h->func_code) { - case XPT_PATH_INQ: { - struct ccb_pathinq *cpi = &ccb->cpi; - int tid = ccb_h->target_id; - - cpi->version_num = 1; - cpi->hba_inquiry = 0; - cpi->target_sprt = 0; - cpi->hba_misc = PIM_NO_6_BYTE; - cpi->hba_eng_cnt = 0; - bzero(cpi->vuhba_flags, sizeof(cpi->vuhba_flags)); - cpi->max_target = 1; - cpi->max_lun = 0; - cpi->async_flags = 0; - cpi->hpath_id = 0; - cpi->initiator_id = 7; - strncpy(cpi->sim_vid, "FreeBSD", sizeof(cpi->sim_vid)); - strncpy(cpi->hba_vid, "ATAPI", sizeof(cpi->hba_vid)); - strncpy(cpi->dev_name, cam_sim_name(sim), sizeof cpi->dev_name); - cpi->unit_number = cam_sim_unit(sim); - cpi->bus_id = cam_sim_bus(sim); - cpi->base_transfer_speed = 3300; - cpi->transport = XPORT_SPI; - cpi->transport_version = 2; - cpi->protocol = PROTO_SCSI; - cpi->protocol_version = SCSI_REV_2; - - if (softc->ata_ch && tid != CAM_TARGET_WILDCARD) { - if (softc->atadev[tid] == NULL) { - ccb->ccb_h.status = CAM_DEV_NOT_THERE; - xpt_done(ccb); - return; - } - switch (softc->atadev[ccb_h->target_id]->mode) { - case ATA_PIO1: - cpi->base_transfer_speed = 5200; - break; - case ATA_PIO2: - cpi->base_transfer_speed = 7000; - break; - case ATA_PIO3: - cpi->base_transfer_speed = 11000; - break; - case ATA_PIO4: - case ATA_DMA: - case ATA_WDMA2: - cpi->base_transfer_speed = 16000; - break; - case ATA_UDMA2: - cpi->base_transfer_speed = 33000; - break; - case ATA_UDMA4: - cpi->base_transfer_speed = 66000; - break; - case ATA_UDMA5: - cpi->base_transfer_speed = 100000; - break; - case ATA_UDMA6: - cpi->base_transfer_speed = 133000; - break; - case ATA_SA150: - cpi->base_transfer_speed = 150000; - break; - case ATA_SA300: - cpi->base_transfer_speed = 300000; - break; - default: - break; - } - } - cpi->maxio = softc->ata_ch->dma.max_iosize ? - softc->ata_ch->dma.max_iosize : DFLTPHYS; - ccb->ccb_h.status = CAM_REQ_CMP; - xpt_done(ccb); - return; - } - - case XPT_RESET_DEV: { - int tid = ccb_h->target_id; - - CAM_DEBUG(ccb->ccb_h.path, CAM_DEBUG_SUBTRACE, ("dev reset\n")); - mtx_unlock(&softc->state_lock); - ata_controlcmd(softc->atadev[tid]->dev, ATA_DEVICE_RESET, 0, 0, 0); - mtx_lock(&softc->state_lock); - ccb->ccb_h.status = CAM_REQ_CMP; - xpt_done(ccb); - return; - } - - case XPT_RESET_BUS: - CAM_DEBUG(ccb->ccb_h.path, CAM_DEBUG_SUBTRACE, ("bus reset\n")); - mtx_unlock(&softc->state_lock); - ata_reinit(softc->parent); - mtx_lock(&softc->state_lock); - ccb->ccb_h.status = CAM_REQ_CMP; - xpt_done(ccb); - return; - - case XPT_SET_TRAN_SETTINGS: - /* ignore these, we're not doing SCSI here */ - CAM_DEBUG(ccb->ccb_h.path, CAM_DEBUG_SUBTRACE, - ("SET_TRAN_SETTINGS not supported\n")); - ccb->ccb_h.status = CAM_FUNC_NOTAVAIL; - xpt_done(ccb); - return; - - case XPT_GET_TRAN_SETTINGS: { - struct ccb_trans_settings *cts = &ccb->cts; - cts->protocol = PROTO_SCSI; - cts->protocol_version = SCSI_REV_2; - cts->transport = XPORT_SPI; - cts->transport_version = XPORT_VERSION_UNSPECIFIED; - cts->proto_specific.valid = 0; - cts->xport_specific.valid = 0; - /* nothing more to do */ - ccb->ccb_h.status = CAM_REQ_CMP; - CAM_DEBUG(ccb->ccb_h.path, CAM_DEBUG_SUBTRACE, ("GET_TRAN_SETTINGS\n")); - xpt_done(ccb); - return; - } - - case XPT_CALC_GEOMETRY: { - CAM_DEBUG(ccb->ccb_h.path, CAM_DEBUG_SUBTRACE, ("CALC_GEOMETRY\n")); - cam_calc_geometry(&ccb->ccg, /*extended*/1); - xpt_done(ccb); - return; - } - - case XPT_SCSI_IO: { - struct ccb_scsiio *csio = &ccb->csio; - int tid = ccb_h->target_id, lid = ccb_h->target_lun; - int request_flags = ATA_R_ATAPI; - - CAM_DEBUG(ccb_h->path, CAM_DEBUG_SUBTRACE, ("XPT_SCSI_IO\n")); - - if (softc->flags & DETACHING) { - ccb->ccb_h.status = CAM_REQ_ABORTED; - xpt_done(ccb); - return; - } - - if (softc->atadev[tid] == NULL) { - ccb->ccb_h.status = CAM_DEV_NOT_THERE; - xpt_done(ccb); - return; - } - - /* check that this request was not aborted already */ - if ((ccb_h->status & CAM_STATUS_MASK) != CAM_REQ_INPROG) { - printf("XPT_SCSI_IO received but already in progress?\n"); - xpt_done(ccb); - return; - } - if (lid > 0) { - CAM_DEBUG(ccb_h->path, CAM_DEBUG_SUBTRACE, - ("SCSI IO received for invalid lun %d\n", lid)); - goto action_invalid; - } - if (csio->cdb_len > sizeof request->u.atapi.ccb) { - CAM_DEBUG(ccb_h->path, CAM_DEBUG_SUBTRACE, - ("CAM CCB too long for ATAPI")); - goto action_invalid; - } - - switch (ccb_h->flags & CAM_DIR_MASK) { - case CAM_DIR_IN: - request_flags |= ATA_R_READ; - break; - case CAM_DIR_OUT: - request_flags |= ATA_R_WRITE; - break; - case CAM_DIR_NONE: - /* No flags need to be set */ - break; - default: - device_printf(softc->dev, "unknown IO operation\n"); - goto action_invalid; - } - - if ((hcb = allocate_hcb(softc, unit, bus, ccb)) == NULL) { - printf("cannot allocate ATAPI/CAM hcb\n"); - goto action_oom; - } - if ((request = ata_alloc_request()) == NULL) { - printf("cannot allocate ATAPI/CAM request\n"); - goto action_oom; - } - - bcopy((ccb_h->flags & CAM_CDB_POINTER) ? - csio->cdb_io.cdb_ptr : csio->cdb_io.cdb_bytes, - request->u.atapi.ccb, csio->cdb_len); -#ifdef CAMDEBUG - if (CAM_DEBUGGED(ccb_h->path, CAM_DEBUG_CDB)) { - char cdb_str[(SCSI_MAX_CDBLEN * 3) + 1]; - - printf("atapi_action: hcb@%p: %s\n", hcb, - scsi_cdb_string(request->u.atapi.ccb, cdb_str, sizeof(cdb_str))); - } - if (CAM_DEBUGGED(ccb_h->path, CAM_DEBUG_SUBTRACE)) { - request_flags |= ATA_R_DEBUG; - } -#endif - - len = csio->dxfer_len; - buf = csio->data_ptr; - - /* some SCSI commands require special processing */ - switch (request->u.atapi.ccb[0]) { - case INQUIRY: { - /* - * many ATAPI devices seem to report more than - * SHORT_INQUIRY_LENGTH bytes of available INQUIRY - * information, but respond with some incorrect condition - * when actually asked for it, so we are going to pretend - * that only SHORT_INQUIRY_LENGTH are expected, anyway. - */ - struct scsi_inquiry *inq = (struct scsi_inquiry *) &request->u.atapi.ccb[0]; - - if (inq->byte2 == 0 && inq->page_code == 0 && - scsi_2btoul(inq->length) > SHORT_INQUIRY_LENGTH) { - bzero(buf, len); - len = SHORT_INQUIRY_LENGTH; - scsi_ulto2b(len, inq->length); - } - break; - } - case READ_6: - /* FALLTHROUGH */ - - case WRITE_6: - CAM_DEBUG(ccb_h->path, CAM_DEBUG_SUBTRACE, - ("Translating %s into _10 equivalent\n", - (request->u.atapi.ccb[0] == READ_6) ? "READ_6" : "WRITE_6")); - request->u.atapi.ccb[0] |= 0x20; - request->u.atapi.ccb[9] = request->u.atapi.ccb[5]; - request->u.atapi.ccb[8] = request->u.atapi.ccb[4]; - request->u.atapi.ccb[7] = 0; - request->u.atapi.ccb[6] = 0; - request->u.atapi.ccb[5] = request->u.atapi.ccb[3]; - request->u.atapi.ccb[4] = request->u.atapi.ccb[2]; - request->u.atapi.ccb[3] = request->u.atapi.ccb[1] & 0x1f; - request->u.atapi.ccb[2] = 0; - request->u.atapi.ccb[1] = 0; - /* FALLTHROUGH */ - - case READ_10: - /* FALLTHROUGH */ - case WRITE_10: - /* FALLTHROUGH */ - case READ_12: - /* FALLTHROUGH */ - case WRITE_12: - /* - * Enable DMA (if target supports it) for READ and WRITE commands - * only, as some combinations of drive, controller and chipset do - * not behave correctly when DMA is enabled for other commands. - */ - if (softc->atadev[tid]->mode >= ATA_DMA) - request_flags |= ATA_R_DMA; - break; - - } - - if ((ccb_h->flags & CAM_DIR_MASK) == CAM_DIR_IN && (len & 1)) { - /* ATA always transfers an even number of bytes */ - if ((buf = hcb->dxfer_alloc - = malloc(++len, M_ATACAM, M_NOWAIT | M_ZERO)) == NULL) { - printf("cannot allocate ATAPI/CAM buffer\n"); - goto action_oom; - } - } - request->dev = softc->atadev[tid]->dev; - request->driver = hcb; - request->data = buf; - request->bytecount = len; - request->transfersize = min(request->bytecount, 65534); - request->timeout = (ccb_h->timeout + 999) / 1000; - request->callback = &atapi_cb; - request->flags = request_flags; - - /* - * no retries are to be performed at the ATA level; any retries - * will be done by CAM. - */ - request->retries = 0; - - TAILQ_INSERT_TAIL(&softc->pending_hcbs, hcb, chain); - hcb->flags |= QUEUED; - ccb_h->status |= CAM_SIM_QUEUED; - mtx_unlock(&softc->state_lock); - - ata_queue_request(request); - mtx_lock(&softc->state_lock); - return; - } - - default: - CAM_DEBUG(ccb_h->path, CAM_DEBUG_SUBTRACE, - ("unsupported function code 0x%02x\n", ccb_h->func_code)); - goto action_invalid; - } - - /* NOTREACHED */ - -action_oom: - if (request != NULL) - ata_free_request(request); - if (hcb != NULL) - free_hcb(hcb); - xpt_print_path(ccb_h->path); - printf("out of memory, freezing queue.\n"); - softc->flags |= RESOURCE_SHORTAGE; - xpt_freeze_simq(sim, /*count*/ 1); - ccb_h->status = CAM_REQUEUE_REQ; - xpt_done(ccb); - return; - -action_invalid: - ccb_h->status = CAM_REQ_INVALID; - xpt_done(ccb); - return; -} - -static void -atapi_poll(struct cam_sim *sim) -{ - struct atapi_xpt_softc *softc = - (struct atapi_xpt_softc*)cam_sim_softc(sim); - - mtx_unlock(&softc->state_lock); - ata_interrupt(softc->ata_ch); - mtx_lock(&softc->state_lock); -} - -static void -atapi_cb(struct ata_request *request) -{ - struct atapi_xpt_softc *scp; - struct atapi_hcb *hcb; - struct ccb_scsiio *csio; - u_int32_t rc; - - hcb = (struct atapi_hcb *)request->driver; - scp = hcb->softc; - csio = &hcb->ccb->csio; - -#ifdef CAMDEBUG -# define err (request->u.atapi.sense.key) - if (CAM_DEBUGGED(csio->ccb_h.path, CAM_DEBUG_CDB)) { - printf("atapi_cb: hcb@%p sense = %02x: sk = %01x%s%s%s\n", - hcb, err, err & 0x0f, - (err & 0x80) ? ", Filemark" : "", - (err & 0x40) ? ", EOM" : "", - (err & 0x20) ? ", ILI" : ""); - device_printf(request->dev, - "cmd %s status %02x result %02x error %02x\n", - ata_cmd2str(request), - request->status, request->result, request->error); - } -#endif - - if ((hcb->flags & AUTOSENSE) != 0) { - rc = CAM_SCSI_STATUS_ERROR; - if (request->result == 0) { - csio->ccb_h.status |= CAM_AUTOSNS_VALID; - } - } else if (request->result != 0) { - if ((request->flags & ATA_R_TIMEOUT) != 0) { - rc = CAM_CMD_TIMEOUT; - } else { - rc = CAM_SCSI_STATUS_ERROR; - csio->scsi_status = SCSI_STATUS_CHECK_COND; - - if ((csio->ccb_h.flags & CAM_DIS_AUTOSENSE) == 0) { -#if 0 - static const int8_t ccb[16] = { ATAPI_REQUEST_SENSE, 0, 0, 0, - sizeof(struct atapi_sense), 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 }; - - bcopy (ccb, request->u.atapi.ccb, sizeof ccb); - request->data = (caddr_t)&csio->sense_data; - request->bytecount = sizeof(struct atapi_sense); - request->transfersize = min(request->bytecount, 65534); - request->timeout = (csio->ccb_h.timeout + 999) / 1000; - request->retries = 2; - request->flags = ATA_R_QUIET|ATA_R_ATAPI|ATA_R_IMMEDIATE; - hcb->flags |= AUTOSENSE; - - ata_queue_request(request); - return; -#else - /* - * Use auto-sense data from the ATA layer, if it has - * issued a REQUEST SENSE automatically and that operation - * returned without error. - */ - if (request->u.atapi.sense.key != 0 && request->error == 0) { - bcopy (&request->u.atapi.sense, &csio->sense_data, sizeof(struct atapi_sense)); - csio->ccb_h.status |= CAM_AUTOSNS_VALID; - } - } -#endif - } - } else { - rc = CAM_REQ_CMP; - csio->scsi_status = SCSI_STATUS_OK; - if (((csio->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) && - hcb->dxfer_alloc != NULL) - { - bcopy(hcb->dxfer_alloc, csio->data_ptr, csio->dxfer_len); - } - } - - mtx_lock(&scp->state_lock); - free_hcb_and_ccb_done(hcb, rc); - mtx_unlock(&scp->state_lock); - - ata_free_request(request); -} - -static void -free_hcb_and_ccb_done(struct atapi_hcb *hcb, u_int32_t status) -{ - struct atapi_xpt_softc *softc; - union ccb *ccb; - - if (hcb == NULL) - return; - - softc = hcb->softc; - ccb = hcb->ccb; - - /* we're about to free a hcb, so the shortage has ended */ - if (softc->flags & RESOURCE_SHORTAGE) { - softc->flags &= ~RESOURCE_SHORTAGE; - status |= CAM_RELEASE_SIMQ; - } - free_hcb(hcb); - ccb->ccb_h.status = - status | (ccb->ccb_h.status & ~(CAM_STATUS_MASK | CAM_SIM_QUEUED)); - xpt_done(ccb); -} - -static void -atapi_async(void *callback_arg, u_int32_t code, - struct cam_path* path, void *arg) -{ - int targ; - - GIANT_REQUIRED; - - switch (code) { - case AC_LOST_DEVICE: - targ = xpt_path_target_id(path); - xpt_print_path(path); - if (targ == -1) - printf("Lost host adapter\n"); - else - printf("Lost target %d???\n", targ); - break; - - default: - break; - } -} - -static void -cam_rescan(struct cam_sim *sim) -{ - union ccb *ccb; - - ccb = xpt_alloc_ccb_nowait(); - if (ccb == NULL) - return; - if (xpt_create_path(&ccb->ccb_h.path, xpt_periph, cam_sim_path(sim), - CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD) != CAM_REQ_CMP) { - xpt_free_ccb(ccb); - return; - } - CAM_DEBUG(ccb->ccb_h.path, CAM_DEBUG_TRACE, ("Rescanning ATAPI bus.\n")); - xpt_rescan(ccb); - /* scan is in progress now */ -} - -static struct atapi_hcb * -allocate_hcb(struct atapi_xpt_softc *softc, int unit, int bus, union ccb *ccb) -{ - struct atapi_hcb *hcb = (struct atapi_hcb *) - malloc(sizeof(struct atapi_hcb), M_ATACAM, M_NOWAIT | M_ZERO); - - if (hcb != NULL) { - hcb->softc = softc; - hcb->unit = unit; - hcb->bus = bus; - hcb->ccb = ccb; - } - return hcb; -} - -static void -free_hcb(struct atapi_hcb *hcb) -{ - if ((hcb->flags & QUEUED) != 0) - TAILQ_REMOVE(&hcb->softc->pending_hcbs, hcb, chain); - if (hcb->dxfer_alloc != NULL) - free(hcb->dxfer_alloc, M_ATACAM); - free(hcb, M_ATACAM); -} - -static void -free_softc(struct atapi_xpt_softc *scp) -{ - struct atapi_hcb *hcb, *thcb; - - if (scp != NULL) { - mtx_lock(&scp->state_lock); - TAILQ_FOREACH_SAFE(hcb, &scp->pending_hcbs, chain, thcb) { - free_hcb_and_ccb_done(hcb, CAM_UNREC_HBA_ERROR); - } - if (scp->path != NULL) { - setup_async_cb(scp, 0); - xpt_free_path(scp->path); - } - if ((scp->flags & BUS_REGISTERED) != 0) { - if (xpt_bus_deregister(cam_sim_path(scp->sim)) == CAM_REQ_CMP) - scp->flags &= ~BUS_REGISTERED; - } - if (scp->sim != NULL) { - if ((scp->flags & BUS_REGISTERED) == 0) - cam_sim_free(scp->sim, /*free_devq*/TRUE); - else - printf("Can't free %s SIM (still registered)\n", - cam_sim_name(scp->sim)); - } - mtx_destroy(&scp->state_lock); - } -} - -static int -atapi_cam_event_handler(module_t mod, int what, void *arg) { - device_t *devlist; - int devcount; - - switch (what) { - case MOD_UNLOAD: - if (devclass_get_devices(atapi_cam_devclass, &devlist, &devcount) - != 0) - return ENXIO; - if (devlist != NULL) { - while (devlist != NULL && devcount > 0) { - device_t child = devlist[--devcount]; - struct atapi_xpt_softc *scp = device_get_softc(child); - - device_delete_child(device_get_parent(child),child); - if (scp != NULL) - free(scp, M_ATACAM); - } - free(devlist, M_TEMP); - } - break; - - default: - break; - } - return 0; -} Property changes on: head/sys/dev/ata/atapi-cam.c ___________________________________________________________________ Deleted: svn:keywords ## -1 +0,0 ## -FreeBSD=%H \ No newline at end of property Index: head/sys/dev/ata/ata-raid-ddf.h =================================================================== --- head/sys/dev/ata/ata-raid-ddf.h (revision 249082) +++ head/sys/dev/ata/ata-raid-ddf.h (nonexistent) @@ -1,333 +0,0 @@ -/*- - * Copyright (c) 2008 Scott Long - * 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. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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. - * - * $FreeBSD$ - */ - -#ifndef ATA_RAID_DDF_H -#define ATA_RAID_DDF_H - -/* Definitions from the SNIA DDF spec, rev 1.2 */ - -#define DDF_HEADER_LENGTH 512 -struct ddf_header { - uint32_t Signature; -#define DDF_HEADER_SIGNATURE 0xde11de11 - uint32_t CRC; - uint8_t DDF_Header_GUID[24]; - uint8_t DDF_rev[8]; - uint32_t Sequence_Number; - uint32_t TimeStamp; - uint8_t Open_Flag; -#define DDF_HEADER_CLOSED 0x00 -#define DDF_HEADER_OPENED_MASK 0x0f -#define DDF_HEADER_OPEN_ANCHOR 0xff - uint8_t Foreign_Flag; - uint8_t Diskgrouping; - uint8_t pad1[13]; - uint8_t Header_ext[32]; - uint64_t Primary_Header_LBA; - uint64_t Secondary_Header_LBA; - uint8_t Header_Type; -#define DDF_HEADER_ANCHOR 0x00 -#define DDF_HEADER_PRIMARY 0x01 -#define DDF_HEADER_SECONDARY 0x02 - uint8_t pad2[3]; - uint32_t WorkSpace_Length; - uint64_t WorkSpace_LBA; - uint16_t Max_PD_Entries; - uint16_t Max_VD_Entries; - uint16_t Max_Partitions; - uint16_t Configuration_Record_Length; - uint16_t Max_Primary_Element_Entries; - uint8_t pad3[54]; - uint32_t cd_section; /* Controller_Data_Section */ - uint32_t cd_length; /* Controller_Data_Section_Length */ - uint32_t pdr_section; /* Physical_Drive_Records_Section */ - uint32_t pdr_length; /* Physical_Drive_Records_Length */ - uint32_t vdr_section; /* Virtual_Drive_Records_Section */ - uint32_t vdr_length; /* Virtual_Drive_Records_Length */ - uint32_t cr_section; /* Configuration_Records_Section */ - uint32_t cr_length; /* Configuration_Records_Length */ - uint32_t pdd_section; /* Physical_Drive_Data_Section */ - uint32_t pdd_length; /* Physical_Drive_Data_Length */ - uint32_t bbmlog_section; /* BBM_Log_Section */ - uint32_t bbmlog_length; /* BBM_Log_Section_Length */ - uint32_t Diagnostic_Space; - uint32_t Diagnostic_Space_Length; - uint32_t Vendor_Specific_Logs; - uint32_t Vendor_Specific_Logs_Length; - uint8_t pad4[256]; -} __packed; - -struct ddf_cd_record { - uint32_t Signature; -#define DDF_CONTROLLER_DATA_SIGNATURE 0xad111111 - uint32_t CRC; - uint8_t Controller_GUID[24]; - struct { - uint16_t Vendor_ID; - uint16_t Device_ID; - uint16_t SubVendor_ID; - uint16_t SubDevice_ID; - } Controller_Type __packed; - uint8_t Product_ID[16]; - uint8_t pad1[8]; - uint8_t Controller_Data[448]; -} __packed; - -struct ddf_device_scsi { - uint8_t Lun; - uint8_t Id; - uint8_t Channel; - uint8_t Path_Flags; -#define DDF_DEVICE_SCSI_FLAG_BROKEN (1 << 7) -} __packed; - -struct ddf_device_sas { - uint64_t Initiator_Path; -} __packed; - -union ddf_pathinfo { - struct { - struct ddf_device_scsi Path0; - struct ddf_device_scsi Path1; - uint8_t pad[10]; - } __packed scsi; - struct { - struct ddf_device_sas Path0; - struct ddf_device_sas Path1; - uint8_t Path0_Flags; - uint8_t Path1_Flags; -#define DDF_DEVICE_SAS_FLAG_BROKEN (1 << 7) - } __packed sas; -} __packed; - -struct ddf_pd_entry { - uint8_t PD_GUID[24]; - uint32_t PD_Reference; - uint16_t PD_Type; -#define DDF_PDE_GUID_FORCE (1 << 0) -#define DDF_PDE_PARTICIPATING (1 << 1) -#define DDF_PDE_GLOBAL_SPARE (1 << 2) -#define DDF_PDE_CONFIG_SPARE (1 << 3) -#define DDF_PDE_FOREIGN (1 << 4) -#define DDF_PDE_LEGACY (1 << 5) -#define DDF_PDE_TYPE_MASK (0x0f << 12) -#define DDF_PDE_UNKNOWN (0x00 << 12) -#define DDF_PDE_SCSI (0x01 << 12) -#define DDF_PDE_SAS (0x02 << 12) -#define DDF_PDE_SATA (0x03 << 12) -#define DDF_PDE_FC (0x04 << 12) - uint16_t PD_State; -#define DDF_PDE_ONLINE (1 << 0) -#define DDF_PDE_FAILED (1 << 1) -#define DDF_PDE_REBUILD (1 << 2) -#define DDF_PDE_TRANSITION (1 << 3) -#define DDF_PDE_PFA (1 << 4) -#define DDF_PDE_UNRECOVERED (1 << 5) -#define DDF_PDE_MISSING (1 << 6) - uint64_t Configured_Size; - union ddf_pathinfo Path_Information; - uint8_t pad1[6]; -} __packed; - -struct ddf_pd_record { - uint32_t Signature; -#define DDF_PDR_SIGNATURE 0x22222222 - uint32_t CRC; - uint16_t Populated_PDEs; - uint16_t Max_PDE_Supported; - uint8_t pad1[52]; - struct ddf_pd_entry entry[0]; -} __packed; - -struct ddf_vd_entry { - uint8_t VD_GUID[24]; - uint16_t VD_Number; - uint8_t pad1[2]; - uint16_t VD_Type; -#define DDF_VDE_SHARED (1 << 0) -#define DDF_VDE_ENFORCE_GROUP (1 << 1) -#define DDF_VDE_UNICODE_NAME (1 << 2) -#define DDF_VDE_OWNER_ID_VALID (1 << 3) - uint16_t Controller_GUID_CRC; - uint8_t VD_State; -#define DDF_VDE_OPTIMAL 0x00 -#define DDF_VDE_DEGRADED 0x01 -#define DDF_VDE_DELETED 0x02 -#define DDF_VDE_MISSING 0x03 -#define DDF_VDE_FAILED 0x04 -#define DDF_VDE_PARTIAL 0x05 -#define DDF_VDE_STATE_MASK 0x07 -#define DDF_VDE_MORPH (1 << 3) -#define DDF_VDE_DIRTY (1 << 4) - uint8_t Init_State; -#define DDF_VDE_UNINTIALIZED 0x00 -#define DDF_VDE_INIT_QUICK 0x01 -#define DDF_VDE_INIT_FULL 0x02 -#define DDF_VDE_INIT_MASK 0x03 -#define DDF_VDE_UACCESS_RW 0x00 -#define DDF_VDE_UACCESS_RO 0x80 -#define DDF_VDE_UACCESS_BLOCKED 0xc0 -#define DDF_VDE_UACCESS_MASK 0xc0 - uint8_t pad2[14]; - uint8_t VD_Name[16]; -} __packed; - -struct ddf_vd_record { - uint32_t Signature; -#define DDF_VD_RECORD_SIGNATURE 0xdddddddd - uint32_t CRC; - uint16_t Populated_VDEs; - uint16_t Max_VDE_Supported; - uint8_t pad1[52]; - struct ddf_vd_entry entry[0]; -} __packed; - -#define DDF_CR_INVALID 0xffffffff - -struct ddf_vdc_record { - uint32_t Signature; -#define DDF_VDCR_SIGNATURE 0xeeeeeeee - uint32_t CRC; - uint8_t VD_GUID[24]; - uint32_t Timestamp; - uint32_t Sequence_Number; - uint8_t pad1[24]; - uint16_t Primary_Element_Count; - uint8_t Stripe_Size; - uint8_t Primary_RAID_Level; -#define DDF_VDCR_RAID0 0x00 -#define DDF_VDCR_RAID1 0x01 -#define DDF_VDCR_RAID3 0x03 -#define DDF_VDCR_RAID4 0x04 -#define DDF_VDCR_RAID5 0x05 -#define DDF_VDCR_RAID6 0x06 -#define DDF_VDCR_RAID1E 0x11 -#define DDF_VDCR_SINGLE 0x0f -#define DDF_VDCR_CONCAT 0x1f -#define DDF_VDCR_RAID5E 0x15 -#define DDF_VDCR_RAID5EE 0x25 - uint8_t RLQ; - uint8_t Secondary_Element_Count; - uint8_t Secondary_Element_Seq; - uint8_t Secondary_RAID_Level; - uint64_t Block_Count; - uint64_t VD_Size; - uint8_t pad2[8]; - uint32_t Associated_Spares[8]; - uint64_t Cache_Flags; -#define DDF_VDCR_CACHE_WB (1 << 0) -#define DDF_VDCR_CACHE_WB_ADAPTIVE (1 << 1) -#define DDF_VDCR_CACHE_RA (1 << 2) -#define DDF_VDCR_CACHE_RA_ADAPTIVE (1 << 3) -#define DDF_VDCR_CACHE_WCACHE_NOBATTERY (1 << 4) -#define DDF_VDCR_CACHE_WCACHE_ALLOW (1 << 5) -#define DDF_VDCR_CACHE_RCACHE_ALLOW (1 << 6) -#define DDF_VDCR_CACHE_VENDOR (1 << 7) - uint8_t BG_Rate; - uint8_t pad3[3]; - uint8_t pad4[52]; - uint8_t pad5[192]; - uint8_t V0[32]; - uint8_t V1[32]; - uint8_t V2[16]; - uint8_t V3[16]; - uint8_t Vendor_Scratch[32]; - uint32_t Physical_Disk_Sequence[0]; -} __packed; - -struct ddf_vuc_record { - uint32_t Signature; -#define DDF_VUCR_SIGNATURE 0x88888888 - uint32_t CRC; - uint8_t VD_GUID[24]; -} __packed; - -struct ddf_sa_entry { - uint8_t VD_GUID[24]; - uint16_t Secondary_Element; - uint8_t rsrvd2[6]; -} __packed; - -struct ddf_sa_record { - uint32_t Signature; -#define DDF_SA_SIGNATURE 0x55555555 - uint32_t CRC; - uint32_t Timestamp; - uint8_t pad1[7]; - uint8_t Spare_Type; -#define DDF_SAR_TYPE_DEDICATED (1 << 0) -#define DDF_SAR_TYPE_REVERTIBLE (1 << 1) -#define DDF_SAR_TYPE_ACTIVE (1 << 2) -#define DDF_SAR_TYPE_ENCL_AFFINITY (1 << 3) - uint16_t Populated_SAEs; - uint16_t MAX_SAE_Supported; - uint8_t pad2[8]; - struct ddf_sa_entry entry[0]; -} __packed; - -struct ddf_pdd_record { - uint32_t Signature; -#define DDF_PDD_SIGNATURE 0x33333333 - uint32_t CRC; - uint8_t PD_GUID[24]; - uint32_t PD_Reference; - uint8_t Forced_Ref_Flag; -#define DDF_PDD_FORCED_REF 0x01 - uint8_t Forced_PD_GUID_Flag; -#define DDF_PDD_FORCED_GUID 0x01 - uint8_t Vendor_Scratch[32]; - uint8_t pad2[442]; -} __packed; - -struct ddf_bbm_entry { - uint64_t Defective_Block_Start; - uint32_t Spare_Block_Offset; - uint16_t Remapped_Count; - uint8_t pad[2]; -}; - -struct ddf_bbm_log { - uint32_t Signature; -#define DDF_BBML_SIGNATURE 0xabadb10c - uint32_t CRC; - uint16_t Entry_Count; - uint32_t Spare_Block_Count; - uint8_t pad1[10]; - uint64_t First_Spare_LBA; - uint64_t Mapped_Block_Entry[0]; -} __packed; - -struct ddf_vendor_log { - uint32_t Signature; -#define DDF_VENDOR_LOG_SIGNATURE 0x01dbeef0 - uint32_t CRC; - uint64_t Log_Owner; - uint8_t pad1[16]; -} __packed; - -#endif Property changes on: head/sys/dev/ata/ata-raid-ddf.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:keywords ## -1 +0,0 ## -FreeBSD=%H \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: head/sys/dev/ata/ata-raid.h =================================================================== --- head/sys/dev/ata/ata-raid.h (revision 249082) +++ head/sys/dev/ata/ata-raid.h (nonexistent) @@ -1,817 +0,0 @@ -/*- - * Copyright (c) 2000 - 2008 Søren Schmidt - * 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. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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. - * - * $FreeBSD$ - */ - -/* misc defines */ -#define MAX_ARRAYS 16 -#define MAX_VOLUMES 4 -#define MAX_DISKS 16 -#define AR_PROXIMITY 2048 /* how many sectors is "close" */ - -#define ATA_MAGIC "FreeBSD ATA driver RAID " - -struct ata_raid_subdisk { - struct ar_softc *raid[MAX_VOLUMES]; - int disk_number[MAX_VOLUMES]; -}; - -/* ATA PseudoRAID Metadata */ -struct ar_softc { - int lun; - u_int8_t name[32]; - int volume; - u_int64_t magic_0; - u_int64_t magic_1; - int type; -#define AR_T_JBOD 0x0001 -#define AR_T_SPAN 0x0002 -#define AR_T_RAID0 0x0004 -#define AR_T_RAID1 0x0008 -#define AR_T_RAID01 0x0010 -#define AR_T_RAID3 0x0020 -#define AR_T_RAID4 0x0040 -#define AR_T_RAID5 0x0080 - - int status; -#define AR_S_READY 0x0001 -#define AR_S_DEGRADED 0x0002 -#define AR_S_REBUILDING 0x0004 - - int format; -#define AR_F_FREEBSD_RAID 0x0001 -#define AR_F_ADAPTEC_RAID 0x0002 -#define AR_F_HPTV2_RAID 0x0004 -#define AR_F_HPTV3_RAID 0x0008 -#define AR_F_INTEL_RAID 0x0010 -#define AR_F_ITE_RAID 0x0020 -#define AR_F_JMICRON_RAID 0x0040 -#define AR_F_LSIV2_RAID 0x0080 -#define AR_F_LSIV3_RAID 0x0100 -#define AR_F_NVIDIA_RAID 0x0200 -#define AR_F_PROMISE_RAID 0x0400 -#define AR_F_SII_RAID 0x0800 -#define AR_F_SIS_RAID 0x1000 -#define AR_F_VIA_RAID 0x2000 -#define AR_F_DDF_RAID 0x4000 -#define AR_F_FORMAT_MASK 0x7fff - - u_int generation; - u_int64_t total_sectors; - u_int64_t offset_sectors; /* offset from start of disk */ - u_int16_t heads; - u_int16_t sectors; - u_int32_t cylinders; - u_int width; /* array width in disks */ - u_int interleave; /* interleave in sectors */ - u_int total_disks; /* number of disks in this array */ - struct ar_disk { - device_t dev; - u_int8_t serial[16]; /* serial # of physical disk */ - u_int64_t sectors; /* useable sectors on this disk */ - off_t last_lba; /* last lba used (for performance) */ - u_int flags; -#define AR_DF_PRESENT 0x0001 /* this HW pos has a disk present */ -#define AR_DF_ASSIGNED 0x0002 /* this HW pos assigned to an array */ -#define AR_DF_SPARE 0x0004 /* this HW pos is a spare */ -#define AR_DF_ONLINE 0x0008 /* this HW pos is online and in use */ - - } disks[MAX_DISKS]; - int toggle; /* performance hack for RAID1's */ - u_int64_t rebuild_lba; /* rebuild progress indicator */ - struct mtx lock; /* metadata lock */ - struct disk *disk; /* disklabel/slice stuff */ - struct proc *pid; /* rebuilder process id */ -}; - -/* Adaptec HostRAID Metadata */ -#define ADP_LBA(dev) \ - (((struct ad_softc *)device_get_ivars(dev))->total_secs - 17) - -/* note all entries are big endian */ -struct adaptec_raid_conf { - u_int32_t magic_0; -#define ADP_MAGIC_0 0xc4650790 - - u_int32_t generation; - u_int16_t dummy_0; - u_int16_t total_configs; - u_int16_t dummy_1; - u_int16_t checksum; - u_int32_t dummy_2; - u_int32_t dummy_3; - u_int32_t flags; - u_int32_t timestamp; - u_int32_t dummy_4[4]; - u_int32_t dummy_5[4]; - struct { - u_int16_t total_disks; - u_int16_t generation; - u_int32_t magic_0; - u_int8_t dummy_0; - u_int8_t type; -#define ADP_T_RAID0 0x00 -#define ADP_T_RAID1 0x01 - u_int8_t dummy_1; - u_int8_t flags; - - u_int8_t dummy_2; - u_int8_t dummy_3; - u_int8_t dummy_4; - u_int8_t dummy_5; - - u_int32_t disk_number; - u_int32_t dummy_6; - u_int32_t sectors; - u_int16_t stripe_shift; - u_int16_t dummy_7; - - u_int32_t dummy_8[4]; - u_int8_t name[16]; - } configs[127]; - u_int32_t dummy_6[13]; - u_int32_t magic_1; -#define ADP_MAGIC_1 0x9ff85009 - u_int32_t dummy_7[3]; - u_int32_t magic_2; - u_int32_t dummy_8[46]; - u_int32_t magic_3; -#define ADP_MAGIC_3 0x4d545044 - u_int32_t magic_4; -#define ADP_MAGIC_4 0x9ff85009 - u_int32_t dummy_9[62]; -} __packed; - -/* DDF Information. Metadata definitions are in another file */ -#define DDF_LBA(dev) \ - (((struct ad_softc *)device_get_ivars(dev))->total_secs - 1) - -/* Highpoint V2 RocketRAID Metadata */ -#define HPTV2_LBA(dev) 9 - -struct hptv2_raid_conf { - int8_t filler1[32]; - u_int32_t magic; -#define HPTV2_MAGIC_OK 0x5a7816f0 -#define HPTV2_MAGIC_BAD 0x5a7816fd - - u_int32_t magic_0; - u_int32_t magic_1; - u_int32_t order; -#define HPTV2_O_RAID0 0x01 -#define HPTV2_O_RAID1 0x02 -#define HPTV2_O_OK 0x04 - - u_int8_t array_width; - u_int8_t stripe_shift; - u_int8_t type; -#define HPTV2_T_RAID0 0x00 -#define HPTV2_T_RAID1 0x01 -#define HPTV2_T_RAID01_RAID0 0x02 -#define HPTV2_T_SPAN 0x03 -#define HPTV2_T_RAID_3 0x04 -#define HPTV2_T_RAID_5 0x05 -#define HPTV2_T_JBOD 0x06 -#define HPTV2_T_RAID01_RAID1 0x07 - - u_int8_t disk_number; - u_int32_t total_sectors; - u_int32_t disk_mode; - u_int32_t boot_mode; - u_int8_t boot_disk; - u_int8_t boot_protect; - u_int8_t error_log_entries; - u_int8_t error_log_index; - struct { - u_int32_t timestamp; - u_int8_t reason; -#define HPTV2_R_REMOVED 0xfe -#define HPTV2_R_BROKEN 0xff - - u_int8_t disk; - u_int8_t status; - u_int8_t sectors; - u_int32_t lba; - } errorlog[32]; - int8_t filler2[16]; - u_int32_t rebuild_lba; - u_int8_t dummy_1; - u_int8_t name_1[15]; - u_int8_t dummy_2; - u_int8_t name_2[15]; - int8_t filler3[8]; -} __packed; - - -/* Highpoint V3 RocketRAID Metadata */ -#define HPTV3_LBA(dev) \ - (((struct ad_softc *)device_get_ivars(dev))->total_secs - 11) - -struct hptv3_raid_conf { - u_int32_t magic; -#define HPTV3_MAGIC 0x5a7816f3 - - u_int32_t magic_0; - u_int8_t checksum_0; - u_int8_t mode; -#define HPTV3_BOOT_MARK 0x01 -#define HPTV3_USER_MODE 0x02 - - u_int8_t user_mode; - u_int8_t config_entries; - struct { - u_int32_t total_sectors; - u_int8_t type; -#define HPTV3_T_SPARE 0x00 -#define HPTV3_T_JBOD 0x03 -#define HPTV3_T_SPAN 0x04 -#define HPTV3_T_RAID0 0x05 -#define HPTV3_T_RAID1 0x06 -#define HPTV3_T_RAID3 0x07 -#define HPTV3_T_RAID5 0x08 - - u_int8_t total_disks; - u_int8_t disk_number; - u_int8_t stripe_shift; - u_int16_t status; -#define HPTV3_T_NEED_REBUILD 0x01 -#define HPTV3_T_RAID5_FLAG 0x02 - - u_int16_t critical_disks; - u_int32_t rebuild_lba; - } __packed configs[2]; - u_int8_t name[16]; - u_int32_t timestamp; - u_int8_t description[64]; - u_int8_t creator[16]; - u_int8_t checksum_1; - u_int8_t dummy_0; - u_int8_t dummy_1; - u_int8_t flags; -#define HPTV3_T_ENABLE_TCQ 0x01 -#define HPTV3_T_ENABLE_NCQ 0x02 -#define HPTV3_T_ENABLE_WCACHE 0x04 -#define HPTV3_T_ENABLE_RCACHE 0x08 - - struct { - u_int32_t total_sectors; - u_int32_t rebuild_lba; - } __packed configs_high[2]; - u_int32_t filler[87]; -} __packed; - - -/* Intel MatrixRAID Metadata */ -#define INTEL_LBA(dev) \ - (((struct ad_softc *)device_get_ivars(dev))->total_secs - 3) - -struct intel_raid_conf { - u_int8_t intel_id[24]; -#define INTEL_MAGIC "Intel Raid ISM Cfg Sig. " - - u_int8_t version[6]; -#define INTEL_VERSION_1100 "1.1.00" -#define INTEL_VERSION_1201 "1.2.01" -#define INTEL_VERSION_1202 "1.2.02" - - u_int8_t dummy_0[2]; - u_int32_t checksum; - u_int32_t config_size; - u_int32_t config_id; - u_int32_t generation; - u_int32_t dummy_1[2]; - u_int8_t total_disks; - u_int8_t total_volumes; - u_int8_t dummy_2[2]; - u_int32_t filler_0[39]; - struct { - u_int8_t serial[16]; - u_int32_t sectors; - u_int32_t id; - u_int32_t flags; -#define INTEL_F_SPARE 0x01 -#define INTEL_F_ASSIGNED 0x02 -#define INTEL_F_DOWN 0x04 -#define INTEL_F_ONLINE 0x08 - - u_int32_t filler[5]; - } __packed disk[1]; - u_int32_t filler_1[62]; -} __packed; - -struct intel_raid_mapping { - u_int8_t name[16]; - u_int64_t total_sectors __packed; - u_int32_t state; - u_int32_t reserved; - u_int32_t filler_0[20]; - u_int32_t offset; - u_int32_t disk_sectors; - u_int32_t stripe_count; - u_int16_t stripe_sectors; - u_int8_t status; -#define INTEL_S_READY 0x00 -#define INTEL_S_DISABLED 0x01 -#define INTEL_S_DEGRADED 0x02 -#define INTEL_S_FAILURE 0x03 - - u_int8_t type; -#define INTEL_T_RAID0 0x00 -#define INTEL_T_RAID1 0x01 -#define INTEL_T_RAID5 0x05 - - u_int8_t total_disks; - u_int8_t magic[3]; - u_int32_t filler_1[7]; - u_int32_t disk_idx[1]; -} __packed; - - -/* Integrated Technology Express Metadata */ -#define ITE_LBA(dev) \ - (((struct ad_softc *)device_get_ivars(dev))->total_secs - 2) - -struct ite_raid_conf { - u_int32_t filler_1[5]; - u_int8_t timestamp_0[8]; - u_int32_t dummy_1; - u_int32_t filler_2[5]; - u_int16_t filler_3; - u_int8_t ite_id[40]; -#define ITE_MAGIC "Integrated Technology Express Inc " - - u_int16_t filler_4; - u_int32_t filler_5[6]; - u_int32_t dummy_2; - u_int32_t dummy_3; - u_int32_t filler_6[12]; - u_int32_t dummy_4; - u_int32_t filler_7[5]; - u_int64_t total_sectors __packed; - u_int32_t filler_8[12]; - - u_int16_t filler_9; - u_int8_t type; -#define ITE_T_RAID0 0x00 -#define ITE_T_RAID1 0x01 -#define ITE_T_RAID01 0x02 -#define ITE_T_SPAN 0x03 - - u_int8_t filler_10; - u_int32_t dummy_5[8]; - u_int8_t stripe_1kblocks; - u_int8_t filler_11[3]; - u_int32_t filler_12[54]; - - u_int32_t dummy_6[4]; - u_int8_t timestamp_1[8]; - u_int32_t filler_13[9]; - u_int8_t stripe_sectors; - u_int8_t filler_14[3]; - u_int8_t array_width; - u_int8_t filler_15[3]; - u_int32_t filler_16; - u_int8_t filler_17; - u_int8_t disk_number; - u_int32_t disk_sectors; - u_int16_t filler_18; - u_int32_t dummy_7[4]; - u_int32_t filler_20[104]; -} __packed; - - -/* JMicron Technology Corp Metadata */ -#define JMICRON_LBA(dev) \ - (((struct ad_softc *)device_get_ivars(dev))->total_secs - 1) -#define JM_MAX_DISKS 8 - -struct jmicron_raid_conf { - u_int8_t signature[2]; -#define JMICRON_MAGIC "JM" - - u_int16_t version; -#define JMICRON_VERSION 0x0001 - - u_int16_t checksum; - u_int8_t filler_1[10]; - u_int32_t disk_id; - u_int32_t offset; - u_int32_t disk_sectors_high; - u_int16_t disk_sectors_low; - u_int8_t filler_2[2]; - u_int8_t name[16]; - u_int8_t type; -#define JM_T_RAID0 0 -#define JM_T_RAID1 1 -#define JM_T_RAID01 2 -#define JM_T_JBOD 3 -#define JM_T_RAID5 5 - - u_int8_t stripe_shift; - u_int16_t flags; -#define JM_F_READY 0x0001 -#define JM_F_BOOTABLE 0x0002 -#define JM_F_BAD 0x0004 -#define JM_F_ACTIVE 0c0010 -#define JM_F_UNSYNC 0c0020 -#define JM_F_NEWEST 0c0040 - - u_int8_t filler_3[4]; - u_int32_t spare[2]; - u_int32_t disks[JM_MAX_DISKS]; - u_int8_t filler_4[32]; - u_int8_t filler_5[384]; -}; - - -/* LSILogic V2 MegaRAID Metadata */ -#define LSIV2_LBA(dev) \ - (((struct ad_softc *)device_get_ivars(dev))->total_secs - 1) - -struct lsiv2_raid_conf { - u_int8_t lsi_id[6]; -#define LSIV2_MAGIC "$XIDE$" - - u_int8_t dummy_0; - u_int8_t flags; - u_int16_t version; - u_int8_t config_entries; - u_int8_t raid_count; - u_int8_t total_disks; - u_int8_t dummy_1; - u_int16_t dummy_2; - - union { - struct { - u_int8_t type; -#define LSIV2_T_RAID0 0x01 -#define LSIV2_T_RAID1 0x02 -#define LSIV2_T_SPARE 0x08 - - u_int8_t dummy_0; - u_int16_t stripe_sectors; - u_int8_t array_width; - u_int8_t disk_count; - u_int8_t config_offset; - u_int8_t dummy_1; - u_int8_t flags; -#define LSIV2_R_DEGRADED 0x02 - - u_int32_t total_sectors; - u_int8_t filler[3]; - } __packed raid; - struct { - u_int8_t device; -#define LSIV2_D_MASTER 0x00 -#define LSIV2_D_SLAVE 0x01 -#define LSIV2_D_CHANNEL0 0x00 -#define LSIV2_D_CHANNEL1 0x10 -#define LSIV2_D_NONE 0xff - - u_int8_t dummy_0; - u_int32_t disk_sectors; - u_int8_t disk_number; - u_int8_t raid_number; - u_int8_t flags; -#define LSIV2_D_GONE 0x02 - - u_int8_t filler[7]; - } __packed disk; - } configs[30]; - u_int8_t disk_number; - u_int8_t raid_number; - u_int32_t timestamp; - u_int8_t filler[10]; -} __packed; - - -/* LSILogic V3 MegaRAID Metadata */ -#define LSIV3_LBA(dev) \ - (((struct ad_softc *)device_get_ivars(dev))->total_secs - 4) - -struct lsiv3_raid_conf { - u_int32_t magic_0; /* 0xa0203200 */ - u_int32_t filler_0[3]; - u_int8_t magic_1[4]; /* "SATA" */ - u_int32_t filler_1[40]; - u_int32_t dummy_0; /* 0x0d000003 */ - u_int32_t filler_2[7]; - u_int32_t dummy_1; /* 0x0d000003 */ - u_int32_t filler_3[70]; - u_int8_t magic_2[8]; /* "$_ENQ$31" */ - u_int8_t filler_4[7]; - u_int8_t checksum_0; - u_int8_t filler_5[512*2]; - u_int8_t lsi_id[6]; -#define LSIV3_MAGIC "$_IDE$" - - u_int16_t dummy_2; /* 0x33de for OK disk */ - u_int16_t version; /* 0x0131 for this version */ - u_int16_t dummy_3; /* 0x0440 always */ - u_int32_t filler_6; - - struct { - u_int16_t stripe_pages; - u_int8_t type; -#define LSIV3_T_RAID0 0x00 -#define LSIV3_T_RAID1 0x01 - - u_int8_t dummy_0; - u_int8_t total_disks; - u_int8_t array_width; - u_int8_t filler_0[10]; - - u_int32_t sectors; - u_int16_t dummy_1; - u_int32_t offset; - u_int16_t dummy_2; - u_int8_t device; -#define LSIV3_D_DEVICE 0x01 -#define LSIV3_D_CHANNEL 0x10 - - u_int8_t dummy_3; - u_int8_t dummy_4; - u_int8_t dummy_5; - u_int8_t filler_1[16]; - } __packed raid[8]; - struct { - u_int32_t disk_sectors; - u_int32_t dummy_0; - u_int32_t dummy_1; - u_int8_t dummy_2; - u_int8_t dummy_3; - u_int8_t flags; -#define LSIV3_D_MIRROR 0x00 -#define LSIV3_D_STRIPE 0xff - u_int8_t dummy_4; - } __packed disk[6]; - u_int8_t filler_7[7]; - u_int8_t device; - u_int32_t timestamp; - u_int8_t filler_8[3]; - u_int8_t checksum_1; -} __packed; - - -/* nVidia MediaShield Metadata */ -#define NVIDIA_LBA(dev) \ - (((struct ad_softc *)device_get_ivars(dev))->total_secs - 2) - -struct nvidia_raid_conf { - u_int8_t nvidia_id[8]; -#define NV_MAGIC "NVIDIA " - - u_int32_t config_size; - u_int32_t checksum; - u_int16_t version; - u_int8_t disk_number; - u_int8_t dummy_0; - u_int32_t total_sectors; - u_int32_t sector_size; - u_int8_t serial[16]; - u_int8_t revision[4]; - u_int32_t dummy_1; - - u_int32_t magic_0; -#define NV_MAGIC0 0x00640044 - - u_int64_t magic_1; - u_int64_t magic_2; - u_int8_t flags; - u_int8_t array_width; - u_int8_t total_disks; - u_int8_t dummy_2; - u_int16_t type; -#define NV_T_RAID0 0x00000080 -#define NV_T_RAID1 0x00000081 -#define NV_T_RAID3 0x00000083 -#define NV_T_RAID5 0x00000085 -#define NV_T_RAID01 0x00008180 -#define NV_T_SPAN 0x000000ff - - u_int16_t dummy_3; - u_int32_t stripe_sectors; - u_int32_t stripe_bytes; - u_int32_t stripe_shift; - u_int32_t stripe_mask; - u_int32_t stripe_sizesectors; - u_int32_t stripe_sizebytes; - u_int32_t rebuild_lba; - u_int32_t dummy_4; - u_int32_t dummy_5; - u_int32_t status; -#define NV_S_BOOTABLE 0x00000001 -#define NV_S_DEGRADED 0x00000002 - - u_int32_t filler[98]; -} __packed; - - -/* Promise FastTrak Metadata */ -#define PROMISE_LBA(dev) \ - (((((struct ad_softc *)device_get_ivars(dev))->total_secs / (((struct ad_softc *)device_get_ivars(dev))->heads * ((struct ad_softc *)device_get_ivars(dev))->sectors)) * ((struct ad_softc *)device_get_ivars(dev))->heads * ((struct ad_softc *)device_get_ivars(dev))->sectors) - ((struct ad_softc *)device_get_ivars(dev))->sectors) - -struct promise_raid_conf { - char promise_id[24]; -#define PR_MAGIC "Promise Technology, Inc." - - u_int32_t dummy_0; - u_int64_t magic_0; -#define PR_MAGIC0(x) (((u_int64_t)(x.channel) << 48) | \ - ((u_int64_t)(x.device != 0) << 56)) - u_int16_t magic_1; - u_int32_t magic_2; - u_int8_t filler1[470]; - struct { - u_int32_t integrity; -#define PR_I_VALID 0x00000080 - - u_int8_t flags; -#define PR_F_VALID 0x00000001 -#define PR_F_ONLINE 0x00000002 -#define PR_F_ASSIGNED 0x00000004 -#define PR_F_SPARE 0x00000008 -#define PR_F_DUPLICATE 0x00000010 -#define PR_F_REDIR 0x00000020 -#define PR_F_DOWN 0x00000040 -#define PR_F_READY 0x00000080 - - u_int8_t disk_number; - u_int8_t channel; - u_int8_t device; - u_int64_t magic_0 __packed; - u_int32_t disk_offset; - u_int32_t disk_sectors; - u_int32_t rebuild_lba; - u_int16_t generation; - u_int8_t status; -#define PR_S_VALID 0x01 -#define PR_S_ONLINE 0x02 -#define PR_S_INITED 0x04 -#define PR_S_READY 0x08 -#define PR_S_DEGRADED 0x10 -#define PR_S_MARKED 0x20 -#define PR_S_FUNCTIONAL 0x80 - - u_int8_t type; -#define PR_T_RAID0 0x00 -#define PR_T_RAID1 0x01 -#define PR_T_RAID3 0x02 -#define PR_T_RAID5 0x04 -#define PR_T_SPAN 0x08 -#define PR_T_JBOD 0x10 - - u_int8_t total_disks; - u_int8_t stripe_shift; - u_int8_t array_width; - u_int8_t array_number; - u_int32_t total_sectors; - u_int16_t cylinders; - u_int8_t heads; - u_int8_t sectors; - u_int64_t magic_1 __packed; - struct { - u_int8_t flags; - u_int8_t dummy_0; - u_int8_t channel; - u_int8_t device; - u_int64_t magic_0 __packed; - } disk[8]; - } raid; - int32_t filler2[346]; - u_int32_t checksum; -} __packed; - - -/* Silicon Image Medley Metadata */ -#define SII_LBA(dev) \ - ( ((struct ad_softc *)device_get_ivars(dev))->total_secs - 1) - -struct sii_raid_conf { - u_int16_t ata_params_00_53[54]; - u_int64_t total_sectors; - u_int16_t ata_params_58_79[70]; - u_int16_t dummy_0; - u_int16_t dummy_1; - u_int32_t controller_pci_id; - u_int16_t version_minor; - u_int16_t version_major; - u_int8_t timestamp[6]; - u_int16_t stripe_sectors; - u_int16_t dummy_2; - u_int8_t disk_number; - u_int8_t type; -#define SII_T_RAID0 0x00 -#define SII_T_RAID1 0x01 -#define SII_T_RAID01 0x02 -#define SII_T_SPARE 0x03 - - u_int8_t raid0_disks; - u_int8_t raid0_ident; - u_int8_t raid1_disks; - u_int8_t raid1_ident; - u_int64_t rebuild_lba; - u_int32_t generation; - u_int8_t status; -#define SII_S_READY 0x01 - - u_int8_t base_raid1_position; - u_int8_t base_raid0_position; - u_int8_t position; - u_int16_t dummy_3; - u_int8_t name[16]; - u_int16_t checksum_0; - int8_t filler1[190]; - u_int16_t checksum_1; -} __packed; - - -/* Silicon Integrated Systems RAID Metadata */ -#define SIS_LBA(dev) \ - ( ((struct ad_softc *)device_get_ivars(dev))->total_secs - 16) - -struct sis_raid_conf { - u_int16_t magic; -#define SIS_MAGIC 0x0010 - - u_int8_t disks; -#define SIS_D_MASTER 0xf0 -#define SIS_D_MIRROR 0x0f - - u_int8_t type_total_disks; -#define SIS_D_MASK 0x0f -#define SIS_T_MASK 0xf0 -#define SIS_T_JBOD 0x10 -#define SIS_T_RAID0 0x20 -#define SIS_T_RAID1 0x30 - - u_int32_t dummy_0; - u_int32_t controller_pci_id; - u_int16_t stripe_sectors; - u_int16_t dummy_1; - u_int32_t timestamp; - u_int8_t model[40]; - u_int8_t disk_number; - u_int8_t dummy_2[3]; - int8_t filler1[448]; -} __packed; - - -/* VIA Tech V-RAID Metadata */ -#define VIA_LBA(dev) \ - ( ((struct ad_softc *)device_get_ivars(dev))->total_secs - 1) - -struct via_raid_conf { - u_int16_t magic; -#define VIA_MAGIC 0xaa55 - - u_int8_t dummy_0; - u_int8_t type; -#define VIA_T_MASK 0x7e -#define VIA_T_BOOTABLE 0x01 -#define VIA_T_RAID0 0x04 -#define VIA_T_RAID1 0x0c -#define VIA_T_RAID01 0x4c -#define VIA_T_RAID5 0x2c -#define VIA_T_SPAN 0x44 -#define VIA_T_UNKNOWN 0x80 - - u_int8_t disk_index; -#define VIA_D_MASK 0x0f -#define VIA_D_DEGRADED 0x10 -#define VIA_D_HIGH_IDX 0x20 - - u_int8_t stripe_layout; -#define VIA_L_DISKS 0x07 -#define VIA_L_MASK 0xf0 -#define VIA_L_SHIFT 4 - - u_int64_t disk_sectors; - u_int32_t disk_id; - u_int32_t disks[8]; - u_int8_t checksum; - u_int8_t filler_1[461]; -} __packed; Property changes on: head/sys/dev/ata/ata-raid.h ___________________________________________________________________ Deleted: svn:keywords ## -1 +0,0 ## -FreeBSD=%H \ No newline at end of property Index: head/sys/dev/ata/atapi-tape.c =================================================================== --- head/sys/dev/ata/atapi-tape.c (revision 249082) +++ head/sys/dev/ata/atapi-tape.c (nonexistent) @@ -1,739 +0,0 @@ -/*- - * Copyright (c) 1998 - 2008 Søren Schmidt - * 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. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include "opt_ata.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* device structure */ -static d_open_t ast_open; -static d_close_t ast_close; -static d_ioctl_t ast_ioctl; -static d_strategy_t ast_strategy; -static struct cdevsw ast_cdevsw = { - .d_version = D_VERSION, - .d_open = ast_open, - .d_close = ast_close, - .d_read = physread, - .d_write = physwrite, - .d_ioctl = ast_ioctl, - .d_strategy = ast_strategy, - .d_name = "ast", - .d_flags = D_TAPE | D_TRACKCLOSE, -}; - -/* prototypes */ -static int ast_sense(device_t); -static void ast_describe(device_t); -static void ast_done(struct ata_request *); -static int ast_mode_sense(device_t, int, void *, int); -static int ast_mode_select(device_t, void *, int); -static int ast_write_filemark(device_t, u_int8_t); -static int ast_read_position(device_t, int, struct ast_readposition *); -static int ast_space(device_t, u_int8_t, int32_t); -static int ast_locate(device_t, int, u_int32_t); -static int ast_prevent_allow(device_t, int); -static int ast_load_unload(device_t, u_int8_t); -static int ast_rewind(device_t); -static int ast_erase(device_t); -static int ast_test_ready(device_t); -static int ast_wait_dsc(device_t, int); - -/* internal vars */ -static u_int64_t ast_total = 0; -static MALLOC_DEFINE(M_AST, "ast_driver", "ATAPI tape driver buffers"); - -static int -ast_probe(device_t dev) -{ - struct ata_device *atadev = device_get_softc(dev); - - if ((atadev->param.config & ATA_PROTO_ATAPI) && - (atadev->param.config & ATA_ATAPI_TYPE_MASK) == ATA_ATAPI_TYPE_TAPE) - return 0; - else - return ENXIO; -} - -static int -ast_attach(device_t dev) -{ - struct ata_channel *ch = device_get_softc(device_get_parent(dev)); - struct ata_device *atadev = device_get_softc(dev); - struct ast_softc *stp; - struct ast_readposition position; - struct cdev *device; - - if (!(stp = malloc(sizeof(struct ast_softc), M_AST, M_NOWAIT | M_ZERO))) { - device_printf(dev, "out of memory\n"); - return ENOMEM; - } - device_set_ivars(dev, stp); - ata_setmode(dev); - - if (ast_sense(dev)) { - device_set_ivars(dev, NULL); - free(stp, M_AST); - return ENXIO; - } - if (!strcmp(atadev->param.model, "OnStream DI-30")) { - struct ast_transferpage transfer; - struct ast_identifypage identify; - - stp->flags |= F_ONSTREAM; - bzero(&transfer, sizeof(struct ast_transferpage)); - ast_mode_sense(dev, ATAPI_TAPE_TRANSFER_PAGE, - &transfer, sizeof(transfer)); - bzero(&identify, sizeof(struct ast_identifypage)); - ast_mode_sense(dev, ATAPI_TAPE_IDENTIFY_PAGE, - &identify, sizeof(identify)); - strncpy(identify.ident, "FBSD", 4); - ast_mode_select(dev, &identify, sizeof(identify)); - ast_read_position(dev, 0, &position); - } - - stp->stats = devstat_new_entry("ast", device_get_unit(dev), DEV_BSIZE, - DEVSTAT_NO_ORDERED_TAGS, - DEVSTAT_TYPE_SEQUENTIAL | DEVSTAT_TYPE_IF_IDE, - DEVSTAT_PRIORITY_TAPE); - device = make_dev(&ast_cdevsw, 0, UID_ROOT, GID_OPERATOR, 0640, - "ast%d", device_get_unit(dev)); - device->si_drv1 = dev; - device->si_iosize_max = ch->dma.max_iosize ? ch->dma.max_iosize : DFLTPHYS; - stp->dev1 = device; - device = make_dev(&ast_cdevsw, 1, UID_ROOT, GID_OPERATOR, 0640, - "nast%d", device_get_unit(dev)); - device->si_drv1 = dev; - device->si_iosize_max = ch->dma.max_iosize; - stp->dev2 = device; - - /* announce we are here and ready */ - ast_describe(dev); - return 0; -} - -static int -ast_detach(device_t dev) -{ - struct ast_softc *stp = device_get_ivars(dev); - - /* detroy devices from the system so we dont get any further requests */ - destroy_dev(stp->dev1); - destroy_dev(stp->dev2); - - /* fail requests on the queue and any thats "in flight" for this device */ - ata_fail_requests(dev); - - /* dont leave anything behind */ - devstat_remove_entry(stp->stats); - device_set_ivars(dev, NULL); - free(stp, M_AST); - return 0; -} - -static int -ast_shutdown(device_t dev) -{ - struct ata_device *atadev = device_get_softc(dev); - - if (atadev->param.support.command2 & ATA_SUPPORT_FLUSHCACHE) - ata_controlcmd(dev, ATA_FLUSHCACHE, 0, 0, 0); - return 0; -} - -static int -ast_reinit(device_t dev) -{ - struct ata_channel *ch = device_get_softc(device_get_parent(dev)); - struct ata_device *atadev = device_get_softc(dev); - - /* if detach pending, return error */ - if (!(ch->devices & (ATA_ATAPI_MASTER << atadev->unit))) - return 1; - - ata_setmode(dev); - return 0; -} - -static int -ast_open(struct cdev *cdev, int flags, int fmt, struct thread *td) -{ - device_t dev = cdev->si_drv1; - struct ata_device *atadev = device_get_softc(dev); - struct ast_softc *stp = device_get_ivars(dev); - - if (!stp) - return ENXIO; - if (!device_is_attached(dev)) - return EBUSY; - - ast_test_ready(dev); - if (stp->cap.lock) - ast_prevent_allow(dev, 1); - if (ast_sense(dev)) - device_printf(dev, "sense media type failed\n"); - - atadev->flags &= ~ATA_D_MEDIA_CHANGED; - stp->flags &= ~(F_DATA_WRITTEN | F_FM_WRITTEN); - ast_total = 0; - return 0; -} - -static int -ast_close(struct cdev *cdev, int flags, int fmt, struct thread *td) -{ - device_t dev = cdev->si_drv1; - struct ast_softc *stp = device_get_ivars(dev); - - /* flush buffers, some drives fail here, they should report ctl = 0 */ - if (stp->cap.ctl && (stp->flags & F_DATA_WRITTEN)) - ast_write_filemark(dev, 0); - - /* write filemark if data written to tape */ - if (!(stp->flags & F_ONSTREAM) && - (stp->flags & (F_DATA_WRITTEN | F_FM_WRITTEN)) == F_DATA_WRITTEN) - ast_write_filemark(dev, ATAPI_WF_WRITE); - - /* if unit is zero rewind on close */ - if (dev2unit(cdev) == 0) - ast_rewind(dev); - - if (stp->cap.lock && count_dev(cdev) == 1) - ast_prevent_allow(dev, 0); - - stp->flags &= ~F_CTL_WARN; -#ifdef AST_DEBUG - device_printf(dev, "%ju total bytes transferred\n", (uintmax_t)ast_total); -#endif - return 0; -} - -static int -ast_ioctl(struct cdev *cdev, u_long cmd, caddr_t data, int flag, struct thread *td) -{ - device_t dev = cdev->si_drv1; - struct ast_softc *stp = device_get_ivars(dev); - int error = 0; - - switch (cmd) { - case MTIOCGET: - { - struct mtget *g = (struct mtget *) data; - - bzero(g, sizeof(struct mtget)); - g->mt_type = 7; - g->mt_density = 1; - g->mt_blksiz = stp->blksize; - g->mt_comp = stp->cap.compress; - g->mt_density0 = 0; g->mt_density1 = 0; - g->mt_density2 = 0; g->mt_density3 = 0; - g->mt_blksiz0 = 0; g->mt_blksiz1 = 0; - g->mt_blksiz2 = 0; g->mt_blksiz3 = 0; - g->mt_comp0 = 0; g->mt_comp1 = 0; - g->mt_comp2 = 0; g->mt_comp3 = 0; - } - break; - - case MTIOCTOP: - { - int i; - struct mtop *mt = (struct mtop *)data; - - switch ((int16_t) (mt->mt_op)) { - - case MTWEOF: - for (i=0; i < mt->mt_count && !error; i++) - error = ast_write_filemark(dev, ATAPI_WF_WRITE); - break; - - case MTFSF: - if (mt->mt_count) - error = ast_space(dev, ATAPI_SP_FM, mt->mt_count); - break; - - case MTBSF: - if (mt->mt_count) - error = ast_space(dev, ATAPI_SP_FM, -(mt->mt_count)); - break; - - case MTREW: - error = ast_rewind(dev); - break; - - case MTOFFL: - error = ast_load_unload(dev, ATAPI_SS_EJECT); - break; - - case MTNOP: - error = ast_write_filemark(dev, 0); - break; - - case MTERASE: - error = ast_erase(dev); - break; - - case MTEOD: - error = ast_space(dev, ATAPI_SP_EOD, 0); - break; - - case MTRETENS: - error = ast_load_unload(dev, ATAPI_SS_RETENSION|ATAPI_SS_LOAD); - break; - - case MTFSR: - case MTBSR: - case MTCACHE: - case MTNOCACHE: - case MTSETBSIZ: - case MTSETDNSTY: - case MTCOMP: - default: - error = EINVAL; - } - } - break; - - case MTIOCRDSPOS: - { - struct ast_readposition position; - - if ((error = ast_read_position(dev, 0, &position))) - break; - *(u_int32_t *)data = position.tape; - } - break; - - case MTIOCRDHPOS: - { - struct ast_readposition position; - - if ((error = ast_read_position(dev, 1, &position))) - break; - *(u_int32_t *)data = position.tape; - } - break; - - case MTIOCSLOCATE: - error = ast_locate(dev, 0, *(u_int32_t *)data); - break; - - case MTIOCHLOCATE: - error = ast_locate(dev, 1, *(u_int32_t *)data); - break; - - default: - error = ata_device_ioctl(dev, cmd, data); - } - return error; -} - -static void -ast_strategy(struct bio *bp) -{ - device_t dev = bp->bio_dev->si_drv1; - struct ast_softc *stp = device_get_ivars(dev); - struct ata_request *request; - u_int32_t blkcount; - int8_t ccb[16]; - - /* if it's a null transfer, return immediatly. */ - if (bp->bio_bcount == 0) { - bp->bio_resid = 0; - biodone(bp); - return; - } - if (!(bp->bio_cmd == BIO_READ) && stp->flags & F_WRITEPROTECT) { - biofinish(bp, NULL, EPERM); - return; - } - - /* check for != blocksize requests */ - if (bp->bio_bcount % stp->blksize) { - device_printf(dev, "transfers must be multiple of %d\n", stp->blksize); - biofinish(bp, NULL, EIO); - return; - } - - /* warn about transfers bigger than the device suggests */ - if (bp->bio_bcount > stp->blksize * stp->cap.ctl) { - if ((stp->flags & F_CTL_WARN) == 0) { - device_printf(dev, "WARNING: CTL exceeded %ld>%d\n", - bp->bio_bcount, stp->blksize * stp->cap.ctl); - stp->flags |= F_CTL_WARN; - } - } - - bzero(ccb, sizeof(ccb)); - - if (bp->bio_cmd == BIO_READ) - ccb[0] = ATAPI_READ; - else - ccb[0] = ATAPI_WRITE; - - blkcount = bp->bio_bcount / stp->blksize; - - ccb[1] = 1; - ccb[2] = blkcount >> 16; - ccb[3] = blkcount >> 8; - ccb[4] = blkcount; - - if (!(request = ata_alloc_request())) { - biofinish(bp, NULL, ENOMEM); - return; - } - request->dev = dev; - request->driver = bp; - bcopy(ccb, request->u.atapi.ccb, 16); - request->data = bp->bio_data; - request->bytecount = blkcount * stp->blksize; - request->transfersize = min(request->bytecount, 65534); - request->timeout = (ccb[0] == ATAPI_WRITE_BIG) ? 180 : 120; - request->retries = 2; - request->callback = ast_done; - switch (bp->bio_cmd) { - case BIO_READ: - request->flags |= (ATA_R_ATAPI | ATA_R_READ); - break; - case BIO_WRITE: - request->flags |= (ATA_R_ATAPI | ATA_R_WRITE); - break; - default: - device_printf(dev, "unknown BIO operation\n"); - ata_free_request(request); - biofinish(bp, NULL, EIO); - return; - } - devstat_start_transaction_bio(stp->stats, bp); - ata_queue_request(request); -} - -static void -ast_done(struct ata_request *request) -{ - struct ast_softc *stp = device_get_ivars(request->dev); - struct bio *bp = request->driver; - - /* finish up transfer */ - if ((bp->bio_error = request->result)) - bp->bio_flags |= BIO_ERROR; - if (bp->bio_cmd == BIO_WRITE) - stp->flags |= F_DATA_WRITTEN; - bp->bio_resid = bp->bio_bcount - request->donecount; - ast_total += (bp->bio_bcount - bp->bio_resid); - biofinish(bp, stp->stats, 0); - ata_free_request(request); -} - -static int -ast_sense(device_t dev) -{ - struct ast_softc *stp = device_get_ivars(dev); - int count; - - /* get drive capabilities, some bugridden drives needs this repeated */ - for (count = 0 ; count < 5 ; count++) { - if (!ast_mode_sense(dev, ATAPI_TAPE_CAP_PAGE, - &stp->cap, sizeof(stp->cap)) && - stp->cap.page_code == ATAPI_TAPE_CAP_PAGE) { - if (stp->cap.blk32k) - stp->blksize = 32768; - if (stp->cap.blk1024) - stp->blksize = 1024; - if (stp->cap.blk512) - stp->blksize = 512; - if (!stp->blksize) - continue; - stp->cap.max_speed = ntohs(stp->cap.max_speed); - stp->cap.max_defects = ntohs(stp->cap.max_defects); - stp->cap.ctl = ntohs(stp->cap.ctl); - stp->cap.speed = ntohs(stp->cap.speed); - stp->cap.buffer_size = ntohs(stp->cap.buffer_size); - return 0; - } - } - return 1; -} - -static int -ast_mode_sense(device_t dev, int page, void *pagebuf, int pagesize) -{ - int8_t ccb[16] = { ATAPI_MODE_SENSE, 0x08, page, pagesize>>8, pagesize, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - int error; - - error = ata_atapicmd(dev, ccb, pagebuf, pagesize, ATA_R_READ, 10); - return error; -} - -static int -ast_mode_select(device_t dev, void *pagebuf, int pagesize) -{ - int8_t ccb[16] = { ATAPI_MODE_SELECT, 0x10, 0, pagesize>>8, pagesize, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - - return ata_atapicmd(dev, ccb, pagebuf, pagesize, 0, 10); -} - -static int -ast_write_filemark(device_t dev, u_int8_t function) -{ - struct ast_softc *stp = device_get_ivars(dev); - int8_t ccb[16] = { ATAPI_WEOF, 0x01, 0, 0, function, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0 }; - int error; - - if (stp->flags & F_ONSTREAM) - ccb[4] = 0x00; /* only flush buffers supported */ - else { - if (function) { - if (stp->flags & F_FM_WRITTEN) - stp->flags &= ~F_DATA_WRITTEN; - else - stp->flags |= F_FM_WRITTEN; - } - } - error = ata_atapicmd(dev, ccb, NULL, 0, 0, 10); - if (error) - return error; - return ast_wait_dsc(dev, 10*60); -} - -static int -ast_read_position(device_t dev, int hard, struct ast_readposition *position) -{ - int8_t ccb[16] = { ATAPI_READ_POSITION, (hard ? 0x01 : 0), 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0 }; - int error; - - error = ata_atapicmd(dev, ccb, (caddr_t)position, - sizeof(struct ast_readposition), ATA_R_READ, 10); - position->tape = ntohl(position->tape); - position->host = ntohl(position->host); - return error; -} - -static int -ast_space(device_t dev, u_int8_t function, int32_t count) -{ - int8_t ccb[16] = { ATAPI_SPACE, function, count>>16, count>>8, count, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - - return ata_atapicmd(dev, ccb, NULL, 0, 0, 60*60); -} - -static int -ast_locate(device_t dev, int hard, u_int32_t pos) -{ - int8_t ccb[16] = { ATAPI_LOCATE, 0x01 | (hard ? 0x4 : 0), 0, - pos>>24, pos>>16, pos>>8, pos, - 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - int error; - - error = ata_atapicmd(dev, ccb, NULL, 0, 0, 10); - if (error) - return error; - return ast_wait_dsc(dev, 60*60); -} - -static int -ast_prevent_allow(device_t dev, int lock) -{ - int8_t ccb[16] = { ATAPI_PREVENT_ALLOW, 0, 0, 0, lock, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - - return ata_atapicmd(dev, ccb, NULL, 0, 0, 30); -} - -static int -ast_load_unload(device_t dev, u_int8_t function) -{ - struct ast_softc *stp = device_get_ivars(dev); - int8_t ccb[16] = { ATAPI_START_STOP, 0x01, 0, 0, function, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0 }; - int error; - - if ((function & ATAPI_SS_EJECT) && !stp->cap.eject) - return 0; - error = ata_atapicmd(dev, ccb, NULL, 0, 0, 10); - if (error) - return error; - pause("astlu", 1 * hz); - if (function == ATAPI_SS_EJECT) - return 0; - return ast_wait_dsc(dev, 60*60); -} - -static int -ast_rewind(device_t dev) -{ - int8_t ccb[16] = { ATAPI_REZERO, 0x01, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0 }; - int error; - - error = ata_atapicmd(dev, ccb, NULL, 0, 0, 10); - if (error) - return error; - return ast_wait_dsc(dev, 60*60); -} - -static int -ast_erase(device_t dev) -{ - int8_t ccb[16] = { ATAPI_ERASE, 3, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0 }; - int error; - - if ((error = ast_rewind(dev))) - return error; - - return ata_atapicmd(dev, ccb, NULL, 0, 0, 60*60); -} - -static int -ast_test_ready(device_t dev) -{ - int8_t ccb[16] = { ATAPI_TEST_UNIT_READY, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - - return ata_atapicmd(dev, ccb, NULL, 0, 0, 30); -} - -static int -ast_wait_dsc(device_t dev, int timeout) -{ - int error = 0; - int8_t ccb[16] = { ATAPI_POLL_DSC, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - - timeout *= hz; - while (timeout > 0) { - error = ata_atapicmd(dev, ccb, NULL, 0, 0, 0); - if (error != EBUSY) - break; - pause("atpwt", hz / 2); - timeout -= (hz / 2); - } - return error; -} - -static void -ast_describe(device_t dev) -{ - struct ata_channel *ch = device_get_softc(device_get_parent(dev)); - struct ata_device *atadev = device_get_softc(dev); - struct ast_softc *stp = device_get_ivars(dev); - - if (bootverbose) { - device_printf(dev, "<%.40s/%.8s> tape drive at ata%d as %s\n", - atadev->param.model, atadev->param.revision, - device_get_unit(ch->dev), ata_unit2str(atadev)); - device_printf(dev, "%dKB/s, ", stp->cap.max_speed); - printf("transfer limit %d blk%s, ", - stp->cap.ctl, (stp->cap.ctl > 1) ? "s" : ""); - printf("%dKB buffer, ", (stp->cap.buffer_size * DEV_BSIZE) / 1024); - printf("%s %s\n", ata_mode2str(atadev->mode), - ata_satarev2str(ATA_GETREV(device_get_parent(dev), atadev->unit))); - device_printf(dev, "Medium: "); - switch (stp->cap.medium_type) { - case 0x00: - printf("none"); break; - case 0x17: - printf("Travan 1 (400 Mbyte)"); break; - case 0xb6: - printf("Travan 4 (4 Gbyte)"); break; - case 0xda: - printf("OnStream ADR (15Gyte)"); break; - default: - printf("unknown (0x%x)", stp->cap.medium_type); - } - if (stp->cap.readonly) printf(", readonly"); - if (stp->cap.reverse) printf(", reverse"); - if (stp->cap.eformat) printf(", eformat"); - if (stp->cap.qfa) printf(", qfa"); - if (stp->cap.lock) printf(", lock"); - if (stp->cap.locked) printf(", locked"); - if (stp->cap.prevent) printf(", prevent"); - if (stp->cap.eject) printf(", eject"); - if (stp->cap.disconnect) printf(", disconnect"); - if (stp->cap.ecc) printf(", ecc"); - if (stp->cap.compress) printf(", compress"); - if (stp->cap.blk512) printf(", 512b"); - if (stp->cap.blk1024) printf(", 1024b"); - if (stp->cap.blk32k) printf(", 32kb"); - printf("\n"); - } - else { - device_printf(dev, "TAPE <%.40s/%.8s> at ata%d-%s %s %s\n", - atadev->param.model, atadev->param.revision, - device_get_unit(ch->dev), ata_unit2str(atadev), - ata_mode2str(atadev->mode), - ata_satarev2str(ATA_GETREV(device_get_parent(dev), atadev->unit))); - } -} - -static device_method_t ast_methods[] = { - /* device interface */ - DEVMETHOD(device_probe, ast_probe), - DEVMETHOD(device_attach, ast_attach), - DEVMETHOD(device_detach, ast_detach), - DEVMETHOD(device_shutdown, ast_shutdown), - - /* ATA methods */ - DEVMETHOD(ata_reinit, ast_reinit), - - DEVMETHOD_END -}; - -static driver_t ast_driver = { - "ast", - ast_methods, - 0, -}; - -static devclass_t ast_devclass; - -DRIVER_MODULE(ast, ata, ast_driver, ast_devclass, NULL, NULL); -MODULE_VERSION(ast, 1); -MODULE_DEPEND(ast, ata, 1, 1, 1); Property changes on: head/sys/dev/ata/atapi-tape.c ___________________________________________________________________ Deleted: svn:keywords ## -1 +0,0 ## -FreeBSD=%H \ No newline at end of property Index: head/sys/dev/ata/atapi-tape.h =================================================================== --- head/sys/dev/ata/atapi-tape.h (revision 249082) +++ head/sys/dev/ata/atapi-tape.h (nonexistent) @@ -1,157 +0,0 @@ -/*- - * Copyright (c) 1998 - 2008 Søren Schmidt - * 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. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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. - * - * $FreeBSD$ - */ - -/* ATAPI tape drive Capabilities and Mechanical Status Page */ -struct ast_cappage { - /* mode page data header */ - u_int8_t data_length; /* total length of data */ - u_int8_t medium_type; /* medium type (if any) */ - u_int8_t reserved :4; - u_int8_t mode :3; /* buffering mode */ - u_int8_t write_protect :1; /* media is writeprotected */ - u_int8_t blk_desc_len; /* block Descriptor Length */ - - /* capabilities page */ - u_int8_t page_code :6; -#define ATAPI_TAPE_CAP_PAGE 0x2a - - u_int8_t reserved0_6 :1; - u_int8_t ps :1; /* parameters saveable */ - u_int8_t page_length; /* page Length == 0x12 */ - u_int8_t reserved2; - u_int8_t reserved3; - u_int8_t readonly :1; /* read Only Mode */ - u_int8_t reserved4_1234 :4; - u_int8_t reverse :1; /* supports reverse direction */ - u_int8_t reserved4_67 :2; - u_int8_t reserved5_012 :3; - u_int8_t eformat :1; /* supports ERASE formatting */ - u_int8_t reserved5_4 :1; - u_int8_t qfa :1; /* supports QFA formats */ - u_int8_t reserved5_67 :2; - u_int8_t lock :1; /* supports locking media */ - u_int8_t locked :1; /* the media is locked */ - u_int8_t prevent :1; /* defaults to prevent state */ - u_int8_t eject :1; /* supports eject */ - u_int8_t disconnect :1; /* can break request > ctl */ - u_int8_t reserved6_5 :1; - u_int8_t ecc :1; /* supports error correction */ - u_int8_t compress :1; /* supports data compression */ - u_int8_t reserved7_0 :1; - u_int8_t blk512 :1; /* supports 512b block size */ - u_int8_t blk1024 :1; /* supports 1024b block size */ - u_int8_t reserved7_3456 :4; - u_int8_t blk32k :1; /* supports 32kb block size */ - u_int16_t max_speed; /* supported speed in KBps */ - u_int16_t max_defects; /* max stored defect entries */ - u_int16_t ctl; /* continuous transfer limit */ - u_int16_t speed; /* current Speed, in KBps */ - u_int16_t buffer_size; /* buffer Size, in 512 bytes */ - u_int8_t reserved18; - u_int8_t reserved19; -}; - -/* ATAPI OnStream ADR data transfer mode page (ADR unique) */ -struct ast_transferpage { - /* mode page data header */ - u_int8_t data_length; /* total length of data */ - u_int8_t medium_type; /* medium type (if any) */ - u_int8_t dsp; /* device specific parameter */ - u_int8_t blk_desc_len; /* block Descriptor Length */ - - /* data transfer page */ - u_int8_t page_code :6; -#define ATAPI_TAPE_TRANSFER_PAGE 0x30 - - u_int8_t reserved0_6 :1; - u_int8_t ps :1; /* parameters saveable */ - u_int8_t page_length; /* page Length == 0x02 */ - u_int8_t reserved2; - u_int8_t read32k :1; /* 32k blk size (data only) */ - u_int8_t read32k5 :1; /* 32.5k blk size (data&AUX) */ - u_int8_t reserved3_23 :2; - u_int8_t write32k :1; /* 32k blk size (data only) */ - u_int8_t write32k5 :1; /* 32.5k blk size (data&AUX) */ - u_int8_t reserved3_6 :1; - u_int8_t streaming :1; /* streaming mode enable */ -}; - -/* ATAPI OnStream ADR vendor identification mode page (ADR unique) */ -struct ast_identifypage { - /* mode page data header */ - u_int8_t data_length; /* total length of data */ - u_int8_t medium_type; /* medium type (if any) */ - u_int8_t dsp; /* device specific parameter */ - u_int8_t blk_desc_len; /* block Descriptor Length */ - - /* data transfer page */ - u_int8_t page_code :6; -#define ATAPI_TAPE_IDENTIFY_PAGE 0x36 - - u_int8_t reserved0_6 :1; - u_int8_t ps :1; /* parameters saveable */ - u_int8_t page_length; /* page Length == 0x06 */ - u_int8_t ident[4]; /* host id string */ - u_int8_t reserved6; - u_int8_t reserved7; -}; - -/* ATAPI read position structure */ -struct ast_readposition { - u_int8_t reserved0_05 :6; - u_int8_t eop :1; /* end of partition */ - u_int8_t bop :1; /* beginning of partition */ - u_int8_t reserved1; - u_int8_t reserved2; - u_int8_t reserved3; - u_int32_t host; /* frame address in buffer */ - u_int32_t tape; /* frame address on tape */ - u_int8_t reserved12; - u_int8_t reserved13; - u_int8_t reserved14; - u_int8_t blks_in_buf; /* blocks in buffer */ - u_int8_t reserved16; - u_int8_t reserved17; - u_int8_t reserved18; - u_int8_t reserved19; -}; - -struct ast_softc { - int flags; /* device state flags */ -#define F_CTL_WARN 0x0001 /* warned about CTL wrong? */ -#define F_WRITEPROTECT 0x0002 /* media is writeprotected */ -#define F_DATA_WRITTEN 0x0004 /* data has been written */ -#define F_FM_WRITTEN 0x0008 /* filemark has been written */ -#define F_ONSTREAM 0x0100 /* OnStream ADR device */ - - int blksize; /* block size (512 | 1024) */ - struct atapi_params *param; /* drive parameters table */ - struct ast_cappage cap; /* capabilities page info */ - struct devstat *stats; /* devstat entry */ - struct cdev *dev1, *dev2; /* device place holders */ -}; Property changes on: head/sys/dev/ata/atapi-tape.h ___________________________________________________________________ Deleted: svn:keywords ## -1 +0,0 ## -FreeBSD=%H \ No newline at end of property Index: head/sys/dev/ata/atapi-cd.c =================================================================== --- head/sys/dev/ata/atapi-cd.c (revision 249082) +++ head/sys/dev/ata/atapi-cd.c (nonexistent) @@ -1,1921 +0,0 @@ -/*- - * Copyright (c) 1998 - 2008 Søren Schmidt - * 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. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include "opt_ata.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* prototypes */ -static void acd_geom_attach(void *, int); -static void acd_geom_detach(void *, int); -static void acd_set_ioparm(device_t); -static void acd_describe(device_t); -static void lba2msf(u_int32_t, u_int8_t *, u_int8_t *, u_int8_t *); -static u_int32_t msf2lba(u_int8_t, u_int8_t, u_int8_t); -static int acd_geom_access(struct g_provider *, int, int, int); -static g_ioctl_t acd_geom_ioctl; -static void acd_geom_start(struct bio *); -static void acd_strategy(struct bio *); -static void acd_done(struct ata_request *); -static void acd_read_toc(device_t); -static int acd_play(device_t, int, int); -static int acd_setchan(device_t, u_int8_t, u_int8_t, u_int8_t, u_int8_t); -static int acd_init_writer(device_t, int); -static int acd_fixate(device_t, int); -static int acd_init_track(device_t, struct cdr_track *); -static int acd_flush(device_t); -static int acd_read_track_info(device_t, int32_t, struct acd_track_info *); -static int acd_get_progress(device_t, int *); -static int acd_send_cue(device_t, struct cdr_cuesheet *); -static int acd_report_key(device_t, struct dvd_authinfo *); -static int acd_send_key(device_t, struct dvd_authinfo *); -static int acd_read_structure(device_t, struct dvd_struct *); -static int acd_tray(device_t, int); -static int acd_blank(device_t, int); -static int acd_prevent_allow(device_t, int); -static int acd_start_stop(device_t, int); -static int acd_pause_resume(device_t, int); -static int acd_mode_sense(device_t, int, caddr_t, int); -static int acd_mode_select(device_t, caddr_t, int); -static int acd_set_speed(device_t, int, int); -static void acd_get_cap(device_t); -static int acd_read_format_caps(device_t, struct cdr_format_capacities *); -static int acd_format(device_t, struct cdr_format_params *); -static int acd_test_ready(device_t); - -/* internal vars */ -static MALLOC_DEFINE(M_ACD, "acd_driver", "ATAPI CD driver buffers"); -static struct g_class acd_class = { - .name = "ACD", - .version = G_VERSION, - .access = acd_geom_access, - .ioctl = acd_geom_ioctl, - .start = acd_geom_start, -}; -//DECLARE_GEOM_CLASS(acd_class, acd); - -static int -acd_probe(device_t dev) -{ - struct ata_device *atadev = device_get_softc(dev); - - if ((atadev->param.config & ATA_PROTO_ATAPI) && - (atadev->param.config & ATA_ATAPI_TYPE_MASK) == ATA_ATAPI_TYPE_CDROM) - return 0; - else - return ENXIO; -} - -static int -acd_attach(device_t dev) -{ - struct acd_softc *cdp; - - if (!(cdp = malloc(sizeof(struct acd_softc), M_ACD, M_NOWAIT | M_ZERO))) { - device_printf(dev, "out of memory\n"); - return ENOMEM; - } - cdp->block_size = 2048; - device_set_ivars(dev, cdp); - ata_setmode(dev); - ata_controlcmd(dev, ATA_DEVICE_RESET, 0, 0, 0); - acd_get_cap(dev); - g_post_event(acd_geom_attach, dev, M_WAITOK, NULL); - - /* announce we are here */ - acd_describe(dev); - return 0; -} - -static int -acd_detach(device_t dev) -{ - g_waitfor_event(acd_geom_detach, dev, M_WAITOK, NULL); - return 0; -} - -static int -acd_shutdown(device_t dev) -{ - struct ata_device *atadev = device_get_softc(dev); - - if (atadev->param.support.command2 & ATA_SUPPORT_FLUSHCACHE) - ata_controlcmd(dev, ATA_FLUSHCACHE, 0, 0, 0); - return 0; -} - -static int -acd_reinit(device_t dev) -{ - struct ata_channel *ch = device_get_softc(device_get_parent(dev)); - struct ata_device *atadev = device_get_softc(dev); - - /* if detach pending, return error */ - if (!(ch->devices & (ATA_ATAPI_MASTER << atadev->unit))) - return 1; - - ata_setmode(dev); - return 0; -} - -static void -acd_geom_attach(void *arg, int flag) -{ - struct ata_device *atadev = device_get_softc(arg); - struct acd_softc *cdp = device_get_ivars(arg); - struct g_geom *gp; - struct g_provider *pp; - - g_topology_assert(); - gp = g_new_geomf(&acd_class, "acd%d", device_get_unit(arg)); - gp->softc = arg; - cdp->gp = gp; - pp = g_new_providerf(gp, "acd%d", device_get_unit(arg)); - pp->index = 0; - cdp->pp[0] = pp; - g_error_provider(pp, 0); - atadev->flags |= ATA_D_MEDIA_CHANGED; - acd_set_ioparm(arg); -} - -static void -acd_geom_detach(void *arg, int flag) -{ - struct acd_softc *cdp = device_get_ivars(arg); - - /* signal geom so we dont get any further requests */ - g_wither_geom(cdp->gp, ENXIO); - - /* fail requests on the queue and any thats "in flight" for this device */ - ata_fail_requests(arg); - - /* dont leave anything behind */ - device_set_ivars(arg, NULL); - free(cdp, M_ACD); -} - -static int -acd_geom_ioctl(struct g_provider *pp, u_long cmd, void *addr, int fflag, struct thread *td) -{ - device_t dev = pp->geom->softc; - struct ata_device *atadev = device_get_softc(dev); - struct acd_softc *cdp = device_get_ivars(dev); - int error = 0, nocopyout = 0; - - if (!cdp) - return ENXIO; - - if (atadev->flags & ATA_D_MEDIA_CHANGED) { - switch (cmd) { - case CDIOCRESET: - acd_test_ready(dev); - break; - - default: - acd_read_toc(dev); - acd_prevent_allow(dev, 1); - cdp->flags |= F_LOCKED; - break; - } - } - - switch (cmd) { - - case CDIOCRESUME: - error = acd_pause_resume(dev, 1); - break; - - case CDIOCPAUSE: - error = acd_pause_resume(dev, 0); - break; - - case CDIOCSTART: - error = acd_start_stop(dev, 1); - break; - - case CDIOCSTOP: - error = acd_start_stop(dev, 0); - break; - - case CDIOCALLOW: - error = acd_prevent_allow(dev, 0); - cdp->flags &= ~F_LOCKED; - break; - - case CDIOCPREVENT: - error = acd_prevent_allow(dev, 1); - cdp->flags |= F_LOCKED; - break; - - /* - * XXXRW: Why does this require privilege? - */ - case CDIOCRESET: - error = priv_check(td, PRIV_DRIVER); - if (error) - break; - error = acd_test_ready(dev); - break; - - case CDIOCEJECT: - if (pp->acr != 1) { - error = EBUSY; - break; - } - error = acd_tray(dev, 0); - break; - - case CDIOCCLOSE: - if (pp->acr != 1) - break; - error = acd_tray(dev, 1); - break; - - case CDIOREADTOCHEADER: - if (!cdp->toc.hdr.ending_track) { - error = EIO; - break; - } - bcopy(&cdp->toc.hdr, addr, sizeof(cdp->toc.hdr)); - break; - - case CDIOREADTOCENTRYS: - { - struct ioc_read_toc_entry *te = (struct ioc_read_toc_entry *)addr; - struct toc *toc = &cdp->toc; - int starting_track = te->starting_track; - int len; - - if (!toc->hdr.ending_track) { - error = EIO; - break; - } - - if (te->data_len < sizeof(toc->tab[0]) || - (te->data_len % sizeof(toc->tab[0])) != 0 || - (te->address_format != CD_MSF_FORMAT && - te->address_format != CD_LBA_FORMAT)) { - error = EINVAL; - break; - } - - if (!starting_track) - starting_track = toc->hdr.starting_track; - else if (starting_track == 170) - starting_track = toc->hdr.ending_track + 1; - else if (starting_track < toc->hdr.starting_track || - starting_track > toc->hdr.ending_track + 1) { - error = EINVAL; - break; - } - - len = ((toc->hdr.ending_track + 1 - starting_track) + 1) * - sizeof(toc->tab[0]); - if (te->data_len < len) - len = te->data_len; - if (len > sizeof(toc->tab)) { - error = EINVAL; - break; - } - - if (te->address_format == CD_MSF_FORMAT) { - struct cd_toc_entry *entry; - - if (!(toc = malloc(sizeof(struct toc), M_ACD, M_NOWAIT))) { - error = ENOMEM; - break; - } - bcopy(&cdp->toc, toc, sizeof(struct toc)); - entry = toc->tab + (toc->hdr.ending_track + 1 - - toc->hdr.starting_track) + 1; - while (--entry >= toc->tab) { - lba2msf(ntohl(entry->addr.lba), &entry->addr.msf.minute, - &entry->addr.msf.second, &entry->addr.msf.frame); - entry->addr_type = CD_MSF_FORMAT; - } - } - error = copyout(toc->tab + starting_track - toc->hdr.starting_track, - te->data, len); - if (te->address_format == CD_MSF_FORMAT) - free(toc, M_ACD); - } - break; - - case CDIOREADTOCENTRY: - { - struct ioc_read_toc_single_entry *te = - (struct ioc_read_toc_single_entry *)addr; - struct toc *toc = &cdp->toc; - u_char track = te->track; - - if (!toc->hdr.ending_track) { - error = EIO; - break; - } - - if (te->address_format != CD_MSF_FORMAT && - te->address_format != CD_LBA_FORMAT) { - error = EINVAL; - break; - } - - if (!track) - track = toc->hdr.starting_track; - else if (track == 170) - track = toc->hdr.ending_track + 1; - else if (track < toc->hdr.starting_track || - track > toc->hdr.ending_track + 1) { - error = EINVAL; - break; - } - - if (te->address_format == CD_MSF_FORMAT) { - struct cd_toc_entry *entry; - - if (!(toc = malloc(sizeof(struct toc), M_ACD, M_NOWAIT))) { - error = ENOMEM; - break; - } - bcopy(&cdp->toc, toc, sizeof(struct toc)); - entry = toc->tab + (track - toc->hdr.starting_track); - lba2msf(ntohl(entry->addr.lba), &entry->addr.msf.minute, - &entry->addr.msf.second, &entry->addr.msf.frame); - } - bcopy(toc->tab + track - toc->hdr.starting_track, - &te->entry, sizeof(struct cd_toc_entry)); - if (te->address_format == CD_MSF_FORMAT) - free(toc, M_ACD); - } - break; - -#if __FreeBSD_version > 600008 - case CDIOCREADSUBCHANNEL_SYSSPACE: - nocopyout = 1; - /* FALLTHROUGH */ - -#endif - case CDIOCREADSUBCHANNEL: - { - struct ioc_read_subchannel *args = - (struct ioc_read_subchannel *)addr; - u_int8_t format; - int8_t ccb[16] = { ATAPI_READ_SUBCHANNEL, 0, 0x40, 1, 0, 0, 0, - sizeof(cdp->subchan)>>8, sizeof(cdp->subchan), - 0, 0, 0, 0, 0, 0, 0 }; - - if (args->data_len > sizeof(struct cd_sub_channel_info) || - args->data_len < sizeof(struct cd_sub_channel_header)) { - error = EINVAL; - break; - } - - format = args->data_format; - if ((format != CD_CURRENT_POSITION) && - (format != CD_MEDIA_CATALOG) && (format != CD_TRACK_INFO)) { - error = EINVAL; - break; - } - - ccb[1] = args->address_format & CD_MSF_FORMAT; - - if ((error = ata_atapicmd(dev, ccb, (caddr_t)&cdp->subchan, - sizeof(cdp->subchan), ATA_R_READ, 10))) - break; - - if ((format == CD_MEDIA_CATALOG) || (format == CD_TRACK_INFO)) { - if (cdp->subchan.header.audio_status == 0x11) { - error = EINVAL; - break; - } - - ccb[3] = format; - if (format == CD_TRACK_INFO) - ccb[6] = args->track; - - if ((error = ata_atapicmd(dev, ccb, (caddr_t)&cdp->subchan, - sizeof(cdp->subchan),ATA_R_READ,10))){ - break; - } - } - if (nocopyout == 0) { - error = copyout(&cdp->subchan, args->data, args->data_len); - } else { - error = 0; - bcopy(&cdp->subchan, args->data, args->data_len); - } - } - break; - - case CDIOCPLAYMSF: - { - struct ioc_play_msf *args = (struct ioc_play_msf *)addr; - - error = - acd_play(dev, - msf2lba(args->start_m, args->start_s, args->start_f), - msf2lba(args->end_m, args->end_s, args->end_f)); - } - break; - - case CDIOCPLAYBLOCKS: - { - struct ioc_play_blocks *args = (struct ioc_play_blocks *)addr; - - error = acd_play(dev, args->blk, args->blk + args->len); - } - break; - - case CDIOCPLAYTRACKS: - { - struct ioc_play_track *args = (struct ioc_play_track *)addr; - int t1, t2; - - if (!cdp->toc.hdr.ending_track) { - error = EIO; - break; - } - if (args->end_track < cdp->toc.hdr.ending_track + 1) - ++args->end_track; - if (args->end_track > cdp->toc.hdr.ending_track + 1) - args->end_track = cdp->toc.hdr.ending_track + 1; - t1 = args->start_track - cdp->toc.hdr.starting_track; - t2 = args->end_track - cdp->toc.hdr.starting_track; - if (t1 < 0 || t2 < 0 || - t1 > (cdp->toc.hdr.ending_track-cdp->toc.hdr.starting_track)) { - error = EINVAL; - break; - } - error = acd_play(dev, ntohl(cdp->toc.tab[t1].addr.lba), - ntohl(cdp->toc.tab[t2].addr.lba)); - } - break; - - case CDIOCGETVOL: - { - struct ioc_vol *arg = (struct ioc_vol *)addr; - - if ((error = acd_mode_sense(dev, ATAPI_CDROM_AUDIO_PAGE, - (caddr_t)&cdp->au, sizeof(cdp->au)))) - break; - - if (cdp->au.page_code != ATAPI_CDROM_AUDIO_PAGE) { - error = EIO; - break; - } - arg->vol[0] = cdp->au.port[0].volume; - arg->vol[1] = cdp->au.port[1].volume; - arg->vol[2] = cdp->au.port[2].volume; - arg->vol[3] = cdp->au.port[3].volume; - } - break; - - case CDIOCSETVOL: - { - struct ioc_vol *arg = (struct ioc_vol *)addr; - - if ((error = acd_mode_sense(dev, ATAPI_CDROM_AUDIO_PAGE, - (caddr_t)&cdp->au, sizeof(cdp->au)))) - break; - if (cdp->au.page_code != ATAPI_CDROM_AUDIO_PAGE) { - error = EIO; - break; - } - if ((error = acd_mode_sense(dev, ATAPI_CDROM_AUDIO_PAGE_MASK, - (caddr_t)&cdp->aumask, - sizeof(cdp->aumask)))) - break; - cdp->au.data_length = 0; - cdp->au.port[0].channels = CHANNEL_0; - cdp->au.port[1].channels = CHANNEL_1; - cdp->au.port[0].volume = arg->vol[0] & cdp->aumask.port[0].volume; - cdp->au.port[1].volume = arg->vol[1] & cdp->aumask.port[1].volume; - cdp->au.port[2].volume = arg->vol[2] & cdp->aumask.port[2].volume; - cdp->au.port[3].volume = arg->vol[3] & cdp->aumask.port[3].volume; - error = acd_mode_select(dev, (caddr_t)&cdp->au, sizeof(cdp->au)); - } - break; - - case CDIOCSETPATCH: - { - struct ioc_patch *arg = (struct ioc_patch *)addr; - - error = acd_setchan(dev, arg->patch[0], arg->patch[1], - arg->patch[2], arg->patch[3]); - } - break; - - case CDIOCSETMONO: - error = acd_setchan(dev, CHANNEL_0|CHANNEL_1, CHANNEL_0|CHANNEL_1, 0,0); - break; - - case CDIOCSETSTEREO: - error = acd_setchan(dev, CHANNEL_0, CHANNEL_1, 0, 0); - break; - - case CDIOCSETMUTE: - error = acd_setchan(dev, 0, 0, 0, 0); - break; - - case CDIOCSETLEFT: - error = acd_setchan(dev, CHANNEL_0, CHANNEL_0, 0, 0); - break; - - case CDIOCSETRIGHT: - error = acd_setchan(dev, CHANNEL_1, CHANNEL_1, 0, 0); - break; - - case CDRIOCBLANK: - error = acd_blank(dev, (*(int *)addr)); - break; - - case CDRIOCNEXTWRITEABLEADDR: - { - struct acd_track_info track_info; - - if ((error = acd_read_track_info(dev, 0xff, &track_info))) - break; - - if (!track_info.nwa_valid) { - error = EINVAL; - break; - } - *(int*)addr = track_info.next_writeable_addr; - } - break; - - case CDRIOCINITWRITER: - error = acd_init_writer(dev, (*(int *)addr)); - break; - - case CDRIOCINITTRACK: - error = acd_init_track(dev, (struct cdr_track *)addr); - break; - - case CDRIOCFLUSH: - error = acd_flush(dev); - break; - - case CDRIOCFIXATE: - error = acd_fixate(dev, (*(int *)addr)); - break; - - case CDRIOCREADSPEED: - { - int speed = *(int *)addr; - - /* Preserve old behavior: units in multiples of CDROM speed */ - if (speed < 177) - speed *= 177; - error = acd_set_speed(dev, speed, CDR_MAX_SPEED); - } - break; - - case CDRIOCWRITESPEED: - { - int speed = *(int *)addr; - - if (speed < 177) - speed *= 177; - error = acd_set_speed(dev, CDR_MAX_SPEED, speed); - } - break; - - case CDRIOCGETBLOCKSIZE: - *(int *)addr = cdp->block_size; - break; - - case CDRIOCSETBLOCKSIZE: - cdp->block_size = *(int *)addr; - pp->sectorsize = cdp->block_size; /* hack for GEOM SOS */ - acd_set_ioparm(dev); - break; - - case CDRIOCGETPROGRESS: - error = acd_get_progress(dev, (int *)addr); - break; - - case CDRIOCSENDCUE: - error = acd_send_cue(dev, (struct cdr_cuesheet *)addr); - break; - - case CDRIOCREADFORMATCAPS: - error = acd_read_format_caps(dev, (struct cdr_format_capacities *)addr); - break; - - case CDRIOCFORMAT: - error = acd_format(dev, (struct cdr_format_params *)addr); - break; - - case DVDIOCREPORTKEY: - if (cdp->cap.media & MST_READ_DVDROM) - error = acd_report_key(dev, (struct dvd_authinfo *)addr); - else - error = EINVAL; - break; - - case DVDIOCSENDKEY: - if (cdp->cap.media & MST_READ_DVDROM) - error = acd_send_key(dev, (struct dvd_authinfo *)addr); - else - error = EINVAL; - break; - - case DVDIOCREADSTRUCTURE: - if (cdp->cap.media & MST_READ_DVDROM) - error = acd_read_structure(dev, (struct dvd_struct *)addr); - else - error = EINVAL; - break; - - default: - error = ata_device_ioctl(dev, cmd, addr); - } - return error; -} - -static int -acd_geom_access(struct g_provider *pp, int dr, int dw, int de) -{ - device_t dev = pp->geom->softc; - struct acd_softc *cdp = device_get_ivars(dev); - struct ata_request *request; - int8_t ccb[16] = { ATAPI_TEST_UNIT_READY, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - int timeout = 60, track; - - if (!(request = ata_alloc_request())) - return ENOMEM; - - /* wait if drive is not finished loading the medium */ - while (timeout--) { - request->dev = dev; - bcopy(ccb, request->u.atapi.ccb, 16); - request->flags = ATA_R_ATAPI; - request->timeout = ATA_REQUEST_TIMEOUT; - ata_queue_request(request); - if (!request->error && - (request->u.atapi.sense.key == 2 || - request->u.atapi.sense.key == 7) && - request->u.atapi.sense.asc == 4 && - request->u.atapi.sense.ascq == 1) - pause("acdld", hz / 2); - else - break; - } - ata_free_request(request); - - if (pp->acr == 0) { - acd_prevent_allow(dev, 1); - cdp->flags |= F_LOCKED; - acd_read_toc(dev); - } - - if (dr + pp->acr == 0) { - acd_prevent_allow(dev, 0); - cdp->flags &= ~F_LOCKED; - } - - if ((track = pp->index)) { - pp->sectorsize = (cdp->toc.tab[track - 1].control & 4) ? 2048 : 2352; - pp->mediasize = ntohl(cdp->toc.tab[track].addr.lba) - - ntohl(cdp->toc.tab[track - 1].addr.lba); - } - else { - pp->sectorsize = cdp->block_size; - pp->mediasize = cdp->disk_size; - } - pp->mediasize *= pp->sectorsize; - - return 0; -} - -static void -acd_geom_start(struct bio *bp) -{ - device_t dev = bp->bio_to->geom->softc; - struct acd_softc *cdp = device_get_ivars(dev); - - if (bp->bio_cmd != BIO_READ && bp->bio_cmd != BIO_WRITE) { - g_io_deliver(bp, EOPNOTSUPP); - return; - } - - if (bp->bio_cmd == BIO_READ && cdp->disk_size == -1) { - g_io_deliver(bp, EIO); - return; - } - - /* GEOM classes must do their own request limiting */ - if (bp->bio_length <= cdp->iomax) { - bp->bio_pblkno = bp->bio_offset / bp->bio_to->sectorsize; - acd_strategy(bp); - } - else { - u_int pos, size = cdp->iomax - cdp->iomax % bp->bio_to->sectorsize; - struct bio *bp2, *bp3; - - if (!(bp2 = g_clone_bio(bp))) - g_io_deliver(bp, EIO); - - for (pos = 0; bp2; pos += size) { - bp3 = NULL; - bp2->bio_done = g_std_done; - bp2->bio_to = bp->bio_to; - bp2->bio_offset += pos; - bp2->bio_data += pos; - bp2->bio_length = bp->bio_length - pos; - if (bp2->bio_length > size) { - bp2->bio_length = size; - if (!(bp3 = g_clone_bio(bp))) - bp->bio_error = ENOMEM; - } - bp2->bio_pblkno = bp2->bio_offset / bp2->bio_to->sectorsize; - acd_strategy(bp2); - bp2 = bp3; - } - } -} - -static void -acd_strategy(struct bio *bp) -{ - device_t dev = bp->bio_to->geom->softc; - struct ata_device *atadev = device_get_softc(dev); - struct acd_softc *cdp = device_get_ivars(dev); - struct ata_request *request; - u_int32_t lba, lastlba, count; - int8_t ccb[16]; - int track, blocksize; - - /* reject all queued entries if media changed */ - if (atadev->flags & ATA_D_MEDIA_CHANGED) { - g_io_deliver(bp, EIO); - return; - } - - bzero(ccb, sizeof(ccb)); - - track = bp->bio_to->index; - - if (track) { - blocksize = (cdp->toc.tab[track - 1].control & 4) ? 2048 : 2352; - lastlba = ntohl(cdp->toc.tab[track].addr.lba); - lba = bp->bio_offset / blocksize; - lba += ntohl(cdp->toc.tab[track - 1].addr.lba); - } - else { - blocksize = cdp->block_size; - lastlba = cdp->disk_size; - lba = bp->bio_offset / blocksize; - } - - count = bp->bio_length / blocksize; - - if (bp->bio_cmd == BIO_READ) { - /* if transfer goes beyond range adjust it to be within limits */ - if (lba + count > lastlba) { - /* if we are entirely beyond EOM return EOF */ - if (lastlba <= lba) { - g_io_deliver(bp, 0); - return; - } - count = lastlba - lba; - } - switch (blocksize) { - case 2048: - ccb[0] = ATAPI_READ_BIG; - break; - - case 2352: - ccb[0] = ATAPI_READ_CD; - ccb[9] = 0xf8; - break; - - default: - ccb[0] = ATAPI_READ_CD; - ccb[9] = 0x10; - } - } - else - ccb[0] = ATAPI_WRITE_BIG; - - ccb[1] = 0; - ccb[2] = lba>>24; - ccb[3] = lba>>16; - ccb[4] = lba>>8; - ccb[5] = lba; - ccb[6] = count>>16; - ccb[7] = count>>8; - ccb[8] = count; - - if (!(request = ata_alloc_request())) { - g_io_deliver(bp, ENOMEM); - return; - } - request->dev = dev; - request->bio = bp; - bcopy(ccb, request->u.atapi.ccb, 16); - request->data = bp->bio_data; - request->bytecount = count * blocksize; - request->transfersize = min(request->bytecount, 65534); - request->timeout = (ccb[0] == ATAPI_WRITE_BIG) ? 60 : 30; - request->retries = 2; - request->callback = acd_done; - request->flags = ATA_R_ATAPI; - if (atadev->mode >= ATA_DMA) - request->flags |= ATA_R_DMA; - switch (bp->bio_cmd) { - case BIO_READ: - request->flags |= ATA_R_READ; - break; - case BIO_WRITE: - request->flags |= ATA_R_WRITE; - break; - default: - device_printf(dev, "unknown BIO operation\n"); - ata_free_request(request); - g_io_deliver(bp, EIO); - return; - } - ata_queue_request(request); -} - -static void -acd_done(struct ata_request *request) -{ - struct bio *bp = request->bio; - - /* finish up transfer */ - bp->bio_completed = request->donecount; - g_io_deliver(bp, request->result); - ata_free_request(request); -} - -static void -acd_set_ioparm(device_t dev) -{ - struct ata_channel *ch = device_get_softc(device_get_parent(dev)); - struct acd_softc *cdp = device_get_ivars(dev); - uint32_t max_iosize; - - max_iosize = ch->dma.max_iosize ? ch->dma.max_iosize : DFLTPHYS; - - cdp->iomax = min(max_iosize, 65534); -} - -static void -lba2msf(u_int32_t lba, u_int8_t *m, u_int8_t *s, u_int8_t *f) -{ - lba += 150; - lba &= 0xffffff; - *m = lba / (60 * 75); - lba %= (60 * 75); - *s = lba / 75; - *f = lba % 75; -} - -static u_int32_t -msf2lba(u_int8_t m, u_int8_t s, u_int8_t f) -{ - return (m * 60 + s) * 75 + f - 150; -} - -static void -acd_read_toc(device_t dev) -{ - struct ata_device *atadev = device_get_softc(dev); - struct acd_softc *cdp = device_get_ivars(dev); - struct g_provider *pp; - u_int32_t sizes[2]; - int8_t ccb[16]; - int track, ntracks, len; - - atadev->flags &= ~ATA_D_MEDIA_CHANGED; - bzero(&cdp->toc, sizeof(cdp->toc)); - cdp->disk_size = -1; /* hack for GEOM SOS */ - - if (acd_test_ready(dev)) - return; - - bzero(ccb, sizeof(ccb)); - len = sizeof(struct ioc_toc_header) + sizeof(struct cd_toc_entry); - ccb[0] = ATAPI_READ_TOC; - ccb[7] = len>>8; - ccb[8] = len; - if (ata_atapicmd(dev, ccb, (caddr_t)&cdp->toc, len, - ATA_R_READ | ATA_R_QUIET, 30)) { - bzero(&cdp->toc, sizeof(cdp->toc)); - return; - } - ntracks = cdp->toc.hdr.ending_track - cdp->toc.hdr.starting_track + 1; - if (ntracks <= 0 || ntracks > MAXTRK) { - bzero(&cdp->toc, sizeof(cdp->toc)); - return; - } - - len = sizeof(struct ioc_toc_header)+(ntracks+1)*sizeof(struct cd_toc_entry); - bzero(ccb, sizeof(ccb)); - ccb[0] = ATAPI_READ_TOC; - ccb[7] = len>>8; - ccb[8] = len; - if (ata_atapicmd(dev, ccb, (caddr_t)&cdp->toc, len, - ATA_R_READ | ATA_R_QUIET, 30)) { - bzero(&cdp->toc, sizeof(cdp->toc)); - return; - } - cdp->toc.hdr.len = ntohs(cdp->toc.hdr.len); - - cdp->block_size = (cdp->toc.tab[0].control & 4) ? 2048 : 2352; - acd_set_ioparm(dev); - bzero(ccb, sizeof(ccb)); - ccb[0] = ATAPI_READ_CAPACITY; - if (ata_atapicmd(dev, ccb, (caddr_t)sizes, sizeof(sizes), - ATA_R_READ | ATA_R_QUIET, 30)) { - bzero(&cdp->toc, sizeof(cdp->toc)); - return; - } - cdp->disk_size = ntohl(sizes[0]) + 1; - - for (track = 1; track <= ntracks; track ++) { - if (cdp->pp[track] != NULL) - continue; - pp = g_new_providerf(cdp->gp, "acd%dt%02d", device_get_unit(dev),track); - pp->index = track; - cdp->pp[track] = pp; - g_error_provider(pp, 0); - } - for (; track < MAXTRK; track ++) { - if (cdp->pp[track] == NULL) - continue; - cdp->pp[track]->flags |= G_PF_WITHER; - g_orphan_provider(cdp->pp[track], ENXIO); - cdp->pp[track] = NULL; - } - -#ifdef ACD_DEBUG - if (cdp->disk_size && cdp->toc.hdr.ending_track) { - device_printf(dev, "(%d sectors (%d bytes)), %d tracks ", - cdp->disk_size, cdp->block_size, - cdp->toc.hdr.ending_track-cdp->toc.hdr.starting_track+1); - if (cdp->toc.tab[0].control & 4) - printf("%dMB\n", cdp->disk_size * cdp->block_size / 1048576); - else - printf("%d:%d audio\n", - cdp->disk_size / 75 / 60, cdp->disk_size / 75 % 60); - } -#endif -} - -static int -acd_play(device_t dev, int start, int end) -{ - int8_t ccb[16]; - - bzero(ccb, sizeof(ccb)); - ccb[0] = ATAPI_PLAY_MSF; - lba2msf(start, &ccb[3], &ccb[4], &ccb[5]); - lba2msf(end, &ccb[6], &ccb[7], &ccb[8]); - return ata_atapicmd(dev, ccb, NULL, 0, 0, 10); -} - -static int -acd_setchan(device_t dev, u_int8_t c0, u_int8_t c1, u_int8_t c2, u_int8_t c3) -{ - struct acd_softc *cdp = device_get_ivars(dev); - int error; - - if ((error = acd_mode_sense(dev, ATAPI_CDROM_AUDIO_PAGE, (caddr_t)&cdp->au, - sizeof(cdp->au)))) - return error; - if (cdp->au.page_code != ATAPI_CDROM_AUDIO_PAGE) - return EIO; - cdp->au.data_length = 0; - cdp->au.port[0].channels = c0; - cdp->au.port[1].channels = c1; - cdp->au.port[2].channels = c2; - cdp->au.port[3].channels = c3; - return acd_mode_select(dev, (caddr_t)&cdp->au, sizeof(cdp->au)); -} - -static int -acd_init_writer(device_t dev, int test_write) -{ - int8_t ccb[16]; - - bzero(ccb, sizeof(ccb)); - ccb[0] = ATAPI_REZERO; - ata_atapicmd(dev, ccb, NULL, 0, ATA_R_QUIET, 60); - ccb[0] = ATAPI_SEND_OPC_INFO; - ccb[1] = 0x01; - ata_atapicmd(dev, ccb, NULL, 0, ATA_R_QUIET, 30); - return 0; -} - -static int -acd_fixate(device_t dev, int multisession) -{ - struct acd_softc *cdp = device_get_ivars(dev); - int8_t ccb[16] = { ATAPI_CLOSE_TRACK, 0x01, 0x02, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0 }; - int timeout = 5*60*2; - int error, dummy; - struct write_param param; - - if ((error = acd_mode_sense(dev, ATAPI_CDROM_WRITE_PARAMETERS_PAGE, - (caddr_t)¶m, sizeof(param)))) - return error; - - param.data_length = 0; - if (multisession) - param.session_type = CDR_SESS_MULTI; - else - param.session_type = CDR_SESS_NONE; - - if ((error = acd_mode_select(dev, (caddr_t)¶m, param.page_length + 10))) - return error; - - error = ata_atapicmd(dev, ccb, NULL, 0, 0, 30); - if (error) - return error; - - /* some drives just return ready, wait for the expected fixate time */ - if ((error = acd_test_ready(dev)) != EBUSY) { - timeout = timeout / (cdp->cap.cur_write_speed / 177); - pause("acdfix", timeout * hz / 2); - return acd_test_ready(dev); - } - - while (timeout-- > 0) { - if ((error = acd_get_progress(dev, &dummy))) - return error; - if ((error = acd_test_ready(dev)) != EBUSY) - return error; - pause("acdcld", hz / 2); - } - return EIO; -} - -static int -acd_init_track(device_t dev, struct cdr_track *track) -{ - struct acd_softc *cdp = device_get_ivars(dev); - struct write_param param; - int error; - - if ((error = acd_mode_sense(dev, ATAPI_CDROM_WRITE_PARAMETERS_PAGE, - (caddr_t)¶m, sizeof(param)))) - return error; - - param.data_length = 0; - param.page_code = ATAPI_CDROM_WRITE_PARAMETERS_PAGE; - param.page_length = 0x32; - param.test_write = track->test_write ? 1 : 0; - param.write_type = CDR_WTYPE_TRACK; - param.session_type = CDR_SESS_NONE; - param.fp = 0; - param.packet_size = 0; - - if (cdp->cap.capabilities & MST_BURNPROOF) - param.burnproof = 1; - - switch (track->datablock_type) { - - case CDR_DB_RAW: - if (track->preemp) - param.track_mode = CDR_TMODE_AUDIO_PREEMP; - else - param.track_mode = CDR_TMODE_AUDIO; - cdp->block_size = 2352; - param.datablock_type = CDR_DB_RAW; - param.session_format = CDR_SESS_CDROM; - break; - - case CDR_DB_ROM_MODE1: - cdp->block_size = 2048; - param.track_mode = CDR_TMODE_DATA; - param.datablock_type = CDR_DB_ROM_MODE1; - param.session_format = CDR_SESS_CDROM; - break; - - case CDR_DB_ROM_MODE2: - cdp->block_size = 2336; - param.track_mode = CDR_TMODE_DATA; - param.datablock_type = CDR_DB_ROM_MODE2; - param.session_format = CDR_SESS_CDROM; - break; - - case CDR_DB_XA_MODE1: - cdp->block_size = 2048; - param.track_mode = CDR_TMODE_DATA; - param.datablock_type = CDR_DB_XA_MODE1; - param.session_format = CDR_SESS_CDROM_XA; - break; - - case CDR_DB_XA_MODE2_F1: - cdp->block_size = 2056; - param.track_mode = CDR_TMODE_DATA; - param.datablock_type = CDR_DB_XA_MODE2_F1; - param.session_format = CDR_SESS_CDROM_XA; - break; - - case CDR_DB_XA_MODE2_F2: - cdp->block_size = 2324; - param.track_mode = CDR_TMODE_DATA; - param.datablock_type = CDR_DB_XA_MODE2_F2; - param.session_format = CDR_SESS_CDROM_XA; - break; - - case CDR_DB_XA_MODE2_MIX: - cdp->block_size = 2332; - param.track_mode = CDR_TMODE_DATA; - param.datablock_type = CDR_DB_XA_MODE2_MIX; - param.session_format = CDR_SESS_CDROM_XA; - break; - } - acd_set_ioparm(dev); - return acd_mode_select(dev, (caddr_t)¶m, param.page_length + 10); -} - -static int -acd_flush(device_t dev) -{ - int8_t ccb[16] = { ATAPI_SYNCHRONIZE_CACHE, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0 }; - - return ata_atapicmd(dev, ccb, NULL, 0, ATA_R_QUIET, 60); -} - -static int -acd_read_track_info(device_t dev, int32_t lba, struct acd_track_info *info) -{ - int8_t ccb[16] = { ATAPI_READ_TRACK_INFO, 1, - lba>>24, lba>>16, lba>>8, lba, 0, - sizeof(*info)>>8, sizeof(*info), - 0, 0, 0, 0, 0, 0, 0 }; - int error; - - if ((error = ata_atapicmd(dev, ccb, (caddr_t)info, sizeof(*info), - ATA_R_READ, 30))) - return error; - info->data_length = ntohs(info->data_length); - info->track_start_addr = ntohl(info->track_start_addr); - info->next_writeable_addr = ntohl(info->next_writeable_addr); - info->free_blocks = ntohl(info->free_blocks); - info->fixed_packet_size = ntohl(info->fixed_packet_size); - info->track_length = ntohl(info->track_length); - return 0; -} - -static int -acd_get_progress(device_t dev, int *finished) -{ - int8_t ccb[16] = { ATAPI_READ_CAPACITY, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0 }; - struct ata_request *request; - int8_t dummy[8]; - - if (!(request = ata_alloc_request())) - return ENOMEM; - - request->dev = dev; - bcopy(ccb, request->u.atapi.ccb, 16); - request->data = dummy; - request->bytecount = sizeof(dummy); - request->transfersize = min(request->bytecount, 65534); - request->flags = ATA_R_ATAPI | ATA_R_READ; - request->timeout = 30; - ata_queue_request(request); - if (!request->error && - request->u.atapi.sense.specific & ATA_SENSE_SPEC_VALID) - *finished = ((request->u.atapi.sense.specific2 | - (request->u.atapi.sense.specific1 << 8)) * 100) / 65535; - else - *finished = 0; - ata_free_request(request); - return 0; -} - -static int -acd_send_cue(device_t dev, struct cdr_cuesheet *cuesheet) -{ - struct acd_softc *cdp = device_get_ivars(dev); - struct write_param param; - int8_t ccb[16] = { ATAPI_SEND_CUE_SHEET, 0, 0, 0, 0, 0, - cuesheet->len>>16, cuesheet->len>>8, cuesheet->len, - 0, 0, 0, 0, 0, 0, 0 }; - int8_t *buffer; - int32_t error; - - if ((error = acd_mode_sense(dev, ATAPI_CDROM_WRITE_PARAMETERS_PAGE, - (caddr_t)¶m, sizeof(param)))) - return error; - - param.data_length = 0; - param.page_code = ATAPI_CDROM_WRITE_PARAMETERS_PAGE; - param.page_length = 0x32; - param.test_write = cuesheet->test_write ? 1 : 0; - param.write_type = CDR_WTYPE_SESSION; - param.session_type = cuesheet->session_type; - param.fp = 0; - param.packet_size = 0; - param.track_mode = CDR_TMODE_AUDIO; - param.datablock_type = CDR_DB_RAW; - param.session_format = cuesheet->session_format; - if (cdp->cap.capabilities & MST_BURNPROOF) - param.burnproof = 1; - - if ((error = acd_mode_select(dev, (caddr_t)¶m, param.page_length + 10))) - return error; - - if (!(buffer = malloc(cuesheet->len, M_ACD, M_NOWAIT))) - return ENOMEM; - - if (!(error = copyin(cuesheet->entries, buffer, cuesheet->len))) - error = ata_atapicmd(dev, ccb, buffer, cuesheet->len, 0, 30); - free(buffer, M_ACD); - return error; -} - -static int -acd_report_key(device_t dev, struct dvd_authinfo *ai) -{ - struct dvd_miscauth *d = NULL; - u_int32_t lba = 0; - int16_t length; - int8_t ccb[16]; - int error; - - switch (ai->format) { - case DVD_REPORT_AGID: - case DVD_REPORT_ASF: - case DVD_REPORT_RPC: - length = 8; - break; - case DVD_REPORT_KEY1: - length = 12; - break; - case DVD_REPORT_TITLE_KEY: - length = 12; - lba = ai->lba; - break; - case DVD_REPORT_CHALLENGE: - length = 16; - break; - case DVD_INVALIDATE_AGID: - length = 0; - break; - default: - return EINVAL; - } - - bzero(ccb, sizeof(ccb)); - ccb[0] = ATAPI_REPORT_KEY; - ccb[2] = (lba >> 24) & 0xff; - ccb[3] = (lba >> 16) & 0xff; - ccb[4] = (lba >> 8) & 0xff; - ccb[5] = lba & 0xff; - ccb[8] = (length >> 8) & 0xff; - ccb[9] = length & 0xff; - ccb[10] = (ai->agid << 6) | ai->format; - - if (length) { - if (!(d = malloc(length, M_ACD, M_NOWAIT | M_ZERO))) - return ENOMEM; - d->length = htons(length - 2); - } - - error = ata_atapicmd(dev, ccb, (caddr_t)d, length, - ai->format == DVD_INVALIDATE_AGID ? 0 : ATA_R_READ,10); - if (error) { - if (length) - free(d, M_ACD); - return error; - } - - switch (ai->format) { - case DVD_REPORT_AGID: - ai->agid = d->data[3] >> 6; - break; - - case DVD_REPORT_CHALLENGE: - bcopy(&d->data[0], &ai->keychal[0], 10); - break; - - case DVD_REPORT_KEY1: - bcopy(&d->data[0], &ai->keychal[0], 5); - break; - - case DVD_REPORT_TITLE_KEY: - ai->cpm = (d->data[0] >> 7); - ai->cp_sec = (d->data[0] >> 6) & 0x1; - ai->cgms = (d->data[0] >> 4) & 0x3; - bcopy(&d->data[1], &ai->keychal[0], 5); - break; - - case DVD_REPORT_ASF: - ai->asf = d->data[3] & 1; - break; - - case DVD_REPORT_RPC: - ai->reg_type = (d->data[0] >> 6); - ai->vend_rsts = (d->data[0] >> 3) & 0x7; - ai->user_rsts = d->data[0] & 0x7; - ai->region = d->data[1]; - ai->rpc_scheme = d->data[2]; - break; - - case DVD_INVALIDATE_AGID: - break; - - default: - error = EINVAL; - } - if (length) - free(d, M_ACD); - return error; -} - -static int -acd_send_key(device_t dev, struct dvd_authinfo *ai) -{ - struct dvd_miscauth *d; - int16_t length; - int8_t ccb[16]; - int error; - - switch (ai->format) { - case DVD_SEND_CHALLENGE: - length = 16; - if (!(d = malloc(length, M_ACD, M_NOWAIT | M_ZERO))) - return ENOMEM; - bcopy(ai->keychal, &d->data[0], 10); - break; - - case DVD_SEND_KEY2: - length = 12; - if (!(d = malloc(length, M_ACD, M_NOWAIT | M_ZERO))) - return ENOMEM; - bcopy(&ai->keychal[0], &d->data[0], 5); - break; - - case DVD_SEND_RPC: - length = 8; - if (!(d = malloc(length, M_ACD, M_NOWAIT | M_ZERO))) - return ENOMEM; - d->data[0] = ai->region; - break; - - default: - return EINVAL; - } - - bzero(ccb, sizeof(ccb)); - ccb[0] = ATAPI_SEND_KEY; - ccb[8] = (length >> 8) & 0xff; - ccb[9] = length & 0xff; - ccb[10] = (ai->agid << 6) | ai->format; - d->length = htons(length - 2); - error = ata_atapicmd(dev, ccb, (caddr_t)d, length, 0, 10); - free(d, M_ACD); - return error; -} - -static int -acd_read_structure(device_t dev, struct dvd_struct *s) -{ - struct dvd_miscauth *d; - u_int16_t length; - int8_t ccb[16]; - int error = 0; - - switch(s->format) { - case DVD_STRUCT_PHYSICAL: - length = 21; - break; - - case DVD_STRUCT_COPYRIGHT: - length = 8; - break; - - case DVD_STRUCT_DISCKEY: - length = 2052; - break; - - case DVD_STRUCT_BCA: - length = 192; - break; - - case DVD_STRUCT_MANUFACT: - length = 2052; - break; - - case DVD_STRUCT_DDS: - case DVD_STRUCT_PRERECORDED: - case DVD_STRUCT_UNIQUEID: - case DVD_STRUCT_LIST: - case DVD_STRUCT_CMI: - case DVD_STRUCT_RMD_LAST: - case DVD_STRUCT_RMD_RMA: - case DVD_STRUCT_DCB: - return ENOSYS; - - default: - return EINVAL; - } - - if (!(d = malloc(length, M_ACD, M_NOWAIT | M_ZERO))) - return ENOMEM; - d->length = htons(length - 2); - - bzero(ccb, sizeof(ccb)); - ccb[0] = ATAPI_READ_STRUCTURE; - ccb[6] = s->layer_num; - ccb[7] = s->format; - ccb[8] = (length >> 8) & 0xff; - ccb[9] = length & 0xff; - ccb[10] = s->agid << 6; - error = ata_atapicmd(dev, ccb, (caddr_t)d, length, ATA_R_READ, 30); - if (error) { - free(d, M_ACD); - return error; - } - - switch (s->format) { - case DVD_STRUCT_PHYSICAL: { - struct dvd_layer *layer = (struct dvd_layer *)&s->data[0]; - - layer->book_type = d->data[0] >> 4; - layer->book_version = d->data[0] & 0xf; - layer->disc_size = d->data[1] >> 4; - layer->max_rate = d->data[1] & 0xf; - layer->nlayers = (d->data[2] >> 5) & 3; - layer->track_path = (d->data[2] >> 4) & 1; - layer->layer_type = d->data[2] & 0xf; - layer->linear_density = d->data[3] >> 4; - layer->track_density = d->data[3] & 0xf; - layer->start_sector = d->data[5] << 16 | d->data[6] << 8 | d->data[7]; - layer->end_sector = d->data[9] << 16 | d->data[10] << 8 | d->data[11]; - layer->end_sector_l0 = d->data[13] << 16 | d->data[14] << 8|d->data[15]; - layer->bca = d->data[16] >> 7; - break; - } - - case DVD_STRUCT_COPYRIGHT: - s->cpst = d->data[0]; - s->rmi = d->data[1]; - break; - - case DVD_STRUCT_DISCKEY: - bcopy(&d->data[0], &s->data[0], 2048); - break; - - case DVD_STRUCT_BCA: - s->length = ntohs(d->length); - bcopy(&d->data[0], &s->data[0], s->length); - break; - - case DVD_STRUCT_MANUFACT: - s->length = ntohs(d->length); - bcopy(&d->data[0], &s->data[0], s->length); - break; - - default: - error = EINVAL; - } - free(d, M_ACD); - return error; -} - -static int -acd_tray(device_t dev, int close) -{ - struct ata_device *atadev = device_get_softc(dev); - struct acd_softc *cdp = device_get_ivars(dev); - int error = ENODEV; - - if (cdp->cap.mechanism & MST_EJECT) { - if (close) { - if (!(error = acd_start_stop(dev, 3))) { - acd_read_toc(dev); - acd_prevent_allow(dev, 1); - cdp->flags |= F_LOCKED; - } - } - else { - acd_start_stop(dev, 0); - acd_prevent_allow(dev, 0); - cdp->flags &= ~F_LOCKED; - atadev->flags |= ATA_D_MEDIA_CHANGED; - error = acd_start_stop(dev, 2); - } - } - return error; -} - -static int -acd_blank(device_t dev, int blanktype) -{ - struct ata_device *atadev = device_get_softc(dev); - int8_t ccb[16] = { ATAPI_BLANK, 0x10 | (blanktype & 0x7), 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0 }; - - atadev->flags |= ATA_D_MEDIA_CHANGED; - return ata_atapicmd(dev, ccb, NULL, 0, 0, 30); -} - -static int -acd_prevent_allow(device_t dev, int lock) -{ - int8_t ccb[16] = { ATAPI_PREVENT_ALLOW, 0, 0, 0, lock, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - - return ata_atapicmd(dev, ccb, NULL, 0, 0, 30); -} - -static int -acd_start_stop(device_t dev, int start) -{ - int8_t ccb[16] = { ATAPI_START_STOP, 0, 0, 0, start, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - - return ata_atapicmd(dev, ccb, NULL, 0, 0, 30); -} - -static int -acd_pause_resume(device_t dev, int pause) -{ - int8_t ccb[16] = { ATAPI_PAUSE, 0, 0, 0, 0, 0, 0, 0, pause, - 0, 0, 0, 0, 0, 0, 0 }; - - return ata_atapicmd(dev, ccb, NULL, 0, 0, 30); -} - -static int -acd_mode_sense(device_t dev, int page, caddr_t pagebuf, int pagesize) -{ - int8_t ccb[16] = { ATAPI_MODE_SENSE_BIG, 0, page, 0, 0, 0, 0, - pagesize>>8, pagesize, 0, 0, 0, 0, 0, 0, 0 }; - int error; - - error = ata_atapicmd(dev, ccb, pagebuf, pagesize, ATA_R_READ, 10); - return error; -} - -static int -acd_mode_select(device_t dev, caddr_t pagebuf, int pagesize) -{ - int8_t ccb[16] = { ATAPI_MODE_SELECT_BIG, 0x10, 0, 0, 0, 0, 0, - pagesize>>8, pagesize, 0, 0, 0, 0, 0, 0, 0 }; - - return ata_atapicmd(dev, ccb, pagebuf, pagesize, 0, 30); -} - -static int -acd_set_speed(device_t dev, int rdspeed, int wrspeed) -{ - int8_t ccb[16] = { ATAPI_SET_SPEED, 0, rdspeed >> 8, rdspeed, - wrspeed >> 8, wrspeed, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - int error; - - error = ata_atapicmd(dev, ccb, NULL, 0, 0, 30); - if (!error) - acd_get_cap(dev); - return error; -} - -static void -acd_get_cap(device_t dev) -{ - struct acd_softc *cdp = device_get_ivars(dev); - int8_t ccb[16] = { ATAPI_MODE_SENSE_BIG, 0, ATAPI_CDROM_CAP_PAGE, - 0, 0, 0, 0, sizeof(cdp->cap)>>8, sizeof(cdp->cap), - 0, 0, 0, 0, 0, 0, 0 }; - int count; - - /* get drive capabilities, some bugridden drives needs this repeated */ - for (count = 0 ; count < 5 ; count++) { - if (!ata_atapicmd(dev, ccb, (caddr_t)&cdp->cap, sizeof(cdp->cap), - ATA_R_READ | ATA_R_QUIET, 5)) { - cdp->cap.data_length = ntohs(cdp->cap.data_length); - cdp->cap.blk_desc_len = ntohs(cdp->cap.blk_desc_len); - cdp->cap.media = ntohs(cdp->cap.media); - cdp->cap.capabilities = ntohs(cdp->cap.capabilities); - cdp->cap.max_read_speed = ntohs(cdp->cap.max_read_speed); - cdp->cap.max_vol_levels = ntohs(cdp->cap.max_vol_levels); - cdp->cap.buf_size = ntohs(cdp->cap.buf_size); - cdp->cap.cur_read_speed = ntohs(cdp->cap.cur_read_speed); - cdp->cap.max_write_speed = ntohs(cdp->cap.max_write_speed); - cdp->cap.cur_write_speed = max(ntohs(cdp->cap.cur_write_speed),177); - cdp->cap.copy_protect_rev = ntohs(cdp->cap.copy_protect_rev); - } - } -} - -static int -acd_read_format_caps(device_t dev, struct cdr_format_capacities *caps) -{ - int8_t ccb[16] = { ATAPI_READ_FORMAT_CAPACITIES, 0, 0, 0, 0, 0, 0, - (sizeof(struct cdr_format_capacities) >> 8) & 0xff, - sizeof(struct cdr_format_capacities) & 0xff, - 0, 0, 0, 0, 0, 0, 0 }; - - return ata_atapicmd(dev, ccb, (caddr_t)caps, - sizeof(struct cdr_format_capacities), ATA_R_READ, 30); -} - -static int -acd_format(device_t dev, struct cdr_format_params* params) -{ - int8_t ccb[16] = { ATAPI_FORMAT, 0x11, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0 }; - int error; - - error = ata_atapicmd(dev, ccb, (u_int8_t *)params, - sizeof(struct cdr_format_params), 0, 30); - return error; -} - -static int -acd_test_ready(device_t dev) -{ - int8_t ccb[16] = { ATAPI_TEST_UNIT_READY, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - - return ata_atapicmd(dev, ccb, NULL, 0, 0, 30); -} - -static void -acd_describe(device_t dev) -{ - struct ata_channel *ch = device_get_softc(device_get_parent(dev)); - struct ata_device *atadev = device_get_softc(dev); - struct acd_softc *cdp = device_get_ivars(dev); - int comma = 0; - char *mechanism; - - if (bootverbose) { - device_printf(dev, "<%.40s/%.8s> %s drive at ata%d as %s\n", - atadev->param.model, atadev->param.revision, - (cdp->cap.media & MST_WRITE_DVDR) ? "DVDR" : - (cdp->cap.media & MST_WRITE_DVDRAM) ? "DVDRAM" : - (cdp->cap.media & MST_WRITE_CDRW) ? "CDRW" : - (cdp->cap.media & MST_WRITE_CDR) ? "CDR" : - (cdp->cap.media & MST_READ_DVDROM) ? "DVDROM":"CDROM", - device_get_unit(ch->dev), ata_unit2str(atadev)); - - device_printf(dev, "%s", ""); - if (cdp->cap.cur_read_speed) { - printf("read %dKB/s", cdp->cap.cur_read_speed * 1000 / 1024); - if (cdp->cap.max_read_speed) - printf(" (%dKB/s)", cdp->cap.max_read_speed * 1000 / 1024); - if ((cdp->cap.cur_write_speed) && - (cdp->cap.media & (MST_WRITE_CDR | MST_WRITE_CDRW | - MST_WRITE_DVDR | MST_WRITE_DVDRAM))) { - printf(" write %dKB/s", cdp->cap.cur_write_speed * 1000 / 1024); - if (cdp->cap.max_write_speed) - printf(" (%dKB/s)", cdp->cap.max_write_speed * 1000 / 1024); - } - comma = 1; - } - if (cdp->cap.buf_size) { - printf("%s %dKB buffer", comma ? "," : "", cdp->cap.buf_size); - comma = 1; - } - printf("%s %s %s\n", comma ? "," : "", ata_mode2str(atadev->mode), - ata_satarev2str(ATA_GETREV(device_get_parent(dev), atadev->unit))); - - device_printf(dev, "Reads:"); - comma = 0; - if (cdp->cap.media & MST_READ_CDR) { - printf(" CDR"); comma = 1; - } - if (cdp->cap.media & MST_READ_CDRW) { - printf("%s CDRW", comma ? "," : ""); comma = 1; - } - if (cdp->cap.capabilities & MST_READ_CDDA) { - if (cdp->cap.capabilities & MST_CDDA_STREAM) - printf("%s CDDA stream", comma ? "," : ""); - else - printf("%s CDDA", comma ? "," : ""); - comma = 1; - } - if (cdp->cap.media & MST_READ_DVDROM) { - printf("%s DVDROM", comma ? "," : ""); comma = 1; - } - if (cdp->cap.media & MST_READ_DVDR) { - printf("%s DVDR", comma ? "," : ""); comma = 1; - } - if (cdp->cap.media & MST_READ_DVDRAM) { - printf("%s DVDRAM", comma ? "," : ""); comma = 1; - } - if (cdp->cap.media & MST_READ_PACKET) - printf("%s packet", comma ? "," : ""); - - printf("\n"); - device_printf(dev, "Writes:"); - if (cdp->cap.media & (MST_WRITE_CDR | MST_WRITE_CDRW | - MST_WRITE_DVDR | MST_WRITE_DVDRAM)) { - comma = 0; - if (cdp->cap.media & MST_WRITE_CDR) { - printf(" CDR" ); comma = 1; - } - if (cdp->cap.media & MST_WRITE_CDRW) { - printf("%s CDRW", comma ? "," : ""); comma = 1; - } - if (cdp->cap.media & MST_WRITE_DVDR) { - printf("%s DVDR", comma ? "," : ""); comma = 1; - } - if (cdp->cap.media & MST_WRITE_DVDRAM) { - printf("%s DVDRAM", comma ? "," : ""); comma = 1; - } - if (cdp->cap.media & MST_WRITE_TEST) { - printf("%s test write", comma ? "," : ""); comma = 1; - } - if (cdp->cap.capabilities & MST_BURNPROOF) - printf("%s burnproof", comma ? "," : ""); - } - printf("\n"); - if (cdp->cap.capabilities & MST_AUDIO_PLAY) { - device_printf(dev, "Audio: "); - if (cdp->cap.capabilities & MST_AUDIO_PLAY) - printf("play"); - if (cdp->cap.max_vol_levels) - printf(", %d volume levels", cdp->cap.max_vol_levels); - printf("\n"); - } - device_printf(dev, "Mechanism: "); - switch (cdp->cap.mechanism & MST_MECH_MASK) { - case MST_MECH_CADDY: - mechanism = "caddy"; break; - case MST_MECH_TRAY: - mechanism = "tray"; break; - case MST_MECH_POPUP: - mechanism = "popup"; break; - case MST_MECH_CHANGER: - mechanism = "changer"; break; - case MST_MECH_CARTRIDGE: - mechanism = "cartridge"; break; - default: - mechanism = 0; break; - } - if (mechanism) - printf("%s%s", (cdp->cap.mechanism & MST_EJECT) ? - "ejectable " : "", mechanism); - else if (cdp->cap.mechanism & MST_EJECT) - printf("ejectable"); - - if (cdp->cap.mechanism & MST_LOCKABLE) - printf((cdp->cap.mechanism & MST_LOCKED) ? ", locked":", unlocked"); - if (cdp->cap.mechanism & MST_PREVENT) - printf(", lock protected"); - printf("\n"); - - if ((cdp->cap.mechanism & MST_MECH_MASK) != MST_MECH_CHANGER) { - device_printf(dev, "Medium: "); - switch (cdp->cap.medium_type & MST_TYPE_MASK_HIGH) { - case MST_CDROM: - printf("CD-ROM "); break; - case MST_CDR: - printf("CD-R "); break; - case MST_CDRW: - printf("CD-RW "); break; - case MST_DVD: - printf("DVD "); break; - case MST_DOOR_OPEN: - printf("door open"); break; - case MST_NO_DISC: - printf("no/blank disc"); break; - case MST_FMT_ERROR: - printf("medium format error"); break; - } - if ((cdp->cap.medium_type & MST_TYPE_MASK_HIGH)cap.medium_type & MST_TYPE_MASK_LOW) { - case MST_DATA_120: - printf("120mm data disc"); break; - case MST_AUDIO_120: - printf("120mm audio disc"); break; - case MST_COMB_120: - printf("120mm data/audio disc"); break; - case MST_PHOTO_120: - printf("120mm photo disc"); break; - case MST_DATA_80: - printf("80mm data disc"); break; - case MST_AUDIO_80: - printf("80mm audio disc"); break; - case MST_COMB_80: - printf("80mm data/audio disc"); break; - case MST_PHOTO_80: - printf("80mm photo disc"); break; - case MST_FMT_NONE: - switch (cdp->cap.medium_type & MST_TYPE_MASK_HIGH) { - case MST_CDROM: - printf("unknown"); break; - case MST_CDR: - case MST_CDRW: - printf("blank"); break; - } - break; - default: - printf("unknown (0x%x)", cdp->cap.medium_type); break; - } - } - printf("\n"); - } - } - else { - device_printf(dev, "%s ", - (cdp->cap.media & MST_WRITE_DVDR) ? "DVDR" : - (cdp->cap.media & MST_WRITE_DVDRAM) ? "DVDRAM" : - (cdp->cap.media & MST_WRITE_CDRW) ? "CDRW" : - (cdp->cap.media & MST_WRITE_CDR) ? "CDR" : - (cdp->cap.media & MST_READ_DVDROM) ? "DVDROM" : - "CDROM"); - if (cdp->changer_info) - printf("with %d CD changer ", cdp->changer_info->slots); - printf("<%.40s/%.8s> at ata%d-%s %s %s\n", - atadev->param.model, atadev->param.revision, - device_get_unit(ch->dev), ata_unit2str(atadev), - ata_mode2str(atadev->mode), - ata_satarev2str(ATA_GETREV(device_get_parent(dev), atadev->unit))); - } -} - -static device_method_t acd_methods[] = { - /* device interface */ - DEVMETHOD(device_probe, acd_probe), - DEVMETHOD(device_attach, acd_attach), - DEVMETHOD(device_detach, acd_detach), - DEVMETHOD(device_shutdown, acd_shutdown), - - /* ATA methods */ - DEVMETHOD(ata_reinit, acd_reinit), - - DEVMETHOD_END -}; - -static driver_t acd_driver = { - "acd", - acd_methods, - 0, -}; - -static devclass_t acd_devclass; - -static int -acd_modevent(module_t mod, int what, void *arg) -{ - return g_modevent(0, what, &acd_class); -} - -DRIVER_MODULE(acd, ata, acd_driver, acd_devclass, acd_modevent, NULL); -MODULE_VERSION(acd, 1); -MODULE_DEPEND(acd, ata, 1, 1, 1); Property changes on: head/sys/dev/ata/atapi-cd.c ___________________________________________________________________ Deleted: svn:keywords ## -1 +0,0 ## -FreeBSD=%H \ No newline at end of property Index: head/sys/dev/ata/atapi-fd.c =================================================================== --- head/sys/dev/ata/atapi-fd.c (revision 249082) +++ head/sys/dev/ata/atapi-fd.c (nonexistent) @@ -1,440 +0,0 @@ -/*- - * Copyright (c) 1998 - 2008 Søren Schmidt - * 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. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -/* prototypes */ -static disk_open_t afd_open; -static disk_close_t afd_close; -static disk_strategy_t afd_strategy; -static disk_ioctl_t afd_ioctl; -static int afd_sense(device_t); -static void afd_describe(device_t); -static void afd_done(struct ata_request *); -static int afd_prevent_allow(device_t, int); -static int afd_test_ready(device_t); - -/* internal vars */ -static MALLOC_DEFINE(M_AFD, "afd_driver", "ATAPI floppy driver buffers"); - -static int -afd_probe(device_t dev) -{ - struct ata_device *atadev = device_get_softc(dev); - if ((atadev->param.config & ATA_PROTO_ATAPI) && - (atadev->param.config & ATA_ATAPI_TYPE_MASK) == ATA_ATAPI_TYPE_DIRECT) - return 0; - else - return ENXIO; -} - -static int -afd_attach(device_t dev) -{ - struct ata_channel *ch = device_get_softc(device_get_parent(dev)); - struct ata_device *atadev = device_get_softc(dev); - struct afd_softc *fdp; - - if (!(fdp = malloc(sizeof(struct afd_softc), M_AFD, M_NOWAIT | M_ZERO))) { - device_printf(dev, "out of memory\n"); - return ENOMEM; - } - device_set_ivars(dev, fdp); - ata_setmode(dev); - - if (afd_sense(dev)) { - device_set_ivars(dev, NULL); - free(fdp, M_AFD); - return ENXIO; - } - atadev->flags |= ATA_D_MEDIA_CHANGED; - - /* announce we are here */ - afd_describe(dev); - - /* create the disk device */ - fdp->disk = disk_alloc(); - fdp->disk->d_open = afd_open; - fdp->disk->d_close = afd_close; - fdp->disk->d_strategy = afd_strategy; - fdp->disk->d_ioctl = afd_ioctl; - fdp->disk->d_name = "afd"; - fdp->disk->d_drv1 = dev; - fdp->disk->d_maxsize = ch->dma.max_iosize ? ch->dma.max_iosize : DFLTPHYS; - fdp->disk->d_unit = device_get_unit(dev); - disk_create(fdp->disk, DISK_VERSION); - return 0; -} - -static int -afd_detach(device_t dev) -{ - struct afd_softc *fdp = device_get_ivars(dev); - - /* check that we have a valid device to detach */ - if (!device_get_ivars(dev)) - return ENXIO; - - /* detroy disk from the system so we dont get any further requests */ - disk_destroy(fdp->disk); - - /* fail requests on the queue and any thats "in flight" for this device */ - ata_fail_requests(dev); - - /* dont leave anything behind */ - device_set_ivars(dev, NULL); - free(fdp, M_AFD); - return 0; -} - -static int -afd_shutdown(device_t dev) -{ - struct ata_device *atadev = device_get_softc(dev); - - if (atadev->param.support.command2 & ATA_SUPPORT_FLUSHCACHE) - ata_controlcmd(dev, ATA_FLUSHCACHE, 0, 0, 0); - return 0; -} - -static int -afd_reinit(device_t dev) -{ - struct ata_channel *ch = device_get_softc(device_get_parent(dev)); - struct ata_device *atadev = device_get_softc(dev); - - /* if detach pending, return error */ - if (!(ch->devices & (ATA_ATAPI_MASTER << atadev->unit))) - return 1; - - ata_setmode(dev); - return 0; -} - -static int -afd_open(struct disk *dp) -{ - device_t dev = dp->d_drv1; - struct ata_device *atadev = device_get_softc(dev); - struct afd_softc *fdp = device_get_ivars(dev); - - if (!fdp) - return ENXIO; - if (!device_is_attached(dev)) - return EBUSY; - - afd_test_ready(dev); - afd_prevent_allow(dev, 1); - - if (afd_sense(dev)) - device_printf(dev, "sense media type failed\n"); - atadev->flags &= ~ATA_D_MEDIA_CHANGED; - - if (!fdp->mediasize) - return ENXIO; - - fdp->disk->d_sectorsize = fdp->sectorsize; - fdp->disk->d_mediasize = fdp->mediasize; - fdp->disk->d_fwsectors = fdp->sectors; - fdp->disk->d_fwheads = fdp->heads; - return 0; -} - -static int -afd_close(struct disk *dp) -{ - device_t dev = dp->d_drv1; - - afd_prevent_allow(dev, 0); - return 0; -} - -static void -afd_strategy(struct bio *bp) -{ - device_t dev = bp->bio_disk->d_drv1; - struct ata_device *atadev = device_get_softc(dev); - struct afd_softc *fdp = device_get_ivars(dev); - struct ata_request *request; - u_int16_t count; - int8_t ccb[16]; - - /* if it's a null transfer, return immediatly. */ - if (bp->bio_bcount == 0) { - bp->bio_resid = 0; - biodone(bp); - return; - } - - /* should reject all queued entries if media have changed. */ - if (atadev->flags & ATA_D_MEDIA_CHANGED) { - biofinish(bp, NULL, EIO); - return; - } - - count = bp->bio_bcount / fdp->sectorsize; - bp->bio_resid = bp->bio_bcount; - - bzero(ccb, sizeof(ccb)); - - if (bp->bio_cmd == BIO_READ) - ccb[0] = ATAPI_READ_BIG; - else - ccb[0] = ATAPI_WRITE_BIG; - - ccb[2] = bp->bio_pblkno >> 24; - ccb[3] = bp->bio_pblkno >> 16; - ccb[4] = bp->bio_pblkno >> 8; - ccb[5] = bp->bio_pblkno; - ccb[7] = count>>8; - ccb[8] = count; - - if (!(request = ata_alloc_request())) { - biofinish(bp, NULL, ENOMEM); - return; - } - request->dev = dev; - request->bio = bp; - bcopy(ccb, request->u.atapi.ccb, 16); - request->data = bp->bio_data; - request->bytecount = count * fdp->sectorsize; - request->transfersize = min(request->bytecount, 65534); - request->timeout = (ccb[0] == ATAPI_WRITE_BIG) ? 60 : 30; - request->retries = 2; - request->callback = afd_done; - switch (bp->bio_cmd) { - case BIO_READ: - request->flags = (ATA_R_ATAPI | ATA_R_READ); - break; - case BIO_WRITE: - request->flags = (ATA_R_ATAPI | ATA_R_WRITE); - break; - default: - device_printf(dev, "unknown BIO operation\n"); - ata_free_request(request); - biofinish(bp, NULL, EIO); - return; - } - if (atadev->mode >= ATA_DMA) - request->flags |= ATA_R_DMA; - request->flags |= ATA_R_ORDERED; - ata_queue_request(request); -} - -static void -afd_done(struct ata_request *request) -{ - struct bio *bp = request->bio; - - /* finish up transfer */ - if ((bp->bio_error = request->result)) - bp->bio_flags |= BIO_ERROR; - bp->bio_resid = bp->bio_bcount - request->donecount; - biodone(bp); - ata_free_request(request); -} - -static int -afd_ioctl(struct disk *disk, u_long cmd, void *data, int flag,struct thread *td) -{ - return ata_device_ioctl(disk->d_drv1, cmd, data); -} - -static int -afd_sense(device_t dev) -{ - struct ata_device *atadev = device_get_softc(dev); - struct afd_softc *fdp = device_get_ivars(dev); - struct afd_capacity capacity; - struct afd_capacity_big capacity_big; - struct afd_capabilities capabilities; - int8_t ccb1[16] = { ATAPI_READ_CAPACITY, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0 }; - int8_t ccb2[16] = { ATAPI_SERVICE_ACTION_IN, 0x10, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, sizeof(struct afd_capacity_big) & 0xff, 0, 0 }; - int8_t ccb3[16] = { ATAPI_MODE_SENSE_BIG, 0, ATAPI_REWRITEABLE_CAP_PAGE, - 0, 0, 0, 0, sizeof(struct afd_capabilities) >> 8, - sizeof(struct afd_capabilities) & 0xff, - 0, 0, 0, 0, 0, 0, 0 }; - int timeout = 20; - int error, count; - - fdp->mediasize = 0; - - /* wait for device to get ready */ - while ((error = afd_test_ready(dev)) && timeout--) { - DELAY(100000); - } - if (error == EBUSY) - return 1; - - /* The IOMEGA Clik! doesn't support reading the cap page, fake it */ - if (!strncmp(atadev->param.model, "IOMEGA Clik!", 12)) { - fdp->heads = 1; - fdp->sectors = 2; - fdp->mediasize = 39441 * 1024; - fdp->sectorsize = 512; - afd_test_ready(dev); - return 0; - } - - /* get drive capacity */ - if (!ata_atapicmd(dev, ccb1, (caddr_t)&capacity, - sizeof(struct afd_capacity), ATA_R_READ, 30)) { - fdp->heads = 16; - fdp->sectors = 63; - fdp->sectorsize = be32toh(capacity.blocksize); - fdp->mediasize = (u_int64_t)be32toh(capacity.capacity)*fdp->sectorsize; - afd_test_ready(dev); - return 0; - } - - /* get drive capacity big */ - if (!ata_atapicmd(dev, ccb2, (caddr_t)&capacity_big, - sizeof(struct afd_capacity_big), - ATA_R_READ | ATA_R_QUIET, 30)) { - fdp->heads = 16; - fdp->sectors = 63; - fdp->sectorsize = be32toh(capacity_big.blocksize); - fdp->mediasize = be64toh(capacity_big.capacity)*fdp->sectorsize; - afd_test_ready(dev); - return 0; - } - - /* get drive capabilities, some bugridden drives needs this repeated */ - for (count = 0 ; count < 5 ; count++) { - if (!ata_atapicmd(dev, ccb3, (caddr_t)&capabilities, - sizeof(struct afd_capabilities), ATA_R_READ, 30) && - capabilities.page_code == ATAPI_REWRITEABLE_CAP_PAGE) { - fdp->heads = capabilities.heads; - fdp->sectors = capabilities.sectors; - fdp->sectorsize = be16toh(capabilities.sector_size); - fdp->mediasize = be16toh(capabilities.cylinders) * - fdp->heads * fdp->sectors * fdp->sectorsize; - if (!capabilities.medium_type) - fdp->mediasize = 0; - return 0; - } - } - return 1; -} - -static int -afd_prevent_allow(device_t dev, int lock) -{ - struct ata_device *atadev = device_get_softc(dev); - int8_t ccb[16] = { ATAPI_PREVENT_ALLOW, 0, 0, 0, lock, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - - if (!strncmp(atadev->param.model, "IOMEGA Clik!", 12)) - return 0; - return ata_atapicmd(dev, ccb, NULL, 0, 0, 30); -} - -static int -afd_test_ready(device_t dev) -{ - int8_t ccb[16] = { ATAPI_TEST_UNIT_READY, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - - return ata_atapicmd(dev, ccb, NULL, 0, 0, 30); -} - -static void -afd_describe(device_t dev) -{ - struct ata_channel *ch = device_get_softc(device_get_parent(dev)); - struct ata_device *atadev = device_get_softc(dev); - struct afd_softc *fdp = device_get_ivars(dev); - char sizestring[16]; - - if (fdp->mediasize > 1048576 * 5) - sprintf(sizestring, "%juMB", fdp->mediasize / 1048576); - else if (fdp->mediasize) - sprintf(sizestring, "%juKB", fdp->mediasize / 1024); - else - strcpy(sizestring, "(no media)"); - - device_printf(dev, "%s <%.40s %.8s> at ata%d-%s %s %s\n", - sizestring, atadev->param.model, atadev->param.revision, - device_get_unit(ch->dev), ata_unit2str(atadev), - ata_mode2str(atadev->mode), - ata_satarev2str(ATA_GETREV(device_get_parent(dev), atadev->unit))); - if (bootverbose) { - device_printf(dev, "%ju sectors [%juC/%dH/%dS]\n", - fdp->mediasize / fdp->sectorsize, - fdp->mediasize /(fdp->sectorsize*fdp->sectors*fdp->heads), - fdp->heads, fdp->sectors); - } -} - -static device_method_t afd_methods[] = { - /* device interface */ - DEVMETHOD(device_probe, afd_probe), - DEVMETHOD(device_attach, afd_attach), - DEVMETHOD(device_detach, afd_detach), - DEVMETHOD(device_shutdown, afd_shutdown), - - /* ATA methods */ - DEVMETHOD(ata_reinit, afd_reinit), - - DEVMETHOD_END -}; - -static driver_t afd_driver = { - "afd", - afd_methods, - 0, -}; - -static devclass_t afd_devclass; - -DRIVER_MODULE(afd, ata, afd_driver, afd_devclass, NULL, NULL); -MODULE_VERSION(afd, 1); -MODULE_DEPEND(afd, ata, 1, 1, 1); - Property changes on: head/sys/dev/ata/atapi-fd.c ___________________________________________________________________ Deleted: svn:keywords ## -1 +0,0 ## -FreeBSD=%H \ No newline at end of property Index: head/sys/dev/ata/ata-disk.c =================================================================== --- head/sys/dev/ata/ata-disk.c (revision 249082) +++ head/sys/dev/ata/ata-disk.c (nonexistent) @@ -1,607 +0,0 @@ -/*- - * Copyright (c) 1998 - 2008 Søren Schmidt - * 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. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include "opt_ata.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* prototypes */ -static void ad_init(device_t dev); -static int ad_get_geometry(device_t dev); -static void ad_set_geometry(device_t dev); -static void ad_done(struct ata_request *request); -static void ad_describe(device_t dev); -static int ad_version(u_int16_t version); -static disk_strategy_t ad_strategy; -static disk_ioctl_t ad_ioctl; -static dumper_t ad_dump; - -/* - * Most platforms map firmware geom to actual, but some don't. If - * not overridden, default to nothing. - */ -#ifndef ata_disk_firmware_geom_adjust -#define ata_disk_firmware_geom_adjust(disk) -#endif - -/* local vars */ -static MALLOC_DEFINE(M_AD, "ad_driver", "ATA disk driver"); - -static int -ad_probe(device_t dev) -{ - struct ata_device *atadev = device_get_softc(dev); - - if (!(atadev->param.config & ATA_PROTO_ATAPI) || - (atadev->param.config == ATA_CFA_MAGIC1) || - (atadev->param.config == ATA_CFA_MAGIC2) || - (atadev->param.config == ATA_CFA_MAGIC3)) - return 0; - else - return ENXIO; -} - -static int -ad_attach(device_t dev) -{ - struct ata_channel *ch = device_get_softc(device_get_parent(dev)); - struct ata_device *atadev = device_get_softc(dev); - struct ad_softc *adp; - device_t parent; - - /* check that we have a virgin disk to attach */ - if (device_get_ivars(dev)) - return EEXIST; - - if (!(adp = malloc(sizeof(struct ad_softc), M_AD, M_NOWAIT | M_ZERO))) { - device_printf(dev, "out of memory\n"); - return ENOMEM; - } - device_set_ivars(dev, adp); - - /* get device geometry into internal structs */ - if (ad_get_geometry(dev)) - return ENXIO; - - /* set the max size if configured */ - if (ata_setmax) - ad_set_geometry(dev); - - /* init device parameters */ - ad_init(dev); - - /* announce we are here */ - ad_describe(dev); - - /* create the disk device */ - adp->disk = disk_alloc(); - adp->disk->d_strategy = ad_strategy; - adp->disk->d_ioctl = ad_ioctl; - adp->disk->d_dump = ad_dump; - adp->disk->d_name = "ad"; - adp->disk->d_drv1 = dev; - adp->disk->d_maxsize = ch->dma.max_iosize ? ch->dma.max_iosize : DFLTPHYS; - if (atadev->param.support.command2 & ATA_SUPPORT_ADDRESS48) - adp->disk->d_maxsize = min(adp->disk->d_maxsize, 65536 * DEV_BSIZE); - else /* 28bit ATA command limit */ - adp->disk->d_maxsize = min(adp->disk->d_maxsize, 256 * DEV_BSIZE); - adp->disk->d_sectorsize = DEV_BSIZE; - adp->disk->d_mediasize = DEV_BSIZE * (off_t)adp->total_secs; - adp->disk->d_fwsectors = adp->sectors; - adp->disk->d_fwheads = adp->heads; - adp->disk->d_unit = device_get_unit(dev); - if (atadev->param.support.command2 & ATA_SUPPORT_FLUSHCACHE) - adp->disk->d_flags |= DISKFLAG_CANFLUSHCACHE; - if ((atadev->param.support.command2 & ATA_SUPPORT_CFA) || - atadev->param.config == ATA_PROTO_CFA) - adp->disk->d_flags |= DISKFLAG_CANDELETE; - strlcpy(adp->disk->d_ident, atadev->param.serial, - sizeof(adp->disk->d_ident)); - strlcpy(adp->disk->d_descr, atadev->param.model, - sizeof(adp->disk->d_descr)); - parent = device_get_parent(ch->dev); - if (parent != NULL && device_get_parent(parent) != NULL && - (device_get_devclass(parent) == - devclass_find("atapci") || - device_get_devclass(device_get_parent(parent)) == - devclass_find("pci"))) { - adp->disk->d_hba_vendor = pci_get_vendor(parent); - adp->disk->d_hba_device = pci_get_device(parent); - adp->disk->d_hba_subvendor = pci_get_subvendor(parent); - adp->disk->d_hba_subdevice = pci_get_subdevice(parent); - } - ata_disk_firmware_geom_adjust(adp->disk); - disk_create(adp->disk, DISK_VERSION); - device_add_child(dev, "subdisk", device_get_unit(dev)); - bus_generic_attach(dev); - - callout_init(&atadev->spindown_timer, 1); - return 0; -} - -static int -ad_detach(device_t dev) -{ - struct ad_softc *adp = device_get_ivars(dev); - struct ata_device *atadev = device_get_softc(dev); - - /* check that we have a valid disk to detach */ - if (!device_get_ivars(dev)) - return ENXIO; - - /* destroy the power timeout */ - callout_drain(&atadev->spindown_timer); - - /* detach & delete all children */ - device_delete_children(dev); - - /* destroy disk from the system so we don't get any further requests */ - disk_destroy(adp->disk); - - /* fail requests on the queue and any that's "in flight" for this device */ - ata_fail_requests(dev); - - /* don't leave anything behind */ - device_set_ivars(dev, NULL); - free(adp, M_AD); - return 0; -} - -static int -ad_shutdown(device_t dev) -{ - struct ata_device *atadev = device_get_softc(dev); - - if (atadev->param.support.command2 & ATA_SUPPORT_FLUSHCACHE) - ata_controlcmd(dev, ATA_FLUSHCACHE, 0, 0, 0); - return 0; -} - -static int -ad_reinit(device_t dev) -{ - struct ata_channel *ch = device_get_softc(device_get_parent(dev)); - struct ata_device *atadev = device_get_softc(dev); - - /* if detach pending, return error */ - if (!(ch->devices & (ATA_ATA_MASTER << atadev->unit))) - return 1; - - ad_init(dev); - return 0; -} - -static void -ad_power_callback(struct ata_request *request) -{ - device_printf(request->dev, "drive spun down.\n"); - ata_free_request(request); -} - -static void -ad_spindown(void *priv) -{ - device_t dev = priv; - struct ata_device *atadev = device_get_softc(dev); - struct ata_request *request; - - if (!atadev->spindown) - return; - device_printf(dev, "Idle, spin down\n"); - atadev->spindown_state = 1; - if (!(request = ata_alloc_request())) { - device_printf(dev, "FAILURE - out of memory in ad_spindown\n"); - return; - } - request->dev = dev; - request->flags = ATA_R_CONTROL; - request->timeout = ATA_REQUEST_TIMEOUT; - request->retries = 1; - request->callback = ad_power_callback; - request->u.ata.command = ATA_STANDBY_IMMEDIATE; - ata_queue_request(request); -} - - -static void -ad_strategy(struct bio *bp) -{ - device_t dev = bp->bio_disk->d_drv1; - struct ata_device *atadev = device_get_softc(dev); - struct ata_request *request; - - if (atadev->spindown) - callout_reset(&atadev->spindown_timer, hz * atadev->spindown, - ad_spindown, dev); - - if (!(request = ata_alloc_request())) { - device_printf(dev, "FAILURE - out of memory in start\n"); - biofinish(bp, NULL, ENOMEM); - return; - } - - /* setup request */ - request->dev = dev; - request->bio = bp; - request->callback = ad_done; - if (atadev->spindown_state) { - device_printf(dev, "request while spun down, starting.\n"); - atadev->spindown_state = 0; - request->timeout = MAX(ATA_REQUEST_TIMEOUT, 31); - } - else { - request->timeout = ATA_REQUEST_TIMEOUT; - } - request->retries = 2; - request->data = bp->bio_data; - request->bytecount = bp->bio_bcount; - request->u.ata.lba = bp->bio_pblkno; - request->u.ata.count = request->bytecount / DEV_BSIZE; - request->transfersize = min(bp->bio_bcount, atadev->max_iosize); - - switch (bp->bio_cmd) { - case BIO_READ: - request->flags = ATA_R_READ; - if (atadev->mode >= ATA_DMA) { - request->u.ata.command = ATA_READ_DMA; - request->flags |= ATA_R_DMA; - } - else if (request->transfersize > DEV_BSIZE) - request->u.ata.command = ATA_READ_MUL; - else - request->u.ata.command = ATA_READ; - break; - case BIO_WRITE: - request->flags = ATA_R_WRITE; - if (atadev->mode >= ATA_DMA) { - request->u.ata.command = ATA_WRITE_DMA; - request->flags |= ATA_R_DMA; - } - else if (request->transfersize > DEV_BSIZE) - request->u.ata.command = ATA_WRITE_MUL; - else - request->u.ata.command = ATA_WRITE; - break; - case BIO_DELETE: - request->flags = ATA_R_CONTROL; - request->u.ata.command = ATA_CFA_ERASE; - request->transfersize = 0; - request->donecount = bp->bio_bcount; - break; - case BIO_FLUSH: - request->u.ata.lba = 0; - request->u.ata.count = 0; - request->u.ata.feature = 0; - request->bytecount = 0; - request->transfersize = 0; - request->flags = ATA_R_CONTROL; - request->u.ata.command = ATA_FLUSHCACHE; - break; - default: - device_printf(dev, "FAILURE - unknown BIO operation\n"); - ata_free_request(request); - biofinish(bp, NULL, EIO); - return; - } - request->flags |= ATA_R_ORDERED; - ata_queue_request(request); -} - -static void -ad_done(struct ata_request *request) -{ - struct bio *bp = request->bio; - - /* finish up transfer */ - if ((bp->bio_error = request->result)) - bp->bio_flags |= BIO_ERROR; - bp->bio_resid = bp->bio_bcount - request->donecount; - biodone(bp); - ata_free_request(request); -} - -static int -ad_ioctl(struct disk *disk, u_long cmd, void *data, int flag, struct thread *td) -{ - return ata_device_ioctl(disk->d_drv1, cmd, data); -} - -static int -ad_dump(void *arg, void *virtual, vm_offset_t physical, - off_t offset, size_t length) -{ - struct disk *dp = arg; - device_t dev = dp->d_drv1; - struct bio bp; - - /* XXX: Drop pre-dump request queue. Long request queue processing - * causes stack overflow in ATA working in dumping (interruptless) mode. - * Conter-XXX: To make dump coherent we should avoid doing anything - * else while dumping. - */ - ata_drop_requests(dev); - - /* length zero is special and really means flush buffers to media */ - if (!length) { - struct ata_device *atadev = device_get_softc(dev); - int error = 0; - - if (atadev->param.support.command2 & ATA_SUPPORT_FLUSHCACHE) - error = ata_controlcmd(dev, ATA_FLUSHCACHE, 0, 0, 0); - return error; - } - - bzero(&bp, sizeof(struct bio)); - bp.bio_disk = dp; - bp.bio_pblkno = offset / DEV_BSIZE; - bp.bio_bcount = length; - bp.bio_data = virtual; - bp.bio_cmd = BIO_WRITE; - ad_strategy(&bp); - return bp.bio_error; -} - -static void -ad_init(device_t dev) -{ - struct ata_device *atadev = device_get_softc(dev); - - ata_setmode(dev); - - /* enable readahead caching */ - if (atadev->param.support.command1 & ATA_SUPPORT_LOOKAHEAD) - ata_controlcmd(dev, ATA_SETFEATURES, ATA_SF_ENAB_RCACHE, 0, 0); - - /* enable write caching if supported and configured */ - if (atadev->param.support.command1 & ATA_SUPPORT_WRITECACHE) { - if (ata_wc) - ata_controlcmd(dev, ATA_SETFEATURES, ATA_SF_ENAB_WCACHE, 0, 0); - else - ata_controlcmd(dev, ATA_SETFEATURES, ATA_SF_DIS_WCACHE, 0, 0); - } - - /* use multiple sectors/interrupt if device supports it */ - if (ad_version(atadev->param.version_major)) { - int secsperint = max(1, min(atadev->param.sectors_intr & 0xff, 16)); - - if (!ata_controlcmd(dev, ATA_SET_MULTI, 0, 0, secsperint)) - atadev->max_iosize = secsperint * DEV_BSIZE; - else - atadev->max_iosize = DEV_BSIZE; - } - else - atadev->max_iosize = DEV_BSIZE; -} - -static int -ad_get_geometry(device_t dev) -{ - struct ata_device *atadev = device_get_softc(dev); - struct ad_softc *adp = device_get_ivars(dev); - u_int64_t lbasize48; - u_int32_t lbasize; - - if ((atadev->param.atavalid & ATA_FLAG_54_58) && - atadev->param.current_heads && atadev->param.current_sectors) { - adp->heads = atadev->param.current_heads; - adp->sectors = atadev->param.current_sectors; - adp->total_secs = (u_int32_t)atadev->param.current_size_1 | - ((u_int32_t)atadev->param.current_size_2 << 16); - } - else { - adp->heads = atadev->param.heads; - adp->sectors = atadev->param.sectors; - adp->total_secs = atadev->param.cylinders * adp->heads * adp->sectors; - } - lbasize = (u_int32_t)atadev->param.lba_size_1 | - ((u_int32_t)atadev->param.lba_size_2 << 16); - /* This device exists, but has no size. Filter out this bogus device. */ - if (!lbasize && !adp->total_secs) - return ENXIO; - - /* does this device need oldstyle CHS addressing */ - if (!ad_version(atadev->param.version_major) || !lbasize) - atadev->flags |= ATA_D_USE_CHS; - - /* use the 28bit LBA size if valid or bigger than the CHS mapping */ - if (atadev->param.cylinders == 16383 || adp->total_secs < lbasize) - adp->total_secs = lbasize; - - /* use the 48bit LBA size if valid */ - lbasize48 = ((u_int64_t)atadev->param.lba_size48_1) | - ((u_int64_t)atadev->param.lba_size48_2 << 16) | - ((u_int64_t)atadev->param.lba_size48_3 << 32) | - ((u_int64_t)atadev->param.lba_size48_4 << 48); - if ((atadev->param.support.command2 & ATA_SUPPORT_ADDRESS48) && - lbasize48 > ATA_MAX_28BIT_LBA) - adp->total_secs = lbasize48; - return 0; -} - -static void -ad_set_geometry(device_t dev) -{ - struct ad_softc *adp = device_get_ivars(dev); - struct ata_request *request; - - if (1 | bootverbose) - device_printf(dev, "ORG %ju sectors [%juC/%dH/%dS]\n", adp->total_secs, - adp->total_secs / (adp->heads * adp->sectors), - adp->heads, adp->sectors); - - if (!(request = ata_alloc_request())) - return; - - /* get the max native size the device supports */ - request->dev = dev; - request->u.ata.command = ATA_READ_NATIVE_MAX_ADDRESS; - request->u.ata.lba = 0; - request->u.ata.count = 0; - request->u.ata.feature = 0; - request->flags = ATA_R_CONTROL | ATA_R_QUIET; - request->timeout = ATA_REQUEST_TIMEOUT; - request->retries = 0; - ata_queue_request(request); - if (request->status & ATA_S_ERROR) - goto out; - - if (1 | bootverbose) - device_printf(dev, "MAX %ju sectors\n", request->u.ata.lba + 1); - - /* if original size equals max size nothing more todo */ - if (adp->total_secs >= request->u.ata.lba) - goto out; - - /* set the max native size to its max */ - request->dev = dev; - request->u.ata.command = ATA_SET_MAX_ADDRESS; - request->u.ata.count = 1; - request->u.ata.feature = 0; - request->flags = ATA_R_CONTROL; - request->timeout = ATA_REQUEST_TIMEOUT; - request->retries = 0; - ata_queue_request(request); - if (request->status & ATA_S_ERROR) - goto out; - - /* refresh geometry from drive */ - ata_getparam(device_get_softc(dev), 0); - ad_get_geometry(dev); - if (1 | bootverbose) - device_printf(dev, "NEW %ju sectors [%juC/%dH/%dS]\n", adp->total_secs, - adp->total_secs / (adp->heads * adp->sectors), - adp->heads, adp->sectors); -out: - ata_free_request(request); -} - -static void -ad_describe(device_t dev) -{ - struct ata_channel *ch = device_get_softc(device_get_parent(dev)); - struct ata_device *atadev = device_get_softc(dev); - struct ad_softc *adp = device_get_ivars(dev); - u_int8_t *marker, vendor[64], product[64]; - - /* try to separate the ATA model string into vendor and model parts */ - if ((marker = strchr(atadev->param.model, ' ')) || - (marker = strchr(atadev->param.model, '-'))) { - int len = (marker - atadev->param.model); - - strncpy(vendor, atadev->param.model, len); - vendor[len++] = 0; - strcat(vendor, " "); - strncpy(product, atadev->param.model + len, 40 - len); - vendor[40 - len] = 0; - } - else { - if (!strncmp(atadev->param.model, "ST", 2)) - strcpy(vendor, "Seagate "); - else if (!strncmp(atadev->param.model, "HDS", 3)) - strcpy(vendor, "Hitachi "); - else - strcpy(vendor, ""); - strncpy(product, atadev->param.model, 40); - } - - device_printf(dev, "%juMB <%s%s %.8s> at ata%d-%s %s%s %s\n", - adp->total_secs / (1048576 / DEV_BSIZE), - vendor, product, atadev->param.revision, - device_get_unit(ch->dev), ata_unit2str(atadev), - (adp->flags & AD_F_TAG_ENABLED) ? "tagged " : "", - ata_mode2str(atadev->mode), - ata_satarev2str(ATA_GETREV(device_get_parent(dev), atadev->unit))); - if (bootverbose) { - device_printf(dev, "%ju sectors [%juC/%dH/%dS] " - "%d sectors/interrupt %d depth queue\n", adp->total_secs, - adp->total_secs / (adp->heads * adp->sectors), - adp->heads, adp->sectors, atadev->max_iosize / DEV_BSIZE, - adp->num_tags + 1); - } -} - -static int -ad_version(u_int16_t version) -{ - int bit; - - if (version == 0xffff) - return 0; - for (bit = 15; bit >= 0; bit--) - if (version & (1< * 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. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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. */ #include __FBSDID("$FreeBSD$"); #include "opt_ata.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include -#ifdef ATA_CAM #include #include #include #include #include -#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 */ int ata_probe(device_t dev) { return 0; } int 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) return EEXIST; /* initialize the softc basics */ ch->dev = 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); if (resource_int_value(device_get_name(dev), device_get_unit(dev), buf, &mode) != 0 && resource_int_value(device_get_name(dev), device_get_unit(dev), "sata_rev", &mode) != 0) mode = -1; if (mode >= 0) ch->user[i].revision = mode; ch->user[i].mode = 0; snprintf(buf, sizeof(buf), "dev%d.mode", i); if (resource_string_value(device_get_name(dev), device_get_unit(dev), buf, &res) == 0) mode = ata_str2mode(res); else if (resource_string_value(device_get_name(dev), device_get_unit(dev), "mode", &res) == 0) mode = ata_str2mode(res); else mode = -1; if (mode >= 0) ch->user[i].mode = mode; if (ch->flags & ATA_SATA) ch->user[i].bytecount = 8192; else ch->user[i].bytecount = MAXPHYS; ch->user[i].caps = 0; ch->curr[i] = ch->user[i]; if (ch->pm_level > 0) ch->user[i].caps |= CTS_SATA_CAPS_H_PMREQ; if (ch->pm_level > 1) 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) ch->dma.alloc(dev); /* setup interrupt delivery */ rid = ATA_IRQ_RID; ch->r_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, RF_SHAREABLE | RF_ACTIVE); if (!ch->r_irq) { device_printf(dev, "unable to allocate interrupt\n"); return ENXIO; } if ((error = bus_setup_intr(dev, ch->r_irq, ATA_INTR_FLAGS, NULL, ata_interrupt, ch, &ch->ih))) { bus_release_resource(dev, SYS_RES_IRQ, rid, ch->r_irq); device_printf(dev, "unable to setup interrupt\n"); 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); /* Create the device queue for our SIM. */ devq = cam_simq_alloc(1); if (devq == NULL) { device_printf(dev, "Unable to allocate simq\n"); error = ENOMEM; goto err1; } /* Construct SIM entry */ ch->sim = cam_sim_alloc(ataaction, atapoll, "ata", ch, device_get_unit(dev), &ch->state_mtx, 1, 0, devq); if (ch->sim == NULL) { device_printf(dev, "unable to allocate sim\n"); cam_simq_free(devq); error = ENOMEM; goto err1; } if (xpt_bus_register(ch->sim, dev, 0) != CAM_SUCCESS) { device_printf(dev, "unable to register xpt bus\n"); error = ENXIO; goto err2; } if (xpt_create_path(&ch->path, /*periph*/NULL, cam_sim_path(ch->sim), CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD) != CAM_REQ_CMP) { device_printf(dev, "unable to create path\n"); error = ENXIO; goto err3; } mtx_unlock(&ch->state_mtx); return (0); err3: xpt_bus_deregister(cam_sim_path(ch->sim)); err2: cam_sim_free(ch->sim, /*free_devq*/TRUE); ch->sim = NULL; err1: bus_release_resource(dev, SYS_RES_IRQ, rid, ch->r_irq); mtx_unlock(&ch->state_mtx); 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) return ENXIO; /* grap the channel lock so no new requests gets launched */ 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); xpt_bus_deregister(cam_sim_path(ch->sim)); 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); bus_release_resource(dev, SYS_RES_IRQ, ATA_IRQ_RID, ch->r_irq); ch->r_irq = NULL; /* free DMA resources if DMA HW present*/ if (ch->dma.free) ch->dma.free(dev); mtx_destroy(&ch->state_mtx); -#ifndef ATA_CAM - mtx_destroy(&ch->queue_mtx); -#endif return 0; } 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; mtx_lock(&ch->state_mtx); if (ch->sim == NULL) { mtx_unlock(&ch->state_mtx); return; } ata_reinit(dev); if ((ccb = xpt_alloc_ccb_nowait()) == NULL) return; if (xpt_create_path(&ccb->ccb_h.path, NULL, cam_sim_path(ch->sim), CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD) != CAM_REQ_CMP) { xpt_free_ccb(ccb); return; } xpt_rescan(ccb); mtx_unlock(&ch->state_mtx); -#else - ata_reinit(dev); -#endif } int 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; if (ch->state == ATA_ACTIVE) ch->state = ATA_IDLE; callout_stop(&request->callout); if (ch->dma.unload) ch->dma.unload(request); request->result = ERESTART; ata_cam_end_transaction(dev, request); } /* reset the controller HW, the channel and device(s) */ ATA_RESET(dev); /* Tell the XPT about the event */ xpt_async(AC_BUS_RESET, ch->path, NULL); xpt_release_simq(ch->sim, TRUE); -#endif return(0); } int ata_suspend(device_t dev) { struct ata_channel *ch; /* check for valid device */ 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); xpt_freeze_simq(ch->sim, 1); 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); } int ata_resume(device_t dev) { struct ata_channel *ch; int error; /* check for valid device */ 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 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)) break; /* do we have a running request */ if (!(request = ch->running)) break; ATA_DEBUG_RQ(request, "interrupt"); /* safetycheck for the right state */ if (ch->state == ATA_IDLE) { device_printf(request->dev, "interrupt on idle channel ignored\n"); break; } /* * we have the HW locks, so end the transaction for this request * if it finishes immediately otherwise wait for next interrupt */ if (ch->hw.end_transaction(request) == ATA_OP_FINISHED) { 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) { struct ata_channel *ch = (struct ata_channel *)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) { device_printf(dev, "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; - request->u.ata.command = command; - request->flags = (ATA_R_READ|ATA_R_AT_HEAD|ATA_R_DIRECT); - if (!bootverbose) - request->flags |= ATA_R_QUIET; - request->data = (void *)&atadev->param; - request->bytecount = sizeof(struct ata_params); - request->donecount = 0; - request->transfersize = DEV_BSIZE; - ata_queue_request(request); - error = request->result; - ata_free_request(request); - } - - if (!error && (isprint(atadev->param.model[0]) || - isprint(atadev->param.model[1]))) { - struct ata_params *atacap = &atadev->param; - int16_t *ptr; - - for (ptr = (int16_t *)atacap; - ptr < (int16_t *)atacap + sizeof(struct ata_params)/2; ptr++) { - *ptr = le16toh(*ptr); - } - if (!(!strncmp(atacap->model, "FX", 2) || - !strncmp(atacap->model, "NEC", 3) || - !strncmp(atacap->model, "Pioneer", 7) || - !strncmp(atacap->model, "SHARP", 5))) { - bswap(atacap->model, sizeof(atacap->model)); - bswap(atacap->revision, sizeof(atacap->revision)); - bswap(atacap->serial, sizeof(atacap->serial)); - } - btrim(atacap->model, sizeof(atacap->model)); - bpack(atacap->model, atacap->model, sizeof(atacap->model)); - btrim(atacap->revision, sizeof(atacap->revision)); - bpack(atacap->revision, atacap->revision, sizeof(atacap->revision)); - btrim(atacap->serial, sizeof(atacap->serial)); - bpack(atacap->serial, atacap->serial, sizeof(atacap->serial)); - - if (bootverbose) - printf("ata%d-%s: pio=%s wdma=%s udma=%s cable=%s wire\n", - device_get_unit(ch->dev), - ata_unit2str(atadev), - ata_mode2str(ata_pmode(atacap)), - ata_mode2str(ata_wmode(atacap)), - ata_mode2str(ata_umode(atacap)), - (atacap->hwres & ATA_CABLE_ID) ? "80":"40"); - - if (init) { - char buffer[64]; - - sprintf(buffer, "%.40s/%.8s", atacap->model, atacap->revision); - device_set_desc_copy(atadev->dev, buffer); - if ((atadev->param.config & ATA_PROTO_ATAPI) && - (atadev->param.config != ATA_CFA_MAGIC1) && - (atadev->param.config != ATA_CFA_MAGIC2)) { - if (atapi_dma && - (atadev->param.config & ATA_DRQ_MASK) != ATA_DRQ_INTR && - ata_umode(&atadev->param) >= ATA_UDMA2) - atadev->mode = ATA_DMA_MAX; - } - else { - if (ata_dma && - (ata_umode(&atadev->param) > 0 || - ata_wmode(&atadev->param) > 0)) - atadev->mode = ATA_DMA_MAX; - } - snprintf(buf, sizeof(buf), "dev%d.mode", atadev->unit); - if (resource_string_value(device_get_name(ch->dev), - device_get_unit(ch->dev), buf, &res) == 0) - mode = ata_str2mode(res); - else if (resource_string_value(device_get_name(ch->dev), - device_get_unit(ch->dev), "mode", &res) == 0) - mode = ata_str2mode(res); - if (mode >= 0) - atadev->mode = mode; - } - } - else { - if (!error) - error = ENXIO; - } - return error; -} -#endif - -#ifndef ATA_CAM -int -ata_identify(device_t dev) -{ - struct ata_channel *ch = device_get_softc(dev); - struct ata_device *atadev; - device_t *children; - device_t child, master = NULL; - int nchildren, i, n = ch->devices; - - if (bootverbose) - device_printf(dev, "Identifying devices: %08x\n", ch->devices); - - mtx_lock(&Giant); - /* Skip existing devices. */ - if (!device_get_children(dev, &children, &nchildren)) { - for (i = 0; i < nchildren; i++) { - if (children[i] && (atadev = device_get_softc(children[i]))) - n &= ~((ATA_ATA_MASTER | ATA_ATAPI_MASTER) << atadev->unit); - } - free(children, M_TEMP); - } - /* Create new devices. */ - if (bootverbose) - device_printf(dev, "New devices: %08x\n", n); - if (n == 0) { - mtx_unlock(&Giant); - return (0); - } - for (i = 0; i < ATA_PM; ++i) { - if (n & (((ATA_ATA_MASTER | ATA_ATAPI_MASTER) << i))) { - int unit = -1; - - if (!(atadev = malloc(sizeof(struct ata_device), - M_ATA, M_NOWAIT | M_ZERO))) { - device_printf(dev, "out of memory\n"); - return ENOMEM; - } - atadev->unit = i; -#ifdef ATA_STATIC_ID - if (n & (ATA_ATA_MASTER << i)) - unit = (device_get_unit(dev) << 1) + i; -#endif - if ((child = ata_add_child(dev, atadev, unit))) { - /* - * PATA slave should be identified first, to allow - * device cable detection on master to work properly. - */ - if (i == 0 && (n & ATA_PORTMULTIPLIER) == 0 && - (n & ((ATA_ATA_MASTER | ATA_ATAPI_MASTER) << 1)) != 0) { - master = child; - continue; - } - if (ata_getparam(atadev, 1)) { - device_delete_child(dev, child); - free(atadev, M_ATA); - } - } - else - free(atadev, M_ATA); - } - } - if (master) { - atadev = device_get_softc(master); - if (ata_getparam(atadev, 1)) { - device_delete_child(dev, master); - free(atadev, M_ATA); - } - } - bus_generic_probe(dev); - bus_generic_attach(dev); - mtx_unlock(&Giant); - return 0; -} -#endif - void ata_default_registers(device_t dev) { struct ata_channel *ch = device_get_softc(dev); /* fill in the defaults from whats setup already */ ch->r_io[ATA_ERROR].res = ch->r_io[ATA_FEATURE].res; ch->r_io[ATA_ERROR].offset = ch->r_io[ATA_FEATURE].offset; ch->r_io[ATA_IREASON].res = ch->r_io[ATA_COUNT].res; ch->r_io[ATA_IREASON].offset = ch->r_io[ATA_COUNT].offset; ch->r_io[ATA_STATUS].res = ch->r_io[ATA_COMMAND].res; ch->r_io[ATA_STATUS].offset = ch->r_io[ATA_COMMAND].offset; ch->r_io[ATA_ALTSTAT].res = ch->r_io[ATA_CONTROL].res; ch->r_io[ATA_ALTSTAT].offset = ch->r_io[ATA_CONTROL].offset; } -#ifndef ATA_CAM void -ata_modify_if_48bit(struct ata_request *request) -{ - struct ata_channel *ch = device_get_softc(request->parent); - struct ata_device *atadev = device_get_softc(request->dev); - - request->flags &= ~ATA_R_48BIT; - - if (((request->u.ata.lba + request->u.ata.count) >= ATA_MAX_28BIT_LBA || - request->u.ata.count > 256) && - atadev->param.support.command2 & ATA_SUPPORT_ADDRESS48) { - - /* translate command into 48bit version */ - switch (request->u.ata.command) { - case ATA_READ: - request->u.ata.command = ATA_READ48; - break; - case ATA_READ_MUL: - request->u.ata.command = ATA_READ_MUL48; - break; - case ATA_READ_DMA: - if (ch->flags & ATA_NO_48BIT_DMA) { - if (request->transfersize > DEV_BSIZE) - request->u.ata.command = ATA_READ_MUL48; - else - request->u.ata.command = ATA_READ48; - request->flags &= ~ATA_R_DMA; - } - else - request->u.ata.command = ATA_READ_DMA48; - break; - case ATA_READ_DMA_QUEUED: - if (ch->flags & ATA_NO_48BIT_DMA) { - if (request->transfersize > DEV_BSIZE) - request->u.ata.command = ATA_READ_MUL48; - else - request->u.ata.command = ATA_READ48; - request->flags &= ~ATA_R_DMA; - } - else - request->u.ata.command = ATA_READ_DMA_QUEUED48; - break; - case ATA_WRITE: - request->u.ata.command = ATA_WRITE48; - break; - case ATA_WRITE_MUL: - request->u.ata.command = ATA_WRITE_MUL48; - break; - case ATA_WRITE_DMA: - if (ch->flags & ATA_NO_48BIT_DMA) { - if (request->transfersize > DEV_BSIZE) - request->u.ata.command = ATA_WRITE_MUL48; - else - request->u.ata.command = ATA_WRITE48; - request->flags &= ~ATA_R_DMA; - } - else - request->u.ata.command = ATA_WRITE_DMA48; - break; - case ATA_WRITE_DMA_QUEUED: - if (ch->flags & ATA_NO_48BIT_DMA) { - if (request->transfersize > DEV_BSIZE) - request->u.ata.command = ATA_WRITE_MUL48; - else - request->u.ata.command = ATA_WRITE48; - request->u.ata.command = ATA_WRITE48; - request->flags &= ~ATA_R_DMA; - } - else - request->u.ata.command = ATA_WRITE_DMA_QUEUED48; - break; - case ATA_FLUSHCACHE: - request->u.ata.command = ATA_FLUSHCACHE48; - break; - case ATA_SET_MAX_ADDRESS: - request->u.ata.command = ATA_SET_MAX_ADDRESS48; - break; - default: - return; - } - request->flags |= ATA_R_48BIT; - } - else if (atadev->param.support.command2 & ATA_SUPPORT_ADDRESS48) { - - /* translate command into 48bit version */ - switch (request->u.ata.command) { - case ATA_FLUSHCACHE: - request->u.ata.command = ATA_FLUSHCACHE48; - break; - case ATA_READ_NATIVE_MAX_ADDRESS: - request->u.ata.command = ATA_READ_NATIVE_MAX_ADDRESS48; - break; - case ATA_SET_MAX_ADDRESS: - request->u.ata.command = ATA_SET_MAX_ADDRESS48; - break; - default: - return; - } - request->flags |= ATA_R_48BIT; - } -} -#endif - -void ata_udelay(int interval) { /* for now just use DELAY, the timer/sleep subsytems are not there yet */ if (1 || interval < (1000000/hz) || ata_delayed_attach) DELAY(interval); else pause("ataslp", interval/(1000000/hz)); } -#ifndef ATA_CAM const char * -ata_unit2str(struct ata_device *atadev) -{ - struct ata_channel *ch = device_get_softc(device_get_parent(atadev->dev)); - static char str[8]; - - if (ch->devices & ATA_PORTMULTIPLIER) - sprintf(str, "port%d", atadev->unit); - else - sprintf(str, "%s", atadev->unit == ATA_MASTER ? "master" : "slave"); - return str; -} -#endif - -const char * ata_mode2str(int mode) { switch (mode) { case -1: return "UNSUPPORTED"; case ATA_PIO0: return "PIO0"; case ATA_PIO1: return "PIO1"; case ATA_PIO2: return "PIO2"; case ATA_PIO3: return "PIO3"; case ATA_PIO4: return "PIO4"; case ATA_WDMA0: return "WDMA0"; case ATA_WDMA1: return "WDMA1"; case ATA_WDMA2: return "WDMA2"; case ATA_UDMA0: return "UDMA16"; case ATA_UDMA1: return "UDMA25"; case ATA_UDMA2: return "UDMA33"; case ATA_UDMA3: return "UDMA40"; case ATA_UDMA4: return "UDMA66"; case ATA_UDMA5: return "UDMA100"; case ATA_UDMA6: return "UDMA133"; case ATA_SA150: return "SATA150"; case ATA_SA300: return "SATA300"; default: if (mode & ATA_DMA_MASK) return "BIOSDMA"; else return "BIOSPIO"; } } int ata_str2mode(const char *str) { if (!strcasecmp(str, "PIO0")) return (ATA_PIO0); if (!strcasecmp(str, "PIO1")) return (ATA_PIO1); if (!strcasecmp(str, "PIO2")) return (ATA_PIO2); if (!strcasecmp(str, "PIO3")) return (ATA_PIO3); if (!strcasecmp(str, "PIO4")) return (ATA_PIO4); if (!strcasecmp(str, "WDMA0")) return (ATA_WDMA0); if (!strcasecmp(str, "WDMA1")) return (ATA_WDMA1); if (!strcasecmp(str, "WDMA2")) return (ATA_WDMA2); if (!strcasecmp(str, "UDMA0")) return (ATA_UDMA0); if (!strcasecmp(str, "UDMA16")) return (ATA_UDMA0); if (!strcasecmp(str, "UDMA1")) return (ATA_UDMA1); if (!strcasecmp(str, "UDMA25")) return (ATA_UDMA1); if (!strcasecmp(str, "UDMA2")) return (ATA_UDMA2); if (!strcasecmp(str, "UDMA33")) return (ATA_UDMA2); if (!strcasecmp(str, "UDMA3")) return (ATA_UDMA3); if (!strcasecmp(str, "UDMA44")) return (ATA_UDMA3); if (!strcasecmp(str, "UDMA4")) return (ATA_UDMA4); if (!strcasecmp(str, "UDMA66")) return (ATA_UDMA4); if (!strcasecmp(str, "UDMA5")) return (ATA_UDMA5); if (!strcasecmp(str, "UDMA100")) return (ATA_UDMA5); if (!strcasecmp(str, "UDMA6")) return (ATA_UDMA6); if (!strcasecmp(str, "UDMA133")) return (ATA_UDMA6); return (-1); } -#ifndef ATA_CAM -const char * -ata_satarev2str(int rev) -{ - switch (rev) { - case 0: return ""; - case 1: return "SATA 1.5Gb/s"; - case 2: return "SATA 3Gb/s"; - case 3: return "SATA 6Gb/s"; - case 0xff: return "SATA"; - default: return "???"; - } -} -#endif - int ata_atapi(device_t dev, int target) { struct ata_channel *ch = device_get_softc(dev); return (ch->devices & (ATA_ATAPI_MASTER << target)); } -#ifndef ATA_CAM -int -ata_pmode(struct ata_params *ap) -{ - if (ap->atavalid & ATA_FLAG_64_70) { - if (ap->apiomodes & 0x02) - return ATA_PIO4; - if (ap->apiomodes & 0x01) - return ATA_PIO3; - } - if (ap->mwdmamodes & 0x04) - return ATA_PIO4; - if (ap->mwdmamodes & 0x02) - return ATA_PIO3; - if (ap->mwdmamodes & 0x01) - return ATA_PIO2; - if ((ap->retired_piomode & ATA_RETIRED_PIO_MASK) == 0x200) - return ATA_PIO2; - if ((ap->retired_piomode & ATA_RETIRED_PIO_MASK) == 0x100) - return ATA_PIO1; - if ((ap->retired_piomode & ATA_RETIRED_PIO_MASK) == 0x000) - return ATA_PIO0; - return ATA_PIO0; -} -#endif - -#ifndef ATA_CAM -int -ata_wmode(struct ata_params *ap) -{ - if (ap->mwdmamodes & 0x04) - return ATA_WDMA2; - if (ap->mwdmamodes & 0x02) - return ATA_WDMA1; - if (ap->mwdmamodes & 0x01) - return ATA_WDMA0; - return -1; -} -#endif - -#ifndef ATA_CAM -int -ata_umode(struct ata_params *ap) -{ - if (ap->atavalid & ATA_FLAG_88) { - if (ap->udmamodes & 0x40) - return ATA_UDMA6; - if (ap->udmamodes & 0x20) - return ATA_UDMA5; - if (ap->udmamodes & 0x10) - return ATA_UDMA4; - if (ap->udmamodes & 0x08) - return ATA_UDMA3; - if (ap->udmamodes & 0x04) - return ATA_UDMA2; - if (ap->udmamodes & 0x02) - return ATA_UDMA1; - if (ap->udmamodes & 0x01) - return ATA_UDMA0; - } - return -1; -} -#endif - -#ifndef ATA_CAM -int -ata_limit_mode(device_t dev, int mode, int maxmode) -{ - struct ata_device *atadev = device_get_softc(dev); - - if (maxmode && mode > maxmode) - mode = maxmode; - - if (mode >= ATA_UDMA0 && ata_umode(&atadev->param) > 0) - return min(mode, ata_umode(&atadev->param)); - - if (mode >= ATA_WDMA0 && ata_wmode(&atadev->param) > 0) - return min(mode, ata_wmode(&atadev->param)); - - if (mode > ata_pmode(&atadev->param)) - return min(mode, ata_pmode(&atadev->param)); - - return mode; -} -#endif - -#ifndef ATA_CAM static void -bswap(int8_t *buf, int len) -{ - u_int16_t *ptr = (u_int16_t*)(buf + len); - - while (--ptr >= (u_int16_t*)buf) - *ptr = ntohs(*ptr); -} -#endif - -#ifndef ATA_CAM -static void -btrim(int8_t *buf, int len) -{ - int8_t *ptr; - - for (ptr = buf; ptr < buf+len; ++ptr) - if (!*ptr || *ptr == '_') - *ptr = ' '; - 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) -{ - int i, j, blank; - - for (i = j = blank = 0 ; i < len; i++) { - if (blank && src[i] == ' ') continue; - if (blank && src[i] != ' ') { - dst[j++] = src[i]; - blank = 0; - continue; - } - if (src[i] == ' ') { - blank = 1; - if (i == 0) - continue; - } - dst[j++] = src[i]; - } - if (j < len) - dst[j] = 0x00; -} -#endif - -#ifdef ATA_CAM -static void ata_cam_begin_transaction(device_t dev, union ccb *ccb) { struct ata_channel *ch = device_get_softc(dev); struct ata_request *request; if (!(request = ata_alloc_request())) { device_printf(dev, "FAILURE - out of memory in start\n"); ccb->ccb_h.status = CAM_REQ_INVALID; xpt_done(ccb); return; } bzero(request, sizeof(*request)); /* setup request */ request->dev = NULL; request->parent = dev; request->unit = ccb->ccb_h.target_id; if (ccb->ccb_h.func_code == XPT_ATA_IO) { request->data = ccb->ataio.data_ptr; request->bytecount = ccb->ataio.dxfer_len; request->u.ata.command = ccb->ataio.cmd.command; request->u.ata.feature = ((uint16_t)ccb->ataio.cmd.features_exp << 8) | (uint16_t)ccb->ataio.cmd.features; request->u.ata.count = ((uint16_t)ccb->ataio.cmd.sector_count_exp << 8) | (uint16_t)ccb->ataio.cmd.sector_count; if (ccb->ataio.cmd.flags & CAM_ATAIO_48BIT) { request->flags |= ATA_R_48BIT; request->u.ata.lba = ((uint64_t)ccb->ataio.cmd.lba_high_exp << 40) | ((uint64_t)ccb->ataio.cmd.lba_mid_exp << 32) | ((uint64_t)ccb->ataio.cmd.lba_low_exp << 24); } else { request->u.ata.lba = ((uint64_t)(ccb->ataio.cmd.device & 0x0f) << 24); } request->u.ata.lba |= ((uint64_t)ccb->ataio.cmd.lba_high << 16) | ((uint64_t)ccb->ataio.cmd.lba_mid << 8) | (uint64_t)ccb->ataio.cmd.lba_low; if (ccb->ataio.cmd.flags & CAM_ATAIO_NEEDRESULT) request->flags |= ATA_R_NEEDRESULT; if ((ccb->ccb_h.flags & CAM_DIR_MASK) != CAM_DIR_NONE && ccb->ataio.cmd.flags & CAM_ATAIO_DMA) request->flags |= ATA_R_DMA; if ((ccb->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) request->flags |= ATA_R_READ; if ((ccb->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_OUT) request->flags |= ATA_R_WRITE; if (ccb->ataio.cmd.command == ATA_READ_MUL || ccb->ataio.cmd.command == ATA_READ_MUL48 || ccb->ataio.cmd.command == ATA_WRITE_MUL || ccb->ataio.cmd.command == ATA_WRITE_MUL48) { request->transfersize = min(request->bytecount, ch->curr[ccb->ccb_h.target_id].bytecount); } else request->transfersize = min(request->bytecount, 512); } else { request->data = ccb->csio.data_ptr; request->bytecount = ccb->csio.dxfer_len; bcopy((ccb->ccb_h.flags & CAM_CDB_POINTER) ? ccb->csio.cdb_io.cdb_ptr : ccb->csio.cdb_io.cdb_bytes, request->u.atapi.ccb, ccb->csio.cdb_len); request->flags |= ATA_R_ATAPI; if (ch->curr[ccb->ccb_h.target_id].atapi == 16) request->flags |= ATA_R_ATAPI16; if ((ccb->ccb_h.flags & CAM_DIR_MASK) != CAM_DIR_NONE && ch->curr[ccb->ccb_h.target_id].mode >= ATA_DMA) request->flags |= ATA_R_DMA; if ((ccb->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) request->flags |= ATA_R_READ; if ((ccb->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_OUT) request->flags |= ATA_R_WRITE; request->transfersize = min(request->bytecount, ch->curr[ccb->ccb_h.target_id].bytecount); } request->retries = 0; request->timeout = (ccb->ccb_h.timeout + 999) / 1000; callout_init_mtx(&request->callout, &ch->state_mtx, CALLOUT_RETURNUNLOCKED); request->ccb = ccb; request->flags |= ATA_R_DATA_IN_CCB; ch->running = request; ch->state = ATA_ACTIVE; if (ch->hw.begin_transaction(request) == ATA_OP_FINISHED) { ch->running = NULL; ch->state = ATA_IDLE; ata_cam_end_transaction(dev, request); return; } } static void ata_cam_request_sense(device_t dev, struct ata_request *request) { struct ata_channel *ch = device_get_softc(dev); union ccb *ccb = request->ccb; ch->requestsense = 1; bzero(request, sizeof(*request)); request->dev = NULL; request->parent = dev; request->unit = ccb->ccb_h.target_id; request->data = (void *)&ccb->csio.sense_data; request->bytecount = ccb->csio.sense_len; request->u.atapi.ccb[0] = ATAPI_REQUEST_SENSE; request->u.atapi.ccb[4] = ccb->csio.sense_len; request->flags |= ATA_R_ATAPI; if (ch->curr[ccb->ccb_h.target_id].atapi == 16) request->flags |= ATA_R_ATAPI16; if (ch->curr[ccb->ccb_h.target_id].mode >= ATA_DMA) request->flags |= ATA_R_DMA; request->flags |= ATA_R_READ; request->transfersize = min(request->bytecount, ch->curr[ccb->ccb_h.target_id].bytecount); request->retries = 0; request->timeout = (ccb->ccb_h.timeout + 999) / 1000; callout_init_mtx(&request->callout, &ch->state_mtx, CALLOUT_RETURNUNLOCKED); request->ccb = ccb; ch->running = request; ch->state = ATA_ACTIVE; if (ch->hw.begin_transaction(request) == ATA_OP_FINISHED) { ch->running = NULL; ch->state = ATA_IDLE; ata_cam_end_transaction(dev, request); return; } } static void ata_cam_process_sense(device_t dev, struct ata_request *request) { struct ata_channel *ch = device_get_softc(dev); union ccb *ccb = request->ccb; int fatalerr = 0; ch->requestsense = 0; if (request->flags & ATA_R_TIMEOUT) fatalerr = 1; if ((request->flags & ATA_R_TIMEOUT) == 0 && (request->status & ATA_S_ERROR) == 0 && request->result == 0) { ccb->ccb_h.status |= CAM_AUTOSNS_VALID; } else { ccb->ccb_h.status &= ~CAM_STATUS_MASK; ccb->ccb_h.status |= CAM_AUTOSENSE_FAIL; } ata_free_request(request); xpt_done(ccb); /* Do error recovery if needed. */ if (fatalerr) ata_reinit(dev); } void ata_cam_end_transaction(device_t dev, struct ata_request *request) { struct ata_channel *ch = device_get_softc(dev); union ccb *ccb = request->ccb; int fatalerr = 0; if (ch->requestsense) { ata_cam_process_sense(dev, request); return; } ccb->ccb_h.status &= ~CAM_STATUS_MASK; if (request->flags & ATA_R_TIMEOUT) { xpt_freeze_simq(ch->sim, 1); ccb->ccb_h.status &= ~CAM_STATUS_MASK; ccb->ccb_h.status |= CAM_CMD_TIMEOUT | CAM_RELEASE_SIMQ; fatalerr = 1; } else if (request->status & ATA_S_ERROR) { if (ccb->ccb_h.func_code == XPT_ATA_IO) { ccb->ccb_h.status |= CAM_ATA_STATUS_ERROR; } else { ccb->ccb_h.status |= CAM_SCSI_STATUS_ERROR; ccb->csio.scsi_status = SCSI_STATUS_CHECK_COND; } } else if (request->result == ERESTART) ccb->ccb_h.status |= CAM_REQUEUE_REQ; else if (request->result != 0) ccb->ccb_h.status |= CAM_REQ_CMP_ERR; else ccb->ccb_h.status |= CAM_REQ_CMP; if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP && !(ccb->ccb_h.status & CAM_DEV_QFRZN)) { xpt_freeze_devq(ccb->ccb_h.path, 1); ccb->ccb_h.status |= CAM_DEV_QFRZN; } if (ccb->ccb_h.func_code == XPT_ATA_IO && ((request->status & ATA_S_ERROR) || (ccb->ataio.cmd.flags & CAM_ATAIO_NEEDRESULT))) { struct ata_res *res = &ccb->ataio.res; res->status = request->status; res->error = request->error; res->lba_low = request->u.ata.lba; res->lba_mid = request->u.ata.lba >> 8; res->lba_high = request->u.ata.lba >> 16; res->device = request->u.ata.lba >> 24; res->lba_low_exp = request->u.ata.lba >> 24; res->lba_mid_exp = request->u.ata.lba >> 32; res->lba_high_exp = request->u.ata.lba >> 40; res->sector_count = request->u.ata.count; res->sector_count_exp = request->u.ata.count >> 8; } if ((ccb->ccb_h.flags & CAM_DIR_MASK) != CAM_DIR_NONE) { if (ccb->ccb_h.func_code == XPT_ATA_IO) { ccb->ataio.resid = ccb->ataio.dxfer_len - request->donecount; } else { ccb->csio.resid = ccb->csio.dxfer_len - request->donecount; } } if ((ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_SCSI_STATUS_ERROR && (ccb->ccb_h.flags & CAM_DIS_AUTOSENSE) == 0) ata_cam_request_sense(dev, request); else { ata_free_request(request); xpt_done(ccb); } /* Do error recovery if needed. */ if (fatalerr) ata_reinit(dev); } static int ata_check_ids(device_t dev, union ccb *ccb) { struct ata_channel *ch = device_get_softc(dev); if (ccb->ccb_h.target_id > ((ch->flags & ATA_NO_SLAVE) ? 0 : 1)) { ccb->ccb_h.status = CAM_TID_INVALID; xpt_done(ccb); return (-1); } if (ccb->ccb_h.target_lun != 0) { ccb->ccb_h.status = CAM_LUN_INVALID; xpt_done(ccb); return (-1); } return (0); } static void ataaction(struct cam_sim *sim, union ccb *ccb) { device_t dev, parent; struct ata_channel *ch; CAM_DEBUG(ccb->ccb_h.path, CAM_DEBUG_TRACE, ("ataaction func_code=%x\n", ccb->ccb_h.func_code)); ch = (struct ata_channel *)cam_sim_softc(sim); dev = ch->dev; switch (ccb->ccb_h.func_code) { /* Common cases first */ case XPT_ATA_IO: /* Execute the requested I/O operation */ case XPT_SCSI_IO: if (ata_check_ids(dev, ccb)) return; if ((ch->devices & ((ATA_ATA_MASTER | ATA_ATAPI_MASTER) << ccb->ccb_h.target_id)) == 0) { ccb->ccb_h.status = CAM_SEL_TIMEOUT; break; } if (ch->running) device_printf(dev, "already running!\n"); if (ccb->ccb_h.func_code == XPT_ATA_IO && (ccb->ataio.cmd.flags & CAM_ATAIO_CONTROL) && (ccb->ataio.cmd.control & ATA_A_RESET)) { struct ata_res *res = &ccb->ataio.res; bzero(res, sizeof(*res)); if (ch->devices & (ATA_ATA_MASTER << ccb->ccb_h.target_id)) { res->lba_high = 0; res->lba_mid = 0; } else { res->lba_high = 0xeb; res->lba_mid = 0x14; } ccb->ccb_h.status = CAM_REQ_CMP; break; } ata_cam_begin_transaction(dev, ccb); return; case XPT_EN_LUN: /* Enable LUN as a target */ case XPT_TARGET_IO: /* Execute target I/O request */ case XPT_ACCEPT_TARGET_IO: /* Accept Host Target Mode CDB */ case XPT_CONT_TARGET_IO: /* Continue Host Target I/O Connection*/ case XPT_ABORT: /* Abort the specified CCB */ /* XXX Implement */ ccb->ccb_h.status = CAM_REQ_INVALID; break; case XPT_SET_TRAN_SETTINGS: { struct ccb_trans_settings *cts = &ccb->cts; struct ata_cam_device *d; if (ata_check_ids(dev, ccb)) return; if (cts->type == CTS_TYPE_CURRENT_SETTINGS) d = &ch->curr[ccb->ccb_h.target_id]; else d = &ch->user[ccb->ccb_h.target_id]; if (ch->flags & ATA_SATA) { if (cts->xport_specific.sata.valid & CTS_SATA_VALID_REVISION) d->revision = cts->xport_specific.sata.revision; if (cts->xport_specific.sata.valid & CTS_SATA_VALID_MODE) { if (cts->type == CTS_TYPE_CURRENT_SETTINGS) { d->mode = ATA_SETMODE(ch->dev, ccb->ccb_h.target_id, cts->xport_specific.sata.mode); } else d->mode = cts->xport_specific.sata.mode; } if (cts->xport_specific.sata.valid & CTS_SATA_VALID_BYTECOUNT) d->bytecount = min(8192, cts->xport_specific.sata.bytecount); if (cts->xport_specific.sata.valid & CTS_SATA_VALID_ATAPI) d->atapi = cts->xport_specific.sata.atapi; if (cts->xport_specific.sata.valid & CTS_SATA_VALID_CAPS) d->caps = cts->xport_specific.sata.caps; } else { if (cts->xport_specific.ata.valid & CTS_ATA_VALID_MODE) { if (cts->type == CTS_TYPE_CURRENT_SETTINGS) { d->mode = ATA_SETMODE(ch->dev, ccb->ccb_h.target_id, cts->xport_specific.ata.mode); } else d->mode = cts->xport_specific.ata.mode; } if (cts->xport_specific.ata.valid & CTS_ATA_VALID_BYTECOUNT) d->bytecount = cts->xport_specific.ata.bytecount; if (cts->xport_specific.ata.valid & CTS_ATA_VALID_ATAPI) d->atapi = cts->xport_specific.ata.atapi; } ccb->ccb_h.status = CAM_REQ_CMP; break; } case XPT_GET_TRAN_SETTINGS: { struct ccb_trans_settings *cts = &ccb->cts; struct ata_cam_device *d; if (ata_check_ids(dev, ccb)) return; if (cts->type == CTS_TYPE_CURRENT_SETTINGS) d = &ch->curr[ccb->ccb_h.target_id]; else d = &ch->user[ccb->ccb_h.target_id]; cts->protocol = PROTO_UNSPECIFIED; cts->protocol_version = PROTO_VERSION_UNSPECIFIED; if (ch->flags & ATA_SATA) { cts->transport = XPORT_SATA; cts->transport_version = XPORT_VERSION_UNSPECIFIED; cts->xport_specific.sata.valid = 0; cts->xport_specific.sata.mode = d->mode; cts->xport_specific.sata.valid |= CTS_SATA_VALID_MODE; cts->xport_specific.sata.bytecount = d->bytecount; cts->xport_specific.sata.valid |= CTS_SATA_VALID_BYTECOUNT; if (cts->type == CTS_TYPE_CURRENT_SETTINGS) { cts->xport_specific.sata.revision = ATA_GETREV(dev, ccb->ccb_h.target_id); if (cts->xport_specific.sata.revision != 0xff) { cts->xport_specific.sata.valid |= CTS_SATA_VALID_REVISION; } cts->xport_specific.sata.caps = d->caps & CTS_SATA_CAPS_D; if (ch->pm_level) { cts->xport_specific.sata.caps |= CTS_SATA_CAPS_H_PMREQ; } cts->xport_specific.sata.caps &= ch->user[ccb->ccb_h.target_id].caps; cts->xport_specific.sata.valid |= CTS_SATA_VALID_CAPS; } else { cts->xport_specific.sata.revision = d->revision; cts->xport_specific.sata.valid |= CTS_SATA_VALID_REVISION; cts->xport_specific.sata.caps = d->caps; cts->xport_specific.sata.valid |= CTS_SATA_VALID_CAPS; } cts->xport_specific.sata.atapi = d->atapi; cts->xport_specific.sata.valid |= CTS_SATA_VALID_ATAPI; } else { cts->transport = XPORT_ATA; cts->transport_version = XPORT_VERSION_UNSPECIFIED; cts->xport_specific.ata.valid = 0; cts->xport_specific.ata.mode = d->mode; cts->xport_specific.ata.valid |= CTS_ATA_VALID_MODE; cts->xport_specific.ata.bytecount = d->bytecount; cts->xport_specific.ata.valid |= CTS_ATA_VALID_BYTECOUNT; cts->xport_specific.ata.atapi = d->atapi; cts->xport_specific.ata.valid |= CTS_ATA_VALID_ATAPI; } ccb->ccb_h.status = CAM_REQ_CMP; break; } case XPT_RESET_BUS: /* Reset the specified SCSI bus */ case XPT_RESET_DEV: /* Bus Device Reset the specified SCSI device */ ata_reinit(dev); ccb->ccb_h.status = CAM_REQ_CMP; break; case XPT_TERM_IO: /* Terminate the I/O process */ /* XXX Implement */ ccb->ccb_h.status = CAM_REQ_INVALID; break; case XPT_PATH_INQ: /* Path routing inquiry */ { struct ccb_pathinq *cpi = &ccb->cpi; parent = device_get_parent(dev); cpi->version_num = 1; /* XXX??? */ cpi->hba_inquiry = PI_SDTR_ABLE; cpi->target_sprt = 0; cpi->hba_misc = PIM_SEQSCAN; cpi->hba_eng_cnt = 0; if (ch->flags & ATA_NO_SLAVE) cpi->max_target = 0; else cpi->max_target = 1; cpi->max_lun = 0; cpi->initiator_id = 0; cpi->bus_id = cam_sim_bus(sim); if (ch->flags & ATA_SATA) cpi->base_transfer_speed = 150000; else cpi->base_transfer_speed = 3300; strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN); strncpy(cpi->hba_vid, "ATA", HBA_IDLEN); strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN); cpi->unit_number = cam_sim_unit(sim); if (ch->flags & ATA_SATA) cpi->transport = XPORT_SATA; else cpi->transport = XPORT_ATA; cpi->transport_version = XPORT_VERSION_UNSPECIFIED; cpi->protocol = PROTO_ATA; cpi->protocol_version = PROTO_VERSION_UNSPECIFIED; cpi->maxio = ch->dma.max_iosize ? ch->dma.max_iosize : DFLTPHYS; if (device_get_devclass(device_get_parent(parent)) == devclass_find("pci")) { cpi->hba_vendor = pci_get_vendor(parent); cpi->hba_device = pci_get_device(parent); cpi->hba_subvendor = pci_get_subvendor(parent); cpi->hba_subdevice = pci_get_subdevice(parent); } cpi->ccb_h.status = CAM_REQ_CMP; break; } default: ccb->ccb_h.status = CAM_REQ_INVALID; break; } xpt_done(ccb); } static void atapoll(struct cam_sim *sim) { struct ata_channel *ch = (struct ata_channel *)cam_sim_softc(sim); ata_interrupt_locked(ch); } -#endif /* * module handeling */ static int ata_module_event_handler(module_t mod, int what, void *arg) { -#ifndef ATA_CAM - static struct cdev *atacdev; -#endif switch (what) { case MOD_LOAD: -#ifndef ATA_CAM - /* register controlling device */ - atacdev = make_dev(&ata_cdevsw, 0, UID_ROOT, GID_OPERATOR, 0600, "ata"); - - if (cold) { - /* register boot attach to be run when interrupts are enabled */ - if (!(ata_delayed_attach = (struct intr_config_hook *) - malloc(sizeof(struct intr_config_hook), - M_TEMP, M_NOWAIT | M_ZERO))) { - printf("ata: malloc of delayed attach hook failed\n"); - return EIO; - } - ata_delayed_attach->ich_func = (void*)ata_boot_attach; - if (config_intrhook_establish(ata_delayed_attach) != 0) { - printf("ata: config_intrhook_establish failed\n"); - free(ata_delayed_attach, M_TEMP); - } - } -#endif return 0; case MOD_UNLOAD: -#ifndef ATA_CAM - /* deregister controlling device */ - destroy_dev(atacdev); -#endif return 0; default: return EOPNOTSUPP; } } static moduledata_t ata_moduledata = { "ata", ata_module_event_handler, NULL }; DECLARE_MODULE(ata, ata_moduledata, SI_SUB_CONFIGURE, SI_ORDER_SECOND); MODULE_VERSION(ata, 1); -#ifdef ATA_CAM MODULE_DEPEND(ata, cam, 1, 1, 1); -#endif static void ata_init(void) { ata_request_zone = uma_zcreate("ata_request", sizeof(struct ata_request), NULL, NULL, NULL, NULL, 0, 0); - ata_composite_zone = uma_zcreate("ata_composite", - sizeof(struct ata_composite), - NULL, NULL, NULL, NULL, 0, 0); } SYSINIT(ata_register, SI_SUB_DRIVERS, SI_ORDER_SECOND, ata_init, NULL); static void ata_uninit(void) { - uma_zdestroy(ata_composite_zone); uma_zdestroy(ata_request_zone); } SYSUNINIT(ata_unregister, SI_SUB_DRIVERS, SI_ORDER_SECOND, ata_uninit, NULL); Index: head/sys/dev/ata/ata-all.h =================================================================== --- head/sys/dev/ata/ata-all.h (revision 249082) +++ head/sys/dev/ata/ata-all.h (revision 249083) @@ -1,779 +1,753 @@ /*- * Copyright (c) 1998 - 2008 Søren Schmidt * 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. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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. * * $FreeBSD$ */ #include "opt_ata.h" #if 0 #define ATA_LEGACY_SUPPORT /* Enable obsolete features that break * some modern devices */ #endif /* ATA register defines */ #define ATA_DATA 0 /* (RW) data */ #define ATA_FEATURE 1 /* (W) feature */ #define ATA_F_DMA 0x01 /* enable DMA */ #define ATA_F_OVL 0x02 /* enable overlap */ #define ATA_COUNT 2 /* (W) sector count */ #define ATA_SECTOR 3 /* (RW) sector # */ #define ATA_CYL_LSB 4 /* (RW) cylinder# LSB */ #define ATA_CYL_MSB 5 /* (RW) cylinder# MSB */ #define ATA_DRIVE 6 /* (W) Sector/Drive/Head */ #define ATA_D_LBA 0x40 /* use LBA addressing */ #define ATA_D_IBM 0xa0 /* 512 byte sectors, ECC */ #define ATA_COMMAND 7 /* (W) command */ #define ATA_ERROR 8 /* (R) error */ #define ATA_E_ILI 0x01 /* illegal length */ #define ATA_E_NM 0x02 /* no media */ #define ATA_E_ABORT 0x04 /* command aborted */ #define ATA_E_MCR 0x08 /* media change request */ #define ATA_E_IDNF 0x10 /* ID not found */ #define ATA_E_MC 0x20 /* media changed */ #define ATA_E_UNC 0x40 /* uncorrectable data */ #define ATA_E_ICRC 0x80 /* UDMA crc error */ #define ATA_E_ATAPI_SENSE_MASK 0xf0 /* ATAPI sense key mask */ #define ATA_IREASON 9 /* (R) interrupt reason */ #define ATA_I_CMD 0x01 /* cmd (1) | data (0) */ #define ATA_I_IN 0x02 /* read (1) | write (0) */ #define ATA_I_RELEASE 0x04 /* released bus (1) */ #define ATA_I_TAGMASK 0xf8 /* tag mask */ #define ATA_STATUS 10 /* (R) status */ #define ATA_ALTSTAT 11 /* (R) alternate status */ #define ATA_S_ERROR 0x01 /* error */ #define ATA_S_INDEX 0x02 /* index */ #define ATA_S_CORR 0x04 /* data corrected */ #define ATA_S_DRQ 0x08 /* data request */ #define ATA_S_DSC 0x10 /* drive seek completed */ #define ATA_S_SERVICE 0x10 /* drive needs service */ #define ATA_S_DWF 0x20 /* drive write fault */ #define ATA_S_DMA 0x20 /* DMA ready */ #define ATA_S_READY 0x40 /* drive ready */ #define ATA_S_BUSY 0x80 /* busy */ #define ATA_CONTROL 12 /* (W) control */ #define ATA_CTLOFFSET 0x206 /* control register offset */ #define ATA_PCCARD_CTLOFFSET 0x0e /* do for PCCARD devices */ #define ATA_PC98_CTLOFFSET 0x10c /* do for PC98 devices */ #define ATA_A_IDS 0x02 /* disable interrupts */ #define ATA_A_RESET 0x04 /* RESET controller */ #ifdef ATA_LEGACY_SUPPORT #define ATA_A_4BIT 0x08 /* 4 head bits: obsolete 1996 */ #else #define ATA_A_4BIT 0x00 #endif #define ATA_A_HOB 0x80 /* High Order Byte enable */ /* SATA register defines */ #define ATA_SSTATUS 13 #define ATA_SS_DET_MASK 0x0000000f #define ATA_SS_DET_NO_DEVICE 0x00000000 #define ATA_SS_DET_DEV_PRESENT 0x00000001 #define ATA_SS_DET_PHY_ONLINE 0x00000003 #define ATA_SS_DET_PHY_OFFLINE 0x00000004 #define ATA_SS_SPD_MASK 0x000000f0 #define ATA_SS_SPD_NO_SPEED 0x00000000 #define ATA_SS_SPD_GEN1 0x00000010 #define ATA_SS_SPD_GEN2 0x00000020 #define ATA_SS_IPM_MASK 0x00000f00 #define ATA_SS_IPM_NO_DEVICE 0x00000000 #define ATA_SS_IPM_ACTIVE 0x00000100 #define ATA_SS_IPM_PARTIAL 0x00000200 #define ATA_SS_IPM_SLUMBER 0x00000600 #define ATA_SERROR 14 #define ATA_SE_DATA_CORRECTED 0x00000001 #define ATA_SE_COMM_CORRECTED 0x00000002 #define ATA_SE_DATA_ERR 0x00000100 #define ATA_SE_COMM_ERR 0x00000200 #define ATA_SE_PROT_ERR 0x00000400 #define ATA_SE_HOST_ERR 0x00000800 #define ATA_SE_PHY_CHANGED 0x00010000 #define ATA_SE_PHY_IERROR 0x00020000 #define ATA_SE_COMM_WAKE 0x00040000 #define ATA_SE_DECODE_ERR 0x00080000 #define ATA_SE_PARITY_ERR 0x00100000 #define ATA_SE_CRC_ERR 0x00200000 #define ATA_SE_HANDSHAKE_ERR 0x00400000 #define ATA_SE_LINKSEQ_ERR 0x00800000 #define ATA_SE_TRANSPORT_ERR 0x01000000 #define ATA_SE_UNKNOWN_FIS 0x02000000 #define ATA_SCONTROL 15 #define ATA_SC_DET_MASK 0x0000000f #define ATA_SC_DET_IDLE 0x00000000 #define ATA_SC_DET_RESET 0x00000001 #define ATA_SC_DET_DISABLE 0x00000004 #define ATA_SC_SPD_MASK 0x000000f0 #define ATA_SC_SPD_NO_SPEED 0x00000000 #define ATA_SC_SPD_SPEED_GEN1 0x00000010 #define ATA_SC_SPD_SPEED_GEN2 0x00000020 #define ATA_SC_SPD_SPEED_GEN3 0x00000040 #define ATA_SC_IPM_MASK 0x00000f00 #define ATA_SC_IPM_NONE 0x00000000 #define ATA_SC_IPM_DIS_PARTIAL 0x00000100 #define ATA_SC_IPM_DIS_SLUMBER 0x00000200 #define ATA_SACTIVE 16 /* SATA AHCI v1.0 register defines */ #define ATA_AHCI_CAP 0x00 #define ATA_AHCI_CAP_NPMASK 0x0000001f #define ATA_AHCI_CAP_SXS 0x00000020 #define ATA_AHCI_CAP_EMS 0x00000040 #define ATA_AHCI_CAP_CCCS 0x00000080 #define ATA_AHCI_CAP_NCS 0x00001F00 #define ATA_AHCI_CAP_NCS_SHIFT 8 #define ATA_AHCI_CAP_PSC 0x00002000 #define ATA_AHCI_CAP_SSC 0x00004000 #define ATA_AHCI_CAP_PMD 0x00008000 #define ATA_AHCI_CAP_FBSS 0x00010000 #define ATA_AHCI_CAP_SPM 0x00020000 #define ATA_AHCI_CAP_SAM 0x00080000 #define ATA_AHCI_CAP_ISS 0x00F00000 #define ATA_AHCI_CAP_ISS_SHIFT 20 #define ATA_AHCI_CAP_SCLO 0x01000000 #define ATA_AHCI_CAP_SAL 0x02000000 #define ATA_AHCI_CAP_SALP 0x04000000 #define ATA_AHCI_CAP_SSS 0x08000000 #define ATA_AHCI_CAP_SMPS 0x10000000 #define ATA_AHCI_CAP_SSNTF 0x20000000 #define ATA_AHCI_CAP_SNCQ 0x40000000 #define ATA_AHCI_CAP_64BIT 0x80000000 #define ATA_AHCI_GHC 0x04 #define ATA_AHCI_GHC_AE 0x80000000 #define ATA_AHCI_GHC_IE 0x00000002 #define ATA_AHCI_GHC_HR 0x00000001 #define ATA_AHCI_IS 0x08 #define ATA_AHCI_PI 0x0c #define ATA_AHCI_VS 0x10 #define ATA_AHCI_OFFSET 0x80 #define ATA_AHCI_P_CLB 0x100 #define ATA_AHCI_P_CLBU 0x104 #define ATA_AHCI_P_FB 0x108 #define ATA_AHCI_P_FBU 0x10c #define ATA_AHCI_P_IS 0x110 #define ATA_AHCI_P_IE 0x114 #define ATA_AHCI_P_IX_DHR 0x00000001 #define ATA_AHCI_P_IX_PS 0x00000002 #define ATA_AHCI_P_IX_DS 0x00000004 #define ATA_AHCI_P_IX_SDB 0x00000008 #define ATA_AHCI_P_IX_UF 0x00000010 #define ATA_AHCI_P_IX_DP 0x00000020 #define ATA_AHCI_P_IX_PC 0x00000040 #define ATA_AHCI_P_IX_DI 0x00000080 #define ATA_AHCI_P_IX_PRC 0x00400000 #define ATA_AHCI_P_IX_IPM 0x00800000 #define ATA_AHCI_P_IX_OF 0x01000000 #define ATA_AHCI_P_IX_INF 0x04000000 #define ATA_AHCI_P_IX_IF 0x08000000 #define ATA_AHCI_P_IX_HBD 0x10000000 #define ATA_AHCI_P_IX_HBF 0x20000000 #define ATA_AHCI_P_IX_TFE 0x40000000 #define ATA_AHCI_P_IX_CPD 0x80000000 #define ATA_AHCI_P_CMD 0x118 #define ATA_AHCI_P_CMD_ST 0x00000001 #define ATA_AHCI_P_CMD_SUD 0x00000002 #define ATA_AHCI_P_CMD_POD 0x00000004 #define ATA_AHCI_P_CMD_CLO 0x00000008 #define ATA_AHCI_P_CMD_FRE 0x00000010 #define ATA_AHCI_P_CMD_CCS_MASK 0x00001f00 #define ATA_AHCI_P_CMD_ISS 0x00002000 #define ATA_AHCI_P_CMD_FR 0x00004000 #define ATA_AHCI_P_CMD_CR 0x00008000 #define ATA_AHCI_P_CMD_CPS 0x00010000 #define ATA_AHCI_P_CMD_PMA 0x00020000 #define ATA_AHCI_P_CMD_HPCP 0x00040000 #define ATA_AHCI_P_CMD_ISP 0x00080000 #define ATA_AHCI_P_CMD_CPD 0x00100000 #define ATA_AHCI_P_CMD_ATAPI 0x01000000 #define ATA_AHCI_P_CMD_DLAE 0x02000000 #define ATA_AHCI_P_CMD_ALPE 0x04000000 #define ATA_AHCI_P_CMD_ASP 0x08000000 #define ATA_AHCI_P_CMD_ICC_MASK 0xf0000000 #define ATA_AHCI_P_CMD_NOOP 0x00000000 #define ATA_AHCI_P_CMD_ACTIVE 0x10000000 #define ATA_AHCI_P_CMD_PARTIAL 0x20000000 #define ATA_AHCI_P_CMD_SLUMBER 0x60000000 #define ATA_AHCI_P_TFD 0x120 #define ATA_AHCI_P_SIG 0x124 #define ATA_AHCI_P_SSTS 0x128 #define ATA_AHCI_P_SCTL 0x12c #define ATA_AHCI_P_SERR 0x130 #define ATA_AHCI_P_SACT 0x134 #define ATA_AHCI_P_CI 0x138 #define ATA_AHCI_P_SNTF 0x13C #define ATA_AHCI_P_FBS 0x140 #define ATA_AHCI_CL_SIZE 32 #define ATA_AHCI_CL_OFFSET 0 #define ATA_AHCI_FB_OFFSET (ATA_AHCI_CL_SIZE * 32) #define ATA_AHCI_CT_OFFSET (ATA_AHCI_FB_OFFSET + 4096) #define ATA_AHCI_CT_SIZE (2176 + 128) struct ata_ahci_dma_prd { u_int64_t dba; u_int32_t reserved; u_int32_t dbc; /* 0 based */ #define ATA_AHCI_PRD_MASK 0x003fffff /* max 4MB */ #define ATA_AHCI_PRD_IPC (1<<31) } __packed; struct ata_ahci_cmd_tab { u_int8_t cfis[64]; u_int8_t acmd[32]; u_int8_t reserved[32]; #define ATA_AHCI_DMA_ENTRIES 129 struct ata_ahci_dma_prd prd_tab[ATA_AHCI_DMA_ENTRIES]; } __packed; struct ata_ahci_cmd_list { u_int16_t cmd_flags; #define ATA_AHCI_CMD_ATAPI 0x0020 #define ATA_AHCI_CMD_WRITE 0x0040 #define ATA_AHCI_CMD_PREFETCH 0x0080 #define ATA_AHCI_CMD_RESET 0x0100 #define ATA_AHCI_CMD_BIST 0x0200 #define ATA_AHCI_CMD_CLR_BUSY 0x0400 u_int16_t prd_length; /* PRD entries */ u_int32_t bytecount; u_int64_t cmd_table_phys; /* 128byte aligned */ } __packed; /* DMA register defines */ #define ATA_DMA_ENTRIES 256 #define ATA_DMA_EOT 0x80000000 #define ATA_BMCMD_PORT 17 #define ATA_BMCMD_START_STOP 0x01 #define ATA_BMCMD_WRITE_READ 0x08 #define ATA_BMDEVSPEC_0 18 #define ATA_BMSTAT_PORT 19 #define ATA_BMSTAT_ACTIVE 0x01 #define ATA_BMSTAT_ERROR 0x02 #define ATA_BMSTAT_INTERRUPT 0x04 #define ATA_BMSTAT_MASK 0x07 #define ATA_BMSTAT_DMA_MASTER 0x20 #define ATA_BMSTAT_DMA_SLAVE 0x40 #define ATA_BMSTAT_DMA_SIMPLEX 0x80 #define ATA_BMDEVSPEC_1 20 #define ATA_BMDTP_PORT 21 #define ATA_IDX_ADDR 22 #define ATA_IDX_DATA 23 #define ATA_MAX_RES 24 /* misc defines */ #define ATA_PRIMARY 0x1f0 #define ATA_SECONDARY 0x170 #define ATA_PC98_BANK 0x432 #define ATA_IOSIZE 0x08 #define ATA_PC98_IOSIZE 0x10 #define ATA_CTLIOSIZE 0x01 #define ATA_BMIOSIZE 0x08 #define ATA_PC98_BANKIOSIZE 0x01 #define ATA_IOADDR_RID 0 #define ATA_CTLADDR_RID 1 #define ATA_BMADDR_RID 0x20 #define ATA_PC98_CTLADDR_RID 8 #define ATA_PC98_BANKADDR_RID 9 #define ATA_IRQ_RID 0 #define ATA_DEV(unit) ((unit > 0) ? 0x10 : 0) #define ATA_CFA_MAGIC1 0x844A #define ATA_CFA_MAGIC2 0x848A #define ATA_CFA_MAGIC3 0x8400 #define ATAPI_MAGIC_LSB 0x14 #define ATAPI_MAGIC_MSB 0xeb #define ATAPI_P_READ (ATA_S_DRQ | ATA_I_IN) #define ATAPI_P_WRITE (ATA_S_DRQ) #define ATAPI_P_CMDOUT (ATA_S_DRQ | ATA_I_CMD) #define ATAPI_P_DONEDRQ (ATA_S_DRQ | ATA_I_CMD | ATA_I_IN) #define ATAPI_P_DONE (ATA_I_CMD | ATA_I_IN) #define ATAPI_P_ABORT 0 #define ATA_INTR_FLAGS (INTR_MPSAFE|INTR_TYPE_BIO|INTR_ENTROPY) #define ATA_OP_CONTINUES 0 #define ATA_OP_FINISHED 1 #define ATA_MAX_28BIT_LBA 268435455UL #ifndef ATA_REQUEST_TIMEOUT #define ATA_REQUEST_TIMEOUT 10 #endif /* structure used for composite atomic operations */ #define MAX_COMPOSITES 32 /* u_int32_t bits */ struct ata_composite { struct mtx lock; /* control lock */ u_int32_t rd_needed; /* needed read subdisks */ u_int32_t rd_done; /* done read subdisks */ u_int32_t wr_needed; /* needed write subdisks */ u_int32_t wr_depend; /* write depends on subdisks */ u_int32_t wr_done; /* done write subdisks */ struct ata_request *request[MAX_COMPOSITES]; u_int32_t residual; /* bytes still to transfer */ caddr_t data_1; caddr_t data_2; }; /* structure used to queue an ATA/ATAPI request */ struct ata_request { device_t dev; /* device handle */ device_t parent; /* channel handle */ int unit; /* physical unit */ union { struct { u_int8_t command; /* command reg */ u_int16_t feature; /* feature reg */ u_int16_t count; /* count reg */ u_int64_t lba; /* lba reg */ } ata; struct { u_int8_t ccb[16]; /* ATAPI command block */ struct atapi_sense sense; /* ATAPI request sense data */ u_int8_t saved_cmd; /* ATAPI saved command */ } atapi; } u; u_int32_t bytecount; /* bytes to transfer */ u_int32_t transfersize; /* bytes pr transfer */ caddr_t data; /* pointer to data buf */ u_int32_t tag; /* HW tag of this request */ int flags; #define ATA_R_CONTROL 0x00000001 #define ATA_R_READ 0x00000002 #define ATA_R_WRITE 0x00000004 #define ATA_R_ATAPI 0x00000008 #define ATA_R_DMA 0x00000010 #define ATA_R_QUIET 0x00000020 #define ATA_R_TIMEOUT 0x00000040 #define ATA_R_48BIT 0x00000080 #define ATA_R_ORDERED 0x00000100 #define ATA_R_AT_HEAD 0x00000200 #define ATA_R_REQUEUE 0x00000400 #define ATA_R_THREAD 0x00000800 #define ATA_R_DIRECT 0x00001000 #define ATA_R_NEEDRESULT 0x00002000 #define ATA_R_DATA_IN_CCB 0x00004000 #define ATA_R_ATAPI16 0x00010000 #define ATA_R_ATAPI_INTR 0x00020000 #define ATA_R_DEBUG 0x10000000 #define ATA_R_DANGER1 0x20000000 #define ATA_R_DANGER2 0x40000000 struct ata_dmaslot *dma; /* DMA slot of this request */ u_int8_t status; /* ATA status */ u_int8_t error; /* ATA error */ u_int32_t donecount; /* bytes transferred */ int result; /* result error code */ void (*callback)(struct ata_request *request); struct sema done; /* request done sema */ int retries; /* retry count */ int timeout; /* timeout for this cmd */ struct callout callout; /* callout management */ struct task task; /* task management */ struct bio *bio; /* bio for this request */ int this; /* this request ID */ struct ata_composite *composite; /* for composite atomic ops */ void *driver; /* driver specific */ TAILQ_ENTRY(ata_request) chain; /* list management */ -#ifdef ATA_CAM union ccb *ccb; -#endif }; /* define this for debugging request processing */ #if 0 #define ATA_DEBUG_RQ(request, string) \ { \ if (request->flags & ATA_R_DEBUG) \ device_printf(request->parent, "req=%p %s " string "\n", \ request, ata_cmd2str(request)); \ } #else #define ATA_DEBUG_RQ(request, string) #endif /* structure describing an ATA/ATAPI device */ struct ata_device { device_t dev; /* device handle */ int unit; /* physical unit */ #define ATA_MASTER 0x00 #define ATA_SLAVE 0x01 #define ATA_PM 0x0f struct ata_params param; /* ata param structure */ int mode; /* current transfermode */ u_int32_t max_iosize; /* max IO size */ int spindown; /* idle spindown timeout */ struct callout spindown_timer; int spindown_state; int flags; #define ATA_D_USE_CHS 0x0001 #define ATA_D_MEDIA_CHANGED 0x0002 #define ATA_D_ENC_PRESENT 0x0004 }; /* structure for holding DMA Physical Region Descriptors (PRD) entries */ struct ata_dma_prdentry { u_int32_t addr; u_int32_t count; }; /* structure used by the setprd function */ struct ata_dmasetprd_args { void *dmatab; int nsegs; int error; }; struct ata_dmaslot { u_int8_t status; /* DMA status */ bus_dma_tag_t sg_tag; /* SG list DMA tag */ bus_dmamap_t sg_map; /* SG list DMA map */ void *sg; /* DMA transfer table */ bus_addr_t sg_bus; /* bus address of dmatab */ bus_dma_tag_t data_tag; /* data DMA tag */ bus_dmamap_t data_map; /* data DMA map */ }; /* structure holding DMA related information */ struct ata_dma { bus_dma_tag_t dmatag; /* parent DMA tag */ bus_dma_tag_t work_tag; /* workspace DMA tag */ bus_dmamap_t work_map; /* workspace DMA map */ u_int8_t *work; /* workspace */ bus_addr_t work_bus; /* bus address of dmatab */ #define ATA_DMA_SLOTS 1 int dma_slots; /* DMA slots allocated */ struct ata_dmaslot slot[ATA_DMA_SLOTS]; u_int32_t alignment; /* DMA SG list alignment */ u_int32_t boundary; /* DMA SG list boundary */ u_int32_t segsize; /* DMA SG list segment size */ u_int32_t max_iosize; /* DMA data max IO size */ u_int64_t max_address; /* highest DMA'able address */ int flags; #define ATA_DMA_ACTIVE 0x01 /* DMA transfer in progress */ void (*alloc)(device_t dev); void (*free)(device_t dev); void (*setprd)(void *xsc, bus_dma_segment_t *segs, int nsegs, int error); int (*load)(struct ata_request *request, void *addr, int *nsegs); int (*unload)(struct ata_request *request); int (*start)(struct ata_request *request); int (*stop)(struct ata_request *request); void (*reset)(device_t dev); }; /* structure holding lowlevel functions */ struct ata_lowlevel { u_int32_t (*softreset)(device_t dev, int pmport); int (*pm_read)(device_t dev, int port, int reg, u_int32_t *result); int (*pm_write)(device_t dev, int port, int reg, u_int32_t value); int (*status)(device_t dev); int (*begin_transaction)(struct ata_request *request); int (*end_transaction)(struct ata_request *request); int (*command)(struct ata_request *request); void (*tf_read)(struct ata_request *request); void (*tf_write)(struct ata_request *request); }; /* structure holding resources for an ATA channel */ struct ata_resource { struct resource *res; int offset; }; -#ifdef ATA_CAM struct ata_cam_device { u_int revision; int mode; u_int bytecount; u_int atapi; u_int caps; }; -#endif /* structure describing an ATA channel */ struct ata_channel { device_t dev; /* device handle */ int unit; /* physical channel */ int attached; /* channel is attached */ struct ata_resource r_io[ATA_MAX_RES];/* I/O resources */ struct resource *r_irq; /* interrupt of this channel */ void *ih; /* interrupt handle */ struct ata_lowlevel hw; /* lowlevel HW functions */ struct ata_dma dma; /* DMA data / functions */ int flags; /* channel flags */ #define ATA_NO_SLAVE 0x01 #define ATA_USE_16BIT 0x02 #define ATA_ATAPI_DMA_RO 0x04 #define ATA_NO_48BIT_DMA 0x08 #define ATA_ALWAYS_DMASTAT 0x10 #define ATA_CHECKS_CABLE 0x20 #define ATA_NO_ATAPI_DMA 0x40 #define ATA_SATA 0x80 #define ATA_DMA_BEFORE_CMD 0x100 #define ATA_KNOWN_PRESENCE 0x200 #define ATA_STATUS_IS_LONG 0x400 #define ATA_PERIODIC_POLL 0x800 int pm_level; /* power management level */ int devices; /* what is present */ #define ATA_ATA_MASTER 0x00000001 #define ATA_ATA_SLAVE 0x00000002 #define ATA_PORTMULTIPLIER 0x00008000 #define ATA_ATAPI_MASTER 0x00010000 #define ATA_ATAPI_SLAVE 0x00020000 struct mtx state_mtx; /* state lock */ int state; /* ATA channel state */ #define ATA_IDLE 0x0000 #define ATA_ACTIVE 0x0001 #define ATA_STALL_QUEUE 0x0002 -#ifndef ATA_CAM - struct mtx queue_mtx; /* queue lock */ - TAILQ_HEAD(, ata_request) ata_queue; /* head of ATA queue */ - struct ata_request *freezepoint; /* composite freezepoint */ -#endif struct ata_request *running; /* currently running request */ struct task conntask; /* PHY events handling task */ -#ifdef ATA_CAM struct cam_sim *sim; struct cam_path *path; struct ata_cam_device user[16]; /* User-specified settings */ struct ata_cam_device curr[16]; /* Current settings */ int requestsense; /* CCB waiting for SENSE. */ -#endif struct callout poll_callout; /* Periodic status poll. */ }; /* disk bay/enclosure related */ #define ATA_LED_OFF 0x00 #define ATA_LED_RED 0x01 #define ATA_LED_GREEN 0x02 #define ATA_LED_ORANGE 0x03 #define ATA_LED_MASK 0x03 /* externs */ extern int (*ata_raid_ioctl_func)(u_long cmd, caddr_t data); extern struct intr_config_hook *ata_delayed_attach; extern devclass_t ata_devclass; extern int ata_wc; extern int ata_setmax; extern int ata_dma_check_80pin; /* public prototypes */ /* ata-all.c: */ int ata_probe(device_t dev); int ata_attach(device_t dev); int ata_detach(device_t dev); int ata_reinit(device_t dev); int ata_suspend(device_t dev); int ata_resume(device_t dev); void ata_interrupt(void *data); int ata_device_ioctl(device_t dev, u_long cmd, caddr_t data); int ata_getparam(struct ata_device *atadev, int init); void ata_default_registers(device_t dev); void ata_udelay(int interval); const char *ata_unit2str(struct ata_device *atadev); const char *ata_mode2str(int mode); void ata_setmode(device_t dev); void ata_print_cable(device_t dev, u_int8_t *who); int ata_str2mode(const char *str); const char *ata_satarev2str(int rev); int ata_atapi(device_t dev, int target); -#ifndef ATA_CAM -int ata_identify(device_t dev); -void ata_modify_if_48bit(struct ata_request *request); -int ata_pmode(struct ata_params *ap); -int ata_wmode(struct ata_params *ap); -int ata_umode(struct ata_params *ap); -int ata_limit_mode(device_t dev, int mode, int maxmode); -int ata_check_80pin(device_t dev, int mode); -#else void ata_cam_end_transaction(device_t dev, struct ata_request *request); -#endif /* ata-queue.c: */ int ata_controlcmd(device_t dev, u_int8_t command, u_int16_t feature, u_int64_t lba, u_int16_t count); int ata_atapicmd(device_t dev, u_int8_t *ccb, caddr_t data, int count, int flags, int timeout); void ata_queue_request(struct ata_request *request); void ata_start(device_t dev); void ata_finish(struct ata_request *request); void ata_timeout(struct ata_request *); void ata_catch_inflight(device_t dev); void ata_fail_requests(device_t dev); void ata_drop_requests(device_t dev); const char *ata_cmd2str(struct ata_request *request); /* ata-lowlevel.c: */ void ata_generic_hw(device_t dev); int ata_begin_transaction(struct ata_request *); int ata_end_transaction(struct ata_request *); void ata_generic_reset(device_t dev); int ata_generic_command(struct ata_request *request); /* ata-dma.c: */ void ata_dmainit(device_t); void ata_dmafini(device_t dev); /* ata-sata.c: */ void ata_sata_phy_check_events(device_t dev, int port); int ata_sata_scr_read(struct ata_channel *ch, int port, int reg, uint32_t *val); int ata_sata_scr_write(struct ata_channel *ch, int port, int reg, uint32_t val); int ata_sata_phy_reset(device_t dev, int port, int quick); int ata_sata_setmode(device_t dev, int target, int mode); int ata_sata_getrev(device_t dev, int target); int ata_request2fis_h2d(struct ata_request *request, u_int8_t *fis); void ata_pm_identify(device_t dev); /* macros for alloc/free of struct ata_request */ extern uma_zone_t ata_request_zone; #define ata_alloc_request() uma_zalloc(ata_request_zone, M_NOWAIT | M_ZERO) #define ata_free_request(request) { \ if (!(request->flags & ATA_R_DANGER2)) \ uma_zfree(ata_request_zone, request); \ } - -/* macros for alloc/free of struct ata_composite */ -extern uma_zone_t ata_composite_zone; -#define ata_alloc_composite() uma_zalloc(ata_composite_zone, M_NOWAIT | M_ZERO) -#define ata_free_composite(composite) uma_zfree(ata_composite_zone, composite) MALLOC_DECLARE(M_ATA); /* misc newbus defines */ #define GRANDPARENT(dev) device_get_parent(device_get_parent(dev)) /* macros to hide busspace uglyness */ #define ATA_INB(res, offset) \ bus_read_1((res), (offset)) #define ATA_INW(res, offset) \ bus_read_2((res), (offset)) #define ATA_INW_STRM(res, offset) \ bus_read_stream_2((res), (offset)) #define ATA_INL(res, offset) \ bus_read_4((res), (offset)) #define ATA_INSW(res, offset, addr, count) \ bus_read_multi_2((res), (offset), (addr), (count)) #define ATA_INSW_STRM(res, offset, addr, count) \ bus_read_multi_stream_2((res), (offset), (addr), (count)) #define ATA_INSL(res, offset, addr, count) \ bus_read_multi_4((res), (offset), (addr), (count)) #define ATA_INSL_STRM(res, offset, addr, count) \ bus_read_multi_stream_4((res), (offset), (addr), (count)) #define ATA_OUTB(res, offset, value) \ bus_write_1((res), (offset), (value)) #define ATA_OUTW(res, offset, value) \ bus_write_2((res), (offset), (value)) #define ATA_OUTW_STRM(res, offset, value) \ bus_write_stream_2((res), (offset), (value)) #define ATA_OUTL(res, offset, value) \ bus_write_4((res), (offset), (value)) #define ATA_OUTSW(res, offset, addr, count) \ bus_write_multi_2((res), (offset), (addr), (count)) #define ATA_OUTSW_STRM(res, offset, addr, count) \ bus_write_multi_stream_2((res), (offset), (addr), (count)) #define ATA_OUTSL(res, offset, addr, count) \ bus_write_multi_4((res), (offset), (addr), (count)) #define ATA_OUTSL_STRM(res, offset, addr, count) \ bus_write_multi_stream_4((res), (offset), (addr), (count)) #define ATA_IDX_INB(ch, idx) \ ATA_INB(ch->r_io[idx].res, ch->r_io[idx].offset) #define ATA_IDX_INW(ch, idx) \ ATA_INW(ch->r_io[idx].res, ch->r_io[idx].offset) #define ATA_IDX_INW_STRM(ch, idx) \ ATA_INW_STRM(ch->r_io[idx].res, ch->r_io[idx].offset) #define ATA_IDX_INL(ch, idx) \ ATA_INL(ch->r_io[idx].res, ch->r_io[idx].offset) #define ATA_IDX_INSW(ch, idx, addr, count) \ ATA_INSW(ch->r_io[idx].res, ch->r_io[idx].offset, addr, count) #define ATA_IDX_INSW_STRM(ch, idx, addr, count) \ ATA_INSW_STRM(ch->r_io[idx].res, ch->r_io[idx].offset, addr, count) #define ATA_IDX_INSL(ch, idx, addr, count) \ ATA_INSL(ch->r_io[idx].res, ch->r_io[idx].offset, addr, count) #define ATA_IDX_INSL_STRM(ch, idx, addr, count) \ ATA_INSL_STRM(ch->r_io[idx].res, ch->r_io[idx].offset, addr, count) #define ATA_IDX_OUTB(ch, idx, value) \ ATA_OUTB(ch->r_io[idx].res, ch->r_io[idx].offset, value) #define ATA_IDX_OUTW(ch, idx, value) \ ATA_OUTW(ch->r_io[idx].res, ch->r_io[idx].offset, value) #define ATA_IDX_OUTW_STRM(ch, idx, value) \ ATA_OUTW_STRM(ch->r_io[idx].res, ch->r_io[idx].offset, value) #define ATA_IDX_OUTL(ch, idx, value) \ ATA_OUTL(ch->r_io[idx].res, ch->r_io[idx].offset, value) #define ATA_IDX_OUTSW(ch, idx, addr, count) \ ATA_OUTSW(ch->r_io[idx].res, ch->r_io[idx].offset, addr, count) #define ATA_IDX_OUTSW_STRM(ch, idx, addr, count) \ ATA_OUTSW_STRM(ch->r_io[idx].res, ch->r_io[idx].offset, addr, count) #define ATA_IDX_OUTSL(ch, idx, addr, count) \ ATA_OUTSL(ch->r_io[idx].res, ch->r_io[idx].offset, addr, count) #define ATA_IDX_OUTSL_STRM(ch, idx, addr, count) \ ATA_OUTSL_STRM(ch->r_io[idx].res, ch->r_io[idx].offset, addr, count) Index: head/sys/dev/ata/ata-cbus.c =================================================================== --- head/sys/dev/ata/ata-cbus.c (revision 249082) +++ head/sys/dev/ata/ata-cbus.c (revision 249083) @@ -1,418 +1,349 @@ /*- * Copyright (c) 2002 - 2008 Søren Schmidt * 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. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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. */ #include __FBSDID("$FreeBSD$"); #include "opt_ata.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /* local vars */ struct ata_cbus_controller { struct resource *io; struct resource *ctlio; struct resource *bankio; struct resource *irq; void *ih; -#ifndef ATA_CAM - struct mtx bank_mtx; - int locked_bank; - int restart_bank; - int hardware_bank; -#endif int channels; struct { void (*function)(void *); void *argument; } interrupt[2]; }; /* local prototypes */ static void ata_cbus_intr(void *); -#ifndef ATA_CAM -static int ata_cbuschannel_banking(device_t dev, int flags); -#endif static int ata_cbus_probe(device_t dev) { struct resource *io; int rid; u_long tmp; /* dont probe PnP devices */ if (isa_get_vendorid(dev)) return (ENXIO); /* allocate the ioport range */ rid = ATA_IOADDR_RID; if (!(io = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0, ATA_PC98_IOSIZE, RF_ACTIVE))) return ENOMEM; /* calculate & set the altport range */ rid = ATA_PC98_CTLADDR_RID; if (bus_get_resource(dev, SYS_RES_IOPORT, rid, &tmp, &tmp)) { bus_set_resource(dev, SYS_RES_IOPORT, rid, rman_get_start(io)+ATA_PC98_CTLOFFSET, ATA_CTLIOSIZE); } /* calculate & set the bank range */ rid = ATA_PC98_BANKADDR_RID; if (bus_get_resource(dev, SYS_RES_IOPORT, rid, &tmp, &tmp)) { bus_set_resource(dev, SYS_RES_IOPORT, rid, ATA_PC98_BANK, ATA_PC98_BANKIOSIZE); } bus_release_resource(dev, SYS_RES_IOPORT, ATA_IOADDR_RID, io); return 0; } static int ata_cbus_attach(device_t dev) { struct ata_cbus_controller *ctlr = device_get_softc(dev); device_t child; int rid, unit; /* allocate resources */ rid = ATA_IOADDR_RID; if (!(ctlr->io = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0, ATA_PC98_IOSIZE, RF_ACTIVE))) return ENOMEM; rid = ATA_PC98_CTLADDR_RID; if (!(ctlr->ctlio = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, rman_get_start(ctlr->io) + ATA_PC98_CTLOFFSET, ~0, ATA_CTLIOSIZE, RF_ACTIVE))) { bus_release_resource(dev, SYS_RES_IOPORT, ATA_IOADDR_RID, ctlr->io); return ENOMEM; } rid = ATA_PC98_BANKADDR_RID; if (!(ctlr->bankio = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, ATA_PC98_BANK, ~0, ATA_PC98_BANKIOSIZE, RF_ACTIVE))) { bus_release_resource(dev, SYS_RES_IOPORT, ATA_IOADDR_RID, ctlr->io); bus_release_resource(dev, SYS_RES_IOPORT, ATA_CTLADDR_RID, ctlr->ctlio); return ENOMEM; } rid = ATA_IRQ_RID; if (!(ctlr->irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, RF_ACTIVE | RF_SHAREABLE))) { device_printf(dev, "unable to alloc interrupt\n"); bus_release_resource(dev, SYS_RES_IOPORT, ATA_IOADDR_RID, ctlr->io); bus_release_resource(dev, SYS_RES_IOPORT, ATA_CTLADDR_RID, ctlr->ctlio); bus_release_resource(dev, SYS_RES_IOPORT, ATA_PC98_BANKADDR_RID, ctlr->bankio); return ENXIO; } if ((bus_setup_intr(dev, ctlr->irq, ATA_INTR_FLAGS, NULL, ata_cbus_intr, ctlr, &ctlr->ih))) { device_printf(dev, "unable to setup interrupt\n"); bus_release_resource(dev, SYS_RES_IOPORT, ATA_IOADDR_RID, ctlr->io); bus_release_resource(dev, SYS_RES_IOPORT, ATA_CTLADDR_RID, ctlr->ctlio); bus_release_resource(dev, SYS_RES_IOPORT, ATA_PC98_BANKADDR_RID, ctlr->bankio); bus_release_resource(dev, SYS_RES_IOPORT, ATA_IRQ_RID, ctlr->irq); return ENXIO; } -#ifndef ATA_CAM - ctlr->channels = 2; - mtx_init(&ctlr->bank_mtx, "ATA cbus bank lock", NULL, MTX_DEF); - ctlr->hardware_bank = -1; - ctlr->locked_bank = -1; - ctlr->restart_bank = -1; -#else /* Work around the lack of channel serialization in ATA_CAM. */ ctlr->channels = 1; device_printf(dev, "second channel ignored\n"); -#endif for (unit = 0; unit < ctlr->channels; unit++) { child = device_add_child(dev, "ata", unit); if (child == NULL) device_printf(dev, "failed to add ata child device\n"); else device_set_ivars(child, (void *)(intptr_t)unit); } bus_generic_attach(dev); return (0); } static struct resource * ata_cbus_alloc_resource(device_t dev, device_t child, int type, int *rid, u_long start, u_long end, u_long count, u_int flags) { struct ata_cbus_controller *ctlr = device_get_softc(dev); if (type == SYS_RES_IOPORT) { switch (*rid) { case ATA_IOADDR_RID: return ctlr->io; case ATA_CTLADDR_RID: return ctlr->ctlio; } } if (type == SYS_RES_IRQ) return ctlr->irq; return 0; } static int ata_cbus_setup_intr(device_t dev, device_t child, struct resource *irq, int flags, driver_filter_t *filter, driver_intr_t *intr, void *arg, void **cookiep) { struct ata_cbus_controller *controller = device_get_softc(dev); int unit = ((struct ata_channel *)device_get_softc(child))->unit; if (filter != NULL) { printf("ata-cbus.c: we cannot use a filter here\n"); return (EINVAL); } controller->interrupt[unit].function = intr; controller->interrupt[unit].argument = arg; *cookiep = controller; return 0; } static int ata_cbus_print_child(device_t dev, device_t child) { struct ata_channel *ch = device_get_softc(child); int retval = 0; retval += bus_print_child_header(dev, child); retval += printf(" at bank %d", ch->unit); retval += bus_print_child_footer(dev, child); return retval; } static void ata_cbus_intr(void *data) { struct ata_cbus_controller *ctlr = data; struct ata_channel *ch; int unit; for (unit = 0; unit < ctlr->channels; unit++) { if (!(ch = ctlr->interrupt[unit].argument)) continue; -#ifndef ATA_CAM - if (ata_cbuschannel_banking(ch->dev, ATA_LF_WHICH) == unit) -#endif - ctlr->interrupt[unit].function(ch); + ctlr->interrupt[unit].function(ch); } } static device_method_t ata_cbus_methods[] = { /* device interface */ DEVMETHOD(device_probe, ata_cbus_probe), DEVMETHOD(device_attach, ata_cbus_attach), // DEVMETHOD(device_detach, ata_cbus_detach), /* bus methods */ DEVMETHOD(bus_alloc_resource, ata_cbus_alloc_resource), DEVMETHOD(bus_setup_intr, ata_cbus_setup_intr), DEVMETHOD(bus_print_child, ata_cbus_print_child), DEVMETHOD_END }; static driver_t ata_cbus_driver = { "atacbus", ata_cbus_methods, sizeof(struct ata_cbus_controller), }; static devclass_t ata_cbus_devclass; DRIVER_MODULE(atacbus, isa, ata_cbus_driver, ata_cbus_devclass, 0, 0); static int ata_cbuschannel_probe(device_t dev) { char buffer[32]; sprintf(buffer, "ATA channel %d", (int)(intptr_t)device_get_ivars(dev)); device_set_desc_copy(dev, buffer); return ata_probe(dev); } static int ata_cbuschannel_attach(device_t dev) { struct ata_cbus_controller *ctlr = device_get_softc(device_get_parent(dev)); struct ata_channel *ch = device_get_softc(dev); int i; if (ch->attached) return (0); ch->attached = 1; ch->unit = (intptr_t)device_get_ivars(dev); /* setup the resource vectors */ for (i = ATA_DATA; i <= ATA_COMMAND; i ++) { ch->r_io[i].res = ctlr->io; ch->r_io[i].offset = i << 1; } ch->r_io[ATA_CONTROL].res = ctlr->ctlio; ch->r_io[ATA_CONTROL].offset = 0; ch->r_io[ATA_IDX_ADDR].res = ctlr->io; ata_default_registers(dev); /* initialize softc for this channel */ ch->flags |= ATA_USE_16BIT; ata_generic_hw(dev); return ata_attach(dev); } static int ata_cbuschannel_detach(device_t dev) { struct ata_channel *ch = device_get_softc(dev); if (!ch->attached) return (0); ch->attached = 0; return ata_detach(dev); } static int ata_cbuschannel_suspend(device_t dev) { struct ata_channel *ch = device_get_softc(dev); if (!ch->attached) return (0); return ata_suspend(dev); } static int ata_cbuschannel_resume(device_t dev) { struct ata_channel *ch = device_get_softc(dev); if (!ch->attached) return (0); return ata_resume(dev); } -#ifndef ATA_CAM -static int -ata_cbuschannel_banking(device_t dev, int flags) -{ - struct ata_cbus_controller *ctlr = device_get_softc(device_get_parent(dev)); - struct ata_channel *ch = device_get_softc(dev); - int res; - - mtx_lock(&ctlr->bank_mtx); - switch (flags) { - case ATA_LF_LOCK: - if (ctlr->locked_bank == -1) - ctlr->locked_bank = ch->unit; - if (ctlr->locked_bank == ch->unit) { - ctlr->hardware_bank = ch->unit; - ATA_OUTB(ctlr->bankio, 0, ch->unit); - } - else - ctlr->restart_bank = ch->unit; - break; - - case ATA_LF_UNLOCK: - if (ctlr->locked_bank == ch->unit) { - ctlr->locked_bank = -1; - if (ctlr->restart_bank != -1) { - if ((ch = ctlr->interrupt[ctlr->restart_bank].argument)) { - ctlr->restart_bank = -1; - mtx_unlock(&ctlr->bank_mtx); - ata_start(ch->dev); - return -1; - } - } - } - break; - - case ATA_LF_WHICH: - break; - } - res = ctlr->locked_bank; - mtx_unlock(&ctlr->bank_mtx); - return res; -} -#endif - static device_method_t ata_cbuschannel_methods[] = { /* device interface */ DEVMETHOD(device_probe, ata_cbuschannel_probe), DEVMETHOD(device_attach, ata_cbuschannel_attach), DEVMETHOD(device_detach, ata_cbuschannel_detach), DEVMETHOD(device_suspend, ata_cbuschannel_suspend), DEVMETHOD(device_resume, ata_cbuschannel_resume), - -#ifndef ATA_CAM - /* ATA methods */ - DEVMETHOD(ata_locking, ata_cbuschannel_banking), -#endif DEVMETHOD_END }; static driver_t ata_cbuschannel_driver = { "ata", ata_cbuschannel_methods, sizeof(struct ata_channel), }; DRIVER_MODULE(ata, atacbus, ata_cbuschannel_driver, ata_devclass, NULL, NULL); MODULE_DEPEND(ata, ata, 1, 1, 1); Index: head/sys/dev/ata/ata-dma.c =================================================================== --- head/sys/dev/ata/ata-dma.c (revision 249082) +++ head/sys/dev/ata/ata-dma.c (revision 249083) @@ -1,353 +1,351 @@ /*- * Copyright (c) 1998 - 2008 Søren Schmidt * 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. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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. */ #include __FBSDID("$FreeBSD$"); #include #include #include #include #include #include #include #include #include #include #include #include #include #include /* prototypes */ static void ata_dmasetupc_cb(void *xsc, bus_dma_segment_t *segs, int nsegs, int error); static void ata_dmaalloc(device_t dev); static void ata_dmafree(device_t dev); static void ata_dmasetprd(void *xsc, bus_dma_segment_t *segs, int nsegs, int error); static int ata_dmaload(struct ata_request *request, void *addr, int *nsegs); static int ata_dmaunload(struct ata_request *request); /* local vars */ static MALLOC_DEFINE(M_ATADMA, "ata_dma", "ATA driver DMA"); /* misc defines */ #define MAXTABSZ PAGE_SIZE #define MAXWSPCSZ PAGE_SIZE*2 struct ata_dc_cb_args { bus_addr_t maddr; int error; }; void ata_dmainit(device_t dev) { struct ata_channel *ch = device_get_softc(dev); struct ata_dc_cb_args dcba; if (ch->dma.alloc == NULL) ch->dma.alloc = ata_dmaalloc; if (ch->dma.free == NULL) ch->dma.free = ata_dmafree; if (ch->dma.setprd == NULL) ch->dma.setprd = ata_dmasetprd; if (ch->dma.load == NULL) ch->dma.load = ata_dmaload; if (ch->dma.unload == NULL) ch->dma.unload = ata_dmaunload; if (ch->dma.alignment == 0) ch->dma.alignment = 2; if (ch->dma.boundary == 0) ch->dma.boundary = 65536; if (ch->dma.segsize == 0) ch->dma.segsize = 65536; if (ch->dma.max_iosize == 0) ch->dma.max_iosize = MIN((ATA_DMA_ENTRIES - 1) * PAGE_SIZE, MAXPHYS); if (ch->dma.max_address == 0) ch->dma.max_address = BUS_SPACE_MAXADDR_32BIT; if (ch->dma.dma_slots == 0) ch->dma.dma_slots = 1; if (bus_dma_tag_create(bus_get_dma_tag(dev), ch->dma.alignment, 0, ch->dma.max_address, BUS_SPACE_MAXADDR, NULL, NULL, ch->dma.max_iosize, ATA_DMA_ENTRIES, ch->dma.segsize, 0, NULL, NULL, &ch->dma.dmatag)) goto error; if (bus_dma_tag_create(ch->dma.dmatag, PAGE_SIZE, 64 * 1024, ch->dma.max_address, BUS_SPACE_MAXADDR, NULL, NULL, MAXWSPCSZ, 1, MAXWSPCSZ, 0, NULL, NULL, &ch->dma.work_tag)) goto error; if (bus_dmamem_alloc(ch->dma.work_tag, (void **)&ch->dma.work, BUS_DMA_WAITOK | BUS_DMA_COHERENT, &ch->dma.work_map)) goto error; if (bus_dmamap_load(ch->dma.work_tag, ch->dma.work_map, ch->dma.work, MAXWSPCSZ, ata_dmasetupc_cb, &dcba, 0) || dcba.error) { bus_dmamem_free(ch->dma.work_tag, ch->dma.work, ch->dma.work_map); goto error; } ch->dma.work_bus = dcba.maddr; return; error: device_printf(dev, "WARNING - DMA initialization failed, disabling DMA\n"); ata_dmafini(dev); } void ata_dmafini(device_t dev) { struct ata_channel *ch = device_get_softc(dev); if (ch->dma.work_bus) { bus_dmamap_unload(ch->dma.work_tag, ch->dma.work_map); bus_dmamem_free(ch->dma.work_tag, ch->dma.work, ch->dma.work_map); ch->dma.work_bus = 0; ch->dma.work_map = NULL; ch->dma.work = NULL; } if (ch->dma.work_tag) { bus_dma_tag_destroy(ch->dma.work_tag); ch->dma.work_tag = NULL; } if (ch->dma.dmatag) { bus_dma_tag_destroy(ch->dma.dmatag); ch->dma.dmatag = NULL; } } static void ata_dmasetupc_cb(void *xsc, bus_dma_segment_t *segs, int nsegs, int error) { struct ata_dc_cb_args *dcba = (struct ata_dc_cb_args *)xsc; if (!(dcba->error = error)) dcba->maddr = segs[0].ds_addr; } static void ata_dmaalloc(device_t dev) { struct ata_channel *ch = device_get_softc(dev); struct ata_dc_cb_args dcba; int i; /* alloc and setup needed dma slots */ bzero(ch->dma.slot, sizeof(struct ata_dmaslot) * ATA_DMA_SLOTS); for (i = 0; i < ch->dma.dma_slots; i++) { struct ata_dmaslot *slot = &ch->dma.slot[i]; if (bus_dma_tag_create(ch->dma.dmatag, PAGE_SIZE, PAGE_SIZE, ch->dma.max_address, BUS_SPACE_MAXADDR, NULL, NULL, PAGE_SIZE, 1, PAGE_SIZE, 0, NULL, NULL, &slot->sg_tag)) { device_printf(ch->dev, "FAILURE - create sg_tag\n"); goto error; } if (bus_dmamem_alloc(slot->sg_tag, (void **)&slot->sg, BUS_DMA_WAITOK, &slot->sg_map)) { device_printf(ch->dev, "FAILURE - alloc sg_map\n"); goto error; } if (bus_dmamap_load(slot->sg_tag, slot->sg_map, slot->sg, MAXTABSZ, ata_dmasetupc_cb, &dcba, 0) || dcba.error) { device_printf(ch->dev, "FAILURE - load sg\n"); goto error; } slot->sg_bus = dcba.maddr; if (bus_dma_tag_create(ch->dma.dmatag, ch->dma.alignment, ch->dma.boundary, ch->dma.max_address, BUS_SPACE_MAXADDR, NULL, NULL, ch->dma.max_iosize, ATA_DMA_ENTRIES, ch->dma.segsize, BUS_DMA_ALLOCNOW, NULL, NULL, &slot->data_tag)) { device_printf(ch->dev, "FAILURE - create data_tag\n"); goto error; } if (bus_dmamap_create(slot->data_tag, 0, &slot->data_map)) { device_printf(ch->dev, "FAILURE - create data_map\n"); goto error; } } return; error: device_printf(dev, "WARNING - DMA allocation failed, disabling DMA\n"); ata_dmafree(dev); } static void ata_dmafree(device_t dev) { struct ata_channel *ch = device_get_softc(dev); int i; /* free all dma slots */ for (i = 0; i < ATA_DMA_SLOTS; i++) { struct ata_dmaslot *slot = &ch->dma.slot[i]; if (slot->sg_bus) { bus_dmamap_unload(slot->sg_tag, slot->sg_map); slot->sg_bus = 0; } if (slot->sg_map) { bus_dmamem_free(slot->sg_tag, slot->sg, slot->sg_map); bus_dmamap_destroy(slot->sg_tag, slot->sg_map); slot->sg = NULL; slot->sg_map = NULL; } if (slot->data_map) { bus_dmamap_destroy(slot->data_tag, slot->data_map); slot->data_map = NULL; } if (slot->sg_tag) { bus_dma_tag_destroy(slot->sg_tag); slot->sg_tag = NULL; } if (slot->data_tag) { bus_dma_tag_destroy(slot->data_tag); slot->data_tag = NULL; } } } static void ata_dmasetprd(void *xsc, bus_dma_segment_t *segs, int nsegs, int error) { struct ata_dmasetprd_args *args = xsc; struct ata_dma_prdentry *prd = args->dmatab; int i; if ((args->error = error)) return; for (i = 0; i < nsegs; i++) { prd[i].addr = htole32(segs[i].ds_addr); prd[i].count = htole32(segs[i].ds_len); } prd[i - 1].count |= htole32(ATA_DMA_EOT); KASSERT(nsegs <= ATA_DMA_ENTRIES, ("too many DMA segment entries\n")); args->nsegs = nsegs; } static int ata_dmaload(struct ata_request *request, void *addr, int *entries) { struct ata_channel *ch = device_get_softc(request->parent); struct ata_dmasetprd_args dspa; int error; ATA_DEBUG_RQ(request, "dmaload"); if (request->dma) { device_printf(request->parent, "FAILURE - already active DMA on this device\n"); return EIO; } if (!request->bytecount) { device_printf(request->parent, "FAILURE - zero length DMA transfer attempted\n"); return EIO; } if (request->bytecount & (ch->dma.alignment - 1)) { device_printf(request->parent, "FAILURE - odd-sized DMA transfer attempt %d %% %d\n", request->bytecount, ch->dma.alignment); return EIO; } if (request->bytecount > ch->dma.max_iosize) { device_printf(request->parent, "FAILURE - oversized DMA transfer attempt %d > %d\n", request->bytecount, ch->dma.max_iosize); return EIO; } /* set our slot. XXX SOS NCQ will change that */ request->dma = &ch->dma.slot[0]; if (addr) dspa.dmatab = addr; else dspa.dmatab = request->dma->sg; -#ifdef ATA_CAM if (request->flags & ATA_R_DATA_IN_CCB) error = bus_dmamap_load_ccb(request->dma->data_tag, request->dma->data_map, request->ccb, ch->dma.setprd, &dspa, BUS_DMA_NOWAIT); else -#endif error = bus_dmamap_load(request->dma->data_tag, request->dma->data_map, request->data, request->bytecount, ch->dma.setprd, &dspa, BUS_DMA_NOWAIT); if (error || (error = dspa.error)) { device_printf(request->parent, "FAILURE - load data\n"); goto error; } if (entries) *entries = dspa.nsegs; bus_dmamap_sync(request->dma->sg_tag, request->dma->sg_map, BUS_DMASYNC_PREWRITE); bus_dmamap_sync(request->dma->data_tag, request->dma->data_map, (request->flags & ATA_R_READ) ? BUS_DMASYNC_PREREAD : BUS_DMASYNC_PREWRITE); return 0; error: ata_dmaunload(request); return EIO; } int ata_dmaunload(struct ata_request *request) { ATA_DEBUG_RQ(request, "dmaunload"); if (request->dma) { bus_dmamap_sync(request->dma->sg_tag, request->dma->sg_map, BUS_DMASYNC_POSTWRITE); bus_dmamap_sync(request->dma->data_tag, request->dma->data_map, (request->flags & ATA_R_READ) ? BUS_DMASYNC_POSTREAD : BUS_DMASYNC_POSTWRITE); bus_dmamap_unload(request->dma->data_tag, request->dma->data_map); request->dma = NULL; } return 0; } Index: head/sys/dev/ata/ata-lowlevel.c =================================================================== --- head/sys/dev/ata/ata-lowlevel.c (revision 249082) +++ head/sys/dev/ata/ata-lowlevel.c (revision 249083) @@ -1,927 +1,897 @@ /*- * Copyright (c) 1998 - 2008 Søren Schmidt * 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. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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. */ #include __FBSDID("$FreeBSD$"); #include "opt_ata.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /* prototypes */ static int ata_generic_status(device_t dev); static int ata_wait(struct ata_channel *ch, int unit, u_int8_t); static void ata_pio_read(struct ata_request *, int); static void ata_pio_write(struct ata_request *, int); static void ata_tf_read(struct ata_request *); static void ata_tf_write(struct ata_request *); /* * low level ATA functions */ void ata_generic_hw(device_t dev) { struct ata_channel *ch = device_get_softc(dev); ch->hw.begin_transaction = ata_begin_transaction; ch->hw.end_transaction = ata_end_transaction; ch->hw.status = ata_generic_status; ch->hw.softreset = NULL; ch->hw.command = ata_generic_command; ch->hw.tf_read = ata_tf_read; ch->hw.tf_write = ata_tf_write; ch->hw.pm_read = NULL; ch->hw.pm_write = NULL; } /* must be called with ATA channel locked and state_mtx held */ int ata_begin_transaction(struct ata_request *request) { struct ata_channel *ch = device_get_softc(request->parent); int dummy, error; ATA_DEBUG_RQ(request, "begin transaction"); /* disable ATAPI DMA writes if HW doesn't support it */ if ((ch->flags & ATA_NO_ATAPI_DMA) && (request->flags & ATA_R_ATAPI) == ATA_R_ATAPI) request->flags &= ~ATA_R_DMA; if ((ch->flags & ATA_ATAPI_DMA_RO) && ((request->flags & (ATA_R_ATAPI | ATA_R_DMA | ATA_R_WRITE)) == (ATA_R_ATAPI | ATA_R_DMA | ATA_R_WRITE))) request->flags &= ~ATA_R_DMA; switch (request->flags & (ATA_R_ATAPI | ATA_R_DMA)) { /* ATA PIO data transfer and control commands */ default: { /* record command direction here as our request might be gone later */ int write = (request->flags & ATA_R_WRITE); /* issue command */ if (ch->hw.command(request)) { device_printf(request->parent, "error issuing %s command\n", ata_cmd2str(request)); request->result = EIO; goto begin_finished; } /* device reset doesn't interrupt */ if (request->u.ata.command == ATA_DEVICE_RESET) { int timeout = 1000000; do { DELAY(10); request->status = ATA_IDX_INB(ch, ATA_STATUS); } while (request->status & ATA_S_BUSY && timeout--); if (request->status & ATA_S_ERROR) request->error = ATA_IDX_INB(ch, ATA_ERROR); ch->hw.tf_read(request); goto begin_finished; } /* if write command output the data */ if (write) { if (ata_wait(ch, request->unit, (ATA_S_READY | ATA_S_DRQ)) < 0) { device_printf(request->parent, "timeout waiting for write DRQ\n"); request->result = EIO; goto begin_finished; } ata_pio_write(request, request->transfersize); } } goto begin_continue; /* ATA DMA data transfer commands */ case ATA_R_DMA: /* check sanity, setup SG list and DMA engine */ if ((error = ch->dma.load(request, NULL, &dummy))) { device_printf(request->parent, "setting up DMA failed\n"); request->result = error; goto begin_finished; } /* start DMA engine if necessary */ if ((ch->flags & ATA_DMA_BEFORE_CMD) && ch->dma.start && ch->dma.start(request)) { device_printf(request->parent, "error starting DMA\n"); request->result = EIO; goto begin_finished; } /* issue command */ if (ch->hw.command(request)) { device_printf(request->parent, "error issuing %s command\n", ata_cmd2str(request)); request->result = EIO; goto begin_finished; } /* start DMA engine */ if (!(ch->flags & ATA_DMA_BEFORE_CMD) && ch->dma.start && ch->dma.start(request)) { device_printf(request->parent, "error starting DMA\n"); request->result = EIO; goto begin_finished; } goto begin_continue; /* ATAPI PIO commands */ case ATA_R_ATAPI: /* is this just a POLL DSC command ? */ if (request->u.atapi.ccb[0] == ATAPI_POLL_DSC) { ATA_IDX_OUTB(ch, ATA_DRIVE, ATA_D_IBM | ATA_DEV(request->unit)); DELAY(10); if (!(ATA_IDX_INB(ch, ATA_ALTSTAT) & ATA_S_DSC)) request->result = EBUSY; goto begin_finished; } /* start ATAPI operation */ if (ch->hw.command(request)) { device_printf(request->parent, "error issuing ATA PACKET command\n"); request->result = EIO; goto begin_finished; } goto begin_continue; /* ATAPI DMA commands */ case ATA_R_ATAPI|ATA_R_DMA: /* is this just a POLL DSC command ? */ if (request->u.atapi.ccb[0] == ATAPI_POLL_DSC) { ATA_IDX_OUTB(ch, ATA_DRIVE, ATA_D_IBM | ATA_DEV(request->unit)); DELAY(10); if (!(ATA_IDX_INB(ch, ATA_ALTSTAT) & ATA_S_DSC)) request->result = EBUSY; goto begin_finished; } /* check sanity, setup SG list and DMA engine */ if ((error = ch->dma.load(request, NULL, &dummy))) { device_printf(request->parent, "setting up DMA failed\n"); request->result = error; goto begin_finished; } /* start ATAPI operation */ if (ch->hw.command(request)) { device_printf(request->parent, "error issuing ATA PACKET command\n"); request->result = EIO; goto begin_finished; } /* start DMA engine */ if (ch->dma.start && ch->dma.start(request)) { request->result = EIO; goto begin_finished; } goto begin_continue; } /* NOT REACHED */ printf("ata_begin_transaction OOPS!!!\n"); begin_finished: if (ch->dma.unload) { ch->dma.unload(request); } return ATA_OP_FINISHED; begin_continue: callout_reset(&request->callout, request->timeout * hz, (timeout_t*)ata_timeout, request); return ATA_OP_CONTINUES; } /* must be called with ATA channel locked and state_mtx held */ int ata_end_transaction(struct ata_request *request) { struct ata_channel *ch = device_get_softc(request->parent); int length; ATA_DEBUG_RQ(request, "end transaction"); /* clear interrupt and get status */ request->status = ATA_IDX_INB(ch, ATA_STATUS); switch (request->flags & (ATA_R_ATAPI | ATA_R_DMA | ATA_R_CONTROL)) { /* ATA PIO data transfer and control commands */ default: /* on timeouts we have no data or anything so just return */ if (request->flags & ATA_R_TIMEOUT) goto end_finished; /* Read back registers to the request struct. */ if ((request->status & ATA_S_ERROR) || (request->flags & (ATA_R_CONTROL | ATA_R_NEEDRESULT))) { ch->hw.tf_read(request); } /* if we got an error we are done with the HW */ if (request->status & ATA_S_ERROR) { request->error = ATA_IDX_INB(ch, ATA_ERROR); goto end_finished; } /* are we moving data ? */ if (request->flags & (ATA_R_READ | ATA_R_WRITE)) { /* if read data get it */ if (request->flags & ATA_R_READ) { int flags = ATA_S_DRQ; if (request->u.ata.command != ATA_ATAPI_IDENTIFY) flags |= ATA_S_READY; if (ata_wait(ch, request->unit, flags) < 0) { device_printf(request->parent, "timeout waiting for read DRQ\n"); request->result = EIO; goto end_finished; } ata_pio_read(request, request->transfersize); } /* update how far we've gotten */ request->donecount += request->transfersize; /* do we need a scoop more ? */ if (request->bytecount > request->donecount) { /* set this transfer size according to HW capabilities */ request->transfersize = min((request->bytecount - request->donecount), request->transfersize); /* if data write command, output the data */ if (request->flags & ATA_R_WRITE) { /* if we get an error here we are done with the HW */ if (ata_wait(ch, request->unit, (ATA_S_READY | ATA_S_DRQ)) < 0) { device_printf(request->parent, "timeout waiting for write DRQ\n"); request->status = ATA_IDX_INB(ch, ATA_STATUS); goto end_finished; } /* output data and return waiting for new interrupt */ ata_pio_write(request, request->transfersize); goto end_continue; } /* if data read command, return & wait for interrupt */ if (request->flags & ATA_R_READ) goto end_continue; } } /* done with HW */ goto end_finished; /* ATA DMA data transfer commands */ case ATA_R_DMA: /* stop DMA engine and get status */ if (ch->dma.stop) request->dma->status = ch->dma.stop(request); /* did we get error or data */ if (request->status & ATA_S_ERROR) request->error = ATA_IDX_INB(ch, ATA_ERROR); else if (request->dma->status & ATA_BMSTAT_ERROR) request->status |= ATA_S_ERROR; else if (!(request->flags & ATA_R_TIMEOUT)) request->donecount = request->bytecount; /* Read back registers to the request struct. */ if ((request->status & ATA_S_ERROR) || (request->flags & (ATA_R_CONTROL | ATA_R_NEEDRESULT))) { ch->hw.tf_read(request); } /* release SG list etc */ ch->dma.unload(request); /* done with HW */ goto end_finished; /* ATAPI PIO commands */ case ATA_R_ATAPI: length = ATA_IDX_INB(ch, ATA_CYL_LSB)|(ATA_IDX_INB(ch, ATA_CYL_MSB)<<8); /* on timeouts we have no data or anything so just return */ if (request->flags & ATA_R_TIMEOUT) goto end_finished; switch ((ATA_IDX_INB(ch, ATA_IREASON) & (ATA_I_CMD | ATA_I_IN)) | (request->status & ATA_S_DRQ)) { case ATAPI_P_CMDOUT: /* this seems to be needed for some (slow) devices */ DELAY(10); if (!(request->status & ATA_S_DRQ)) { device_printf(request->parent, "command interrupt without DRQ\n"); request->status = ATA_S_ERROR; goto end_finished; } ATA_IDX_OUTSW_STRM(ch, ATA_DATA, (int16_t *)request->u.atapi.ccb, (request->flags & ATA_R_ATAPI16) ? 8 : 6); /* return wait for interrupt */ goto end_continue; case ATAPI_P_WRITE: if (request->flags & ATA_R_READ) { request->status = ATA_S_ERROR; device_printf(request->parent, "%s trying to write on read buffer\n", ata_cmd2str(request)); goto end_finished; } ata_pio_write(request, length); request->donecount += length; /* set next transfer size according to HW capabilities */ request->transfersize = min((request->bytecount-request->donecount), request->transfersize); /* return wait for interrupt */ goto end_continue; case ATAPI_P_READ: if (request->flags & ATA_R_WRITE) { request->status = ATA_S_ERROR; device_printf(request->parent, "%s trying to read on write buffer\n", ata_cmd2str(request)); goto end_finished; } ata_pio_read(request, length); request->donecount += length; /* set next transfer size according to HW capabilities */ request->transfersize = min((request->bytecount-request->donecount), request->transfersize); /* return wait for interrupt */ goto end_continue; case ATAPI_P_DONEDRQ: device_printf(request->parent, "WARNING - %s DONEDRQ non conformant device\n", ata_cmd2str(request)); if (request->flags & ATA_R_READ) { ata_pio_read(request, length); request->donecount += length; } else if (request->flags & ATA_R_WRITE) { ata_pio_write(request, length); request->donecount += length; } else request->status = ATA_S_ERROR; /* FALLTHROUGH */ case ATAPI_P_ABORT: case ATAPI_P_DONE: if (request->status & (ATA_S_ERROR | ATA_S_DWF)) request->error = ATA_IDX_INB(ch, ATA_ERROR); goto end_finished; default: device_printf(request->parent, "unknown transfer phase\n"); request->status = ATA_S_ERROR; } /* done with HW */ goto end_finished; /* ATAPI DMA commands */ case ATA_R_ATAPI|ATA_R_DMA: /* stop DMA engine and get status */ if (ch->dma.stop) request->dma->status = ch->dma.stop(request); /* did we get error or data */ if (request->status & (ATA_S_ERROR | ATA_S_DWF)) request->error = ATA_IDX_INB(ch, ATA_ERROR); else if (request->dma->status & ATA_BMSTAT_ERROR) request->status |= ATA_S_ERROR; else if (!(request->flags & ATA_R_TIMEOUT)) request->donecount = request->bytecount; /* release SG list etc */ ch->dma.unload(request); /* done with HW */ goto end_finished; } /* NOT REACHED */ printf("ata_end_transaction OOPS!!\n"); end_finished: callout_stop(&request->callout); return ATA_OP_FINISHED; end_continue: return ATA_OP_CONTINUES; } /* must be called with ATA channel locked and state_mtx held */ void ata_generic_reset(device_t dev) { struct ata_channel *ch = device_get_softc(dev); u_int8_t ostat0 = 0, stat0 = 0, ostat1 = 0, stat1 = 0; u_int8_t err = 0, lsb = 0, msb = 0; int mask = 0, timeout; /* do we have any signs of ATA/ATAPI HW being present ? */ ATA_IDX_OUTB(ch, ATA_DRIVE, ATA_D_IBM | ATA_D_LBA | ATA_DEV(ATA_MASTER)); DELAY(10); ostat0 = ATA_IDX_INB(ch, ATA_STATUS); if (((ostat0 & 0xf8) != 0xf8 || (ch->flags & ATA_KNOWN_PRESENCE)) && ostat0 != 0xa5) { stat0 = ATA_S_BUSY; mask |= 0x01; } /* in some setups we dont want to test for a slave */ if (!(ch->flags & ATA_NO_SLAVE)) { ATA_IDX_OUTB(ch, ATA_DRIVE, ATA_D_IBM | ATA_D_LBA | ATA_DEV(ATA_SLAVE)); DELAY(10); ostat1 = ATA_IDX_INB(ch, ATA_STATUS); if (((ostat1 & 0xf8) != 0xf8 || (ch->flags & ATA_KNOWN_PRESENCE)) && ostat1 != 0xa5) { stat1 = ATA_S_BUSY; mask |= 0x02; } } if (bootverbose) device_printf(dev, "reset tp1 mask=%02x ostat0=%02x ostat1=%02x\n", mask, ostat0, ostat1); /* if nothing showed up there is no need to get any further */ /* XXX SOS is that too strong?, we just might loose devices here */ ch->devices = 0; if (!mask) return; /* reset (both) devices on this channel */ ATA_IDX_OUTB(ch, ATA_DRIVE, ATA_D_IBM | ATA_D_LBA | ATA_DEV(ATA_MASTER)); DELAY(10); ATA_IDX_OUTB(ch, ATA_CONTROL, ATA_A_IDS | ATA_A_RESET); ata_udelay(10000); ATA_IDX_OUTB(ch, ATA_CONTROL, ATA_A_IDS); ata_udelay(100000); ATA_IDX_INB(ch, ATA_ERROR); /* wait for BUSY to go inactive */ for (timeout = 0; timeout < 310; timeout++) { if ((mask & 0x01) && (stat0 & ATA_S_BUSY)) { ATA_IDX_OUTB(ch, ATA_DRIVE, ATA_D_IBM | ATA_DEV(ATA_MASTER)); DELAY(10); if (ch->flags & ATA_STATUS_IS_LONG) stat0 = ATA_IDX_INL(ch, ATA_STATUS) & 0xff; else stat0 = ATA_IDX_INB(ch, ATA_STATUS); err = ATA_IDX_INB(ch, ATA_ERROR); lsb = ATA_IDX_INB(ch, ATA_CYL_LSB); msb = ATA_IDX_INB(ch, ATA_CYL_MSB); if (bootverbose) device_printf(dev, "stat0=0x%02x err=0x%02x lsb=0x%02x msb=0x%02x\n", stat0, err, lsb, msb); if (stat0 == err && lsb == err && msb == err && timeout > (stat0 & ATA_S_BUSY ? 100 : 10)) mask &= ~0x01; if (!(stat0 & ATA_S_BUSY)) { if ((err & 0x7f) == ATA_E_ILI) { if (lsb == ATAPI_MAGIC_LSB && msb == ATAPI_MAGIC_MSB) { ch->devices |= ATA_ATAPI_MASTER; } else if (lsb == 0 && msb == 0 && (stat0 & ATA_S_READY)) { ch->devices |= ATA_ATA_MASTER; } } else if ((stat0 & 0x0f) && err == lsb && err == msb) { stat0 |= ATA_S_BUSY; } } } if ((mask & 0x02) && (stat1 & ATA_S_BUSY) && !((mask & 0x01) && (stat0 & ATA_S_BUSY))) { ATA_IDX_OUTB(ch, ATA_DRIVE, ATA_D_IBM | ATA_DEV(ATA_SLAVE)); DELAY(10); if (ch->flags & ATA_STATUS_IS_LONG) stat1 = ATA_IDX_INL(ch, ATA_STATUS) & 0xff; else stat1 = ATA_IDX_INB(ch, ATA_STATUS); err = ATA_IDX_INB(ch, ATA_ERROR); lsb = ATA_IDX_INB(ch, ATA_CYL_LSB); msb = ATA_IDX_INB(ch, ATA_CYL_MSB); if (bootverbose) device_printf(dev, "stat1=0x%02x err=0x%02x lsb=0x%02x msb=0x%02x\n", stat1, err, lsb, msb); if (stat1 == err && lsb == err && msb == err && timeout > (stat1 & ATA_S_BUSY ? 100 : 10)) mask &= ~0x02; if (!(stat1 & ATA_S_BUSY)) { if ((err & 0x7f) == ATA_E_ILI) { if (lsb == ATAPI_MAGIC_LSB && msb == ATAPI_MAGIC_MSB) { ch->devices |= ATA_ATAPI_SLAVE; } else if (lsb == 0 && msb == 0 && (stat1 & ATA_S_READY)) { ch->devices |= ATA_ATA_SLAVE; } } else if ((stat1 & 0x0f) && err == lsb && err == msb) { stat1 |= ATA_S_BUSY; } } } if ((ch->flags & ATA_KNOWN_PRESENCE) == 0 && timeout > ((mask == 0x03) ? 20 : 10)) { if ((mask & 0x01) && stat0 == 0xff) mask &= ~0x01; if ((mask & 0x02) && stat1 == 0xff) mask &= ~0x02; } if (((mask & 0x01) == 0 || !(stat0 & ATA_S_BUSY)) && ((mask & 0x02) == 0 || !(stat1 & ATA_S_BUSY))) break; ata_udelay(100000); } if (bootverbose) device_printf(dev, "reset tp2 stat0=%02x stat1=%02x devices=0x%x\n", stat0, stat1, ch->devices); } /* must be called with ATA channel locked and state_mtx held */ int ata_generic_status(device_t dev) { struct ata_channel *ch = device_get_softc(dev); if (ATA_IDX_INB(ch, ATA_ALTSTAT) & ATA_S_BUSY) { DELAY(100); if (ATA_IDX_INB(ch, ATA_ALTSTAT) & ATA_S_BUSY) return 0; } return 1; } static int ata_wait(struct ata_channel *ch, int unit, u_int8_t mask) { u_int8_t status; int timeout = 0; DELAY(1); /* wait at max 1 second for device to get !BUSY */ while (timeout < 1000000) { status = ATA_IDX_INB(ch, ATA_ALTSTAT); /* if drive fails status, reselect the drive and try again */ if (status == 0xff) { ATA_IDX_OUTB(ch, ATA_DRIVE, ATA_D_IBM | ATA_DEV(unit)); timeout += 1000; DELAY(1000); continue; } /* are we done ? */ if (!(status & ATA_S_BUSY)) break; if (timeout > 1000) { timeout += 1000; DELAY(1000); } else { timeout += 10; DELAY(10); } } if (timeout >= 1000000) return -2; if (!mask) return (status & ATA_S_ERROR); DELAY(1); /* wait 50 msec for bits wanted */ timeout = 5000; while (timeout--) { status = ATA_IDX_INB(ch, ATA_ALTSTAT); if ((status & mask) == mask) return (status & ATA_S_ERROR); DELAY(10); } return -3; } int ata_generic_command(struct ata_request *request) { struct ata_channel *ch = device_get_softc(request->parent); /* select device */ ATA_IDX_OUTB(ch, ATA_DRIVE, ATA_D_IBM | ATA_D_LBA | ATA_DEV(request->unit)); /* ready to issue command ? */ if (ata_wait(ch, request->unit, 0) < 0) { device_printf(request->parent, "timeout waiting to issue command\n"); request->flags |= ATA_R_TIMEOUT; return (-1); } /* enable interrupt */ ATA_IDX_OUTB(ch, ATA_CONTROL, ATA_A_4BIT); if (request->flags & ATA_R_ATAPI) { int timeout = 5000; int res; /* issue packet command to controller */ if (request->flags & ATA_R_DMA) { ATA_IDX_OUTB(ch, ATA_FEATURE, ATA_F_DMA); ATA_IDX_OUTB(ch, ATA_CYL_LSB, 0); ATA_IDX_OUTB(ch, ATA_CYL_MSB, 0); } else { ATA_IDX_OUTB(ch, ATA_FEATURE, 0); ATA_IDX_OUTB(ch, ATA_CYL_LSB, request->transfersize); ATA_IDX_OUTB(ch, ATA_CYL_MSB, request->transfersize >> 8); } ATA_IDX_OUTB(ch, ATA_COMMAND, ATA_PACKET_CMD); /* command interrupt device ? just return and wait for interrupt */ if (request->flags & ATA_R_ATAPI_INTR) return (0); /* command processed ? */ res = ata_wait(ch, request->unit, 0); if (res != 0) { if (res < 0) { device_printf(request->parent, "timeout waiting for PACKET command\n"); request->flags |= ATA_R_TIMEOUT; } return (-1); } /* wait for ready to write ATAPI command block */ while (timeout--) { int reason = ATA_IDX_INB(ch, ATA_IREASON); int status = ATA_IDX_INB(ch, ATA_STATUS); if (((reason & (ATA_I_CMD | ATA_I_IN)) | (status & (ATA_S_DRQ | ATA_S_BUSY))) == ATAPI_P_CMDOUT) break; DELAY(20); } if (timeout <= 0) { device_printf(request->parent, "timeout waiting for ATAPI ready\n"); request->flags |= ATA_R_TIMEOUT; return (-1); } /* this seems to be needed for some (slow) devices */ DELAY(10); /* output command block */ ATA_IDX_OUTSW_STRM(ch, ATA_DATA, (int16_t *)request->u.atapi.ccb, (request->flags & ATA_R_ATAPI16) ? 8 : 6); } else { ch->hw.tf_write(request); /* issue command to controller */ ATA_IDX_OUTB(ch, ATA_COMMAND, request->u.ata.command); } return (0); } static void ata_tf_read(struct ata_request *request) { struct ata_channel *ch = device_get_softc(request->parent); if (request->flags & ATA_R_48BIT) { ATA_IDX_OUTB(ch, ATA_CONTROL, ATA_A_4BIT | ATA_A_HOB); request->u.ata.count = (ATA_IDX_INB(ch, ATA_COUNT) << 8); request->u.ata.lba = ((u_int64_t)(ATA_IDX_INB(ch, ATA_SECTOR)) << 24) | ((u_int64_t)(ATA_IDX_INB(ch, ATA_CYL_LSB)) << 32) | ((u_int64_t)(ATA_IDX_INB(ch, ATA_CYL_MSB)) << 40); ATA_IDX_OUTB(ch, ATA_CONTROL, ATA_A_4BIT); request->u.ata.count |= ATA_IDX_INB(ch, ATA_COUNT); request->u.ata.lba |= (ATA_IDX_INB(ch, ATA_SECTOR) | (ATA_IDX_INB(ch, ATA_CYL_LSB) << 8) | (ATA_IDX_INB(ch, ATA_CYL_MSB) << 16)); } else { request->u.ata.count = ATA_IDX_INB(ch, ATA_COUNT); request->u.ata.lba = ATA_IDX_INB(ch, ATA_SECTOR) | (ATA_IDX_INB(ch, ATA_CYL_LSB) << 8) | (ATA_IDX_INB(ch, ATA_CYL_MSB) << 16) | ((ATA_IDX_INB(ch, ATA_DRIVE) & 0xf) << 24); } } static void ata_tf_write(struct ata_request *request) { struct ata_channel *ch = device_get_softc(request->parent); -#ifndef ATA_CAM - struct ata_device *atadev = device_get_softc(request->dev); -#endif if (request->flags & ATA_R_48BIT) { ATA_IDX_OUTB(ch, ATA_FEATURE, request->u.ata.feature >> 8); ATA_IDX_OUTB(ch, ATA_FEATURE, request->u.ata.feature); ATA_IDX_OUTB(ch, ATA_COUNT, request->u.ata.count >> 8); ATA_IDX_OUTB(ch, ATA_COUNT, request->u.ata.count); ATA_IDX_OUTB(ch, ATA_SECTOR, request->u.ata.lba >> 24); ATA_IDX_OUTB(ch, ATA_SECTOR, request->u.ata.lba); ATA_IDX_OUTB(ch, ATA_CYL_LSB, request->u.ata.lba >> 32); ATA_IDX_OUTB(ch, ATA_CYL_LSB, request->u.ata.lba >> 8); ATA_IDX_OUTB(ch, ATA_CYL_MSB, request->u.ata.lba >> 40); ATA_IDX_OUTB(ch, ATA_CYL_MSB, request->u.ata.lba >> 16); ATA_IDX_OUTB(ch, ATA_DRIVE, ATA_D_LBA | ATA_DEV(request->unit)); } else { ATA_IDX_OUTB(ch, ATA_FEATURE, request->u.ata.feature); ATA_IDX_OUTB(ch, ATA_COUNT, request->u.ata.count); -#ifndef ATA_CAM - if (atadev->flags & ATA_D_USE_CHS) { - int heads, sectors; - - if (atadev->param.atavalid & ATA_FLAG_54_58) { - heads = atadev->param.current_heads; - sectors = atadev->param.current_sectors; - } - else { - heads = atadev->param.heads; - sectors = atadev->param.sectors; - } - - ATA_IDX_OUTB(ch, ATA_SECTOR, (request->u.ata.lba % sectors)+1); - ATA_IDX_OUTB(ch, ATA_CYL_LSB, - (request->u.ata.lba / (sectors * heads))); - ATA_IDX_OUTB(ch, ATA_CYL_MSB, - (request->u.ata.lba / (sectors * heads)) >> 8); - ATA_IDX_OUTB(ch, ATA_DRIVE, ATA_D_IBM | ATA_DEV(request->unit) | - (((request->u.ata.lba% (sectors * heads)) / - sectors) & 0xf)); - } - else { -#endif ATA_IDX_OUTB(ch, ATA_SECTOR, request->u.ata.lba); ATA_IDX_OUTB(ch, ATA_CYL_LSB, request->u.ata.lba >> 8); ATA_IDX_OUTB(ch, ATA_CYL_MSB, request->u.ata.lba >> 16); ATA_IDX_OUTB(ch, ATA_DRIVE, ATA_D_IBM | ATA_D_LBA | ATA_DEV(request->unit) | ((request->u.ata.lba >> 24) & 0x0f)); -#ifndef ATA_CAM - } -#endif } } static void ata_pio_read(struct ata_request *request, int length) { struct ata_channel *ch = device_get_softc(request->parent); uint8_t *addr; int size = min(request->transfersize, length); int resid; uint8_t buf[2] __aligned(sizeof(int16_t)); #ifndef __NO_STRICT_ALIGNMENT int i; #endif addr = (uint8_t *)request->data + request->donecount; if (__predict_false(ch->flags & ATA_USE_16BIT || (size % sizeof(int32_t)) || ((uintptr_t)addr % sizeof(int32_t)))) { #ifndef __NO_STRICT_ALIGNMENT if (__predict_false((uintptr_t)addr % sizeof(int16_t))) { for (i = 0, resid = size & ~1; resid > 0; resid -= sizeof(int16_t)) { *(uint16_t *)&buf = ATA_IDX_INW_STRM(ch, ATA_DATA); addr[i++] = buf[0]; addr[i++] = buf[1]; } } else #endif ATA_IDX_INSW_STRM(ch, ATA_DATA, (void*)addr, size / sizeof(int16_t)); if (size & 1) { *(uint16_t *)&buf = ATA_IDX_INW_STRM(ch, ATA_DATA); (addr + (size & ~1))[0] = buf[0]; } } else ATA_IDX_INSL_STRM(ch, ATA_DATA, (void*)addr, size / sizeof(int32_t)); if (request->transfersize < length) { device_printf(request->parent, "WARNING - %s read data overrun %d>%d\n", ata_cmd2str(request), length, request->transfersize); for (resid = request->transfersize + (size & 1); resid < length; resid += sizeof(int16_t)) ATA_IDX_INW(ch, ATA_DATA); } } static void ata_pio_write(struct ata_request *request, int length) { struct ata_channel *ch = device_get_softc(request->parent); uint8_t *addr; int size = min(request->transfersize, length); int resid; uint8_t buf[2] __aligned(sizeof(int16_t)); #ifndef __NO_STRICT_ALIGNMENT int i; #endif size = min(request->transfersize, length); addr = (uint8_t *)request->data + request->donecount; if (__predict_false(ch->flags & ATA_USE_16BIT || (size % sizeof(int32_t)) || ((uintptr_t)addr % sizeof(int32_t)))) { #ifndef __NO_STRICT_ALIGNMENT if (__predict_false((uintptr_t)addr % sizeof(int16_t))) { for (i = 0, resid = size & ~1; resid > 0; resid -= sizeof(int16_t)) { buf[0] = addr[i++]; buf[1] = addr[i++]; ATA_IDX_OUTW_STRM(ch, ATA_DATA, *(uint16_t *)&buf); } } else #endif ATA_IDX_OUTSW_STRM(ch, ATA_DATA, (void*)addr, size / sizeof(int16_t)); if (size & 1) { buf[0] = (addr + (size & ~1))[0]; ATA_IDX_OUTW_STRM(ch, ATA_DATA, *(uint16_t *)&buf); } } else ATA_IDX_OUTSL_STRM(ch, ATA_DATA, (void*)addr, size / sizeof(int32_t)); if (request->transfersize < length) { device_printf(request->parent, "WARNING - %s write data underrun %d>%d\n", ata_cmd2str(request), length, request->transfersize); for (resid = request->transfersize + (size & 1); resid < length; resid += sizeof(int16_t)) ATA_IDX_OUTW(ch, ATA_DATA, 0); } } Index: head/sys/dev/ata/ata-pci.c =================================================================== --- head/sys/dev/ata/ata-pci.c (revision 249082) +++ head/sys/dev/ata/ata-pci.c (revision 249083) @@ -1,946 +1,928 @@ /*- * Copyright (c) 1998 - 2008 Søren Schmidt * 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. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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. */ #include __FBSDID("$FreeBSD$"); #include "opt_ata.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include MALLOC_DEFINE(M_ATAPCI, "ata_pci", "ATA driver PCI"); /* misc defines */ #define IOMASK 0xfffffffc /* * generic PCI ATA device probe */ int ata_pci_probe(device_t dev) { struct ata_pci_controller *ctlr = device_get_softc(dev); char buffer[64]; /* is this a storage class device ? */ if (pci_get_class(dev) != PCIC_STORAGE) return (ENXIO); /* is this an IDE/ATA type device ? */ if (pci_get_subclass(dev) != PCIS_STORAGE_IDE) return (ENXIO); sprintf(buffer, "%s ATA controller", ata_pcivendor2str(dev)); device_set_desc_copy(dev, buffer); ctlr->chipinit = ata_generic_chipinit; /* we are a low priority handler */ return (BUS_PROBE_GENERIC); } int ata_pci_attach(device_t dev) { struct ata_pci_controller *ctlr = device_get_softc(dev); device_t child; u_int32_t cmd; int unit; /* do chipset specific setups only needed once */ ctlr->legacy = ata_legacy(dev); if (ctlr->legacy || pci_read_config(dev, PCIR_BAR(2), 4) & IOMASK) ctlr->channels = 2; else ctlr->channels = 1; ctlr->ichannels = -1; ctlr->ch_attach = ata_pci_ch_attach; ctlr->ch_detach = ata_pci_ch_detach; ctlr->dev = dev; /* if needed try to enable busmastering */ cmd = pci_read_config(dev, PCIR_COMMAND, 2); if (!(cmd & PCIM_CMD_BUSMASTEREN)) { pci_write_config(dev, PCIR_COMMAND, cmd | PCIM_CMD_BUSMASTEREN, 2); cmd = pci_read_config(dev, PCIR_COMMAND, 2); } /* if busmastering mode "stuck" use it */ if ((cmd & PCIM_CMD_BUSMASTEREN) == PCIM_CMD_BUSMASTEREN) { ctlr->r_type1 = SYS_RES_IOPORT; ctlr->r_rid1 = ATA_BMADDR_RID; ctlr->r_res1 = bus_alloc_resource_any(dev, ctlr->r_type1, &ctlr->r_rid1, RF_ACTIVE); } if (ctlr->chipinit(dev)) return ENXIO; /* attach all channels on this controller */ for (unit = 0; unit < ctlr->channels; unit++) { if ((ctlr->ichannels & (1 << unit)) == 0) continue; child = device_add_child(dev, "ata", ((unit == 0 || unit == 1) && ctlr->legacy) ? unit : devclass_find_free_unit(ata_devclass, 2)); if (child == NULL) device_printf(dev, "failed to add ata child device\n"); else device_set_ivars(child, (void *)(intptr_t)unit); } bus_generic_attach(dev); return 0; } int ata_pci_detach(device_t dev) { struct ata_pci_controller *ctlr = device_get_softc(dev); /* detach & delete all children */ device_delete_children(dev); if (ctlr->r_irq) { bus_teardown_intr(dev, ctlr->r_irq, ctlr->handle); bus_release_resource(dev, SYS_RES_IRQ, ctlr->r_irq_rid, ctlr->r_irq); if (ctlr->r_irq_rid != ATA_IRQ_RID) pci_release_msi(dev); } if (ctlr->chipdeinit != NULL) ctlr->chipdeinit(dev); if (ctlr->r_res2) { #ifdef __sparc64__ bus_space_unmap(rman_get_bustag(ctlr->r_res2), rman_get_bushandle(ctlr->r_res2), rman_get_size(ctlr->r_res2)); #endif bus_release_resource(dev, ctlr->r_type2, ctlr->r_rid2, ctlr->r_res2); } if (ctlr->r_res1) { #ifdef __sparc64__ bus_space_unmap(rman_get_bustag(ctlr->r_res1), rman_get_bushandle(ctlr->r_res1), rman_get_size(ctlr->r_res1)); #endif bus_release_resource(dev, ctlr->r_type1, ctlr->r_rid1, ctlr->r_res1); } return 0; } int ata_pci_suspend(device_t dev) { struct ata_pci_controller *ctlr = device_get_softc(dev); int error = 0; bus_generic_suspend(dev); if (ctlr->suspend) error = ctlr->suspend(dev); return error; } int ata_pci_resume(device_t dev) { struct ata_pci_controller *ctlr = device_get_softc(dev); int error = 0; if (ctlr->resume) error = ctlr->resume(dev); bus_generic_resume(dev); return error; } int ata_pci_read_ivar(device_t dev, device_t child, int which, uintptr_t *result) { return (BUS_READ_IVAR(device_get_parent(dev), dev, which, result)); } int ata_pci_write_ivar(device_t dev, device_t child, int which, uintptr_t value) { return (BUS_WRITE_IVAR(device_get_parent(dev), dev, which, value)); } uint32_t ata_pci_read_config(device_t dev, device_t child, int reg, int width) { return (pci_read_config(dev, reg, width)); } void ata_pci_write_config(device_t dev, device_t child, int reg, uint32_t val, int width) { pci_write_config(dev, reg, val, width); } struct resource * ata_pci_alloc_resource(device_t dev, device_t child, int type, int *rid, u_long start, u_long end, u_long count, u_int flags) { struct ata_pci_controller *controller = device_get_softc(dev); struct resource *res = NULL; if (device_get_devclass(child) == ata_devclass) { int unit = ((struct ata_channel *)device_get_softc(child))->unit; int myrid; if (type == SYS_RES_IOPORT) { switch (*rid) { case ATA_IOADDR_RID: if (controller->legacy) { start = (unit ? ATA_SECONDARY : ATA_PRIMARY); count = ATA_IOSIZE; end = start + count - 1; } myrid = PCIR_BAR(0) + (unit << 3); res = BUS_ALLOC_RESOURCE(device_get_parent(dev), dev, SYS_RES_IOPORT, &myrid, start, end, count, flags); break; case ATA_CTLADDR_RID: if (controller->legacy) { start = (unit ? ATA_SECONDARY : ATA_PRIMARY) + ATA_CTLOFFSET; count = ATA_CTLIOSIZE; end = start + count - 1; } myrid = PCIR_BAR(1) + (unit << 3); res = BUS_ALLOC_RESOURCE(device_get_parent(dev), dev, SYS_RES_IOPORT, &myrid, start, end, count, flags); break; } } if (type == SYS_RES_IRQ && *rid == ATA_IRQ_RID) { if (controller->legacy) { int irq = (unit == 0 ? 14 : 15); res = BUS_ALLOC_RESOURCE(device_get_parent(dev), child, SYS_RES_IRQ, rid, irq, irq, 1, flags); } else res = controller->r_irq; } } else { if (type == SYS_RES_IRQ) { if (*rid != ATA_IRQ_RID) return (NULL); res = controller->r_irq; } else { res = BUS_ALLOC_RESOURCE(device_get_parent(dev), dev, type, rid, start, end, count, flags); } } return (res); } int ata_pci_release_resource(device_t dev, device_t child, int type, int rid, struct resource *r) { if (device_get_devclass(child) == ata_devclass) { struct ata_pci_controller *controller = device_get_softc(dev); int unit = ((struct ata_channel *)device_get_softc(child))->unit; if (type == SYS_RES_IOPORT) { switch (rid) { case ATA_IOADDR_RID: return BUS_RELEASE_RESOURCE(device_get_parent(dev), dev, SYS_RES_IOPORT, PCIR_BAR(0) + (unit << 3), r); case ATA_CTLADDR_RID: return BUS_RELEASE_RESOURCE(device_get_parent(dev), dev, SYS_RES_IOPORT, PCIR_BAR(1) + (unit << 3), r); default: return ENOENT; } } if (type == SYS_RES_IRQ) { if (rid != ATA_IRQ_RID) return ENOENT; if (controller->legacy) { return BUS_RELEASE_RESOURCE(device_get_parent(dev), child, SYS_RES_IRQ, rid, r); } else return 0; } } else { if (type == SYS_RES_IRQ) { if (rid != ATA_IRQ_RID) return (ENOENT); return (0); } else { return (BUS_RELEASE_RESOURCE(device_get_parent(dev), child, type, rid, r)); } } return (EINVAL); } int ata_pci_setup_intr(device_t dev, device_t child, struct resource *irq, int flags, driver_filter_t *filter, driver_intr_t *function, void *argument, void **cookiep) { struct ata_pci_controller *controller = device_get_softc(dev); if (controller->legacy) { return BUS_SETUP_INTR(device_get_parent(dev), child, irq, flags, filter, function, argument, cookiep); } else { struct ata_pci_controller *controller = device_get_softc(dev); int unit; if (filter != NULL) { printf("ata-pci.c: we cannot use a filter here\n"); return (EINVAL); } if (device_get_devclass(child) == ata_devclass) unit = ((struct ata_channel *)device_get_softc(child))->unit; else unit = ATA_PCI_MAX_CH - 1; controller->interrupt[unit].function = function; controller->interrupt[unit].argument = argument; *cookiep = controller; return 0; } } int ata_pci_teardown_intr(device_t dev, device_t child, struct resource *irq, void *cookie) { struct ata_pci_controller *controller = device_get_softc(dev); if (controller->legacy) { return BUS_TEARDOWN_INTR(device_get_parent(dev), child, irq, cookie); } else { struct ata_pci_controller *controller = device_get_softc(dev); int unit; if (device_get_devclass(child) == ata_devclass) unit = ((struct ata_channel *)device_get_softc(child))->unit; else unit = ATA_PCI_MAX_CH - 1; controller->interrupt[unit].function = NULL; controller->interrupt[unit].argument = NULL; return 0; } } int ata_generic_setmode(device_t dev, int target, int mode) { return (min(mode, ATA_UDMA2)); } int ata_generic_chipinit(device_t dev) { struct ata_pci_controller *ctlr = device_get_softc(dev); if (ata_setup_interrupt(dev, ata_generic_intr)) return ENXIO; ctlr->setmode = ata_generic_setmode; return 0; } int ata_pci_ch_attach(device_t dev) { struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev)); struct ata_channel *ch = device_get_softc(dev); struct resource *io = NULL, *ctlio = NULL; int i, rid; rid = ATA_IOADDR_RID; if (!(io = bus_alloc_resource_any(dev, SYS_RES_IOPORT, &rid, RF_ACTIVE))) return ENXIO; rid = ATA_CTLADDR_RID; if (!(ctlio = bus_alloc_resource_any(dev, SYS_RES_IOPORT, &rid,RF_ACTIVE))){ bus_release_resource(dev, SYS_RES_IOPORT, ATA_IOADDR_RID, io); return ENXIO; } ata_pci_dmainit(dev); for (i = ATA_DATA; i <= ATA_COMMAND; i ++) { ch->r_io[i].res = io; ch->r_io[i].offset = i; } ch->r_io[ATA_CONTROL].res = ctlio; ch->r_io[ATA_CONTROL].offset = ctlr->legacy ? 0 : 2; ch->r_io[ATA_IDX_ADDR].res = io; ata_default_registers(dev); if (ctlr->r_res1) { for (i = ATA_BMCMD_PORT; i <= ATA_BMDTP_PORT; i++) { ch->r_io[i].res = ctlr->r_res1; ch->r_io[i].offset = (i - ATA_BMCMD_PORT) + (ch->unit*ATA_BMIOSIZE); } } ata_pci_hw(dev); return 0; } int ata_pci_ch_detach(device_t dev) { struct ata_channel *ch = device_get_softc(dev); ata_pci_dmafini(dev); bus_release_resource(dev, SYS_RES_IOPORT, ATA_CTLADDR_RID, ch->r_io[ATA_CONTROL].res); bus_release_resource(dev, SYS_RES_IOPORT, ATA_IOADDR_RID, ch->r_io[ATA_IDX_ADDR].res); return (0); } int ata_pci_status(device_t dev) { struct ata_pci_controller *controller = device_get_softc(device_get_parent(dev)); struct ata_channel *ch = device_get_softc(dev); if ((dumping || !controller->legacy) && ((ch->flags & ATA_ALWAYS_DMASTAT) || (ch->dma.flags & ATA_DMA_ACTIVE))) { int bmstat = ATA_IDX_INB(ch, ATA_BMSTAT_PORT) & ATA_BMSTAT_MASK; if ((bmstat & ATA_BMSTAT_INTERRUPT) == 0) return 0; ATA_IDX_OUTB(ch, ATA_BMSTAT_PORT, bmstat & ~ATA_BMSTAT_ERROR); DELAY(1); } if (ATA_IDX_INB(ch, ATA_ALTSTAT) & ATA_S_BUSY) { DELAY(100); if (ATA_IDX_INB(ch, ATA_ALTSTAT) & ATA_S_BUSY) return 0; } return 1; } void ata_pci_hw(device_t dev) { struct ata_channel *ch = device_get_softc(dev); ata_generic_hw(dev); ch->hw.status = ata_pci_status; } static int ata_pci_dmastart(struct ata_request *request) { struct ata_channel *ch = device_get_softc(request->parent); ATA_DEBUG_RQ(request, "dmastart"); ATA_IDX_OUTB(ch, ATA_BMSTAT_PORT, (ATA_IDX_INB(ch, ATA_BMSTAT_PORT) | (ATA_BMSTAT_INTERRUPT | ATA_BMSTAT_ERROR))); ATA_IDX_OUTL(ch, ATA_BMDTP_PORT, request->dma->sg_bus); ch->dma.flags |= ATA_DMA_ACTIVE; ATA_IDX_OUTB(ch, ATA_BMCMD_PORT, (ATA_IDX_INB(ch, ATA_BMCMD_PORT) & ~ATA_BMCMD_WRITE_READ) | ((request->flags & ATA_R_READ) ? ATA_BMCMD_WRITE_READ : 0)| ATA_BMCMD_START_STOP); return 0; } static int ata_pci_dmastop(struct ata_request *request) { struct ata_channel *ch = device_get_softc(request->parent); int error; ATA_DEBUG_RQ(request, "dmastop"); ATA_IDX_OUTB(ch, ATA_BMCMD_PORT, ATA_IDX_INB(ch, ATA_BMCMD_PORT) & ~ATA_BMCMD_START_STOP); ch->dma.flags &= ~ATA_DMA_ACTIVE; error = ATA_IDX_INB(ch, ATA_BMSTAT_PORT) & ATA_BMSTAT_MASK; ATA_IDX_OUTB(ch, ATA_BMSTAT_PORT, ATA_BMSTAT_INTERRUPT | ATA_BMSTAT_ERROR); return error; } static void ata_pci_dmareset(device_t dev) { struct ata_channel *ch = device_get_softc(dev); struct ata_request *request; ATA_IDX_OUTB(ch, ATA_BMCMD_PORT, ATA_IDX_INB(ch, ATA_BMCMD_PORT) & ~ATA_BMCMD_START_STOP); ch->dma.flags &= ~ATA_DMA_ACTIVE; ATA_IDX_OUTB(ch, ATA_BMSTAT_PORT, ATA_BMSTAT_INTERRUPT | ATA_BMSTAT_ERROR); if ((request = ch->running)) { device_printf(dev, "DMA reset calling unload\n"); ch->dma.unload(request); } } void ata_pci_dmainit(device_t dev) { struct ata_channel *ch = device_get_softc(dev); ata_dmainit(dev); ch->dma.start = ata_pci_dmastart; ch->dma.stop = ata_pci_dmastop; ch->dma.reset = ata_pci_dmareset; } void ata_pci_dmafini(device_t dev) { ata_dmafini(dev); } int ata_pci_print_child(device_t dev, device_t child) { int retval; retval = bus_print_child_header(dev, child); retval += printf(" at channel %d", (int)(intptr_t)device_get_ivars(child)); retval += bus_print_child_footer(dev, child); return (retval); } int ata_pci_child_location_str(device_t dev, device_t child, char *buf, size_t buflen) { snprintf(buf, buflen, "channel=%d", (int)(intptr_t)device_get_ivars(child)); return (0); } static device_method_t ata_pci_methods[] = { /* device interface */ DEVMETHOD(device_probe, ata_pci_probe), DEVMETHOD(device_attach, ata_pci_attach), DEVMETHOD(device_detach, ata_pci_detach), DEVMETHOD(device_suspend, ata_pci_suspend), DEVMETHOD(device_resume, ata_pci_resume), DEVMETHOD(device_shutdown, bus_generic_shutdown), /* bus methods */ DEVMETHOD(bus_read_ivar, ata_pci_read_ivar), DEVMETHOD(bus_write_ivar, ata_pci_write_ivar), DEVMETHOD(bus_alloc_resource, ata_pci_alloc_resource), DEVMETHOD(bus_release_resource, ata_pci_release_resource), DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), DEVMETHOD(bus_setup_intr, ata_pci_setup_intr), DEVMETHOD(bus_teardown_intr, ata_pci_teardown_intr), DEVMETHOD(pci_read_config, ata_pci_read_config), DEVMETHOD(pci_write_config, ata_pci_write_config), DEVMETHOD(bus_print_child, ata_pci_print_child), DEVMETHOD(bus_child_location_str, ata_pci_child_location_str), DEVMETHOD_END }; devclass_t ata_pci_devclass; static driver_t ata_pci_driver = { "atapci", ata_pci_methods, sizeof(struct ata_pci_controller), }; DRIVER_MODULE(atapci, pci, ata_pci_driver, ata_pci_devclass, NULL, NULL); MODULE_VERSION(atapci, 1); MODULE_DEPEND(atapci, ata, 1, 1, 1); static int ata_pcichannel_probe(device_t dev) { if ((intptr_t)device_get_ivars(dev) < 0) return (ENXIO); device_set_desc(dev, "ATA channel"); return ata_probe(dev); } static int ata_pcichannel_attach(device_t dev) { struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev)); struct ata_channel *ch = device_get_softc(dev); int error; if (ch->attached) return (0); ch->attached = 1; ch->dev = dev; ch->unit = (intptr_t)device_get_ivars(dev); resource_int_value(device_get_name(dev), device_get_unit(dev), "pm_level", &ch->pm_level); if ((error = ctlr->ch_attach(dev))) return error; return ata_attach(dev); } static int ata_pcichannel_detach(device_t dev) { struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev)); struct ata_channel *ch = device_get_softc(dev); int error; if (!ch->attached) return (0); ch->attached = 0; if ((error = ata_detach(dev))) return error; if (ctlr->ch_detach) return (ctlr->ch_detach(dev)); return (0); } static int ata_pcichannel_suspend(device_t dev) { struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev)); struct ata_channel *ch = device_get_softc(dev); int error; if (!ch->attached) return (0); if ((error = ata_suspend(dev))) return (error); if (ctlr->ch_suspend != NULL && (error = ctlr->ch_suspend(dev))) return (error); return (0); } static int ata_pcichannel_resume(device_t dev) { struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev)); struct ata_channel *ch = device_get_softc(dev); int error; if (!ch->attached) return (0); if (ctlr->ch_resume != NULL && (error = ctlr->ch_resume(dev))) return (error); return ata_resume(dev); } - -#ifndef ATA_CAM -static int -ata_pcichannel_locking(device_t dev, int mode) -{ - struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev)); - struct ata_channel *ch = device_get_softc(dev); - - if (ctlr->locking) - return ctlr->locking(dev, mode); - else - return ch->unit; -} -#endif - static void ata_pcichannel_reset(device_t dev) { struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev)); struct ata_channel *ch = device_get_softc(dev); /* if DMA engine present reset it */ if (ch->dma.reset) ch->dma.reset(dev); /* reset the controller HW */ if (ctlr->reset) ctlr->reset(dev); else ata_generic_reset(dev); } static int ata_pcichannel_setmode(device_t dev, int target, int mode) { struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev)); if (ctlr->setmode) return (ctlr->setmode(dev, target, mode)); else return (ata_generic_setmode(dev, target, mode)); } static int ata_pcichannel_getrev(device_t dev, int target) { struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev)); struct ata_channel *ch = device_get_softc(dev); if (ch->flags & ATA_SATA) { if (ctlr->getrev) return (ctlr->getrev(dev, target)); else return (0xff); } else return (0); } static device_method_t ata_pcichannel_methods[] = { /* device interface */ DEVMETHOD(device_probe, ata_pcichannel_probe), DEVMETHOD(device_attach, ata_pcichannel_attach), DEVMETHOD(device_detach, ata_pcichannel_detach), DEVMETHOD(device_shutdown, bus_generic_shutdown), DEVMETHOD(device_suspend, ata_pcichannel_suspend), DEVMETHOD(device_resume, ata_pcichannel_resume), /* 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), DEVMETHOD_END }; driver_t ata_pcichannel_driver = { "ata", ata_pcichannel_methods, sizeof(struct ata_channel), }; DRIVER_MODULE(ata, atapci, ata_pcichannel_driver, ata_devclass, NULL, NULL); /* * misc support fucntions */ int ata_legacy(device_t dev) { return (((pci_read_config(dev, PCIR_SUBCLASS, 1) == PCIS_STORAGE_IDE) && (pci_read_config(dev, PCIR_PROGIF, 1)&PCIP_STORAGE_IDE_MASTERDEV)&& ((pci_read_config(dev, PCIR_PROGIF, 1) & (PCIP_STORAGE_IDE_MODEPRIM | PCIP_STORAGE_IDE_MODESEC)) != (PCIP_STORAGE_IDE_MODEPRIM | PCIP_STORAGE_IDE_MODESEC))) || (!pci_read_config(dev, PCIR_BAR(0), 4) && !pci_read_config(dev, PCIR_BAR(1), 4) && !pci_read_config(dev, PCIR_BAR(2), 4) && !pci_read_config(dev, PCIR_BAR(3), 4) && !pci_read_config(dev, PCIR_BAR(5), 4))); } void ata_generic_intr(void *data) { struct ata_pci_controller *ctlr = data; struct ata_channel *ch; int unit; for (unit = 0; unit < ATA_PCI_MAX_CH; unit++) { if ((ch = ctlr->interrupt[unit].argument)) ctlr->interrupt[unit].function(ch); } } int ata_setup_interrupt(device_t dev, void *intr_func) { struct ata_pci_controller *ctlr = device_get_softc(dev); int i, msi = 0; if (!ctlr->legacy) { if (resource_int_value(device_get_name(dev), device_get_unit(dev), "msi", &i) == 0 && i != 0) msi = 1; if (msi && pci_msi_count(dev) > 0 && pci_alloc_msi(dev, &msi) == 0) { ctlr->r_irq_rid = 0x1; } else { msi = 0; ctlr->r_irq_rid = ATA_IRQ_RID; } if (!(ctlr->r_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &ctlr->r_irq_rid, RF_SHAREABLE | RF_ACTIVE))) { device_printf(dev, "unable to map interrupt\n"); if (msi) pci_release_msi(dev); return ENXIO; } if ((bus_setup_intr(dev, ctlr->r_irq, ATA_INTR_FLAGS, NULL, intr_func, ctlr, &ctlr->handle))) { device_printf(dev, "unable to setup interrupt\n"); bus_release_resource(dev, SYS_RES_IRQ, ctlr->r_irq_rid, ctlr->r_irq); if (msi) pci_release_msi(dev); return ENXIO; } } return 0; } void ata_set_desc(device_t dev) { struct ata_pci_controller *ctlr = device_get_softc(dev); char buffer[128]; sprintf(buffer, "%s %s %s controller", ata_pcivendor2str(dev), ctlr->chip->text, ata_mode2str(ctlr->chip->max_dma)); device_set_desc_copy(dev, buffer); } const struct ata_chip_id * ata_match_chip(device_t dev, const struct ata_chip_id *index) { uint32_t devid; uint8_t revid; devid = pci_get_devid(dev); revid = pci_get_revid(dev); while (index->chipid != 0) { if (devid == index->chipid && revid >= index->chiprev) return (index); index++; } return (NULL); } const struct ata_chip_id * ata_find_chip(device_t dev, const struct ata_chip_id *index, int slot) { const struct ata_chip_id *idx; device_t *children; int nchildren, i; uint8_t s; if (device_get_children(device_get_parent(dev), &children, &nchildren)) return (NULL); for (i = 0; i < nchildren; i++) { s = pci_get_slot(children[i]); if ((slot >= 0 && s == slot) || (slot < 0 && s <= -slot)) { idx = ata_match_chip(children[i], index); if (idx != NULL) { free(children, M_TEMP); return (idx); } } } free(children, M_TEMP); return (NULL); } const char * ata_pcivendor2str(device_t dev) { switch (pci_get_vendor(dev)) { case ATA_ACARD_ID: return "Acard"; case ATA_ACER_LABS_ID: return "AcerLabs"; case ATA_AMD_ID: return "AMD"; case ATA_ADAPTEC_ID: return "Adaptec"; case ATA_ATI_ID: return "ATI"; case ATA_CYRIX_ID: return "Cyrix"; case ATA_CYPRESS_ID: return "Cypress"; case ATA_HIGHPOINT_ID: return "HighPoint"; case ATA_INTEL_ID: return "Intel"; case ATA_ITE_ID: return "ITE"; case ATA_JMICRON_ID: return "JMicron"; case ATA_MARVELL_ID: return "Marvell"; case ATA_MARVELL2_ID: return "Marvell"; case ATA_NATIONAL_ID: return "National"; case ATA_NETCELL_ID: return "Netcell"; case ATA_NVIDIA_ID: return "nVidia"; case ATA_PROMISE_ID: return "Promise"; case ATA_SERVERWORKS_ID: return "ServerWorks"; case ATA_SILICON_IMAGE_ID: return "SiI"; case ATA_SIS_ID: return "SiS"; case ATA_VIA_ID: return "VIA"; case ATA_CENATEK_ID: return "Cenatek"; case ATA_MICRON_ID: return "Micron"; default: return "Generic"; } } int ata_mode2idx(int mode) { if ((mode & ATA_DMA_MASK) == ATA_UDMA0) return (mode & ATA_MODE_MASK) + 8; if ((mode & ATA_DMA_MASK) == ATA_WDMA0) return (mode & ATA_MODE_MASK) + 5; return (mode & ATA_MODE_MASK) - ATA_PIO0; } Index: head/sys/dev/ata/ata-pci.h =================================================================== --- head/sys/dev/ata/ata-pci.h (revision 249082) +++ head/sys/dev/ata/ata-pci.h (revision 249083) @@ -1,644 +1,641 @@ /*- * Copyright (c) 2003 - 2008 Søren Schmidt * 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. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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. * * $FreeBSD$ */ /* structure holding chipset config info */ struct ata_chip_id { u_int32_t chipid; u_int8_t chiprev; int cfg1; int cfg2; u_int8_t max_dma; const char *text; }; #define ATA_PCI_MAX_CH 8 /* structure describing a PCI ATA controller */ struct ata_pci_controller { device_t dev; int r_type1; int r_rid1; struct resource *r_res1; int r_type2; int r_rid2; struct resource *r_res2; int r_irq_rid; struct resource *r_irq; void *handle; const struct ata_chip_id *chip; int legacy; int channels; int ichannels; int (*chipinit)(device_t); int (*chipdeinit)(device_t); int (*suspend)(device_t); int (*resume)(device_t); int (*ch_attach)(device_t); 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); struct { void (*function)(void *); void *argument; } interrupt[ATA_PCI_MAX_CH]; void *chipset_data; }; /* defines for known chipset PCI id's */ #define ATA_ACARD_ID 0x1191 #define ATA_ATP850 0x00021191 #define ATA_ATP850A 0x00041191 #define ATA_ATP850R 0x00051191 #define ATA_ATP860A 0x00061191 #define ATA_ATP860R 0x00071191 #define ATA_ATP865A 0x00081191 #define ATA_ATP865R 0x00091191 #define ATA_ACER_LABS_ID 0x10b9 #define ATA_ALI_1533 0x153310b9 #define ATA_ALI_5228 0x522810b9 #define ATA_ALI_5229 0x522910b9 #define ATA_ALI_5281 0x528110b9 #define ATA_ALI_5287 0x528710b9 #define ATA_ALI_5288 0x528810b9 #define ATA_ALI_5289 0x528910b9 #define ATA_AMD_ID 0x1022 #define ATA_AMD755 0x74011022 #define ATA_AMD756 0x74091022 #define ATA_AMD766 0x74111022 #define ATA_AMD768 0x74411022 #define ATA_AMD8111 0x74691022 #define ATA_AMD5536 0x209a1022 #define ATA_AMD_HUDSON2_S1 0x78001022 #define ATA_AMD_HUDSON2_S2 0x78011022 #define ATA_AMD_HUDSON2_S3 0x78021022 #define ATA_AMD_HUDSON2_S4 0x78031022 #define ATA_AMD_HUDSON2_S5 0x78041022 #define ATA_AMD_HUDSON2 0x780c1022 #define ATA_ADAPTEC_ID 0x9005 #define ATA_ADAPTEC_1420 0x02419005 #define ATA_ADAPTEC_1430 0x02439005 #define ATA_ATI_ID 0x1002 #define ATA_ATI_IXP200 0x43491002 #define ATA_ATI_IXP300 0x43691002 #define ATA_ATI_IXP300_S1 0x436e1002 #define ATA_ATI_IXP400 0x43761002 #define ATA_ATI_IXP400_S1 0x43791002 #define ATA_ATI_IXP400_S2 0x437a1002 #define ATA_ATI_IXP600 0x438c1002 #define ATA_ATI_IXP600_S1 0x43801002 #define ATA_ATI_IXP700 0x439c1002 #define ATA_ATI_IXP700_S1 0x43901002 #define ATA_ATI_IXP700_S2 0x43911002 #define ATA_ATI_IXP700_S3 0x43921002 #define ATA_ATI_IXP700_S4 0x43931002 #define ATA_ATI_IXP800_S1 0x43941002 #define ATA_ATI_IXP800_S2 0x43951002 #define ATA_CENATEK_ID 0x16ca #define ATA_CENATEK_ROCKET 0x000116ca #define ATA_CYRIX_ID 0x1078 #define ATA_CYRIX_5530 0x01021078 #define ATA_CYPRESS_ID 0x1080 #define ATA_CYPRESS_82C693 0xc6931080 #define ATA_DEC_21150 0x00221011 #define ATA_DEC_21150_1 0x00231011 #define ATA_HIGHPOINT_ID 0x1103 #define ATA_HPT366 0x00041103 #define ATA_HPT372 0x00051103 #define ATA_HPT302 0x00061103 #define ATA_HPT371 0x00071103 #define ATA_HPT374 0x00081103 #define ATA_INTEL_ID 0x8086 #define ATA_I960RM 0x09628086 #define ATA_I82371FB 0x12308086 #define ATA_I82371SB 0x70108086 #define ATA_I82371AB 0x71118086 #define ATA_I82443MX 0x71998086 #define ATA_I82451NX 0x84ca8086 #define ATA_I82372FB 0x76018086 #define ATA_I82801AB 0x24218086 #define ATA_I82801AA 0x24118086 #define ATA_I82801BA 0x244a8086 #define ATA_I82801BA_1 0x244b8086 #define ATA_I82801CA 0x248a8086 #define ATA_I82801CA_1 0x248b8086 #define ATA_I82801DB 0x24cb8086 #define ATA_I82801DB_1 0x24ca8086 #define ATA_I82801EB 0x24db8086 #define ATA_I82801EB_S1 0x24d18086 #define ATA_I82801EB_R1 0x24df8086 #define ATA_I6300ESB 0x25a28086 #define ATA_I6300ESB_S1 0x25a38086 #define ATA_I6300ESB_R1 0x25b08086 #define ATA_I63XXESB2 0x269e8086 #define ATA_I63XXESB2_S1 0x26808086 #define ATA_I63XXESB2_S2 0x26818086 #define ATA_I63XXESB2_R1 0x26828086 #define ATA_I63XXESB2_R2 0x26838086 #define ATA_I82801FB 0x266f8086 #define ATA_I82801FB_S1 0x26518086 #define ATA_I82801FB_R1 0x26528086 #define ATA_I82801FBM 0x26538086 #define ATA_I82801GB 0x27df8086 #define ATA_I82801GB_S1 0x27c08086 #define ATA_I82801GB_AH 0x27c18086 #define ATA_I82801GB_R1 0x27c38086 #define ATA_I82801GBM_S1 0x27c48086 #define ATA_I82801GBM_AH 0x27c58086 #define ATA_I82801GBM_R1 0x27c68086 #define ATA_I82801HB_S1 0x28208086 #define ATA_I82801HB_AH6 0x28218086 #define ATA_I82801HB_R1 0x28228086 #define ATA_I82801HB_AH4 0x28248086 #define ATA_I82801HB_S2 0x28258086 #define ATA_I82801HBM 0x28508086 #define ATA_I82801HBM_S1 0x28288086 #define ATA_I82801HBM_S2 0x28298086 #define ATA_I82801HBM_S3 0x282a8086 #define ATA_I82801IB_S1 0x29208086 #define ATA_I82801IB_S3 0x29218086 #define ATA_I82801IB_AH6 0x29228086 #define ATA_I82801IB_AH4 0x29238086 #define ATA_I82801IB_R1 0x29258086 #define ATA_I82801IB_S2 0x29268086 #define ATA_I82801IBM_S1 0x29288086 #define ATA_I82801IBM_AH 0x29298086 #define ATA_I82801IBM_R1 0x292a8086 #define ATA_I82801IBM_S2 0x292d8086 #define ATA_I82801JIB_S1 0x3a208086 #define ATA_I82801JIB_AH 0x3a228086 #define ATA_I82801JIB_R1 0x3a258086 #define ATA_I82801JIB_S2 0x3a268086 #define ATA_I82801JD_S1 0x3a008086 #define ATA_I82801JD_AH 0x3a028086 #define ATA_I82801JD_R1 0x3a058086 #define ATA_I82801JD_S2 0x3a068086 #define ATA_I82801JI_S1 0x3a208086 #define ATA_I82801JI_AH 0x3a228086 #define ATA_I82801JI_R1 0x3a258086 #define ATA_I82801JI_S2 0x3a268086 #define ATA_5Series_S1 0x3b208086 #define ATA_5Series_S2 0x3b218086 #define ATA_5Series_AH1 0x3b228086 #define ATA_5Series_AH2 0x3b238086 #define ATA_5Series_R1 0x3b258086 #define ATA_5Series_S3 0x3b268086 #define ATA_5Series_S4 0x3b288086 #define ATA_5Series_AH3 0x3b298086 #define ATA_5Series_R2 0x3b2c8086 #define ATA_5Series_S5 0x3b2d8086 #define ATA_5Series_S6 0x3b2e8086 #define ATA_5Series_AH4 0x3b2f8086 #define ATA_CPT_S1 0x1c008086 #define ATA_CPT_S2 0x1c018086 #define ATA_CPT_AH1 0x1c028086 #define ATA_CPT_AH2 0x1c038086 #define ATA_CPT_R1 0x1c048086 #define ATA_CPT_R2 0x1c058086 #define ATA_CPT_S3 0x1c088086 #define ATA_CPT_S4 0x1c098086 #define ATA_PBG_S1 0x1d008086 #define ATA_PBG_AH1 0x1d028086 #define ATA_PBG_R1 0x1d048086 #define ATA_PBG_R2 0x1d068086 #define ATA_PBG_R3 0x28268086 #define ATA_PBG_S2 0x1d088086 #define ATA_PPT_S1 0x1e008086 #define ATA_PPT_S2 0x1e018086 #define ATA_PPT_AH1 0x1e028086 #define ATA_PPT_AH2 0x1e038086 #define ATA_PPT_R1 0x1e048086 #define ATA_PPT_R2 0x1e058086 #define ATA_PPT_R3 0x1e068086 #define ATA_PPT_R4 0x1e078086 #define ATA_PPT_S3 0x1e088086 #define ATA_PPT_S4 0x1e098086 #define ATA_PPT_R5 0x1e0e8086 #define ATA_PPT_R6 0x1e0f8086 #define ATA_LPT_S1 0x8c008086 #define ATA_LPT_S2 0x8c018086 #define ATA_LPT_AH1 0x8c028086 #define ATA_LPT_AH2 0x8c038086 #define ATA_LPT_R1 0x8c048086 #define ATA_LPT_R2 0x8c058086 #define ATA_LPT_R3 0x8c068086 #define ATA_LPT_R4 0x8c078086 #define ATA_LPT_S3 0x8c088086 #define ATA_LPT_S4 0x8c098086 #define ATA_LPT_R5 0x8c0e8086 #define ATA_LPT_R6 0x8c0f8086 #define ATA_I31244 0x32008086 #define ATA_ISCH 0x811a8086 #define ATA_DH89XXCC 0x23238086 #define ATA_ITE_ID 0x1283 #define ATA_IT8211F 0x82111283 #define ATA_IT8212F 0x82121283 #define ATA_IT8213F 0x82131283 #define ATA_JMICRON_ID 0x197b #define ATA_JMB360 0x2360197b #define ATA_JMB361 0x2361197b #define ATA_JMB362 0x2362197b #define ATA_JMB363 0x2363197b #define ATA_JMB365 0x2365197b #define ATA_JMB366 0x2366197b #define ATA_JMB368 0x2368197b #define ATA_MARVELL_ID 0x11ab #define ATA_M88SX5040 0x504011ab #define ATA_M88SX5041 0x504111ab #define ATA_M88SX5080 0x508011ab #define ATA_M88SX5081 0x508111ab #define ATA_M88SX6041 0x604111ab #define ATA_M88SX6042 0x604211ab #define ATA_M88SX6081 0x608111ab #define ATA_M88SX7042 0x704211ab #define ATA_M88SE6101 0x610111ab #define ATA_M88SE6102 0x610211ab #define ATA_M88SE6111 0x611111ab #define ATA_M88SE6121 0x612111ab #define ATA_M88SE6141 0x614111ab #define ATA_M88SE6145 0x614511ab #define ATA_MARVELL2_ID 0x1b4b #define ATA_MICRON_ID 0x1042 #define ATA_MICRON_RZ1000 0x10001042 #define ATA_MICRON_RZ1001 0x10011042 #define ATA_NATIONAL_ID 0x100b #define ATA_SC1100 0x0502100b #define ATA_NETCELL_ID 0x169c #define ATA_NETCELL_SR 0x0044169c #define ATA_NVIDIA_ID 0x10de #define ATA_NFORCE1 0x01bc10de #define ATA_NFORCE2 0x006510de #define ATA_NFORCE2_PRO 0x008510de #define ATA_NFORCE2_PRO_S1 0x008e10de #define ATA_NFORCE3 0x00d510de #define ATA_NFORCE3_PRO 0x00e510de #define ATA_NFORCE3_PRO_S1 0x00e310de #define ATA_NFORCE3_PRO_S2 0x00ee10de #define ATA_NFORCE_MCP04 0x003510de #define ATA_NFORCE_MCP04_S1 0x003610de #define ATA_NFORCE_MCP04_S2 0x003e10de #define ATA_NFORCE_CK804 0x005310de #define ATA_NFORCE_CK804_S1 0x005410de #define ATA_NFORCE_CK804_S2 0x005510de #define ATA_NFORCE_MCP51 0x026510de #define ATA_NFORCE_MCP51_S1 0x026610de #define ATA_NFORCE_MCP51_S2 0x026710de #define ATA_NFORCE_MCP55 0x036e10de #define ATA_NFORCE_MCP55_S1 0x037e10de #define ATA_NFORCE_MCP55_S2 0x037f10de #define ATA_NFORCE_MCP61 0x03ec10de #define ATA_NFORCE_MCP61_S1 0x03e710de #define ATA_NFORCE_MCP61_S2 0x03f610de #define ATA_NFORCE_MCP61_S3 0x03f710de #define ATA_NFORCE_MCP65 0x044810de #define ATA_NFORCE_MCP65_A0 0x044c10de #define ATA_NFORCE_MCP65_A1 0x044d10de #define ATA_NFORCE_MCP65_A2 0x044e10de #define ATA_NFORCE_MCP65_A3 0x044f10de #define ATA_NFORCE_MCP65_A4 0x045c10de #define ATA_NFORCE_MCP65_A5 0x045d10de #define ATA_NFORCE_MCP65_A6 0x045e10de #define ATA_NFORCE_MCP65_A7 0x045f10de #define ATA_NFORCE_MCP67 0x056010de #define ATA_NFORCE_MCP67_A0 0x055010de #define ATA_NFORCE_MCP67_A1 0x055110de #define ATA_NFORCE_MCP67_A2 0x055210de #define ATA_NFORCE_MCP67_A3 0x055310de #define ATA_NFORCE_MCP67_A4 0x055410de #define ATA_NFORCE_MCP67_A5 0x055510de #define ATA_NFORCE_MCP67_A6 0x055610de #define ATA_NFORCE_MCP67_A7 0x055710de #define ATA_NFORCE_MCP67_A8 0x055810de #define ATA_NFORCE_MCP67_A9 0x055910de #define ATA_NFORCE_MCP67_AA 0x055A10de #define ATA_NFORCE_MCP67_AB 0x055B10de #define ATA_NFORCE_MCP67_AC 0x058410de #define ATA_NFORCE_MCP73 0x056c10de #define ATA_NFORCE_MCP73_A0 0x07f010de #define ATA_NFORCE_MCP73_A1 0x07f110de #define ATA_NFORCE_MCP73_A2 0x07f210de #define ATA_NFORCE_MCP73_A3 0x07f310de #define ATA_NFORCE_MCP73_A4 0x07f410de #define ATA_NFORCE_MCP73_A5 0x07f510de #define ATA_NFORCE_MCP73_A6 0x07f610de #define ATA_NFORCE_MCP73_A7 0x07f710de #define ATA_NFORCE_MCP73_A8 0x07f810de #define ATA_NFORCE_MCP73_A9 0x07f910de #define ATA_NFORCE_MCP73_AA 0x07fa10de #define ATA_NFORCE_MCP73_AB 0x07fb10de #define ATA_NFORCE_MCP77 0x075910de #define ATA_NFORCE_MCP77_A0 0x0ad010de #define ATA_NFORCE_MCP77_A1 0x0ad110de #define ATA_NFORCE_MCP77_A2 0x0ad210de #define ATA_NFORCE_MCP77_A3 0x0ad310de #define ATA_NFORCE_MCP77_A4 0x0ad410de #define ATA_NFORCE_MCP77_A5 0x0ad510de #define ATA_NFORCE_MCP77_A6 0x0ad610de #define ATA_NFORCE_MCP77_A7 0x0ad710de #define ATA_NFORCE_MCP77_A8 0x0ad810de #define ATA_NFORCE_MCP77_A9 0x0ad910de #define ATA_NFORCE_MCP77_AA 0x0ada10de #define ATA_NFORCE_MCP77_AB 0x0adb10de #define ATA_NFORCE_MCP79_A0 0x0ab410de #define ATA_NFORCE_MCP79_A1 0x0ab510de #define ATA_NFORCE_MCP79_A2 0x0ab610de #define ATA_NFORCE_MCP79_A3 0x0ab710de #define ATA_NFORCE_MCP79_A4 0x0ab810de #define ATA_NFORCE_MCP79_A5 0x0ab910de #define ATA_NFORCE_MCP79_A6 0x0aba10de #define ATA_NFORCE_MCP79_A7 0x0abb10de #define ATA_NFORCE_MCP79_A8 0x0abc10de #define ATA_NFORCE_MCP79_A9 0x0abd10de #define ATA_NFORCE_MCP79_AA 0x0abe10de #define ATA_NFORCE_MCP79_AB 0x0abf10de #define ATA_NFORCE_MCP89_A0 0x0d8410de #define ATA_NFORCE_MCP89_A1 0x0d8510de #define ATA_NFORCE_MCP89_A2 0x0d8610de #define ATA_NFORCE_MCP89_A3 0x0d8710de #define ATA_NFORCE_MCP89_A4 0x0d8810de #define ATA_NFORCE_MCP89_A5 0x0d8910de #define ATA_NFORCE_MCP89_A6 0x0d8a10de #define ATA_NFORCE_MCP89_A7 0x0d8b10de #define ATA_NFORCE_MCP89_A8 0x0d8c10de #define ATA_NFORCE_MCP89_A9 0x0d8d10de #define ATA_NFORCE_MCP89_AA 0x0d8e10de #define ATA_NFORCE_MCP89_AB 0x0d8f10de #define ATA_PROMISE_ID 0x105a #define ATA_PDC20246 0x4d33105a #define ATA_PDC20262 0x4d38105a #define ATA_PDC20263 0x0d38105a #define ATA_PDC20265 0x0d30105a #define ATA_PDC20267 0x4d30105a #define ATA_PDC20268 0x4d68105a #define ATA_PDC20269 0x4d69105a #define ATA_PDC20270 0x6268105a #define ATA_PDC20271 0x6269105a #define ATA_PDC20275 0x1275105a #define ATA_PDC20276 0x5275105a #define ATA_PDC20277 0x7275105a #define ATA_PDC20318 0x3318105a #define ATA_PDC20319 0x3319105a #define ATA_PDC20371 0x3371105a #define ATA_PDC20375 0x3375105a #define ATA_PDC20376 0x3376105a #define ATA_PDC20377 0x3377105a #define ATA_PDC20378 0x3373105a #define ATA_PDC20379 0x3372105a #define ATA_PDC20571 0x3571105a #define ATA_PDC20575 0x3d75105a #define ATA_PDC20579 0x3574105a #define ATA_PDC20771 0x3570105a #define ATA_PDC40518 0x3d18105a #define ATA_PDC40519 0x3519105a #define ATA_PDC40718 0x3d17105a #define ATA_PDC40719 0x3515105a #define ATA_PDC40775 0x3d73105a #define ATA_PDC40779 0x3577105a #define ATA_PDC20617 0x6617105a #define ATA_PDC20618 0x6626105a #define ATA_PDC20619 0x6629105a #define ATA_PDC20620 0x6620105a #define ATA_PDC20621 0x6621105a #define ATA_PDC20622 0x6622105a #define ATA_PDC20624 0x6624105a #define ATA_PDC81518 0x8002105a #define ATA_SERVERWORKS_ID 0x1166 #define ATA_ROSB4_ISA 0x02001166 #define ATA_ROSB4 0x02111166 #define ATA_CSB5 0x02121166 #define ATA_CSB6 0x02131166 #define ATA_CSB6_1 0x02171166 #define ATA_HT1000 0x02141166 #define ATA_HT1000_S1 0x024b1166 #define ATA_HT1000_S2 0x024a1166 #define ATA_K2 0x02401166 #define ATA_FRODO4 0x02411166 #define ATA_FRODO8 0x02421166 #define ATA_SILICON_IMAGE_ID 0x1095 #define ATA_SII3114 0x31141095 #define ATA_SII3512 0x35121095 #define ATA_SII3112 0x31121095 #define ATA_SII3112_1 0x02401095 #define ATA_SII3124 0x31241095 #define ATA_SII3132 0x31321095 #define ATA_SII3132_1 0x02421095 #define ATA_SII3132_2 0x02441095 #define ATA_SII0680 0x06801095 #define ATA_CMD646 0x06461095 #define ATA_CMD648 0x06481095 #define ATA_CMD649 0x06491095 #define ATA_SIS_ID 0x1039 #define ATA_SISSOUTH 0x00081039 #define ATA_SIS5511 0x55111039 #define ATA_SIS5513 0x55131039 #define ATA_SIS5517 0x55171039 #define ATA_SIS5518 0x55181039 #define ATA_SIS5571 0x55711039 #define ATA_SIS5591 0x55911039 #define ATA_SIS5596 0x55961039 #define ATA_SIS5597 0x55971039 #define ATA_SIS5598 0x55981039 #define ATA_SIS5600 0x56001039 #define ATA_SIS530 0x05301039 #define ATA_SIS540 0x05401039 #define ATA_SIS550 0x05501039 #define ATA_SIS620 0x06201039 #define ATA_SIS630 0x06301039 #define ATA_SIS635 0x06351039 #define ATA_SIS633 0x06331039 #define ATA_SIS640 0x06401039 #define ATA_SIS645 0x06451039 #define ATA_SIS646 0x06461039 #define ATA_SIS648 0x06481039 #define ATA_SIS650 0x06501039 #define ATA_SIS651 0x06511039 #define ATA_SIS652 0x06521039 #define ATA_SIS655 0x06551039 #define ATA_SIS658 0x06581039 #define ATA_SIS661 0x06611039 #define ATA_SIS730 0x07301039 #define ATA_SIS733 0x07331039 #define ATA_SIS735 0x07351039 #define ATA_SIS740 0x07401039 #define ATA_SIS745 0x07451039 #define ATA_SIS746 0x07461039 #define ATA_SIS748 0x07481039 #define ATA_SIS750 0x07501039 #define ATA_SIS751 0x07511039 #define ATA_SIS752 0x07521039 #define ATA_SIS755 0x07551039 #define ATA_SIS961 0x09611039 #define ATA_SIS962 0x09621039 #define ATA_SIS963 0x09631039 #define ATA_SIS964 0x09641039 #define ATA_SIS965 0x09651039 #define ATA_SIS180 0x01801039 #define ATA_SIS181 0x01811039 #define ATA_SIS182 0x01821039 #define ATA_VIA_ID 0x1106 #define ATA_VIA82C571 0x05711106 #define ATA_VIA82C586 0x05861106 #define ATA_VIA82C596 0x05961106 #define ATA_VIA82C686 0x06861106 #define ATA_VIA8231 0x82311106 #define ATA_VIA8233 0x30741106 #define ATA_VIA8233A 0x31471106 #define ATA_VIA8233C 0x31091106 #define ATA_VIA8235 0x31771106 #define ATA_VIA8237 0x32271106 #define ATA_VIA8237A 0x05911106 #define ATA_VIA8237S 0x53371106 #define ATA_VIA8237_5372 0x53721106 #define ATA_VIA8237_7372 0x73721106 #define ATA_VIA8251 0x33491106 #define ATA_VIA8361 0x31121106 #define ATA_VIA8363 0x03051106 #define ATA_VIA8371 0x03911106 #define ATA_VIA8662 0x31021106 #define ATA_VIA6410 0x31641106 #define ATA_VIA6420 0x31491106 #define ATA_VIA6421 0x32491106 #define ATA_VIACX700IDE 0x05811106 #define ATA_VIACX700 0x83241106 #define ATA_VIASATAIDE 0x53241106 #define ATA_VIAVX800 0x83531106 #define ATA_VIASATAIDE2 0xc4091106 #define ATA_VIAVX855 0x84091106 #define ATA_VIASATAIDE3 0x90011106 #define ATA_VIAVX900 0x84101106 /* global prototypes ata-pci.c */ int ata_pci_probe(device_t dev); int ata_pci_attach(device_t dev); int ata_pci_detach(device_t dev); int ata_pci_suspend(device_t dev); int ata_pci_resume(device_t dev); int ata_pci_read_ivar(device_t dev, device_t child, int which, uintptr_t *result); int ata_pci_write_ivar(device_t dev, device_t child, int which, uintptr_t value); uint32_t ata_pci_read_config(device_t dev, device_t child, int reg, int width); void ata_pci_write_config(device_t dev, device_t child, int reg, uint32_t val, int width); int ata_pci_print_child(device_t dev, device_t child); int ata_pci_child_location_str(device_t dev, device_t child, char *buf, size_t buflen); struct resource * ata_pci_alloc_resource(device_t dev, device_t child, int type, int *rid, u_long start, u_long end, u_long count, u_int flags); int ata_pci_release_resource(device_t dev, device_t child, int type, int rid, struct resource *r); int ata_pci_setup_intr(device_t dev, device_t child, struct resource *irq, int flags, driver_filter_t *filter, driver_intr_t *function, void *argument, void **cookiep); int ata_pci_teardown_intr(device_t dev, device_t child, struct resource *irq, void *cookie); int ata_pci_ch_attach(device_t dev); int ata_pci_ch_detach(device_t dev); int ata_pci_status(device_t dev); void ata_pci_hw(device_t dev); void ata_pci_dmainit(device_t dev); void ata_pci_dmafini(device_t dev); const char *ata_pcivendor2str(device_t dev); int ata_legacy(device_t); void ata_generic_intr(void *data); int ata_generic_chipinit(device_t dev); int ata_generic_setmode(device_t dev, int target, int mode); int ata_setup_interrupt(device_t dev, void *intr_func); void ata_set_desc(device_t dev); const struct ata_chip_id *ata_match_chip(device_t dev, const struct ata_chip_id *index); const struct ata_chip_id *ata_find_chip(device_t dev, const struct ata_chip_id *index, int slot); int ata_mode2idx(int mode); /* global prototypes from chipsets/ata-*.c */ int ata_ahci_chipinit(device_t); int ata_marvell_edma_chipinit(device_t); int ata_sii_chipinit(device_t); /* externs */ extern devclass_t ata_pci_devclass; MALLOC_DECLARE(M_ATAPCI); /* macro for easy definition of all driver module stuff */ #define ATA_DECLARE_DRIVER(dname) \ static device_method_t __CONCAT(dname,_methods)[] = { \ DEVMETHOD(device_probe, __CONCAT(dname,_probe)), \ DEVMETHOD(device_attach, ata_pci_attach), \ DEVMETHOD(device_detach, ata_pci_detach), \ DEVMETHOD(device_suspend, ata_pci_suspend), \ DEVMETHOD(device_resume, ata_pci_resume), \ DEVMETHOD(device_shutdown, bus_generic_shutdown), \ DEVMETHOD(bus_read_ivar, ata_pci_read_ivar), \ DEVMETHOD(bus_write_ivar, ata_pci_write_ivar), \ DEVMETHOD(bus_alloc_resource, ata_pci_alloc_resource), \ DEVMETHOD(bus_release_resource, ata_pci_release_resource), \ DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), \ DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), \ DEVMETHOD(bus_setup_intr, ata_pci_setup_intr), \ DEVMETHOD(bus_teardown_intr, ata_pci_teardown_intr), \ DEVMETHOD(pci_read_config, ata_pci_read_config), \ DEVMETHOD(pci_write_config, ata_pci_write_config), \ DEVMETHOD(bus_print_child, ata_pci_print_child), \ DEVMETHOD(bus_child_location_str, ata_pci_child_location_str), \ DEVMETHOD_END \ }; \ static driver_t __CONCAT(dname,_driver) = { \ "atapci", \ __CONCAT(dname,_methods), \ sizeof(struct ata_pci_controller) \ }; \ DRIVER_MODULE(dname, pci, __CONCAT(dname,_driver), ata_pci_devclass, NULL, NULL); \ MODULE_VERSION(dname, 1); \ MODULE_DEPEND(dname, ata, 1, 1, 1); \ MODULE_DEPEND(dname, atapci, 1, 1, 1); Index: head/sys/dev/ata/ata-queue.c =================================================================== --- head/sys/dev/ata/ata-queue.c (revision 249082) +++ head/sys/dev/ata/ata-queue.c (revision 249083) @@ -1,825 +1,186 @@ /*- * Copyright (c) 1998 - 2008 Søren Schmidt * 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. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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. */ #include __FBSDID("$FreeBSD$"); #include "opt_ata.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include -#ifndef ATA_CAM -/* prototypes */ -static void ata_completed(void *, int); -static void ata_sort_queue(struct ata_channel *ch, struct ata_request *request); -static const char *ata_skey2str(u_int8_t); -#endif - -#ifndef ATA_CAM void -ata_queue_request(struct ata_request *request) -{ - struct ata_channel *ch; - struct ata_device *atadev = device_get_softc(request->dev); - - /* treat request as virgin (this might be an ATA_R_REQUEUE) */ - request->result = request->status = request->error = 0; - - /* Prepare paramers required by low-level code. */ - request->unit = atadev->unit; - if (!(request->parent = device_get_parent(request->dev))) { - request->result = ENXIO; - if (request->callback) - (request->callback)(request); - return; - } - if ((atadev->param.config & ATA_PROTO_MASK) == ATA_PROTO_ATAPI_16) - request->flags |= ATA_R_ATAPI16; - if ((atadev->param.config & ATA_DRQ_MASK) == ATA_DRQ_INTR) - request->flags |= ATA_R_ATAPI_INTR; - if ((request->flags & ATA_R_ATAPI) == 0) - ata_modify_if_48bit(request); - ch = device_get_softc(request->parent); - callout_init_mtx(&request->callout, &ch->state_mtx, CALLOUT_RETURNUNLOCKED); - if (!request->callback && !(request->flags & ATA_R_REQUEUE)) - sema_init(&request->done, 0, "ATA request done"); - - /* in ATA_STALL_QUEUE state we call HW directly */ - if ((ch->state & ATA_STALL_QUEUE) && (request->flags & ATA_R_CONTROL)) { - mtx_lock(&ch->state_mtx); - ch->running = request; - if (ch->hw.begin_transaction(request) == ATA_OP_FINISHED) { - ch->running = NULL; - if (!request->callback) - sema_destroy(&request->done); - mtx_unlock(&ch->state_mtx); - return; - } - mtx_unlock(&ch->state_mtx); - } - /* otherwise put request on the locked queue at the specified location */ - else { - mtx_lock(&ch->queue_mtx); - if (request->flags & ATA_R_AT_HEAD) - TAILQ_INSERT_HEAD(&ch->ata_queue, request, chain); - else if (request->flags & ATA_R_ORDERED) - ata_sort_queue(ch, request); - else - TAILQ_INSERT_TAIL(&ch->ata_queue, request, chain); - mtx_unlock(&ch->queue_mtx); - ATA_DEBUG_RQ(request, "queued"); - ata_start(ch->dev); - } - - /* if this is a requeued request callback/sleep we're done */ - if (request->flags & ATA_R_REQUEUE) - return; - - /* if this is not a callback wait until request is completed */ - if (!request->callback) { - ATA_DEBUG_RQ(request, "wait for completion"); - if (!dumping && - sema_timedwait(&request->done, request->timeout * hz * 4)) { - callout_drain(&request->callout); - device_printf(request->dev, - "WARNING - %s taskqueue timeout " - "- completing request directly\n", - ata_cmd2str(request)); - request->flags |= ATA_R_DANGER1; - ata_completed(request, 0); - } - 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) -{ - struct ata_device *atadev = device_get_softc(dev); - struct ata_request *request = ata_alloc_request(); - int error = ENOMEM; - - if (request) { - request->dev = dev; - request->u.ata.command = command; - request->u.ata.lba = lba; - request->u.ata.count = count; - request->u.ata.feature = feature; - request->flags = ATA_R_CONTROL; - if (atadev->spindown_state) { - device_printf(dev, "request while spun down, starting.\n"); - atadev->spindown_state = 0; - request->timeout = MAX(ATA_REQUEST_TIMEOUT, 31); - } else { - request->timeout = ATA_REQUEST_TIMEOUT; - } - request->retries = 0; - ata_queue_request(request); - error = request->result; - ata_free_request(request); - } - 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) -{ - struct ata_request *request = ata_alloc_request(); - int error = ENOMEM; - - if (request) { - request->dev = dev; - bcopy(ccb, request->u.atapi.ccb, 16); - request->data = data; - request->bytecount = count; - request->transfersize = min(request->bytecount, 65534); - request->flags = flags | ATA_R_ATAPI; - request->timeout = timeout; - request->retries = 0; - ata_queue_request(request); - error = request->result; - ata_free_request(request); - } - return error; -} -#endif - -#ifndef ATA_CAM -void -ata_start(device_t dev) -{ - struct ata_channel *ch = device_get_softc(dev); - struct ata_request *request; - struct ata_composite *cptr; - int dependencies = 0; - - /* if we have a request on the queue try to get it running */ - mtx_lock(&ch->queue_mtx); - if ((request = TAILQ_FIRST(&ch->ata_queue))) { - - /* we need the locking function to get the lock for this channel */ - if (ATA_LOCKING(dev, ATA_LF_LOCK) == ch->unit) { - - /* check for composite dependencies */ - if ((cptr = request->composite)) { - mtx_lock(&cptr->lock); - if ((request->flags & ATA_R_WRITE) && - (cptr->wr_depend & cptr->rd_done) != cptr->wr_depend) { - dependencies = 1; - } - mtx_unlock(&cptr->lock); - } - - /* check we are in the right state and has no dependencies */ - mtx_lock(&ch->state_mtx); - if (ch->state == ATA_IDLE && !dependencies) { - ATA_DEBUG_RQ(request, "starting"); - TAILQ_REMOVE(&ch->ata_queue, request, chain); - ch->running = request; - ch->state = ATA_ACTIVE; - - /* if we are the freezing point release it */ - if (ch->freezepoint == request) - ch->freezepoint = NULL; - - if (ch->hw.begin_transaction(request) == ATA_OP_FINISHED) { - ch->running = NULL; - ch->state = ATA_IDLE; - mtx_unlock(&ch->state_mtx); - mtx_unlock(&ch->queue_mtx); - ATA_LOCKING(dev, ATA_LF_UNLOCK); - ata_finish(request); - return; - } - } - mtx_unlock(&ch->state_mtx); - } - } - mtx_unlock(&ch->queue_mtx); - if (dumping) { - while (ch->running) { - ata_interrupt(ch); - DELAY(10); - } - } -} -#endif - -#ifndef ATA_CAM -void -ata_finish(struct ata_request *request) -{ - struct ata_channel *ch = device_get_softc(request->parent); - - /* - * if in ATA_STALL_QUEUE state or request has ATA_R_DIRECT flags set - * we need to call ata_complete() directly here (no taskqueue involvement) - */ - if (dumping || - (ch->state & ATA_STALL_QUEUE) || (request->flags & ATA_R_DIRECT)) { - ATA_DEBUG_RQ(request, "finish directly"); - ata_completed(request, 0); - } - else { - /* put request on the proper taskqueue for completion */ - if (request->bio && !(request->flags & (ATA_R_THREAD | ATA_R_TIMEOUT))){ - ATA_DEBUG_RQ(request, "finish bio_taskqueue"); - bio_taskqueue(request->bio, (bio_task_t *)ata_completed, request); - } - else { - TASK_INIT(&request->task, 0, ata_completed, request); - ATA_DEBUG_RQ(request, "finish taskqueue_swi"); - taskqueue_enqueue(taskqueue_swi, &request->task); - } - } -} -#endif - -#ifndef ATA_CAM -static void -ata_completed(void *context, int dummy) -{ - struct ata_request *request = (struct ata_request *)context; - struct ata_channel *ch = device_get_softc(request->parent); - struct ata_device *atadev = device_get_softc(request->dev); - struct ata_composite *composite; - - if (request->flags & ATA_R_DANGER2) { - device_printf(request->dev, - "WARNING - %s freeing taskqueue zombie request\n", - ata_cmd2str(request)); - request->flags &= ~(ATA_R_DANGER1 | ATA_R_DANGER2); - ata_free_request(request); - return; - } - if (request->flags & ATA_R_DANGER1) - request->flags |= ATA_R_DANGER2; - - ATA_DEBUG_RQ(request, "completed entered"); - - /* if we had a timeout, reinit channel and deal with the falldown */ - if (request->flags & ATA_R_TIMEOUT) { - /* - * if the channel is still present and - * reinit succeeds and - * the device doesn't get detached and - * there are retries left we reinject this request - */ - if (ch && !ata_reinit(ch->dev) && !request->result && - (request->retries-- > 0)) { - if (!(request->flags & ATA_R_QUIET)) { - device_printf(request->dev, - "TIMEOUT - %s retrying (%d retr%s left)", - ata_cmd2str(request), request->retries, - request->retries == 1 ? "y" : "ies"); - if (!(request->flags & (ATA_R_ATAPI | ATA_R_CONTROL))) - printf(" LBA=%ju", request->u.ata.lba); - printf("\n"); - } - request->flags &= ~(ATA_R_TIMEOUT | ATA_R_DEBUG); - request->flags |= (ATA_R_AT_HEAD | ATA_R_REQUEUE); - ATA_DEBUG_RQ(request, "completed reinject"); - ata_queue_request(request); - return; - } - - /* ran out of good intentions so finish with error */ - if (!request->result) { - if (!(request->flags & ATA_R_QUIET)) { - if (request->dev) { - device_printf(request->dev, "FAILURE - %s timed out", - ata_cmd2str(request)); - if (!(request->flags & (ATA_R_ATAPI | ATA_R_CONTROL))) - printf(" LBA=%ju", request->u.ata.lba); - printf("\n"); - } - } - request->result = EIO; - } - } - else if (!(request->flags & ATA_R_ATAPI) ){ - /* if this is a soft ECC error warn about it */ - /* XXX SOS we could do WARF here */ - if ((request->status & (ATA_S_CORR | ATA_S_ERROR)) == ATA_S_CORR) { - device_printf(request->dev, - "WARNING - %s soft error (ECC corrected)", - ata_cmd2str(request)); - if (!(request->flags & (ATA_R_ATAPI | ATA_R_CONTROL))) - printf(" LBA=%ju", request->u.ata.lba); - printf("\n"); - } - - /* if this is a UDMA CRC error we reinject if there are retries left */ - if (request->flags & ATA_R_DMA && request->error & ATA_E_ICRC) { - if (request->retries-- > 0) { - device_printf(request->dev, - "WARNING - %s UDMA ICRC error (retrying request)", - 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_AT_HEAD | ATA_R_REQUEUE); - ata_queue_request(request); - return; - } - } - } - - switch (request->flags & ATA_R_ATAPI) { - - /* ATA errors */ - default: - if (!request->result && request->status & ATA_S_ERROR) { - if (!(request->flags & ATA_R_QUIET)) { - device_printf(request->dev, - "FAILURE - %s status=%b error=%b", - ata_cmd2str(request), - request->status, "\20\10BUSY\7READY\6DMA_READY" - "\5DSC\4DRQ\3CORRECTABLE\2INDEX\1ERROR", - request->error, "\20\10ICRC\7UNCORRECTABLE" - "\6MEDIA_CHANGED\5NID_NOT_FOUND" - "\4MEDIA_CHANGE_REQEST" - "\3ABORTED\2NO_MEDIA\1ILLEGAL_LENGTH"); - if ((request->flags & ATA_R_DMA) && request->dma && - (request->dma->status & ATA_BMSTAT_ERROR)) - printf(" dma=0x%02x", request->dma->status); - if (!(request->flags & (ATA_R_ATAPI | ATA_R_CONTROL))) - printf(" LBA=%ju", request->u.ata.lba); - printf("\n"); - } - request->result = EIO; - } - break; - - /* ATAPI errors */ - case ATA_R_ATAPI: - /* skip if result already set */ - if (request->result) - break; - - /* if we have a sensekey -> request sense from device */ - if ((request->error & ATA_E_ATAPI_SENSE_MASK) && - (request->u.atapi.ccb[0] != ATAPI_REQUEST_SENSE)) { - static u_int8_t ccb[16] = { ATAPI_REQUEST_SENSE, 0, 0, 0, - sizeof(struct atapi_sense), - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - - request->u.atapi.saved_cmd = request->u.atapi.ccb[0]; - bcopy(ccb, request->u.atapi.ccb, 16); - request->data = (caddr_t)&request->u.atapi.sense; - request->bytecount = sizeof(struct atapi_sense); - request->donecount = 0; - request->transfersize = sizeof(struct atapi_sense); - request->timeout = ATA_REQUEST_TIMEOUT; - request->flags &= (ATA_R_ATAPI | ATA_R_QUIET | ATA_R_DEBUG); - request->flags |= (ATA_R_READ | ATA_R_AT_HEAD | ATA_R_REQUEUE); - ATA_DEBUG_RQ(request, "autoissue request sense"); - ata_queue_request(request); - return; - } - - switch (request->u.atapi.sense.key & ATA_SENSE_KEY_MASK) { - case ATA_SENSE_RECOVERED_ERROR: - device_printf(request->dev, "WARNING - %s recovered error\n", - ata_cmd2str(request)); - /* FALLTHROUGH */ - - case ATA_SENSE_NO_SENSE: - request->result = 0; - break; - - case ATA_SENSE_NOT_READY: - request->result = EBUSY; - break; - - case ATA_SENSE_UNIT_ATTENTION: - atadev->flags |= ATA_D_MEDIA_CHANGED; - request->result = EIO; - break; - - default: - request->result = EIO; - if (request->flags & ATA_R_QUIET) - break; - - device_printf(request->dev, - "FAILURE - %s %s asc=0x%02x ascq=0x%02x ", - ata_cmd2str(request), ata_skey2str( - (request->u.atapi.sense.key & ATA_SENSE_KEY_MASK)), - request->u.atapi.sense.asc, - request->u.atapi.sense.ascq); - if (request->u.atapi.sense.specific & ATA_SENSE_SPEC_VALID) - printf("sks=0x%02x 0x%02x 0x%02x\n", - request->u.atapi.sense.specific & ATA_SENSE_SPEC_MASK, - request->u.atapi.sense.specific1, - request->u.atapi.sense.specific2); - else - printf("\n"); - } - - if (!request->result && - (request->u.atapi.sense.key & ATA_SENSE_KEY_MASK || - request->error)) - request->result = EIO; - } - - ATA_DEBUG_RQ(request, "completed callback/wakeup"); - - /* if we are part of a composite operation we need to maintain progress */ - if ((composite = request->composite)) { - int index = 0; - - mtx_lock(&composite->lock); - - /* update whats done */ - if (request->flags & ATA_R_READ) - composite->rd_done |= (1 << request->this); - if (request->flags & ATA_R_WRITE) - composite->wr_done |= (1 << request->this); - - /* find ready to go dependencies */ - if (composite->wr_depend && - (composite->rd_done & composite->wr_depend)==composite->wr_depend && - (composite->wr_needed & (~composite->wr_done))) { - index = composite->wr_needed & ~composite->wr_done; - } - - mtx_unlock(&composite->lock); - - /* if we have any ready candidates kick them off */ - if (index) { - int bit; - - for (bit = 0; bit < MAX_COMPOSITES; bit++) { - if (index & (1 << bit)) - ata_start(device_get_parent(composite->request[bit]->dev)); - } - } - } - - /* get results back to the initiator for this request */ - if (request->callback) - (request->callback)(request); - else - sema_post(&request->done); - - /* only call ata_start if channel is present */ - if (ch) - ata_start(ch->dev); -} -#endif - -void ata_timeout(struct ata_request *request) { struct ata_channel *ch = device_get_softc(request->parent); //request->flags |= ATA_R_DEBUG; ATA_DEBUG_RQ(request, "timeout"); /* * if we have an ATA_ACTIVE request running, we flag the request * ATA_R_TIMEOUT so ata_finish will handle it correctly * also NULL out the running request so we wont loose * the race with an eventual interrupt arriving late */ if (ch->state == ATA_ACTIVE) { request->flags |= ATA_R_TIMEOUT; if (ch->dma.unload) ch->dma.unload(request); ch->running = NULL; ch->state = ATA_IDLE; -#ifdef ATA_CAM ata_cam_end_transaction(ch->dev, request); -#endif mtx_unlock(&ch->state_mtx); -#ifndef ATA_CAM - ATA_LOCKING(ch->dev, ATA_LF_UNLOCK); - ata_finish(request); -#endif } else { mtx_unlock(&ch->state_mtx); } } -#ifndef ATA_CAM -void -ata_fail_requests(device_t dev) -{ - struct ata_channel *ch = device_get_softc(device_get_parent(dev)); - struct ata_request *request, *tmp; - TAILQ_HEAD(, ata_request) fail_requests; - TAILQ_INIT(&fail_requests); - - /* grap all channel locks to avoid races */ - mtx_lock(&ch->queue_mtx); - mtx_lock(&ch->state_mtx); - - /* do we have any running request to care about ? */ - if ((request = ch->running) && (!dev || request->dev == dev)) { - callout_stop(&request->callout); - ch->running = NULL; - request->result = ENXIO; - TAILQ_INSERT_TAIL(&fail_requests, request, chain); - } - - /* fail all requests queued on this channel for device dev if !NULL */ - TAILQ_FOREACH_SAFE(request, &ch->ata_queue, chain, tmp) { - if (!dev || request->dev == dev) { - TAILQ_REMOVE(&ch->ata_queue, request, chain); - request->result = ENXIO; - TAILQ_INSERT_TAIL(&fail_requests, request, chain); - } - } - - mtx_unlock(&ch->state_mtx); - mtx_unlock(&ch->queue_mtx); - - /* finish up all requests collected above */ - TAILQ_FOREACH_SAFE(request, &fail_requests, chain, tmp) { - TAILQ_REMOVE(&fail_requests, request, chain); - 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. - */ -void -ata_drop_requests(device_t dev) -{ - struct ata_channel *ch = device_get_softc(device_get_parent(dev)); - struct ata_request *request, *tmp; - - mtx_lock(&ch->queue_mtx); - TAILQ_FOREACH_SAFE(request, &ch->ata_queue, chain, tmp) { - TAILQ_REMOVE(&ch->ata_queue, request, chain); - request->result = ENXIO; - } - mtx_unlock(&ch->queue_mtx); -} -#endif - -#ifndef ATA_CAM -static u_int64_t -ata_get_lba(struct ata_request *request) -{ - if (request->flags & ATA_R_ATAPI) { - switch (request->u.atapi.ccb[0]) { - case ATAPI_READ_BIG: - case ATAPI_WRITE_BIG: - case ATAPI_READ_CD: - return (request->u.atapi.ccb[5]) | (request->u.atapi.ccb[4]<<8) | - (request->u.atapi.ccb[3]<<16)|(request->u.atapi.ccb[2]<<24); - case ATAPI_READ: - case ATAPI_WRITE: - return (request->u.atapi.ccb[4]) | (request->u.atapi.ccb[3]<<8) | - (request->u.atapi.ccb[2]<<16); - default: - return 0; - } - } - else - return request->u.ata.lba; -} -#endif - -#ifndef ATA_CAM -static void -ata_sort_queue(struct ata_channel *ch, struct ata_request *request) -{ - struct ata_request *this, *next; - - this = TAILQ_FIRST(&ch->ata_queue); - - /* if the queue is empty just insert */ - if (!this) { - if (request->composite) - ch->freezepoint = request; - TAILQ_INSERT_TAIL(&ch->ata_queue, request, chain); - return; - } - - /* dont sort frozen parts of the queue */ - if (ch->freezepoint) - this = ch->freezepoint; - - /* if position is less than head we add after tipping point */ - if (ata_get_lba(request) < ata_get_lba(this)) { - while ((next = TAILQ_NEXT(this, chain))) { - - /* have we reached the tipping point */ - if (ata_get_lba(next) < ata_get_lba(this)) { - - /* sort the insert */ - do { - if (ata_get_lba(request) < ata_get_lba(next)) - break; - this = next; - } while ((next = TAILQ_NEXT(this, chain))); - break; - } - this = next; - } - } - - /* we are after head so sort the insert before tipping point */ - else { - while ((next = TAILQ_NEXT(this, chain))) { - if (ata_get_lba(next) < ata_get_lba(this) || - ata_get_lba(request) < ata_get_lba(next)) - break; - this = next; - } - } - - if (request->composite) - ch->freezepoint = request; - TAILQ_INSERT_AFTER(&ch->ata_queue, this, request, chain); -} -#endif - const char * ata_cmd2str(struct ata_request *request) { static char buffer[20]; if (request->flags & ATA_R_ATAPI) { switch (request->u.atapi.sense.key ? request->u.atapi.saved_cmd : request->u.atapi.ccb[0]) { case 0x00: return ("TEST_UNIT_READY"); case 0x01: return ("REZERO"); case 0x03: return ("REQUEST_SENSE"); case 0x04: return ("FORMAT"); case 0x08: return ("READ"); case 0x0a: return ("WRITE"); case 0x10: return ("WEOF"); case 0x11: return ("SPACE"); case 0x12: return ("INQUIRY"); case 0x15: return ("MODE_SELECT"); case 0x19: return ("ERASE"); case 0x1a: return ("MODE_SENSE"); case 0x1b: return ("START_STOP"); case 0x1e: return ("PREVENT_ALLOW"); case 0x23: return ("ATAPI_READ_FORMAT_CAPACITIES"); case 0x25: return ("READ_CAPACITY"); case 0x28: return ("READ_BIG"); case 0x2a: return ("WRITE_BIG"); case 0x2b: return ("LOCATE"); case 0x34: return ("READ_POSITION"); case 0x35: return ("SYNCHRONIZE_CACHE"); case 0x3b: return ("WRITE_BUFFER"); case 0x3c: return ("READ_BUFFER"); case 0x42: return ("READ_SUBCHANNEL"); case 0x43: return ("READ_TOC"); case 0x45: return ("PLAY_10"); case 0x47: return ("PLAY_MSF"); case 0x48: return ("PLAY_TRACK"); case 0x4b: return ("PAUSE"); case 0x51: return ("READ_DISK_INFO"); case 0x52: return ("READ_TRACK_INFO"); case 0x53: return ("RESERVE_TRACK"); case 0x54: return ("SEND_OPC_INFO"); case 0x55: return ("MODE_SELECT_BIG"); case 0x58: return ("REPAIR_TRACK"); case 0x59: return ("READ_MASTER_CUE"); case 0x5a: return ("MODE_SENSE_BIG"); case 0x5b: return ("CLOSE_TRACK/SESSION"); case 0x5c: return ("READ_BUFFER_CAPACITY"); case 0x5d: return ("SEND_CUE_SHEET"); case 0x96: return ("SERVICE_ACTION_IN"); case 0xa1: return ("BLANK_CMD"); case 0xa3: return ("SEND_KEY"); case 0xa4: return ("REPORT_KEY"); case 0xa5: return ("PLAY_12"); case 0xa6: return ("LOAD_UNLOAD"); case 0xad: return ("READ_DVD_STRUCTURE"); case 0xb4: return ("PLAY_CD"); case 0xbb: return ("SET_SPEED"); case 0xbd: return ("MECH_STATUS"); case 0xbe: return ("READ_CD"); case 0xff: return ("POLL_DSC"); } } else { switch (request->u.ata.command) { case 0x00: return ("NOP"); case 0x08: return ("DEVICE_RESET"); case 0x20: return ("READ"); case 0x24: return ("READ48"); case 0x25: return ("READ_DMA48"); case 0x26: return ("READ_DMA_QUEUED48"); case 0x27: return ("READ_NATIVE_MAX_ADDRESS48"); case 0x29: return ("READ_MUL48"); case 0x30: return ("WRITE"); case 0x34: return ("WRITE48"); case 0x35: return ("WRITE_DMA48"); case 0x36: return ("WRITE_DMA_QUEUED48"); case 0x37: return ("SET_MAX_ADDRESS48"); case 0x39: return ("WRITE_MUL48"); case 0x70: return ("SEEK"); case 0xa0: return ("PACKET_CMD"); case 0xa1: return ("ATAPI_IDENTIFY"); case 0xa2: return ("SERVICE"); case 0xb0: return ("SMART"); case 0xc0: return ("CFA ERASE"); case 0xc4: return ("READ_MUL"); case 0xc5: return ("WRITE_MUL"); case 0xc6: return ("SET_MULTI"); case 0xc7: return ("READ_DMA_QUEUED"); case 0xc8: return ("READ_DMA"); case 0xca: return ("WRITE_DMA"); case 0xcc: return ("WRITE_DMA_QUEUED"); case 0xe6: return ("SLEEP"); case 0xe7: return ("FLUSHCACHE"); case 0xea: return ("FLUSHCACHE48"); case 0xec: return ("ATA_IDENTIFY"); case 0xef: switch (request->u.ata.feature) { case 0x03: return ("SETFEATURES SET TRANSFER MODE"); case 0x02: return ("SETFEATURES ENABLE WCACHE"); case 0x82: return ("SETFEATURES DISABLE WCACHE"); case 0xaa: return ("SETFEATURES ENABLE RCACHE"); case 0x55: return ("SETFEATURES DISABLE RCACHE"); } sprintf(buffer, "SETFEATURES 0x%02x", request->u.ata.feature); return buffer; case 0xf5: return ("SECURITY_FREE_LOCK"); case 0xf8: return ("READ_NATIVE_MAX_ADDRESS"); case 0xf9: return ("SET_MAX_ADDRESS"); } } sprintf(buffer, "unknown CMD (0x%02x)", request->u.ata.command); return buffer; } - -#ifndef ATA_CAM -static const char * -ata_skey2str(u_int8_t skey) -{ - switch (skey) { - case 0x00: return ("NO SENSE"); - case 0x01: return ("RECOVERED ERROR"); - case 0x02: return ("NOT READY"); - case 0x03: return ("MEDIUM ERROR"); - case 0x04: return ("HARDWARE ERROR"); - case 0x05: return ("ILLEGAL REQUEST"); - case 0x06: return ("UNIT ATTENTION"); - case 0x07: return ("DATA PROTECT"); - case 0x08: return ("BLANK CHECK"); - case 0x09: return ("VENDOR SPECIFIC"); - case 0x0a: return ("COPY ABORTED"); - case 0x0b: return ("ABORTED COMMAND"); - case 0x0c: return ("EQUAL"); - case 0x0d: return ("VOLUME OVERFLOW"); - case 0x0e: return ("MISCOMPARE"); - case 0x0f: return ("RESERVED"); - default: return("UNKNOWN"); - } -} -#endif Index: head/sys/dev/ata/ata-sata.c =================================================================== --- head/sys/dev/ata/ata-sata.c (revision 249082) +++ head/sys/dev/ata/ata-sata.c (revision 249083) @@ -1,372 +1,368 @@ /*- * Copyright (c) 1998 - 2008 Søren Schmidt * 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. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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. */ #include __FBSDID("$FreeBSD$"); #include "opt_ata.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void ata_sata_phy_check_events(device_t dev, int port) { struct ata_channel *ch = device_get_softc(dev); u_int32_t error, status; if (ata_sata_scr_read(ch, port, ATA_SERROR, &error)) return; /* Check that SError value is sane. */ if (error == 0xffffffff) return; /* Clear set error bits/interrupt. */ if (error) ata_sata_scr_write(ch, port, ATA_SERROR, error); /* if we have a connection event deal with it */ if ((error & ATA_SE_PHY_CHANGED) && (ch->pm_level == 0)) { if (bootverbose) { if (ata_sata_scr_read(ch, port, ATA_SSTATUS, &status)) { device_printf(dev, "PHYRDY change\n"); } else if (((status & ATA_SS_DET_MASK) == ATA_SS_DET_PHY_ONLINE) && ((status & ATA_SS_SPD_MASK) != ATA_SS_SPD_NO_SPEED) && ((status & ATA_SS_IPM_MASK) == ATA_SS_IPM_ACTIVE)) { device_printf(dev, "CONNECT requested\n"); } else device_printf(dev, "DISCONNECT requested\n"); } taskqueue_enqueue(taskqueue_thread, &ch->conntask); } } int ata_sata_scr_read(struct ata_channel *ch, int port, int reg, uint32_t *val) { if (ch->hw.pm_read != NULL) return (ch->hw.pm_read(ch->dev, port, reg, val)); if (ch->r_io[reg].res) { *val = ATA_IDX_INL(ch, reg); return (0); } return (-1); } int ata_sata_scr_write(struct ata_channel *ch, int port, int reg, uint32_t val) { if (ch->hw.pm_write != NULL) return (ch->hw.pm_write(ch->dev, port, reg, val)); if (ch->r_io[reg].res) { ATA_IDX_OUTL(ch, reg, val); return (0); } return (-1); } static int ata_sata_connect(struct ata_channel *ch, int port, int quick) { u_int32_t status; int timeout, t; /* wait up to 1 second for "connect well" */ timeout = (quick == 2) ? 0 : 100; t = 0; while (1) { if (ata_sata_scr_read(ch, port, ATA_SSTATUS, &status)) return (0); if (((status & ATA_SS_DET_MASK) == ATA_SS_DET_PHY_ONLINE) && ((status & ATA_SS_SPD_MASK) != ATA_SS_SPD_NO_SPEED) && ((status & ATA_SS_IPM_MASK) == ATA_SS_IPM_ACTIVE)) break; if (++t > timeout) break; ata_udelay(10000); } if (bootverbose) { if (t > timeout) { if (port < 0) { device_printf(ch->dev, "SATA connect timeout status=%08x\n", status); } else { device_printf(ch->dev, "p%d: SATA connect timeout status=%08x\n", port, status); } } else if (port < 0) { device_printf(ch->dev, "SATA connect time=%dms status=%08x\n", t * 10, status); } else { device_printf(ch->dev, "p%d: SATA connect time=%dms status=%08x\n", port, t * 10, status); } } /* clear SATA error register */ ata_sata_scr_write(ch, port, ATA_SERROR, 0xffffffff); return ((t > timeout) ? 0 : 1); } int ata_sata_phy_reset(device_t dev, int port, int quick) { struct ata_channel *ch = device_get_softc(dev); int loop, retry, sata_rev; uint32_t val, val1; -#ifdef ATA_CAM sata_rev = ch->user[port < 0 ? 0 : port].revision; if (sata_rev > 0) quick = 0; -#else - sata_rev = 0; -#endif if (quick) { if (ata_sata_scr_read(ch, port, ATA_SCONTROL, &val)) return (0); if ((val & ATA_SC_DET_MASK) == ATA_SC_DET_IDLE) { ata_sata_scr_write(ch, port, ATA_SCONTROL, ATA_SC_DET_IDLE | ((ch->pm_level > 0) ? 0 : ATA_SC_IPM_DIS_PARTIAL | ATA_SC_IPM_DIS_SLUMBER)); return ata_sata_connect(ch, port, quick); } } if (bootverbose) { if (port < 0) { device_printf(dev, "hard reset ...\n"); } else { device_printf(dev, "p%d: hard reset ...\n", port); } } if (sata_rev == 1) val1 = ATA_SC_SPD_SPEED_GEN1; else if (sata_rev == 2) val1 = ATA_SC_SPD_SPEED_GEN2; else if (sata_rev == 3) val1 = ATA_SC_SPD_SPEED_GEN3; else val1 = 0; for (retry = 0; retry < 10; retry++) { for (loop = 0; loop < 10; loop++) { if (ata_sata_scr_write(ch, port, ATA_SCONTROL, ATA_SC_DET_RESET | val1 | ATA_SC_IPM_DIS_PARTIAL | ATA_SC_IPM_DIS_SLUMBER)) goto fail; ata_udelay(100); if (ata_sata_scr_read(ch, port, ATA_SCONTROL, &val)) goto fail; if ((val & ATA_SC_DET_MASK) == ATA_SC_DET_RESET) break; } ata_udelay(5000); for (loop = 0; loop < 10; loop++) { if (ata_sata_scr_write(ch, port, ATA_SCONTROL, ATA_SC_DET_IDLE | val1 | ((ch->pm_level > 0) ? 0 : ATA_SC_IPM_DIS_PARTIAL | ATA_SC_IPM_DIS_SLUMBER))) goto fail; ata_udelay(100); if (ata_sata_scr_read(ch, port, ATA_SCONTROL, &val)) goto fail; if ((val & ATA_SC_DET_MASK) == 0) return ata_sata_connect(ch, port, 0); } } fail: /* Clear SATA error register. */ ata_sata_scr_write(ch, port, ATA_SERROR, 0xffffffff); if (bootverbose) { if (port < 0) { device_printf(dev, "hard reset failed\n"); } else { device_printf(dev, "p%d: hard reset failed\n", port); } } return (0); } int ata_sata_setmode(device_t dev, int target, int mode) { return (min(mode, ATA_UDMA5)); } int ata_sata_getrev(device_t dev, int target) { struct ata_channel *ch = device_get_softc(dev); if (ch->r_io[ATA_SSTATUS].res) return ((ATA_IDX_INL(ch, ATA_SSTATUS) & 0x0f0) >> 4); return (0xff); } int ata_request2fis_h2d(struct ata_request *request, u_int8_t *fis) { if (request->flags & ATA_R_ATAPI) { fis[0] = 0x27; /* host to device */ fis[1] = 0x80 | (request->unit & 0x0f); fis[2] = ATA_PACKET_CMD; if (request->flags & (ATA_R_READ | ATA_R_WRITE)) fis[3] = ATA_F_DMA; else { fis[5] = request->transfersize; fis[6] = request->transfersize >> 8; } fis[7] = ATA_D_LBA; fis[15] = ATA_A_4BIT; return 20; } else { fis[0] = 0x27; /* host to device */ fis[1] = 0x80 | (request->unit & 0x0f); fis[2] = request->u.ata.command; fis[3] = request->u.ata.feature; fis[4] = request->u.ata.lba; fis[5] = request->u.ata.lba >> 8; fis[6] = request->u.ata.lba >> 16; fis[7] = ATA_D_LBA; if (!(request->flags & ATA_R_48BIT)) fis[7] |= (ATA_D_IBM | (request->u.ata.lba >> 24 & 0x0f)); fis[8] = request->u.ata.lba >> 24; fis[9] = request->u.ata.lba >> 32; fis[10] = request->u.ata.lba >> 40; fis[11] = request->u.ata.feature >> 8; fis[12] = request->u.ata.count; fis[13] = request->u.ata.count >> 8; fis[15] = ATA_A_4BIT; return 20; } return 0; } void ata_pm_identify(device_t dev) { struct ata_channel *ch = device_get_softc(dev); u_int32_t pm_chipid, pm_revision, pm_ports; int port; /* get PM vendor & product data */ if (ch->hw.pm_read(dev, ATA_PM, 0, &pm_chipid)) { device_printf(dev, "error getting PM vendor data\n"); return; } /* get PM revision data */ if (ch->hw.pm_read(dev, ATA_PM, 1, &pm_revision)) { device_printf(dev, "error getting PM revison data\n"); return; } /* get number of HW ports on the PM */ if (ch->hw.pm_read(dev, ATA_PM, 2, &pm_ports)) { device_printf(dev, "error getting PM port info\n"); return; } pm_ports &= 0x0000000f; /* chip specific quirks */ switch (pm_chipid) { case 0x37261095: /* This PM declares 6 ports, while only 5 of them are real. * Port 5 is enclosure management bridge port, which has implementation * problems, causing probe faults. Hide it for now. */ device_printf(dev, "SiI 3726 (rev=%x) Port Multiplier with %d (5) ports\n", pm_revision, pm_ports); pm_ports = 5; break; case 0x47261095: /* This PM declares 7 ports, while only 5 of them are real. * Port 5 is some fake "Config Disk" with 640 sectors size, * port 6 is enclosure management bridge port. * Both fake ports has implementation problems, causing * probe faults. Hide them for now. */ device_printf(dev, "SiI 4726 (rev=%x) Port Multiplier with %d (5) ports\n", pm_revision, pm_ports); pm_ports = 5; break; default: device_printf(dev, "Port Multiplier (id=%08x rev=%x) with %d ports\n", pm_chipid, pm_revision, pm_ports); } /* reset all ports and register if anything connected */ for (port=0; port < pm_ports; port++) { u_int32_t signature; if (!ata_sata_phy_reset(dev, port, 1)) continue; /* * XXX: I have no idea how to properly wait for PMP port hardreset * completion. Without this delay soft reset does not completes * successfully. */ DELAY(1000000); signature = ch->hw.softreset(dev, port); if (bootverbose) device_printf(dev, "p%d: SIGNATURE=%08x\n", port, signature); /* figure out whats there */ switch (signature >> 16) { case 0x0000: ch->devices |= (ATA_ATA_MASTER << port); continue; case 0xeb14: ch->devices |= (ATA_ATAPI_MASTER << port); continue; } } } Index: head/sys/dev/ata/ata_if.m =================================================================== --- head/sys/dev/ata/ata_if.m (revision 249082) +++ head/sys/dev/ata/ata_if.m (revision 249083) @@ -1,92 +1,74 @@ # Copyright (c) 2004 - 2008 Søren Schmidt # 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. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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. # # $FreeBSD$ #include #include #include #include #include #include #include #include #include #include #include INTERFACE ata; CODE { - static int ata_null_locking(device_t dev, int mode) - { - struct ata_channel *ch = device_get_softc(dev); - - return ch->unit; - } -}; -METHOD int locking { - device_t channel; - int mode; -} DEFAULT ata_null_locking; -HEADER { -#define ATA_LF_LOCK 0x0001 -#define ATA_LF_UNLOCK 0x0002 -#define ATA_LF_WHICH 0x0004 -}; - -CODE { static int ata_null_setmode(device_t dev, int target, int mode) { if (mode > ATA_PIO_MAX) return (ATA_PIO_MAX); return (mode); } }; METHOD int setmode { device_t dev; int target; int mode; } DEFAULT ata_null_setmode; CODE { static int ata_null_getrev(device_t dev, int target) { return (0); } }; METHOD int getrev { device_t dev; int target; } DEFAULT ata_null_getrev; METHOD void reset { device_t channel; } DEFAULT ata_generic_reset; METHOD int reinit { device_t dev; }; Index: head/sys/dev/ata/chipsets/ata-acard.c =================================================================== --- head/sys/dev/ata/chipsets/ata-acard.c (revision 249082) +++ head/sys/dev/ata/chipsets/ata-acard.c (revision 249083) @@ -1,298 +1,198 @@ /*- * Copyright (c) 1998 - 2008 Søren Schmidt * 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. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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. */ #include __FBSDID("$FreeBSD$"); #include "opt_ata.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include -#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_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 */ static int ata_acard_probe(device_t dev) { struct ata_pci_controller *ctlr = device_get_softc(dev); static const struct ata_chip_id ids[] = {{ ATA_ATP850R, 0, ATP_OLD, 0x00, ATA_UDMA2, "ATP850" }, { ATA_ATP860A, 0, 0, 0x00, ATA_UDMA4, "ATP860A" }, { ATA_ATP860R, 0, 0, 0x00, ATA_UDMA4, "ATP860R" }, { ATA_ATP865A, 0, 0, 0x00, ATA_UDMA6, "ATP865A" }, { ATA_ATP865R, 0, 0, 0x00, ATA_UDMA6, "ATP865R" }, { 0, 0, 0, 0, 0, 0}}; if (pci_get_vendor(dev) != ATA_ACARD_ID) return ENXIO; if (!(ctlr->chip = ata_match_chip(dev, ids))) return ENXIO; ata_set_desc(dev); ctlr->chipinit = ata_acard_chipinit; -#ifndef ATA_CAM - ctlr->chipdeinit = ata_acard_chipdeinit; -#endif return (BUS_PROBE_DEFAULT); } 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; ctlr->ch_attach = ata_acard_ch_attach; 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; -#else /* Work around the lack of channel serialization in ATA_CAM. */ ctlr->channels = 1; device_printf(dev, "second channel ignored\n"); -#endif } else ctlr->setmode = ata_acard_86X_setmode; return 0; } -#ifndef ATA_CAM static int -ata_acard_chipdeinit(device_t dev) -{ - struct ata_pci_controller *ctlr = device_get_softc(dev); - struct ata_serialize *serial; - - if (ctlr->chip->cfg1 == ATP_OLD) { - serial = ctlr->chipset_data; - mtx_destroy(&serial->locked_mtx); - free(serial, M_ATAPCI); - ctlr->chipset_data = NULL; - } - return (0); -} -#endif - -static int ata_acard_ch_attach(device_t dev) { struct ata_channel *ch = device_get_softc(dev); /* setup the usual register normal pci style */ if (ata_pci_ch_attach(dev)) return ENXIO; ch->hw.status = ata_acard_status; ch->flags |= ATA_NO_ATAPI_DMA; return 0; } static int ata_acard_status(device_t dev) { - struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev)); struct ata_channel *ch = device_get_softc(dev); - if (ctlr->chip->cfg1 == ATP_OLD && - ATA_LOCKING(dev, ATA_LF_WHICH) != ch->unit) - return 0; if (ch->dma.flags & ATA_DMA_ACTIVE) { int bmstat = ATA_IDX_INB(ch, ATA_BMSTAT_PORT) & ATA_BMSTAT_MASK; if ((bmstat & (ATA_BMSTAT_ACTIVE | ATA_BMSTAT_INTERRUPT)) != ATA_BMSTAT_INTERRUPT) return 0; ATA_IDX_OUTB(ch, ATA_BMSTAT_PORT, bmstat & ~ATA_BMSTAT_ERROR); DELAY(1); ATA_IDX_OUTB(ch, ATA_BMCMD_PORT, ATA_IDX_INB(ch, ATA_BMCMD_PORT) & ~ATA_BMCMD_START_STOP); DELAY(1); } if (ATA_IDX_INB(ch, ATA_ALTSTAT) & ATA_S_BUSY) { DELAY(100); if (ATA_IDX_INB(ch, ATA_ALTSTAT) & ATA_S_BUSY) return 0; } return 1; } static int ata_acard_850_setmode(device_t dev, int target, int mode) { device_t parent = device_get_parent(dev); struct ata_pci_controller *ctlr = device_get_softc(parent); struct ata_channel *ch = device_get_softc(dev); int devno = (ch->unit << 1) + target; mode = min(mode, ctlr->chip->max_dma); /* XXX SOS missing WDMA0+1 + PIO modes */ if (mode >= ATA_WDMA2) { u_int8_t reg54 = pci_read_config(parent, 0x54, 1); reg54 &= ~(0x03 << (devno << 1)); if (mode >= ATA_UDMA0) reg54 |= (((mode & ATA_MODE_MASK) + 1) << (devno << 1)); pci_write_config(parent, 0x54, reg54, 1); pci_write_config(parent, 0x4a, 0xa6, 1); pci_write_config(parent, 0x40 + (devno << 1), 0x0301, 2); } /* we could set PIO mode timings, but we assume the BIOS did that */ return (mode); } static int ata_acard_86X_setmode(device_t dev, int target, int mode) { device_t parent = device_get_parent(dev); struct ata_pci_controller *ctlr = device_get_softc(parent); struct ata_channel *ch = device_get_softc(dev); int devno = (ch->unit << 1) + target; mode = min(mode, ctlr->chip->max_dma); /* XXX SOS missing WDMA0+1 + PIO modes */ if (mode >= ATA_WDMA2) { u_int16_t reg44 = pci_read_config(parent, 0x44, 2); reg44 &= ~(0x000f << (devno << 2)); if (mode >= ATA_UDMA0) reg44 |= (((mode & ATA_MODE_MASK) + 1) << (devno << 2)); pci_write_config(parent, 0x44, reg44, 2); pci_write_config(parent, 0x4a, 0xa6, 1); pci_write_config(parent, 0x40 + devno, 0x31, 1); } /* we could set PIO mode timings, but we assume the BIOS did that */ return (mode); } - -#ifndef ATA_CAM -static void -ata_serialize_init(struct ata_serialize *serial) -{ - - mtx_init(&serial->locked_mtx, "ATA serialize lock", NULL, MTX_DEF); - serial->locked_ch = -1; - serial->restart_ch = -1; -} - -static int -ata_serialize(device_t dev, int flags) -{ - struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev)); - struct ata_channel *ch = device_get_softc(dev); - struct ata_serialize *serial; - int res; - - serial = ctlr->chipset_data; - - mtx_lock(&serial->locked_mtx); - switch (flags) { - case ATA_LF_LOCK: - if (serial->locked_ch == -1) - serial->locked_ch = ch->unit; - if (serial->locked_ch != ch->unit) - serial->restart_ch = ch->unit; - break; - - case ATA_LF_UNLOCK: - if (serial->locked_ch == ch->unit) { - serial->locked_ch = -1; - if (serial->restart_ch != -1) { - if ((ch = ctlr->interrupt[serial->restart_ch].argument)) { - serial->restart_ch = -1; - mtx_unlock(&serial->locked_mtx); - ata_start(dev); - return -1; - } - } - } - break; - - case ATA_LF_WHICH: - break; - } - res = serial->locked_ch; - mtx_unlock(&serial->locked_mtx); - return res; -} -#endif ATA_DECLARE_DRIVER(ata_acard); Index: head/sys/dev/ata/chipsets/ata-acerlabs.c =================================================================== --- head/sys/dev/ata/chipsets/ata-acerlabs.c (revision 249082) +++ head/sys/dev/ata/chipsets/ata-acerlabs.c (revision 249083) @@ -1,353 +1,351 @@ /*- * Copyright (c) 1998 - 2008 Søren Schmidt * 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. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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. */ #include __FBSDID("$FreeBSD$"); #include "opt_ata.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /* local prototypes */ static int ata_ali_chipinit(device_t dev); static int ata_ali_chipdeinit(device_t dev); static int ata_ali_ch_attach(device_t dev); static int ata_ali_sata_ch_attach(device_t dev); static void ata_ali_reset(device_t dev); static int ata_ali_setmode(device_t dev, int target, int mode); /* misc defines */ #define ALI_OLD 0x01 #define ALI_NEW 0x02 #define ALI_SATA 0x04 struct ali_sata_resources { struct resource *bars[4]; }; /* * Acer Labs Inc (ALI) chipset support functions */ static int ata_ali_probe(device_t dev) { struct ata_pci_controller *ctlr = device_get_softc(dev); static const struct ata_chip_id ids[] = {{ ATA_ALI_5289, 0x00, 2, ALI_SATA, ATA_SA150, "M5289" }, { ATA_ALI_5288, 0x00, 4, ALI_SATA, ATA_SA300, "M5288" }, { ATA_ALI_5287, 0x00, 4, ALI_SATA, ATA_SA150, "M5287" }, { ATA_ALI_5281, 0x00, 2, ALI_SATA, ATA_SA150, "M5281" }, { ATA_ALI_5228, 0xc5, 0, ALI_NEW, ATA_UDMA6, "M5228" }, { ATA_ALI_5229, 0xc5, 0, ALI_NEW, ATA_UDMA6, "M5229" }, { ATA_ALI_5229, 0xc4, 0, ALI_NEW, ATA_UDMA5, "M5229" }, { ATA_ALI_5229, 0xc2, 0, ALI_NEW, ATA_UDMA4, "M5229" }, { ATA_ALI_5229, 0x20, 0, ALI_OLD, ATA_UDMA2, "M5229" }, { ATA_ALI_5229, 0x00, 0, ALI_OLD, ATA_WDMA2, "M5229" }, { 0, 0, 0, 0, 0, 0}}; if (pci_get_vendor(dev) != ATA_ACER_LABS_ID) return ENXIO; if (!(ctlr->chip = ata_match_chip(dev, ids))) return ENXIO; ata_set_desc(dev); ctlr->chipinit = ata_ali_chipinit; ctlr->chipdeinit = ata_ali_chipdeinit; return (BUS_PROBE_DEFAULT); } static int ata_ali_chipinit(device_t dev) { struct ata_pci_controller *ctlr = device_get_softc(dev); struct ali_sata_resources *res; int i, rid; if (ata_setup_interrupt(dev, ata_generic_intr)) return ENXIO; switch (ctlr->chip->cfg2) { case ALI_SATA: ctlr->channels = ctlr->chip->cfg1; ctlr->ch_attach = ata_ali_sata_ch_attach; ctlr->ch_detach = ata_pci_ch_detach; ctlr->setmode = ata_sata_setmode; ctlr->getrev = ata_sata_getrev; /* AHCI mode is correctly supported only on the ALi 5288. */ if ((ctlr->chip->chipid == ATA_ALI_5288) && (ata_ahci_chipinit(dev) != ENXIO)) return 0; /* Allocate resources for later use by channel attach routines. */ res = malloc(sizeof(struct ali_sata_resources), M_ATAPCI, M_WAITOK); for (i = 0; i < 4; i++) { rid = PCIR_BAR(i); res->bars[i] = bus_alloc_resource_any(dev, SYS_RES_IOPORT, &rid, RF_ACTIVE); if (res->bars[i] == NULL) { device_printf(dev, "Failed to allocate BAR %d\n", i); for (i--; i >=0; i--) bus_release_resource(dev, SYS_RES_IOPORT, PCIR_BAR(i), res->bars[i]); free(res, M_TEMP); return ENXIO; } } ctlr->chipset_data = res; break; case ALI_NEW: /* use device interrupt as byte count end */ pci_write_config(dev, 0x4a, pci_read_config(dev, 0x4a, 1) | 0x20, 1); /* enable cable detection and UDMA support on revisions < 0xc7 */ if (ctlr->chip->chiprev < 0xc7) pci_write_config(dev, 0x4b, pci_read_config(dev, 0x4b, 1) | 0x09, 1); /* enable ATAPI UDMA mode (even if we are going to do PIO) */ pci_write_config(dev, 0x53, pci_read_config(dev, 0x53, 1) | (ctlr->chip->chiprev >= 0xc7 ? 0x03 : 0x01), 1); /* only chips with revision > 0xc4 can do 48bit DMA */ if (ctlr->chip->chiprev <= 0xc4) device_printf(dev, "using PIO transfers above 137GB as workaround for " "48bit DMA access bug, expect reduced performance\n"); ctlr->ch_attach = ata_ali_ch_attach; ctlr->ch_detach = ata_pci_ch_detach; ctlr->reset = ata_ali_reset; ctlr->setmode = ata_ali_setmode; break; case ALI_OLD: /* deactivate the ATAPI FIFO and enable ATAPI UDMA */ pci_write_config(dev, 0x53, pci_read_config(dev, 0x53, 1) | 0x03, 1); ctlr->setmode = ata_ali_setmode; break; } return 0; } static int ata_ali_chipdeinit(device_t dev) { struct ata_pci_controller *ctlr = device_get_softc(dev); struct ali_sata_resources *res; int i; if (ctlr->chip->cfg2 == ALI_SATA) { res = ctlr->chipset_data; for (i = 0; i < 4; i++) { if (res->bars[i] != NULL) { bus_release_resource(dev, SYS_RES_IOPORT, PCIR_BAR(i), res->bars[i]); } } free(res, M_ATAPCI); ctlr->chipset_data = NULL; } return (0); } static int ata_ali_ch_attach(device_t dev) { struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev)); struct ata_channel *ch = device_get_softc(dev); /* setup the usual register normal pci style */ if (ata_pci_ch_attach(dev)) return ENXIO; if (ctlr->chip->cfg2 & ALI_NEW && ctlr->chip->chiprev < 0xc7) ch->flags |= ATA_CHECKS_CABLE; /* older chips can't do 48bit DMA transfers */ if (ctlr->chip->chiprev <= 0xc4) { ch->flags |= ATA_NO_48BIT_DMA; if (ch->dma.max_iosize > 256 * 512) ch->dma.max_iosize = 256 * 512; } -#ifdef ATA_CAM if (ctlr->chip->cfg2 & ALI_NEW) ch->flags |= ATA_NO_ATAPI_DMA; -#endif return 0; } static int ata_ali_sata_ch_attach(device_t dev) { device_t parent = device_get_parent(dev); struct ata_pci_controller *ctlr = device_get_softc(parent); struct ata_channel *ch = device_get_softc(dev); struct ali_sata_resources *res; struct resource *io = NULL, *ctlio = NULL; int unit01 = (ch->unit & 1), unit10 = (ch->unit & 2); int i; res = ctlr->chipset_data; if (unit01) { io = res->bars[2]; ctlio = res->bars[3]; } else { io = res->bars[0]; ctlio = res->bars[1]; } ata_pci_dmainit(dev); for (i = ATA_DATA; i <= ATA_COMMAND; i ++) { ch->r_io[i].res = io; ch->r_io[i].offset = i + (unit10 ? 8 : 0); } ch->r_io[ATA_CONTROL].res = ctlio; ch->r_io[ATA_CONTROL].offset = 2 + (unit10 ? 4 : 0); ch->r_io[ATA_IDX_ADDR].res = io; ata_default_registers(dev); if (ctlr->r_res1) { for (i = ATA_BMCMD_PORT; i <= ATA_BMDTP_PORT; i++) { ch->r_io[i].res = ctlr->r_res1; ch->r_io[i].offset = (i - ATA_BMCMD_PORT)+(ch->unit * ATA_BMIOSIZE); } } ch->flags |= ATA_NO_SLAVE; ch->flags |= ATA_SATA; /* XXX SOS PHY handling awkward in ALI chip not supported yet */ ata_pci_hw(dev); return 0; } static void ata_ali_reset(device_t dev) { struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev)); struct ata_channel *ch = device_get_softc(dev); device_t *children; int nchildren, i; ata_generic_reset(dev); /* * workaround for datacorruption bug found on at least SUN Blade-100 * find the ISA function on the southbridge and disable then enable * the ATA channel tristate buffer */ if (ctlr->chip->chiprev == 0xc3 || ctlr->chip->chiprev == 0xc2) { if (!device_get_children(GRANDPARENT(dev), &children, &nchildren)) { for (i = 0; i < nchildren; i++) { if (pci_get_devid(children[i]) == ATA_ALI_1533) { pci_write_config(children[i], 0x58, pci_read_config(children[i], 0x58, 1) & ~(0x04 << ch->unit), 1); pci_write_config(children[i], 0x58, pci_read_config(children[i], 0x58, 1) | (0x04 << ch->unit), 1); break; } } free(children, M_TEMP); } } } static int ata_ali_setmode(device_t dev, int target, int mode) { device_t parent = device_get_parent(dev); struct ata_pci_controller *ctlr = device_get_softc(parent); struct ata_channel *ch = device_get_softc(dev); int devno = (ch->unit << 1) + target; int piomode; static const uint32_t piotimings[] = { 0x006d0003, 0x00580002, 0x00440001, 0x00330001, 0x00310001, 0x006d0003, 0x00330001, 0x00310001 }; static const uint8_t udma[] = {0x0c, 0x0b, 0x0a, 0x09, 0x08, 0x0f, 0x0d}; uint32_t word54; mode = min(mode, ctlr->chip->max_dma); if (ctlr->chip->cfg2 & ALI_NEW && ctlr->chip->chiprev < 0xc7) { if (ata_dma_check_80pin && mode > ATA_UDMA2 && pci_read_config(parent, 0x4a, 1) & (1 << ch->unit)) { ata_print_cable(dev, "controller"); mode = ATA_UDMA2; } } if (ctlr->chip->cfg2 & ALI_OLD) { /* doesn't support ATAPI DMA on write */ ch->flags |= ATA_ATAPI_DMA_RO; if (ch->devices & ATA_ATAPI_MASTER && ch->devices & ATA_ATAPI_SLAVE) { /* doesn't support ATAPI DMA on two ATAPI devices */ device_printf(dev, "two atapi devices on this channel," " no DMA\n"); mode = min(mode, ATA_PIO_MAX); } } /* Set UDMA mode */ word54 = pci_read_config(parent, 0x54, 4); if (mode >= ATA_UDMA0) { word54 &= ~(0x000f000f << (devno << 2)); word54 |= (((udma[mode&ATA_MODE_MASK]<<16)|0x05)<<(devno<<2)); piomode = ATA_PIO4; } else { word54 &= ~(0x0008000f << (devno << 2)); piomode = mode; } pci_write_config(parent, 0x54, word54, 4); /* Set PIO/WDMA mode */ pci_write_config(parent, 0x58 + (ch->unit << 2), piotimings[ata_mode2idx(piomode)], 4); return (mode); } ATA_DECLARE_DRIVER(ata_ali); MODULE_DEPEND(ata_ali, ata_ahci, 1, 1, 1); Index: head/sys/dev/ata/chipsets/ata-intel.c =================================================================== --- head/sys/dev/ata/chipsets/ata-intel.c (revision 249082) +++ head/sys/dev/ata/chipsets/ata-intel.c (revision 249083) @@ -1,976 +1,947 @@ /*- * Copyright (c) 1998 - 2008 Søren Schmidt * 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. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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. */ #include __FBSDID("$FreeBSD$"); #include "opt_ata.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /* local prototypes */ static int ata_intel_chipinit(device_t dev); static int ata_intel_chipdeinit(device_t dev); static int ata_intel_ch_attach(device_t dev); static void ata_intel_reset(device_t dev); static int ata_intel_old_setmode(device_t dev, int target, int mode); static int ata_intel_new_setmode(device_t dev, int target, int mode); static int ata_intel_sch_setmode(device_t dev, int target, int mode); static int ata_intel_sata_getrev(device_t dev, int target); static int ata_intel_sata_status(device_t dev); static int ata_intel_sata_ahci_read(device_t dev, int port, int reg, u_int32_t *result); static int ata_intel_sata_cscr_read(device_t dev, int port, int reg, u_int32_t *result); static int ata_intel_sata_sidpr_read(device_t dev, int port, int reg, u_int32_t *result); static int ata_intel_sata_ahci_write(device_t dev, int port, int reg, u_int32_t result); static int ata_intel_sata_cscr_write(device_t dev, int port, int reg, u_int32_t result); static int ata_intel_sata_sidpr_write(device_t dev, int port, int reg, u_int32_t result); static int ata_intel_31244_ch_attach(device_t dev); static int ata_intel_31244_ch_detach(device_t dev); static int ata_intel_31244_status(device_t dev); static void ata_intel_31244_tf_write(struct ata_request *request); static void ata_intel_31244_reset(device_t dev); /* misc defines */ #define INTEL_AHCI 1 #define INTEL_ICH5 2 #define INTEL_6CH 4 #define INTEL_6CH2 8 #define INTEL_ICH7 16 struct ata_intel_data { struct mtx lock; u_char smap[4]; }; #define ATA_INTEL_SMAP(ctlr, ch) \ &((struct ata_intel_data *)((ctlr)->chipset_data))->smap[(ch)->unit * 2] #define ATA_INTEL_LOCK(ctlr) \ mtx_lock(&((struct ata_intel_data *)((ctlr)->chipset_data))->lock) #define ATA_INTEL_UNLOCK(ctlr) \ mtx_unlock(&((struct ata_intel_data *)((ctlr)->chipset_data))->lock) /* * Intel chipset support functions */ static int ata_intel_probe(device_t dev) { struct ata_pci_controller *ctlr = device_get_softc(dev); static const struct ata_chip_id ids[] = {{ ATA_I82371FB, 0, 0, 2, ATA_WDMA2, "PIIX" }, { ATA_I82371SB, 0, 0, 2, ATA_WDMA2, "PIIX3" }, { ATA_I82371AB, 0, 0, 2, ATA_UDMA2, "PIIX4" }, { ATA_I82443MX, 0, 0, 2, ATA_UDMA2, "PIIX4" }, { ATA_I82451NX, 0, 0, 2, ATA_UDMA2, "PIIX4" }, { ATA_I82801AB, 0, 0, 2, ATA_UDMA2, "ICH0" }, { ATA_I82801AA, 0, 0, 2, ATA_UDMA4, "ICH" }, { ATA_I82372FB, 0, 0, 2, ATA_UDMA4, "ICH" }, { ATA_I82801BA, 0, 0, 2, ATA_UDMA5, "ICH2" }, { ATA_I82801BA_1, 0, 0, 2, ATA_UDMA5, "ICH2" }, { ATA_I82801CA, 0, 0, 2, ATA_UDMA5, "ICH3" }, { ATA_I82801CA_1, 0, 0, 2, ATA_UDMA5, "ICH3" }, { ATA_I82801DB, 0, 0, 2, ATA_UDMA5, "ICH4" }, { ATA_I82801DB_1, 0, 0, 2, ATA_UDMA5, "ICH4" }, { ATA_I82801EB, 0, 0, 2, ATA_UDMA5, "ICH5" }, { ATA_I82801EB_S1, 0, INTEL_ICH5, 2, ATA_SA150, "ICH5" }, { ATA_I82801EB_R1, 0, INTEL_ICH5, 2, ATA_SA150, "ICH5" }, { ATA_I6300ESB, 0, 0, 2, ATA_UDMA5, "6300ESB" }, { ATA_I6300ESB_S1, 0, INTEL_ICH5, 2, ATA_SA150, "6300ESB" }, { ATA_I6300ESB_R1, 0, INTEL_ICH5, 2, ATA_SA150, "6300ESB" }, { ATA_I82801FB, 0, 0, 2, ATA_UDMA5, "ICH6" }, { ATA_I82801FB_S1, 0, INTEL_AHCI, 0, ATA_SA150, "ICH6" }, { ATA_I82801FB_R1, 0, INTEL_AHCI, 0, ATA_SA150, "ICH6" }, { ATA_I82801FBM, 0, INTEL_AHCI, 0, ATA_SA150, "ICH6M" }, { ATA_I82801GB, 0, 0, 1, ATA_UDMA5, "ICH7" }, { ATA_I82801GB_S1, 0, INTEL_ICH7, 0, ATA_SA300, "ICH7" }, { ATA_I82801GB_R1, 0, INTEL_AHCI, 0, ATA_SA300, "ICH7" }, { ATA_I82801GB_AH, 0, INTEL_AHCI, 0, ATA_SA300, "ICH7" }, { ATA_I82801GBM_S1, 0, INTEL_ICH7, 0, ATA_SA150, "ICH7M" }, { ATA_I82801GBM_R1, 0, INTEL_AHCI, 0, ATA_SA150, "ICH7M" }, { ATA_I82801GBM_AH, 0, INTEL_AHCI, 0, ATA_SA150, "ICH7M" }, { ATA_I63XXESB2, 0, 0, 1, ATA_UDMA5, "63XXESB2" }, { ATA_I63XXESB2_S1, 0, 0, 0, ATA_SA300, "63XXESB2" }, { ATA_I63XXESB2_S2, 0, INTEL_AHCI, 0, ATA_SA300, "63XXESB2" }, { ATA_I63XXESB2_R1, 0, INTEL_AHCI, 0, ATA_SA300, "63XXESB2" }, { ATA_I63XXESB2_R2, 0, INTEL_AHCI, 0, ATA_SA300, "63XXESB2" }, { ATA_I82801HB_S1, 0, INTEL_6CH, 0, ATA_SA300, "ICH8" }, { ATA_I82801HB_S2, 0, INTEL_6CH2, 0, ATA_SA300, "ICH8" }, { ATA_I82801HB_R1, 0, INTEL_AHCI, 0, ATA_SA300, "ICH8" }, { ATA_I82801HB_AH4, 0, INTEL_AHCI, 0, ATA_SA300, "ICH8" }, { ATA_I82801HB_AH6, 0, INTEL_AHCI, 0, ATA_SA300, "ICH8" }, { ATA_I82801HBM, 0, 0, 1, ATA_UDMA5, "ICH8M" }, { ATA_I82801HBM_S1, 0, INTEL_6CH, 0, ATA_SA300, "ICH8M" }, { ATA_I82801HBM_S2, 0, INTEL_AHCI, 0, ATA_SA300, "ICH8M" }, { ATA_I82801HBM_S3, 0, INTEL_AHCI, 0, ATA_SA300, "ICH8M" }, { ATA_I82801IB_S1, 0, INTEL_6CH, 0, ATA_SA300, "ICH9" }, { ATA_I82801IB_S2, 0, INTEL_6CH2, 0, ATA_SA300, "ICH9" }, { ATA_I82801IB_S3, 0, INTEL_6CH2, 0, ATA_SA300, "ICH9" }, { ATA_I82801IB_AH4, 0, INTEL_AHCI, 0, ATA_SA300, "ICH9" }, { ATA_I82801IB_AH6, 0, INTEL_AHCI, 0, ATA_SA300, "ICH9" }, { ATA_I82801IB_R1, 0, INTEL_AHCI, 0, ATA_SA300, "ICH9" }, { ATA_I82801IBM_S1, 0, INTEL_6CH2, 0, ATA_SA300, "ICH9M" }, { ATA_I82801IBM_AH, 0, INTEL_AHCI, 0, ATA_SA300, "ICH9M" }, { ATA_I82801IBM_R1, 0, INTEL_AHCI, 0, ATA_SA300, "ICH9M" }, { ATA_I82801IBM_S2, 0, INTEL_6CH2, 0, ATA_SA300, "ICH9M" }, { ATA_I82801JIB_S1, 0, INTEL_6CH, 0, ATA_SA300, "ICH10" }, { ATA_I82801JIB_AH, 0, INTEL_AHCI, 0, ATA_SA300, "ICH10" }, { ATA_I82801JIB_R1, 0, INTEL_AHCI, 0, ATA_SA300, "ICH10" }, { ATA_I82801JIB_S2, 0, INTEL_6CH2, 0, ATA_SA300, "ICH10" }, { ATA_I82801JD_S1, 0, INTEL_6CH, 0, ATA_SA300, "ICH10" }, { ATA_I82801JD_AH, 0, INTEL_AHCI, 0, ATA_SA300, "ICH10" }, { ATA_I82801JD_R1, 0, INTEL_AHCI, 0, ATA_SA300, "ICH10" }, { ATA_I82801JD_S2, 0, INTEL_6CH2, 0, ATA_SA300, "ICH10" }, { ATA_I82801JI_S1, 0, INTEL_6CH, 0, ATA_SA300, "ICH10" }, { ATA_I82801JI_AH, 0, INTEL_AHCI, 0, ATA_SA300, "ICH10" }, { ATA_I82801JI_R1, 0, INTEL_AHCI, 0, ATA_SA300, "ICH10" }, { ATA_I82801JI_S2, 0, INTEL_6CH2, 0, ATA_SA300, "ICH10" }, { ATA_5Series_S1, 0, INTEL_6CH, 0, ATA_SA300, "5 Series/3400 Series PCH" }, { ATA_5Series_S2, 0, INTEL_6CH2, 0, ATA_SA300, "5 Series/3400 Series PCH" }, { ATA_5Series_AH1, 0, INTEL_AHCI, 0, ATA_SA300, "5 Series/3400 Series PCH" }, { ATA_5Series_AH2, 0, INTEL_AHCI, 0, ATA_SA300, "5 Series/3400 Series PCH" }, { ATA_5Series_R1, 0, INTEL_AHCI, 0, ATA_SA300, "5 Series/3400 Series PCH" }, { ATA_5Series_S3, 0, INTEL_6CH2, 0, ATA_SA300, "5 Series/3400 Series PCH" }, { ATA_5Series_S4, 0, INTEL_6CH, 0, ATA_SA300, "5 Series/3400 Series PCH" }, { ATA_5Series_AH3, 0, INTEL_AHCI, 0, ATA_SA300, "5 Series/3400 Series PCH" }, { ATA_5Series_R2, 0, INTEL_AHCI, 0, ATA_SA300, "5 Series/3400 Series PCH" }, { ATA_5Series_S5, 0, INTEL_6CH2, 0, ATA_SA300, "5 Series/3400 Series PCH" }, { ATA_5Series_S6, 0, INTEL_6CH, 0, ATA_SA300, "5 Series/3400 Series PCH" }, { ATA_5Series_AH4, 0, INTEL_AHCI, 0, ATA_SA300, "5 Series/3400 Series PCH" }, { ATA_CPT_S1, 0, INTEL_6CH, 0, ATA_SA300, "Cougar Point" }, { ATA_CPT_S2, 0, INTEL_6CH, 0, ATA_SA300, "Cougar Point" }, { ATA_CPT_AH1, 0, INTEL_AHCI, 0, ATA_SA300, "Cougar Point" }, { ATA_CPT_AH2, 0, INTEL_AHCI, 0, ATA_SA300, "Cougar Point" }, { ATA_CPT_R1, 0, INTEL_AHCI, 0, ATA_SA300, "Cougar Point" }, { ATA_CPT_R2, 0, INTEL_AHCI, 0, ATA_SA300, "Cougar Point" }, { ATA_CPT_S3, 0, INTEL_6CH2, 0, ATA_SA300, "Cougar Point" }, { ATA_CPT_S4, 0, INTEL_6CH2, 0, ATA_SA300, "Cougar Point" }, { ATA_PBG_S1, 0, INTEL_6CH, 0, ATA_SA300, "Patsburg" }, { ATA_PBG_AH1, 0, INTEL_AHCI, 0, ATA_SA300, "Patsburg" }, { ATA_PBG_R1, 0, INTEL_AHCI, 0, ATA_SA300, "Patsburg" }, { ATA_PBG_R2, 0, INTEL_AHCI, 0, ATA_SA300, "Patsburg" }, { ATA_PBG_R3, 0, INTEL_AHCI, 0, ATA_SA300, "Patsburg" }, { ATA_PBG_S2, 0, INTEL_6CH2, 0, ATA_SA300, "Patsburg" }, { ATA_PPT_S1, 0, INTEL_6CH, 0, ATA_SA300, "Panther Point" }, { ATA_PPT_S2, 0, INTEL_6CH, 0, ATA_SA300, "Panther Point" }, { ATA_PPT_AH1, 0, INTEL_AHCI, 0, ATA_SA300, "Panther Point" }, { ATA_PPT_AH2, 0, INTEL_AHCI, 0, ATA_SA300, "Panther Point" }, { ATA_PPT_R1, 0, INTEL_AHCI, 0, ATA_SA300, "Panther Point" }, { ATA_PPT_R2, 0, INTEL_AHCI, 0, ATA_SA300, "Panther Point" }, { ATA_PPT_R3, 0, INTEL_AHCI, 0, ATA_SA300, "Panther Point" }, { ATA_PPT_R4, 0, INTEL_AHCI, 0, ATA_SA300, "Panther Point" }, { ATA_PPT_S3, 0, INTEL_6CH2, 0, ATA_SA300, "Panther Point" }, { ATA_PPT_S4, 0, INTEL_6CH2, 0, ATA_SA300, "Panther Point" }, { ATA_PPT_R5, 0, INTEL_AHCI, 0, ATA_SA300, "Panther Point" }, { ATA_PPT_R6, 0, INTEL_AHCI, 0, ATA_SA300, "Panther Point" }, { ATA_LPT_S1, 0, INTEL_6CH, 0, ATA_SA300, "Lynx Point" }, { ATA_LPT_S2, 0, INTEL_6CH, 0, ATA_SA300, "Lynx Point" }, { ATA_LPT_AH1, 0, INTEL_AHCI, 0, ATA_SA300, "Lynx Point" }, { ATA_LPT_AH2, 0, INTEL_AHCI, 0, ATA_SA300, "Lynx Point" }, { ATA_LPT_R1, 0, INTEL_AHCI, 0, ATA_SA300, "Lynx Point" }, { ATA_LPT_R2, 0, INTEL_AHCI, 0, ATA_SA300, "Lynx Point" }, { ATA_LPT_R3, 0, INTEL_AHCI, 0, ATA_SA300, "Lynx Point" }, { ATA_LPT_R4, 0, INTEL_AHCI, 0, ATA_SA300, "Lynx Point" }, { ATA_LPT_S3, 0, INTEL_6CH2, 0, ATA_SA300, "Lynx Point" }, { ATA_LPT_S4, 0, INTEL_6CH2, 0, ATA_SA300, "Lynx Point" }, { ATA_LPT_R5, 0, INTEL_AHCI, 0, ATA_SA300, "Lynx Point" }, { ATA_LPT_R6, 0, INTEL_AHCI, 0, ATA_SA300, "Lynx Point" }, { ATA_I31244, 0, 0, 2, ATA_SA150, "31244" }, { ATA_ISCH, 0, 0, 1, ATA_UDMA5, "SCH" }, { ATA_DH89XXCC, 0, INTEL_AHCI, 0, ATA_SA300, "DH89xxCC" }, { 0, 0, 0, 0, 0, 0}}; if (pci_get_vendor(dev) != ATA_INTEL_ID) return ENXIO; if (!(ctlr->chip = ata_match_chip(dev, ids))) return ENXIO; ata_set_desc(dev); ctlr->chipinit = ata_intel_chipinit; ctlr->chipdeinit = ata_intel_chipdeinit; return (BUS_PROBE_DEFAULT); } static int ata_intel_chipinit(device_t dev) { struct ata_pci_controller *ctlr = device_get_softc(dev); struct ata_intel_data *data; if (ata_setup_interrupt(dev, ata_generic_intr)) return ENXIO; data = malloc(sizeof(struct ata_intel_data), M_ATAPCI, M_WAITOK | M_ZERO); mtx_init(&data->lock, "Intel SATA lock", NULL, MTX_DEF); ctlr->chipset_data = (void *)data; /* good old PIIX needs special treatment (not implemented) */ if (ctlr->chip->chipid == ATA_I82371FB) { ctlr->setmode = ata_intel_old_setmode; } /* the intel 31244 needs special care if in DPA mode */ else if (ctlr->chip->chipid == ATA_I31244) { if (pci_get_subclass(dev) != PCIS_STORAGE_IDE) { ctlr->r_type2 = SYS_RES_MEMORY; ctlr->r_rid2 = PCIR_BAR(0); if (!(ctlr->r_res2 = bus_alloc_resource_any(dev, ctlr->r_type2, &ctlr->r_rid2, RF_ACTIVE))) return ENXIO; ctlr->channels = 4; ctlr->ch_attach = ata_intel_31244_ch_attach; ctlr->ch_detach = ata_intel_31244_ch_detach; ctlr->reset = ata_intel_31244_reset; } ctlr->setmode = ata_sata_setmode; ctlr->getrev = ata_sata_getrev; } /* SCH */ else if (ctlr->chip->chipid == ATA_ISCH) { ctlr->channels = 1; ctlr->ch_attach = ata_intel_ch_attach; ctlr->ch_detach = ata_pci_ch_detach; ctlr->setmode = ata_intel_sch_setmode; } /* non SATA intel chips goes here */ else if (ctlr->chip->max_dma < ATA_SA150) { ctlr->channels = ctlr->chip->cfg2; ctlr->ch_attach = ata_intel_ch_attach; ctlr->ch_detach = ata_pci_ch_detach; ctlr->setmode = ata_intel_new_setmode; } /* SATA parts can be either compat or AHCI */ else { /* force all ports active "the legacy way" */ pci_write_config(dev, 0x92, pci_read_config(dev, 0x92, 2) | 0x0f, 2); ctlr->ch_attach = ata_intel_ch_attach; ctlr->ch_detach = ata_pci_ch_detach; ctlr->reset = ata_intel_reset; /* * if we have AHCI capability and AHCI or RAID mode enabled * in BIOS we try for AHCI mode */ if ((ctlr->chip->cfg1 & INTEL_AHCI) && (pci_read_config(dev, 0x90, 1) & 0xc0) && (ata_ahci_chipinit(dev) != ENXIO)) return 0; /* BAR(5) may point to SATA interface registers */ if ((ctlr->chip->cfg1 & INTEL_ICH7)) { ctlr->r_type2 = SYS_RES_MEMORY; ctlr->r_rid2 = PCIR_BAR(5); ctlr->r_res2 = bus_alloc_resource_any(dev, ctlr->r_type2, &ctlr->r_rid2, RF_ACTIVE); if (ctlr->r_res2 != NULL) { /* Set SCRAE bit to enable registers access. */ pci_write_config(dev, 0x94, pci_read_config(dev, 0x94, 4) | (1 << 9), 4); /* Set Ports Implemented register bits. */ ATA_OUTL(ctlr->r_res2, 0x0C, ATA_INL(ctlr->r_res2, 0x0C) | 0xf); } /* Skip BAR(5) on ICH8M Apples, system locks up on access. */ } else if (ctlr->chip->chipid != ATA_I82801HBM_S1 || pci_get_subvendor(dev) != 0x106b) { ctlr->r_type2 = SYS_RES_IOPORT; ctlr->r_rid2 = PCIR_BAR(5); ctlr->r_res2 = bus_alloc_resource_any(dev, ctlr->r_type2, &ctlr->r_rid2, RF_ACTIVE); } if (ctlr->r_res2 != NULL || (ctlr->chip->cfg1 & INTEL_ICH5)) ctlr->getrev = ata_intel_sata_getrev; ctlr->setmode = ata_sata_setmode; } return 0; } static int ata_intel_chipdeinit(device_t dev) { struct ata_pci_controller *ctlr = device_get_softc(dev); struct ata_intel_data *data; data = ctlr->chipset_data; mtx_destroy(&data->lock); free(data, M_ATAPCI); ctlr->chipset_data = NULL; return (0); } static int ata_intel_ch_attach(device_t dev) { struct ata_pci_controller *ctlr; struct ata_channel *ch; u_char *smap; u_int map; /* setup the usual register normal pci style */ if (ata_pci_ch_attach(dev)) return (ENXIO); ctlr = device_get_softc(device_get_parent(dev)); ch = device_get_softc(dev); /* if r_res2 is valid it points to SATA interface registers */ if (ctlr->r_res2) { ch->r_io[ATA_IDX_ADDR].res = ctlr->r_res2; ch->r_io[ATA_IDX_ADDR].offset = 0x00; ch->r_io[ATA_IDX_DATA].res = ctlr->r_res2; ch->r_io[ATA_IDX_DATA].offset = 0x04; } ch->flags |= ATA_ALWAYS_DMASTAT; if (ctlr->chip->max_dma >= ATA_SA150) { smap = ATA_INTEL_SMAP(ctlr, ch); map = pci_read_config(device_get_parent(dev), 0x90, 1); if (ctlr->chip->cfg1 & INTEL_ICH5) { map &= 0x07; if ((map & 0x04) == 0) { ch->flags |= ATA_SATA; ch->flags |= ATA_NO_SLAVE; smap[0] = (map & 0x01) ^ ch->unit; smap[1] = 0; } else if ((map & 0x02) == 0 && ch->unit == 0) { ch->flags |= ATA_SATA; smap[0] = (map & 0x01) ? 1 : 0; smap[1] = (map & 0x01) ? 0 : 1; } else if ((map & 0x02) != 0 && ch->unit == 1) { ch->flags |= ATA_SATA; smap[0] = (map & 0x01) ? 1 : 0; smap[1] = (map & 0x01) ? 0 : 1; } } else if (ctlr->chip->cfg1 & INTEL_6CH2) { ch->flags |= ATA_SATA; ch->flags |= ATA_NO_SLAVE; smap[0] = (ch->unit == 0) ? 0 : 1; smap[1] = 0; } else { map &= 0x03; if (map == 0x00) { ch->flags |= ATA_SATA; smap[0] = (ch->unit == 0) ? 0 : 1; smap[1] = (ch->unit == 0) ? 2 : 3; } else if (map == 0x02 && ch->unit == 0) { ch->flags |= ATA_SATA; smap[0] = 0; smap[1] = 2; } else if (map == 0x01 && ch->unit == 1) { ch->flags |= ATA_SATA; smap[0] = 1; smap[1] = 3; } } if (ch->flags & ATA_SATA) { if ((ctlr->chip->cfg1 & INTEL_ICH5)) { ch->flags |= ATA_PERIODIC_POLL; ch->hw.status = ata_intel_sata_status; ch->hw.pm_read = ata_intel_sata_cscr_read; ch->hw.pm_write = ata_intel_sata_cscr_write; } else if (ctlr->r_res2) { ch->flags |= ATA_PERIODIC_POLL; ch->hw.status = ata_intel_sata_status; if ((ctlr->chip->cfg1 & INTEL_ICH7)) { ch->hw.pm_read = ata_intel_sata_ahci_read; ch->hw.pm_write = ata_intel_sata_ahci_write; } else { ch->hw.pm_read = ata_intel_sata_sidpr_read; ch->hw.pm_write = ata_intel_sata_sidpr_write; }; } if (ch->hw.pm_write != NULL) { ata_sata_scr_write(ch, 0, ATA_SERROR, 0xffffffff); if ((ch->flags & ATA_NO_SLAVE) == 0) { ata_sata_scr_write(ch, 1, ATA_SERROR, 0xffffffff); } } } else ctlr->setmode = ata_intel_new_setmode; } else if (ctlr->chip->chipid != ATA_ISCH) ch->flags |= ATA_CHECKS_CABLE; return (0); } static void ata_intel_reset(device_t dev) { device_t parent = device_get_parent(dev); struct ata_pci_controller *ctlr = device_get_softc(parent); struct ata_channel *ch = device_get_softc(dev); int mask, pshift, timeout, devs; u_char *smap; uint16_t pcs; /* In combined mode, skip SATA stuff for PATA channel. */ if ((ch->flags & ATA_SATA) == 0) return (ata_generic_reset(dev)); /* Do hard-reset on respective SATA ports. */ smap = ATA_INTEL_SMAP(ctlr, ch); mask = 1 << smap[0]; if ((ch->flags & ATA_NO_SLAVE) == 0) mask |= (1 << smap[1]); pci_write_config(parent, 0x92, pci_read_config(parent, 0x92, 2) & ~mask, 2); DELAY(10); pci_write_config(parent, 0x92, pci_read_config(parent, 0x92, 2) | mask, 2); /* Wait up to 1 sec for "connect well". */ if (ctlr->chip->cfg1 & (INTEL_6CH | INTEL_6CH2)) pshift = 8; else pshift = 4; for (timeout = 0; timeout < 100 ; timeout++) { pcs = (pci_read_config(parent, 0x92, 2) >> pshift) & mask; if ((pcs == mask) && (ATA_IDX_INB(ch, ATA_STATUS) != 0xff)) break; ata_udelay(10000); } if (bootverbose) device_printf(dev, "SATA reset: ports status=0x%02x\n", pcs); /* If any device found, do soft-reset. */ if (ch->hw.pm_read != NULL) { devs = ata_sata_phy_reset(dev, 0, 2) ? ATA_ATA_MASTER : 0; if ((ch->flags & ATA_NO_SLAVE) == 0) devs |= ata_sata_phy_reset(dev, 1, 2) ? ATA_ATA_SLAVE : 0; } else { devs = (pcs & (1 << smap[0])) ? ATA_ATA_MASTER : 0; if ((ch->flags & ATA_NO_SLAVE) == 0) devs |= (pcs & (1 << smap[1])) ? ATA_ATA_SLAVE : 0; } if (devs) { ata_generic_reset(dev); /* Reset may give fake slave when only ATAPI master present. */ ch->devices &= (devs | (devs * ATA_ATAPI_MASTER)); } else ch->devices = 0; } static int ata_intel_old_setmode(device_t dev, int target, int mode) { device_t parent = device_get_parent(dev); struct ata_pci_controller *ctlr = device_get_softc(parent); mode = min(mode, ctlr->chip->max_dma); return (mode); } static int ata_intel_new_setmode(device_t dev, int target, int mode) { device_t parent = device_get_parent(dev); struct ata_pci_controller *ctlr = device_get_softc(parent); struct ata_channel *ch = device_get_softc(dev); int devno = (ch->unit << 1) + target; int piomode; u_int32_t reg40 = pci_read_config(parent, 0x40, 4); u_int8_t reg44 = pci_read_config(parent, 0x44, 1); u_int8_t reg48 = pci_read_config(parent, 0x48, 1); u_int16_t reg4a = pci_read_config(parent, 0x4a, 2); u_int16_t reg54 = pci_read_config(parent, 0x54, 2); u_int32_t mask40 = 0, new40 = 0; u_int8_t mask44 = 0, new44 = 0; static const uint8_t timings[] = { 0x00, 0x00, 0x10, 0x21, 0x23, 0x00, 0x21, 0x23 }; static const uint8_t utimings[] = { 0x00, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02 }; /* In combined mode, skip PATA stuff for SATA channel. */ if (ch->flags & ATA_SATA) return (ata_sata_setmode(dev, target, mode)); mode = min(mode, ctlr->chip->max_dma); if (ata_dma_check_80pin && mode > ATA_UDMA2 && !(reg54 & (0x10 << devno))) { ata_print_cable(dev, "controller"); mode = ATA_UDMA2; } /* Enable/disable UDMA and set timings. */ if (mode >= ATA_UDMA0) { pci_write_config(parent, 0x48, reg48 | (0x0001 << devno), 2); pci_write_config(parent, 0x4a, (reg4a & ~(0x3 << (devno << 2))) | (utimings[mode & ATA_MODE_MASK] << (devno<<2)), 2); piomode = ATA_PIO4; } else { pci_write_config(parent, 0x48, reg48 & ~(0x0001 << devno), 2); pci_write_config(parent, 0x4a, (reg4a & ~(0x3 << (devno << 2))),2); piomode = mode; } reg54 |= 0x0400; /* Set UDMA reference clock (33/66/133MHz). */ reg54 &= ~(0x1001 << devno); if (mode >= ATA_UDMA5) reg54 |= (0x1000 << devno); else if (mode >= ATA_UDMA3) reg54 |= (0x1 << devno); pci_write_config(parent, 0x54, reg54, 2); /* Allow PIO/WDMA timing controls. */ reg40 &= ~0x00ff00ff; reg40 |= 0x40774077; /* Set PIO/WDMA timings. */ if (target == 0) { mask40 = 0x3300; new40 = timings[ata_mode2idx(piomode)] << 8; } else { mask44 = 0x0f; new44 = ((timings[ata_mode2idx(piomode)] & 0x30) >> 2) | (timings[ata_mode2idx(piomode)] & 0x03); } if (ch->unit) { mask40 <<= 16; new40 <<= 16; mask44 <<= 4; new44 <<= 4; } pci_write_config(parent, 0x40, (reg40 & ~mask40) | new40, 4); pci_write_config(parent, 0x44, (reg44 & ~mask44) | new44, 1); return (mode); } static int ata_intel_sch_setmode(device_t dev, int target, int mode) { device_t parent = device_get_parent(dev); struct ata_pci_controller *ctlr = device_get_softc(parent); u_int8_t dtim = 0x80 + (target << 2); u_int32_t tim = pci_read_config(parent, dtim, 4); int piomode; mode = min(mode, ctlr->chip->max_dma); if (mode >= ATA_UDMA0) { tim |= (0x1 << 31); tim &= ~(0x7 << 16); tim |= ((mode & ATA_MODE_MASK) << 16); piomode = ATA_PIO4; } else if (mode >= ATA_WDMA0) { tim &= ~(0x1 << 31); tim &= ~(0x3 << 8); tim |= ((mode & ATA_MODE_MASK) << 8); piomode = (mode == ATA_WDMA0) ? ATA_PIO0 : (mode == ATA_WDMA1) ? ATA_PIO3 : ATA_PIO4; } else piomode = mode; tim &= ~(0x7); tim |= (piomode & 0x7); pci_write_config(parent, dtim, tim, 4); return (mode); } static int ata_intel_sata_getrev(device_t dev, int target) { struct ata_channel *ch = device_get_softc(dev); uint32_t status; if (ata_sata_scr_read(ch, target, ATA_SSTATUS, &status) == 0) return ((status & 0x0f0) >> 4); return (0xff); } static int ata_intel_sata_status(device_t dev) { struct ata_channel *ch = device_get_softc(dev); ata_sata_phy_check_events(dev, 0); if ((ch->flags & ATA_NO_SLAVE) == 0) ata_sata_phy_check_events(dev, 1); return ata_pci_status(dev); } static int ata_intel_sata_ahci_read(device_t dev, int port, int reg, u_int32_t *result) { struct ata_pci_controller *ctlr; struct ata_channel *ch; device_t parent; u_char *smap; int offset; parent = device_get_parent(dev); ctlr = device_get_softc(parent); ch = device_get_softc(dev); port = (port == 1) ? 1 : 0; smap = ATA_INTEL_SMAP(ctlr, ch); offset = 0x100 + smap[port] * 0x80; switch (reg) { case ATA_SSTATUS: reg = 0x28; break; case ATA_SCONTROL: reg = 0x2c; break; case ATA_SERROR: reg = 0x30; break; default: return (EINVAL); } *result = ATA_INL(ctlr->r_res2, offset + reg); return (0); } static int ata_intel_sata_cscr_read(device_t dev, int port, int reg, u_int32_t *result) { struct ata_pci_controller *ctlr; struct ata_channel *ch; device_t parent; u_char *smap; parent = device_get_parent(dev); ctlr = device_get_softc(parent); ch = device_get_softc(dev); smap = ATA_INTEL_SMAP(ctlr, ch); port = (port == 1) ? 1 : 0; switch (reg) { case ATA_SSTATUS: reg = 0; break; case ATA_SERROR: reg = 1; break; case ATA_SCONTROL: reg = 2; break; default: return (EINVAL); } ATA_INTEL_LOCK(ctlr); pci_write_config(parent, 0xa0, 0x50 + smap[port] * 0x10 + reg * 4, 4); *result = pci_read_config(parent, 0xa4, 4); ATA_INTEL_UNLOCK(ctlr); return (0); } static int ata_intel_sata_sidpr_read(device_t dev, int port, int reg, u_int32_t *result) { struct ata_pci_controller *ctlr; struct ata_channel *ch; device_t parent; parent = device_get_parent(dev); ctlr = device_get_softc(parent); ch = device_get_softc(dev); port = (port == 1) ? 1 : 0; switch (reg) { case ATA_SSTATUS: reg = 0; break; case ATA_SCONTROL: reg = 1; break; case ATA_SERROR: reg = 2; break; default: return (EINVAL); } ATA_INTEL_LOCK(ctlr); ATA_IDX_OUTL(ch, ATA_IDX_ADDR, ((ch->unit * 2 + port) << 8) + reg); *result = ATA_IDX_INL(ch, ATA_IDX_DATA); ATA_INTEL_UNLOCK(ctlr); return (0); } static int ata_intel_sata_ahci_write(device_t dev, int port, int reg, u_int32_t value) { struct ata_pci_controller *ctlr; struct ata_channel *ch; device_t parent; u_char *smap; int offset; parent = device_get_parent(dev); ctlr = device_get_softc(parent); ch = device_get_softc(dev); port = (port == 1) ? 1 : 0; smap = ATA_INTEL_SMAP(ctlr, ch); offset = 0x100 + smap[port] * 0x80; switch (reg) { case ATA_SSTATUS: reg = 0x28; break; case ATA_SCONTROL: reg = 0x2c; break; case ATA_SERROR: reg = 0x30; break; default: return (EINVAL); } ATA_OUTL(ctlr->r_res2, offset + reg, value); return (0); } static int ata_intel_sata_cscr_write(device_t dev, int port, int reg, u_int32_t value) { struct ata_pci_controller *ctlr; struct ata_channel *ch; device_t parent; u_char *smap; parent = device_get_parent(dev); ctlr = device_get_softc(parent); ch = device_get_softc(dev); smap = ATA_INTEL_SMAP(ctlr, ch); port = (port == 1) ? 1 : 0; switch (reg) { case ATA_SSTATUS: reg = 0; break; case ATA_SERROR: reg = 1; break; case ATA_SCONTROL: reg = 2; break; default: return (EINVAL); } ATA_INTEL_LOCK(ctlr); pci_write_config(parent, 0xa0, 0x50 + smap[port] * 0x10 + reg * 4, 4); pci_write_config(parent, 0xa4, value, 4); ATA_INTEL_UNLOCK(ctlr); return (0); } static int ata_intel_sata_sidpr_write(device_t dev, int port, int reg, u_int32_t value) { struct ata_pci_controller *ctlr; struct ata_channel *ch; device_t parent; parent = device_get_parent(dev); ctlr = device_get_softc(parent); ch = device_get_softc(dev); port = (port == 1) ? 1 : 0; switch (reg) { case ATA_SSTATUS: reg = 0; break; case ATA_SCONTROL: reg = 1; break; case ATA_SERROR: reg = 2; break; default: return (EINVAL); } ATA_INTEL_LOCK(ctlr); ATA_IDX_OUTL(ch, ATA_IDX_ADDR, ((ch->unit * 2 + port) << 8) + reg); ATA_IDX_OUTL(ch, ATA_IDX_DATA, value); ATA_INTEL_UNLOCK(ctlr); return (0); } static int ata_intel_31244_ch_attach(device_t dev) { struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev)); struct ata_channel *ch = device_get_softc(dev); int i; int ch_offset; ata_pci_dmainit(dev); ch_offset = 0x200 + ch->unit * 0x200; for (i = ATA_DATA; i < ATA_MAX_RES; i++) ch->r_io[i].res = ctlr->r_res2; /* setup ATA registers */ ch->r_io[ATA_DATA].offset = ch_offset + 0x00; ch->r_io[ATA_FEATURE].offset = ch_offset + 0x06; ch->r_io[ATA_COUNT].offset = ch_offset + 0x08; ch->r_io[ATA_SECTOR].offset = ch_offset + 0x0c; ch->r_io[ATA_CYL_LSB].offset = ch_offset + 0x10; ch->r_io[ATA_CYL_MSB].offset = ch_offset + 0x14; ch->r_io[ATA_DRIVE].offset = ch_offset + 0x18; ch->r_io[ATA_COMMAND].offset = ch_offset + 0x1d; ch->r_io[ATA_ERROR].offset = ch_offset + 0x04; ch->r_io[ATA_STATUS].offset = ch_offset + 0x1c; ch->r_io[ATA_ALTSTAT].offset = ch_offset + 0x28; ch->r_io[ATA_CONTROL].offset = ch_offset + 0x29; /* setup DMA registers */ ch->r_io[ATA_SSTATUS].offset = ch_offset + 0x100; ch->r_io[ATA_SERROR].offset = ch_offset + 0x104; ch->r_io[ATA_SCONTROL].offset = ch_offset + 0x108; /* setup SATA registers */ ch->r_io[ATA_BMCMD_PORT].offset = ch_offset + 0x70; ch->r_io[ATA_BMSTAT_PORT].offset = ch_offset + 0x72; ch->r_io[ATA_BMDTP_PORT].offset = ch_offset + 0x74; ch->flags |= ATA_NO_SLAVE; ch->flags |= ATA_SATA; ata_pci_hw(dev); ch->hw.status = ata_intel_31244_status; ch->hw.tf_write = ata_intel_31244_tf_write; /* enable PHY state change interrupt */ ATA_OUTL(ctlr->r_res2, 0x4, ATA_INL(ctlr->r_res2, 0x04) | (0x01 << (ch->unit << 3))); return 0; } static int ata_intel_31244_ch_detach(device_t dev) { ata_pci_dmafini(dev); return (0); } static int ata_intel_31244_status(device_t dev) { /* do we have any PHY events ? */ ata_sata_phy_check_events(dev, -1); /* any drive action to take care of ? */ return ata_pci_status(dev); } static void ata_intel_31244_tf_write(struct ata_request *request) { struct ata_channel *ch = device_get_softc(request->parent); -#ifndef ATA_CAM - struct ata_device *atadev = device_get_softc(request->dev); -#endif if (request->flags & ATA_R_48BIT) { ATA_IDX_OUTW(ch, ATA_FEATURE, request->u.ata.feature); ATA_IDX_OUTW(ch, ATA_COUNT, request->u.ata.count); ATA_IDX_OUTW(ch, ATA_SECTOR, ((request->u.ata.lba >> 16) & 0xff00) | (request->u.ata.lba & 0x00ff)); ATA_IDX_OUTW(ch, ATA_CYL_LSB, ((request->u.ata.lba >> 24) & 0xff00) | ((request->u.ata.lba >> 8) & 0x00ff)); ATA_IDX_OUTW(ch, ATA_CYL_MSB, ((request->u.ata.lba >> 32) & 0xff00) | ((request->u.ata.lba >> 16) & 0x00ff)); ATA_IDX_OUTW(ch, ATA_DRIVE, ATA_D_LBA | ATA_DEV(request->unit)); } else { ATA_IDX_OUTB(ch, ATA_FEATURE, request->u.ata.feature); ATA_IDX_OUTB(ch, ATA_COUNT, request->u.ata.count); -#ifndef ATA_CAM - if (atadev->flags & ATA_D_USE_CHS) { - int heads, sectors; - - if (atadev->param.atavalid & ATA_FLAG_54_58) { - heads = atadev->param.current_heads; - sectors = atadev->param.current_sectors; - } - else { - heads = atadev->param.heads; - sectors = atadev->param.sectors; - } - ATA_IDX_OUTB(ch, ATA_SECTOR, (request->u.ata.lba % sectors)+1); - ATA_IDX_OUTB(ch, ATA_CYL_LSB, - (request->u.ata.lba / (sectors * heads))); - ATA_IDX_OUTB(ch, ATA_CYL_MSB, - (request->u.ata.lba / (sectors * heads)) >> 8); - ATA_IDX_OUTB(ch, ATA_DRIVE, ATA_D_IBM | ATA_DEV(request->unit) | - (((request->u.ata.lba% (sectors * heads)) / - sectors) & 0xf)); - } - else { -#endif ATA_IDX_OUTB(ch, ATA_SECTOR, request->u.ata.lba); ATA_IDX_OUTB(ch, ATA_CYL_LSB, request->u.ata.lba >> 8); ATA_IDX_OUTB(ch, ATA_CYL_MSB, request->u.ata.lba >> 16); ATA_IDX_OUTB(ch, ATA_DRIVE, ATA_D_IBM | ATA_D_LBA | ATA_DEV(request->unit) | ((request->u.ata.lba >> 24) & 0x0f)); -#ifndef ATA_CAM - } -#endif } } static void ata_intel_31244_reset(device_t dev) { struct ata_channel *ch = device_get_softc(dev); if (ata_sata_phy_reset(dev, -1, 1)) ata_generic_reset(dev); else ch->devices = 0; } ATA_DECLARE_DRIVER(ata_intel); MODULE_DEPEND(ata_intel, ata_ahci, 1, 1, 1); Index: head/sys/dev/ata/chipsets/ata-ite.c =================================================================== --- head/sys/dev/ata/chipsets/ata-ite.c (revision 249082) +++ head/sys/dev/ata/chipsets/ata-ite.c (revision 249083) @@ -1,238 +1,236 @@ /*- * Copyright (c) 1998 - 2008 Søren Schmidt * 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. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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. */ #include __FBSDID("$FreeBSD$"); #include "opt_ata.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /* local prototypes */ static int ata_ite_chipinit(device_t dev); static int ata_ite_ch_attach(device_t dev); static int ata_ite_821x_setmode(device_t dev, int target, int mode); static int ata_ite_8213_setmode(device_t dev, int target, int mode); /* * Integrated Technology Express Inc. (ITE) chipset support functions */ static int ata_ite_probe(device_t dev) { struct ata_pci_controller *ctlr = device_get_softc(dev); static const struct ata_chip_id ids[] = {{ ATA_IT8213F, 0x00, 0x00, 0x00, ATA_UDMA6, "IT8213F" }, { ATA_IT8212F, 0x00, 0x00, 0x00, ATA_UDMA6, "IT8212F" }, { ATA_IT8211F, 0x00, 0x00, 0x00, ATA_UDMA6, "IT8211F" }, { 0, 0, 0, 0, 0, 0}}; if (pci_get_vendor(dev) != ATA_ITE_ID) return ENXIO; if (!(ctlr->chip = ata_match_chip(dev, ids))) return ENXIO; ata_set_desc(dev); ctlr->chipinit = ata_ite_chipinit; return (BUS_PROBE_DEFAULT); } static int ata_ite_chipinit(device_t dev) { struct ata_pci_controller *ctlr = device_get_softc(dev); if (ata_setup_interrupt(dev, ata_generic_intr)) return ENXIO; if (ctlr->chip->chipid == ATA_IT8213F) { /* the ITE 8213F only has one channel */ ctlr->channels = 1; ctlr->setmode = ata_ite_8213_setmode; } else { /* set PCI mode and 66Mhz reference clock */ pci_write_config(dev, 0x50, pci_read_config(dev, 0x50, 1) & ~0x83, 1); /* set default active & recover timings */ pci_write_config(dev, 0x54, 0x31, 1); pci_write_config(dev, 0x56, 0x31, 1); ctlr->setmode = ata_ite_821x_setmode; /* No timing restrictions initally. */ ctlr->chipset_data = NULL; } ctlr->ch_attach = ata_ite_ch_attach; return (0); } static int ata_ite_ch_attach(device_t dev) { struct ata_channel *ch = device_get_softc(dev); int error; error = ata_pci_ch_attach(dev); ch->flags |= ATA_CHECKS_CABLE; -#ifdef ATA_CAM ch->flags |= ATA_NO_ATAPI_DMA; -#endif return (error); } static int ata_ite_821x_setmode(device_t dev, int target, int mode) { device_t parent = device_get_parent(dev); struct ata_pci_controller *ctlr = device_get_softc(parent); struct ata_channel *ch = device_get_softc(dev); int devno = (ch->unit << 1) + target; int piomode; uint8_t *timings = (uint8_t*)(&ctlr->chipset_data); static const uint8_t udmatiming[] = { 0x44, 0x42, 0x31, 0x21, 0x11, 0xa2, 0x91 }; static const uint8_t chtiming[] = { 0xaa, 0xa3, 0xa1, 0x33, 0x31, 0x88, 0x32, 0x31 }; mode = min(mode, ctlr->chip->max_dma); /* check the CBLID bits for 80 conductor cable detection */ if (ata_dma_check_80pin && mode > ATA_UDMA2 && (pci_read_config(parent, 0x40, 2) & (ch->unit ? (1<<3) : (1<<2)))) { ata_print_cable(dev, "controller"); mode = ATA_UDMA2; } if (mode >= ATA_UDMA0) { /* enable UDMA mode */ pci_write_config(parent, 0x50, pci_read_config(parent, 0x50, 1) & ~(1 << (devno + 3)), 1); /* set UDMA timing */ pci_write_config(parent, 0x56 + (ch->unit << 2) + target, udmatiming[mode & ATA_MODE_MASK], 1); piomode = ATA_PIO4; } else { /* disable UDMA mode */ pci_write_config(parent, 0x50, pci_read_config(parent, 0x50, 1) | (1 << (devno + 3)), 1); piomode = mode; } timings[devno] = chtiming[ata_mode2idx(piomode)]; /* set active and recover timing (shared between master & slave) */ pci_write_config(parent, 0x54 + (ch->unit << 2), max(timings[ch->unit << 1], timings[(ch->unit << 1) + 1]), 1); return (mode); } static int ata_ite_8213_setmode(device_t dev, int target, int mode) { device_t parent = device_get_parent(dev); struct ata_pci_controller *ctlr = device_get_softc(parent); int piomode; u_int16_t reg40 = pci_read_config(parent, 0x40, 2); u_int8_t reg44 = pci_read_config(parent, 0x44, 1); u_int8_t reg48 = pci_read_config(parent, 0x48, 1); u_int16_t reg4a = pci_read_config(parent, 0x4a, 2); u_int16_t reg54 = pci_read_config(parent, 0x54, 2); u_int16_t mask40 = 0, new40 = 0; u_int8_t mask44 = 0, new44 = 0; static const uint8_t timings[] = { 0x00, 0x00, 0x10, 0x21, 0x23, 0x00, 0x21, 0x23 }; static const uint8_t utimings[] = { 0x00, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02 }; mode = min(mode, ctlr->chip->max_dma); if (ata_dma_check_80pin && mode > ATA_UDMA2 && !(reg54 & (0x10 << target))) { ata_print_cable(dev, "controller"); mode = ATA_UDMA2; } /* Enable/disable UDMA and set timings. */ if (mode >= ATA_UDMA0) { pci_write_config(parent, 0x48, reg48 | (0x0001 << target), 2); pci_write_config(parent, 0x4a, (reg4a & ~(0x3 << (target << 2))) | (utimings[mode & ATA_MODE_MASK] << (target<<2)), 2); piomode = ATA_PIO4; } else { pci_write_config(parent, 0x48, reg48 & ~(0x0001 << target), 2); pci_write_config(parent, 0x4a, (reg4a & ~(0x3 << (target << 2))),2); piomode = mode; } /* Set UDMA reference clock (33/66/133MHz). */ reg54 &= ~(0x1001 << target); if (mode >= ATA_UDMA5) reg54 |= (0x1000 << target); else if (mode >= ATA_UDMA3) reg54 |= (0x1 << target); pci_write_config(parent, 0x54, reg54, 2); /* Allow PIO/WDMA timing controls. */ reg40 &= 0xff00; reg40 |= 0x4033; /* Set PIO/WDMA timings. */ if (target == 0) { reg40 |= (ata_atapi(dev, target) ? 0x04 : 0x00); mask40 = 0x3300; new40 = timings[ata_mode2idx(piomode)] << 8; } else { reg40 |= (ata_atapi(dev, target) ? 0x40 : 0x00); mask44 = 0x0f; new44 = ((timings[ata_mode2idx(piomode)] & 0x30) >> 2) | (timings[ata_mode2idx(piomode)] & 0x03); } pci_write_config(parent, 0x40, (reg40 & ~mask40) | new40, 4); pci_write_config(parent, 0x44, (reg44 & ~mask44) | new44, 1); return (mode); } ATA_DECLARE_DRIVER(ata_ite); Index: head/sys/dev/ata/chipsets/ata-serverworks.c =================================================================== --- head/sys/dev/ata/chipsets/ata-serverworks.c (revision 249082) +++ head/sys/dev/ata/chipsets/ata-serverworks.c (revision 249083) @@ -1,414 +1,385 @@ /*- * Copyright (c) 1998 - 2008 Søren Schmidt * 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. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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. */ #include __FBSDID("$FreeBSD$"); #include "opt_ata.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /* local prototypes */ static int ata_serverworks_chipinit(device_t dev); static int ata_serverworks_ch_attach(device_t dev); static int ata_serverworks_ch_detach(device_t dev); static void ata_serverworks_tf_read(struct ata_request *request); static void ata_serverworks_tf_write(struct ata_request *request); static int ata_serverworks_setmode(device_t dev, int target, int mode); static void ata_serverworks_sata_reset(device_t dev); static int ata_serverworks_status(device_t dev); /* misc defines */ #define SWKS_33 0 #define SWKS_66 1 #define SWKS_100 2 #define SWKS_MIO 3 /* * ServerWorks chipset support functions */ static int ata_serverworks_probe(device_t dev) { struct ata_pci_controller *ctlr = device_get_softc(dev); static const struct ata_chip_id ids[] = {{ ATA_ROSB4, 0x00, SWKS_33, 0, ATA_WDMA2, "ROSB4" }, { ATA_CSB5, 0x92, SWKS_100, 0, ATA_UDMA5, "CSB5" }, { ATA_CSB5, 0x00, SWKS_66, 0, ATA_UDMA4, "CSB5" }, { ATA_CSB6, 0x00, SWKS_100, 0, ATA_UDMA5, "CSB6" }, { ATA_CSB6_1, 0x00, SWKS_66, 0, ATA_UDMA4, "CSB6" }, { ATA_HT1000, 0x00, SWKS_100, 0, ATA_UDMA5, "HT1000" }, { ATA_HT1000_S1, 0x00, SWKS_MIO, 4, ATA_SA150, "HT1000" }, { ATA_HT1000_S2, 0x00, SWKS_MIO, 4, ATA_SA150, "HT1000" }, { ATA_K2, 0x00, SWKS_MIO, 4, ATA_SA150, "K2" }, { ATA_FRODO4, 0x00, SWKS_MIO, 4, ATA_SA150, "Frodo4" }, { ATA_FRODO8, 0x00, SWKS_MIO, 8, ATA_SA150, "Frodo8" }, { 0, 0, 0, 0, 0, 0}}; if (pci_get_vendor(dev) != ATA_SERVERWORKS_ID) return ENXIO; if (!(ctlr->chip = ata_match_chip(dev, ids))) return ENXIO; ata_set_desc(dev); ctlr->chipinit = ata_serverworks_chipinit; return (BUS_PROBE_DEFAULT); } static int ata_serverworks_status(device_t dev) { struct ata_channel *ch = device_get_softc(dev); struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev)); /* * Check if this interrupt belongs to our channel. */ if (!(ATA_INL(ctlr->r_res2, 0x1f80) & (1 << ch->unit))) return (0); /* * We need to do a 4-byte read on the status reg before the values * will report correctly */ ATA_IDX_INL(ch,ATA_STATUS); return ata_pci_status(dev); } static int ata_serverworks_chipinit(device_t dev) { struct ata_pci_controller *ctlr = device_get_softc(dev); if (ata_setup_interrupt(dev, ata_generic_intr)) return ENXIO; if (ctlr->chip->cfg1 == SWKS_MIO) { ctlr->r_type2 = SYS_RES_MEMORY; ctlr->r_rid2 = PCIR_BAR(5); if (!(ctlr->r_res2 = bus_alloc_resource_any(dev, ctlr->r_type2, &ctlr->r_rid2, RF_ACTIVE))) return ENXIO; ctlr->channels = ctlr->chip->cfg2; ctlr->ch_attach = ata_serverworks_ch_attach; ctlr->ch_detach = ata_serverworks_ch_detach; ctlr->setmode = ata_sata_setmode; ctlr->getrev = ata_sata_getrev; ctlr->reset = ata_serverworks_sata_reset; return 0; } else if (ctlr->chip->cfg1 == SWKS_33) { device_t *children; int nchildren, i; /* locate the ISA part in the southbridge and enable UDMA33 */ if (!device_get_children(device_get_parent(dev), &children,&nchildren)){ for (i = 0; i < nchildren; i++) { if (pci_get_devid(children[i]) == ATA_ROSB4_ISA) { pci_write_config(children[i], 0x64, (pci_read_config(children[i], 0x64, 4) & ~0x00002000) | 0x00004000, 4); break; } } free(children, M_TEMP); } } else { pci_write_config(dev, 0x5a, (pci_read_config(dev, 0x5a, 1) & ~0x40) | (ctlr->chip->cfg1 == SWKS_100) ? 0x03 : 0x02, 1); } ctlr->setmode = ata_serverworks_setmode; return 0; } static int ata_serverworks_ch_attach(device_t dev) { struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev)); struct ata_channel *ch = device_get_softc(dev); int ch_offset; int i; ch_offset = ch->unit * 0x100; for (i = ATA_DATA; i < ATA_MAX_RES; i++) ch->r_io[i].res = ctlr->r_res2; /* setup ATA registers */ ch->r_io[ATA_DATA].offset = ch_offset + 0x00; ch->r_io[ATA_FEATURE].offset = ch_offset + 0x04; ch->r_io[ATA_COUNT].offset = ch_offset + 0x08; ch->r_io[ATA_SECTOR].offset = ch_offset + 0x0c; ch->r_io[ATA_CYL_LSB].offset = ch_offset + 0x10; ch->r_io[ATA_CYL_MSB].offset = ch_offset + 0x14; ch->r_io[ATA_DRIVE].offset = ch_offset + 0x18; ch->r_io[ATA_COMMAND].offset = ch_offset + 0x1c; ch->r_io[ATA_CONTROL].offset = ch_offset + 0x20; ata_default_registers(dev); /* setup DMA registers */ ch->r_io[ATA_BMCMD_PORT].offset = ch_offset + 0x30; ch->r_io[ATA_BMSTAT_PORT].offset = ch_offset + 0x32; ch->r_io[ATA_BMDTP_PORT].offset = ch_offset + 0x34; /* setup SATA registers */ ch->r_io[ATA_SSTATUS].offset = ch_offset + 0x40; ch->r_io[ATA_SERROR].offset = ch_offset + 0x44; ch->r_io[ATA_SCONTROL].offset = ch_offset + 0x48; ch->flags |= ATA_NO_SLAVE | ATA_SATA | ATA_KNOWN_PRESENCE; ata_pci_hw(dev); ch->hw.tf_read = ata_serverworks_tf_read; ch->hw.tf_write = ata_serverworks_tf_write; if (ctlr->chip->chipid == ATA_K2) { /* * Set SICR registers to turn off waiting for a status message * before sending FIS. Values obtained from the Darwin driver. */ ATA_OUTL(ctlr->r_res2, ch_offset + 0x80, ATA_INL(ctlr->r_res2, ch_offset + 0x80) & ~0x00040000); ATA_OUTL(ctlr->r_res2, ch_offset + 0x88, 0); /* * Some controllers have a bug where they will send the command * to the drive before seeing a DMA start, and then can begin * receiving data before the DMA start arrives. The controller * will then become confused and either corrupt the data or crash. * Remedy this by starting DMA before sending the drive command. */ ch->flags |= ATA_DMA_BEFORE_CMD; /* * The status register must be read as a long to fill the other * registers. */ ch->hw.status = ata_serverworks_status; ch->flags |= ATA_STATUS_IS_LONG; } /* chip does not reliably do 64K DMA transfers */ ch->dma.max_iosize = 64 * DEV_BSIZE; ata_pci_dmainit(dev); return 0; } static int ata_serverworks_ch_detach(device_t dev) { ata_pci_dmafini(dev); return (0); } static void ata_serverworks_tf_read(struct ata_request *request) { struct ata_channel *ch = device_get_softc(request->parent); if (request->flags & ATA_R_48BIT) { u_int16_t temp; request->u.ata.count = ATA_IDX_INW(ch, ATA_COUNT); temp = ATA_IDX_INW(ch, ATA_SECTOR); request->u.ata.lba = (u_int64_t)(temp & 0x00ff) | ((u_int64_t)(temp & 0xff00) << 24); temp = ATA_IDX_INW(ch, ATA_CYL_LSB); request->u.ata.lba |= ((u_int64_t)(temp & 0x00ff) << 8) | ((u_int64_t)(temp & 0xff00) << 32); temp = ATA_IDX_INW(ch, ATA_CYL_MSB); request->u.ata.lba |= ((u_int64_t)(temp & 0x00ff) << 16) | ((u_int64_t)(temp & 0xff00) << 40); } else { request->u.ata.count = ATA_IDX_INW(ch, ATA_COUNT) & 0x00ff; request->u.ata.lba = (ATA_IDX_INW(ch, ATA_SECTOR) & 0x00ff) | ((ATA_IDX_INW(ch, ATA_CYL_LSB) & 0x00ff) << 8) | ((ATA_IDX_INW(ch, ATA_CYL_MSB) & 0x00ff) << 16) | ((ATA_IDX_INW(ch, ATA_DRIVE) & 0xf) << 24); } } static void ata_serverworks_tf_write(struct ata_request *request) { struct ata_channel *ch = device_get_softc(request->parent); -#ifndef ATA_CAM - struct ata_device *atadev = device_get_softc(request->dev); -#endif if (request->flags & ATA_R_48BIT) { ATA_IDX_OUTW(ch, ATA_FEATURE, request->u.ata.feature); ATA_IDX_OUTW(ch, ATA_COUNT, request->u.ata.count); ATA_IDX_OUTW(ch, ATA_SECTOR, ((request->u.ata.lba >> 16) & 0xff00) | (request->u.ata.lba & 0x00ff)); ATA_IDX_OUTW(ch, ATA_CYL_LSB, ((request->u.ata.lba >> 24) & 0xff00) | ((request->u.ata.lba >> 8) & 0x00ff)); ATA_IDX_OUTW(ch, ATA_CYL_MSB, ((request->u.ata.lba >> 32) & 0xff00) | ((request->u.ata.lba >> 16) & 0x00ff)); ATA_IDX_OUTW(ch, ATA_DRIVE, ATA_D_LBA | ATA_DEV(request->unit)); } else { ATA_IDX_OUTW(ch, ATA_FEATURE, request->u.ata.feature); ATA_IDX_OUTW(ch, ATA_COUNT, request->u.ata.count); -#ifndef ATA_CAM - if (atadev->flags & ATA_D_USE_CHS) { - int heads, sectors; - - if (atadev->param.atavalid & ATA_FLAG_54_58) { - heads = atadev->param.current_heads; - sectors = atadev->param.current_sectors; - } - else { - heads = atadev->param.heads; - sectors = atadev->param.sectors; - } - ATA_IDX_OUTW(ch, ATA_SECTOR, (request->u.ata.lba % sectors)+1); - ATA_IDX_OUTW(ch, ATA_CYL_LSB, - (request->u.ata.lba / (sectors * heads))); - ATA_IDX_OUTW(ch, ATA_CYL_MSB, - (request->u.ata.lba / (sectors * heads)) >> 8); - ATA_IDX_OUTW(ch, ATA_DRIVE, ATA_D_IBM | ATA_DEV(request->unit) | - (((request->u.ata.lba% (sectors * heads)) / - sectors) & 0xf)); - } - else { -#endif ATA_IDX_OUTW(ch, ATA_SECTOR, request->u.ata.lba); ATA_IDX_OUTW(ch, ATA_CYL_LSB, request->u.ata.lba >> 8); ATA_IDX_OUTW(ch, ATA_CYL_MSB, request->u.ata.lba >> 16); ATA_IDX_OUTW(ch, ATA_DRIVE, ATA_D_IBM | ATA_D_LBA | ATA_DEV(request->unit) | ((request->u.ata.lba >> 24) & 0x0f)); -#ifndef ATA_CAM - } -#endif } } static int ata_serverworks_setmode(device_t dev, int target, int mode) { device_t parent = device_get_parent(dev); struct ata_pci_controller *ctlr = device_get_softc(parent); struct ata_channel *ch = device_get_softc(dev); int devno = (ch->unit << 1) + target; int offset = (devno ^ 0x01) << 3; int piomode; static const uint8_t piotimings[] = { 0x5d, 0x47, 0x34, 0x22, 0x20 }; static const uint8_t dmatimings[] = { 0x77, 0x21, 0x20 }; mode = min(mode, ctlr->chip->max_dma); if (mode >= ATA_UDMA0) { /* Set UDMA mode, enable UDMA, set WDMA2/PIO4 */ pci_write_config(parent, 0x56, (pci_read_config(parent, 0x56, 2) & ~(0xf << (devno << 2))) | ((mode & ATA_MODE_MASK) << (devno << 2)), 2); pci_write_config(parent, 0x54, pci_read_config(parent, 0x54, 1) | (0x01 << devno), 1); pci_write_config(parent, 0x44, (pci_read_config(parent, 0x44, 4) & ~(0xff << offset)) | (dmatimings[2] << offset), 4); piomode = ATA_PIO4; } else if (mode >= ATA_WDMA0) { /* Disable UDMA, set WDMA mode and timings, calculate PIO. */ pci_write_config(parent, 0x54, pci_read_config(parent, 0x54, 1) & ~(0x01 << devno), 1); pci_write_config(parent, 0x44, (pci_read_config(parent, 0x44, 4) & ~(0xff << offset)) | (dmatimings[mode & ATA_MODE_MASK] << offset), 4); piomode = (mode == ATA_WDMA0) ? ATA_PIO0 : (mode == ATA_WDMA1) ? ATA_PIO3 : ATA_PIO4; } else { /* Disable UDMA, set requested PIO. */ pci_write_config(parent, 0x54, pci_read_config(parent, 0x54, 1) & ~(0x01 << devno), 1); piomode = mode; } /* Set PIO mode and timings, calculated above. */ if (ctlr->chip->cfg1 != SWKS_33) { pci_write_config(parent, 0x4a, (pci_read_config(parent, 0x4a, 2) & ~(0xf << (devno << 2))) | ((piomode - ATA_PIO0) << (devno<<2)),2); } pci_write_config(parent, 0x40, (pci_read_config(parent, 0x40, 4) & ~(0xff << offset)) | (piotimings[ata_mode2idx(piomode)] << offset), 4); return (mode); } static void ata_serverworks_sata_reset(device_t dev) { struct ata_channel *ch = device_get_softc(dev); if (ata_sata_phy_reset(dev, -1, 0)) ata_generic_reset(dev); else ch->devices = 0; } ATA_DECLARE_DRIVER(ata_serverworks); Index: head/sys/dev/ata/chipsets/ata-siliconimage.c =================================================================== --- head/sys/dev/ata/chipsets/ata-siliconimage.c (revision 249082) +++ head/sys/dev/ata/chipsets/ata-siliconimage.c (revision 249083) @@ -1,957 +1,955 @@ /*- * Copyright (c) 1998 - 2008 Søren Schmidt * 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. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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. */ #include __FBSDID("$FreeBSD$"); #include "opt_ata.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /* local prototypes */ static int ata_cmd_ch_attach(device_t dev); static int ata_cmd_status(device_t dev); static int ata_cmd_setmode(device_t dev, int target, int mode); static int ata_sii_ch_attach(device_t dev); static int ata_sii_ch_detach(device_t dev); static int ata_sii_status(device_t dev); static void ata_sii_reset(device_t dev); static int ata_sii_setmode(device_t dev, int target, int mode); static int ata_siiprb_ch_attach(device_t dev); static int ata_siiprb_ch_detach(device_t dev); static int ata_siiprb_status(device_t dev); static int ata_siiprb_begin_transaction(struct ata_request *request); static int ata_siiprb_end_transaction(struct ata_request *request); static int ata_siiprb_pm_read(device_t dev, int port, int reg, u_int32_t *result); static int ata_siiprb_pm_write(device_t dev, int port, int reg, u_int32_t result); static u_int32_t ata_siiprb_softreset(device_t dev, int port); static void ata_siiprb_reset(device_t dev); static void ata_siiprb_dmasetprd(void *xsc, bus_dma_segment_t *segs, int nsegs, int error); static void ata_siiprb_dmainit(device_t dev); /* misc defines */ #define SII_MEMIO 1 #define SII_PRBIO 2 #define SII_INTR 0x01 #define SII_SETCLK 0x02 #define SII_BUG 0x04 #define SII_4CH 0x08 /* * Silicon Image Inc. (SiI) (former CMD) chipset support functions */ static int ata_sii_probe(device_t dev) { struct ata_pci_controller *ctlr = device_get_softc(dev); static const struct ata_chip_id ids[] = {{ ATA_SII3114, 0x00, SII_MEMIO, SII_4CH, ATA_SA150, "3114" }, { ATA_SII3512, 0x02, SII_MEMIO, 0, ATA_SA150, "3512" }, { ATA_SII3112, 0x02, SII_MEMIO, 0, ATA_SA150, "3112" }, { ATA_SII3112_1, 0x02, SII_MEMIO, 0, ATA_SA150, "3112" }, { ATA_SII3512, 0x00, SII_MEMIO, SII_BUG, ATA_SA150, "3512" }, { ATA_SII3112, 0x00, SII_MEMIO, SII_BUG, ATA_SA150, "3112" }, { ATA_SII3112_1, 0x00, SII_MEMIO, SII_BUG, ATA_SA150, "3112" }, { ATA_SII3124, 0x00, SII_PRBIO, SII_4CH, ATA_SA300, "3124" }, { ATA_SII3132, 0x00, SII_PRBIO, 0, ATA_SA300, "3132" }, { ATA_SII3132_1, 0x00, SII_PRBIO, 0, ATA_SA300, "3132" }, { ATA_SII3132_2, 0x00, SII_PRBIO, 0, ATA_SA300, "3132" }, { ATA_SII0680, 0x00, SII_MEMIO, SII_SETCLK, ATA_UDMA6, "680" }, { ATA_CMD649, 0x00, 0, SII_INTR, ATA_UDMA5, "(CMD) 649" }, { ATA_CMD648, 0x00, 0, SII_INTR, ATA_UDMA4, "(CMD) 648" }, { ATA_CMD646, 0x07, 0, 0, ATA_UDMA2, "(CMD) 646U2" }, { ATA_CMD646, 0x00, 0, 0, ATA_WDMA2, "(CMD) 646" }, { 0, 0, 0, 0, 0, 0}}; if (pci_get_vendor(dev) != ATA_SILICON_IMAGE_ID) return ENXIO; if (!(ctlr->chip = ata_match_chip(dev, ids))) return ENXIO; ata_set_desc(dev); ctlr->chipinit = ata_sii_chipinit; return (BUS_PROBE_DEFAULT); } int ata_sii_chipinit(device_t dev) { struct ata_pci_controller *ctlr = device_get_softc(dev); if (ata_setup_interrupt(dev, ata_generic_intr)) return ENXIO; switch (ctlr->chip->cfg1) { case SII_PRBIO: ctlr->r_type1 = SYS_RES_MEMORY; ctlr->r_rid1 = PCIR_BAR(0); if (!(ctlr->r_res1 = bus_alloc_resource_any(dev, ctlr->r_type1, &ctlr->r_rid1, RF_ACTIVE))) return ENXIO; ctlr->r_rid2 = PCIR_BAR(2); ctlr->r_type2 = SYS_RES_MEMORY; if (!(ctlr->r_res2 = bus_alloc_resource_any(dev, ctlr->r_type2, &ctlr->r_rid2, RF_ACTIVE))){ bus_release_resource(dev, ctlr->r_type1, ctlr->r_rid1,ctlr->r_res1); return ENXIO; } #ifdef __sparc64__ if (!bus_space_map(rman_get_bustag(ctlr->r_res2), rman_get_bushandle(ctlr->r_res2), rman_get_size(ctlr->r_res2), BUS_SPACE_MAP_LINEAR, NULL)) { bus_release_resource(dev, ctlr->r_type1, ctlr->r_rid1, ctlr->r_res1); bus_release_resource(dev, ctlr->r_type2, ctlr->r_rid2, ctlr->r_res2); return (ENXIO); } #endif ctlr->ch_attach = ata_siiprb_ch_attach; ctlr->ch_detach = ata_siiprb_ch_detach; ctlr->reset = ata_siiprb_reset; ctlr->setmode = ata_sata_setmode; ctlr->getrev = ata_sata_getrev; ctlr->channels = (ctlr->chip->cfg2 == SII_4CH) ? 4 : 2; /* reset controller */ ATA_OUTL(ctlr->r_res1, 0x0040, 0x80000000); DELAY(10000); ATA_OUTL(ctlr->r_res1, 0x0040, 0x0000000f); break; case SII_MEMIO: ctlr->r_type2 = SYS_RES_MEMORY; ctlr->r_rid2 = PCIR_BAR(5); if (!(ctlr->r_res2 = bus_alloc_resource_any(dev, ctlr->r_type2, &ctlr->r_rid2, RF_ACTIVE))){ if (ctlr->chip->chipid != ATA_SII0680 || (pci_read_config(dev, 0x8a, 1) & 1)) return ENXIO; } if (ctlr->chip->cfg2 & SII_SETCLK) { if ((pci_read_config(dev, 0x8a, 1) & 0x30) != 0x10) pci_write_config(dev, 0x8a, (pci_read_config(dev, 0x8a, 1) & 0xcf)|0x10,1); if ((pci_read_config(dev, 0x8a, 1) & 0x30) != 0x10) device_printf(dev, "%s could not set ATA133 clock\n", ctlr->chip->text); } /* if we have 4 channels enable the second set */ if (ctlr->chip->cfg2 & SII_4CH) { ATA_OUTL(ctlr->r_res2, 0x0200, 0x00000002); ctlr->channels = 4; } /* dont block interrupts from any channel */ pci_write_config(dev, 0x48, (pci_read_config(dev, 0x48, 4) & ~0x03c00000), 4); /* enable PCI interrupt as BIOS might not */ pci_write_config(dev, 0x8a, (pci_read_config(dev, 0x8a, 1) & 0x3f), 1); if (ctlr->r_res2) { ctlr->ch_attach = ata_sii_ch_attach; ctlr->ch_detach = ata_sii_ch_detach; } if (ctlr->chip->max_dma >= ATA_SA150) { ctlr->reset = ata_sii_reset; ctlr->setmode = ata_sata_setmode; ctlr->getrev = ata_sata_getrev; } else ctlr->setmode = ata_sii_setmode; break; default: if ((pci_read_config(dev, 0x51, 1) & 0x08) != 0x08) { device_printf(dev, "HW has secondary channel disabled\n"); ctlr->channels = 1; } /* enable interrupt as BIOS might not */ pci_write_config(dev, 0x71, 0x01, 1); ctlr->ch_attach = ata_cmd_ch_attach; ctlr->ch_detach = ata_pci_ch_detach; ctlr->setmode = ata_cmd_setmode; break; } return 0; } static int ata_cmd_ch_attach(device_t dev) { struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev)); struct ata_channel *ch = device_get_softc(dev); /* setup the usual register normal pci style */ if (ata_pci_ch_attach(dev)) return ENXIO; if (ctlr->chip->cfg2 & SII_INTR) ch->hw.status = ata_cmd_status; -#ifdef ATA_CAM ch->flags |= ATA_NO_ATAPI_DMA; -#endif return 0; } static int ata_cmd_status(device_t dev) { struct ata_channel *ch = device_get_softc(dev); u_int8_t reg71; if (((reg71 = pci_read_config(device_get_parent(dev), 0x71, 1)) & (ch->unit ? 0x08 : 0x04))) { pci_write_config(device_get_parent(dev), 0x71, reg71 & ~(ch->unit ? 0x04 : 0x08), 1); return ata_pci_status(dev); } return 0; } static int ata_cmd_setmode(device_t dev, int target, int mode) { device_t parent = device_get_parent(dev); struct ata_pci_controller *ctlr = device_get_softc(parent); struct ata_channel *ch = device_get_softc(dev); int devno = (ch->unit << 1) + target; int treg = 0x54 + ((devno < 3) ? (devno << 1) : 7); int ureg = ch->unit ? 0x7b : 0x73; int piomode; static const uint8_t piotimings[] = { 0xa9, 0x57, 0x44, 0x32, 0x3f, 0x87, 0x32, 0x3f }; static const uint8_t udmatimings[][2] = { { 0x31, 0xc2 }, { 0x21, 0x82 }, { 0x11, 0x42 }, { 0x25, 0x8a }, { 0x15, 0x4a }, { 0x05, 0x0a } }; mode = min(mode, ctlr->chip->max_dma); if (mode >= ATA_UDMA0) { u_int8_t umode = pci_read_config(parent, ureg, 1); umode &= ~(target == 0 ? 0x35 : 0xca); umode |= udmatimings[mode & ATA_MODE_MASK][target]; pci_write_config(parent, ureg, umode, 1); piomode = ATA_PIO4; } else { pci_write_config(parent, ureg, pci_read_config(parent, ureg, 1) & ~(target == 0 ? 0x35 : 0xca), 1); piomode = mode; } pci_write_config(parent, treg, piotimings[ata_mode2idx(piomode)], 1); return (mode); } static int ata_sii_ch_attach(device_t dev) { struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev)); struct ata_channel *ch = device_get_softc(dev); int unit01 = (ch->unit & 1), unit10 = (ch->unit & 2); int i; for (i = ATA_DATA; i <= ATA_COMMAND; i++) { ch->r_io[i].res = ctlr->r_res2; ch->r_io[i].offset = 0x80 + i + (unit01 << 6) + (unit10 << 8); } ch->r_io[ATA_CONTROL].res = ctlr->r_res2; ch->r_io[ATA_CONTROL].offset = 0x8a + (unit01 << 6) + (unit10 << 8); ch->r_io[ATA_IDX_ADDR].res = ctlr->r_res2; ata_default_registers(dev); ch->r_io[ATA_BMCMD_PORT].res = ctlr->r_res2; ch->r_io[ATA_BMCMD_PORT].offset = 0x00 + (unit01 << 3) + (unit10 << 8); ch->r_io[ATA_BMSTAT_PORT].res = ctlr->r_res2; ch->r_io[ATA_BMSTAT_PORT].offset = 0x02 + (unit01 << 3) + (unit10 << 8); ch->r_io[ATA_BMDTP_PORT].res = ctlr->r_res2; ch->r_io[ATA_BMDTP_PORT].offset = 0x04 + (unit01 << 3) + (unit10 << 8); if (ctlr->chip->max_dma >= ATA_SA150) { ch->r_io[ATA_SSTATUS].res = ctlr->r_res2; ch->r_io[ATA_SSTATUS].offset = 0x104 + (unit01 << 7) + (unit10 << 8); ch->r_io[ATA_SERROR].res = ctlr->r_res2; ch->r_io[ATA_SERROR].offset = 0x108 + (unit01 << 7) + (unit10 << 8); ch->r_io[ATA_SCONTROL].res = ctlr->r_res2; ch->r_io[ATA_SCONTROL].offset = 0x100 + (unit01 << 7) + (unit10 << 8); ch->flags |= ATA_NO_SLAVE; ch->flags |= ATA_SATA; ch->flags |= ATA_KNOWN_PRESENCE; /* enable PHY state change interrupt */ ATA_OUTL(ctlr->r_res2, 0x148 + (unit01 << 7) + (unit10 << 8),(1 << 16)); } if (ctlr->chip->cfg2 & SII_BUG) { /* work around errata in early chips */ ch->dma.boundary = 8192; ch->dma.segsize = 15 * DEV_BSIZE; } ata_pci_hw(dev); ch->hw.status = ata_sii_status; if (ctlr->chip->cfg2 & SII_SETCLK) ch->flags |= ATA_CHECKS_CABLE; ata_pci_dmainit(dev); return 0; } static int ata_sii_ch_detach(device_t dev) { ata_pci_dmafini(dev); return (0); } static int ata_sii_status(device_t dev) { struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev)); struct ata_channel *ch = device_get_softc(dev); int offset0 = ((ch->unit & 1) << 3) + ((ch->unit & 2) << 8); int offset1 = ((ch->unit & 1) << 6) + ((ch->unit & 2) << 8); /* do we have any PHY events ? */ if (ctlr->chip->max_dma >= ATA_SA150 && (ATA_INL(ctlr->r_res2, 0x10 + offset0) & 0x00000010)) ata_sata_phy_check_events(dev, -1); if (ATA_INL(ctlr->r_res2, 0xa0 + offset1) & 0x00000800) return ata_pci_status(dev); else return 0; } static void ata_sii_reset(device_t dev) { struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev)); struct ata_channel *ch = device_get_softc(dev); int offset = ((ch->unit & 1) << 7) + ((ch->unit & 2) << 8); uint32_t val; /* Apply R_ERR on DMA activate FIS errata workaround. */ val = ATA_INL(ctlr->r_res2, 0x14c + offset); if ((val & 0x3) == 0x1) ATA_OUTL(ctlr->r_res2, 0x14c + offset, val & ~0x3); if (ata_sata_phy_reset(dev, -1, 1)) ata_generic_reset(dev); else ch->devices = 0; } static int ata_sii_setmode(device_t dev, int target, int mode) { device_t parent = device_get_parent(dev); struct ata_pci_controller *ctlr = device_get_softc(parent); struct ata_channel *ch = device_get_softc(dev); int rego = (ch->unit << 4) + (target << 1); int mreg = ch->unit ? 0x84 : 0x80; int mask = 0x03 << (target << 2); int mval = pci_read_config(parent, mreg, 1) & ~mask; int piomode; u_int8_t preg = 0xa4 + rego; u_int8_t dreg = 0xa8 + rego; u_int8_t ureg = 0xac + rego; static const uint16_t piotimings[] = { 0x328a, 0x2283, 0x1104, 0x10c3, 0x10c1 }; static const uint16_t dmatimings[] = { 0x2208, 0x10c2, 0x10c1 }; static const uint8_t udmatimings[] = { 0xf, 0xb, 0x7, 0x5, 0x3, 0x2, 0x1 }; mode = min(mode, ctlr->chip->max_dma); if (ctlr->chip->cfg2 & SII_SETCLK) { if (ata_dma_check_80pin && mode > ATA_UDMA2 && (pci_read_config(parent, 0x79, 1) & (ch->unit ? 0x02 : 0x01))) { ata_print_cable(dev, "controller"); mode = ATA_UDMA2; } } if (mode >= ATA_UDMA0) { pci_write_config(parent, mreg, mval | (0x03 << (target << 2)), 1); pci_write_config(parent, ureg, (pci_read_config(parent, ureg, 1) & ~0x3f) | udmatimings[mode & ATA_MODE_MASK], 1); piomode = ATA_PIO4; } else if (mode >= ATA_WDMA0) { pci_write_config(parent, mreg, mval | (0x02 << (target << 2)), 1); pci_write_config(parent, dreg, dmatimings[mode & ATA_MODE_MASK], 2); piomode = (mode == ATA_WDMA0) ? ATA_PIO0 : (mode == ATA_WDMA1) ? ATA_PIO3 : ATA_PIO4; } else { pci_write_config(parent, mreg, mval | (0x01 << (target << 2)), 1); piomode = mode; } pci_write_config(parent, preg, piotimings[ata_mode2idx(piomode)], 2); return (mode); } struct ata_siiprb_dma_prdentry { u_int64_t addr; u_int32_t count; u_int32_t control; } __packed; #define ATA_SIIPRB_DMA_ENTRIES 129 struct ata_siiprb_ata_command { struct ata_siiprb_dma_prdentry prd[ATA_SIIPRB_DMA_ENTRIES]; } __packed; struct ata_siiprb_atapi_command { u_int8_t ccb[16]; struct ata_siiprb_dma_prdentry prd[ATA_SIIPRB_DMA_ENTRIES]; } __packed; struct ata_siiprb_command { u_int16_t control; u_int16_t protocol_override; u_int32_t transfer_count; u_int8_t fis[24]; union { struct ata_siiprb_ata_command ata; struct ata_siiprb_atapi_command atapi; } u; } __packed; static int ata_siiprb_ch_attach(device_t dev) { struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev)); struct ata_channel *ch = device_get_softc(dev); int offset = ch->unit * 0x2000; ata_siiprb_dmainit(dev); /* set the SATA resources */ ch->r_io[ATA_SSTATUS].res = ctlr->r_res2; ch->r_io[ATA_SSTATUS].offset = 0x1f04 + offset; ch->r_io[ATA_SERROR].res = ctlr->r_res2; ch->r_io[ATA_SERROR].offset = 0x1f08 + offset; ch->r_io[ATA_SCONTROL].res = ctlr->r_res2; ch->r_io[ATA_SCONTROL].offset = 0x1f00 + offset; ch->r_io[ATA_SACTIVE].res = ctlr->r_res2; ch->r_io[ATA_SACTIVE].offset = 0x1f0c + offset; ch->hw.status = ata_siiprb_status; ch->hw.begin_transaction = ata_siiprb_begin_transaction; ch->hw.end_transaction = ata_siiprb_end_transaction; ch->hw.command = NULL; /* not used here */ ch->hw.softreset = ata_siiprb_softreset; ch->hw.pm_read = ata_siiprb_pm_read; ch->hw.pm_write = ata_siiprb_pm_write; ch->flags |= ATA_NO_SLAVE; ch->flags |= ATA_SATA; return 0; } static int ata_siiprb_ch_detach(device_t dev) { struct ata_channel *ch = device_get_softc(dev); if (ch->dma.work_tag && ch->dma.work_map) bus_dmamap_sync(ch->dma.work_tag, ch->dma.work_map, BUS_DMASYNC_POSTWRITE); ata_dmafini(dev); return 0; } static int ata_siiprb_status(device_t dev) { struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev)); struct ata_channel *ch = device_get_softc(dev); u_int32_t action = ATA_INL(ctlr->r_res1, 0x0044); int offset = ch->unit * 0x2000; if (action & (1 << ch->unit)) { u_int32_t istatus = ATA_INL(ctlr->r_res2, 0x1008 + offset); /* do we have any PHY events ? */ ata_sata_phy_check_events(dev, -1); /* clear interrupt(s) */ ATA_OUTL(ctlr->r_res2, 0x1008 + offset, istatus); /* do we have any device action ? */ return (istatus & 0x00000003); } return 0; } static int ata_siiprb_begin_transaction(struct ata_request *request) { struct ata_pci_controller *ctlr=device_get_softc(device_get_parent(request->parent)); struct ata_channel *ch = device_get_softc(request->parent); struct ata_siiprb_command *prb; struct ata_siiprb_dma_prdentry *prd; int offset = ch->unit * 0x2000; u_int64_t prb_bus; /* SOS XXX */ if (request->u.ata.command == ATA_DEVICE_RESET) { request->result = 0; return ATA_OP_FINISHED; } /* get a piece of the workspace for this request */ prb = (struct ata_siiprb_command *)ch->dma.work; /* clear the prb structure */ bzero(prb, sizeof(struct ata_siiprb_command)); /* setup the FIS for this request */ if (!ata_request2fis_h2d(request, &prb->fis[0])) { device_printf(request->parent, "setting up SATA FIS failed\n"); request->result = EIO; return ATA_OP_FINISHED; } /* setup transfer type */ if (request->flags & ATA_R_ATAPI) { bcopy(request->u.atapi.ccb, prb->u.atapi.ccb, 16); if (request->flags & ATA_R_ATAPI16) ATA_OUTL(ctlr->r_res2, 0x1000 + offset, 0x00000020); else ATA_OUTL(ctlr->r_res2, 0x1004 + offset, 0x00000020); if (request->flags & ATA_R_READ) prb->control = htole16(0x0010); if (request->flags & ATA_R_WRITE) prb->control = htole16(0x0020); prd = &prb->u.atapi.prd[0]; } else prd = &prb->u.ata.prd[0]; /* if request moves data setup and load SG list */ if (request->flags & (ATA_R_READ | ATA_R_WRITE)) { if (ch->dma.load(request, prd, NULL)) { device_printf(request->parent, "setting up DMA failed\n"); request->result = EIO; return ATA_OP_FINISHED; } } bus_dmamap_sync(ch->dma.work_tag, ch->dma.work_map, BUS_DMASYNC_PREWRITE); /* activate the prb */ prb_bus = ch->dma.work_bus; ATA_OUTL(ctlr->r_res2, 0x1c00 + offset, prb_bus); ATA_OUTL(ctlr->r_res2, 0x1c04 + offset, prb_bus>>32); /* start the timeout */ callout_reset(&request->callout, request->timeout * hz, (timeout_t*)ata_timeout, request); return ATA_OP_CONTINUES; } static int ata_siiprb_end_transaction(struct ata_request *request) { struct ata_pci_controller *ctlr=device_get_softc(device_get_parent(request->parent)); struct ata_channel *ch = device_get_softc(request->parent); struct ata_siiprb_command *prb; int offset = ch->unit * 0x2000; int error, timeout; /* kill the timeout */ callout_stop(&request->callout); bus_dmamap_sync(ch->dma.work_tag, ch->dma.work_map, BUS_DMASYNC_POSTWRITE); prb = (struct ata_siiprb_command *) ((u_int8_t *)rman_get_virtual(ctlr->r_res2) + offset); /* any controller errors flagged ? */ if ((error = ATA_INL(ctlr->r_res2, 0x1024 + offset))) { if (bootverbose) printf("ata_siiprb_end_transaction %s error=%08x\n", ata_cmd2str(request), error); /* if device error status get details */ if (error == 1 || error == 2) { request->status = prb->fis[2]; if (request->status & ATA_S_ERROR) request->error = prb->fis[3]; } /* SOS XXX handle other controller errors here */ /* initialize port */ ATA_OUTL(ctlr->r_res2, 0x1000 + offset, 0x00000004); /* poll for port ready */ for (timeout = 0; timeout < 1000; timeout++) { DELAY(1000); if (ATA_INL(ctlr->r_res2, 0x1008 + offset) & 0x00040000) break; } if (bootverbose) { if (timeout >= 1000) device_printf(ch->dev, "port initialize timeout\n"); else device_printf(ch->dev, "port initialize time=%dms\n", timeout); } } /* Read back registers to the request struct. */ if ((request->flags & ATA_R_ATAPI) == 0 && ((request->status & ATA_S_ERROR) || (request->flags & (ATA_R_CONTROL | ATA_R_NEEDRESULT)))) { request->u.ata.count = prb->fis[12] | ((u_int16_t)prb->fis[13] << 8); request->u.ata.lba = prb->fis[4] | ((u_int64_t)prb->fis[5] << 8) | ((u_int64_t)prb->fis[6] << 16); if (request->flags & ATA_R_48BIT) request->u.ata.lba |= ((u_int64_t)prb->fis[8] << 24) | ((u_int64_t)prb->fis[9] << 32) | ((u_int64_t)prb->fis[10] << 40); else request->u.ata.lba |= ((u_int64_t)(prb->fis[7] & 0x0f) << 24); } /* update progress */ if (!(request->status & ATA_S_ERROR) && !(request->flags & ATA_R_TIMEOUT)) { if (request->flags & ATA_R_READ) request->donecount = le32toh(prb->transfer_count); else request->donecount = request->bytecount; } /* release SG list etc */ ch->dma.unload(request); return ATA_OP_FINISHED; } static int ata_siiprb_issue_cmd(device_t dev) { struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev)); struct ata_channel *ch = device_get_softc(dev); u_int64_t prb_bus = ch->dma.work_bus; u_int32_t status; int offset = ch->unit * 0x2000; int timeout; bus_dmamap_sync(ch->dma.work_tag, ch->dma.work_map, BUS_DMASYNC_PREWRITE); /* issue command to chip */ ATA_OUTL(ctlr->r_res2, 0x1c00 + offset, prb_bus); ATA_OUTL(ctlr->r_res2, 0x1c04 + offset, prb_bus >> 32); /* poll for command finished */ for (timeout = 0; timeout < 10000; timeout++) { DELAY(1000); if ((status = ATA_INL(ctlr->r_res2, 0x1008 + offset)) & 0x00010000) break; } bus_dmamap_sync(ch->dma.work_tag, ch->dma.work_map, BUS_DMASYNC_POSTWRITE); // SOS XXX ATA_OUTL(ctlr->r_res2, 0x1008 + offset, 0x00010000); ATA_OUTL(ctlr->r_res2, 0x1008 + offset, 0x08ff08ff); if (timeout >= 1000) return EIO; if (bootverbose) device_printf(dev, "siiprb_issue_cmd time=%dms status=%08x\n", timeout, status); return 0; } static int ata_siiprb_pm_read(device_t dev, int port, int reg, u_int32_t *result) { struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev)); struct ata_channel *ch = device_get_softc(dev); struct ata_siiprb_command *prb = (struct ata_siiprb_command *)ch->dma.work; int offset = ch->unit * 0x2000; if (port < 0) { *result = ATA_IDX_INL(ch, reg); return (0); } if (port < ATA_PM) { switch (reg) { case ATA_SSTATUS: reg = 0; break; case ATA_SERROR: reg = 1; break; case ATA_SCONTROL: reg = 2; break; default: return (EINVAL); } } bzero(prb, sizeof(struct ata_siiprb_command)); prb->fis[0] = 0x27; /* host to device */ prb->fis[1] = 0x8f; /* command FIS to PM port */ prb->fis[2] = ATA_READ_PM; prb->fis[3] = reg; prb->fis[7] = port; if (ata_siiprb_issue_cmd(dev)) { device_printf(dev, "error reading PM port\n"); return EIO; } prb = (struct ata_siiprb_command *) ((u_int8_t *)rman_get_virtual(ctlr->r_res2) + offset); *result = prb->fis[12]|(prb->fis[4]<<8)|(prb->fis[5]<<16)|(prb->fis[6]<<24); return 0; } static int ata_siiprb_pm_write(device_t dev, int port, int reg, u_int32_t value) { struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev)); struct ata_channel *ch = device_get_softc(dev); struct ata_siiprb_command *prb = (struct ata_siiprb_command *)ch->dma.work; int offset = ch->unit * 0x2000; if (port < 0) { ATA_IDX_OUTL(ch, reg, value); return (0); } if (port < ATA_PM) { switch (reg) { case ATA_SSTATUS: reg = 0; break; case ATA_SERROR: reg = 1; break; case ATA_SCONTROL: reg = 2; break; default: return (EINVAL); } } bzero(prb, sizeof(struct ata_siiprb_command)); prb->fis[0] = 0x27; /* host to device */ prb->fis[1] = 0x8f; /* command FIS to PM port */ prb->fis[2] = ATA_WRITE_PM; prb->fis[3] = reg; prb->fis[7] = port; prb->fis[12] = value & 0xff; prb->fis[4] = (value >> 8) & 0xff; prb->fis[5] = (value >> 16) & 0xff; prb->fis[6] = (value >> 24) & 0xff; if (ata_siiprb_issue_cmd(dev)) { device_printf(dev, "error writing PM port\n"); return ATA_E_ABORT; } prb = (struct ata_siiprb_command *) ((u_int8_t *)rman_get_virtual(ctlr->r_res2) + offset); return prb->fis[3]; } static u_int32_t ata_siiprb_softreset(device_t dev, int port) { struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev)); struct ata_channel *ch = device_get_softc(dev); struct ata_siiprb_command *prb = (struct ata_siiprb_command *)ch->dma.work; u_int32_t signature; int offset = ch->unit * 0x2000; /* setup the workspace for a soft reset command */ bzero(prb, sizeof(struct ata_siiprb_command)); prb->control = htole16(0x0080); prb->fis[1] = port & 0x0f; /* issue soft reset */ if (ata_siiprb_issue_cmd(dev)) return -1; ata_udelay(150000); /* get possible signature */ prb = (struct ata_siiprb_command *) ((u_int8_t *)rman_get_virtual(ctlr->r_res2) + offset); signature=prb->fis[12]|(prb->fis[4]<<8)|(prb->fis[5]<<16)|(prb->fis[6]<<24); /* clear error bits/interrupt */ ATA_IDX_OUTL(ch, ATA_SERROR, 0xffffffff); return signature; } static void ata_siiprb_reset(device_t dev) { struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev)); struct ata_channel *ch = device_get_softc(dev); int offset = ch->unit * 0x2000; u_int32_t status, signature; int timeout; /* disable interrupts */ ATA_OUTL(ctlr->r_res2, 0x1014 + offset, 0x000000ff); /* reset channel HW */ ATA_OUTL(ctlr->r_res2, 0x1000 + offset, 0x00000001); DELAY(1000); ATA_OUTL(ctlr->r_res2, 0x1004 + offset, 0x00000001); DELAY(10000); /* poll for channel ready */ for (timeout = 0; timeout < 1000; timeout++) { if ((status = ATA_INL(ctlr->r_res2, 0x1008 + offset)) & 0x00040000) break; DELAY(1000); } if (bootverbose) { if (timeout >= 1000) device_printf(dev, "channel HW reset timeout\n"); else device_printf(dev, "channel HW reset time=%dms\n", timeout); } /* reset phy */ if (!ata_sata_phy_reset(dev, -1, 1)) { if (bootverbose) device_printf(dev, "phy reset found no device\n"); ch->devices = 0; goto finish; } /* issue soft reset */ signature = ata_siiprb_softreset(dev, ATA_PM); if (bootverbose) device_printf(dev, "SIGNATURE=%08x\n", signature); /* figure out whats there */ switch (signature >> 16) { case 0x0000: ch->devices = ATA_ATA_MASTER; break; case 0x9669: ch->devices = ATA_PORTMULTIPLIER; ATA_OUTL(ctlr->r_res2, 0x1000 + offset, 0x2000); /* enable PM support */ //SOS XXX need to clear all PM status and interrupts!!!! ata_pm_identify(dev); break; case 0xeb14: ch->devices = ATA_ATAPI_MASTER; break; default: ch->devices = 0; } if (bootverbose) device_printf(dev, "siiprb_reset devices=%08x\n", ch->devices); finish: /* clear interrupt(s) */ ATA_OUTL(ctlr->r_res2, 0x1008 + offset, 0x000008ff); /* require explicit interrupt ack */ ATA_OUTL(ctlr->r_res2, 0x1000 + offset, 0x00000008); /* 64bit mode */ ATA_OUTL(ctlr->r_res2, 0x1004 + offset, 0x00000400); /* enable interrupts wanted */ ATA_OUTL(ctlr->r_res2, 0x1010 + offset, 0x000000ff); } static void ata_siiprb_dmasetprd(void *xsc, bus_dma_segment_t *segs, int nsegs, int error) { struct ata_dmasetprd_args *args = xsc; struct ata_siiprb_dma_prdentry *prd = args->dmatab; int i; if ((args->error = error)) return; for (i = 0; i < nsegs; i++) { prd[i].addr = htole64(segs[i].ds_addr); prd[i].count = htole32(segs[i].ds_len); } prd[i - 1].control = htole32(ATA_DMA_EOT); KASSERT(nsegs <= ATA_SIIPRB_DMA_ENTRIES,("too many DMA segment entries\n")); args->nsegs = nsegs; } static void ata_siiprb_dmainit(device_t dev) { struct ata_channel *ch = device_get_softc(dev); /* note start and stop are not used here */ ch->dma.setprd = ata_siiprb_dmasetprd; ch->dma.max_address = BUS_SPACE_MAXADDR; ch->dma.max_iosize = (ATA_SIIPRB_DMA_ENTRIES - 1) * PAGE_SIZE; ata_dmainit(dev); } ATA_DECLARE_DRIVER(ata_sii); Index: head/sys/i386/conf/GENERIC =================================================================== --- head/sys/i386/conf/GENERIC (revision 249082) +++ head/sys/i386/conf/GENERIC (revision 249083) @@ -1,358 +1,357 @@ # # GENERIC -- Generic kernel configuration file for FreeBSD/i386 # # For more information on this file, please read the config(5) manual page, # and/or 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. # # $FreeBSD$ cpu I486_CPU cpu I586_CPU cpu I686_CPU ident GENERIC makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols makeoptions WITH_CTF=1 # Run ctfconvert(1) for DTrace support options SCHED_ULE # ULE scheduler options PREEMPTION # Enable kernel thread preemption options INET # InterNETworking options INET6 # IPv6 communications protocols options TCP_OFFLOAD # TCP offload options SCTP # Stream Control Transmission Protocol options FFS # Berkeley Fast Filesystem 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 QUOTA # Enable disk quotas for UFS options MD_ROOT # MD is a potential root device options NFSCL # New Network Filesystem Client options NFSD # New Network Filesystem Server options NFSLOCKD # Network Lock Manager options NFS_ROOT # NFS usable as /, requires NFSCL options MSDOSFS # MSDOS Filesystem options CD9660 # ISO 9660 Filesystem options PROCFS # Process filesystem (requires PSEUDOFS) options PSEUDOFS # Pseudo-filesystem framework options GEOM_PART_GPT # GUID Partition Tables. options GEOM_RAID # Soft RAID functionality. options GEOM_LABEL # Provides labelization 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 options SYSVMSG # SYSV-style message queues options SYSVSEM # SYSV-style semaphores options _KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time extensions options PRINTF_BUFR_SIZE=128 # Prevent printf output being interspersed. options KBD_INSTALL_CDEV # install a CDEV entry in /dev options HWPMC_HOOKS # Necessary kernel hooks for hwpmc(4) options AUDIT # Security event auditing options CAPABILITY_MODE # Capsicum capability mode options CAPABILITIES # Capsicum capabilities options MAC # TrustedBSD MAC Framework options KDTRACE_HOOKS # Kernel DTrace hooks options DDB_CTF # Kernel ELF linker loads CTF data options INCLUDE_CONFIG_FILE # Include this file in kernel # Debugging support. Always need this: options KDB # Enable kernel debugger support. # For minimum debugger support (stable branch) use: #options KDB_TRACE # Print a stack trace for a panic. # For full debugger support use this instead: options DDB # Support DDB. options GDB # Support remote GDB. options DEADLKRES # Enable the deadlock resolver options INVARIANTS # Enable calls of extra sanity checking options INVARIANT_SUPPORT # Extra sanity checks of internal structures, required by INVARIANTS options WITNESS # Enable checks to detect deadlocks and cycles options WITNESS_SKIPSPIN # Don't run witness on spinlocks for speed options MALLOC_DEBUG_MAXZONES=8 # Separate malloc(9) zones # To make an SMP kernel, the next two lines are needed options SMP # Symmetric MultiProcessor Kernel device apic # I/O APIC # CPU frequency control device cpufreq # Bus support. device acpi device eisa device pci # Floppy drives 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 # SCSI Controllers device ahb # EISA AHA1742 family device ahc # AHA2940 and onboard AIC7xxx devices options AHC_REG_PRETTY_PRINT # Print register bitfields in debug # output. Adds ~128k to driver. device ahd # AHA39320/29320 and onboard AIC79xx devices options AHD_REG_PRETTY_PRINT # Print register bitfields in debug # output. Adds ~215k to driver. device esp # AMD Am53C974 (Tekram DC-390(T)) device hptiop # Highpoint RocketRaid 3xxx series device isp # Qlogic family #device ispfw # Firmware for QLogic HBAs- normally a module device mpt # LSI-Logic MPT-Fusion device mps # LSI-Logic MPT-Fusion 2 #device ncr # NCR/Symbios Logic device sym # NCR/Symbios Logic (newer chipsets + those of `ncr') device trm # Tekram DC395U/UW/F DC315U adapters device adv # Advansys SCSI adapters device adw # Advansys wide SCSI adapters device aha # Adaptec 154x SCSI adapters device aic # Adaptec 15[012]x SCSI adapters, AIC-6[23]60. device bt # Buslogic/Mylex MultiMaster SCSI adapters device ncv # NCR 53C500 device nsp # Workbit Ninja SCSI-3 device stg # TMC 18C30/18C50 device isci # Intel C600 SAS controller # ATA/SCSI peripherals device scbus # SCSI bus (required for ATA/SCSI) device ch # SCSI media changers device da # Direct Access (disks) device sa # Sequential Access (tape etc) device cd # CD device pass # Passthrough device (direct ATA/SCSI access) device ses # Enclosure Services (SES and SAF-TE) device ctl # CAM Target Layer options CTL_DISABLE # Disable CTL by default to save memory. # Re-enable with kern.cam.ctl.disable=0 in # /boot/loader.conf # RAID controllers interfaced to the SCSI subsystem device amr # AMI MegaRAID device arcmsr # Areca SATA II RAID device asr # DPT SmartRAID V, VI and Adaptec SCSI RAID device ciss # Compaq Smart RAID 5* device dpt # DPT Smartcache III, IV - See NOTES for options device hptmv # Highpoint RocketRAID 182x device hptrr # Highpoint RocketRAID 17xx, 22xx, 23xx, 25xx device hpt27xx # Highpoint RocketRAID 27xx device iir # Intel Integrated RAID device ips # IBM (Adaptec) ServeRAID device mly # Mylex AcceleRAID/eXtremeRAID device twa # 3ware 9000 series PATA/SATA RAID device tws # LSI 3ware 9750 SATA+SAS 6Gb/s RAID controller # RAID controllers device aac # Adaptec FSA RAID device aacp # SCSI passthrough for aac (requires CAM) device ida # Compaq Smart RAID device mfi # LSI MegaRAID SAS device mlx # Mylex DAC960 family device pst # Promise Supertrak SX6000 device twe # 3ware ATA RAID # 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 options VESA # Add support for VESA BIOS Extensions (VBE) device splash # Splash screen and screen saver support # syscons is the default console driver, resembling an SCO console device sc options SC_PIXEL_MODE # add support for the raster text mode device agp # support several AGP chipsets # Power management support (see NOTES for more options) #device apm # Add suspend/resume support for the i8254. device pmtimer # 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 ppi # Parallel port interface device #device vpo # Requires scbus and da device puc # Multi I/O cards and multi-channel UARTs # PCI Ethernet NICs. device bxe # Broadcom BCM57710/BCM57711/BCM57711E 10Gb Ethernet device de # DEC/Intel DC21x4x (``Tulip'') device em # Intel PRO/1000 Gigabit Ethernet Family device igb # Intel PRO/1000 PCIE Server Gigabit Family device ixgb # Intel PRO/10GbE Ethernet Card device le # AMD Am7900 LANCE and Am79C9xx PCnet device ti # Alteon Networks Tigon I/II gigabit Ethernet device txp # 3Com 3cR990 (``Typhoon'') device vx # 3Com 3c590, 3c595 (``Vortex'') # PCI Ethernet NICs that use the common MII bus controller code. # NOTE: Be sure to keep the 'device miibus' line in order to use these NICs! device miibus # MII bus support device ae # Attansic/Atheros L2 FastEthernet device age # Attansic/Atheros L1 Gigabit Ethernet device alc # Atheros AR8131/AR8132 Ethernet device ale # Atheros AR8121/AR8113/AR8114 Ethernet device bce # Broadcom BCM5706/BCM5708 Gigabit Ethernet device bfe # Broadcom BCM440x 10/100 Ethernet device bge # Broadcom BCM570xx Gigabit Ethernet device cas # Sun Cassini/Cassini+ and NS DP83065 Saturn device dc # DEC/Intel 21143 and various workalikes device et # Agere ET1310 10/100/Gigabit Ethernet device fxp # Intel EtherExpress PRO/100B (82557, 82558) device gem # Sun GEM/Sun ERI/Apple GMAC device hme # Sun HME (Happy Meal Ethernet) device jme # JMicron JMC250 Gigabit/JMC260 Fast Ethernet device lge # Level 1 LXT1001 gigabit Ethernet device msk # Marvell/SysKonnect Yukon II Gigabit Ethernet device nfe # nVidia nForce MCP on-board Ethernet device nge # NatSemi DP83820 gigabit Ethernet #device nve # nVidia nForce MCP on-board Ethernet Networking device pcn # AMD Am79C97x PCI 10/100 (precedence over 'le') device re # RealTek 8139C+/8169/8169S/8110S device rl # RealTek 8129/8139 device sf # Adaptec AIC-6915 (``Starfire'') device sge # Silicon Integrated Systems SiS190/191 device sis # Silicon Integrated Systems SiS 900/SiS 7016 device sk # SysKonnect SK-984x & SK-982x gigabit Ethernet device ste # Sundance ST201 (D-Link DFE-550TX) device stge # Sundance/Tamarack TC9021 gigabit Ethernet device tl # Texas Instruments ThunderLAN device tx # SMC EtherPower II (83c170 ``EPIC'') device vge # VIA VT612x gigabit Ethernet device vr # VIA Rhine, Rhine II device vte # DM&P Vortex86 RDC R6040 Fast Ethernet device wb # Winbond W89C840F device xl # 3Com 3c90x (``Boomerang'', ``Cyclone'') # ISA Ethernet NICs. pccard NICs included. device cs # Crystal Semiconductor CS89x0 NIC # 'device ed' requires 'device miibus' device ed # NE[12]000, SMC Ultra, 3c503, DS8390 cards device ex # Intel EtherExpress Pro/10 and Pro/10+ device ep # Etherlink III based cards device fe # Fujitsu MB8696x based cards device ie # EtherExpress 8/16, 3C507, StarLAN 10 etc. device sn # SMC's 9000 series of Ethernet chips device xe # Xircom pccard Ethernet # Wireless NIC cards device wlan # 802.11 support options IEEE80211_DEBUG # enable debug msgs options IEEE80211_AMPDU_AGE # age frames in AMPDU reorder q's options IEEE80211_SUPPORT_MESH # enable 802.11s draft support device wlan_wep # 802.11 WEP support device wlan_ccmp # 802.11 CCMP support device wlan_tkip # 802.11 TKIP support device wlan_amrr # AMRR transmit rate control algorithm device an # Aironet 4500/4800 802.11 wireless NICs. device ath # Atheros NICs device ath_pci # Atheros pci/cardbus glue device ath_hal # pci/cardbus chip support options AH_SUPPORT_AR5416 # enable AR5416 tx/rx descriptors options AH_AR5416_INTERRUPT_MITIGATION # AR5416 interrupt mitigation options ATH_ENABLE_11N # Enable 802.11n support for AR5416 and later device ath_rate_sample # SampleRate tx rate control for ath #device bwi # Broadcom BCM430x/BCM431x wireless NICs. #device bwn # Broadcom BCM43xx wireless NICs. device ipw # Intel 2100 wireless NICs. device iwi # Intel 2200BG/2225BG/2915ABG wireless NICs. device iwn # Intel 4965/1000/5000/6000 wireless NICs. device malo # Marvell Libertas wireless NICs. device mwl # Marvell 88W8363 802.11n wireless NICs. device ral # Ralink Technology RT2500 wireless NICs. device wi # WaveLAN/Intersil/Symbol 802.11 wireless NICs. #device wl # Older non 802.11 Wavelan wireless NIC. device wpi # Intel 3945ABG wireless NICs. # Pseudo devices. device loop # Network loopback device random # Entropy device options PADLOCK_RNG # VIA Padlock RNG options RDRAND_RNG # Intel Bull Mountain RNG device ether # Ethernet support device vlan # 802.1Q VLAN support device tun # Packet tunnel. 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! # Note that 'bpf' is required for DHCP. device bpf # Berkeley packet filter # USB support options USB_DEBUG # enable debug msgs device uhci # UHCI PCI->USB interface device ohci # OHCI PCI->USB interface device ehci # EHCI PCI->USB interface (USB 2.0) device xhci # XHCI PCI->USB interface (USB 3.0) device usb # USB Bus (required) device ukbd # Keyboard device umass # Disks/Mass storage - Requires scbus and da # Sound support device sound # Generic sound driver (required) device snd_cmi # CMedia CMI8338/CMI8738 device snd_csa # Crystal Semiconductor CS461x/428x device snd_emu10kx # Creative SoundBlaster Live! and Audigy device snd_es137x # Ensoniq AudioPCI ES137x device snd_hda # Intel High Definition Audio device snd_ich # Intel, NVidia and other ICH AC'97 Audio device snd_via8233 # VIA VT8233x Audio # MMC/SD device mmc # MMC/SD bus device mmcsd # MMC/SD memory card device sdhci # Generic PCI SD Host Controller # VirtIO support device virtio # Generic VirtIO bus (required) device virtio_pci # VirtIO PCI device device vtnet # VirtIO Ethernet device device virtio_blk # VirtIO Block device device virtio_scsi # VirtIO SCSI device device virtio_balloon # VirtIO Memory Balloon device Index: head/sys/i386/conf/XBOX =================================================================== --- head/sys/i386/conf/XBOX (revision 249082) +++ head/sys/i386/conf/XBOX (revision 249083) @@ -1,90 +1,89 @@ # # XBOX -- kernel for an XBOX # # $FreeBSD$ cpu I686_CPU # Celeron ident XBOX makeoptions MODULES_OVERRIDE="" options KDB options DDB options XBOX # kernel is for XBOX device xboxfb # frame buffer support (REQUIRED!) device sc # syscons device fb # no support yet for root device name fetching options ROOTDEVNAME=\"ufs:ada0s1a\" #options ROOTDEVNAME=\"cd9660:acd0\" options SCHED_4BSD # 4BSD scheduler options INET # InterNETworking options INET6 # IPv6 communications protocols options FFS # Berkeley Fast Filesystem options SOFTUPDATES # Enable FFS soft updates support #options UFS_ACL # Support for access control lists #options UFS_DIRHASH # Improve performance on big directories #options MD_ROOT # MD is a potential root device options NFSCL # New Network Filesystem Client #options NFSD # New Network Filesystem Server #options NFSLOCKD # Network Lock Manager #options NFS_ROOT # NFS usable as /, requires NFSCL #options MSDOSFS # MSDOS Filesystem options CD9660 # ISO 9660 Filesystem #options PROCFS # Process filesystem (requires PSEUDOFS) #options PSEUDOFS # Pseudo-filesystem framework #options COMPAT_FREEBSD4 # Compatible with FreeBSD4 #options KTRACE # ktrace(1) support #options SYSVSHM # SYSV-style shared memory #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 # Xbox has a non-standard default timer frequency options TIMER_FREQ=1125000 # Gives ~733.34MHz CPU #device apic # I/O APIC device pci # ATA and ATAPI devices device ata -options ATA_CAM options ATA_STATIC_ID # Static device numbering # ATA/SCSI peripherals device scbus # SCSI bus (required for ATA/SCSI) device cd # CD device da # Direct Access (disks) device pass # Passthrough device (direct ATA/SCSI access) # Pseudo devices. device loop # Network loopback device random # Entropy device device ether # Ethernet support #device tun # Packet tunnel. #device md # Memory "disks" #device gif # IPv6 and IPv4 tunneling #device faith # IPv6-to-IPv4 relaying (translation) # The `bpf' device enables the Berkeley Packet Filter. # Be aware of the administrative consequences of enabling this! # Note that 'bpf' is required for DHCP. device bpf # Berkeley packet filter # USB support options USB_DEBUG # enable debug msgs #device uhci # UHCI PCI->USB interface device ohci # OHCI PCI->USB interface device usb # USB Bus (required) device ukbd # Keyboard device umass # Disks/Mass storage - Requires scbus and da device miibus device sound device snd_ich # nForce audio device nfe # nVidia nForce MCP on-board Ethernet Networking Index: head/sys/ia64/conf/GENERIC =================================================================== --- head/sys/ia64/conf/GENERIC (revision 249082) +++ head/sys/ia64/conf/GENERIC (revision 249083) @@ -1,209 +1,208 @@ # # GENERIC -- Generic kernel configuration file for FreeBSD/ia64 # # 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. # # For hardware specific information check HARDWARE.TXT # # $FreeBSD$ cpu ITANIUM2 ident GENERIC makeoptions DEBUG=-g # Build kernel with debug information. options AUDIT # Security event auditing options CAPABILITY_MODE # Capsicum capability mode options CAPABILITIES # Capsicum capabilities options CD9660 # ISO 9660 Filesystem options COMPAT_FREEBSD7 # Compatible with FreeBSD7 options FFS # Berkeley Fast Filesystem options GEOM_LABEL # Provides labelization options INCLUDE_CONFIG_FILE # Include this file in kernel options INET # InterNETworking options INET6 # IPv6 communications protocols options KTRACE # ktrace(1) syscall trace support options MAC # TrustedBSD MAC Framework options MD_ROOT # MD usable as root device options MSDOSFS # MSDOS Filesystem options NFSCL # New Network Filesystem Client options NFSLOCKD # Network Lock Manager options NFSD # New Network Filesystem Server options NFS_ROOT # NFS usable as root device options P1003_1B_SEMAPHORES # POSIX-style semaphores options PREEMPTION # Enable kernel thread preemption options PRINTF_BUFR_SIZE=128 # Printf buffering to limit interspersion options PROCFS # Process filesystem (/proc) options PSEUDOFS # Pseudo-filesystem framework options SCHED_ULE # ULE scheduler options SCSI_DELAY=5000 # Delay (in ms) before probing SCSI options SCTP # Stream Control Transmission Protocol options SMP # Symmetric Multi-Processor support options SOFTUPDATES # Enable FFS soft updates support options STACK # stack(9) support options SYSVMSG # SYSV-style message queues options SYSVSEM # SYSV-style semaphores options SYSVSHM # SYSV-style shared memory options UFS_ACL # Support for access control lists options UFS_DIRHASH # Hash-based directory lookup scheme options UFS_GJOURNAL # Enable gjournal-based UFS journaling options QUOTA # Enable disk quotas for UFS options _KPOSIX_PRIORITY_SCHEDULING # Posix P1003_1B RT extensions # Debugging support. Always need this: options KDB # Enable kernel debugger support. # For minimum debugger support (stable branch) use: #options KDB_TRACE # Print a stack trace for a panic. # For full debugger support use this instead: options DDB # Support DDB options GDB # Support remote GDB options DEADLKRES # Enable the deadlock resolver options INVARIANTS # Enable calls of extra sanity checking options INVARIANT_SUPPORT # required by INVARIANTS options WITNESS # Enable checks to detect deadlocks and cycles options WITNESS_SKIPSPIN # Don't run witness on spinlocks for speed options MALLOC_DEBUG_MAXZONES=8 # Separate malloc(9) zones # Various "busses" device miibus # MII bus support (Ethernet) device pci # PCI bus support device scbus # SCSI bus (required for ATA/SCSI) device usb # USB Bus (required for USB) # ATA controllers device ahci # AHCI-compatible SATA controllers device ata # Legacy ATA/SATA controllers -options ATA_CAM # Handle legacy controllers with CAM device mvs # Marvell 88SX50XX/88SX60XX/88SX70XX/SoC SATA device siis # SiliconImage SiI3124/SiI3132/SiI3531 SATA # SCSI Controllers device ahc # AHA2940 and AIC7xxx devices device ahd # AHA39320/29320 and AIC79xx devices device hptiop # Highpoint RocketRaid 3xxx series device isp # Qlogic family device mpt # LSI-Logic MPT-Fusion device sym # NCR/Symbios Logic # RAID controllers interfaced to the SCSI subsystem device amr # AMI MegaRAID device ciss # Compaq Smart RAID 5* device dpt # DPT Smartcache III, IV device iir # Intel Integrated RAID device ips # IBM (Adaptec) ServeRAID device mly # Mylex AcceleRAID/eXtremeRAID device twa # 3ware 9000 series PATA/SATA RAID # ATA/SCSI peripherals device cd # CD-ROM, DVD-ROM etc. device ch # Media changer device da # Direct Access (ie disk) device pass # Passthrough (direct ATA/SCSI access) device sa # Sequential Access (ie tape) device ses # Enclosure Services (SES and SAF-TE) device ctl # CAM Target Layer # RAID controllers device aac # Adaptec FSA RAID device aacp # SCSI passthrough for aac (requires CAM) device ida # Compaq Smart RAID device mlx # Mylex DAC960 family # USB host controllers and peripherals options USB_DEBUG # enable debug msgs device ehci # EHCI host controller device ohci # OHCI PCI->USB interface device uhci # UHCI PCI->USB interface device uhid # Human Interface Devices device ukbd # Keyboard device ulpt # Printer device umass # Disks/Mass storage (need scbus & da) device ums # Mouse # PCI Ethernet NICs. device de # DEC/Intel DC21x4x (``Tulip'') device em # Intel PRO/1000 Gigabit Ethernet Family device igb # Intel PRO/1000 PCIE Server Gigabit Family device ixgbe # Intel PRO/10GbE PCIE Ethernet Family device txp # 3Com 3cR990 (``Typhoon'') # PCI Ethernet NICs that use the common MII bus controller code. device ae # Attansic/Atheros L2 FastEthernet device age # Attansic/Atheros L1 Gigabit Ethernet device alc # Atheros AR8131/AR8132 Ethernet device ale # Atheros AR8121/AR8113/AR8114 Ethernet device bce # Broadcom BCM5706/BCM5708 Gigabit Ethernet device bfe # Broadcom BCM440x 10/100 Ethernet device bge # Broadcom BCM570xx Gigabit Ethernet device et # Agere ET1310 10/100/Gigabit Ethernet device jme # JMicron JMC250 Gigabit/JMC260 Fast Ethernet device msk # Marvell/SysKonnect Yukon II Gigabit Ethernet device nge # NatSemi DP83820 gigabit Ethernet device fxp # Intel EtherExpress PRO/100B (82557, 82558) device re # RealTek 8139C+/8169/8169S/8110S device sf # Adaptec AIC-6915 (``Starfire'') device sk # SysKonnect SK-984x & SK-982x gigabit Ethernet device ste # Sundance ST201 (D-Link DFE-550TX) device stge # Sundance/Tamarack TC9021 gigabit Ethernet device tx # SMC EtherPower II (83c170 ``EPIC'') device vge # VIA VT612x gigabit Ethernet device xl # 3Com 3c90x ("Boomerang", "Cyclone") # USB Ethernet device aue # ADMtek USB Ethernet device axe # ASIX Electronics USB Ethernet device cdce # Generic USB over Ethernet device cue # CATC USB Ethernet device kue # Kawasaki LSI USB Ethernet device rue # RealTek RTL8150 USB Ethernet device udav # Davicom DM9601E USB # USB Serial device uark # Technologies ARK3116 based serial adapters device ubsa # Belkin F5U103 and compatible serial adapters device uftdi # For FTDI usb serial adapters device uipaq # Some WinCE based devices device uplcom # Prolific PL-2303 serial adapters device uslcom # SI Labs CP2101/CP2102 serial adapters device uvisor # Visor and Palm devices device uvscom # USB serial support for DDI pocket's PHS # Wireless NIC cards. # The wlan(4) module assumes this, so just define it so it # at least correctly loads. options IEEE80211_SUPPORT_MESH # The ath(4) and ath_hal(4) code requires this. The module currently # builds everything including AR5416 (and later 11n NIC) support. options AH_SUPPORT_AR5416 # Various (pseudo) devices device ether # Ethernet support device faith # IPv6-to-IPv4 relaying (translation) device gif # IPv6 and IPv4 tunneling device loop # Network loopback device md # Memory "disks" device puc # Multi I/O cards and multi-channel UARTs device random # Entropy device device tun # Packet tunnel. device uart # Serial port (UART) device vlan # 802.1Q VLAN support device firmware # firmware assist module # The `bpf' device enables the Berkeley Packet Filter. # Be aware of the administrative consequences of enabling this! # Note that 'bpf' is required for DHCP. device bpf # Berkeley packet filter Index: head/sys/mips/conf/OCTEON1 =================================================================== --- head/sys/mips/conf/OCTEON1 (revision 249082) +++ head/sys/mips/conf/OCTEON1 (revision 249083) @@ -1,321 +1,320 @@ # # OCTEON1 -- Generic kernel configuration file for FreeBSD/MIPS on Cavium Octeon # # For more information on this file, please read the config(5) manual page, # and/or 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. # # $FreeBSD$ ident OCTEON1 makeoptions ARCH_FLAGS="-march=octeon -mabi=64" makeoptions LDSCRIPT_NAME=ldscript.mips.octeon1 # Don't build any modules yet. makeoptions MODULES_OVERRIDE="" makeoptions KERNLOADADDR=0xffffffff80100000 # We don't need to build a trampolined version of the kernel. makeoptions WITHOUT_KERNEL_TRAMPOLINE=1 include "../cavium/std.octeon1" hints "OCTEON1.hints" #Default places to look for devices. makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols # Board-specific support that cannot be auto-detected at runtime. #options OCTEON_VENDOR_LANNER # Support for Lanner boards. #options OCTEON_VENDOR_RADISYS # Support for Radisys boards. #options OCTEON_VENDOR_UBIQUITI # Support for Ubiquiti boards. #options OCTEON_BOARD_CAPK_0100ND # Support for CAPK-0100nd. # Compile for a specified Octeon model. If not specified, support for # detection at runtime will be used instead, which may give inferior # performance. # # See sys/contrib/octeon-sdk/octeon-model.h for possible values. #options OCTEON_MODEL=OCTEON_CN58XX_PASS1_1 options SCHED_ULE # ULE scheduler options PREEMPTION # Enable kernel thread preemption options INET # InterNETworking options INET6 # IPv6 communications protocols options SCTP # Stream Control Transmission Protocol options FFS # Berkeley Fast Filesystem 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 NFSCL # Network Filesystem Client options NFSD # Network Filesystem Server options NFSLOCKD # Network Lock Manager options NFS_ROOT # NFS usable as /, requires NFSCL options MSDOSFS # MSDOS Filesystem options CD9660 # ISO 9660 Filesystem options PROCFS # Process filesystem (requires PSEUDOFS) options PSEUDOFS # Pseudo-filesystem framework options GEOM_PART_GPT # GUID Partition Tables. options GEOM_LABEL # Provides labelization options COMPAT_FREEBSD32 # Compatible with o32 binaries 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 options SYSVMSG # SYSV-style message queues options SYSVSEM # SYSV-style semaphores options _KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time extensions options PRINTF_BUFR_SIZE=128 # Prevent printf output being interspersed. options HWPMC_HOOKS # Necessary kernel hooks for hwpmc(4) options AUDIT # Security event auditing options MAC # TrustedBSD MAC Framework #options KDTRACE_FRAME # Ensure frames are compiled in #options KDTRACE_HOOKS # Kernel DTrace hooks options INCLUDE_CONFIG_FILE # Include this file in kernel options NO_SWAPPING # Disable support for paging # Debugging for use in -current options KDB # Enable kernel debugger support. options DDB # Support DDB. options GDB # Support remote GDB. options DEADLKRES # Enable the deadlock resolver options INVARIANTS # Enable calls of extra sanity checking options INVARIANT_SUPPORT # Extra sanity checks of internal structures, required by INVARIANTS options WITNESS # Enable checks to detect deadlocks and cycles options WITNESS_SKIPSPIN # Don't run witness on spinlocks for speed options MALLOC_DEBUG_MAXZONES=8 # Separate malloc(9) zones # Make an SMP-capable kernel by default options SMP # Symmetric MultiProcessor Kernel # Bus support. device pci # 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 # On-board Compact Flash driver. device cf options ROOTDEVNAME=\"ufs:cf0s2a\" # Default root filesystem. # SCSI Controllers device ahc # AHA2940 and onboard AIC7xxx devices options AHC_REG_PRETTY_PRINT # Print register bitfields in debug # output. Adds ~128k to driver. device ahd # AHA39320/29320 and onboard AIC79xx devices options AHD_REG_PRETTY_PRINT # Print register bitfields in debug # output. Adds ~215k to driver. device esp # AMD Am53C974 (Tekram DC-390(T)) device hptiop # Highpoint RocketRaid 3xxx series device isp # Qlogic family #device ispfw # Firmware for QLogic HBAs- normally a module device mpt # LSI-Logic MPT-Fusion device mps # LSI-Logic MPT-Fusion 2 #device ncr # NCR/Symbios Logic device trm # Tekram DC395U/UW/F DC315U adapters device adv # Advansys SCSI adapters device adw # Advansys wide SCSI adapters device aic # Adaptec 15[012]x SCSI adapters, AIC-6[23]60. device bt # Buslogic/Mylex MultiMaster SCSI adapters # ATA/SCSI peripherals device scbus # SCSI bus (required for ATA/SCSI) device ch # SCSI media changers device da # Direct Access (disks) device sa # Sequential Access (tape etc) device cd # CD device pass # Passthrough device (direct ATA/SCSI access) device ses # Enclosure Services (SES and SAF-TE) # RAID controllers interfaced to the SCSI subsystem device amr # AMI MegaRAID #XXX it is not 64-bit clean, -scottl #device asr # DPT SmartRAID V, VI and Adaptec SCSI RAID device ciss # Compaq Smart RAID 5* device dpt # DPT Smartcache III, IV - See NOTES for options device iir # Intel Integrated RAID device ips # IBM (Adaptec) ServeRAID device mly # Mylex AcceleRAID/eXtremeRAID # RAID controllers device aac # Adaptec FSA RAID device aacp # SCSI passthrough for aac (requires CAM) device ida # Compaq Smart RAID device mfi # LSI MegaRAID SAS device mlx # Mylex DAC960 family #XXX pointer/int warnings #device pst # Promise Supertrak SX6000 device twe # 3ware ATA RAID # 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 # 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 # On-board Cavium Octeon Ethernet. # NOTE: Be sure to keep the 'device miibus' line in order to use these NICs! device octe # Cavium Octeon management Ethernet. device octm # Switch PHY support for the octe driver. These currently present a VLAN per # physical port, but may eventually provide support for DSA or similar instead. #device mv88e61xxphy # Marvell 88E61XX # PCI Ethernet NICs. device de # DEC/Intel DC21x4x (``Tulip'') device em # Intel PRO/1000 Gigabit Ethernet Family device igb # Intel PRO/1000 PCIE Server Gigabit Family device ixgbe # Intel PRO/10GbE PCIE Ethernet Family device le # AMD Am7900 LANCE and Am79C9xx PCnet device ti # Alteon Networks Tigon I/II gigabit Ethernet device txp # 3Com 3cR990 (``Typhoon'') device vx # 3Com 3c590, 3c595 (``Vortex'') # PCI Ethernet NICs that use the common MII bus controller code. # NOTE: Be sure to keep the 'device miibus' line in order to use these NICs! device miibus # MII bus support device ae # Attansic/Atheros L2 FastEthernet device age # Attansic/Atheros L1 Gigabit Ethernet device alc # Atheros AR8131/AR8132 Ethernet device ale # Atheros AR8121/AR8113/AR8114 Ethernet device bce # Broadcom BCM5706/BCM5708 Gigabit Ethernet device bfe # Broadcom BCM440x 10/100 Ethernet device bge # Broadcom BCM570xx Gigabit Ethernet device dc # DEC/Intel 21143 and various workalikes device et # Agere ET1310 10/100/Gigabit Ethernet device fxp # Intel EtherExpress PRO/100B (82557, 82558) device jme # JMicron JMC250 Gigabit/JMC260 Fast Ethernet device lge # Level 1 LXT1001 gigabit Ethernet device msk # Marvell/SysKonnect Yukon II Gigabit Ethernet device nge # NatSemi DP83820 gigabit Ethernet #device nve # nVidia nForce MCP on-board Ethernet Networking device pcn # AMD Am79C97x PCI 10/100 (precedence over 'le') device re # RealTek 8139C+/8169/8169S/8110S device rl # RealTek 8129/8139 device sf # Adaptec AIC-6915 (``Starfire'') device sge # Silicon Integrated Systems SiS190/191 device sis # Silicon Integrated Systems SiS 900/SiS 7016 device sk # SysKonnect SK-984x & SK-982x gigabit Ethernet device ste # Sundance ST201 (D-Link DFE-550TX) device stge # Sundance/Tamarack TC9021 gigabit Ethernet device tl # Texas Instruments ThunderLAN device tx # SMC EtherPower II (83c170 ``EPIC'') device vge # VIA VT612x gigabit Ethernet device vr # VIA Rhine, Rhine II device wb # Winbond W89C840F device xl # 3Com 3c90x (``Boomerang'', ``Cyclone'') # Wireless NIC cards device wlan # 802.11 support options IEEE80211_DEBUG # enable debug msgs options IEEE80211_AMPDU_AGE # age frames in AMPDU reorder q's options IEEE80211_SUPPORT_MESH # enable 802.11s draft support device wlan_wep # 802.11 WEP support device wlan_ccmp # 802.11 CCMP support device wlan_tkip # 802.11 TKIP support device wlan_amrr # AMRR transmit rate control algorithm device an # Aironet 4500/4800 802.11 wireless NICs. device ath # Atheros NIC's device ath_pci # Atheros pci/cardbus glue device ath_hal # pci/cardbus chip support options AH_SUPPORT_AR5416 # enable AR5416 tx/rx descriptors device ath_rate_sample # SampleRate tx rate control for ath device ral # Ralink Technology RT2500 wireless NICs. device wi # WaveLAN/Intersil/Symbol 802.11 wireless NICs. # Pseudo devices. device loop # Network loopback device random # Entropy device device ether # Ethernet support device vlan # 802.1Q VLAN support device tun # Packet tunnel. 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! # Note that 'bpf' is required for DHCP. device bpf # Berkeley packet filter # Hardware watchdog support. #device octeon_wdog # Octeon hardware watchdog # USB support options USB_DEBUG # enable debug msgs device octusb # Cavium Octeon on-board USB interface (USB 2.0) device uhci # UHCI PCI->USB interface device ohci # OHCI PCI->USB interface device ehci # EHCI PCI->USB interface (USB 2.0) device usb # USB Bus (required) #device udbp # USB Double Bulk Pipe devices device uhid # "Human Interface Devices" device ulpt # Printer device umass # Disks/Mass storage - Requires scbus and da device ums # Mouse device urio # Diamond Rio 500 MP3 player # USB Serial devices device u3g # USB-based 3G modems (Option, Huawei, Sierra) device uark # Technologies ARK3116 based serial adapters device ubsa # Belkin F5U103 and compatible serial adapters device uftdi # For FTDI usb serial adapters device uipaq # Some WinCE based devices device uplcom # Prolific PL-2303 serial adapters device uslcom # SI Labs CP2101/CP2102 serial adapters device uvisor # Visor and Palm devices device uvscom # USB serial support for DDI pocket's PHS # USB Ethernet, requires miibus device aue # ADMtek USB Ethernet device axe # ASIX Electronics USB Ethernet device cdce # Generic USB over Ethernet device cue # CATC USB Ethernet device kue # Kawasaki LSI USB Ethernet device rue # RealTek RTL8150 USB Ethernet device udav # Davicom DM9601E USB # USB Wireless device rum # Ralink Technology RT2501USB wireless NICs device uath # Atheros AR5523 wireless NICs device ural # Ralink Technology RT2500USB wireless NICs device zyd # ZyDAS zd1211/zd1211b wireless NICs # crypto subsystem device crypto # core crypto support device cryptodev # /dev/crypto for access to h/w device cryptocteon # Octeon coprocessor 2 crypto offload # GPIO support #device gpio # PMC support #device hwpmc Index: head/sys/mips/conf/XLR =================================================================== --- head/sys/mips/conf/XLR (revision 249082) +++ head/sys/mips/conf/XLR (revision 249083) @@ -1,147 +1,146 @@ #################################RMI_BSD##################################### # Copyright (c) 2003-2009 RMI Corporation # 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. # 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. Neither the name of RMI Corporation, nor the names of its contributors, # may 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. #################################RMI_BSD##################################### # XLR -- Generic kernel configuration file for FreeBSD/mips # # 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. # # $FreeBSD$ machine mips mips ident XLR include "../rmi/std.xlr" makeoptions MODULES_OVERRIDE="" makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols makeoptions KERNLOADADDR=0x80100000 #profile 2 options SCHED_ULE # ULE scheduler #options VERBOSE_SYSINIT #options SCHED_4BSD # 4BSD scheduler options SMP options PREEMPTION # Enable kernel thread preemption #options FULL_PREEMPTION # Enable kernel thread preemption options INET # InterNETworking options INET6 # IPv6 communications protocols options FFS # Berkeley Fast Filesystem #options SOFTUPDATES # Enable FFS soft updates support options UFS_ACL # Support for access control lists options UFS_DIRHASH # Improve performance on big directories options NFSCL options NFS_ROOT # options BOOTP options BOOTP_NFSROOT options BOOTP_NFSV3 options BOOTP_WIRED_TO=nlge0 options BOOTP_COMPAT options ROOTDEVNAME=\"nfs:10.1.1.8:/usr/extra/nfsroot\" # #options MD_ROOT # MD is a potential root device #options MD_ROOT_SIZE=27000 #options MD_ROOT_SIZE=5120 #options ROOTDEVNAME=\"ufs:md0\" options _KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time extensions options HZ=1000 options NO_SWAPPING #Debugging options options KTRACE # ktrace(1) support options DDB options KDB options GDB options ALT_BREAK_TO_DEBUGGER options BREAK_TO_DEBUGGER #options DEADLKRES #Enable the deadlock resolver options INVARIANTS #Enable calls of extra sanity checking options INVARIANT_SUPPORT #Extra sanity checks of internal structures, required by INVARIANTS #options WITNESS #Enable checks to detect deadlocks and cycles #options WITNESS_SKIPSPIN #Don't run witness on spinlocks for speed #options KTR # ktr(4) and ktrdump(8) support #options KTR_COMPILE=(KTR_LOCK|KTR_PROC|KTR_INTR|KTR_CALLOUT|KTR_UMA|KTR_SYSC) #options KTR_ENTRIES=131072 #options LOCK_PROFILING #options SLEEPQUEUE_PROFILING #options TURNSTILE_PROFILING device pci #device ata -#device atadisk device uart # Pseudo device loop device random device md device bpf # Network device miibus device nlge device ether device re device msk device da device scbus device ehci # EHCI PCI->USB interface (USB 2.0) device usb # USB Bus (required) #options USB_DEBUG # enable debug msgs #device uhid # "Human Interface Devices" device umass # Disks/Mass storage - Requires scbus and da #device cfi #i2c device ic device iic device iicbb device iicbus device ds1374u # RTC on XLR boards device max6657 # Temparature sensor on XLR boards device at24co2n # EEPROM on XLR boards #crypto # Not yet #device cryptodev #device crypto #device rmisec Index: head/sys/mips/conf/XLR64 =================================================================== --- head/sys/mips/conf/XLR64 (revision 249082) +++ head/sys/mips/conf/XLR64 (revision 249083) @@ -1,121 +1,120 @@ # XLR64 -- Kernel configuration file for N64 kernel on XLR/XLS # # 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. # # $FreeBSD$ machine mips mips64 ident XLR64 include "../rmi/std.xlr" makeoptions MODULES_OVERRIDE="" makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols makeoptions ARCH_FLAGS="-march=mips64 -mabi=64" makeoptions KERNLOADADDR=0xffffffff80100000 #profile 2 options SCHED_ULE # ULE scheduler #options VERBOSE_SYSINIT #options SCHED_4BSD # 4BSD scheduler options SMP #options PREEMPTION # Enable kernel thread preemption #options FULL_PREEMPTION # Enable kernel thread preemption options INET # InterNETworking options INET6 # IPv6 communications protocols options FFS # Berkeley Fast Filesystem #options SOFTUPDATES # Enable FFS soft updates support options UFS_ACL # Support for access control lists options UFS_DIRHASH # Improve performance on big directories options NFSCL options NFS_ROOT # options BOOTP options BOOTP_NFSROOT options BOOTP_NFSV3 options BOOTP_WIRED_TO=nlge0 options BOOTP_COMPAT options ROOTDEVNAME=\"nfs:10.1.1.8:/usr/extra/nfsroot\" # #options MD_ROOT # MD is a potential root device #options MD_ROOT_SIZE=27000 #options MD_ROOT_SIZE=5120 #options ROOTDEVNAME=\"ufs:md0\" options _KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time extensions options HZ=1000 options NO_SWAPPING #Debugging options options KTRACE # ktrace(1) support options DDB options KDB options GDB options ALT_BREAK_TO_DEBUGGER options BREAK_TO_DEBUGGER #options DEADLKRES #Enable the deadlock resolver options INVARIANTS #Enable calls of extra sanity checking options INVARIANT_SUPPORT #Extra sanity checks of internal structures, required by INVARIANTS #options WITNESS #Enable checks to detect deadlocks and cycles #options WITNESS_SKIPSPIN #Don't run witness on spinlocks for speed #options KTR # ktr(4) and ktrdump(8) support #options KTR_COMPILE=(KTR_LOCK|KTR_PROC|KTR_INTR|KTR_CALLOUT|KTR_UMA|KTR_SYSC) #options KTR_ENTRIES=131072 #options LOCK_PROFILING #options SLEEPQUEUE_PROFILING #options TURNSTILE_PROFILING device pci #device ata -#device atadisk device uart # Pseudo device loop device random device md device bpf # Network device miibus device nlge device ether device re device msk device da device scbus device ehci # EHCI PCI->USB interface (USB 2.0) device usb # USB Bus (required) options USB_DEBUG # enable debug msgs #device uhid # "Human Interface Devices" device umass # Disks/Mass storage - Requires scbus and da #device cfi #i2c device ic device iic device iicbb device iicbus device ds1374u # RTC on XLR boards device max6657 # Temparature sensor on XLR boards device at24co2n # EEPROM on XLR boards #crypto # Not yet #device cryptodev #device crypto #device rmisec Index: head/sys/mips/conf/XLRN32 =================================================================== --- head/sys/mips/conf/XLRN32 (revision 249082) +++ head/sys/mips/conf/XLRN32 (revision 249083) @@ -1,125 +1,124 @@ # XLRN32 -- Kernel configuration file for N32 kernel on XLR/XLS # # 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. # # $FreeBSD$ machine mips mipsn32 ident XLRN32 include "../rmi/std.xlr" makeoptions MODULES_OVERRIDE="" makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols makeoptions ARCH_FLAGS="-march=mips64 -mabi=n32" makeoptions KERNLOADADDR=0x80100000 #profile 2 options SCHED_ULE # ULE scheduler #options VERBOSE_SYSINIT #options SCHED_4BSD # 4BSD scheduler options SMP options PREEMPTION # Enable kernel thread preemption #options FULL_PREEMPTION # Enable kernel thread preemption options INET # InterNETworking options INET6 # IPv6 communications protocols options FFS # Berkeley Fast Filesystem #options SOFTUPDATES # Enable FFS soft updates support options UFS_ACL # Support for access control lists options UFS_DIRHASH # Improve performance on big directories options NFSCL options NFS_ROOT # options BOOTP options BOOTP_NFSROOT options BOOTP_NFSV3 options BOOTP_WIRED_TO=nlge0 options BOOTP_COMPAT options ROOTDEVNAME=\"nfs:10.1.1.8:/usr/extra/nfsroot\" # #options MD_ROOT # MD is a potential root device #options MD_ROOT_SIZE=27000 #options MD_ROOT_SIZE=5120 #options ROOTDEVNAME=\"ufs:md0\" options _KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time extensions options HZ=1000 options NO_SWAPPING #Debugging options options KTRACE # ktrace(1) support #options DDB #options KDB #options GDB #options ALT_BREAK_TO_DEBUGGER #options DEADLKRES #Enable the deadlock resolver options INVARIANTS #Enable calls of extra sanity checking options INVARIANT_SUPPORT #Extra sanity checks of internal structures, required by INVARIANTS #options WITNESS #Enable checks to detect deadlocks and cycles #options WITNESS_SKIPSPIN #Don't run witness on spinlocks for speed #options KTR # ktr(4) and ktrdump(8) support #options KTR_COMPILE=(KTR_LOCK|KTR_PROC|KTR_INTR|KTR_CALLOUT|KTR_UMA|KTR_SYSC) #options KTR_ENTRIES=131072 #options LOCK_PROFILING #options SLEEPQUEUE_PROFILING #options TURNSTILE_PROFILING device pci #device ata -#device atadisk #options XLR_PERFMON # Enable XLR processor activity monitoring options BREAK_TO_DEBUGGER device uart # Pseudo device loop device random device md device bpf # Network device miibus device nlge device ether device re device msk device da device scbus #device ohci # OHCI PCI->USB interface device ehci # EHCI PCI->USB interface (USB 2.0) device usb # USB Bus (required) options USB_DEBUG # enable debug msgs #device udbp # USB Double Bulk Pipe devices #device ugen # Generic #device uhid # "Human Interface Devices" device umass # Disks/Mass storage - Requires scbus and da #device cfi #i2c device ic device iic device iicbb device iicbus device ds1374u # RTC on XLR boards device max6657 # Temparature sensor on XLR boards device at24co2n # EEPROM on XLR boards #crypto # Not yet #device cryptodev #device crypto #device rmisec Index: head/sys/mips/conf/std.SWARM =================================================================== --- head/sys/mips/conf/std.SWARM (revision 249082) +++ head/sys/mips/conf/std.SWARM (revision 249083) @@ -1,61 +1,60 @@ # # $FreeBSD$ # hints "SWARM.hints" include "../sibyte/std.sibyte" options CFE options CFE_CONSOLE options CFE_ENV options ALT_BREAK_TO_DEBUGGER cpu CPU_SB1 makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols makeoptions MODULES_OVERRIDE="" options DDB options KDB options SCHED_4BSD #4BSD scheduler options INET #InterNETworking options NFSCL #Network Filesystem Client options NFS_ROOT #NFS usable as /, requires NFSCL options PSEUDOFS #Pseudo-filesystem framework options _KPOSIX_PRIORITY_SCHEDULING #Posix P1003_1B real-time extensions # Debugging for use in -current #options DEADLKRES options INVARIANTS options INVARIANT_SUPPORT options WITNESS options FFS #Fast filesystem options KTRACE device pci device miibus device bge device loop device ether device md device random options USB_DEBUG device usb device ohci device uhci device ehci device umass device scbus device cd device da device pass device ata -options ATA_CAM options ATA_STATIC_ID # Static device numbering Index: head/sys/mips/conf/std.XLP =================================================================== --- head/sys/mips/conf/std.XLP (revision 249082) +++ head/sys/mips/conf/std.XLP (revision 249083) @@ -1,117 +1,116 @@ # $FreeBSD$ include "../nlm/std.xlp" makeoptions MODULES_OVERRIDE="" makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols #profile 2 hints "XLP.hints" options SCHED_ULE # ULE scheduler #options VERBOSE_SYSINIT #options SCHED_4BSD # 4BSD scheduler options SMP options PREEMPTION # Enable kernel thread preemption #options FULL_PREEMPTION # Enable kernel thread preemption options INET # InterNETworking options INET6 # IPv6 communications protocols options FFS # Berkeley Fast Filesystem #options SOFTUPDATES # Enable FFS soft updates support options UFS_ACL # Support for access control lists options UFS_DIRHASH # Improve performance on big directories options NFSCL options NFS_ROOT options MSDOSFS #MSDOS Filesystem # #options BOOTP #options BOOTP_NFSROOT #options BOOTP_NFSV3 #options BOOTP_WIRED_TO=nlge0 #options BOOTP_COMPAT #options ROOTDEVNAME=\"nfs:10.1.1.8:/usr/extra/nfsroot\" options MD_ROOT # MD is a potential root device options MD_ROOT_SIZE=132000 options ROOTDEVNAME=\"ufs:md0\" options _KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time extensions options HZ=1000 options NO_SWAPPING # Debugging options options KTRACE # ktrace(1) support options DDB options KDB options GDB options BREAK_TO_DEBUGGER options ALT_BREAK_TO_DEBUGGER #options DEADLKRES # Enable the deadlock resolver #options INVARIANTS #options INVARIANT_SUPPORT #options WITNESS # Detect deadlocks and cycles #options WITNESS_SKIPSPIN # Don't run witness on spinlocks for speed #options KTR # ktr(4) and ktrdump(8) support #options KTR_COMPILE=(KTR_LOCK|KTR_PROC|KTR_INTR|KTR_CALLOUT|KTR_UMA|KTR_SYSC) #options KTR_ENTRIES=131072 #options LOCK_DEBUG #options LOCK_PROFILING options GEOM_UZIP # Device tree options FDT options FDT_DTB_STATIC makeoptions FDT_DTS_FILE=xlp-basic.dts # Pseudo device loop device random device md device bpf # Network device miibus device ether device xlpge #device re device msk device em # Disks device siis device da device scbus #device ata -#device atadisk # USB device usb # USB Bus (required) device ehci # EHCI PCI->USB interface (USB 2.0) #options USB_DEBUG # enable debug msgs #device ugen # Generic #device uhid # "Human Interface Devices" device umass # Requires scbus and da # i2c driver and devices device iic device iicbus device iicoc device ds1374 # RTC on XLP boards # Crypto device crypto device cryptodev device nlmsec device nlmrsa # Options that use crypto options IPSEC options GEOM_ELI # NOR device cfi device cfid # MMC/SD device mmc # MMC/SD bus device mmcsd # MMC/SD memory card device sdhci # Generic PCI SD Host Controller Index: head/sys/mips/malta/std.malta =================================================================== --- head/sys/mips/malta/std.malta (revision 249082) +++ head/sys/mips/malta/std.malta (revision 249083) @@ -1,12 +1,11 @@ # $FreeBSD$ files "../malta/files.malta" cpu CPU_MIPS4KC device pci device ata -options ATA_CAM device scbus # SCSI bus (required for ATA/SCSI) device cd # CD device da # Direct Access (disks) device pass # Passthrough device (direct ATA/SCSI access) Index: head/sys/modules/ata/atapicd/Makefile =================================================================== --- head/sys/modules/ata/atapicd/Makefile (revision 249082) +++ head/sys/modules/ata/atapicd/Makefile (nonexistent) @@ -1,9 +0,0 @@ -# $FreeBSD$ - -.PATH: ${.CURDIR}/../../../dev/ata - -KMOD= atapicd -SRCS= atapi-cd.c -SRCS+= opt_ata.h ata_if.h device_if.h bus_if.h pci_if.h - -.include Property changes on: head/sys/modules/ata/atapicd/Makefile ___________________________________________________________________ Deleted: svn:keywords ## -1 +0,0 ## -FreeBSD=%H \ No newline at end of property Index: head/sys/modules/ata/atapist/Makefile =================================================================== --- head/sys/modules/ata/atapist/Makefile (revision 249082) +++ head/sys/modules/ata/atapist/Makefile (nonexistent) @@ -1,9 +0,0 @@ -# $FreeBSD$ - -.PATH: ${.CURDIR}/../../../dev/ata - -KMOD= atapist -SRCS= atapi-tape.c -SRCS+= opt_ata.h ata_if.h device_if.h bus_if.h pci_if.h - -.include Property changes on: head/sys/modules/ata/atapist/Makefile ___________________________________________________________________ Deleted: svn:keywords ## -1 +0,0 ## -FreeBSD=%H \ No newline at end of property Index: head/sys/modules/ata/atapifd/Makefile =================================================================== --- head/sys/modules/ata/atapifd/Makefile (revision 249082) +++ head/sys/modules/ata/atapifd/Makefile (nonexistent) @@ -1,9 +0,0 @@ -# $FreeBSD$ - -.PATH: ${.CURDIR}/../../../dev/ata - -KMOD= atapifd -SRCS= atapi-fd.c -SRCS+= opt_ata.h ata_if.h device_if.h bus_if.h pci_if.h - -.include Property changes on: head/sys/modules/ata/atapifd/Makefile ___________________________________________________________________ Deleted: svn:keywords ## -1 +0,0 ## -FreeBSD=%H \ No newline at end of property Index: head/sys/modules/ata/atadisk/Makefile =================================================================== --- head/sys/modules/ata/atadisk/Makefile (revision 249082) +++ head/sys/modules/ata/atadisk/Makefile (nonexistent) @@ -1,13 +0,0 @@ -# $FreeBSD$ - -.PATH: ${.CURDIR}/../../../dev/ata ${.CURDIR}/../../../${MACHINE}/${MACHINE} - -KMOD= atadisk -SRCS= ata-disk.c ${ata_machdep} -SRCS+= opt_ata.h ata_if.h device_if.h bus_if.h pci_if.h - -.if exists(${.CURDIR}/../../../${MACHINE}/${MACHINE}/ata_machdep.c) -ata_machdep= ata_machdep.c -.endif - -.include Property changes on: head/sys/modules/ata/atadisk/Makefile ___________________________________________________________________ Deleted: svn:keywords ## -1 +0,0 ## -FreeBSD=%H \ No newline at end of property Index: head/sys/modules/ata/atapicam/Makefile =================================================================== --- head/sys/modules/ata/atapicam/Makefile (revision 249082) +++ head/sys/modules/ata/atapicam/Makefile (nonexistent) @@ -1,9 +0,0 @@ -# $FreeBSD$ - -.PATH: ${.CURDIR}/../../../dev/ata - -KMOD= atapicam -SRCS= atapi-cam.c -SRCS+= opt_ata.h opt_cam.h ata_if.h device_if.h bus_if.h pci_if.h - -.include Property changes on: head/sys/modules/ata/atapicam/Makefile ___________________________________________________________________ Deleted: svn:keywords ## -1 +0,0 ## -FreeBSD=%H \ No newline at end of property Index: head/sys/modules/ata/atacam/Makefile =================================================================== --- head/sys/modules/ata/atacam/Makefile (revision 249082) +++ head/sys/modules/ata/atacam/Makefile (nonexistent) @@ -1,9 +0,0 @@ -# $FreeBSD$ - -.PATH: ${.CURDIR}/../../../dev/ata - -KMOD= atacam -SRCS= ata-cam.c -SRCS+= opt_ata.h opt_cam.h ata_if.h device_if.h bus_if.h pci_if.h - -.include Property changes on: head/sys/modules/ata/atacam/Makefile ___________________________________________________________________ Deleted: svn:keywords ## -1 +0,0 ## -FreeBSD=%H \ No newline at end of property Index: head/sys/modules/ata/ataraid/Makefile =================================================================== --- head/sys/modules/ata/ataraid/Makefile (revision 249082) +++ head/sys/modules/ata/ataraid/Makefile (nonexistent) @@ -1,9 +0,0 @@ -# $FreeBSD$ - -.PATH: ${.CURDIR}/../../../dev/ata - -KMOD= ataraid -SRCS= ata-raid.c -SRCS+= opt_ata.h ata_if.h device_if.h bus_if.h pci_if.h - -.include Property changes on: head/sys/modules/ata/ataraid/Makefile ___________________________________________________________________ Deleted: svn:keywords ## -1 +0,0 ## -FreeBSD=%H \ No newline at end of property Index: head/sys/modules/ata/Makefile =================================================================== --- head/sys/modules/ata/Makefile (revision 249082) +++ head/sys/modules/ata/Makefile (revision 249083) @@ -1,13 +1,12 @@ # $FreeBSD$ SUBDIR = atacore SUBDIR += atacard .if ${MACHINE} == "pc98" SUBDIR += atacbus .else SUBDIR += ataisa .endif SUBDIR += atapci -SUBDIR += atadisk atapicd atapifd atapist ataraid atapicam #atacam .include Index: head/sys/pc98/conf/GENERIC =================================================================== --- head/sys/pc98/conf/GENERIC (revision 249082) +++ head/sys/pc98/conf/GENERIC (revision 249083) @@ -1,247 +1,246 @@ # # GENERIC -- Generic kernel configuration file for FreeBSD/pc98 # # For more information on this file, please read the config(5) manual page, # and/or 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. # # $FreeBSD$ cpu I486_CPU cpu I586_CPU cpu I686_CPU ident GENERIC makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols options SCHED_4BSD # 4BSD scheduler #options PREEMPTION # Enable kernel thread preemption options INET # InterNETworking options INET6 # IPv6 communications protocols options SCTP # Stream Control Transmission Protocol options FFS # Berkeley Fast Filesystem 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 NFSCL # New Network Filesystem Client options NFSD # New Network Filesystem Server options NFSLOCKD # Network Lock Manager options NFS_ROOT # NFS usable as /, requires NFSCL options MSDOSFS # MSDOS Filesystem options CD9660 # ISO 9660 Filesystem options PROCFS # Process filesystem (requires PSEUDOFS) options PSEUDOFS # Pseudo-filesystem framework options GEOM_PART_GPT # GUID Partition Tables. options GEOM_LABEL # Provides labelization 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 EPSON_BOUNCEDMA # use bounce buffer for 15-16M #options EPSON_MEMWIN # EPSON memory window support #options LINE30 options KTRACE # ktrace(1) support options STACK # stack(9) support options SYSVSHM # SYSV-style shared memory 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 options CAPABILITY_MODE # Capsicum capability mode options CAPABILITIES # Capsicum capabilities options MAC # TrustedBSD MAC Framework options INCLUDE_CONFIG_FILE # Include this file in kernel options KDB # Kernel debugger related code options KDB_TRACE # Print a stack trace for a panic # To make an SMP kernel, the next two lines are needed #options SMP # Symmetric MultiProcessor Kernel #device apic # I/O APIC # Bus support. device pci # Floppy drives 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 # SCSI Controllers device adv # Advansys SCSI adapters device ahc # AHA2940 and onboard AIC7xxx devices device esp # AMD Am53C974 (Tekram DC-390(T)) device isp # Qlogic family #device ncr # NCR/Symbios Logic device sym # NCR/Symbios Logic (newer chipsets + those of `ncr') device aic # PC-9801-100 device ct # host adapter using WD33C93[ABC] chip (C bus) device ncv # NCR 53C500 device nsp # Workbit Ninja SCSI-3 device stg # TMC 18C30/18C50 # ATA/SCSI peripherals device scbus # SCSI bus (required for ATA/SCSI) device ch # SCSI media changers device da # Direct Access (disks) device sa # Sequential Access (tape etc) device cd # CD device pass # Passthrough device (direct ATA/SCSI access) device ses # Enclosure Services (SES and SAF-TE) # keyboard driver device pckbd # PC98 keyboard device gdc # GDC screen device splash # Splash screen and screen saver support # syscons is the default console driver, resembling an SCO console device sc #device agp # support several AGP chipsets # Power management support (see NOTES for more options) #device apm #device pmc #device canbus #device canbepm # Add suspend/resume support for the i8254. #device pmtimer # 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 #options COM_MULTIPORT #options COM_ESP # ESP98 #device sio # 8250, 16[45]50, 8251 based serial ports device uart # Generic UART driver device mse #device joy # NEW Parallel port device ppc device ppbus # Parallel port bus (required) device lpt # Printer device ppi # Parallel port interface device #device vpo # Requires scbus and da # OLD Parallel port #device olpt # PCI Ethernet NICs. device de # DEC/Intel DC21x4x (``Tulip'') #device em # Intel PRO/1000 adapter Gigabit Ethernet Card device le # AMD Am7900 LANCE and Am79C9xx PCnet #device ti # Alteon Networks Tigon I/II gigabit Ethernet device txp # 3Com 3cR990 (``Typhoon'') device vx # 3Com 3c590, 3c595 (``Vortex'') # PCI Ethernet NICs that use the common MII bus controller code. # NOTE: Be sure to keep the 'device miibus' line in order to use these NICs! device miibus # MII bus support device bfe # Broadcom BCM440x 10/100 Ethernet #device bge # Broadcom BCM570xx Gigabit Ethernet device dc # DEC/Intel 21143 and various workalikes device fxp # Intel EtherExpress PRO/100B (82557, 82558) #device lge # Level 1 LXT1001 gigabit Ethernet #device nge # NatSemi DP83820 gigabit Ethernet device pcn # AMD Am79C97x PCI 10/100 (precedence over 'le') device re # RealTek 8139C+/8169/8169S/8110S device rl # RealTek 8129/8139 device sf # Adaptec AIC-6915 (``Starfire'') device sis # Silicon Integrated Systems SiS 900/SiS 7016 #device sk # SysKonnect SK-984x & SK-982x gigabit Ethernet device ste # Sundance ST201 (D-Link DFE-550TX) device tl # Texas Instruments ThunderLAN device tx # SMC EtherPower II (83c170 ``EPIC'') #device vge # VIA VT612x gigabit Ethernet device vr # VIA Rhine, Rhine II device wb # Winbond W89C840F device xl # 3Com 3c90x (``Boomerang'', ``Cyclone'') # ISA Ethernet NICs. pccard NICs included. # 'device ed' requires 'device miibus' device ed # NE[12]000, SMC Ultra, 3c503, DS8390 cards device ep # Etherlink III based cards device fe # Fujitsu MB8696x based cards device sn # SMC's 9000 series of Ethernet chips device snc device xe # Xircom pccard Ethernet # Wireless NIC cards #device wlan # 802.11 support #options IEEE80211_DEBUG # enable debug msgs #options IEEE80211_AMPDU_AGE # age frames in AMPDU reorder q's options IEEE80211_SUPPORT_MESH # enable 802.11s draft support #device wlan_wep # 802.11 WEP support #device wlan_ccmp # 802.11 CCMP support #device wlan_tkip # 802.11 TKIP support #device wlan_amrr # AMRR transmit rate control algorithm #device an # Aironet 4500/4800 802.11 wireless NICs. #device ath # Atheros NICs #device ath_pci # Atheros pci/cardbus glue #device ath_hal # pci/cardbus chip support options AH_SUPPORT_AR5416 # enable AR5416 tx/rx descriptors #device ath_rate_sample # SampleRate tx rate control for ath #device ral # Ralink Technology RT2500 wireless NICs. #device wi # WaveLAN/Intersil/Symbol 802.11 wireless NICs. #device wl # Older non 802.11 Wavelan wireless NIC. # Pseudo devices. device loop # Network loopback device random # Entropy device device ether # Ethernet support device vlan # 802.1Q VLAN support device tun # Packet tunnel. 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! # Note that 'bpf' is required for DHCP. device bpf # Berkeley packet filter # USB support #options USB_DEBUG # enable debug msgs #device uhci # UHCI PCI->USB interface #device ohci # OHCI PCI->USB interface #device ehci # EHCI PCI->USB interface (USB 2.0) #device usb # USB Bus (required) #device ukbd # Keyboard #device umass # Disks/Mass storage - Requires scbus and da # Sound support #device sound # Generic sound driver (required) #device snd_mss # Microsoft Sound System #device "snd_sb16" # Sound Blaster 16 #device snd_sbc # Sound Blaster Index: head/sys/pc98/conf/NOTES =================================================================== --- head/sys/pc98/conf/NOTES (revision 249082) +++ head/sys/pc98/conf/NOTES (revision 249083) @@ -1,643 +1,642 @@ # # NOTES -- Lines that can be cut/pasted into kernel and hints configs. # # This file contains machine dependent kernel configuration notes. For # machine independent notes, look in /sys/conf/NOTES. # # $FreeBSD$ # # # We want LINT to cover profiling as well. profile 2 ##################################################################### # SMP OPTIONS: # # The apic device enables the use of the I/O APIC for interrupt delivery. # The apic device can be used in both UP and SMP kernels, but is required # for SMP kernels. Thus, the apic device is not strictly an SMP option, # but it is a prerequisite for SMP. # # Mandatory: device apic # I/O apic # # Watchdog routines. # options MP_WATCHDOG ##################################################################### # CPU OPTIONS # # You must specify at least one CPU (the one you intend to run on); # deleting the specification for CPUs you don't need to use may make # parts of the system run faster. # cpu I486_CPU cpu I586_CPU # aka Pentium(tm) cpu I686_CPU # aka Pentium Pro(tm) # # Options for CPU features. # # CPU_BLUELIGHTNING_3X enables triple-clock mode on IBM Blue Lightning # CPU if CPU supports it. The default is double-clock mode on # BlueLightning CPU box. # # CPU_BLUELIGHTNING_FPU_OP_CACHE enables FPU operand cache on IBM # BlueLightning CPU. It works only with Cyrix FPU, and this option # should not be used with Intel FPU. # # CPU_BTB_EN enables branch target buffer on Cyrix 5x86 (NOTE 1). # # CPU_CYRIX_NO_LOCK enables weak locking for the entire address space # of Cyrix 6x86 and 6x86MX CPUs by setting the NO_LOCK bit of CCR1. # Otherwise, the NO_LOCK bit of CCR1 is cleared. (NOTE 3) # # CPU_DIRECT_MAPPED_CACHE sets L1 cache of Cyrix 486DLC CPU in direct # mapped mode. Default is 2-way set associative mode. # # CPU_DISABLE_5X86_LSSER disables load store serialize (i.e., enables # reorder). This option should not be used if you use memory mapped # I/O device(s). # # CPU_DISABLE_CMPXCHG disables the CMPXCHG instruction on > i386 IA32 # machines. VmWare 3.x seems to emulate this instruction poorly, causing # the guest OS to run very slowly. This problem appears to be fixed in # VmWare 4.x, at least in version 4.5.2, so that enabling this option with # VmWare 4.x will result in locking operations to be 20-30 times slower. # Enabling this with an SMP kernel will cause the kernel to be unusable. # # CPU_DISABLE_SSE explicitly prevents I686_CPU from turning on SSE. # # CPU_FASTER_5X86_FPU enables faster FPU exception handler. # # CPU_I486_ON_386 enables CPU cache on i486 based CPU upgrade products # for i386 machines. # # CPU_IORT defines I/O clock delay time (NOTE 1). Default values of # I/O clock delay time on Cyrix 5x86 and 6x86 are 0 and 7,respectively # (no clock delay). # # CPU_L2_LATENCY specifies the L2 cache latency value. This option is used # only when CPU_PPRO2CELERON is defined and Mendocino Celeron is detected. # The default value is 5. # # CPU_LOOP_EN prevents flushing the prefetch buffer if the destination # of a jump is already present in the prefetch buffer on Cyrix 5x86(NOTE # 1). # # CPU_PPRO2CELERON enables L2 cache of Mendocino Celeron CPUs. This option # is useful when you use Socket 8 to Socket 370 converter, because most Pentium # Pro BIOSs do not enable L2 cache of Mendocino Celeron CPUs. # # CPU_RSTK_EN enables return stack on Cyrix 5x86 (NOTE 1). # # CPU_SUSP_HLT enables suspend on HALT. If this option is set, CPU # enters suspend mode following execution of HALT instruction. # # CPU_UPGRADE_HW_CACHE eliminates unneeded cache flush instruction(s). # # CPU_WT_ALLOC enables write allocation on Cyrix 6x86/6x86MX and AMD # K5/K6/K6-2 CPUs. # # CYRIX_CACHE_WORKS enables CPU cache on Cyrix 486 CPUs with cache # flush at hold state. # # CYRIX_CACHE_REALLY_WORKS enables (1) CPU cache on Cyrix 486 CPUs # without cache flush at hold state, and (2) write-back CPU cache on # Cyrix 6x86 whose revision < 2.7 (NOTE 2). # # NO_F00F_HACK disables the hack that prevents Pentiums (and ONLY # Pentiums) from locking up when a LOCK CMPXCHG8B instruction is # executed. This option is only needed if I586_CPU is also defined, # and should be included for any non-Pentium CPU that defines it. # # NO_MEMORY_HOLE is an optimisation for systems with AMD K6 processors # which indicates that the 15-16MB range is *definitely* not being # occupied by an ISA memory hole. # # NOTE 1: The options, CPU_BTB_EN, CPU_LOOP_EN, CPU_IORT, # CPU_LOOP_EN and CPU_RSTK_EN should not be used because of CPU bugs. # These options may crash your system. # # NOTE 2: If CYRIX_CACHE_REALLY_WORKS is not set, CPU cache is enabled # in write-through mode when revision < 2.7. If revision of Cyrix # 6x86 >= 2.7, CPU cache is always enabled in write-back mode. # # NOTE 3: This option may cause failures for software that requires # locked cycles in order to operate correctly. # options CPU_BLUELIGHTNING_3X options CPU_BLUELIGHTNING_FPU_OP_CACHE options CPU_BTB_EN options CPU_DIRECT_MAPPED_CACHE options CPU_DISABLE_5X86_LSSER options CPU_DISABLE_CMPXCHG #options CPU_DISABLE_SSE options CPU_FASTER_5X86_FPU options CPU_I486_ON_386 options CPU_IORT options CPU_L2_LATENCY=5 options CPU_LOOP_EN options CPU_PPRO2CELERON options CPU_RSTK_EN options CPU_SUSP_HLT options CPU_UPGRADE_HW_CACHE options CPU_WT_ALLOC options CYRIX_CACHE_WORKS options CYRIX_CACHE_REALLY_WORKS #options NO_F00F_HACK # Debug options options NPX_DEBUG # enable npx debugging # # PERFMON causes the driver for Pentium/Pentium Pro performance counters # to be compiled. See perfmon(4) for more information. # options PERFMON ##################################################################### # NETWORKING OPTIONS # # DEVICE_POLLING adds support for mixed interrupt-polling handling # of network device drivers, which has significant benefits in terms # of robustness to overloads and responsivity, as well as permitting # accurate scheduling of the CPU time between kernel network processing # and other activities. The drawback is a moderate (up to 1/HZ seconds) # potential increase in response times. # It is strongly recommended to use HZ=1000 or 2000 with DEVICE_POLLING # to achieve smoother behaviour. # Additionally, you can enable/disable polling at runtime with help of # the ifconfig(8) utility, and select the CPU fraction reserved to # userland with the sysctl variable kern.polling.user_frac # (default 50, range 0..100). # # Not all device drivers support this mode of operation at the time of # this writing. See polling(4) for more details. options DEVICE_POLLING # BPF_JITTER adds support for BPF just-in-time compiler. options BPF_JITTER ##################################################################### # MISCELLANEOUS DEVICES AND OPTIONS # # sio: serial ports (see sio(4)), including support for various # PC Card devices, such as Modem and NICs # #device sio hint.sio.0.at="isa" hint.sio.0.port="0x3F8" hint.sio.0.flags="0x10" hint.sio.0.irq="4" # `flags' specific to sio(4). # 0x10 enable console support for this unit. Other console flags # (if applicable) are ignored unless this is set. Enabling # console support does not make the unit the preferred console. # Boot with -h or set boot_serial=YES in the loader. For sio(4) # specifically, the 0x20 flag can also be set (see above). # Currently, at most one unit can have console support; the # first one (in config file order) with this flag set is # preferred. Setting this flag for sio0 gives the old behaviour. # 0x20 force this unit to be the console (unless there is another # higher priority console). This replaces the COMCONSOLE option. # 0x40 reserve this unit for low level console operations. Do not # access the device in any normal way. # 0x80 use this port for serial line gdb support in ddb. Also known # as debug port. # PnP `flags' # 0x1 disable probing of this device. Used to prevent your modem # from being attached as a PnP modem. # Other flags for sio that aren't documented in the man page. # 0x20000 enable hardware RTS/CTS and larger FIFOs. Only works for # ST16650A-compatible UARTs. # Options for sio: options COM_ESP # Code for Hayes ESP. options COM_MULTIPORT # Code for some cards with shared IRQs. options CONSPEED=115200 # Speed for serial console # (default 9600). device speaker #Play IBM BASIC-style noises out your speaker hint.speaker.0.at="isa" hint.speaker.0.port="0x35" device gzip #Exec gzipped a.out's. REQUIRES COMPAT_AOUT! device apm_saver # Requires APM ##################################################################### # HARDWARE BUS CONFIGURATION # # ISA bus # device isa # # Options for `isa': # # AUTO_EOI_1 enables the `automatic EOI' feature for the master 8259A # interrupt controller. This saves about 0.7-1.25 usec for each interrupt. # This option breaks suspend/resume on some portables. # # MAXMEM specifies the amount of RAM on the machine; if this is not # specified, FreeBSD will first read the amount of memory from the CMOS # RAM, so the amount of memory will initially be limited to 64MB or 16MB # depending on the BIOS. If the BIOS reports 64MB, a memory probe will # then attempt to detect the installed amount of RAM. If this probe # fails to detect >64MB RAM you will have to use the MAXMEM option. # The amount is in kilobytes, so for a machine with 128MB of RAM, it would # be 131072 (128 * 1024). # # BROKEN_KEYBOARD_RESET disables the use of the keyboard controller to # reset the CPU for reboot. This is needed on some systems with broken # keyboard controllers. # # EPSON_BOUNCEDMA was to use a bounce buffer to upper 15MB, but it's # broken now. # # EPSON_MEMWIN disables 15-16MB chunk, and enables EPSON memory window. # options AUTO_EOI_1 options MAXMEM=(128*1024) #options BROKEN_KEYBOARD_RESET options EPSON_BOUNCEDMA options EPSON_MEMWIN # # PCI bus & PCI options: # device pci # # AGP GART support device agp # AGP debugging. options AGP_DEBUG ##################################################################### # HARDWARE DEVICE CONFIGURATION # PC98 keyboard device pckbd hint.pckbd.0.at="isa" hint.pckbd.0.port="0x041" hint.pckbd.0.irq="1" # GDC screen device gdc hint.gdc.0.at="isa" options LINE30 # # The Numeric Processing eXtension driver. This is non-optional. device npx # # `flags' for npx0: # 0x01 don't use the npx registers to optimize bcopy. # 0x02 don't use the npx registers to optimize bzero. # 0x04 don't use the npx registers to optimize copyin or copyout. # The npx registers are normally used to optimize copying and zeroing when # all of the following conditions are satisfied: # I586_CPU is an option # the cpu is an i586 (perhaps not a Pentium) # the probe for npx0 succeeds # INT 16 exception handling works. # Then copying and zeroing using the npx registers is normally 30-100% faster. # The flags can be used to control cases where it doesn't work or is slower. # Setting them at boot time using hints works right (the optimizations # are not used until later in the bootstrap when npx0 is attached). # Flag 0x08 automatically disables the i586 optimized routines. # # # Optional devices: # # 3Dfx Voodoo Graphics, Voodoo II /dev/3dfx CDEV support. This will create # the /dev/3dfx0 device to work with glide implementations. This should get # linked to /dev/3dfx and /dev/voodoo. Note that this is not the same as # the tdfx DRI module from XFree86 and is completely unrelated. # # To enable Linuxulator support, one must also include COMPAT_LINUX in the # config as well. The other option is to load both as modules. device tdfx # Enable 3Dfx Voodoo support device tdfx_linux # Enable Linuxulator support # Direct Rendering modules for 3D acceleration. device drm # DRM core module required by DRM drivers device mach64drm # ATI Rage Pro, Rage Mobility P/M, Rage XL device mgadrm # AGP Matrox G200, G400, G450, G550 device r128drm # ATI Rage 128 device radeondrm # ATI Radeon device savagedrm # S3 Savage3D, Savage4 device sisdrm # SiS 300/305, 540, 630 device tdfxdrm # 3dfx Voodoo 3/4/5 and Banshee options DRM_DEBUG # Include debug printfs (slow) # # Bus mouse # device mse hint.mse.0.at="isa" hint.mse.0.port="0x7fd9" hint.mse.0.irq="13" # # Network interfaces: # # ce: Cronyx Tau-PCI/32 sync single/dual port G.703/E1 serial adaptor # with 32 HDLC subchannels (requires sppp (default), or NETGRAPH if # NETGRAPH_CRONYX is configured) # cp: Cronyx Tau-PCI sync single/dual/four port # V.35/RS-232/RS-530/RS-449/X.21/G.703/E1/E3/T3/STS-1 # serial adaptor (requires sppp (default), or NETGRAPH if # NETGRAPH_CRONYX is configured) # cs: IBM Etherjet and other Crystal Semi CS89x0-based adapters and pccard # ed: Western Digital and SMC 80xx; Novell NE1000 and NE2000; 3Com 3C503 # HP PC Lan+, various PC Card devices # (requires miibus) # ie: AT&T StarLAN 10 and EN100; 3Com 3C507; unknown NI5210; # Intel EtherExpress # le: AMD Am7900 LANCE and Am79C9xx ILACC/PCnet Ethernet interface driver # sbni: Granch SBNI12-xx ISA and PCI adapters # snc: National Semiconductor DP8393X SONIC Ethernet adapter driver # Order for ISA/EISA devices is important here device ce device cp device cs device ed hint.ed.0.at="isa" hint.ed.0.port="0x280" hint.ed.0.irq="5" hint.ed.0.maddr="0xd8000" device ie # Hints only required for Starlan hint.ie.2.at="isa" hint.ie.2.port="0x300" hint.ie.2.irq="5" hint.ie.2.maddr="0xd0000" #device le # Hint for the PC98-only C-NET(98)S C-bus front-end of le(4). hint.le.0.at="isa" hint.le.0.port="0x03d0" hint.le.0.irq="6" device sbni hint.sbni.0.at="isa" hint.sbni.0.port="0x210" hint.sbni.0.irq="0xefdead" hint.sbni.0.flags="0" device snc hint.snc.0.at="isa" hint.snc.0.port="0x888" hint.snc.0.irq="6" hint.snc.0.maddr="0xc0000" # # SCSI host adapters: # # ct: WD33C93[ABC] based SCSI host adapters. # ncv: NCR 53C500 based SCSI host adapters. # nsp: Workbit Ninja SCSI-3 based PC Card SCSI host adapters. # stg: TMC 18C30, 18C50 based SCSI host adapters. device ct hint.ct.0.at="isa" device ncv device nsp device stg # # SafeNet crypto driver: can be moved to the MI NOTES as soon as # it's tested on a big-endian machine # device safe # SafeNet 1141 options SAFE_DEBUG # enable debugging support: hw.safe.debug options SAFE_RNDTEST # enable rndtest support ##################################################################### # # Miscellaneous hardware: # # apm: Laptop Advanced Power Management (experimental) # canbus: CanBe I/O Bus # canbepm: CanBe Power Management Controller # olpt: XXX # pmc: Power Management Controller of NEC PC-98Note # pmtimer: Timer device driver for power management events (APM or ACPI) # Adjusts system timer at wakeup time # # Notes on APM # The flags takes the following meaning for apm0: # 0x0020 Statclock is broken. device apm hint.apm.0.flags="0x20" device canbus device canbepm device olpt hint.olpt.0.at="isa" hint.olpt.0.port="0x040" device pmc hint.pmc.0.at="isa" hint.pmc.0.port="0x8f0" device pmtimer # # Laptop/Notebook options: # # See also: # apm under `Miscellaneous hardware' # above. # For older notebooks that signal a powerfail condition (external # power supply dropped, or battery state low) by issuing an NMI: options POWERFAIL_NMI # make it beep instead of panicing # # Set the number of PV entries per process. Increasing this can # stop panics related to heavy use of shared memory. However, that can # (combined with large amounts of physical memory) cause panics at # boot time due the kernel running out of VM space. # # If you're tweaking this, you might also want to increase the sysctls # "vm.v_free_min", "vm.v_free_reserved", and "vm.v_free_target". # # The value below is the one more than the default. # options PMAP_SHPGPERPROC=201 # # Change the size of the kernel virtual address space. Due to # constraints in loader(8) on i386, this must be a multiple of 4. # 256 = 1 GB of kernel address space. Increasing this also causes # a reduction of the address space in user processes. 512 splits # the 4GB cpu address space in half (2GB user, 2GB kernel). # options KVA_PAGES=260 ##################################################################### # ABI Emulation # Enable iBCS2 runtime support for SCO and ISC binaries options IBCS2 # Emulate spx device for client side of SVR3 local X interface options SPX_HACK # Enable Linux ABI emulation options COMPAT_LINUX # Enable i386 a.out binary support options COMPAT_AOUT # Enable the linux-like proc filesystem support (requires COMPAT_LINUX # and PSEUDOFS) options LINPROCFS # Enable the linux-like sys filesystem support (requires COMPAT_LINUX # and PSEUDOFS) options LINSYSFS # # SysVR4 ABI emulation # # The svr4 ABI emulator can be statically compiled into the kernel or loaded as # a KLD module. # The STREAMS network emulation code can also be compiled statically or as a # module. If loaded as a module, it must be loaded before the svr4 module # (the /usr/sbin/svr4 script does this for you). If compiling statically, # the `streams' device must be configured into any kernel which also # specifies COMPAT_SVR4. It is possible to have a statically-configured # STREAMS device and a dynamically loadable svr4 emulator; the /usr/sbin/svr4 # script understands that it doesn't need to load the `streams' module under # those circumstances. # Caveat: At this time, `options KTRACE' is required for the svr4 emulator # (whether static or dynamic). # options COMPAT_SVR4 # build emulator statically options DEBUG_SVR4 # enable verbose debugging device streams # STREAMS network driver (required for svr4). # Linux-specific pseudo devices support device lindev ##################################################################### # VM OPTIONS # Disable the 4 MByte page PSE CPU feature. The PSE feature allows the # kernel to use 4 MByte pages to map the kernel instead of 4k pages. # This saves on the amount of memory needed for page tables needed to # map the kernel. You should only disable this feature as a temporary # workaround if you are having problems with it enabled. # #options DISABLE_PSE # Disable the global pages PGE CPU feature. The PGE feature allows pages # to be marked with the PG_G bit. TLB entries for these pages are not # flushed from the cache when %cr3 is reloaded. This can make context # switches less expensive. You should only disable this feature as a # temporary workaround if you are having problems with it enabled. # #options DISABLE_PG_G # KSTACK_PAGES is the number of memory pages to assign to the kernel # stack of each thread. options KSTACK_PAGES=3 ##################################################################### # More undocumented options for linting. # Note that documenting these are not considered an affront. options FB_INSTALL_CDEV # install a CDEV entry in /dev options I586_PMC_GUPROF=0x70000 options KBDIO_DEBUG=2 options KBD_MAXRETRY=4 options KBD_MAXWAIT=6 options KBD_RESETDELAY=201 options TIMER_FREQ=((14318182+6)/12) options VM_KMEM_SIZE options VM_KMEM_SIZE_MAX options VM_KMEM_SIZE_SCALE ##################################################################### # Devices we don't want to deal with nodevice bt nodevice adw nodevice aha nodevice ahb nodevice ahd nodevice mpt nodevice trm nodevice wds nodevice dpt nodevice ciss nodevice iir nodevice mly nodevice ida # Compaq Smart RAID nodevice mlx # Mylex DAC960 nodevice amr # AMI MegaRAID nodevice twe # 3ware ATA RAID -nodevice ataraid nodevice cm nodevice ex nodevice fea nodevice intpm nodevice alpm nodevice ichsmb nodevice viapm nodevice amdpm nodevice amdsmb nodevice nfpm nodevice nfsmb ##################################################################### # Options we don't want to deal with nooption AHD_DEBUG nooption AHD_DEBUG_OPTS nooption AHD_REG_PRETTY_PRINT nooption ADW_ALLOW_MEMIO nooption DPT_LOST_IRQ nooption DPT_RESET_HBA nooption DPT_TIMEOUT_FACTOR nooption AAC_DEBUG ##################################################################### # Make options we don't want to deal with Index: head/sys/powerpc/conf/GENERIC =================================================================== --- head/sys/powerpc/conf/GENERIC (revision 249082) +++ head/sys/powerpc/conf/GENERIC (revision 249083) @@ -1,211 +1,210 @@ # # GENERIC -- Generic kernel configuration file for FreeBSD/powerpc # # 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. # # $FreeBSD$ cpu AIM ident GENERIC machine powerpc powerpc makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols makeoptions WITH_CTF=1 # Platform support options POWERMAC #NewWorld Apple PowerMacs options PSIM #GDB PSIM ppc simulator options MAMBO #IBM Mambo Full System Simulator options SCHED_ULE #ULE scheduler options PREEMPTION #Enable kernel thread preemption options INET #InterNETworking options INET6 #IPv6 communications protocols options SCTP #Stream Control Transmission Protocol options FFS #Berkeley Fast Filesystem 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 QUOTA #Enable disk quotas for UFS options MD_ROOT #MD is a potential root device options NFSCL #New Network Filesystem Client options NFSD #New Network Filesystem Server options NFSLOCKD #Network Lock Manager options NFS_ROOT #NFS usable as root device options MSDOSFS #MSDOS Filesystem options CD9660 #ISO 9660 Filesystem options PROCFS #Process filesystem (requires PSEUDOFS) options PSEUDOFS #Pseudo-filesystem framework options GEOM_PART_APM #Apple Partition Maps. options GEOM_PART_GPT #GUID Partition Tables. options GEOM_LABEL #Provides labelization options COMPAT_FREEBSD4 #Keep this for a while 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) syscall trace support options STACK #stack(9) support options SYSVSHM #SYSV-style shared memory options SYSVMSG #SYSV-style message queues options SYSVSEM #SYSV-style semaphores options _KPOSIX_PRIORITY_SCHEDULING #Posix P1003_1B real-time extensions options HWPMC_HOOKS # Necessary kernel hooks for hwpmc(4) options AUDIT # Security event auditing options CAPABILITY_MODE # Capsicum capability mode options CAPABILITIES # Capsicum capabilities options MAC # TrustedBSD MAC Framework options KDTRACE_HOOKS # Kernel DTrace hooks options DDB_CTF # Kernel ELF linker loads CTF data options INCLUDE_CONFIG_FILE # Include this file in kernel # Debugging support. Always need this: options KDB # Enable kernel debugger support. # For minimum debugger support (stable branch) use: #options KDB_TRACE # Print a stack trace for a panic. # For full debugger support use this instead: options DDB #Support DDB #options DEADLKRES #Enable the deadlock resolver options INVARIANTS #Enable calls of extra sanity checking options INVARIANT_SUPPORT #Extra sanity checks of internal structures, required by INVARIANTS options WITNESS #Enable checks to detect deadlocks and cycles options WITNESS_SKIPSPIN #Don't run witness on spinlocks for speed options MALLOC_DEBUG_MAXZONES=8 # Separate malloc(9) zones # Make an SMP-capable kernel by default options SMP # Symmetric MultiProcessor Kernel # CPU frequency control device cpufreq # Standard busses device pci device agp # ATA controllers device ahci # AHCI-compatible SATA controllers device ata # Legacy ATA/SATA controllers -options ATA_CAM # Handle legacy controllers with CAM device mvs # Marvell 88SX50XX/88SX60XX/88SX70XX/SoC SATA device siis # SiliconImage SiI3124/SiI3132/SiI3531 SATA # SCSI Controllers device ahc # AHA2940 and onboard AIC7xxx devices options AHC_ALLOW_MEMIO # Attempt to use memory mapped I/O options AHC_REG_PRETTY_PRINT # Print register bitfields in debug # output. Adds ~128k to driver. device isp # Qlogic family device ispfw # Firmware module for Qlogic host adapters device mpt # LSI-Logic MPT-Fusion device mps # LSI-Logic MPT-Fusion 2 device sym # NCR/Symbios/LSI Logic 53C8XX/53C1010/53C1510D # ATA/SCSI peripherals device scbus # SCSI bus (required for ATA/SCSI) device da # Direct Access (disks) device sa # Sequential Access (tape etc) device cd # CD device pass # Passthrough device (direct ATA/SCSI access) # syscons is the default console driver, resembling an SCO console device sc device kbdmux options SC_OFWFB # OFW frame buffer options SC_DFLT_FONT # compile font in makeoptions SC_DFLT_FONT=cp437 # Serial (COM) ports device scc device uart device uart_z8530 # PCI Ethernet NICs that use the common MII bus controller code. device miibus # MII bus support device bge # Broadcom BCM570xx Gigabit Ethernet device bm # Apple BMAC Ethernet device gem # Sun GEM/Sun ERI/Apple GMAC device dc # DEC/Intel 21143 and various workalikes device fxp # Intel EtherExpress PRO/100B (82557, 82558) # Pseudo devices. device loop # Network loopback device random # Entropy device device ether # Ethernet support device vlan # 802.1Q VLAN support device tun # Packet tunnel. device md # Memory "disks" device ofwd # Open Firmware 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! # Note that 'bpf' is required for DHCP. device bpf #Berkeley packet filter # USB support options USB_DEBUG # enable debug msgs device uhci # UHCI PCI->USB interface device ohci # OHCI PCI->USB interface device ehci # EHCI PCI->USB interface device usb # USB Bus (required) device uhid # "Human Interface Devices" device ukbd # Keyboard options KBD_INSTALL_CDEV # install a CDEV entry in /dev device ulpt # Printer device umass # Disks/Mass storage - Requires scbus and da0 device ums # Mouse device atp # Apple USB touchpad device urio # Diamond Rio 500 MP3 player # USB Ethernet device aue # ADMtek USB Ethernet device axe # ASIX Electronics USB Ethernet device cdce # Generic USB over Ethernet device cue # CATC USB Ethernet device kue # Kawasaki LSI USB Ethernet # Wireless NIC cards options IEEE80211_SUPPORT_MESH options AH_SUPPORT_AR5416 # Misc device iicbus # I2C bus code device kiic # Keywest I2C device ad7417 # PowerMac7,2 temperature sensor device ds1631 # PowerMac11,2 temperature sensor device ds1775 # PowerMac7,2 temperature sensor device fcu # Apple Fan Control Unit device max6690 # PowerMac7,2 temperature sensor device powermac_nvram # Open Firmware configuration NVRAM device smu # Apple System Management Unit device windtunnel # Apple G4 MDD fan controller device atibl # ATI-based backlight driver for PowerBooks/iBooks device nvbl # nVidia-based backlight driver for PowerBooks/iBooks # ADB support device adb device cuda device pmu # Sound support device sound # Generic sound driver (required) device snd_ai2s # Apple I2S audio device snd_davbus # Apple DAVBUS audio device snd_uaudio # USB Audio Index: head/sys/powerpc/conf/GENERIC64 =================================================================== --- head/sys/powerpc/conf/GENERIC64 (revision 249082) +++ head/sys/powerpc/conf/GENERIC64 (revision 249083) @@ -1,209 +1,208 @@ # # GENERIC -- Generic kernel configuration file for FreeBSD/powerpc # # 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. # # $FreeBSD$ cpu AIM ident GENERIC machine powerpc powerpc64 makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols # Platform support options POWERMAC #NewWorld Apple PowerMacs options PS3 #Sony Playstation 3 options MAMBO #IBM Mambo Full System Simulator options SCHED_ULE #ULE scheduler options PREEMPTION #Enable kernel thread preemption options INET #InterNETworking options INET6 #IPv6 communications protocols options SCTP #Stream Control Transmission Protocol options FFS #Berkeley Fast Filesystem 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 QUOTA #Enable disk quotas for UFS options MD_ROOT #MD is a potential root device options NFSCL #New Network Filesystem Client options NFSD #New Network Filesystem Server options NFSLOCKD #Network Lock Manager options NFS_ROOT #NFS usable as root device options MSDOSFS #MSDOS Filesystem options CD9660 #ISO 9660 Filesystem options PROCFS #Process filesystem (requires PSEUDOFS) options PSEUDOFS #Pseudo-filesystem framework options GEOM_PART_APM #Apple Partition Maps. options GEOM_PART_GPT #GUID Partition Tables. options GEOM_LABEL #Provides labelization options COMPAT_FREEBSD32 #Compatible with FreeBSD/powerpc binaries 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) syscall trace support options STACK #stack(9) support options SYSVSHM #SYSV-style shared memory options SYSVMSG #SYSV-style message queues options SYSVSEM #SYSV-style semaphores options _KPOSIX_PRIORITY_SCHEDULING #Posix P1003_1B real-time extensions options HWPMC_HOOKS # Necessary kernel hooks for hwpmc(4) options AUDIT # Security event auditing options MAC # TrustedBSD MAC Framework options INCLUDE_CONFIG_FILE # Include this file in kernel # Debugging support. Always need this: options KDB # Enable kernel debugger support. # For minimum debugger support (stable branch) use: #options KDB_TRACE # Print a stack trace for a panic. # For full debugger support use this instead: options DDB #Support DDB #options DEADLKRES #Enable the deadlock resolver options INVARIANTS #Enable calls of extra sanity checking options INVARIANT_SUPPORT #Extra sanity checks of internal structures, required by INVARIANTS options WITNESS #Enable checks to detect deadlocks and cycles options WITNESS_SKIPSPIN #Don't run witness on spinlocks for speed options MALLOC_DEBUG_MAXZONES=8 # Separate malloc(9) zones # Make an SMP-capable kernel by default options SMP # Symmetric MultiProcessor Kernel # CPU frequency control device cpufreq # Standard busses device pci device agp # ATA controllers device ahci # AHCI-compatible SATA controllers device ata # Legacy ATA/SATA controllers -options ATA_CAM # Handle legacy controllers with CAM device mvs # Marvell 88SX50XX/88SX60XX/88SX70XX/SoC SATA device siis # SiliconImage SiI3124/SiI3132/SiI3531 SATA # SCSI Controllers device ahc # AHA2940 and onboard AIC7xxx devices options AHC_ALLOW_MEMIO # Attempt to use memory mapped I/O options AHC_REG_PRETTY_PRINT # Print register bitfields in debug # output. Adds ~128k to driver. device isp # Qlogic family device ispfw # Firmware module for Qlogic host adapters device mpt # LSI-Logic MPT-Fusion device mps # LSI-Logic MPT-Fusion 2 device sym # NCR/Symbios/LSI Logic 53C8XX/53C1010/53C1510D # ATA/SCSI peripherals device scbus # SCSI bus (required for ATA/SCSI) device da # Direct Access (disks) device sa # Sequential Access (tape etc) device cd # CD device pass # Passthrough device (direct ATA/SCSI access) # syscons is the default console driver, resembling an SCO console device sc device kbdmux options SC_OFWFB # OFW frame buffer options SC_DFLT_FONT # compile font in makeoptions SC_DFLT_FONT=cp437 # Serial (COM) ports device scc device uart device uart_z8530 # Ethernet hardware device glc # Sony Playstation 3 Ethernet # PCI Ethernet NICs that use the common MII bus controller code. device miibus # MII bus support device bge # Broadcom BCM570xx Gigabit Ethernet device gem # Sun GEM/Sun ERI/Apple GMAC device dc # DEC/Intel 21143 and various workalikes device fxp # Intel EtherExpress PRO/100B (82557, 82558) # Pseudo devices. device loop # Network loopback device random # Entropy device device ether # Ethernet support device vlan # 802.1Q VLAN support device tun # Packet tunnel. device md # Memory "disks" device ofwd # Open Firmware 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! # Note that 'bpf' is required for DHCP. device bpf #Berkeley packet filter # USB support options USB_DEBUG # enable debug msgs device uhci # UHCI PCI->USB interface device ohci # OHCI PCI->USB interface device ehci # EHCI PCI->USB interface device usb # USB Bus (required) device uhid # "Human Interface Devices" device ukbd # Keyboard options KBD_INSTALL_CDEV # install a CDEV entry in /dev device ulpt # Printer device umass # Disks/Mass storage - Requires scbus and da0 device ums # Mouse device urio # Diamond Rio 500 MP3 player # USB Ethernet device aue # ADMtek USB Ethernet device axe # ASIX Electronics USB Ethernet device cdce # Generic USB over Ethernet device cue # CATC USB Ethernet device kue # Kawasaki LSI USB Ethernet # Wireless NIC cards options IEEE80211_SUPPORT_MESH options AH_SUPPORT_AR5416 # FireWire support device firewire # FireWire bus code device sbp # SCSI over FireWire (Requires scbus and da) device fwe # Ethernet over FireWire (non-standard!) # Misc device iicbus # I2C bus code device kiic # Keywest I2C device ad7417 # PowerMac7,2 temperature sensor device ds1631 # PowerMac11,2 temperature sensor device ds1775 # PowerMac7,2 temperature sensor device fcu # Apple Fan Control Unit device max6690 # PowerMac7,2 temperature sensor device powermac_nvram # Open Firmware configuration NVRAM device smu # Apple System Management Unit device atibl # ATI-based backlight driver for PowerBooks/iBooks device nvbl # nVidia-based backlight driver for PowerBooks/iBooks # ADB support device adb device pmu # Sound support device sound # Generic sound driver (required) device snd_ai2s # Apple I2S audio device snd_uaudio # USB Audio Index: head/sys/powerpc/conf/MPC85XX =================================================================== --- head/sys/powerpc/conf/MPC85XX (revision 249082) +++ head/sys/powerpc/conf/MPC85XX (revision 249083) @@ -1,91 +1,90 @@ # # Custom kernel for Freescale MPC85XX development boards like the CDS etc. # # $FreeBSD$ # cpu BOOKE cpu BOOKE_E500 ident MPC85XX machine powerpc powerpc makeoptions DEBUG="-Wa,-me500 -g" makeoptions NO_MODULES=yes options FPU_EMU options _KPOSIX_PRIORITY_SCHEDULING options ALT_BREAK_TO_DEBUGGER options BREAK_TO_DEBUGGER options BOOTP options BOOTP_NFSROOT options BOOTP_NFSV3 options BOOTP_WIRED_TO=tsec0 options CD9660 options COMPAT_43 options DDB #options DEADLKRES options DEVICE_POLLING #options DIAGNOSTIC options FDT makeoptions FDT_DTS_FILE=mpc8572ds.dts #makeoptions FDT_DTS_FILE=mpc8555cds.dts options FFS options GDB options GEOM_PART_GPT options INET options INET6 options INVARIANTS options INVARIANT_SUPPORT options KDB options KTRACE options MD_ROOT options MPC85XX options MSDOSFS options NFS_ROOT options NFSCL options NFSLOCKD options PROCFS options PSEUDOFS options SCHED_4BSD options SMP options SYSVMSG options SYSVSEM options SYSVSHM options WITNESS options WITNESS_SKIPSPIN device ata -options ATA_CAM device bpf device cfi device crypto device cryptodev device da device ds1553 device em device ether device fxp device iic device iicbus #device isa device loop device md device miibus device pass device pci device quicc device random #device rl device scbus device scc device sec device tsec device tun device uart options USB_DEBUG # enable debug msgs #device uhci device umass device usb device vlan Index: head/sys/sparc64/conf/GENERIC =================================================================== --- head/sys/sparc64/conf/GENERIC (revision 249082) +++ head/sys/sparc64/conf/GENERIC (revision 249083) @@ -1,248 +1,247 @@ # # GENERIC -- Generic kernel configuration file for FreeBSD/sparc64 # # For more information on this file, please read the config(5) manual page, # and/or 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. # # $FreeBSD$ cpu SUN4U ident GENERIC makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols # Platforms supported # At this time all platforms are supported, as-is. options SCHED_ULE # ULE scheduler options PREEMPTION # Enable kernel thread preemption options INET # InterNETworking options INET6 # IPv6 communications protocols options SCTP # Stream Control Transmission Protocol options FFS # Berkeley Fast Filesystem 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 QUOTA # Enable disk quotas for UFS options MD_ROOT # MD is a potential root device options NFSCL # New Network Filesystem Client options NFSD # New Network Filesystem Server options NFSLOCKD # Network Lock Manager options NFS_ROOT # NFS usable as /, requires NFSCL #options MSDOSFS # MSDOS Filesystem options CD9660 # ISO 9660 Filesystem options PROCFS # Process filesystem (requires PSEUDOFS) options PSEUDOFS # Pseudo-filesystem framework options GEOM_PART_GPT # GUID Partition Tables. options GEOM_LABEL # Provides labelization 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 options SYSVMSG # SYSV-style message queues options SYSVSEM # SYSV-style semaphores options _KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time extensions options PRINTF_BUFR_SIZE=128 # Prevent printf output being interspersed. options HWPMC_HOOKS # Necessary kernel hooks for hwpmc(4) options AUDIT # Security event auditing options CAPABILITY_MODE # Capsicum capability mode options CAPABILITIES # Capsicum capabilities options MAC # TrustedBSD MAC Framework options INCLUDE_CONFIG_FILE # Include this file in kernel # Debugging support. Always need this: options KDB # Enable kernel debugger support. # For minimum debugger support (stable branch) use: #options KDB_TRACE # Print a stack trace for a panic. # For full debugger support use this instead: options DDB # Support DDB. options GDB # Support remote GDB. options DEADLKRES # Enable the deadlock resolver options INVARIANTS # Enable calls of extra sanity checking options INVARIANT_SUPPORT # Extra sanity checks of internal structures, required by INVARIANTS options WITNESS # Enable checks to detect deadlocks and cycles options WITNESS_SKIPSPIN # Don't run witness on spinlocks for speed options MALLOC_DEBUG_MAXZONES=8 # Separate malloc(9) zones # Make an SMP-capable kernel by default options SMP # Symmetric MultiProcessor Kernel # Standard busses device ebus device isa device pci device sbus device central device fhc # Floppy drives #device fdc # ATA controllers device ahci # AHCI-compatible SATA controllers device ata # Legacy ATA/SATA controllers -options ATA_CAM # Handle legacy controllers with CAM device mvs # Marvell 88SX50XX/88SX60XX/88SX70XX/SoC SATA device siis # SiliconImage SiI3124/SiI3132/SiI3531 SATA # SCSI Controllers device ahc # AHA2940 and onboard AIC7xxx devices options AHC_ALLOW_MEMIO # Attempt to use memory mapped I/O options AHC_REG_PRETTY_PRINT # Print register bitfields in debug # output. Adds ~128k to driver. device esp # AMD Am53C974, Sun ESP and FAS families device isp # Qlogic family device ispfw # Firmware module for Qlogic host adapters device mpt # LSI-Logic MPT-Fusion device mps # LSI-Logic MPT-Fusion 2 device sym # NCR/Symbios/LSI Logic 53C8XX/53C1010/53C1510D # ATA/SCSI peripherals device scbus # SCSI bus (required for ATA/SCSI) device ch # SCSI media changers device da # Direct Access (disks) device sa # Sequential Access (tape etc) device cd # CD device pass # Passthrough device (direct ATA/SCSI access) device ses # Enclosure Services (SES and SAF-TE) device ctl # CAM Target Layer options CTL_DISABLE # Disable CTL by default to save memory. # Re-enable with kern.cam.ctl.disable=0 in # /boot/loader.conf # RAID controllers #device amr # AMI MegaRAID #device mlx # Mylex DAC960 family # 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 # syscons is the default console driver, resembling an SCO console device sc device creator # Creator, Creator3D and Elite3D framebuffers device machfb # ATI Mach64 framebuffers device splash # Splash screen and screen saver support options KBD_INSTALL_CDEV # install a CDEV entry in /dev # Builtin hardware device auxio # auxiliary I/O device device eeprom # eeprom (really a front-end for the MK48Txx) device mk48txx # Mostek MK48Txx clocks device rtc # rtc (really a front-end for the MC146818) device mc146818 # Motorola MC146818 and compatible clocks device epic # Sun Fire V215/V245 LEDs device sbbc # Sun BootBus controller (time-of-day clock for # Serengeti and StarCat, console for Serengeti, # requires device uart) # Serial (COM) ports device puc # Multi-channel uarts device scc # Serial communications controllers. device uart # Multi-uart driver # Parallel port #device ppc #device ppbus # Parallel port bus (required) #device lpt # Printer #device ppi # Parallel port interface device #device vpo # Requires scbus and da # PCI Ethernet NICs. #device de # DEC/Intel DC21x4x (``Tulip'') device em # Intel PRO/1000 adapter Gigabit Ethernet Card #device ixgb # Intel PRO/10GbE Ethernet Card device le # AMD Am7900 LANCE and Am79C9xx PCnet device ti # Alteon Networks Tigon I/II gigabit Ethernet device txp # 3Com 3cR990 (``Typhoon'') #device vx # 3Com 3c590, 3c595 (``Vortex'') # PCI Ethernet NICs that use the common MII bus controller code. # NOTE: Be sure to keep the 'device miibus' line in order to use these NICs! device miibus # MII bus support #device bfe # Broadcom BCM440x 10/100 Ethernet device bge # Broadcom BCM570xx Gigabit Ethernet device cas # Sun Cassini/Cassini+ and NS DP83065 Saturn device dc # DEC/Intel 21143 and various workalikes device fxp # Intel EtherExpress PRO/100B (82557, 82558) device gem # Sun GEM/Sun ERI/Apple GMAC device hme # Sun HME (Happy Meal Ethernet) device nge # NatSemi DP83820 gigabit Ethernet #device pcn # AMD Am79C97x PCI 10/100 (precedence over 'le') device re # RealTek 8139C+/8169/8169S/8110S device rl # RealTek 8129/8139 device sf # Adaptec AIC-6915 (``Starfire'') device sis # Silicon Integrated Systems SiS 900/SiS 7016 device sk # SysKonnect SK-984x & SK-982x gigabit Ethernet device ste # Sundance ST201 (D-Link DFE-550TX) device stge # Sundance/Tamarack TC9021 gigabit Ethernet #device tl # Texas Instruments ThunderLAN #device tx # SMC EtherPower II (83c170 ``EPIC'') device vr # VIA Rhine, Rhine II #device wb # Winbond W89C840F device xl # 3Com 3c90x (``Boomerang'', ``Cyclone'') # Wireless NIC cards device wlan # 802.11 support options IEEE80211_DEBUG # enable debug msgs options IEEE80211_AMPDU_AGE # age frames in AMPDU reorder q's options IEEE80211_SUPPORT_MESH # enable 802.11s D3.0 support device wlan_wep # 802.11 WEP support device wlan_ccmp # 802.11 CCMP support device wlan_tkip # 802.11 TKIP support device wlan_amrr # AMRR transmit rate control algorithm device ath # Atheros NICs device ath_pci # Atheros pci/cardbus glue device ath_hal # Atheros HAL (Hardware Access Layer) options AH_SUPPORT_AR5416 # enable AR5416 tx/rx descriptors device ath_rate_sample # SampleRate tx rate control for ath # Pseudo devices. device loop # Network loopback device random # Entropy device device ether # Ethernet support device vlan # 802.1Q VLAN support device tun # Packet tunnel. 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! # Note that 'bpf' is required for DHCP. device bpf # Berkeley packet filter # USB support options USB_DEBUG # enable debug msgs device uhci # UHCI PCI->USB interface device ohci # OHCI PCI->USB interface device ehci # EHCI PCI->USB interface (USB 2.0) device usb # USB Bus (required) device ukbd # Keyboard device umass # Disks/Mass storage - Requires scbus and da # Sound support device sound # Generic sound driver (required) device snd_audiocs # Crystal Semiconductor CS4231 device snd_es137x # Ensoniq AudioPCI ES137x device snd_t4dwave # Acer Labs M5451