diff --git a/build/jam/BuildFeatures b/build/jam/BuildFeatures index fa806de919..28d22f97ae 100644 --- a/build/jam/BuildFeatures +++ b/build/jam/BuildFeatures @@ -203,6 +203,118 @@ if $(HAIKU_BUILD_FEATURE_CLUCENE) { } +# LLVM +if $(TARGET_ARCH) = x86 { + if $(HAIKU_GCC_VERSION[1]) >= 4 { + HAIKU_LLVM_FILE = llvm-3.2-x86-gcc4-2012-12-21.zip ; + local zipFile = [ DownloadFile $(HAIKU_LLVM_FILE) + : $(baseURL)/$(HAIKU_LLVM_FILE) ] ; + + HAIKU_LLVM_DIR = [ FDirName $(HAIKU_OPTIONAL_BUILD_PACKAGES_DIR) + $(HAIKU_LLVM_FILE:B) ] ; + + HAIKU_LLVM_HEADERS_DEPENDENCY = [ ExtractArchive $(HAIKU_LLVM_DIR) + : common/include/ : $(zipFile) : extracted-llvm ] ; + HAIKU_LLVM_HEADERS = [ FDirName $(HAIKU_LLVM_DIR) common include ] ; + + # We can't Glob these because they aren't extracted yet. + HAIKU_LLVM_LIBS = [ ExtractArchive $(HAIKU_LLVM_DIR) + : + common/lib/libLLVMAsmParser.a + common/lib/libLLVMInstrumentation.a + common/lib/libLLVMLinker.a + common/lib/libLLVMArchive.a + common/lib/libLLVMBitReader.a + common/lib/libLLVMDebugInfo.a + common/lib/libLLVMJIT.a + common/lib/libLLVMipo.a + common/lib/libLLVMVectorize.a + common/lib/libLLVMBitWriter.a + common/lib/libLLVMTableGen.a + #common/lib/libLLVMHexagonCodeGen.a + #common/lib/libLLVMHexagonAsmPrinter.a + #common/lib/libLLVMHexagonDesc.a + #common/lib/libLLVMHexagonInfo.a + #common/lib/libLLVMNVPTXCodeGen.a + #common/lib/libLLVMNVPTXDesc.a + #common/lib/libLLVMNVPTXInfo.a + #common/lib/libLLVMNVPTXAsmPrinter.a + #common/lib/libLLVMMBlazeCodeGen.a + #common/lib/libLLVMMBlazeAsmParser.a + #common/lib/libLLVMMBlazeDisassembler.a + #common/lib/libLLVMMBlazeDesc.a + #common/lib/libLLVMMBlazeInfo.a + #common/lib/libLLVMMBlazeAsmPrinter.a + common/lib/libLLVMCppBackendCodeGen.a + common/lib/libLLVMCppBackendInfo.a + #common/lib/libLLVMMSP430CodeGen.a + #common/lib/libLLVMMSP430Desc.a + #common/lib/libLLVMMSP430AsmPrinter.a + #common/lib/libLLVMMSP430Info.a + #common/lib/libLLVMXCoreCodeGen.a + #common/lib/libLLVMXCoreDesc.a + #common/lib/libLLVMXCoreInfo.a + #common/lib/libLLVMCellSPUCodeGen.a + #common/lib/libLLVMCellSPUDesc.a + #common/lib/libLLVMCellSPUInfo.a + #common/lib/libLLVMMipsAsmParser.a + #common/lib/libLLVMMipsCodeGen.a + #common/lib/libLLVMMipsDesc.a + #common/lib/libLLVMMipsAsmPrinter.a + #common/lib/libLLVMMipsDisassembler.a + #common/lib/libLLVMMipsInfo.a + #common/lib/libLLVMARMAsmParser.a + #common/lib/libLLVMARMCodeGen.a + #common/lib/libLLVMARMDisassembler.a + #common/lib/libLLVMARMDesc.a + #common/lib/libLLVMARMInfo.a + #common/lib/libLLVMARMAsmPrinter.a + #common/lib/libLLVMPowerPCCodeGen.a + #common/lib/libLLVMPowerPCDesc.a + #common/lib/libLLVMPowerPCInfo.a + #common/lib/libLLVMPowerPCAsmPrinter.a + #common/lib/libLLVMSparcCodeGen.a + #common/lib/libLLVMSparcDesc.a + #common/lib/libLLVMSparcInfo.a + common/lib/libLLVMX86AsmParser.a + common/lib/libLLVMX86CodeGen.a + common/lib/libLLVMSelectionDAG.a + common/lib/libLLVMAsmPrinter.a + common/lib/libLLVMX86Disassembler.a + common/lib/libLLVMX86Desc.a + common/lib/libLLVMX86Info.a + common/lib/libLLVMX86AsmPrinter.a + common/lib/libLLVMX86Utils.a + common/lib/libLLVMMCDisassembler.a + common/lib/libLLVMMCParser.a + common/lib/libLLVMInterpreter.a + common/lib/libLLVMCodeGen.a + common/lib/libLLVMScalarOpts.a + common/lib/libLLVMInstCombine.a + common/lib/libLLVMTransformUtils.a + common/lib/libLLVMipa.a + common/lib/libLLVMAnalysis.a + common/lib/libLLVMMCJIT.a + common/lib/libLLVMRuntimeDyld.a + common/lib/libLLVMExecutionEngine.a + common/lib/libLLVMTarget.a + common/lib/libLLVMMC.a + common/lib/libLLVMObject.a + common/lib/libLLVMCore.a + common/lib/libLLVMSupport.a + : $(zipFile) : extracted-llvm ] + ; + + EnableBuildFeatures llvm ; + } else { + # Nor will it ever be + Echo "LLVM not available on GCC2" ; + } +} else { + Echo "LLVM not yet available on $(TARGET_ARCH)" ; +} + + # GLU (GL Utilities) if $(TARGET_ARCH) = x86 { if $(HAIKU_GCC_VERSION[1]) >= 4 { @@ -266,16 +378,21 @@ if $(TARGET_ARCH) = x86 { lib.haiku/libgallium.a : $(zipFile) : extracted-mesa ] ; - HAIKU_GALLIUM_SOFTPIPE_LIB = [ ExtractArchive $(HAIKU_MESA_DIR) - : - lib.haiku/libsoftpipe.a - : $(zipFile) - : extracted-mesa ] ; - HAIKU_GALLIUM_LLVMPIPE_LIB = [ ExtractArchive $(HAIKU_MESA_DIR) - : - lib.haiku/libllvmpipe.a - : $(zipFile) - : extracted-mesa ] ; + + if FIsBuildFeatureEnabled(llvm) { + HAIKU_GALLIUM_LLVMPIPE_LIB = [ ExtractArchive $(HAIKU_MESA_DIR) + : + lib.haiku/libllvmpipe.a + : $(zipFile) + : extracted-mesa ] ; + Depends $(HAIKU_GALLIUM_LLVMPIPE_LIB) : $(HAIKU_LLVM_LIBS) ; + } else { + HAIKU_GALLIUM_SOFTPIPE_LIB = [ ExtractArchive $(HAIKU_MESA_DIR) + : + lib.haiku/libsoftpipe.a + : $(zipFile) + : extracted-mesa ] ; + } HAIKU_MESA_HEADERS = [ FDirName $(HAIKU_MESA_DIR) include ] ; diff --git a/build/jam/Haiku64Image b/build/jam/Haiku64Image index cc6224c8cc..916e08052e 100644 --- a/build/jam/Haiku64Image +++ b/build/jam/Haiku64Image @@ -6,36 +6,39 @@ # easily add things to the image as I port them. -SYSTEM_BIN = "[" addattr base64 basename bash beep cal cat catattr checkfs - chgrp chmod chown chroot cksum clear clockconfig cmp collectcatkeys comm - compress copyattr cp csplit cut date dd diff diff3 dircolors dirname df du - dumpcatalog echo eject env error expand expr factor false find finddir - fmt fold fortune ftp gawk gdb gzip gzexe getlimits groups head hostname - id ifconfig install isvolume join kernel_debugger kill less lessecho - lesskey link linkcatkeys listdev ln locale locate logger logname ls - makebootable md5sum mimeset mkdir mkfifo mkfs mktemp mount mountvolume - mv nl nohup notify nproc od open paste patch pathchk ping pr printenv printf - ps ptx pwd query rc readlink ReadOnlyBootPrompt rm rmattr rmdir safemode - sdiff seq sha1sum shred shuf shutdown sleep sort split stat strace stty su sum sync - sysinfo tac tail tee test timeout touch tr true truncate tsort tty unexpand - uname uniq unlink unmount unzip updatedb waitfor wc wget whoami xargs - xres yes zdiff zforce zgrep zip zipcloak zipgrep zipnote zipsplit - zmore znew +SYSTEM_BIN = "[" addattr alert arp base64 basename bash bc beep cal cat catattr + checkfs chgrp chmod chown chroot cksum clear clockconfig cmp + collectcatkeys comm compress copyattr CortexAddOnHost cp csplit cut date + dd diff diff3 dircolors dirname df du dumpcatalog echo eject env error + expand expr factor false find finddir fmt fold fortune ftp gawk gdb gzip + gzexe getlimits groups head hostname id ifconfig install isvolume + join kernel_debugger kill less lessecho lesskey link linkcatkeys listdev + ln locale locate logger logname ls makebootable md5sum mimeset mkdir + mkfifo mkfs mktemp mount mountvolume mv nl nohup notify nproc od open + paste patch pathchk ping pr printenv printf ps ptx pwd query rc readlink + ReadOnlyBootPrompt rm rmattr rmdir safemode sdiff seq sha1sum shred shuf + shutdown sleep sort split stat strace stty su sum sync sysinfo tac tail + tee test timeout touch tr true truncate tsort tty unexpand uname uniq + unlink unmount unzip updatedb waitfor wc wget whoami xargs xres yes + zdiff zforce zgrep zip zipcloak zipgrep zipnote zipsplit zmore znew ; -SYSTEM_APPS = AboutSystem ActivityMonitor Debugger DriveSetup Installer - NetworkStatus ProcessController StyledEdit Terminal +SYSTEM_APPS = AboutSystem ActivityMonitor CDPlayer CharacterMap Debugger DeskCalc + Devices DiskUsage DriveSetup Expander Installer LaunchBox MediaConverter + NetworkStatus PoorMan Pulse ProcessController Screenshot ShowImage + SoundRecorder StyledEdit Terminal TV Workspaces ; -SYSTEM_PREFERENCES = Appearance Backgrounds Deskbar FileTypes - Keyboard Keymap Locale Mouse Network Notifications Screen Time Touchpad - Tracker VirtualMemory +SYSTEM_PREFERENCES = Appearance Backgrounds DataTranslations Deskbar + FileTypes Keyboard Keymap Locale Media Mouse Network Notifications + Printers Screen ScreenSaver Time Touchpad Tracker + VirtualMemory ; -SYSTEM_DEMOS = Sudoku ; +SYSTEM_DEMOS = BSnow Cortex FontDemo OverlayImage Pairs Sudoku ; -SYSTEM_LIBS = libbe.so libbsd.so libbnetapi.so libdebug.so libmedia.so - libnetwork.so libroot.so libroot-addon-icu.so +SYSTEM_LIBS = libbe.so libbsd.so libbnetapi.so libgame.so libdebug.so libmedia.so + libmidi2.so libnetwork.so libroot.so libroot-addon-icu.so libtextencoding.so libtiff.so libtracker.so libtranslation.so $(HAIKU_SHARED_LIBSTDC++) $(HAIKU_SHARED_LIBSUPC++) ; @@ -48,8 +51,9 @@ PRIVATE_SYSTEM_LIBS = libilmimf.so ; -SYSTEM_SERVERS = app_server debug_server input_server mount_server - net_server notification_server registrar syslog_daemon +SYSTEM_SERVERS = app_server cddb_daemon debug_server input_server midi_server + mount_server net_server notification_server power_daemon print_server + print_addon_server registrar syslog_daemon ; SYSTEM_NETWORK_DEVICES = ethernet loopback ; @@ -65,6 +69,17 @@ SYSTEM_ADD_ONS_TRANSLATORS = BMPTranslator EXRTranslator GIFTranslator TIFFTranslator WebPTranslator WonderBrushTranslator ; +SYSTEM_ADD_ONS_PRINT = + Canon\ LIPS3\ Compatible + Canon\ LIPS4\ Compatible + Gutenprint + PCL5\ Compatible + PCL6\ Compatible + PDF\ Writer + PS\ Compatible + +; + SYSTEM_ADD_ONS_DRIVERS_GRAPHICS = vesa ; SYSTEM_ADD_ONS_DRIVERS_NET = 3com atheros813x ar81xx attansic_l1 attansic_l2 broadcom440x broadcom570x dec21xxx etherpci ipro100 ipro1000 jmicron2x0 @@ -519,6 +534,7 @@ AddTargetVariableToScript $(script) : rc ; AddTargetVariableToScript $(script) : resattr ; AddTargetVariableToScript $(script) : unzip ; AddTargetVariableToScript $(script) : vmdkimage ; +AddTargetVariableToScript $(script) : $(HAIKU_STRIP) : stripCommand ; if $(HOST_RM_ATTRS_TARGET) { AddTargetVariableToScript $(script) : $(HOST_RM_ATTRS_TARGET) : rmAttrs ; } else { diff --git a/build/jam/HaikuCD b/build/jam/HaikuCD index d77e752d90..e474296282 100644 --- a/build/jam/HaikuCD +++ b/build/jam/HaikuCD @@ -34,6 +34,7 @@ AddTargetVariableToScript $(script) : rc ; AddTargetVariableToScript $(script) : resattr ; AddTargetVariableToScript $(script) : unzip ; AddTargetVariableToScript $(script) : generate_attribute_stores ; +AddTargetVariableToScript $(script) : $(HAIKU_STRIP) : stripCommand ; if $(HOST_RM_ATTRS_TARGET) { AddTargetVariableToScript $(script) : $(HOST_RM_ATTRS_TARGET) : rmAttrs ; } else { diff --git a/build/jam/HaikuImage b/build/jam/HaikuImage index fb77abdbe6..9aab5280cc 100644 --- a/build/jam/HaikuImage +++ b/build/jam/HaikuImage @@ -170,7 +170,7 @@ SYSTEM_ADD_ONS_DRIVERS_NET = [ FFilterByBuildFeatures aironetwifi atheroswifi broadcom43xx iprowifi2100 iprowifi2200 iprowifi3945 iprowifi4965 marvell88w8363 marvell88w8335 - ralink2860 ralinkwifi wavelanwifi + ralinkwifi wavelanwifi }@ # x86 # WWAN drivers @@ -751,10 +751,12 @@ CopyDirectoryToHaikuImage develop sample-code : [ FDirName $(HAIKU_TOP) src libs pdflib bind pdflib ] : pdflib ; -# Copy Mesa3D GL headers into image +# Copy OpenGL kit headers into image if $(TARGET_ARCH) = x86 { CopyDirectoryToHaikuImage develop headers os opengl : [ FDirName $(HAIKU_MESA_HEADERS) GL ] ; + CopyDirectoryToHaikuImage develop headers os opengl + : [ FDirName $(HAIKU_GLU_HEADERS) GL ] ; } #pragma mark - Optional Packages @@ -911,6 +913,7 @@ AddTargetVariableToScript $(script) : rc ; AddTargetVariableToScript $(script) : resattr ; AddTargetVariableToScript $(script) : unzip ; AddTargetVariableToScript $(script) : vmdkimage ; +AddTargetVariableToScript $(script) : $(HAIKU_STRIP) : stripCommand ; if $(HOST_RM_ATTRS_TARGET) { AddTargetVariableToScript $(script) : $(HOST_RM_ATTRS_TARGET) : rmAttrs ; } else { diff --git a/build/jam/OptionalPackageDependencies b/build/jam/OptionalPackageDependencies index a03fbf19c5..84d12ca66e 100644 --- a/build/jam/OptionalPackageDependencies +++ b/build/jam/OptionalPackageDependencies @@ -1,7 +1,7 @@ # package dependencies # -# For transitive dependencies dependants should be listed before their +# For transitive dependencies dependents should be listed before their # dependencies. OptionalPackageDependencies APR-util : APR Expat ; @@ -31,7 +31,7 @@ OptionalPackageDependencies NetFS : UserlandFS ; OptionalPackageDependencies NetSurf : OpenSSL Curl LibXML2 LibIconv Libmng ; OptionalPackageDependencies OpenSSH : OpenSSL ; OptionalPackageDependencies OpenSSL : CARootCertificates ; -OptionalPackageDependencies Paladin : CCache Fastdep ; +OptionalPackageDependencies Paladin : CCache Fastdep PCRE ; OptionalPackageDependencies Pe : PCRE ; OptionalPackageDependencies SDLLibs : XiphLibs libmad libmikmod Libmng libmodplug physfs ; OptionalPackageDependencies Subversion : APR-util Neon LibIconv LibXML2 OpenSSL SQLite ; diff --git a/build/jam/OptionalPackages b/build/jam/OptionalPackages index 59bcdc68db..39525947e4 100644 --- a/build/jam/OptionalPackages +++ b/build/jam/OptionalPackages @@ -297,8 +297,8 @@ if [ IsOptionalHaikuImagePackageAdded BePDF ] { : $(baseURL)/bepdf-1.1.1b4-x86-gcc4-2012-08-11.zip ; } else { InstallOptionalHaikuImagePackage - bepdf-1.1.1b4-r1a4-x86-gcc2-2012-08-30.zip - : $(baseURL)/bepdf-1.1.1b4-r1a4-x86-gcc2-2012-08-30.zip ; + bepdf-1.1.1b4-r1a4-x86-gcc2-2013-01-02.zip + : $(baseURL)/bepdf-1.1.1b4-r1a4-x86-gcc2-2013-01-02.zip ; } AddSymlinkToHaikuImage home config settings deskbar Applications : /boot/apps/BePDF/BePDF ; @@ -2282,8 +2282,8 @@ if [ IsOptionalHaikuImagePackageAdded WonderBrush ] { } else if $(HAIKU_GCC_VERSION[1]) >= 4 && ! $(isHybridBuild) { Echo "No optional package WonderBrush available for gcc4" ; } else { - InstallOptionalHaikuImagePackage WonderBrush-2.1.2.zip - : $(baseURL)/WonderBrush-2.1.2-x86-gcc2-2008-11-08.zip + InstallOptionalHaikuImagePackage WonderBrush-2.1.2-a.zip + : $(baseURL)/WonderBrush-2.1.2-x86-gcc2-2013-01-02.zip : apps ; AddSymlinkToHaikuImage home config settings deskbar Applications : /boot/apps/WonderBrush/WonderBrush ; diff --git a/build/scripts/build_haiku_image b/build/scripts/build_haiku_image index 155e5f6876..6be56b580f 100755 --- a/build/scripts/build_haiku_image +++ b/build/scripts/build_haiku_image @@ -31,6 +31,7 @@ set -o errexit # The following is only for cd types: # generate_attribute_stores # isCD +# stripCommand # if [ $# -gt 0 ]; then . $1 @@ -151,7 +152,7 @@ stripDebugInfo() if [ "$elfMarker" = 'ELF' ]; then # make user-writable first -- some files aren't chmod u+w "$file" - strip --strip-debug "$file" + "$stripCommand" --strip-debug "$file" fi } diff --git a/build/scripts/determine_haiku_revision b/build/scripts/determine_haiku_revision index f10e791860..012c09008a 100644 --- a/build/scripts/determine_haiku_revision +++ b/build/scripts/determine_haiku_revision @@ -8,7 +8,7 @@ determineGitRevision() revision=`cat ${haikuBuildOutputDir}/haiku-revision 2>/dev/null` lastBuiltRevision=`cat ${haikuBuildOutputDir}/last-built-revision \ 2>/dev/null` - localRev=`git rev-list -n1 HEAD` + localRev=`git rev-parse HEAD` # only determine the haiku-revision if anything has changed from # last build @@ -16,7 +16,10 @@ determineGitRevision() # the revision we use is the description of HEAD with respect to the # last reachable hrev-(haiku-revision-)tag revision=`git describe --dirty --tags --match=hrev*` - if echo "$revision" | grep -- '-' >/dev/null; then + if [ -z "$revision" ]; then + # failed to find any hrev tags, use short hash instead + revision=`git rev-parse --short HEAD` + elif echo "$revision" | grep -- '-' >/dev/null; then # HEAD is not directly a changeset from Haiku's central repo, so we # add the current branch name as additional info branchName=`git branch | grep '*' | cut -b 3-` @@ -59,7 +62,7 @@ determineHaikuRevision() grep --max-count=1 "(svn r" | $SED -n -e 's,(svn r\(.*\)).*,\1,p'` fi - if [ "$revision" = "" ]; then + if [ -z "$revision" ]; then revision=0 fi echo $revision >${haikuBuildOutputDir}/haiku-revision diff --git a/configure b/configure index f0df8ebabf..1edc558802 100755 --- a/configure +++ b/configure @@ -90,6 +90,7 @@ environment variables: HAIKU_OBJCOPY The objcopy to be used. Defaults to "objcopy". HAIKU_RANLIB The static library indexer. Defaults to "ranlib". HAIKU_YASM The yasm assembler (x86 only). + HAIKU_STRIP The strip command. Defaults to "strip". HAIKU_CPPFLAGS The preprocessor flags. Defaults to "". HAIKU_CCFLAGS The C flags. Defaults to "". HAIKU_CXXFLAGS The C++ flags. Defaults to "". @@ -364,6 +365,7 @@ set_default_value HAIKU_OBJCOPY objcopy set_default_value HAIKU_RANLIB ranlib set_default_value HAIKU_ELFEDIT elfedit set_default_value HAIKU_YASM yasm +set_default_value HAIKU_STRIP strip set_default_value HAIKU_CPPFLAGS "" set_default_value HAIKU_CCFLAGS "" set_default_value HAIKU_CXXFLAGS "" @@ -529,6 +531,7 @@ if [ -n "$crossToolsPrefix" ]; then get_build_tool_path LD ld get_build_tool_path OBJCOPY objcopy get_build_tool_path RANLIB ranlib + get_build_tool_path STRIP strip fi # prepare gcc settings @@ -602,6 +605,7 @@ HAIKU_OBJCOPY ?= ${HAIKU_OBJCOPY} ; HAIKU_RANLIB ?= ${HAIKU_RANLIB} ; HAIKU_ELFEDIT ?= ${HAIKU_ELFEDIT} ; HAIKU_YASM ?= ${HAIKU_YASM} ; +HAIKU_STRIP ?= ${HAIKU_STRIP} ; HAIKU_CPPFLAGS ?= ${HAIKU_CPPFLAGS} ; HAIKU_CCFLAGS ?= ${HAIKU_CCFLAGS} ; HAIKU_C++FLAGS ?= ${HAIKU_CXXFLAGS} ; diff --git a/data/artwork/icons/File_Archive_XAR b/data/artwork/icons/File_Archive_XAR new file mode 100644 index 0000000000..dce147a7aa Binary files /dev/null and b/data/artwork/icons/File_Archive_XAR differ diff --git a/data/catalogs/add-ons/media/media-add-ons/mixer/hu.catkeys b/data/catalogs/add-ons/media/media-add-ons/mixer/hu.catkeys index 9fd6a9dd1e..fad7110362 100644 --- a/data/catalogs/add-ons/media/media-add-ons/mixer/hu.catkeys +++ b/data/catalogs/add-ons/media/media-add-ons/mixer/hu.catkeys @@ -16,10 +16,10 @@ Output channel sources AudioMixer Kimeneti csatorna forrásai dB AudioMixer dB Gain controls AudioMixer Előerősítés beállításai Input mapping AudioMixer Bemenet leképezése -Mute AudioMixer Elnémítás +Mute AudioMixer Némítás Input channel destinations AudioMixer Bemeneti csatornák céljai -To master AudioMixer Masterre -Master output AudioMixer Master kimenet +To master AudioMixer Az elsődlegesre +Master output AudioMixer Elsődleges kimenet Setup AudioMixer Beállítás Use non linear gain sliders (like BeOS R5) AudioMixer Nem lineáris előerősítés csúszkák használata (mint a BeOS R5-ben) Gain AudioMixer Előerősítés diff --git a/data/catalogs/add-ons/screen_savers/flurry/be.catkeys b/data/catalogs/add-ons/screen_savers/flurry/be.catkeys index 9154517aab..2bde216be3 100644 --- a/data/catalogs/add-ons/screen_savers/flurry/be.catkeys +++ b/data/catalogs/add-ons/screen_savers/flurry/be.catkeys @@ -1,2 +1,2 @@ -1 belarusian x-vnd.Haiku-Flurry 3686556109 +1 belarusian x-vnd.Haiku-FlurryScreensaver 3686556109 Flurry System name Бура diff --git a/data/catalogs/add-ons/screen_savers/flurry/de.catkeys b/data/catalogs/add-ons/screen_savers/flurry/de.catkeys index 593d0075d5..0ff5a498df 100644 --- a/data/catalogs/add-ons/screen_savers/flurry/de.catkeys +++ b/data/catalogs/add-ons/screen_savers/flurry/de.catkeys @@ -1,2 +1,2 @@ -1 german x-vnd.Haiku-Flurry 3686556109 +1 german x-vnd.Haiku-FlurryScreensaver 3686556109 Flurry System name Flurry diff --git a/data/catalogs/add-ons/screen_savers/flurry/el.catkeys b/data/catalogs/add-ons/screen_savers/flurry/el.catkeys index 3c78b636c9..962212a0e9 100644 --- a/data/catalogs/add-ons/screen_savers/flurry/el.catkeys +++ b/data/catalogs/add-ons/screen_savers/flurry/el.catkeys @@ -1,2 +1,2 @@ -1 greek, modern (1453-) x-vnd.Haiku-Flurry 3686556109 +1 greek, modern (1453-) x-vnd.Haiku-FlurryScreensaver 3686556109 Flurry System name Flurry diff --git a/data/catalogs/add-ons/screen_savers/flurry/fi.catkeys b/data/catalogs/add-ons/screen_savers/flurry/fi.catkeys index 937c6ddb02..297938496b 100644 --- a/data/catalogs/add-ons/screen_savers/flurry/fi.catkeys +++ b/data/catalogs/add-ons/screen_savers/flurry/fi.catkeys @@ -1,2 +1,2 @@ -1 finnish x-vnd.Haiku-Flurry 3686556109 +1 finnish x-vnd.Haiku-FlurryScreensaver 3686556109 Flurry System name Hullunmylly diff --git a/data/catalogs/add-ons/screen_savers/flurry/fr.catkeys b/data/catalogs/add-ons/screen_savers/flurry/fr.catkeys index 995d547059..e7bcb6cf35 100644 --- a/data/catalogs/add-ons/screen_savers/flurry/fr.catkeys +++ b/data/catalogs/add-ons/screen_savers/flurry/fr.catkeys @@ -1,2 +1,2 @@ -1 french x-vnd.Haiku-Flurry 3686556109 +1 french x-vnd.Haiku-FlurryScreensaver 3686556109 Flurry System name Flurry diff --git a/data/catalogs/add-ons/screen_savers/flurry/hi.catkeys b/data/catalogs/add-ons/screen_savers/flurry/hi.catkeys index c407874eef..774ac21a40 100644 --- a/data/catalogs/add-ons/screen_savers/flurry/hi.catkeys +++ b/data/catalogs/add-ons/screen_savers/flurry/hi.catkeys @@ -1,2 +1,2 @@ -1 hindi x-vnd.Haiku-Flurry 3686556109 +1 hindi x-vnd.Haiku-FlurryScreensaver 3686556109 Flurry System name फ्लार्री diff --git a/data/catalogs/add-ons/screen_savers/flurry/hu.catkeys b/data/catalogs/add-ons/screen_savers/flurry/hu.catkeys index 50a2e9a053..ca81694893 100644 --- a/data/catalogs/add-ons/screen_savers/flurry/hu.catkeys +++ b/data/catalogs/add-ons/screen_savers/flurry/hu.catkeys @@ -1,2 +1,2 @@ -1 hungarian x-vnd.Haiku-Flurry 3686556109 +1 hungarian x-vnd.Haiku-FlurryScreensaver 3686556109 Flurry System name Fénycsóva diff --git a/data/catalogs/add-ons/screen_savers/flurry/ja.catkeys b/data/catalogs/add-ons/screen_savers/flurry/ja.catkeys index 62a64b6c75..af0d816c27 100644 --- a/data/catalogs/add-ons/screen_savers/flurry/ja.catkeys +++ b/data/catalogs/add-ons/screen_savers/flurry/ja.catkeys @@ -1,2 +1,2 @@ -1 japanese x-vnd.Haiku-Flurry 3686556109 +1 japanese x-vnd.Haiku-FlurryScreensaver 3686556109 Flurry System name Flurry diff --git a/data/catalogs/add-ons/screen_savers/flurry/lt.catkeys b/data/catalogs/add-ons/screen_savers/flurry/lt.catkeys index f6a1f1840c..9480145b90 100644 --- a/data/catalogs/add-ons/screen_savers/flurry/lt.catkeys +++ b/data/catalogs/add-ons/screen_savers/flurry/lt.catkeys @@ -1,2 +1,2 @@ -1 lithuanian x-vnd.Haiku-Flurry 3686556109 +1 lithuanian x-vnd.Haiku-FlurryScreensaver 3686556109 Flurry System name Sąmyšis diff --git a/data/catalogs/add-ons/screen_savers/flurry/nl.catkeys b/data/catalogs/add-ons/screen_savers/flurry/nl.catkeys index f25633da6d..433c48767c 100644 --- a/data/catalogs/add-ons/screen_savers/flurry/nl.catkeys +++ b/data/catalogs/add-ons/screen_savers/flurry/nl.catkeys @@ -1,2 +1,2 @@ -1 dutch; flemish x-vnd.Haiku-Flurry 3686556109 +1 dutch; flemish x-vnd.Haiku-FlurryScreensaver 3686556109 Flurry System name Flurry diff --git a/data/catalogs/add-ons/screen_savers/flurry/pl.catkeys b/data/catalogs/add-ons/screen_savers/flurry/pl.catkeys index c3fded6533..9a75c380cf 100644 --- a/data/catalogs/add-ons/screen_savers/flurry/pl.catkeys +++ b/data/catalogs/add-ons/screen_savers/flurry/pl.catkeys @@ -1,2 +1,2 @@ -1 polish x-vnd.Haiku-Flurry 3686556109 +1 polish x-vnd.Haiku-FlurryScreensaver 3686556109 Flurry System name Nawałnica diff --git a/data/catalogs/add-ons/screen_savers/flurry/pt_BR.catkeys b/data/catalogs/add-ons/screen_savers/flurry/pt_BR.catkeys index f77b318911..d4b797cbaa 100644 --- a/data/catalogs/add-ons/screen_savers/flurry/pt_BR.catkeys +++ b/data/catalogs/add-ons/screen_savers/flurry/pt_BR.catkeys @@ -1,2 +1,2 @@ -1 portuguese (brazil) x-vnd.Haiku-Flurry 3686556109 +1 portuguese (brazil) x-vnd.Haiku-FlurryScreensaver 3686556109 Flurry System name Flurry diff --git a/data/catalogs/add-ons/screen_savers/flurry/ro.catkeys b/data/catalogs/add-ons/screen_savers/flurry/ro.catkeys index 956d8ee222..85b782020f 100644 --- a/data/catalogs/add-ons/screen_savers/flurry/ro.catkeys +++ b/data/catalogs/add-ons/screen_savers/flurry/ro.catkeys @@ -1,2 +1,2 @@ -1 romanian x-vnd.Haiku-Flurry 3686556109 +1 romanian x-vnd.Haiku-FlurryScreensaver 3686556109 Flurry System name Agitație diff --git a/data/catalogs/add-ons/screen_savers/flurry/ru.catkeys b/data/catalogs/add-ons/screen_savers/flurry/ru.catkeys index 26115c6326..37c95c453e 100644 --- a/data/catalogs/add-ons/screen_savers/flurry/ru.catkeys +++ b/data/catalogs/add-ons/screen_savers/flurry/ru.catkeys @@ -1,2 +1,2 @@ -1 russian x-vnd.Haiku-Flurry 3686556109 +1 russian x-vnd.Haiku-FlurryScreensaver 3686556109 Flurry System name Волнение diff --git a/data/catalogs/add-ons/screen_savers/flurry/sk.catkeys b/data/catalogs/add-ons/screen_savers/flurry/sk.catkeys index 843940d06d..c052cdb451 100644 --- a/data/catalogs/add-ons/screen_savers/flurry/sk.catkeys +++ b/data/catalogs/add-ons/screen_savers/flurry/sk.catkeys @@ -1,2 +1,2 @@ -1 slovak x-vnd.Haiku-Flurry 3686556109 +1 slovak x-vnd.Haiku-FlurryScreensaver 3686556109 Flurry System name Flurry diff --git a/data/catalogs/add-ons/screen_savers/flurry/sv.catkeys b/data/catalogs/add-ons/screen_savers/flurry/sv.catkeys index e302705ae4..aad380489b 100644 --- a/data/catalogs/add-ons/screen_savers/flurry/sv.catkeys +++ b/data/catalogs/add-ons/screen_savers/flurry/sv.catkeys @@ -1,2 +1,2 @@ -1 swedish x-vnd.Haiku-Flurry 3686556109 +1 swedish x-vnd.Haiku-FlurryScreensaver 3686556109 Flurry System name Flurry diff --git a/data/catalogs/add-ons/screen_savers/flurry/uk.catkeys b/data/catalogs/add-ons/screen_savers/flurry/uk.catkeys index 42d48aacd2..56761168cb 100644 --- a/data/catalogs/add-ons/screen_savers/flurry/uk.catkeys +++ b/data/catalogs/add-ons/screen_savers/flurry/uk.catkeys @@ -1,2 +1,2 @@ -1 ukrainian x-vnd.Haiku-Flurry 3686556109 +1 ukrainian x-vnd.Haiku-FlurryScreensaver 3686556109 Flurry System name Flurry diff --git a/data/catalogs/add-ons/screen_savers/flurry/zh_Hans.catkeys b/data/catalogs/add-ons/screen_savers/flurry/zh_Hans.catkeys index 268a0949f1..9c8e662789 100644 --- a/data/catalogs/add-ons/screen_savers/flurry/zh_Hans.catkeys +++ b/data/catalogs/add-ons/screen_savers/flurry/zh_Hans.catkeys @@ -1,2 +1,2 @@ -1 english x-vnd.Haiku-Flurry 3686556109 +1 english x-vnd.Haiku-FlurryScreensaver 3686556109 Flurry System name 飘雪 diff --git a/data/catalogs/add-ons/translators/icns/be.catkeys b/data/catalogs/add-ons/translators/icns/be.catkeys new file mode 100644 index 0000000000..2291439efd --- /dev/null +++ b/data/catalogs/add-ons/translators/icns/be.catkeys @@ -0,0 +1,5 @@ +1 belarusian x-vnd.Haiku-ICNSTranslator 2416672857 +Version %d.%d.%d, %s ICNSConfig Версія %d.%d.%d, %s +Apple icons ICNSTranslator Значкі Apple +Apple icon translator ICNSTranslator Канвертар значкаў Apple +Apple icon translator ICNSConfig Канвертар значкаў Apple diff --git a/data/catalogs/add-ons/translators/icns/de.catkeys b/data/catalogs/add-ons/translators/icns/de.catkeys new file mode 100644 index 0000000000..a7537ac6a4 --- /dev/null +++ b/data/catalogs/add-ons/translators/icns/de.catkeys @@ -0,0 +1,5 @@ +1 german x-vnd.Haiku-ICNSTranslator 2416672857 +Version %d.%d.%d, %s ICNSConfig Version %d.%d.%d, %s +Apple icons ICNSTranslator Apple Icons +Apple icon translator ICNSTranslator Apple Icon-Translator +Apple icon translator ICNSConfig Apple Icon-Translator diff --git a/data/catalogs/add-ons/translators/icns/fr.catkeys b/data/catalogs/add-ons/translators/icns/fr.catkeys new file mode 100644 index 0000000000..ce928777b3 --- /dev/null +++ b/data/catalogs/add-ons/translators/icns/fr.catkeys @@ -0,0 +1,5 @@ +1 french x-vnd.Haiku-ICNSTranslator 2416672857 +Version %d.%d.%d, %s ICNSConfig Version %d.%d.%d, %s +Apple icons ICNSTranslator Icônes Apple +Apple icon translator ICNSTranslator Traducteur d'icône Apple +Apple icon translator ICNSConfig Traducteur d'icône Apple diff --git a/data/catalogs/add-ons/translators/icns/hu.catkeys b/data/catalogs/add-ons/translators/icns/hu.catkeys new file mode 100644 index 0000000000..7f5b4fdaaf --- /dev/null +++ b/data/catalogs/add-ons/translators/icns/hu.catkeys @@ -0,0 +1,5 @@ +1 hungarian x-vnd.Haiku-ICNSTranslator 2416672857 +Version %d.%d.%d, %s ICNSConfig Verzió: %d.%d.%d, %s +Apple icons ICNSTranslator Apple ikon +Apple icon translator ICNSTranslator Apple ikon értelmező +Apple icon translator ICNSConfig Apple ikon értelmező diff --git a/data/catalogs/add-ons/translators/icns/ja.catkeys b/data/catalogs/add-ons/translators/icns/ja.catkeys new file mode 100644 index 0000000000..c2027d62d8 --- /dev/null +++ b/data/catalogs/add-ons/translators/icns/ja.catkeys @@ -0,0 +1,5 @@ +1 japanese x-vnd.Haiku-ICNSTranslator 2416672857 +Version %d.%d.%d, %s ICNSConfig バージョン %d.%d.%d, %s +Apple icons ICNSTranslator アップルアイコン +Apple icon translator ICNSTranslator アップルアイコントランスレーター +Apple icon translator ICNSConfig アップルアイコントランスレーター diff --git a/data/catalogs/add-ons/translators/icns/pl.catkeys b/data/catalogs/add-ons/translators/icns/pl.catkeys new file mode 100644 index 0000000000..f4c9924c5f --- /dev/null +++ b/data/catalogs/add-ons/translators/icns/pl.catkeys @@ -0,0 +1,2 @@ +1 polish x-vnd.Haiku-ICNSTranslator 2751404179 +Version %d.%d.%d, %s ICNSConfig Wersja %d.%d.%d, %s diff --git a/data/catalogs/add-ons/translators/icns/pt_BR.catkeys b/data/catalogs/add-ons/translators/icns/pt_BR.catkeys new file mode 100644 index 0000000000..e1ae23ec18 --- /dev/null +++ b/data/catalogs/add-ons/translators/icns/pt_BR.catkeys @@ -0,0 +1,5 @@ +1 portuguese (brazil) x-vnd.Haiku-ICNSTranslator 2416672857 +Version %d.%d.%d, %s ICNSConfig Versão %d.%d.%d, %s +Apple icons ICNSTranslator Ícones da Apple +Apple icon translator ICNSTranslator Tradutor de ícone da Apple +Apple icon translator ICNSConfig Tradutor de ícone da Apple diff --git a/data/catalogs/add-ons/translators/icns/ru.catkeys b/data/catalogs/add-ons/translators/icns/ru.catkeys new file mode 100644 index 0000000000..d55d34510a --- /dev/null +++ b/data/catalogs/add-ons/translators/icns/ru.catkeys @@ -0,0 +1,5 @@ +1 russian x-vnd.Haiku-ICNSTranslator 2416672857 +Version %d.%d.%d, %s ICNSConfig Версия %d.%d.%d, %s +Apple icons ICNSTranslator Apple значки +Apple icon translator ICNSTranslator Транслятор значков Apple +Apple icon translator ICNSConfig Транслятор значков Apple diff --git a/data/catalogs/add-ons/translators/icns/zh_Hans.catkeys b/data/catalogs/add-ons/translators/icns/zh_Hans.catkeys new file mode 100644 index 0000000000..56f77cac85 --- /dev/null +++ b/data/catalogs/add-ons/translators/icns/zh_Hans.catkeys @@ -0,0 +1,5 @@ +1 english x-vnd.Haiku-ICNSTranslator 2416672857 +Version %d.%d.%d, %s ICNSConfig 版本 %d.%d.%d, %s +Apple icons ICNSTranslator Apple 图标 +Apple icon translator ICNSTranslator Apple 图标转换器 +Apple icon translator ICNSConfig Apple 图标转换器 diff --git a/data/catalogs/apps/aboutsystem/lt.catkeys b/data/catalogs/apps/aboutsystem/lt.catkeys index 45b67eb8df..2978c475dd 100644 --- a/data/catalogs/apps/aboutsystem/lt.catkeys +++ b/data/catalogs/apps/aboutsystem/lt.catkeys @@ -1,4 +1,4 @@ -1 lithuanian x-vnd.Haiku-About 3952543106 +1 lithuanian x-vnd.Haiku-About 2547069165 Copyright © 1999-2010 by the authors of Gutenprint. All rights reserved. AboutView © 1999-2010 „Gutenprint“ autoriai. Visos teisės saugomos. Travis Geiselbrecht (and his NewOS kernel)\n AboutView Travis'ui Geiselbrecht'ui (už „NewOS“ branduolį)\n BSD (4-clause) AboutView BSD (4 punktų) @@ -42,6 +42,7 @@ Copyright © 2006-2012 Kentaro Fukuchi AboutView © 2006-2012 Kentaro Fukuchi Copyright © 1994-2009, Thomas G. Lane, Guido Vollbeding. This software is based in part on the work of the Independent JPEG Group. AboutView © 1994-2009, Thomas G. Lane, Guido Vollbeding. Ši programinė įranga iš dalies pagrįsta „Independent JPEG Group“ darbu. Past maintainers:\n AboutView Ankstesni vystytojai:\n \n\nSpecial thanks to:\n AboutView \n\nYpatingos padėkos:\n +\n…and probably some more we forgot to mention (sorry!)\n\n AboutView \n…ir galbūt dar kažkas, ką pamiršome paminėti (atleiskite!)\n\n Licenses: AboutView Licencijos: Copyright © 1995-2004 Jean-loup Gailly and Mark Adler. AboutView © 1995-2004 Jean-loup Gailly ir Mark Adler. Copyright © 2002-2003 Steve Lhomme. All rights reserved. AboutView © 2002-2003 Steve Lhomme. Visos teisės saugomos. @@ -53,6 +54,7 @@ The code that is unique to Haiku, especially the kernel and all code that applic Time running: AboutView Veikimo laikas: Contains software developed by the NetBSD Foundation, Inc. and its contributors:\nftp, tput\nCopyright © 1996-2008 The NetBSD Foundation, Inc. All rights reserved. AboutView Dalies pateiktos programinės įrangos autorių teisės priklauso „NetBSD Foundation, Inc.“ ir talkininkams:\nftp, tput\n© 1996-2008 The NetBSD Foundation, Inc. Visos teisės saugomos. Contains software from the FreeBSD Project, released under the BSD license:\ncal, ftpd, ping, telnet, telnetd, traceroute\nCopyright © 1994-2008 The FreeBSD Project. All rights reserved. AboutView Dalis pateiktos programinės įrangos yra iš „FreeBSD“ Projekto, ir platinama pagal BSD licenciją:\ncal, ftpd, ping, telnet, telnetd, traceroute\n© 1994-2008 The FreeBSD Project. Visos teisės saugomos. +Google and their Google Summer of Code and Google Code In programs\n AboutView „Google“korporacijai už „Google Summer of Code“ ir „Google Code In“ programas The Haikuware team and their bounty program\n AboutView „Haikuware“ komandai už premijavimo programą bei šios programos dalyviams\n Copyright © 1995, 1998-2001 Jef Poskanzer. All rights reserved. AboutView © 1995, 1998-2001 Jef Poskanzer. Visos teisės saugomos. Copyright © 2010-2011 Google Inc. All rights reserved. AboutView © 2010-2011 Google Inc. Visos teisės saugomos. @@ -74,6 +76,7 @@ Copyright © 2003-2006 Intel Corporation. All rights reserved. AboutView © 200 Copyright © 1997-2006 PDFlib GmbH and Thomas Merz. All rights reserved.\nPDFlib and PDFlib logo are registered trademarks of PDFlib GmbH. AboutView © 1997-2006 PDFlib GmbH ir Thomas Merz. Visos teisės saugomos.\n„PDFlib“ and „PDFlib“ logotipas yra „PDFlib GmbH“ registruoti prekės ženklai. Copyright © 1991-2000 Silicon Graphics, Inc. All rights reserved. AboutView © 1991-2000 Silicon Graphics, Inc. Visos teisės saugomos. Contains software from the GNU Project, released under the GPL and LGPL licenses:\nGNU C Library, GNU coretools, diffutils, findutils, sharutils, gawk, bison, m4, make, gdb, wget, ncurses, termcap, Bourne Again Shell.\nCopyright © The Free Software Foundation. AboutView Dalis pateiktos programinės įrangos yra iš GNU projekto ir platinama pagal GPL ir LGPL licencijas:\nGNU C Library, GNU coretools, diffutils, findutils, sharutils, gawk, bison, m4, make, gdb, wget, ncurses, termcap, Bourne Again Shell.\n© The Free Software Foundation. +…and the many people making donations!\n\n AboutView …taip pat daugybei pinigus aukojusių žmonių!\n\n MIT license. All rights reserved. AboutView MIT licencija. Visos teisės saugomos. [Click a license name to read the respective license.]\n\n AboutView [Norėdami perskaityti licenciją, spustelėkite jos pavadinimą.]\n\n Copyright © 2007 Ralink Technology Corporation. All rights reserved. AboutView © 2007 Ralink Technology Corporation. Visos teisės saugomos. diff --git a/data/catalogs/apps/bsnow/zh_Hans.catkeys b/data/catalogs/apps/bsnow/zh_Hans.catkeys index 507543bdef..493852ee6c 100644 --- a/data/catalogs/apps/bsnow/zh_Hans.catkeys +++ b/data/catalogs/apps/bsnow/zh_Hans.catkeys @@ -1,3 +1,4 @@ -1 english x-vnd.mmu_man.BSnow 2460058908 +1 english x-vnd.mmu_man.BSnow 2621406458 Drag me on your desktop… BSnow 拖拽至您的桌面... Click me to remove BSnow… BSnow 点击以移除BSnow... +BSnow System name BSnow diff --git a/data/catalogs/apps/deskbar/be.catkeys b/data/catalogs/apps/deskbar/be.catkeys index 789a3734ae..16848ecb8d 100644 --- a/data/catalogs/apps/deskbar/be.catkeys +++ b/data/catalogs/apps/deskbar/be.catkeys @@ -1,7 +1,9 @@ -1 belarusian x-vnd.Be-TSKB 3155357024 +1 belarusian x-vnd.Be-TSKB 1210725923 Power off DeskbarMenu Выключыць Edit menu… PreferencesWindow Змяніць меню… Suspend DeskbarMenu Прыпыніць +Hide clock TimeView Схаваць гадзіннік +Applications PreferencesWindow Праграмы Time preferences… TimeView Наладкі Часу… About Haiku DeskbarMenu Пра Haiku Recent documents: PreferencesWindow Нядаўнія дакументы: @@ -9,6 +11,7 @@ Recent applications DeskbarMenu Нядаўнія праграмы Sort running applications PreferencesWindow Сартыравать запушчаныя праграмы Applications B_USER_DESKBAR_DIRECTORY/Applications Праграмы Find… DeskbarMenu Знайсці… +Show clock Tray Паказаць гадзіннік Window PreferencesWindow Акно Menu PreferencesWindow Меню Recent documents DeskbarMenu Нядаўнія дакументы diff --git a/data/catalogs/apps/deskbar/fi.catkeys b/data/catalogs/apps/deskbar/fi.catkeys index 1cd1b49c60..d5942e274e 100644 --- a/data/catalogs/apps/deskbar/fi.catkeys +++ b/data/catalogs/apps/deskbar/fi.catkeys @@ -1,7 +1,9 @@ -1 finnish x-vnd.Be-TSKB 3155357024 +1 finnish x-vnd.Be-TSKB 1210725923 Power off DeskbarMenu Sammuta virta Edit menu… PreferencesWindow Muokkaa valikkoa... Suspend DeskbarMenu Keskeytystila +Hide clock TimeView Piilota kello +Applications PreferencesWindow Sovellukset Time preferences… TimeView Aika-asetukset... About Haiku DeskbarMenu Haikusta Recent documents: PreferencesWindow Äskettäiset asiakirjat: @@ -9,6 +11,7 @@ Recent applications DeskbarMenu Äskettäiset sovellukset Sort running applications PreferencesWindow Lajittele suoritettavat sovellukset Applications B_USER_DESKBAR_DIRECTORY/Applications Sovellukset Find… DeskbarMenu Etsi... +Show clock Tray Näytä kello Window PreferencesWindow Ikkuna Menu PreferencesWindow Valikko Recent documents DeskbarMenu Äskettäiset asiakirjat diff --git a/data/catalogs/apps/deskbar/fr.catkeys b/data/catalogs/apps/deskbar/fr.catkeys index cb018ad9d3..8a636c1e6f 100644 --- a/data/catalogs/apps/deskbar/fr.catkeys +++ b/data/catalogs/apps/deskbar/fr.catkeys @@ -1,7 +1,9 @@ -1 french x-vnd.Be-TSKB 3155357024 +1 french x-vnd.Be-TSKB 1210725923 Power off DeskbarMenu Éteindre Edit menu… PreferencesWindow Éditer le menu… Suspend DeskbarMenu Mettre en veille +Hide clock TimeView Masquer l'horloge +Applications PreferencesWindow Applications Time preferences… TimeView Préférences de l'heure… About Haiku DeskbarMenu À propos de Haiku Recent documents: PreferencesWindow Documents récents : @@ -9,6 +11,7 @@ Recent applications DeskbarMenu Applications récentes Sort running applications PreferencesWindow Trier les applications lancées Applications B_USER_DESKBAR_DIRECTORY/Applications Applications Find… DeskbarMenu Rechercher… +Show clock Tray Afficher l'horloge Window PreferencesWindow Fenêtre Menu PreferencesWindow Menu Recent documents DeskbarMenu Documents récents diff --git a/data/catalogs/apps/deskbar/hu.catkeys b/data/catalogs/apps/deskbar/hu.catkeys index 0b433f943f..3047e5c0ab 100644 --- a/data/catalogs/apps/deskbar/hu.catkeys +++ b/data/catalogs/apps/deskbar/hu.catkeys @@ -1,11 +1,12 @@ -1 hungarian x-vnd.Be-TSKB 1566009467 +1 hungarian x-vnd.Be-TSKB 1210725923 Power off DeskbarMenu Kikapcsolás Edit menu… PreferencesWindow Menü szerkesztése… Suspend DeskbarMenu Felfüggesztés Hide clock TimeView Óra elrejtése +Applications PreferencesWindow Programok Time preferences… TimeView Idő beállítása… About Haiku DeskbarMenu Haiku névjegye -Recent documents: PreferencesWindow Utolsó dokumentumok: +Recent documents: PreferencesWindow Legutóbb használt fájlok: Recent applications DeskbarMenu Legutóbbi programok Sort running applications PreferencesWindow Futó programok rendezése Applications B_USER_DESKBAR_DIRECTORY/Applications Programok @@ -13,7 +14,7 @@ Find… DeskbarMenu Keresés… Show clock Tray Óra megjelenítése Window PreferencesWindow Ablak Menu PreferencesWindow Menü -Recent documents DeskbarMenu Legutóbbi dokumentumok +Recent documents DeskbarMenu Legutóbb használt fájlok Auto-hide PreferencesWindow Automatikus elrejtés Always on top PreferencesWindow Mindig felül DeskbarMenu @@ -24,7 +25,7 @@ Restart system DeskbarMenu Rendszer újraindítása Large PreferencesWindow Nagy Auto-raise PreferencesWindow Automatikus előrehozás Recent folders: PreferencesWindow Utolsó mappák: -Show application expander PreferencesWindow Programkiterjesztő mutatása +Show application expander PreferencesWindow Programkibontó mutatása Restart Tracker DeskbarMenu Nyomkövető újraindítása Close all WindowMenu Összes bezárása Deskbar preferences PreferencesWindow Asztalsáv-beállítások @@ -38,7 +39,7 @@ Recent folders DeskbarMenu Legutóbbi mappák About this system DeskbarMenu Rendszer névjegye Show calendar… TimeView Naptár megjelenítése… Deskbar preferences… DeskbarMenu Asztalsáv-beállítások… -Expand new applications PreferencesWindow Új programok kicsomagolása +Expand new applications PreferencesWindow Új programok kibontása Show replicants DeskbarMenu Replikánsok megjelenítése Hide application names PreferencesWindow Programnevek elrejtése Demos B_USER_DESKBAR_DIRECTORY/Demos Bemutatók diff --git a/data/catalogs/apps/deskbar/lt.catkeys b/data/catalogs/apps/deskbar/lt.catkeys index 9f07ab9229..782cef2c8e 100644 --- a/data/catalogs/apps/deskbar/lt.catkeys +++ b/data/catalogs/apps/deskbar/lt.catkeys @@ -1,7 +1,9 @@ -1 lithuanian x-vnd.Be-TSKB 3155357024 +1 lithuanian x-vnd.Be-TSKB 1210725923 Power off DeskbarMenu Išjungti Edit menu… PreferencesWindow Taisyti meniu… Suspend DeskbarMenu Pristabdyti +Hide clock TimeView Nerodyti laikrodžio +Applications PreferencesWindow Programos Time preferences… TimeView Laiko nuostatos… About Haiku DeskbarMenu Apie „Haiku“ Recent documents: PreferencesWindow Paskiausi dokumentai: @@ -9,6 +11,7 @@ Recent applications DeskbarMenu Paskiausiai leistos programos Sort running applications PreferencesWindow Rikiuoti paleistas programas Applications B_USER_DESKBAR_DIRECTORY/Applications Programos Find… DeskbarMenu Ieškoti… +Show clock Tray Rodyti laikrodį Window PreferencesWindow Langas Menu PreferencesWindow Meniu Recent documents DeskbarMenu Paskiausiai atverti dokumentai diff --git a/data/catalogs/apps/deskbar/pt_BR.catkeys b/data/catalogs/apps/deskbar/pt_BR.catkeys index 163d747871..31f7edff49 100644 --- a/data/catalogs/apps/deskbar/pt_BR.catkeys +++ b/data/catalogs/apps/deskbar/pt_BR.catkeys @@ -1,7 +1,9 @@ -1 portuguese (brazil) x-vnd.Be-TSKB 3155357024 +1 portuguese (brazil) x-vnd.Be-TSKB 1210725923 Power off DeskbarMenu Desligar Edit menu… PreferencesWindow Editar menu... Suspend DeskbarMenu Suspender +Hide clock TimeView Ocultar relógio +Applications PreferencesWindow Aplicativos Time preferences… TimeView Preferências de hora… About Haiku DeskbarMenu Sobre o Haiku Recent documents: PreferencesWindow Documentos recentes: @@ -9,6 +11,7 @@ Recent applications DeskbarMenu Aplicativos recentes Sort running applications PreferencesWindow Ordenar aplicativos em execução Applications B_USER_DESKBAR_DIRECTORY/Applications Aplicativos Find… DeskbarMenu Localizar… +Show clock Tray Exibir relógio Window PreferencesWindow Janela Menu PreferencesWindow Menu Recent documents DeskbarMenu Documentos recentes diff --git a/data/catalogs/apps/deskbar/ru.catkeys b/data/catalogs/apps/deskbar/ru.catkeys index bf5d78479c..d219f817ad 100644 --- a/data/catalogs/apps/deskbar/ru.catkeys +++ b/data/catalogs/apps/deskbar/ru.catkeys @@ -1,7 +1,9 @@ -1 russian x-vnd.Be-TSKB 3155357024 +1 russian x-vnd.Be-TSKB 1210725923 Power off DeskbarMenu Выключить компьютер Edit menu… PreferencesWindow Изменить меню… Suspend DeskbarMenu Приостановить +Hide clock TimeView Скрыть часы +Applications PreferencesWindow Приложения Time preferences… TimeView Настроить часы… About Haiku DeskbarMenu О системе Haiku Recent documents: PreferencesWindow Недавние документы: @@ -9,6 +11,7 @@ Recent applications DeskbarMenu Недавние приложения Sort running applications PreferencesWindow Сортировать запущенные приложения Applications B_USER_DESKBAR_DIRECTORY/Applications Приложения Find… DeskbarMenu Найти… +Show clock Tray Показать часы Window PreferencesWindow Окно Menu PreferencesWindow Меню Recent documents DeskbarMenu Недавние документы diff --git a/data/catalogs/apps/deskbar/sk.catkeys b/data/catalogs/apps/deskbar/sk.catkeys index 3554022900..723f839a30 100644 --- a/data/catalogs/apps/deskbar/sk.catkeys +++ b/data/catalogs/apps/deskbar/sk.catkeys @@ -1,7 +1,9 @@ -1 slovak x-vnd.Be-TSKB 3155357024 +1 slovak x-vnd.Be-TSKB 1210725923 Power off DeskbarMenu Vypnúť Edit menu… PreferencesWindow Upraviť menu… Suspend DeskbarMenu Režim spánku +Hide clock TimeView Skryť hodiny +Applications PreferencesWindow Aplikácie Time preferences… TimeView Nastavenia času… About Haiku DeskbarMenu O Haiku Recent documents: PreferencesWindow Nedávne dokumenty: @@ -9,6 +11,7 @@ Recent applications DeskbarMenu Nedávne aplikácie Sort running applications PreferencesWindow Zoradiť bežiace aplikácie Applications B_USER_DESKBAR_DIRECTORY/Applications Aplikácie Find… DeskbarMenu Nájsť… +Show clock Tray Zobraziť hodiny Window PreferencesWindow Okno Menu PreferencesWindow Menu Recent documents DeskbarMenu Nedávne dokumenty diff --git a/data/catalogs/apps/deskbar/zh_Hans.catkeys b/data/catalogs/apps/deskbar/zh_Hans.catkeys index e33e982a99..c0694054ca 100644 --- a/data/catalogs/apps/deskbar/zh_Hans.catkeys +++ b/data/catalogs/apps/deskbar/zh_Hans.catkeys @@ -1,7 +1,9 @@ -1 english x-vnd.Be-TSKB 3155357024 +1 english x-vnd.Be-TSKB 1210725923 Power off DeskbarMenu 关闭电源 Edit menu… PreferencesWindow 编辑菜单 Suspend DeskbarMenu 挂起 +Hide clock TimeView 隐藏时钟 +Applications PreferencesWindow 应用程序 Time preferences… TimeView 时间设置... About Haiku DeskbarMenu 关于Haiku Recent documents: PreferencesWindow 最近文档: @@ -9,6 +11,7 @@ Recent applications DeskbarMenu 最近程序 Sort running applications PreferencesWindow 运行程序排序 Applications B_USER_DESKBAR_DIRECTORY/Applications 应用程序 Find… DeskbarMenu 查找... +Show clock Tray 显示时钟 Window PreferencesWindow 窗口 Menu PreferencesWindow 菜单 Recent documents DeskbarMenu 最近文档: diff --git a/data/catalogs/apps/diskusage/be.catkeys b/data/catalogs/apps/diskusage/be.catkeys index 0c9327259d..da361fcb77 100644 --- a/data/catalogs/apps/diskusage/be.catkeys +++ b/data/catalogs/apps/diskusage/be.catkeys @@ -1,4 +1,4 @@ -1 belarusian x-vnd.Haiku-DiskUsage 2447717116 +1 belarusian x-vnd.Haiku-DiskUsage 3631077986 Scanning %refName% Scanner Сканаванне %refName% Size Info Window Памер Rescan Pie View Перасканаваць @@ -9,12 +9,16 @@ no supporting apps Pie View няма падтрымліваючых прагр Path Info Window Пуць Scan Status View Скан 9999.99 GB Status View 9999.99 ГБ +Rescan Status View Перасканаваць file unavailable Status View файл недаступны +Get info Pie View Узяць інфу DiskUsage System name Статыстыка дыскаў in %d files Info Window ў %d файлах %d files Status View %d файлаў Created Info Window Створаны Modified Info Window Мадыфікаваны +Abort Status View Перарваць +Open with Pie View Адкрыць з дапамогай Open Pie View Адкрыць %a, %d %b %Y, %r Info Window %a, %d %b %Y, %r Free on %refName% Scanner Вольна на %refName% diff --git a/data/catalogs/apps/diskusage/de.catkeys b/data/catalogs/apps/diskusage/de.catkeys index 5e98016472..cf676d5f11 100644 --- a/data/catalogs/apps/diskusage/de.catkeys +++ b/data/catalogs/apps/diskusage/de.catkeys @@ -1,4 +1,4 @@ -1 german x-vnd.Haiku-DiskUsage 274830116 +1 german x-vnd.Haiku-DiskUsage 3631077986 Scanning %refName% Scanner Analysiere %refName% Size Info Window Größe Rescan Pie View Erneut analysieren @@ -11,12 +11,14 @@ Scan Status View Analyse 9999.99 GB Status View 9999,99 GiB Rescan Status View Erneut analysieren file unavailable Status View Datei nicht verfügbar +Get info Pie View Datei-Info DiskUsage System name Datenträgerbelegung in %d files Info Window in %d Dateien %d files Status View %d Dateien Created Info Window Erstellt Modified Info Window Geändert Abort Status View Abbrechen +Open with Pie View Öffnen mit Open Pie View Öffnen %a, %d %b %Y, %r Info Window %a, %d %b %Y, %r Free on %refName% Scanner Frei auf %refName% diff --git a/data/catalogs/apps/diskusage/fi.catkeys b/data/catalogs/apps/diskusage/fi.catkeys index 024cda8055..fc71da56e2 100644 --- a/data/catalogs/apps/diskusage/fi.catkeys +++ b/data/catalogs/apps/diskusage/fi.catkeys @@ -1,4 +1,4 @@ -1 finnish x-vnd.Haiku-DiskUsage 274830116 +1 finnish x-vnd.Haiku-DiskUsage 3631077986 Scanning %refName% Scanner Tutkitaan %refName% Size Info Window Koko Rescan Pie View Tutki uudelleen @@ -11,12 +11,14 @@ Scan Status View Tutki 9999.99 GB Status View 9999.99 gibitavua Rescan Status View Tutki uudelleen file unavailable Status View tiedosto ei ole saatavilla +Get info Pie View Hae tiedot DiskUsage System name Levyasemakäyttö in %d files Info Window %d tiedostossa %d files Status View %d tiedostoa Created Info Window Luotu Modified Info Window Muokattu Abort Status View Keskeytä +Open with Pie View Avaa sovelluksella Open Pie View Avaa %a, %d %b %Y, %r Info Window %a, %d. %Bta %Y, %r Free on %refName% Scanner Vapaata levyasemalla %refName% diff --git a/data/catalogs/apps/diskusage/fr.catkeys b/data/catalogs/apps/diskusage/fr.catkeys index 177c7bf671..57935b6ccd 100644 --- a/data/catalogs/apps/diskusage/fr.catkeys +++ b/data/catalogs/apps/diskusage/fr.catkeys @@ -1,4 +1,4 @@ -1 french x-vnd.Haiku-DiskUsage 274830116 +1 french x-vnd.Haiku-DiskUsage 3710683878 Scanning %refName% Scanner Examen de %refName% Size Info Window Taille Rescan Pie View Réexaminer @@ -17,6 +17,7 @@ DiskUsage System name Utilisation Disque Created Info Window Créé Modified Info Window Modifié Abort Status View Abandonner +Open with Pie View Ouvrir avec Open Pie View Ouvrir %a, %d %b %Y, %r Info Window %a, %d %b %Y, %R Free on %refName% Scanner Libre sur %refName% diff --git a/data/catalogs/apps/diskusage/hu.catkeys b/data/catalogs/apps/diskusage/hu.catkeys index a46be8d527..f806c1278f 100644 --- a/data/catalogs/apps/diskusage/hu.catkeys +++ b/data/catalogs/apps/diskusage/hu.catkeys @@ -1,4 +1,4 @@ -1 hungarian x-vnd.Haiku-DiskUsage 274830116 +1 hungarian x-vnd.Haiku-DiskUsage 3631077986 Scanning %refName% Scanner %refName% elemzése Size Info Window Méret Rescan Pie View Újraelemzés @@ -11,12 +11,14 @@ Scan Status View Elemzés 9999.99 GB Status View 9999,99 GB Rescan Status View Újraelemzés file unavailable Status View fájl nem elérhető +Get info Pie View Információ DiskUsage System name Lemezhasználat in %d files Info Window %d fájlban. %d files Status View %d fájl Created Info Window Létrehozva Modified Info Window Módosítva Abort Status View Megszakítás +Open with Pie View Megnyitás ezzel Open Pie View Megnyitás %a, %d %b %Y, %r Info Window %a, %d %b %Y, %r Free on %refName% Scanner %refName% szabad területe diff --git a/data/catalogs/apps/diskusage/ja.catkeys b/data/catalogs/apps/diskusage/ja.catkeys index 25a28fe2fb..b945603bc7 100644 --- a/data/catalogs/apps/diskusage/ja.catkeys +++ b/data/catalogs/apps/diskusage/ja.catkeys @@ -1,4 +1,4 @@ -1 japanese x-vnd.Haiku-DiskUsage 274830116 +1 japanese x-vnd.Haiku-DiskUsage 3631077986 Scanning %refName% Scanner %refName%をスキャン中 Size Info Window サイズ Rescan Pie View 再スキャン @@ -11,12 +11,14 @@ Scan Status View スキャン 9999.99 GB Status View 9999.99 GB Rescan Status View 再スキャン file unavailable Status View 利用できないファイル +Get info Pie View 情報を表示 DiskUsage System name DiskUsage in %d files Info Window %d 個のファイル中 %d files Status View %d 個のファイル Created Info Window 作成日時 Modified Info Window 更新日時 Abort Status View 中断 +Open with Pie View アプリケーションで開く Open Pie View 開く %a, %d %b %Y, %r Info Window %a, %d %b %Y, %r Free on %refName% Scanner %refName%の空き領域 diff --git a/data/catalogs/apps/diskusage/lt.catkeys b/data/catalogs/apps/diskusage/lt.catkeys index a6702a8182..9ac241a531 100644 --- a/data/catalogs/apps/diskusage/lt.catkeys +++ b/data/catalogs/apps/diskusage/lt.catkeys @@ -1,4 +1,4 @@ -1 lithuanian x-vnd.Haiku-DiskUsage 2447717116 +1 lithuanian x-vnd.Haiku-DiskUsage 3631077986 Scanning %refName% Scanner Žvalgomas skirsnis „%refName%“ Size Info Window Dydis Rescan Pie View Peržvalgyti @@ -9,12 +9,16 @@ no supporting apps Pie View palaikančių programų nėra Path Info Window Kelias Scan Status View Žvalgyti 9999.99 GB Status View 9999,99 GB +Rescan Status View Peržvalgyti file unavailable Status View failas nepasiekiamas +Get info Pie View Savybės DiskUsage System name Disko naudojimas in %d files Info Window %d failuose (-ų) %d files Status View %d failai (-ų) Created Info Window Sukurtas Modified Info Window Modifikuotas +Abort Status View Nutraukti +Open with Pie View Atverti naudojant Open Pie View Atverti %a, %d %b %Y, %r Info Window %a, %Y %b %d, %T Free on %refName% Scanner Laisva vieta skirsnyje „%refName%“ diff --git a/data/catalogs/apps/diskusage/pl.catkeys b/data/catalogs/apps/diskusage/pl.catkeys index cd26104146..d674a5c3ad 100644 --- a/data/catalogs/apps/diskusage/pl.catkeys +++ b/data/catalogs/apps/diskusage/pl.catkeys @@ -1,4 +1,4 @@ -1 polish x-vnd.Haiku-DiskUsage 274830116 +1 polish x-vnd.Haiku-DiskUsage 3631077986 Scanning %refName% Scanner Skanowanie %refName% Size Info Window Rozmiar Rescan Pie View Przeskanuj @@ -11,12 +11,14 @@ Scan Status View Skanowanie 9999.99 GB Status View 9999.99 GB Rescan Status View Przeskanuj file unavailable Status View plik niedostępny +Get info Pie View Pobierz informacje DiskUsage System name Wykorzystanie Dysku in %d files Info Window w %d plikach %d files Status View %d plików Created Info Window Stworzony Modified Info Window Zmodyfikowany Abort Status View Przerwij +Open with Pie View Otwórz za pomocą Open Pie View Otwórz %a, %d %b %Y, %r Info Window %a, %d %b %Y, %r Free on %refName% Scanner Wolne na %refName% diff --git a/data/catalogs/apps/diskusage/pt_BR.catkeys b/data/catalogs/apps/diskusage/pt_BR.catkeys index 7218a1f7c0..f12a193c92 100644 --- a/data/catalogs/apps/diskusage/pt_BR.catkeys +++ b/data/catalogs/apps/diskusage/pt_BR.catkeys @@ -1,4 +1,4 @@ -1 portuguese (brazil) x-vnd.Haiku-DiskUsage 274830116 +1 portuguese (brazil) x-vnd.Haiku-DiskUsage 3631077986 Scanning %refName% Scanner Analisando %refName% Size Info Window Tamanho Rescan Pie View ReAnalisar @@ -11,12 +11,14 @@ Scan Status View Analisar 9999.99 GB Status View 9999.99 Gb Rescan Status View ReAnalisar file unavailable Status View arquivo não disponível +Get info Pie View Obter informação DiskUsage System name Uso de Disco in %d files Info Window em %d arquivos %d files Status View %d arquivos Created Info Window Criado Modified Info Window Modificado Abort Status View Cancelar +Open with Pie View Abrir com Open Pie View Abrir %a, %d %b %Y, %r Info Window %a, %d %b %Y, %r Free on %refName% Scanner Livre em %refName% diff --git a/data/catalogs/apps/diskusage/ru.catkeys b/data/catalogs/apps/diskusage/ru.catkeys index 81ce293895..2f86052ffe 100644 --- a/data/catalogs/apps/diskusage/ru.catkeys +++ b/data/catalogs/apps/diskusage/ru.catkeys @@ -1,4 +1,4 @@ -1 russian x-vnd.Haiku-DiskUsage 2447717116 +1 russian x-vnd.Haiku-DiskUsage 3631077986 Scanning %refName% Scanner Сканируется раздел %refName% Size Info Window Размер Rescan Pie View Пересканировать @@ -9,12 +9,16 @@ no supporting apps Pie View нет поддерживающих програм Path Info Window Путь Scan Status View Сканировать 9999.99 GB Status View 9999.99 ГБ +Rescan Status View Пересканировать file unavailable Status View файл недоступен +Get info Pie View Информация DiskUsage System name Использование диска in %d files Info Window в %d файлах %d files Status View %d файлов Created Info Window Создан Modified Info Window Изменен +Abort Status View Прервать +Open with Pie View Открыть в Open Pie View Открыть %a, %d %b %Y, %r Info Window %a, %d %b %Y, %r Free on %refName% Scanner Свободно на разделе %refName% diff --git a/data/catalogs/apps/diskusage/sk.catkeys b/data/catalogs/apps/diskusage/sk.catkeys index a9618e67da..f6d57e3186 100644 --- a/data/catalogs/apps/diskusage/sk.catkeys +++ b/data/catalogs/apps/diskusage/sk.catkeys @@ -1,4 +1,4 @@ -1 slovak x-vnd.Haiku-DiskUsage 2447717116 +1 slovak x-vnd.Haiku-DiskUsage 3631077986 Scanning %refName% Scanner Prehľadáva sa %refName% Size Info Window Veľkosť Rescan Pie View Znovu preskúmať @@ -9,12 +9,16 @@ no supporting apps Pie View žiadne podporujúce aplikácie Path Info Window Cesta Scan Status View Preskúmať 9999.99 GB Status View 9999.99 GB +Rescan Status View Znovu preskúmať file unavailable Status View súbor nedostupný +Get info Pie View Získať informácie DiskUsage System name Využitie disku in %d files Info Window v %d súboroch %d files Status View %d súborov Created Info Window Vytvorené Modified Info Window Zmenené +Abort Status View Zrušiť +Open with Pie View Otvoriť pomocou Open Pie View Otvoriť %a, %d %b %Y, %r Info Window %a, %d %b %Y, %r Free on %refName% Scanner Voľné na %refName% diff --git a/data/catalogs/apps/diskusage/zh_Hans.catkeys b/data/catalogs/apps/diskusage/zh_Hans.catkeys index 7d1fe297a0..7eec591ca3 100644 --- a/data/catalogs/apps/diskusage/zh_Hans.catkeys +++ b/data/catalogs/apps/diskusage/zh_Hans.catkeys @@ -1,4 +1,4 @@ -1 english x-vnd.Haiku-DiskUsage 2447717116 +1 english x-vnd.Haiku-DiskUsage 3631077986 Scanning %refName% Scanner 扫描 %refName% Size Info Window 大小 Rescan Pie View 重新扫描 @@ -9,12 +9,16 @@ no supporting apps Pie View 无可支持应用 Path Info Window 路径 Scan Status View 扫描 9999.99 GB Status View 9999.99 GB +Rescan Status View 重新扫描 file unavailable Status View 文件不可用 +Get info Pie View 获取信息 DiskUsage System name 磁盘查看器 in %d files Info Window 位于 %d 个文件 %d files Status View %d 文件 Created Info Window 已创建 Modified Info Window 已修改 +Abort Status View 退出 +Open with Pie View 打开方式 Open Pie View 打开 %a, %d %b %Y, %r Info Window %a, %d %b %Y, %r Free on %refName% Scanner 空闲存在 %refName% diff --git a/data/catalogs/apps/drivesetup/lt.catkeys b/data/catalogs/apps/drivesetup/lt.catkeys index 2a09ac961f..76493de096 100644 --- a/data/catalogs/apps/drivesetup/lt.catkeys +++ b/data/catalogs/apps/drivesetup/lt.catkeys @@ -1,4 +1,4 @@ -1 lithuanian x-vnd.Haiku-DriveSetup 3746427159 +1 lithuanian x-vnd.Haiku-DriveSetup 1372142450 DriveSetup System name Diskų ženklintuvas Delete MainWindow Šalinti Are you sure you want to write the changes back to disk now?\n\nAll data on the selected partition will be irretrievably lost if you do so! MainWindow Ar tikrai norite pakeitimus dabar įrašyti į diską?\n\nJei tęsite toliau – visi duomenys, esantys pasirinktame skaidinyje, bus negrįžtamai prarasti! @@ -65,6 +65,7 @@ Partition MainWindow Skaidinys File system PartitionList Failų sistema Validation of the given creation parameters failed. MainWindow Nurodyti netinkami kūrimo parametrai. Size PartitionList Dydis +Wipe (not implemented) MainWindow Ištrinti (dar nerealizuota) Validation of the given initialization parameters failed. MainWindow Nurodyti netinkami ženklinimo parametrai. The selected partition does not contain a partitioning system. MainWindow Pasirinktame skaidinyje nėra skaidinių lentelės. Are you sure you want to write the changes back to disk now?\n\nAll data on the partition %s will be irretrievably lost if you do so! MainWindow Ar tikrai norite pakeitimus dabar įrašyti į diską?\n\nJei tęsite toliau – visi duomenys, esantys skaidinyje „%s“, bus negrįžtamai prarasti! diff --git a/data/catalogs/apps/expander/be.catkeys b/data/catalogs/apps/expander/be.catkeys index 06df50042b..e5c4bbb5f6 100644 --- a/data/catalogs/apps/expander/be.catkeys +++ b/data/catalogs/apps/expander/be.catkeys @@ -1,4 +1,4 @@ -1 belarusian x-vnd.Haiku-Expander 282517174 +1 belarusian x-vnd.Haiku-Expander 2603318510 Expand ExpanderMenu Распакаваць Close window when done expanding ExpanderPreferences Закрыць вакно пасля распакоўкі Set destination… ExpanderMenu Задаць прызначэнне… @@ -22,6 +22,7 @@ Cancel ExpanderPreferences Адмена Expansion ExpanderPreferences Пашырэньне Are you sure you want to stop expanding this\narchive? The expanded items may not be complete. ExpanderWindow Спыніць распакоўку гэтага \nархіва? Ужо распакаваныя файлы могуць быць няпоўнымі. Select DirectoryFilePanel Пазначыць +Destination folder doesn't exist. Would you like to create it? ExpanderWindow Мэтавая папка не існуе. Ці хочаце стварыць яе? Same directory as source (archive) file ExpanderPreferences Папка ў якой знаходзіцца зыходны архіў Expanding '%s' ExpanderWindow Распакоўка '%s' Settings ExpanderMenu Налады @@ -32,6 +33,8 @@ Show contents ExpanderWindow Паказаць змест Automatically show contents listing ExpanderPreferences Аўтаматычна паказваць змесціва OK ExpanderPreferences ОК Leave destination folder path empty ExpanderPreferences Пакінуць пуць да пакі прызначэння пустым +Failed to create the destination folder. ExpanderWindow Не ўдалося стварыць мэтавую папку. +Create ExpanderWindow Стварыць The folder was either moved, renamed or not\nsupported. ExpanderWindow Гэты каталёг быў перамешчаны, перайменаваны, або не\n падтрымліваецца. The file doesn't exist ExpanderWindow Гэты файл не існуе Stop ExpanderMenu Спыніць diff --git a/data/catalogs/apps/expander/lt.catkeys b/data/catalogs/apps/expander/lt.catkeys index d59a8503c7..e10140d1d8 100644 --- a/data/catalogs/apps/expander/lt.catkeys +++ b/data/catalogs/apps/expander/lt.catkeys @@ -1,4 +1,4 @@ -1 lithuanian x-vnd.Haiku-Expander 282517174 +1 lithuanian x-vnd.Haiku-Expander 2603318510 Expand ExpanderMenu Išskleisti Close window when done expanding ExpanderPreferences Viską išskleidus, užverti langą Set destination… ExpanderMenu Paskirties vieta… @@ -22,6 +22,7 @@ Cancel ExpanderPreferences Atsisakyti Expansion ExpanderPreferences Išskleidimas Are you sure you want to stop expanding this\narchive? The expanded items may not be complete. ExpanderWindow Ar tikrai norite nutraukti šio archyvo išskleidimą? Gali būti, kad išskleisti dar ne visi elementai. Select DirectoryFilePanel Parinkti +Destination folder doesn't exist. Would you like to create it? ExpanderWindow Paskirties aplankas neegzistuoja. Ar norite jį sukurti? Same directory as source (archive) file ExpanderPreferences Aplankas, kuriame yra išskleidžiamas archyvas Expanding '%s' ExpanderWindow Išskleidžiamas archyvas „%s“ Settings ExpanderMenu Nuostatos @@ -32,6 +33,8 @@ Show contents ExpanderWindow Rodyti turinį Automatically show contents listing ExpanderPreferences Automatiškai rodyti turinį OK ExpanderPreferences Gerai Leave destination folder path empty ExpanderPreferences Paskirties aplanko lauką palikti tuščią +Failed to create the destination folder. ExpanderWindow Nepavyko sukurti paskirties aplanko. +Create ExpanderWindow Sukurti The folder was either moved, renamed or not\nsupported. ExpanderWindow Aplankas buvo perkeltas, pervardintas arba yra nepalaikomas. The file doesn't exist ExpanderWindow Failas neegzistuoja Stop ExpanderMenu Nutraukti diff --git a/data/catalogs/apps/expander/ru.catkeys b/data/catalogs/apps/expander/ru.catkeys index aa4cfd4bbb..bc43a0b23f 100644 --- a/data/catalogs/apps/expander/ru.catkeys +++ b/data/catalogs/apps/expander/ru.catkeys @@ -1,4 +1,4 @@ -1 russian x-vnd.Haiku-Expander 282517174 +1 russian x-vnd.Haiku-Expander 1269216169 Expand ExpanderMenu Распаковать Close window when done expanding ExpanderPreferences Закрывать окно после распаковки Set destination… ExpanderMenu Путь назначения для извлечения… @@ -22,6 +22,7 @@ Cancel ExpanderPreferences Отмена Expansion ExpanderPreferences Извлечение Are you sure you want to stop expanding this\narchive? The expanded items may not be complete. ExpanderWindow Вы уверены, что хотите остановить распаковку этого\nархива? Некоторые файлы могли быть извлечены не полностью. Select DirectoryFilePanel Выбрать +Destination folder doesn't exist. Would you like to create it? ExpanderWindow Папка назначения не существует. Создать её? Same directory as source (archive) file ExpanderPreferences Использовать ту же папку где находится архив Expanding '%s' ExpanderWindow Распаковывается '%s' Settings ExpanderMenu Настройки diff --git a/data/catalogs/apps/expander/sk.catkeys b/data/catalogs/apps/expander/sk.catkeys index 443c1abe90..1eb46d8d3f 100644 --- a/data/catalogs/apps/expander/sk.catkeys +++ b/data/catalogs/apps/expander/sk.catkeys @@ -1,4 +1,4 @@ -1 slovak x-vnd.Haiku-Expander 282517174 +1 slovak x-vnd.Haiku-Expander 2603318510 Expand ExpanderMenu Rozbaliť Close window when done expanding ExpanderPreferences Zatvoriť okno po dokončení rozbaľovania Set destination… ExpanderMenu Nastaviť cieľ… @@ -22,6 +22,7 @@ Cancel ExpanderPreferences Zrušiť Expansion ExpanderPreferences Rozpínanie Are you sure you want to stop expanding this\narchive? The expanded items may not be complete. ExpanderWindow Ste si istí, že chcete zastaviť rozbaľovanie tohto archívu?\nRozbalené položky nemusia byť úplné. Select DirectoryFilePanel Vybrať +Destination folder doesn't exist. Would you like to create it? ExpanderWindow Cieľový priečinok neexistuje. Chcete ho vytvoriť? Same directory as source (archive) file ExpanderPreferences Rovnaký ako zdrojový (archívny) súbor Expanding '%s' ExpanderWindow Rozbaľuje sa „%s“ Settings ExpanderMenu Nastavenia @@ -32,6 +33,8 @@ Show contents ExpanderWindow Zobraziť obsah Automatically show contents listing ExpanderPreferences Automaticky zobrazovať obsah OK ExpanderPreferences OK Leave destination folder path empty ExpanderPreferences Ponechať cestu k cieľovému priečinku prázdnu +Failed to create the destination folder. ExpanderWindow Nepodarilo sa vytvoriť cieľový priečinok. +Create ExpanderWindow Vytvoriť The folder was either moved, renamed or not\nsupported. ExpanderWindow Priečinok bol presunutý, premenovaný\nalebo nie je podporovaný. The file doesn't exist ExpanderWindow Súbor neexistuje Stop ExpanderMenu Zastaviť diff --git a/data/catalogs/apps/expander/zh_Hans.catkeys b/data/catalogs/apps/expander/zh_Hans.catkeys index f66069ca8c..d51c6a76bd 100644 --- a/data/catalogs/apps/expander/zh_Hans.catkeys +++ b/data/catalogs/apps/expander/zh_Hans.catkeys @@ -1,4 +1,4 @@ -1 english x-vnd.Haiku-Expander 282517174 +1 english x-vnd.Haiku-Expander 2603318510 Expand ExpanderMenu 解压缩 Close window when done expanding ExpanderPreferences 完成解压后,关闭窗口。 Set destination… ExpanderMenu 目标文件… @@ -22,6 +22,7 @@ Cancel ExpanderPreferences 取消 Expansion ExpanderPreferences 展开 Are you sure you want to stop expanding this\narchive? The expanded items may not be complete. ExpanderWindow 确定停止解压\n该压缩文件? 已完成解压部分可能不完整。 Select DirectoryFilePanel 选择 +Destination folder doesn't exist. Would you like to create it? ExpanderWindow 目标目录不存在。您是否希望创建该目录? Same directory as source (archive) file ExpanderPreferences 相同于源文件(压缩档)目录 Expanding '%s' ExpanderWindow '%s' 解压进行中 Settings ExpanderMenu 设置 @@ -32,6 +33,8 @@ Show contents ExpanderWindow 显示内容 Automatically show contents listing ExpanderPreferences 自动显示内容列表 OK ExpanderPreferences 确定 Leave destination folder path empty ExpanderPreferences 保持目标目录为空 +Failed to create the destination folder. ExpanderWindow 目标目录创建失败。 +Create ExpanderWindow 创建 The folder was either moved, renamed or not\nsupported. ExpanderWindow 文件夹已被删除,重命名或者不被\n支持. The file doesn't exist ExpanderWindow 文件不存在 Stop ExpanderMenu 停止 diff --git a/data/catalogs/apps/fontdemo/fr.catkeys b/data/catalogs/apps/fontdemo/fr.catkeys index 625fca8228..8dc101729c 100644 --- a/data/catalogs/apps/fontdemo/fr.catkeys +++ b/data/catalogs/apps/fontdemo/fr.catkeys @@ -1,4 +1,4 @@ -1 french x-vnd.Haiku-FontDemo 1300625863 +1 french x-vnd.Haiku-FontDemo 3522850500 Outline: ControlView Contour : Size: 50 ControlView Taille : 50 Stop cycling ControlView Arrêter de boucler @@ -14,6 +14,7 @@ Rotation: 0 ControlView Rotation : 0 Drawing mode: ControlView Mode de dessin : Haiku, Inc. ControlView Haiku, Inc. Controls FontDemo Contrôles +FontDemo System name FontDemo Outline: %d ControlView Contour : %d Text: ControlView Texte : Antialiased text ControlView Anticrénelage diff --git a/data/catalogs/apps/icon-o-matic/be.catkeys b/data/catalogs/apps/icon-o-matic/be.catkeys index 6188f25bf5..f8a93fa2f3 100644 --- a/data/catalogs/apps/icon-o-matic/be.catkeys +++ b/data/catalogs/apps/icon-o-matic/be.catkeys @@ -1,4 +1,4 @@ -1 belarusian x-vnd.haiku-icon_o_matic 2079362081 +1 belarusian x-vnd.haiku-icon_o_matic 3933520036 Select All Icon-O-Matic-PathManipulator Выбраць Усё Add Style Icon-O-Matic-AddStylesCmd Дадаць Стыль Color (#%02x%02x%02x) Style name after dropping a color Колер (#%02x%02x%02x) @@ -43,6 +43,7 @@ Untitled Icon-O-Matic-Main Неназваны Multi Set Multi Set (property name) Прызначыць некалькі any of the other lists to Empty property list - 2nd line любым з іншых спісаў каб Save as… Icon-O-Matic-Menu-File Захаваць як… +Don't save Icon-O-Matic-Menu-Settings Не захоўваць Change Color Icon-O-Matic-SetColorCmd Змяніць колер Style Icon-O-Matic-Menus Стыль Icon-O-Matic-PathCmd <змяніць пуць> @@ -72,6 +73,7 @@ Undo Icon-O-Matic-Main Вярнуць Click on a shape above Empty transformers list - 1st line Клікніце па фігуры вышэй Add Shape Icon-O-Matic-AddShapesCmd Дадаць Фігуру Contour Transformation Контур +Save changes to current icon before closing? Icon-O-Matic-Menu-Settings Захаваць зьмены ў значак перад тым як выйсьці? Icon-O-Matic-Menu-Edit <няма чаго перарабляць> Perspective Transformation Перспэктыва Move Transformer Icon-O-Matic-MoveTransformersCmd Перамясціць Трансформер @@ -99,7 +101,6 @@ Pick a color Icon-O-Matic-ColorPicker Падабраць колер Quit Icon-O-Matic-Menu-File Выйсці Export Icon-O-Matic-Menu-File Экспарт No Icon-O-Matic-StyledTextImport Не -Save changes to current icon? Icon-O-Matic-Menu-Settings Захаваць змены ў цякучы значак? Rotate indices forwards Icon-O-Matic-PathsList Павярнуць індэксы наперад Unassign Path Icon-O-Matic-UnassignPathCmd Адвязаць шлях load error Icon-O-Matic-SVGImport памылка загрузкі @@ -147,7 +148,6 @@ Add Transformers Icon-O-Matic-AddTransformersCmd Дадаць Трансфор Diamond Icon-O-Matic-StyleTypes Ромб Path Icon-O-Matic-PropertyNames Шлях Failed to open the file '%s' as an SVG document.\n\nError: %s Icon-O-Matic-SVGImport Не ўдалося адкрыць '%s' як дакумент SVG.\n\nПамылка: %s -Discard Icon-O-Matic-Menu-Settings Адкінуць Swatches Icon-O-Matic-Menus Узоры Icon-O-Matic-StyleTypes <недаступны> Rotation Icon-O-Matic-PropertyNames Паварот diff --git a/data/catalogs/apps/icon-o-matic/de.catkeys b/data/catalogs/apps/icon-o-matic/de.catkeys index c568f7de73..a51b20a861 100644 --- a/data/catalogs/apps/icon-o-matic/de.catkeys +++ b/data/catalogs/apps/icon-o-matic/de.catkeys @@ -1,4 +1,4 @@ -1 german x-vnd.haiku-icon_o_matic 2079362081 +1 german x-vnd.haiku-icon_o_matic 3933520036 Select All Icon-O-Matic-PathManipulator Alles auswählen Add Style Icon-O-Matic-AddStylesCmd Stil hinzufügen Color (#%02x%02x%02x) Style name after dropping a color Farbe (#%02x%02x%02x) @@ -43,6 +43,7 @@ Untitled Icon-O-Matic-Main Unbenannt Multi Set Multi Set (property name) Mehrfach-Setzen any of the other lists to Empty property list - 2nd line einer der anderen Listen, um Save as… Icon-O-Matic-Menu-File Speichern als… +Don't save Icon-O-Matic-Menu-Settings Nicht speichern Change Color Icon-O-Matic-SetColorCmd Farbe ändern Style Icon-O-Matic-Menus Stil Icon-O-Matic-PathCmd @@ -72,6 +73,7 @@ Undo Icon-O-Matic-Main Rückgängig: Click on a shape above Empty transformers list - 1st line Erst eine Form oben auswählen, Add Shape Icon-O-Matic-AddShapesCmd Form hinzufügen Contour Transformation Kontur +Save changes to current icon before closing? Icon-O-Matic-Menu-Settings Änderungen am aktuellen Icon vor dem Schließen speichern? Icon-O-Matic-Menu-Edit Perspective Transformation Perspektive Move Transformer Icon-O-Matic-MoveTransformersCmd Transformator umsortieren @@ -99,7 +101,6 @@ Pick a color Icon-O-Matic-ColorPicker Farbe aussuchen Quit Icon-O-Matic-Menu-File Beenden Export Icon-O-Matic-Menu-File Exportieren No Icon-O-Matic-StyledTextImport Nein -Save changes to current icon? Icon-O-Matic-Menu-Settings Änderungen am aktuellen Icon speichern? Rotate indices forwards Icon-O-Matic-PathsList Indizes vorwärts rotieren Unassign Path Icon-O-Matic-UnassignPathCmd Pfad lösen load error Icon-O-Matic-SVGImport Ladefehler @@ -147,7 +148,6 @@ Add Transformers Icon-O-Matic-AddTransformersCmd Transformatoren hinzufügen Diamond Icon-O-Matic-StyleTypes Raute Path Icon-O-Matic-PropertyNames Pfad Failed to open the file '%s' as an SVG document.\n\nError: %s Icon-O-Matic-SVGImport Öffen der Datei '%s' als SVG Dokument fehlgeschlagen.\n\nFehler: %s -Discard Icon-O-Matic-Menu-Settings Verwerfen Swatches Icon-O-Matic-Menus Farbfelder Icon-O-Matic-StyleTypes Rotation Icon-O-Matic-PropertyNames Rotation diff --git a/data/catalogs/apps/icon-o-matic/el.catkeys b/data/catalogs/apps/icon-o-matic/el.catkeys index d7286aadfb..faa116e3f4 100644 --- a/data/catalogs/apps/icon-o-matic/el.catkeys +++ b/data/catalogs/apps/icon-o-matic/el.catkeys @@ -1,4 +1,4 @@ -1 greek, modern (1453-) x-vnd.haiku-icon_o_matic 2591538723 +1 greek, modern (1453-) x-vnd.haiku-icon_o_matic 3581603413 Select All Icon-O-Matic-PathManipulator Επιλογή όλων Add Style Icon-O-Matic-AddStylesCmd Προσθήκη Στυλ Color (#%02x%02x%02x) Style name after dropping a color Χρώμα (#%02x%02x%02x) @@ -98,7 +98,6 @@ Pick a color Icon-O-Matic-ColorPicker Διάλεξε ένα χρώμα Quit Icon-O-Matic-Menu-File Έξοδος Export Icon-O-Matic-Menu-File Εξαγωγή No Icon-O-Matic-StyledTextImport Όχι -Save changes to current icon? Icon-O-Matic-Menu-Settings Αποθήκευση ρυθμίσεων στο υπάρχον εικονίδιο; Rotate indices forwards Icon-O-Matic-PathsList Περιστροφή δεικτών προς τα εμπρός Unassign Path Icon-O-Matic-UnassignPathCmd Αφαίρεση μονοπατιού load error Icon-O-Matic-SVGImport σφάλμα φόρτωσης @@ -145,7 +144,6 @@ Add Transformers Icon-O-Matic-AddTransformersCmd Προσθήκη μεταμο Diamond Icon-O-Matic-StyleTypes Διαμάντι Path Icon-O-Matic-PropertyNames Μονοπάτι Failed to open the file '%s' as an SVG document.\n\nError: %s Icon-O-Matic-SVGImport Αδύνατο το άνοιγμα του αρχείου '%s' ως SVG.\n\nΣφάλμα: %s -Discard Icon-O-Matic-Menu-Settings Απόρριψη Swatches Icon-O-Matic-Menus Δείγματα Icon-O-Matic-StyleTypes <μη διαθέσιμο> Rotation Icon-O-Matic-PropertyNames Περιστροφή diff --git a/data/catalogs/apps/icon-o-matic/fi.catkeys b/data/catalogs/apps/icon-o-matic/fi.catkeys index d4018b36e9..de2dcb195b 100644 --- a/data/catalogs/apps/icon-o-matic/fi.catkeys +++ b/data/catalogs/apps/icon-o-matic/fi.catkeys @@ -1,4 +1,4 @@ -1 finnish x-vnd.haiku-icon_o_matic 2079362081 +1 finnish x-vnd.haiku-icon_o_matic 3069426771 Select All Icon-O-Matic-PathManipulator Valitse kaikki Add Style Icon-O-Matic-AddStylesCmd Lisää tyyli Color (#%02x%02x%02x) Style name after dropping a color Väri (#%02x%02x%02x) @@ -99,7 +99,6 @@ Pick a color Icon-O-Matic-ColorPicker Poimi väri Quit Icon-O-Matic-Menu-File Poistu Export Icon-O-Matic-Menu-File Vie No Icon-O-Matic-StyledTextImport Ei -Save changes to current icon? Icon-O-Matic-Menu-Settings Tallenna muutokset nykyiseen kuvakkeeseen? Rotate indices forwards Icon-O-Matic-PathsList Pyöritä osoittimia eteenpäin Unassign Path Icon-O-Matic-UnassignPathCmd Liittämätön polku load error Icon-O-Matic-SVGImport lataa virhe @@ -147,7 +146,6 @@ Add Transformers Icon-O-Matic-AddTransformersCmd Lisää muuntimet Diamond Icon-O-Matic-StyleTypes Vinoneliö Path Icon-O-Matic-PropertyNames Polku Failed to open the file '%s' as an SVG document.\n\nError: %s Icon-O-Matic-SVGImport Tiedoston ’%s’ avaaminen SVG-asiakirjana epäonnistui.\n\nVirhe: %s -Discard Icon-O-Matic-Menu-Settings Hylkää Swatches Icon-O-Matic-Menus Palaset Icon-O-Matic-StyleTypes Rotation Icon-O-Matic-PropertyNames Kierto diff --git a/data/catalogs/apps/icon-o-matic/fr.catkeys b/data/catalogs/apps/icon-o-matic/fr.catkeys index e4745d0566..be28119fb7 100644 --- a/data/catalogs/apps/icon-o-matic/fr.catkeys +++ b/data/catalogs/apps/icon-o-matic/fr.catkeys @@ -1,4 +1,4 @@ -1 french x-vnd.haiku-icon_o_matic 1958317345 +1 french x-vnd.haiku-icon_o_matic 2622191328 Select All Icon-O-Matic-PathManipulator Sélectionner tout Add Style Icon-O-Matic-AddStylesCmd Ajouter un style Color (#%02x%02x%02x) Style name after dropping a color Couleur (#%02x%02x%02x) @@ -12,7 +12,7 @@ New Icon-O-Matic-Menu-File Nouveau Icon-O-Matic might not have interpreted all data from the SVG when it was loaded. By overwriting the original file, this information would now be lost. Icon-O-Matic-SVGExport Icon-O-Matic peut ne pas avoir interprété toutes les données du fichier SVG lors de son importation. En sauvegardant par-dessus le fichier original, ces informations seront perdues. Paste Properties Icon-O-Matic-Properties Coller les propriétés Stroke Transformation Barré -Save Icon Dialog title Enregistrer icône +Save Icon Dialog title Enregistrer l'icône Closed Icon-O-Matic-PropertyNames Fermé Remove Path Icon-O-Matic-RemovePathsCmd Enlever le chemin Add shape with path Icon-O-Matic-Menu-Shape Ajouter une forme avec un chemin @@ -114,7 +114,6 @@ Error: Icon-O-Matic-Exporter Erreur : Diamond Icon-O-Matic-StyleTypes Diamant Path Icon-O-Matic-PropertyNames Chemin Failed to open the file '%s' as an SVG document.\n\nError: %s Icon-O-Matic-SVGImport Impossible d'ouvrir le fichier « %s » en tant que document SVG.\n\nError : %s -Discard Icon-O-Matic-Menu-Settings Abandonner Swatches Icon-O-Matic-Menus Nuancier Icon-O-Matic-StyleTypes Rotation Icon-O-Matic-PropertyNames Rotation diff --git a/data/catalogs/apps/icon-o-matic/hu.catkeys b/data/catalogs/apps/icon-o-matic/hu.catkeys index 87f263dce2..276bb7245a 100644 --- a/data/catalogs/apps/icon-o-matic/hu.catkeys +++ b/data/catalogs/apps/icon-o-matic/hu.catkeys @@ -1,4 +1,4 @@ -1 hungarian x-vnd.haiku-icon_o_matic 2079362081 +1 hungarian x-vnd.haiku-icon_o_matic 3933520036 Select All Icon-O-Matic-PathManipulator Mind kijelölése Add Style Icon-O-Matic-AddStylesCmd Stílus hozzáadása Color (#%02x%02x%02x) Style name after dropping a color Szín (#%02x%02x%02x) @@ -43,6 +43,7 @@ Untitled Icon-O-Matic-Main Névtelen Multi Set Multi Set (property name) Többszörös beállítás any of the other lists to Empty property list - 2nd line a többi listában Save as… Icon-O-Matic-Menu-File Mentés másként… +Don't save Icon-O-Matic-Menu-Settings Ne mentse Change Color Icon-O-Matic-SetColorCmd Szín váltása Style Icon-O-Matic-Menus Stílus Icon-O-Matic-PathCmd <útvonal módosítása> @@ -72,6 +73,7 @@ Undo Icon-O-Matic-Main Visszavonás Click on a shape above Empty transformers list - 1st line Kattintson egy alakzatra Add Shape Icon-O-Matic-AddShapesCmd Alakzat hozzáadása Contour Transformation Körvonal +Save changes to current icon before closing? Icon-O-Matic-Menu-Settings Menti a változtatásokat a jelenlegi ikonba bezárás előtt? Icon-O-Matic-Menu-Edit Perspective Transformation Perspektíva Move Transformer Icon-O-Matic-MoveTransformersCmd Átalakító áthelyezése @@ -99,7 +101,6 @@ Pick a color Icon-O-Matic-ColorPicker Szín kiválasztása Quit Icon-O-Matic-Menu-File Kilépés Export Icon-O-Matic-Menu-File Exportálás No Icon-O-Matic-StyledTextImport Nem -Save changes to current icon? Icon-O-Matic-Menu-Settings Mentsük a jelenlegi ikon változtatásait? Rotate indices forwards Icon-O-Matic-PathsList Forgatás jobbra Unassign Path Icon-O-Matic-UnassignPathCmd Útvonal hozzárendelésének törlése load error Icon-O-Matic-SVGImport betöltési hiba @@ -147,7 +148,6 @@ Add Transformers Icon-O-Matic-AddTransformersCmd Átalakítók hozzáadása Diamond Icon-O-Matic-StyleTypes Rombusz Path Icon-O-Matic-PropertyNames Útvonal Failed to open the file '%s' as an SVG document.\n\nError: %s Icon-O-Matic-SVGImport Nem sikerült SVG dokumentumként megnyitni ezt: '%s'.\n\nHiba: %s -Discard Icon-O-Matic-Menu-Settings Elvetés Swatches Icon-O-Matic-Menus Paletta Icon-O-Matic-StyleTypes Rotation Icon-O-Matic-PropertyNames Elforgatás diff --git a/data/catalogs/apps/icon-o-matic/ja.catkeys b/data/catalogs/apps/icon-o-matic/ja.catkeys index 3dbb7e0ae5..56310a1729 100644 --- a/data/catalogs/apps/icon-o-matic/ja.catkeys +++ b/data/catalogs/apps/icon-o-matic/ja.catkeys @@ -1,4 +1,4 @@ -1 japanese x-vnd.haiku-icon_o_matic 1581984396 +1 japanese x-vnd.haiku-icon_o_matic 3436142351 Select All Icon-O-Matic-PathManipulator すべて選択 Add Style Icon-O-Matic-AddStylesCmd スタイルを追加 Color (#%02x%02x%02x) Style name after dropping a color カラー (#%02x%02x%02x) @@ -43,6 +43,7 @@ Untitled Icon-O-Matic-Main 無題 Multi Set Multi Set (property name) 複数セット any of the other lists to Empty property list - 2nd line 他のリストの中の Save as… Icon-O-Matic-Menu-File 名前を付けて保存… +Don't save Icon-O-Matic-Menu-Settings 保存しない Change Color Icon-O-Matic-SetColorCmd カラーを変更 Style Icon-O-Matic-Menus スタイル Icon-O-Matic-PathCmd <パスを修正> @@ -72,6 +73,7 @@ Undo Icon-O-Matic-Main 元に戻す Click on a shape above Empty transformers list - 1st line 上のシェイプをクリックして Add Shape Icon-O-Matic-AddShapesCmd シェイプを追加 Contour Transformation コンター +Save changes to current icon before closing? Icon-O-Matic-Menu-Settings 閉じる前に作業中のアイコンへの変更を保存しますか? Icon-O-Matic-Menu-Edit <やり直しできるものはありません> Perspective Transformation パースペクティブ Move Transformer Icon-O-Matic-MoveTransformersCmd Transformerを移動 @@ -99,7 +101,6 @@ Pick a color Icon-O-Matic-ColorPicker カラーを選択 Quit Icon-O-Matic-Menu-File 終了 Export Icon-O-Matic-Menu-File エクスポート No Icon-O-Matic-StyledTextImport いいえ -Save changes to current icon? Icon-O-Matic-Menu-Settings 現在のアイコンの変更を保存しますか? Rotate indices forwards Icon-O-Matic-PathsList インデックスを順に辿る Unassign Path Icon-O-Matic-UnassignPathCmd パスの割り当て解除 load error Icon-O-Matic-SVGImport 読み込みエラー @@ -146,7 +147,6 @@ Add Transformers Icon-O-Matic-AddTransformersCmd Transformerを追加 Diamond Icon-O-Matic-StyleTypes ダイヤモンド Path Icon-O-Matic-PropertyNames パス Failed to open the file '%s' as an SVG document.\n\nError: %s Icon-O-Matic-SVGImport ファイル'%s'をSVGドキュメントとして開けませんでした.\n\nエラー: %s -Discard Icon-O-Matic-Menu-Settings 破棄 Swatches Icon-O-Matic-Menus 見本 Icon-O-Matic-StyleTypes <利用できません> Rotation Icon-O-Matic-PropertyNames 回転 diff --git a/data/catalogs/apps/icon-o-matic/lt.catkeys b/data/catalogs/apps/icon-o-matic/lt.catkeys index a2facff081..27979d9a61 100644 --- a/data/catalogs/apps/icon-o-matic/lt.catkeys +++ b/data/catalogs/apps/icon-o-matic/lt.catkeys @@ -1,4 +1,4 @@ -1 lithuanian x-vnd.haiku-icon_o_matic 830768065 +1 lithuanian x-vnd.haiku-icon_o_matic 1820832755 Select All Icon-O-Matic-PathManipulator Pažymėti viską Add Style Icon-O-Matic-AddStylesCmd Pridėti stilių Color (#%02x%02x%02x) Style name after dropping a color Spalva (#%02x%02x%02x) @@ -98,7 +98,6 @@ Pick a color Icon-O-Matic-ColorPicker Parinkite spalvą Quit Icon-O-Matic-Menu-File Baigti darbą Export Icon-O-Matic-Menu-File Eksportuoti No Icon-O-Matic-StyledTextImport Ne -Save changes to current icon? Icon-O-Matic-Menu-Settings Ar norite įrašyti šios piktogramos pakeitimus? Rotate indices forwards Icon-O-Matic-PathsList Perkelti galus pirmyn Unassign Path Icon-O-Matic-UnassignPathCmd Pašalinti kreivės priskyrimą load error Icon-O-Matic-SVGImport įkėlimo klaida @@ -145,7 +144,6 @@ Add Transformers Icon-O-Matic-AddTransformersCmd Pridėti transformatorius Diamond Icon-O-Matic-StyleTypes Rombinis Path Icon-O-Matic-PropertyNames Kreivė Failed to open the file '%s' as an SVG document.\n\nError: %s Icon-O-Matic-SVGImport Nepavyko atverti failo „%s“ kaip SVG dokumento.\n\nKlaida: %s -Discard Icon-O-Matic-Menu-Settings Neįrašyti Swatches Icon-O-Matic-Menus Paletė Icon-O-Matic-StyleTypes Rotation Icon-O-Matic-PropertyNames Pasukimas diff --git a/data/catalogs/apps/icon-o-matic/nl.catkeys b/data/catalogs/apps/icon-o-matic/nl.catkeys index 72d94ba8b9..aaaa630bc6 100644 --- a/data/catalogs/apps/icon-o-matic/nl.catkeys +++ b/data/catalogs/apps/icon-o-matic/nl.catkeys @@ -1,4 +1,4 @@ -1 dutch; flemish x-vnd.haiku-icon_o_matic 2079362081 +1 dutch; flemish x-vnd.haiku-icon_o_matic 3069426771 Select All Icon-O-Matic-PathManipulator Alles selecteren Add Style Icon-O-Matic-AddStylesCmd Stijl toevoegen Color (#%02x%02x%02x) Style name after dropping a color Kleur (#02x%02x%02x) @@ -99,7 +99,6 @@ Pick a color Icon-O-Matic-ColorPicker Kleur kiezen Quit Icon-O-Matic-Menu-File Afsluiten Export Icon-O-Matic-Menu-File Exporteren No Icon-O-Matic-StyledTextImport Nee -Save changes to current icon? Icon-O-Matic-Menu-Settings Wijzigingen voor het huidige icoon opslaan? Rotate indices forwards Icon-O-Matic-PathsList Indices voorwaarts roteren Unassign Path Icon-O-Matic-UnassignPathCmd Pad ontzeggen load error Icon-O-Matic-SVGImport laadfout @@ -147,7 +146,6 @@ Add Transformers Icon-O-Matic-AddTransformersCmd Omzetters toevoegen Diamond Icon-O-Matic-StyleTypes Diamantvormig Path Icon-O-Matic-PropertyNames Pad Failed to open the file '%s' as an SVG document.\n\nError: %s Icon-O-Matic-SVGImport Kon het bestand '%s' niet als SVG-document openen.\n\nFout: %s -Discard Icon-O-Matic-Menu-Settings Verwerpen Swatches Icon-O-Matic-Menus Paletten Icon-O-Matic-StyleTypes Rotation Icon-O-Matic-PropertyNames Rotatie diff --git a/data/catalogs/apps/icon-o-matic/pl.catkeys b/data/catalogs/apps/icon-o-matic/pl.catkeys index 8bbe958367..f9755d1c98 100644 --- a/data/catalogs/apps/icon-o-matic/pl.catkeys +++ b/data/catalogs/apps/icon-o-matic/pl.catkeys @@ -1,4 +1,4 @@ -1 polish x-vnd.haiku-icon_o_matic 2079362081 +1 polish x-vnd.haiku-icon_o_matic 3069426771 Select All Icon-O-Matic-PathManipulator Zaznacz wszystko Add Style Icon-O-Matic-AddStylesCmd Dodanie stylu Color (#%02x%02x%02x) Style name after dropping a color Kolor (#%02x%02x%02x) @@ -99,7 +99,6 @@ Pick a color Icon-O-Matic-ColorPicker Wybierz kolor Quit Icon-O-Matic-Menu-File Wyjdź Export Icon-O-Matic-Menu-File Eksportuj No Icon-O-Matic-StyledTextImport Nie -Save changes to current icon? Icon-O-Matic-Menu-Settings Zapisać zmiany do obecnej ikony? Rotate indices forwards Icon-O-Matic-PathsList Obróć indeksy do przodu Unassign Path Icon-O-Matic-UnassignPathCmd Usunięcie przypisania ścieżki load error Icon-O-Matic-SVGImport błąd ładowania @@ -147,7 +146,6 @@ Add Transformers Icon-O-Matic-AddTransformersCmd Dodanie transformatorów Diamond Icon-O-Matic-StyleTypes Diament Path Icon-O-Matic-PropertyNames Ścieżka Failed to open the file '%s' as an SVG document.\n\nError: %s Icon-O-Matic-SVGImport Nie udało się otworzyć pliku '%s' jako dokument SVG.\n\nBłąd: %s -Discard Icon-O-Matic-Menu-Settings Odrzuć Swatches Icon-O-Matic-Menus Próbki Icon-O-Matic-StyleTypes Rotation Icon-O-Matic-PropertyNames Obrót diff --git a/data/catalogs/apps/icon-o-matic/pt_BR.catkeys b/data/catalogs/apps/icon-o-matic/pt_BR.catkeys index 84894a7320..e80cfa4bf5 100644 --- a/data/catalogs/apps/icon-o-matic/pt_BR.catkeys +++ b/data/catalogs/apps/icon-o-matic/pt_BR.catkeys @@ -1,4 +1,4 @@ -1 portuguese (brazil) x-vnd.haiku-icon_o_matic 2079362081 +1 portuguese (brazil) x-vnd.haiku-icon_o_matic 3933520036 Select All Icon-O-Matic-PathManipulator Selecionar Tudo Add Style Icon-O-Matic-AddStylesCmd Adicionar Estilo Color (#%02x%02x%02x) Style name after dropping a color Cor (#%02x%02x%02x) @@ -43,6 +43,7 @@ Untitled Icon-O-Matic-Main Sem título Multi Set Multi Set (property name) Conjunto Múltiplo any of the other lists to Empty property list - 2nd line qualquer das outras listas para Save as… Icon-O-Matic-Menu-File Salvar como… +Don't save Icon-O-Matic-Menu-Settings Não salvar Change Color Icon-O-Matic-SetColorCmd Alterar Cor Style Icon-O-Matic-Menus Estilo Icon-O-Matic-PathCmd @@ -72,6 +73,7 @@ Undo Icon-O-Matic-Main Desfazer Click on a shape above Empty transformers list - 1st line Clique em uma forma acima Add Shape Icon-O-Matic-AddShapesCmd Adicionar Forma Contour Transformation Contorno +Save changes to current icon before closing? Icon-O-Matic-Menu-Settings Salvar as alterações para o ícone atual antes de fechar? Icon-O-Matic-Menu-Edit Perspective Transformation Perspectiva Move Transformer Icon-O-Matic-MoveTransformersCmd Mover Transformador @@ -99,7 +101,6 @@ Pick a color Icon-O-Matic-ColorPicker Selecionar uma cor Quit Icon-O-Matic-Menu-File Sair Export Icon-O-Matic-Menu-File Exportar No Icon-O-Matic-StyledTextImport Não -Save changes to current icon? Icon-O-Matic-Menu-Settings Salvar alterações no ícone atual? Rotate indices forwards Icon-O-Matic-PathsList Girar índices para a frente Unassign Path Icon-O-Matic-UnassignPathCmd Desatribuir Caminho load error Icon-O-Matic-SVGImport erro ao carregar @@ -147,7 +148,6 @@ Add Transformers Icon-O-Matic-AddTransformersCmd Adicionar Transformadores Diamond Icon-O-Matic-StyleTypes Diamante Path Icon-O-Matic-PropertyNames Caminho Failed to open the file '%s' as an SVG document.\n\nError: %s Icon-O-Matic-SVGImport Falha ao abrir o arquivo '%s' como um documento SVG.\n\nErro: %s -Discard Icon-O-Matic-Menu-Settings Descartar Swatches Icon-O-Matic-Menus Amostras Icon-O-Matic-StyleTypes Rotation Icon-O-Matic-PropertyNames Rotação diff --git a/data/catalogs/apps/icon-o-matic/ro.catkeys b/data/catalogs/apps/icon-o-matic/ro.catkeys index 4b98533224..4fe86227f2 100644 --- a/data/catalogs/apps/icon-o-matic/ro.catkeys +++ b/data/catalogs/apps/icon-o-matic/ro.catkeys @@ -1,4 +1,4 @@ -1 romanian x-vnd.haiku-icon_o_matic 1182041310 +1 romanian x-vnd.haiku-icon_o_matic 2172106000 Select All Icon-O-Matic-PathManipulator Selectează tot Add Style Icon-O-Matic-AddStylesCmd Adaugă stil Color (#%02x%02x%02x) Style name after dropping a color Culoare (#%02x%02x%02x) @@ -98,7 +98,6 @@ Pick a color Icon-O-Matic-ColorPicker Alegeți o culoare Quit Icon-O-Matic-Menu-File Părăsește Export Icon-O-Matic-Menu-File Exportă No Icon-O-Matic-StyledTextImport Nu -Save changes to current icon? Icon-O-Matic-Menu-Settings Se salvează modificările la pictograma curentă? Rotate indices forwards Icon-O-Matic-PathsList Rotește indicii înainte Unassign Path Icon-O-Matic-UnassignPathCmd Înlătură atribuire cale load error Icon-O-Matic-SVGImport eroare de încărcare @@ -145,7 +144,6 @@ Add Transformers Icon-O-Matic-AddTransformersCmd Adaugă transformatori Diamond Icon-O-Matic-StyleTypes Diamant Path Icon-O-Matic-PropertyNames Cale Failed to open the file '%s' as an SVG document.\n\nError: %s Icon-O-Matic-SVGImport A eșuat deschiderea fișierului „%s” ca document SVG.\n\nEroare: %s -Discard Icon-O-Matic-Menu-Settings Ignoră Swatches Icon-O-Matic-Menus Eșantioane Icon-O-Matic-StyleTypes Rotation Icon-O-Matic-PropertyNames Rotație diff --git a/data/catalogs/apps/icon-o-matic/ru.catkeys b/data/catalogs/apps/icon-o-matic/ru.catkeys index 5fae5af33f..5ab37fa343 100644 --- a/data/catalogs/apps/icon-o-matic/ru.catkeys +++ b/data/catalogs/apps/icon-o-matic/ru.catkeys @@ -1,4 +1,4 @@ -1 russian x-vnd.haiku-icon_o_matic 2079362081 +1 russian x-vnd.haiku-icon_o_matic 3069426771 Select All Icon-O-Matic-PathManipulator Выделить всё Add Style Icon-O-Matic-AddStylesCmd Добавить стиль Color (#%02x%02x%02x) Style name after dropping a color Цвет (#%02x%02x%02x) @@ -99,7 +99,6 @@ Pick a color Icon-O-Matic-ColorPicker Выберите цвет Quit Icon-O-Matic-Menu-File Выход Export Icon-O-Matic-Menu-File Экспортировать No Icon-O-Matic-StyledTextImport Нет -Save changes to current icon? Icon-O-Matic-Menu-Settings Сохранить изменения в текущем значке? Rotate indices forwards Icon-O-Matic-PathsList Переместить начало контура вперед Unassign Path Icon-O-Matic-UnassignPathCmd Непринятый контур load error Icon-O-Matic-SVGImport ошибка загрузки @@ -147,7 +146,6 @@ Add Transformers Icon-O-Matic-AddTransformersCmd Добавить трансф Diamond Icon-O-Matic-StyleTypes Ромбовидный Path Icon-O-Matic-PropertyNames Контур Failed to open the file '%s' as an SVG document.\n\nError: %s Icon-O-Matic-SVGImport Не удалось открыть файл '%s' как SVG документ.\n\nError: %s -Discard Icon-O-Matic-Menu-Settings Не сохранять Swatches Icon-O-Matic-Menus Палитра Icon-O-Matic-StyleTypes <недоступно> Rotation Icon-O-Matic-PropertyNames Поворот diff --git a/data/catalogs/apps/icon-o-matic/sk.catkeys b/data/catalogs/apps/icon-o-matic/sk.catkeys index eb5c9c0ff4..0313a6f4af 100644 --- a/data/catalogs/apps/icon-o-matic/sk.catkeys +++ b/data/catalogs/apps/icon-o-matic/sk.catkeys @@ -1,4 +1,4 @@ -1 slovak x-vnd.haiku-icon_o_matic 2079362081 +1 slovak x-vnd.haiku-icon_o_matic 3069426771 Select All Icon-O-Matic-PathManipulator Vybrať všetky Add Style Icon-O-Matic-AddStylesCmd Pridať štýl Color (#%02x%02x%02x) Style name after dropping a color Farba (#%02x%02x%02x) @@ -99,7 +99,6 @@ Pick a color Icon-O-Matic-ColorPicker Vybrať farbu Quit Icon-O-Matic-Menu-File Ukončiť Export Icon-O-Matic-Menu-File Exportovať No Icon-O-Matic-StyledTextImport Nie -Save changes to current icon? Icon-O-Matic-Menu-Settings Uložiť zmeny aktuálnej ikony? Rotate indices forwards Icon-O-Matic-PathsList Otočiť indexy vpred Unassign Path Icon-O-Matic-UnassignPathCmd Zrušiť priradenie cesty load error Icon-O-Matic-SVGImport chyba načítania @@ -147,7 +146,6 @@ Add Transformers Icon-O-Matic-AddTransformersCmd Pridať transformátory Diamond Icon-O-Matic-StyleTypes Diamant Path Icon-O-Matic-PropertyNames Cesta Failed to open the file '%s' as an SVG document.\n\nError: %s Icon-O-Matic-SVGImport Nepodarilo sa otvoriť súbor „%s“ ako dokument SVG.\n\nChyba: %s -Discard Icon-O-Matic-Menu-Settings Zahodiť Swatches Icon-O-Matic-Menus Paleta Icon-O-Matic-StyleTypes Rotation Icon-O-Matic-PropertyNames Otočenie diff --git a/data/catalogs/apps/icon-o-matic/sv.catkeys b/data/catalogs/apps/icon-o-matic/sv.catkeys index d8e3ac31a4..61565290f5 100644 --- a/data/catalogs/apps/icon-o-matic/sv.catkeys +++ b/data/catalogs/apps/icon-o-matic/sv.catkeys @@ -1,4 +1,4 @@ -1 swedish x-vnd.haiku-icon_o_matic 2079362081 +1 swedish x-vnd.haiku-icon_o_matic 3069426771 Select All Icon-O-Matic-PathManipulator Markera allt Add Style Icon-O-Matic-AddStylesCmd Lägg till stil Color (#%02x%02x%02x) Style name after dropping a color Färg (#%02x%02x%02x) @@ -99,7 +99,6 @@ Pick a color Icon-O-Matic-ColorPicker Välj en färg Quit Icon-O-Matic-Menu-File Avsluta Export Icon-O-Matic-Menu-File Exportera No Icon-O-Matic-StyledTextImport Nej -Save changes to current icon? Icon-O-Matic-Menu-Settings Spara ändringarna för aktuell ikon? Rotate indices forwards Icon-O-Matic-PathsList Rotera indexpunkter medurs Unassign Path Icon-O-Matic-UnassignPathCmd Avtilldela bana load error Icon-O-Matic-SVGImport laddningsfel @@ -147,7 +146,6 @@ Add Transformers Icon-O-Matic-AddTransformersCmd Lägg till omvandlare Diamond Icon-O-Matic-StyleTypes Diamant Path Icon-O-Matic-PropertyNames Bana Failed to open the file '%s' as an SVG document.\n\nError: %s Icon-O-Matic-SVGImport Misslyckades att öppna filen '%s' som ett SVG dokument.\n\n Fel: %s -Discard Icon-O-Matic-Menu-Settings Förkasta Swatches Icon-O-Matic-Menus Penslar Icon-O-Matic-StyleTypes Rotation Icon-O-Matic-PropertyNames Rotation diff --git a/data/catalogs/apps/icon-o-matic/uk.catkeys b/data/catalogs/apps/icon-o-matic/uk.catkeys index d76465dbda..fff874a466 100644 --- a/data/catalogs/apps/icon-o-matic/uk.catkeys +++ b/data/catalogs/apps/icon-o-matic/uk.catkeys @@ -1,4 +1,4 @@ -1 ukrainian x-vnd.haiku-icon_o_matic 2591538723 +1 ukrainian x-vnd.haiku-icon_o_matic 3581603413 Select All Icon-O-Matic-PathManipulator Вибрати все Add Style Icon-O-Matic-AddStylesCmd Додати cтиль Color (#%02x%02x%02x) Style name after dropping a color Колір (#%02x%02x%02x) @@ -98,7 +98,6 @@ Pick a color Icon-O-Matic-ColorPicker Вибрати колір Quit Icon-O-Matic-Menu-File Вийти Export Icon-O-Matic-Menu-File Експорт No Icon-O-Matic-StyledTextImport Ні -Save changes to current icon? Icon-O-Matic-Menu-Settings Зберегти зміни для біжучої іконки? Rotate indices forwards Icon-O-Matic-PathsList обертати за годинниковою стрілкою Unassign Path Icon-O-Matic-UnassignPathCmd Відв'язати шлях load error Icon-O-Matic-SVGImport помилка загрузки @@ -145,7 +144,6 @@ Add Transformers Icon-O-Matic-AddTransformersCmd Додати перетвор Diamond Icon-O-Matic-StyleTypes Ромб Path Icon-O-Matic-PropertyNames Шлях Failed to open the file '%s' as an SVG document.\n\nError: %s Icon-O-Matic-SVGImport Не вдалося відкрити файл '%s' Як документ SVG.\n\nПомилка: %s -Discard Icon-O-Matic-Menu-Settings Витягнути Swatches Icon-O-Matic-Menus Узори Icon-O-Matic-StyleTypes <недоступний> Rotation Icon-O-Matic-PropertyNames Обертання diff --git a/data/catalogs/apps/icon-o-matic/zh_Hans.catkeys b/data/catalogs/apps/icon-o-matic/zh_Hans.catkeys index 19a53bed26..0b785ac31d 100644 --- a/data/catalogs/apps/icon-o-matic/zh_Hans.catkeys +++ b/data/catalogs/apps/icon-o-matic/zh_Hans.catkeys @@ -1,4 +1,4 @@ -1 english x-vnd.haiku-icon_o_matic 2079362081 +1 english x-vnd.haiku-icon_o_matic 3933520036 Select All Icon-O-Matic-PathManipulator 全选 Add Style Icon-O-Matic-AddStylesCmd 添加样式 Color (#%02x%02x%02x) Style name after dropping a color 颜色(#%02x%02x%02x) @@ -43,6 +43,7 @@ Untitled Icon-O-Matic-Main 未命名 Multi Set Multi Set (property name) 批量设置 any of the other lists to Empty property list - 2nd line 任何其他列表为 Save as… Icon-O-Matic-Menu-File 保存为... +Don't save Icon-O-Matic-Menu-Settings 不保存 Change Color Icon-O-Matic-SetColorCmd 修改颜色 Style Icon-O-Matic-Menus 样式 Icon-O-Matic-PathCmd <修改路径> @@ -72,6 +73,7 @@ Undo Icon-O-Matic-Main 撤销 Click on a shape above Empty transformers list - 1st line 点击上述模型 Add Shape Icon-O-Matic-AddShapesCmd 添加模型 Contour Transformation 轮廓 +Save changes to current icon before closing? Icon-O-Matic-Menu-Settings 关闭前是否保存当前图标修改? Icon-O-Matic-Menu-Edit <无恢复内容> Perspective Transformation 透视 Move Transformer Icon-O-Matic-MoveTransformersCmd 移动转换 @@ -99,7 +101,6 @@ Pick a color Icon-O-Matic-ColorPicker 选择颜色 Quit Icon-O-Matic-Menu-File 退出 Export Icon-O-Matic-Menu-File 导出 No Icon-O-Matic-StyledTextImport 否 -Save changes to current icon? Icon-O-Matic-Menu-Settings 保存修改到当前图标? Rotate indices forwards Icon-O-Matic-PathsList 顺时针旋转 Unassign Path Icon-O-Matic-UnassignPathCmd 取消路径 load error Icon-O-Matic-SVGImport 加载错误 @@ -147,7 +148,6 @@ Add Transformers Icon-O-Matic-AddTransformersCmd 添加转换器 Diamond Icon-O-Matic-StyleTypes 菱形 Path Icon-O-Matic-PropertyNames 路径 Failed to open the file '%s' as an SVG document.\n\nError: %s Icon-O-Matic-SVGImport 无法以 SVG 格式打开 '%s' 。\n\n错误:%s -Discard Icon-O-Matic-Menu-Settings 放弃 Swatches Icon-O-Matic-Menus 调色板 Icon-O-Matic-StyleTypes <不可用> Rotation Icon-O-Matic-PropertyNames 旋转 diff --git a/data/catalogs/apps/magnify/be.catkeys b/data/catalogs/apps/magnify/be.catkeys index 67d4064dea..91b799858d 100644 --- a/data/catalogs/apps/magnify/be.catkeys +++ b/data/catalogs/apps/magnify/be.catkeys @@ -9,7 +9,7 @@ Info:\n hide/show info - hides/shows all these new features\n note: when sho freeze - freezes/unfreezes magnification of whatever the\n cursor is currently over\n Magnify-Help freeze - блакуе/разблакуе павялiчванне\n дзе бы нi знахадзiўся курсор\n Hide/Show grid Magnify-Main Схаваць/Паказаць сетку magnify: size must be a multiple of 4\n Console magnify: памер павінен быць кратны 4\n -General:\n 32 x 32 - the top left numbers are the number of visible\n pixels (width x height)\n 8 pixels/pixel - represents the number of pixels that are\n used to magnify a pixel\n R:152 G:52 B:10 - the RGB values for the pixel under\n the red square\n Magnify-Help Агульныя:\n 32 x 32 - верхнія левыя лічбы - колькасць бачных\n пікселяў (шырыня x вышыня)\n 8 пікселяў на піксель - паказвае, колькі пікселяў\n выкарыстана, каб павялічыць адзін піксель\n R:152 G:52 B:10 - RGB значэнні пікселя пад чырвоным квадратам\n +General:\n 32 x 32 - the top left numbers are the number of visible\n pixels (width x height)\n 8 pixels/pixel - represents the number of pixels that are\n used to magnify a pixel\n R:152 G:52 B:10 - the RGB values for the pixel under\n the red square\n Magnify-Help Агульныя:\n 32 x 32 - верхнія левыя лічбы - колькасць бачных\n пікселяў (шырыня x вышыня)\n 8 пікселяў на піксель - паказвае, колькі пікселяў\n выкарыстана, каб павялічыць адзін піксель\n R:152 G:52 B:10 - RGB значэнні пікселя пад чырвоным квадратам\n Help Magnify-Main Дапамога Sizing/Resizing:\n make square - sets the width and the height to the larger\n of the two making a square image\n increase/decrease window size - grows or shrinks the window\n size by 4 pixels.\n note: this window can also be resized to any size via the\n resizing region of the window\n increase/decrease pixel size - increases or decreases the number\n of pixels used to magnify a 'real' pixel. Range is 1 to 16.\n Magnify-Help Пазначэнне/Змяненне памеру:\n зрабіць квадратным - прызначае шырыню і вышыню па большаму з бакоў\n і стварае квадратную выяву\n павялічыць/паменшыць памер вакна - расцягвае або сціскае памер\n вакна на 4 пікселя.\n нататка: гэтае вакно таксама можна расцягнуць да любога памеру\n з дапамогай спецыяльнай вобласці ў вакне\n павялічыць/паменшыць памер пікселяў - павялічвае ці паменшвае\n колькасць пікселяў на 'рэальны' піксель. Інтэрвал - з 1 да 16.\n Decrease pixel size Magnify-Main Паменшыць памер пікселяў @@ -20,7 +20,7 @@ Remove a crosshair Magnify-Main Выдаліць перакрыжаванне Freeze/Unfreeze image Magnify-Main Замарозіць/Размарозіць выяву Copy/Save:\n copy - copies the current image to the clipboard\n save - prompts the user for a file to save to and writes out\n the bits of the image\n Magnify-Help Капіяванне/Захаванне:\n капіяваць - капіруе цякучую выяву у буфер\n захаваць - пытае у карыстача файл, у які захоўваць\n і запісвае туды выяву\n Hide/Show info Magnify-Main Схаваць/Паказаць інфармацыю -Navigation:\n arrow keys - move the current selection (rgb indicator or crosshair)\n around 1 pixel at a time\n option-arrow key - moves the mouse location 1 pixel at a time\n x marks the selection - the current selection has an 'x' in it\n Magnify-Help Навігацыя:\n стрэлкі - перамясціць цякучае выдзяленне (індыкатар RGB або перакрыжаванне)\n на 1 піксель за раз\n апцыянальныя стрэлкі - перамяшчае курсор на 1 піксель за раз\n x пазначае выдяленне - цякучае выдзяленне мае 'x'\n +Navigation:\n arrow keys - move the current selection (rgb indicator or crosshair)\n around 1 pixel at a time\n option-arrow key - moves the mouse location 1 pixel at a time\n x marks the selection - the current selection has an 'x' in it\n Magnify-Help Навігацыя:\n стрэлкі - перамясціць цякучае выдзяленне (індыкатар RGB або перакрыжаванне)\n на 1 піксель за раз\n апцыянальныя стрэлкі - перамяшчае курсор на 1 піксель за раз\n x пазначае выдяленне - цякучае выдзяленне мае 'x'\n Save image Magnify-Main Захаваць выяву Increase window size Magnify-Main Павялічыць памер вакна Decrease window size Magnify-Main Паменшыць памер вакна diff --git a/data/catalogs/apps/mail/be.catkeys b/data/catalogs/apps/mail/be.catkeys index 0d5a2366db..2b57a0bf6c 100644 --- a/data/catalogs/apps/mail/be.catkeys +++ b/data/catalogs/apps/mail/be.catkeys @@ -1,4 +1,4 @@ -1 belarusian x-vnd.Be-MAIL 3337401776 +1 belarusian x-vnd.Be-MAIL 233997769 View Mail Агляд %d - Date Mail %d - Дата Attach attributes: Mail Атрыбуты ўкладання: @@ -10,6 +10,7 @@ Edit Mail Правіць Print Mail Друкаваць Mail <няма> New mail message Mail Новае паведамленне +Untitled Mail Без назвы Automatic Mail Аўтаматычна Automatically mark mail as read: Mail Аўтаматычна пазначаць паведамленні як прачытаныя: helpful message Mail карыснае паведамленне @@ -25,7 +26,6 @@ Beginner Mail Спрошчаны Don't save Mail Не захоўваць Expert Mail Поўны Reply account: Mail Акаунт для адказаў: -Discard Mail Адхіліць Message Mail Паведамленне Settings… Mail Наладкі… Reply to sender Mail Адказаць адпраўніку @@ -82,6 +82,7 @@ Only files can be added as attachments. Mail Можна ўкладаць тол Previous message Mail Папярэдняе паведамленне Attachments: Mail Укладанні: Title: Mail Загаловак: + Mail <рахунак ня знойдзены> Find… Mail Знайсці… Accounts… Mail Акаунты… Mail preferences Mail Наладкі Пошты @@ -106,6 +107,7 @@ Close Mail Закрыць No matches Mail Няма супадзенняў The mail_daemon is not running. The message is queued and will be sent when the mail_daemon is started. Mail Сервіс mail_daemon не актыўны. Паведамленне будзе пастаўлена ў чаргу і дасланае пасля таго як гэты сервіс будзе запушчаны наноў. Really delete this signature? This cannot be undone. Mail Сапраўды жадаеце знішчыць подпіс? Гэтую аперацыю немагчыма адмяніць. +Save this message as a draft before closing? Mail Захаваць гэты ліст як чарнавік? Open Mail Адкрыць draft B_USER_DIRECTORY/mail/draft чарнавік Quote Mail Цытата @@ -118,8 +120,8 @@ Remove enclosure Mail Выдаліць укладанне Account: Mail Акаунт: Decoding: Mail Кадаванне: Sorry, could not find an application that supports the 'Person' data type. Mail Выбачайце, але мне не ўдалося знайсці праграму якая можа працаваць с дадзенымі тыпу 'Person'. -Do you wish to send this message before closing? Mail Жадаеце даслаць гэтае паведамленне да таго як закрыеце яго? Delete Mail Выдаліць +Don't send Mail Не дасылаць Leave as '%s' Mail Пакінуць як '%s' Copy Mail Капіяваць Mail couldn't find its dictionary. Mail Немагчыма знайсці слоўнік. @@ -134,7 +136,7 @@ Font: Mail Шрыфт: (Address unavailable) Mail (Адрэс невядомы) Save address Mail Захаваць адрас Queries Mail Запыты -Do you wish to save this message as a draft before closing? Mail Жадаеце захаваць паведамленне ў чарнавіках да таго як закрыеце яго? +Send this message before closing? Mail Даслаць гэты ліст зараз? Save Mail Захаваць Random Mail Выпадковы Close and Mail Закрыць ды diff --git a/data/catalogs/apps/mail/de.catkeys b/data/catalogs/apps/mail/de.catkeys index 577694c120..3c64859f54 100644 --- a/data/catalogs/apps/mail/de.catkeys +++ b/data/catalogs/apps/mail/de.catkeys @@ -1,4 +1,4 @@ -1 german x-vnd.Be-MAIL 2319898213 +1 german x-vnd.Be-MAIL 233997769 View Mail Ansicht %d - Date Mail %d - Datum Attach attributes: Mail Attribute von Anhängen: @@ -26,7 +26,6 @@ Beginner Mail Anfänger Don't save Mail Verwerfen Expert Mail Experte Reply account: Mail Konto zum Beantworten: -Discard Mail Verwerfen Message Mail Nachricht Settings… Mail Einstellungen… Reply to sender Mail Antwort an Absender @@ -108,6 +107,7 @@ Close Mail Schließen No matches Mail Keine Treffer The mail_daemon is not running. The message is queued and will be sent when the mail_daemon is started. Mail Der Nachrichtendienst (mail_daemon) läuft nicht. Die Nachricht wird versendet, sobald der Dienst wieder läuft. Really delete this signature? This cannot be undone. Mail Diese Signatur tatsächlich löschen? Das kann nicht rückgängig gemacht werden. +Save this message as a draft before closing? Mail Nachricht vor dem Schließen als Entwurf speichern? Open Mail Öffnen draft B_USER_DIRECTORY/mail/draft Entwürfe Quote Mail Zitieren @@ -120,8 +120,8 @@ Remove enclosure Mail Anhang entfernen Account: Mail Konto: Decoding: Mail Kodierung: Sorry, could not find an application that supports the 'Person' data type. Mail Es konnte leider keine Anwendung gefunden werden, die den Datentyp 'Person' unterstützt. -Do you wish to send this message before closing? Mail Soll diese Nachricht gesendet werden, bevor sie geschlossen wird? Delete Mail Löschen +Don't send Mail Nicht senden Leave as '%s' Mail Status '%s' belassen Copy Mail Kopieren Mail couldn't find its dictionary. Mail Das Wörterbuch wurde nicht gefunden. @@ -136,7 +136,7 @@ Font: Mail Schriftart: (Address unavailable) Mail (Adresse nicht verfügbar) Save address Mail Adresse speichern Queries Mail Queries -Do you wish to save this message as a draft before closing? Mail Soll die Nachricht als Entwurf gespeichert werden, bevor sie geschlossen wird? +Send this message before closing? Mail Nachricht vor dem Schließen senden? Save Mail Speichern Random Mail Zufällig Close and Mail Schließen und diff --git a/data/catalogs/apps/mail/el.catkeys b/data/catalogs/apps/mail/el.catkeys index ae68a6da53..6357de9c37 100644 --- a/data/catalogs/apps/mail/el.catkeys +++ b/data/catalogs/apps/mail/el.catkeys @@ -1,4 +1,4 @@ -1 greek, modern (1453-) x-vnd.Be-MAIL 2668114830 +1 greek, modern (1453-) x-vnd.Be-MAIL 3165492866 View Mail Προβολή %d - Date Mail %d - Ημερομηνία Attach attributes: Mail Επισύναψη ιδιοτήτων: @@ -24,7 +24,6 @@ Beginner Mail Αρχάριος Don't save Mail Χωρίς αποθήκευση Expert Mail Έμπειρος Reply account: Mail Απάντηση λογαριασμού: -Discard Mail Απόρριψη Message Mail Μήνυμα Reply to sender Mail Απάντηση στον αποστολέα There is no installed handler for URL links. Mail Δεν έχει εγκατασταθεί χειριστής για τις συνδέσεις URL. diff --git a/data/catalogs/apps/mail/fi.catkeys b/data/catalogs/apps/mail/fi.catkeys index 4a28434a03..1ea8587135 100644 --- a/data/catalogs/apps/mail/fi.catkeys +++ b/data/catalogs/apps/mail/fi.catkeys @@ -1,4 +1,4 @@ -1 finnish x-vnd.Be-MAIL 1599879742 +1 finnish x-vnd.Be-MAIL 3366038826 View Mail Näkymä %d - Date Mail %d - Päivämäärä Attach attributes: Mail Liittämisattribuutit: @@ -10,6 +10,7 @@ Edit Mail Muokkaa Print Mail Tulosta Mail New mail message Mail Uusi sähköpostiviesti +Untitled Mail Nimetön Automatic Mail Automaattinen Automatically mark mail as read: Mail Merkitse sähköpostiviesti automaattisesti luetuksi: helpful message Mail hyödyllinen viesti @@ -25,7 +26,6 @@ Beginner Mail Aloittelija Don't save Mail Älä tallenna Expert Mail Asiantuntija Reply account: Mail Vastaustili: -Discard Mail Hylkää Message Mail Viesti Settings… Mail Asetukset… Reply to sender Mail Vastaa lähettäjälle @@ -119,7 +119,6 @@ Remove enclosure Mail Poista liite Account: Mail Tili: Decoding: Mail Purkaminen: Sorry, could not find an application that supports the 'Person' data type. Mail ’Person’-tietotyyppiä tukevan sovelluksen löytäminen epäonnistui. -Do you wish to send this message before closing? Mail Haluatko lähettää tämän viestin ennen sulkemista? Delete Mail Poista Leave as '%s' Mail Jätä arvoksi ’%s’ Copy Mail Kopioi @@ -135,7 +134,6 @@ Font: Mail Kirjasin: (Address unavailable) Mail (Osoite ei ole saatavilla) Save address Mail Tallenna osoite Queries Mail Kyselyt -Do you wish to save this message as a draft before closing? Mail Haluatko tallentaa tämän viestin luonnoksena ennen sulkemista? Save Mail Tallenna Random Mail Satunnainen Close and Mail Sulje ja diff --git a/data/catalogs/apps/mail/fr.catkeys b/data/catalogs/apps/mail/fr.catkeys index fbe602cc7a..6470d9eb92 100644 --- a/data/catalogs/apps/mail/fr.catkeys +++ b/data/catalogs/apps/mail/fr.catkeys @@ -1,4 +1,4 @@ -1 french x-vnd.Be-MAIL 1599879742 +1 french x-vnd.Be-MAIL 233997769 View Mail Vue %d - Date Mail %d - Date Attach attributes: Mail Attributs du fichier joint : @@ -10,6 +10,7 @@ Edit Mail Modifier Print Mail Imprimer Mail New mail message Mail Nouveau courriel +Untitled Mail Sans titre Automatic Mail Automatique Automatically mark mail as read: Mail Marquer automatiquement les courriels lus : helpful message Mail message utile @@ -25,7 +26,6 @@ Beginner Mail Débutant Don't save Mail Ne pas enregistrer Expert Mail Expert Reply account: Mail Compte de réponse : -Discard Mail Ignorer Message Mail Message Settings… Mail Réglages… Reply to sender Mail Répondre à l'expéditeur @@ -107,6 +107,7 @@ Close Mail Fermer No matches Mail Pas de correspondances The mail_daemon is not running. The message is queued and will be sent when the mail_daemon is started. Mail mail_daemon n'est pas démarré. Ce message a été placé en file d'attente et sera envoyé quand mail_daemon sera démarré. Really delete this signature? This cannot be undone. Mail Voulez-vous vraiment effacer cette signature ? Ça ne pourra pas être annulé. +Save this message as a draft before closing? Mail Voulez-vous sauvegarder ce brouillon avant de fermer ? Open Mail Ouvrir draft B_USER_DIRECTORY/mail/draft brouillons Quote Mail Citer @@ -119,8 +120,8 @@ Remove enclosure Mail Enlever la pièce jointe Account: Mail Compte : Decoding: Mail Décodage : Sorry, could not find an application that supports the 'Person' data type. Mail Désolé, aucune application ne peut ouvrir les données de type « Person ». -Do you wish to send this message before closing? Mail Voulez-vous fermer ce message avant de l'envoyer ? Delete Mail Effacer +Don't send Mail Ne pas envoyer Leave as '%s' Mail Laisser « %s » Copy Mail Copier Mail couldn't find its dictionary. Mail Mail n'a pas trouvé son dictionaire. @@ -135,7 +136,7 @@ Font: Mail Police : (Address unavailable) Mail (Adresse non disponible) Save address Mail Enregistrer l'adresse Queries Mail Requêtes -Do you wish to save this message as a draft before closing? Mail Voulez-vous sauvegarder ce message en tant que brouillon avant de le fermer ? +Send this message before closing? Mail Voulez-vous envoyer ce message avant de fermer ? Save Mail Sauvegarder Random Mail Aléatoire Close and Mail Fermer et diff --git a/data/catalogs/apps/mail/hu.catkeys b/data/catalogs/apps/mail/hu.catkeys index eb17ad1e74..cf5d68669a 100644 --- a/data/catalogs/apps/mail/hu.catkeys +++ b/data/catalogs/apps/mail/hu.catkeys @@ -1,4 +1,4 @@ -1 hungarian x-vnd.Be-MAIL 2319898213 +1 hungarian x-vnd.Be-MAIL 233997769 View Mail Nézet %d - Date Mail %d - dátum Attach attributes: Mail Jellemzők csatolása: @@ -26,7 +26,6 @@ Beginner Mail Kezdő Don't save Mail Ne mentse Expert Mail Haladó Reply account: Mail Válaszcím: -Discard Mail Elvet Message Mail Levél Settings… Mail Beállítások… Reply to sender Mail Válasz a feladónak @@ -108,6 +107,7 @@ Close Mail Bezárás No matches Mail Nincs találat The mail_daemon is not running. The message is queued and will be sent when the mail_daemon is started. Mail A mail_daemon nem fut. A levelek akkor lesznek fogadva/küldve ha majd a mail_daemon elindul. Really delete this signature? This cannot be undone. Mail Biztosan törli az aláírást? Ez nem vonható vissza. +Save this message as a draft before closing? Mail Menti ezt az üzenetet piszkozatként bezárás előtt? Open Mail Megnyitás draft B_USER_DIRECTORY/mail/draft piszkozat Quote Mail Idézet @@ -120,8 +120,8 @@ Remove enclosure Mail Melléklet eltávolítása Account: Mail Felhasználói fiók: Decoding: Mail Kódolás: Sorry, could not find an application that supports the 'Person' data type. Mail Sajnálom, de nem található olyan program, ami támogatja a 'Névjegy' formátumot. -Do you wish to send this message before closing? Mail Elküldi az levelet bezárás előtt? Delete Mail Törlés +Don't send Mail Ne küldje Leave as '%s' Mail Hagyja „%s”-ként Copy Mail Másolás Mail couldn't find its dictionary. Mail Nem található a szótár. @@ -136,7 +136,7 @@ Font: Mail Betűtípus: (Address unavailable) Mail (A cím nem elérhető) Save address Mail Cím mentése Queries Mail Lekérdezések -Do you wish to save this message as a draft before closing? Mail Biztosan menti piszkozatként bezárás előtt? +Send this message before closing? Mail Elküldi ezt az üzenetet bezárás előtt? Save Mail Mentés Random Mail Véletlen Close and Mail Bezárás és … diff --git a/data/catalogs/apps/mail/ja.catkeys b/data/catalogs/apps/mail/ja.catkeys index e18f045626..89f7fe4ae1 100644 --- a/data/catalogs/apps/mail/ja.catkeys +++ b/data/catalogs/apps/mail/ja.catkeys @@ -1,4 +1,4 @@ -1 japanese x-vnd.Be-MAIL 2319898213 +1 japanese x-vnd.Be-MAIL 233997769 View Mail 表示 %d - Date Mail %d - 日付 Attach attributes: Mail 属性の添付: @@ -26,7 +26,6 @@ Beginner Mail 初心者 Don't save Mail 保存しない Expert Mail 上級者 Reply account: Mail 返信アカウント: -Discard Mail 破棄 Message Mail メッセージ Settings… Mail 設定… Reply to sender Mail 差出人に返信 @@ -108,6 +107,7 @@ Close Mail 閉じる No matches Mail 一致しません The mail_daemon is not running. The message is queued and will be sent when the mail_daemon is started. Mail メールサービスが起動されていないため、このメッセージは処理待ちとなりメールサービス起動後に処理されます。 Really delete this signature? This cannot be undone. Mail 署名を削除しますか?削除した書名は復元できませんので、ご注意ください。 +Save this message as a draft before closing? Mail 閉じる前にドラフトとして保存しますか? Open Mail 開く draft B_USER_DIRECTORY/mail/draft 下書き Quote Mail 引用符を付ける @@ -120,8 +120,8 @@ Remove enclosure Mail 添付ファイルを削除 Account: Mail アカウント: Decoding: Mail 文字コード: Sorry, could not find an application that supports the 'Person' data type. Mail People データ形式をサポートするアプリケーションが見つかりませんでした。 -Do you wish to send this message before closing? Mail 閉じる前にこのメッセージを送信しますか? Delete Mail 削除 +Don't send Mail 送信しない Leave as '%s' Mail 「%s」のままにする Copy Mail コピー Mail couldn't find its dictionary. Mail スペルチェック用辞書データが見つかりません。 @@ -136,7 +136,7 @@ Font: Mail フォント: (Address unavailable) Mail (アドレスは利用できません) Save address Mail アドレスを保存 Queries Mail クエリ -Do you wish to save this message as a draft before closing? Mail メッセージを閉じる前に下書きとして保存しますか? +Send this message before closing? Mail 閉じる前にこのメッセージを送信しますか? Save Mail 保存 Random Mail ランダム Close and Mail 閉じる diff --git a/data/catalogs/apps/mail/lt.catkeys b/data/catalogs/apps/mail/lt.catkeys index 15d9339e44..acd9c2b87d 100644 --- a/data/catalogs/apps/mail/lt.catkeys +++ b/data/catalogs/apps/mail/lt.catkeys @@ -1,14 +1,16 @@ -1 lithuanian x-vnd.Be-MAIL 596741059 +1 lithuanian x-vnd.Be-MAIL 3366038826 View Mail Rodymas %d - Date Mail %d – data Attach attributes: Mail Pridedamų failų požymių įtraukimas: Inconsistency occurred in the undo/redo buffer. Mail Nesutapimas atšaukti/grąžinti buferyje. An error occurred trying to save the attachment. Mail Bandant įrašyti laiško priedą, įvyko klaida. Copy to new Mail Kopijuoti į naujus +Leave as 'New' Mail Do not translate New - this is non-localizable e-mail status Palikti kaip „New“ Edit Mail Taisa Print Mail Spausdinti Mail New mail message Mail Naujas laiškas +Untitled Mail Be pavadinimo Automatic Mail Nustatyti automatiškai Automatically mark mail as read: Mail Automatiškai žymėti laiškus kaip skaitytus: helpful message Mail naudingas pranešimas @@ -24,7 +26,6 @@ Beginner Mail Naujokas Don't save Mail Neįrašyti Expert Mail Žinovas Reply account: Mail Paskyra rašant atsakymą: -Discard Mail Atmesti Message Mail Laiškas Settings… Mail Nuostatos… Reply to sender Mail Atsakyti siuntėjui @@ -118,7 +119,6 @@ Remove enclosure Mail Pašalinti priedą Account: Mail Paskyra: Decoding: Mail Koduotė: Sorry, could not find an application that supports the 'Person' data type. Mail Apgailestaujame, tačiau nepavyko rasti programos, palaikančios „Person“ tipo failus. -Do you wish to send this message before closing? Mail Ar norite prieš užverami šį laišką išsiųsti? Delete Mail Šalinti Leave as '%s' Mail Palikti kaip „%s“ Copy Mail Kopijuoti @@ -134,7 +134,6 @@ Font: Mail Šriftas: (Address unavailable) Mail (Adresas nenurodytas) Save address Mail Įrašyti adresą Queries Mail Užklausos -Do you wish to save this message as a draft before closing? Mail Ar norite prieš užverdami įrašyti šį laišką kaip juodraštį? Save Mail Įrašyti Random Mail Atsitiktinį Close and Mail Užverti ir diff --git a/data/catalogs/apps/mail/nl.catkeys b/data/catalogs/apps/mail/nl.catkeys index 465f2b828c..025ece4a45 100644 --- a/data/catalogs/apps/mail/nl.catkeys +++ b/data/catalogs/apps/mail/nl.catkeys @@ -1,4 +1,4 @@ -1 dutch; flemish x-vnd.Be-MAIL 1599879742 +1 dutch; flemish x-vnd.Be-MAIL 2646020355 View Mail Bekijken %d - Date Mail %d - Datum Attach attributes: Mail Attributen bijvoegen: @@ -25,7 +25,6 @@ Beginner Mail Beginner Don't save Mail Niet opslaan Expert Mail Expert Reply account: Mail Antwoordaccount: -Discard Mail Verwerpen Message Mail Bericht Settings… Mail Instellingen… Reply to sender Mail Afzender beantwoorden @@ -119,7 +118,6 @@ Remove enclosure Mail Bijlage verwijderen Account: Mail Account: Decoding: Mail Bezig met decoderen: Sorry, could not find an application that supports the 'Person' data type. Mail Sorry, kon geen toepassing vinden die het 'Person'-datatype ondersteunt. -Do you wish to send this message before closing? Mail Wilt u dit bericht versturen voordat u afsluit? Delete Mail Verwijderen Leave as '%s' Mail Behouden als '%s' Copy Mail Kopiëren @@ -135,7 +133,6 @@ Font: Mail Lettertype: (Address unavailable) Mail (Adres niet beschikbaar) Save address Mail Adres opslaan Queries Mail Zoektermen -Do you wish to save this message as a draft before closing? Mail Wilt u dit bericht als concept opslaan voordat u afsluit? Save Mail Opslaan Random Mail Willekeurig Close and Mail Sluiten en diff --git a/data/catalogs/apps/mail/pl.catkeys b/data/catalogs/apps/mail/pl.catkeys index 619bd3fa8d..81dd49ad62 100644 --- a/data/catalogs/apps/mail/pl.catkeys +++ b/data/catalogs/apps/mail/pl.catkeys @@ -1,4 +1,4 @@ -1 polish x-vnd.Be-MAIL 4057420247 +1 polish x-vnd.Be-MAIL 808593564 View Mail Widok %d - Date Mail %d - Data Attach attributes: Mail Dołączaj atrybuty: @@ -26,7 +26,6 @@ Beginner Mail Początkujący Don't save Mail Nie zapisuj Expert Mail Ekspert Reply account: Mail Konto odpowiedzi: -Discard Mail Odrzuć Message Mail Wiadomość Settings… Mail Ustawienia... Reply to sender Mail Odpowiedz nadawcy @@ -119,7 +118,6 @@ Remove enclosure Mail Usuń załącznik Account: Mail Konto: Decoding: Mail Dekodowanie: Sorry, could not find an application that supports the 'Person' data type. Mail Przepraszamy, nie można znaleźć aplikacji która wspiera typ danych "Osoba". -Do you wish to send this message before closing? Mail Czy chcesz wysłać tę wiadomość przed zamknięciem? Delete Mail Usuń Leave as '%s' Mail Pozostaw jako '%s' Copy Mail Skopiuj @@ -135,7 +133,6 @@ Font: Mail Czcionka: (Address unavailable) Mail (Adres niedostępny) Save address Mail Zapisz adres Queries Mail Zapytania -Do you wish to save this message as a draft before closing? Mail Czy chcesz zapisać wiadomość jako szkic przed zamknięciem? Save Mail Zapisz Random Mail Losowe Close and Mail Zamknij i diff --git a/data/catalogs/apps/mail/pt_BR.catkeys b/data/catalogs/apps/mail/pt_BR.catkeys index 95c8908ac2..1b3e9eda7d 100644 --- a/data/catalogs/apps/mail/pt_BR.catkeys +++ b/data/catalogs/apps/mail/pt_BR.catkeys @@ -1,4 +1,4 @@ -1 portuguese (brazil) x-vnd.Be-MAIL 1599879742 +1 portuguese (brazil) x-vnd.Be-MAIL 233997769 View Mail Visualizar %d - Date Mail %d - Data Attach attributes: Mail Anexar Atributos: @@ -10,6 +10,7 @@ Edit Mail Editar Print Mail Imprimir Mail New mail message Mail Nova mensagem de correio +Untitled Mail Sem título Automatic Mail Automático Automatically mark mail as read: Mail Marcar automaticamente correio como lido: helpful message Mail mensagem útil @@ -25,7 +26,6 @@ Beginner Mail Iniciante Don't save Mail Não salvar Expert Mail Especialista Reply account: Mail Responder conta: -Discard Mail Descartar Message Mail Mensagem Settings… Mail Definições… Reply to sender Mail Responder ao remetente @@ -107,6 +107,7 @@ Close Mail Fechar No matches Mail Nenhuma correspondência The mail_daemon is not running. The message is queued and will be sent when the mail_daemon is started. Mail O mail_daemon não está executando. A mensagem está na fila e será enviada quando o mail_daemon iniciar. Really delete this signature? This cannot be undone. Mail Excluir realmente esta assinatura? Isto não poderá ser desfeito. +Save this message as a draft before closing? Mail Salvar esta mensagem como um rascunho antes de fechar? Open Mail Abrir draft B_USER_DIRECTORY/mail/draft rascunho Quote Mail Citar @@ -119,8 +120,8 @@ Remove enclosure Mail Remover compartimento Account: Mail Conta: Decoding: Mail Decodificação: Sorry, could not find an application that supports the 'Person' data type. Mail Desculpe, não foi possível encontrar um aplicativo que suporte o tipo de dados 'Pessoa'. -Do you wish to send this message before closing? Mail Deseja enviar esta mensagem antes de fechar? Delete Mail Excluir +Don't send Mail Não enviar Leave as '%s' Mail Deixar como '%s' Copy Mail Copiar Mail couldn't find its dictionary. Mail O correio não pôde encontrar seu dicionário. @@ -135,7 +136,7 @@ Font: Mail Fonte: (Address unavailable) Mail (Endereço indisponível) Save address Mail Salvar endereço Queries Mail Consultas -Do you wish to save this message as a draft before closing? Mail Deseja salvar esta mensagem como um rascunho antes de fechar? +Send this message before closing? Mail Enviar esta mensagem antes de fechar? Save Mail Salvar Random Mail Aleatório Close and Mail Fechar e diff --git a/data/catalogs/apps/mail/ro.catkeys b/data/catalogs/apps/mail/ro.catkeys index 8d2614bdc5..e115e928a6 100644 --- a/data/catalogs/apps/mail/ro.catkeys +++ b/data/catalogs/apps/mail/ro.catkeys @@ -1,4 +1,4 @@ -1 romanian x-vnd.Be-MAIL 4080240987 +1 romanian x-vnd.Be-MAIL 831414304 View Mail Vizualizare %d - Date Mail %d - Dată Attach attributes: Mail Atașează atribute: @@ -23,7 +23,6 @@ Beginner Mail Începător Don't save Mail Nu salva Expert Mail Expert Reply account: Mail Cont de răspuns: -Discard Mail Ignoră Message Mail Mesaj Reply to sender Mail Răspunde la expeditor There is no installed handler for URL links. Mail Nu există un operator instalat pentru legături URL. @@ -112,7 +111,6 @@ Remove enclosure Mail Elimină contur Account: Mail Cont: Decoding: Mail Decodare: Sorry, could not find an application that supports the 'Person' data type. Mail Îmi pare rău, nu s-a putut găsi o aplicație care suportă tipul de date „Persoană”. -Do you wish to send this message before closing? Mail Doriți să trimiteți acest mesaj înainte de închidere? Delete Mail Șterge Leave as '%s' Mail Menține ca „%s” Copy Mail Copiază @@ -128,7 +126,6 @@ Font: Mail Font: (Address unavailable) Mail (Adresă indisponibilă) Save address Mail Salvează adresa Queries Mail Interogări -Do you wish to save this message as a draft before closing? Mail Doriți să salvați acest mesaj ca o ciornă înainte de închidere? Save Mail Salvează Random Mail Aleator Close and Mail Închide și diff --git a/data/catalogs/apps/mail/ru.catkeys b/data/catalogs/apps/mail/ru.catkeys index ee40b09324..9a4dc32db0 100644 --- a/data/catalogs/apps/mail/ru.catkeys +++ b/data/catalogs/apps/mail/ru.catkeys @@ -1,4 +1,4 @@ -1 russian x-vnd.Be-MAIL 1599879742 +1 russian x-vnd.Be-MAIL 2646020355 View Mail Вид %d - Date Mail %d - Дата Attach attributes: Mail Прикрепление атрибутов: @@ -25,7 +25,6 @@ Beginner Mail Новичок Don't save Mail Не сохранять Expert Mail Эксперт Reply account: Mail Ответить, используя акканут: -Discard Mail Сбросить Message Mail Сообщение Settings… Mail Настройки… Reply to sender Mail Ответить отправителю @@ -119,7 +118,6 @@ Remove enclosure Mail Удалить вложения Account: Mail Аккаунт: Decoding: Mail Кодировка: Sorry, could not find an application that supports the 'Person' data type. Mail Извините, не удалось найти приложение поддерживающее тип файлов 'Персона'. -Do you wish to send this message before closing? Mail Хотите отправить это сообщение перед закрытием? Delete Mail Удалить Leave as '%s' Mail Оставить как '%s' Copy Mail Копия @@ -135,7 +133,6 @@ Font: Mail Шрифт: (Address unavailable) Mail (Адрес недоступен) Save address Mail Сохранить адрес Queries Mail Запросы -Do you wish to save this message as a draft before closing? Mail Сохранить это сообщение как черновик? Save Mail Сохранить Random Mail Случайная Close and Mail Закрыть и diff --git a/data/catalogs/apps/mail/sk.catkeys b/data/catalogs/apps/mail/sk.catkeys index e8f34f882f..12af9c5a02 100644 --- a/data/catalogs/apps/mail/sk.catkeys +++ b/data/catalogs/apps/mail/sk.catkeys @@ -1,4 +1,4 @@ -1 slovak x-vnd.Be-MAIL 1599879742 +1 slovak x-vnd.Be-MAIL 3366038826 View Mail Zobraziť %d - Date Mail %d - Dátum Attach attributes: Mail Pripojiť atribúty: @@ -10,6 +10,7 @@ Edit Mail Upraviť Print Mail Tlačiť Mail <žiadne> New mail message Mail Nová poštová správa +Untitled Mail Bez názvu Automatic Mail Automaticky Automatically mark mail as read: Mail Automaticky označiť poštu ako prečítanú: helpful message Mail užitočná správa @@ -25,7 +26,6 @@ Beginner Mail Začiatočník Don't save Mail Neukladať Expert Mail Expert Reply account: Mail Účet na odpoveď: -Discard Mail Zahodiť Message Mail Správa Settings… Mail Nastavenia… Reply to sender Mail Odpovedať odosielateľovi @@ -119,7 +119,6 @@ Remove enclosure Mail Odstrániť prílohu Account: Mail Účet: Decoding: Mail Dekódovanie: Sorry, could not find an application that supports the 'Person' data type. Mail Ľutujeme, nebola nájdená aplikácia podporujúca dátový typ „Osoba“. -Do you wish to send this message before closing? Mail Želáte si pred zatvorením odoslať túto správu? Delete Mail Zmazať Leave as '%s' Mail Ponechať ako „%s“ Copy Mail Kopírovať @@ -135,7 +134,6 @@ Font: Mail Písmo: (Address unavailable) Mail (Adresa nedostupná) Save address Mail Uložiť adresu Queries Mail Požiadavky -Do you wish to save this message as a draft before closing? Mail Chcete túto správu pred ukončením uložiť medzi rozpísané? Save Mail Uložiť Random Mail Náhodný Close and Mail Zatvoriť a diff --git a/data/catalogs/apps/mail/sv.catkeys b/data/catalogs/apps/mail/sv.catkeys index 1fb54fe4cd..635194e59f 100644 --- a/data/catalogs/apps/mail/sv.catkeys +++ b/data/catalogs/apps/mail/sv.catkeys @@ -1,4 +1,4 @@ -1 swedish x-vnd.Be-MAIL 196678253 +1 swedish x-vnd.Be-MAIL 694056289 View Mail Visa %d - Date Mail %d - Datum Attach attributes: Mail Bifoga attribut: @@ -26,7 +26,6 @@ Beginner Mail Nybörjare Don't save Mail Spara ej Expert Mail Expert Reply account: Mail Konto för att svara på e-post: -Discard Mail Kasta bort Message Mail Meddelande Settings… Mail Inställningar… Reply to sender Mail Svara avsändare diff --git a/data/catalogs/apps/mail/uk.catkeys b/data/catalogs/apps/mail/uk.catkeys index 3acd051bcc..e433bd1640 100644 --- a/data/catalogs/apps/mail/uk.catkeys +++ b/data/catalogs/apps/mail/uk.catkeys @@ -1,4 +1,4 @@ -1 ukrainian x-vnd.Be-MAIL 2794882281 +1 ukrainian x-vnd.Be-MAIL 3841022894 View Mail Вигляд %d - Date Mail %d - Дата Attach attributes: Mail Додати атрибути: @@ -25,7 +25,6 @@ Beginner Mail Початківець Don't save Mail Не зберігати Expert Mail Експерт Reply account: Mail Аккаунт для відповіді: -Discard Mail Завершити Message Mail Повідомлення Reply to sender Mail Відповісти відправникові There is no installed handler for URL links. Mail Не встановлено обробник посилань URL @@ -113,7 +112,6 @@ Remove enclosure Mail Видалити вкладення Account: Mail Аккаунт: Decoding: Mail Розкодування: Sorry, could not find an application that supports the 'Person' data type. Mail Вибачте не знайдено жодного додатка що підтримує дані типу 'Person'. -Do you wish to send this message before closing? Mail Бажаєте відправити лист до закриття? Delete Mail Видалити Leave as '%s' Mail Зберегти як '%s' Copy Mail Копіювати @@ -129,7 +127,6 @@ Font: Mail Шрифт: (Address unavailable) Mail (Адреса недоступна) Save address Mail Зберегти адресу Queries Mail Запити -Do you wish to save this message as a draft before closing? Mail Бажаєте зберегти цей лист як чорновик перед закриттям? Save Mail Зберегти Random Mail Випадковий Close and Mail Закрити і diff --git a/data/catalogs/apps/mail/zh_Hans.catkeys b/data/catalogs/apps/mail/zh_Hans.catkeys index a3a478d515..1fd56486e1 100644 --- a/data/catalogs/apps/mail/zh_Hans.catkeys +++ b/data/catalogs/apps/mail/zh_Hans.catkeys @@ -1,4 +1,4 @@ -1 english x-vnd.Be-MAIL 1599879742 +1 english x-vnd.Be-MAIL 233997769 View Mail 查看 %d - Date Mail %d - 日期 Attach attributes: Mail 附加属性: @@ -10,6 +10,7 @@ Edit Mail 编辑 Print Mail 打印 Mail <无> New mail message Mail 新建邮件 +Untitled Mail 未命名 Automatic Mail 自动 Automatically mark mail as read: Mail 邮件自动标记为“已读”: helpful message Mail 帮助消息 @@ -25,7 +26,6 @@ Beginner Mail 新手 Don't save Mail 不保存 Expert Mail 专家 Reply account: Mail 回复: -Discard Mail 忽略 Message Mail 邮件 Settings… Mail 设置… Reply to sender Mail 回复发件人 @@ -107,6 +107,7 @@ Close Mail 关闭 No matches Mail 无匹配项 The mail_daemon is not running. The message is queued and will be sent when the mail_daemon is started. Mail mail_daemon 没有运行。邮件将会被打包,在mail_daemon启动时将会发送。 Really delete this signature? This cannot be undone. Mail 确定删除标识? 删除的标识将无法被恢复。 +Save this message as a draft before closing? Mail 关闭前是否将消息保存为草稿? Open Mail 打开 draft B_USER_DIRECTORY/mail/draft 草稿箱 Quote Mail 转发 @@ -119,8 +120,8 @@ Remove enclosure Mail 删除格式 Account: Mail 账户: Decoding: Mail 解码: Sorry, could not find an application that supports the 'Person' data type. Mail 对不起,无法找到支持‘个人’数据类型的程序。 -Do you wish to send this message before closing? Mail 关闭之前,是否发送邮件? Delete Mail 删除 +Don't send Mail 不发送 Leave as '%s' Mail 标记为 '%s' Copy Mail 复制 Mail couldn't find its dictionary. Mail 电子邮件无法找到字典。 @@ -135,7 +136,7 @@ Font: Mail 字体: (Address unavailable) Mail (地址不可用) Save address Mail 保存地址 Queries Mail 查询 -Do you wish to save this message as a draft before closing? Mail 关闭之前,是否把邮件保存为草稿? +Send this message before closing? Mail 关闭前是否发送消息? Save Mail 保存 Random Mail 随机 Close and Mail 关闭并且 diff --git a/data/catalogs/apps/mediaconverter/be.catkeys b/data/catalogs/apps/mediaconverter/be.catkeys index 9720b29a40..70495941ad 100644 --- a/data/catalogs/apps/mediaconverter/be.catkeys +++ b/data/catalogs/apps/mediaconverter/be.catkeys @@ -1,4 +1,4 @@ -1 belarusian x-vnd.Haiku-MediaConverter 296071315 +1 belarusian x-vnd.Haiku-MediaConverter 2955071341 Video using parameters form settings MediaConverter Відэа карыстае параметры з наладак Video encoding: MediaConverter Кадаванне відэа: No audio Audio codecs list Няма аўдыё @@ -15,7 +15,6 @@ MediaConverter System name Канвертар медыя No video Video codecs list Няма відэа Duration: MediaConverter-FileInfo Працягласць: OK MediaConverter ОК -Error writing audio frame %Ld MediaConverter Немагчыма запісаць кард %Ld аўдыёпатоку Error converting '%filename' MediaConverter Немагчыма канвертаваць '%filename' Low MediaConverter Нізкая Conversion completed MediaConverter Апрацоўка завершана @@ -30,7 +29,6 @@ Cancel MediaConverter Адмена None available Video codecs Не даступна Conversion cancelled MediaConverter Канвертаванне адменена No file selected MediaConverter-FileInfo Не абрана ні воднага файла -Error writing video frame %Ld MediaConverter Немагчыма запісаць кард %Ld відэапатоку Select this folder MediaConverter Абраць гэтую папку Continue MediaConverter Працяг Encoder parameters MediaConverter-EncoderWindow Параметры кадыроўшчыка @@ -48,7 +46,6 @@ Preview MediaConverter Прагляд File format: MediaConverter Фармат файла: None available Audio codecs Не даступны MediaConverter+:SaveDirectory MediaConverter КанвертарМедыя+:Захаваць папку -Error read audio frame %Ld MediaConverter Немагчыма прачытаць фрэйм %Ld у аўдыёпатоку %.1f kHz %ld channel / %lld frames MediaFileInfo %.1f кГц %ld каналаў / %lld фрэймаў Error launching: %strError% MediaConverter Немагчыма запусціць: %strError% High MediaConverter Найвышэйшая @@ -63,6 +60,5 @@ Video quality: %3d%% MediaConverter Якасць відэа: %3d%% Output folder MediaConverter Папка для выходных файлаў Audio quality: %3d%% MediaConverter Якасць аўдыё: %3d%% An error has occurred reading the file info.\n\nError : MediaConverter-FileInfo Не ўдалося прачытаць інфармацыю пра файл.\n\nПамылка : -Error read video frame %Ld MediaConverter Немагчыма прачытаць фрэйм %Ld у відэапатоку %amountOfFiles files were not recognized as supported media files: MediaConverter %amountOfFiles файлаў не былі прызнаныя як медыя, іх немагчыма апрацаваць: %.1f kHz mono / %lld frames MediaFileInfo %.1f кГц моно / %lld фрэймаў diff --git a/data/catalogs/apps/mediaconverter/de.catkeys b/data/catalogs/apps/mediaconverter/de.catkeys index 4d2cafe45d..fa592c91d1 100644 --- a/data/catalogs/apps/mediaconverter/de.catkeys +++ b/data/catalogs/apps/mediaconverter/de.catkeys @@ -1,4 +1,4 @@ -1 german x-vnd.Haiku-MediaConverter 296071315 +1 german x-vnd.Haiku-MediaConverter 2955071341 Video using parameters form settings MediaConverter Video benutzt die Parameter aus den Einstellungen Video encoding: MediaConverter Videokodierung: No audio Audio codecs list Keine Tonspur @@ -15,7 +15,6 @@ MediaConverter System name Media-Konverter No video Video codecs list Keine Videospur Duration: MediaConverter-FileInfo Dauer: OK MediaConverter OK -Error writing audio frame %Ld MediaConverter Fehler beim Schreiben von Audio-Frame %Ld Error converting '%filename' MediaConverter Fehler beim Konvertieren von '%filename' Low MediaConverter Niedrig Conversion completed MediaConverter Konvertierung abgeschlossen @@ -30,7 +29,6 @@ Cancel MediaConverter Abbrechen None available Video codecs Keine verfügbar Conversion cancelled MediaConverter Konvertierung abgebrochen No file selected MediaConverter-FileInfo Keine Datei ausgewählt -Error writing video frame %Ld MediaConverter Fehler beim Schreiben von Video-Frame %Ld Select this folder MediaConverter Diesen Ordner wählen Continue MediaConverter Fortsetzen Encoder parameters MediaConverter-EncoderWindow Encoder-Parameter @@ -48,7 +46,6 @@ Preview MediaConverter Vorschau File format: MediaConverter Dateiformat: None available Audio codecs Keine verfügbar MediaConverter+:SaveDirectory MediaConverter Media-Konverter+:SaveDirectory -Error read audio frame %Ld MediaConverter Fehler beim Einlesen von Audio-Frame %Ld %.1f kHz %ld channel / %lld frames MediaFileInfo %.1f kHz %ld Kanal / %lld Frames Error launching: %strError% MediaConverter Fehler beim Start: %strError% High MediaConverter Hoch @@ -63,6 +60,5 @@ Video quality: %3d%% MediaConverter Videoqualität: %3d%% Output folder MediaConverter Ausgabeordner Audio quality: %3d%% MediaConverter Tonqualität: %3d%% An error has occurred reading the file info.\n\nError : MediaConverter-FileInfo Es ist ein Fehler beim Lesen der Dateiinformationen aufgetreten.\n\nFehler: -Error read video frame %Ld MediaConverter Fehler beim Einlesen von Video-Frame %Ld %amountOfFiles files were not recognized as supported media files: MediaConverter %amountOfFiles Dateien scheinen keine unterstützten Mediadateien zu sein: %.1f kHz mono / %lld frames MediaFileInfo %.1f kHz Mono / %lld Frames diff --git a/data/catalogs/apps/mediaconverter/el.catkeys b/data/catalogs/apps/mediaconverter/el.catkeys index 164886788e..50442adce1 100644 --- a/data/catalogs/apps/mediaconverter/el.catkeys +++ b/data/catalogs/apps/mediaconverter/el.catkeys @@ -1,4 +1,4 @@ -1 greek, modern (1453-) x-vnd.Haiku-MediaConverter 3564609505 +1 greek, modern (1453-) x-vnd.Haiku-MediaConverter 1928642235 Video using parameters form settings MediaConverter Βίντεο χρησιμοποιόντας τις ρυθμίσεις Video encoding: MediaConverter Κωδικοποίηση βίντεο: No audio Audio codecs list Χωρίς ήχο @@ -15,7 +15,6 @@ MediaConverter System name Μετατροπέας Μέσων No video Video codecs list Χωρίς βίντεο Duration: MediaConverter-FileInfo Διάρκεια: OK MediaConverter Εντάξει -Error writing audio frame %Ld MediaConverter Σφάλμα κατά την εγγραφή του καρέ ήχου %Ld Error converting '%filename' MediaConverter Σφάλμα κατά τη μετατροπή του '%filename' Low MediaConverter Χαμηλή Conversion completed MediaConverter Η μετατροπή ολοκληρώθηκε @@ -29,7 +28,6 @@ Cancel MediaConverter Άκυρο None available Video codecs Κανένα διαθέσιμο Conversion cancelled MediaConverter Η μετατροπή ακυρώθηκε No file selected MediaConverter-FileInfo Δεν επιλέχτηκε αρχείο -Error writing video frame %Ld MediaConverter Σφάλμα κατά την εγγραφή του καρε βίντεο %Ld Select this folder MediaConverter Επιλέξτε αυτό τον φάκελο Continue MediaConverter Συνέχεια Encoder parameters MediaConverter-EncoderWindow Encoder parameters @@ -47,7 +45,6 @@ Preview MediaConverter Προεπισκόπηση File format: MediaConverter Μορφή αρχείου: None available Audio codecs Κανένα διαθέσιμο MediaConverter+:SaveDirectory MediaConverter ΜετατροπέαςΠολυμέσων+:ΑποθήκευσηΚαταλόγου -Error read audio frame %Ld MediaConverter Σφάλμα κατά την ανάγνωση του καρέ ήχου %Ld %.1f kHz %ld channel / %lld frames MediaFileInfo %.1f kHz %ld κανάλι/ %lld καρέ Error launching: %strError% MediaConverter Σφάλμα κατά την εκτέλεση του: %strError% High MediaConverter Υψηλή @@ -62,6 +59,5 @@ Video quality: %3d%% MediaConverter Ποιότητα βίντεο: %3d%% Output folder MediaConverter Φάκελος εξαγωγής Audio quality: %3d%% MediaConverter Ποιότητα ήχου: %3d%% An error has occurred reading the file info.\n\nError : MediaConverter-FileInfo Προέκυψε ένα σφάλμα κατά την ανάγνωση των πληροφοριών του αρχείου.\n\nΣφάλμα: -Error read video frame %Ld MediaConverter Σφάλμα κατά την ανάγνωση του καρέ βίντεο %Ld %amountOfFiles files were not recognized as supported media files: MediaConverter Τα %amountOfFiles αρχεία δεν αναγνωρίστηκαν ως υποστηριζόμενα αρχεία πολυμέσων: %.1f kHz mono / %lld frames MediaFileInfo %.1f kHz mono / %lld καρέ diff --git a/data/catalogs/apps/mediaconverter/fi.catkeys b/data/catalogs/apps/mediaconverter/fi.catkeys index 784b191795..85b5b8d8d7 100644 --- a/data/catalogs/apps/mediaconverter/fi.catkeys +++ b/data/catalogs/apps/mediaconverter/fi.catkeys @@ -1,4 +1,4 @@ -1 finnish x-vnd.Haiku-MediaConverter 296071315 +1 finnish x-vnd.Haiku-MediaConverter 2955071341 Video using parameters form settings MediaConverter Video käyttäen parametreja muotoasetuksiin Video encoding: MediaConverter Videokoodaus: No audio Audio codecs list Ei ääntä @@ -15,7 +15,6 @@ MediaConverter System name Mediamuunnin No video Video codecs list Ei videota Duration: MediaConverter-FileInfo Kesto: OK MediaConverter Valmis -Error writing audio frame %Ld MediaConverter Virhe kirjoitettaessa äänikehystä %Ld Error converting '%filename' MediaConverter Virhe muunnettaessa tiedostoa ’%filename’ Low MediaConverter Alhainen Conversion completed MediaConverter Muunnos valmis @@ -30,7 +29,6 @@ Cancel MediaConverter Peru None available Video codecs Ei mitään saatavilla Conversion cancelled MediaConverter Muunnos peruttu No file selected MediaConverter-FileInfo Ei tiedostoa valittuna -Error writing video frame %Ld MediaConverter Virhe kirjoitettaessa videokehystä %Ld Select this folder MediaConverter Valitse tämä kansio Continue MediaConverter Jatka Encoder parameters MediaConverter-EncoderWindow Koodausparametrit @@ -48,7 +46,6 @@ Preview MediaConverter Esikatselu File format: MediaConverter Tiedostomuoto: None available Audio codecs Ei mitään saatavilla MediaConverter+:SaveDirectory MediaConverter Mediamuunnin+:Tallenna hakemisto -Error read audio frame %Ld MediaConverter Virhe luettaessa äänikehystä %Ld %.1f kHz %ld channel / %lld frames MediaFileInfo %.1f kHz %ld kanava / %lld kehystä Error launching: %strError% MediaConverter Virhe käynnistettäessä: %strError% High MediaConverter Korkea @@ -63,6 +60,5 @@ Video quality: %3d%% MediaConverter Videolaatu: %3d%% Output folder MediaConverter Tulostekansio Audio quality: %3d%% MediaConverter Äänen laatu: %3d%% An error has occurred reading the file info.\n\nError : MediaConverter-FileInfo Tapahtui virhe luettaessa tiedostotietoja.\n\nVirhe : -Error read video frame %Ld MediaConverter Virheellisesti luettu videokehys %Ld %amountOfFiles files were not recognized as supported media files: MediaConverter %amountOfFiles-tiedostoja ei tunnistettu tuettuina mediatiedostoina: %.1f kHz mono / %lld frames MediaFileInfo %.1f kHz mono / %lld kehystä diff --git a/data/catalogs/apps/mediaconverter/fr.catkeys b/data/catalogs/apps/mediaconverter/fr.catkeys index 908ac58cf8..f89c3dc5dc 100644 --- a/data/catalogs/apps/mediaconverter/fr.catkeys +++ b/data/catalogs/apps/mediaconverter/fr.catkeys @@ -1,4 +1,4 @@ -1 french x-vnd.Haiku-MediaConverter 296071315 +1 french x-vnd.Haiku-MediaConverter 2955071341 Video using parameters form settings MediaConverter La vidéo utilise les paramètres de réglages Video encoding: MediaConverter Encodage vidéo : No audio Audio codecs list Pas de son @@ -15,7 +15,6 @@ MediaConverter System name MédiaConvertisseur No video Video codecs list Pas de vidéo Duration: MediaConverter-FileInfo Durée : OK MediaConverter OK -Error writing audio frame %Ld MediaConverter Erreur d'écriture de l'échantillons audio %Ld Error converting '%filename' MediaConverter Erreur à la conversion de « %filename » Low MediaConverter Basse Conversion completed MediaConverter Conversion achevée @@ -30,7 +29,6 @@ Cancel MediaConverter Annuler None available Video codecs Aucun disponible Conversion cancelled MediaConverter Conversion annulée No file selected MediaConverter-FileInfo Aucun fichier sélectionné -Error writing video frame %Ld MediaConverter Erreur d'écriture de la trame vidéo %Ld Select this folder MediaConverter Sélectionner ce dossier Continue MediaConverter Continuer Encoder parameters MediaConverter-EncoderWindow Paramètres d'encodage @@ -48,7 +46,6 @@ Preview MediaConverter Aperçu File format: MediaConverter Format de fichier : None available Audio codecs Aucun disponible MediaConverter+:SaveDirectory MediaConverter MédiaConvertisseur+ : Dossier d'enregistrement -Error read audio frame %Ld MediaConverter Erreur de lecture de l'échantillons audio %Ld %.1f kHz %ld channel / %lld frames MediaFileInfo %.1f kHz %ld canaux / %Ld échantillons Error launching: %strError% MediaConverter Erreur de lancement : %strError% High MediaConverter Haute @@ -63,6 +60,5 @@ Video quality: %3d%% MediaConverter Qualité vidéo : %3d%% Output folder MediaConverter Dossier de sortie Audio quality: %3d%% MediaConverter Qualité audio : %3d%% An error has occurred reading the file info.\n\nError : MediaConverter-FileInfo Une erreur est survenue lors de la lecture des informations du fichier.\n\nErreur : -Error read video frame %Ld MediaConverter Erreur de lecture de l'image vidéo %Ld %amountOfFiles files were not recognized as supported media files: MediaConverter %amountOfFiles fichiers ne sont pas des médias reconnus pour être pris en charge : %.1f kHz mono / %lld frames MediaFileInfo %.1f kHz mono / %Ld échantillons diff --git a/data/catalogs/apps/mediaconverter/hi.catkeys b/data/catalogs/apps/mediaconverter/hi.catkeys index 9ed8a27d17..3252a3046f 100644 --- a/data/catalogs/apps/mediaconverter/hi.catkeys +++ b/data/catalogs/apps/mediaconverter/hi.catkeys @@ -1,4 +1,4 @@ -1 hindi x-vnd.Haiku-MediaConverter 2083427598 +1 hindi x-vnd.Haiku-MediaConverter 2627948724 Video using parameters form settings MediaConverter विडियो जो पारामीटर फॉर्म सेट्टिंग इस्तमाल कर रहें है Video encoding: MediaConverter विडियो एन्कोडिंग: No audio Audio codecs list कोई आवाज नहीं है @@ -15,7 +15,6 @@ MediaConverter System name मीडियाकोन्वेर्टर No video Video codecs list कोई विडियो नहीं Duration: MediaConverter-FileInfo अवधि: OK MediaConverter ठीक है -Error writing audio frame %Ld MediaConverter ऑडियो फरमे लिखने में त्रुटि %Ld Error converting '%filename' MediaConverter कोन्वेर्ट करने में त्रुटि '%filename' Low MediaConverter कम Conversion completed MediaConverter रूपांतरण पूरा हुआ @@ -29,7 +28,6 @@ Cancel MediaConverter रद्द करना None available Video codecs कुछ भी उपलब्ध नहीं है Conversion cancelled MediaConverter कन्वेर्शन रद्द हुआ No file selected MediaConverter-FileInfo कोई भी फ़ाइल चुनी नहीं हुई है -Error writing video frame %Ld MediaConverter विडियो फरेम लिखने में त्रुटि %Ld Select this folder MediaConverter इस फोल्डर को चुने Continue MediaConverter जरी रखें Encoder parameters MediaConverter-EncoderWindow एनकोडर पैरामीटर @@ -47,6 +45,5 @@ Preview MediaConverter प्रेविएव File format: MediaConverter फ़ाइल फॉर्मेट None available Audio codecs कोई उप्लाब्दः नहीं है MediaConverter+:SaveDirectory MediaConverter मीडियाकोन्वेर्टर+:सेवदिरेक्टोरी -Error read audio frame %Ld MediaConverter ऑडियो फरमे पढ़ने में त्रुटि %Ld %.1f kHz %ld channel / %lld frames MediaFileInfo %.1f kHz %ld channel / %lld frames Error launching: %strError% MediaConverter लॉन्च करने में त्रुटि: %strError% diff --git a/data/catalogs/apps/mediaconverter/hu.catkeys b/data/catalogs/apps/mediaconverter/hu.catkeys index 8d82256008..849b63160e 100644 --- a/data/catalogs/apps/mediaconverter/hu.catkeys +++ b/data/catalogs/apps/mediaconverter/hu.catkeys @@ -1,4 +1,4 @@ -1 hungarian x-vnd.Haiku-MediaConverter 296071315 +1 hungarian x-vnd.Haiku-MediaConverter 2955071341 Video using parameters form settings MediaConverter Videó a beállítások paramétereivel Video encoding: MediaConverter Videó kódolása: No audio Audio codecs list Nincs hang @@ -15,7 +15,6 @@ MediaConverter System name Médiaátalakító No video Video codecs list Nincs videó Duration: MediaConverter-FileInfo Időtartam: OK MediaConverter Rendben -Error writing audio frame %Ld MediaConverter Hiba történt a %Ld. hang írása közben Error converting '%filename' MediaConverter Hiba történt a(z) '%filename' fájl átalakítása közben Low MediaConverter Alacsony Conversion completed MediaConverter Átalakítás kész @@ -30,7 +29,6 @@ Cancel MediaConverter Mégse None available Video codecs Nincs elérhető Conversion cancelled MediaConverter Konvertálás megszakítva No file selected MediaConverter-FileInfo Nincs fájl kiválasztva -Error writing video frame %Ld MediaConverter Hiba történt a %Ld. képkocka írása közben Select this folder MediaConverter E mappa kijelölése Continue MediaConverter Folytatás Encoder parameters MediaConverter-EncoderWindow Kódoló paraméterei @@ -48,7 +46,6 @@ Preview MediaConverter Előnézet File format: MediaConverter Fájlformátum: None available Audio codecs Nincs elérhető MediaConverter+:SaveDirectory MediaConverter MediaConverter+:SaveDirectory -Error read audio frame %Ld MediaConverter Hiba történt a %Ld. hang olvasása közben %.1f kHz %ld channel / %lld frames MediaFileInfo %.1f kHz %ld csatorna / %lld képkocka Error launching: %strError% MediaConverter Hiba történt a %strError% indítása közben High MediaConverter Magas @@ -63,6 +60,5 @@ Video quality: %3d%% MediaConverter Videó minősége: %3d%% Output folder MediaConverter Kimeneti mappa Audio quality: %3d%% MediaConverter Audió minősége: %3d%% An error has occurred reading the file info.\n\nError : MediaConverter-FileInfo Hiba történt a fájl beolvasása közben.\n\nHiba: -Error read video frame %Ld MediaConverter Hiba történt a %Ld. képkocka olvasása közben %amountOfFiles files were not recognized as supported media files: MediaConverter %amountOfFiles fájl típusa nem támogatott: %.1f kHz mono / %lld frames MediaFileInfo %.1f kHz mono / %lld képkocka diff --git a/data/catalogs/apps/mediaconverter/ja.catkeys b/data/catalogs/apps/mediaconverter/ja.catkeys index 55cef10f97..fc193d6b63 100644 --- a/data/catalogs/apps/mediaconverter/ja.catkeys +++ b/data/catalogs/apps/mediaconverter/ja.catkeys @@ -1,4 +1,4 @@ -1 japanese x-vnd.Haiku-MediaConverter 296071315 +1 japanese x-vnd.Haiku-MediaConverter 2955071341 Video using parameters form settings MediaConverter 設定のパラメーターを使ったビデオ Video encoding: MediaConverter ビデオエンコーディング: No audio Audio codecs list オーディオ無し @@ -15,7 +15,6 @@ MediaConverter System name メディアコンバーター No video Video codecs list ビデオ無し Duration: MediaConverter-FileInfo 継続時間: OK MediaConverter OK -Error writing audio frame %Ld MediaConverter オーディオフレーム%Ldの書き出し中にエラーが発生しました Error converting '%filename' MediaConverter '%filename'の変換中にエラーが発生しました Low MediaConverter 低い Conversion completed MediaConverter 変換が終了しました @@ -30,7 +29,6 @@ Cancel MediaConverter キャンセル None available Video codecs 利用できません Conversion cancelled MediaConverter 変換はキャンセルされました No file selected MediaConverter-FileInfo ファイルが選択されていません -Error writing video frame %Ld MediaConverter ビデオフレーム %Ld の書き込み時にエラーが発生しました Select this folder MediaConverter このフォルダーを選択 Continue MediaConverter 続ける Encoder parameters MediaConverter-EncoderWindow エンコーターパラメーター @@ -48,7 +46,6 @@ Preview MediaConverter プレビュー File format: MediaConverter ファイルフォーマット: None available Audio codecs 利用できません MediaConverter+:SaveDirectory MediaConverter MediaConverter+:保存先フォルダー -Error read audio frame %Ld MediaConverter オーディオフレーム %Ld の読み取り時にエラーが発生しました %.1f kHz %ld channel / %lld frames MediaFileInfo %.1f kHz %ld チャンネル / %lld フレーム Error launching: %strError% MediaConverter 起動時にエラーが発生しました: %strError% High MediaConverter 高い @@ -63,6 +60,5 @@ Video quality: %3d%% MediaConverter 映像品質: %3d%% Output folder MediaConverter 出力先フォルダー Audio quality: %3d%% MediaConverter 音声品質:%3d%% An error has occurred reading the file info.\n\nError : MediaConverter-FileInfo ファイル情報を読み取る際にエラーが発生しました。\n\nError : -Error read video frame %Ld MediaConverter ビデオフレーム %Ld の読み取り時にエラーが発生しました %amountOfFiles files were not recognized as supported media files: MediaConverter %amountOfFiles 個のファイルがサポートされるメディアファイルとして認識できませんでした: %.1f kHz mono / %lld frames MediaFileInfo %.1f kHz モノラル / %lld フレーム diff --git a/data/catalogs/apps/mediaconverter/lt.catkeys b/data/catalogs/apps/mediaconverter/lt.catkeys index e156bc669b..753ba8e0f3 100644 --- a/data/catalogs/apps/mediaconverter/lt.catkeys +++ b/data/catalogs/apps/mediaconverter/lt.catkeys @@ -1,4 +1,4 @@ -1 lithuanian x-vnd.Haiku-MediaConverter 296071315 +1 lithuanian x-vnd.Haiku-MediaConverter 2955071341 Video using parameters form settings MediaConverter Vaizdo įrašui naudojami nurodyti parametrai Video encoding: MediaConverter Vaizdo kodavimas: No audio Audio codecs list Be garso takelio @@ -15,7 +15,6 @@ MediaConverter System name Medijos keitiklis No video Video codecs list Be vaizdo takelio Duration: MediaConverter-FileInfo Trukmė: OK MediaConverter Gerai -Error writing audio frame %Ld MediaConverter Klaida rašant %Ld–ąjį garso takelio kadrą Error converting '%filename' MediaConverter Klaida konvertuojant „%filename“ Low MediaConverter Žema Conversion completed MediaConverter Konvertavimas baigtas @@ -30,7 +29,6 @@ Cancel MediaConverter Atsisakyti None available Video codecs Nepasiekiama Conversion cancelled MediaConverter Konvertavimas nutrauktas No file selected MediaConverter-FileInfo Nepažymėtas joks failas -Error writing video frame %Ld MediaConverter Klaida rašant %Ld-ąjį vaizdo takelio kadrą Select this folder MediaConverter Rinktis šį aplanką Continue MediaConverter Tęsti Encoder parameters MediaConverter-EncoderWindow Kodavimo parametrai @@ -48,7 +46,6 @@ Preview MediaConverter Peržiūrėti File format: MediaConverter Failo formatas: None available Audio codecs Nepasiekiama MediaConverter+:SaveDirectory MediaConverter Medijos keitiklis: parinkite paskirties aplanką -Error read audio frame %Ld MediaConverter Klaida skaitant %Ld–ąjį garso takelio kadrą %.1f kHz %ld channel / %lld frames MediaFileInfo %.1f kHz, %ld kanalai (-ų), %lld kadrai (-ų) Error launching: %strError% MediaConverter Klaida paleidžiant: %strError% High MediaConverter Aukšta @@ -63,6 +60,5 @@ Video quality: %3d%% MediaConverter Vaizdo takelio kokybė: %3d%% Output folder MediaConverter Paskirties aplankas Audio quality: %3d%% MediaConverter Garso takelio kokybė: %3d%% An error has occurred reading the file info.\n\nError : MediaConverter-FileInfo Skaitant failo informaciją įvyko klaida.\n\nKlaida: -Error read video frame %Ld MediaConverter Klaida skaitant %Ld–ąjį vaizdo takelio kadrą %amountOfFiles files were not recognized as supported media files: MediaConverter Šie %amountOfFiles failai (-ų) nebuvo atpažinti kaip palaikomo formato failai: %.1f kHz mono / %lld frames MediaFileInfo %.1f kHz, mono, %lld kadrai (-ų) diff --git a/data/catalogs/apps/mediaconverter/nl.catkeys b/data/catalogs/apps/mediaconverter/nl.catkeys index f64012651d..3652bf95cf 100644 --- a/data/catalogs/apps/mediaconverter/nl.catkeys +++ b/data/catalogs/apps/mediaconverter/nl.catkeys @@ -1,4 +1,4 @@ -1 dutch; flemish x-vnd.Haiku-MediaConverter 296071315 +1 dutch; flemish x-vnd.Haiku-MediaConverter 2955071341 Video using parameters form settings MediaConverter Video gebruik makend van de gespecifieerde instellingen Video encoding: MediaConverter Videocodering: No audio Audio codecs list Geen audio @@ -15,7 +15,6 @@ MediaConverter System name MediaConverter No video Video codecs list Geen video Duration: MediaConverter-FileInfo Duur: OK MediaConverter OK -Error writing audio frame %Ld MediaConverter Fout bij het schrijven van audioframe %Ld Error converting '%filename' MediaConverter Fout bij het omzetten van '%filename' Low MediaConverter Laag Conversion completed MediaConverter Conversie voltooid @@ -30,7 +29,6 @@ Cancel MediaConverter Annuleren None available Video codecs Geen beschikbaar Conversion cancelled MediaConverter Omzetting geannuleerd No file selected MediaConverter-FileInfo Geen bestand geselecteerd -Error writing video frame %Ld MediaConverter Fout bij het schrijven van videoframe %Ld Select this folder MediaConverter Deze map selecteren Continue MediaConverter Voortzetten Encoder parameters MediaConverter-EncoderWindow Parameters van de encoder @@ -48,7 +46,6 @@ Preview MediaConverter Voorbeeld File format: MediaConverter Bestandsformaat: None available Audio codecs Geen beschikbaar MediaConverter+:SaveDirectory MediaConverter MediaConverter+:OpslagMap -Error read audio frame %Ld MediaConverter Fout bij het lezen van audioframe %Ld %.1f kHz %ld channel / %lld frames MediaFileInfo %.1f kHz %ld kanaal / %lld frames Error launching: %strError% MediaConverter Fout bij het starten: %strError% High MediaConverter Hoog @@ -63,6 +60,5 @@ Video quality: %3d%% MediaConverter Videokwaliteit: %3d%% Output folder MediaConverter Uitvoermap Audio quality: %3d%% MediaConverter Audiokwaliteit: %3d%% An error has occurred reading the file info.\n\nError : MediaConverter-FileInfo Er is een fout opgetreden bij het lezen van de bestandsinformatie.\n\nFout: -Error read video frame %Ld MediaConverter Fout bij het lezen van videoframe %Ld %amountOfFiles files were not recognized as supported media files: MediaConverter %amountOfFiles bestanden werden niet herkend als ondersteunde mediabestanden: %.1f kHz mono / %lld frames MediaFileInfo %.1f kHz mono / %lld frames diff --git a/data/catalogs/apps/mediaconverter/pl.catkeys b/data/catalogs/apps/mediaconverter/pl.catkeys index 7a3252d8b7..6ba33456c7 100644 --- a/data/catalogs/apps/mediaconverter/pl.catkeys +++ b/data/catalogs/apps/mediaconverter/pl.catkeys @@ -1,4 +1,4 @@ -1 polish x-vnd.Haiku-MediaConverter 296071315 +1 polish x-vnd.Haiku-MediaConverter 2955071341 Video using parameters form settings MediaConverter Wideo używa parametrów z ustawień Video encoding: MediaConverter Kodowanie wideo: No audio Audio codecs list Brak dźwięku @@ -15,7 +15,6 @@ MediaConverter System name MediaConverter No video Video codecs list Brak wideo Duration: MediaConverter-FileInfo Długość: OK MediaConverter OK -Error writing audio frame %Ld MediaConverter Błąd zapisu ramki dźwięku %Ld Error converting '%filename' MediaConverter Błąd konwersji '%filename' Low MediaConverter Niska Conversion completed MediaConverter Konwersja ukończona @@ -30,7 +29,6 @@ Cancel MediaConverter Anuluj None available Video codecs Brak Conversion cancelled MediaConverter Konwersja anulowana No file selected MediaConverter-FileInfo Nie wybrano pliku -Error writing video frame %Ld MediaConverter Błąd zapisywania ramki wideo %Ld Select this folder MediaConverter Wybierz ten katalog Continue MediaConverter Kontynuuj Encoder parameters MediaConverter-EncoderWindow Parametry kodeka @@ -48,7 +46,6 @@ Preview MediaConverter Podgląd File format: MediaConverter Format pliku: None available Audio codecs Brak MediaConverter+:SaveDirectory MediaConverter MediaConverter+:SaveDirectory -Error read audio frame %Ld MediaConverter Błąd odczytu ramki dźwięku %Ld %.1f kHz %ld channel / %lld frames MediaFileInfo %.1f kHz %ld kanał/ %lld ramek Error launching: %strError% MediaConverter Błąd uruchamiania: %strError% High MediaConverter Wysoka @@ -63,6 +60,5 @@ Video quality: %3d%% MediaConverter Jakość wideo: %3d%% Output folder MediaConverter Katalog wynikowy Audio quality: %3d%% MediaConverter Jakość dźwięku: %3d%% An error has occurred reading the file info.\n\nError : MediaConverter-FileInfo Wystąpił błąd podczas odczytu informacji o pliku.\n\nBłąd : -Error read video frame %Ld MediaConverter Błąd odczytu ramki wideo %Ld %amountOfFiles files were not recognized as supported media files: MediaConverter %amountOfFiles plików nie zostało rozpoznanych jako wspierane pliki multimedialne: %.1f kHz mono / %lld frames MediaFileInfo %.1f kHz mono / %lld ramek diff --git a/data/catalogs/apps/mediaconverter/pt_BR.catkeys b/data/catalogs/apps/mediaconverter/pt_BR.catkeys index 7b56ba9149..61427ca84a 100644 --- a/data/catalogs/apps/mediaconverter/pt_BR.catkeys +++ b/data/catalogs/apps/mediaconverter/pt_BR.catkeys @@ -1,4 +1,4 @@ -1 portuguese (brazil) x-vnd.Haiku-MediaConverter 296071315 +1 portuguese (brazil) x-vnd.Haiku-MediaConverter 2955071341 Video using parameters form settings MediaConverter Vídeo utilizando definições de forma de parâmetros Video encoding: MediaConverter Codificação de vídeo: No audio Audio codecs list Sem áudio @@ -15,7 +15,6 @@ MediaConverter System name Conversor de Mídia No video Video codecs list Nenhum vídeo Duration: MediaConverter-FileInfo Duração: OK MediaConverter OK -Error writing audio frame %Ld MediaConverter Erro gravando quadro de áudio %Ld Error converting '%filename' MediaConverter Erro ao converter '%filename' Low MediaConverter Baixo Conversion completed MediaConverter Conversão concluída @@ -30,7 +29,6 @@ Cancel MediaConverter Cancelar None available Video codecs Nenhum disponível Conversion cancelled MediaConverter Conversão cancelada No file selected MediaConverter-FileInfo Nenhum arquivo selecionado -Error writing video frame %Ld MediaConverter Erro gravando quadro de vídeo %Ld Select this folder MediaConverter Selecionar esta pasta Continue MediaConverter Continuar Encoder parameters MediaConverter-EncoderWindow Parâmetros do codificador @@ -48,7 +46,6 @@ Preview MediaConverter Pré-visualização File format: MediaConverter Formato de arquivo: None available Audio codecs Nenhum disponível MediaConverter+:SaveDirectory MediaConverter Conversor de Mídia+:Salvar Diretório -Error read audio frame %Ld MediaConverter Erro ao ler quadro de áudio %Ld %.1f kHz %ld channel / %lld frames MediaFileInfo %.1f kHz %ld canal / %lld quadros Error launching: %strError% MediaConverter Erro ao lançar: %strError% High MediaConverter Alto @@ -63,6 +60,5 @@ Video quality: %3d%% MediaConverter Qualidade de vídeo: %3d%% Output folder MediaConverter Pasta de saída Audio quality: %3d%% MediaConverter Qualidade de áudio: %3d%% An error has occurred reading the file info.\n\nError : MediaConverter-FileInfo Um erro ocorreu lendo as informações do arquivo.\n\nErro : -Error read video frame %Ld MediaConverter Erro ao ler quadro de vídeo %Ld %amountOfFiles files were not recognized as supported media files: MediaConverter %amountOfFiles arquivos não foram reconhecidos como arquivos de mídia suportados: %.1f kHz mono / %lld frames MediaFileInfo %.1f kHz mono / %lld quadros diff --git a/data/catalogs/apps/mediaconverter/ro.catkeys b/data/catalogs/apps/mediaconverter/ro.catkeys index 40e94a8b31..fe573fa7e5 100644 --- a/data/catalogs/apps/mediaconverter/ro.catkeys +++ b/data/catalogs/apps/mediaconverter/ro.catkeys @@ -1,4 +1,4 @@ -1 romanian x-vnd.Haiku-MediaConverter 3564609505 +1 romanian x-vnd.Haiku-MediaConverter 1928642235 Video using parameters form settings MediaConverter Video ce utilizează configurările parametrilor de formular Video encoding: MediaConverter Codare video: No audio Audio codecs list Fără audio @@ -15,7 +15,6 @@ MediaConverter System name ConvertorMedia No video Video codecs list Fără video Duration: MediaConverter-FileInfo Durată: OK MediaConverter OK -Error writing audio frame %Ld MediaConverter Eroare la scrierea cadrului audio %Ld Error converting '%filename' MediaConverter Eroare la convertirea „%filename” Low MediaConverter Jos Conversion completed MediaConverter Conversie completă @@ -29,7 +28,6 @@ Cancel MediaConverter Anulează None available Video codecs Nimic disponibil Conversion cancelled MediaConverter Conversie anulată No file selected MediaConverter-FileInfo Niciun fișier selectat -Error writing video frame %Ld MediaConverter Eroare la scrierea cadrului video %Ld Select this folder MediaConverter Selectează acest dosar Continue MediaConverter Continuă Encoder parameters MediaConverter-EncoderWindow Parametri de codor @@ -47,7 +45,6 @@ Preview MediaConverter Previzualizare File format: MediaConverter Format fișier: None available Audio codecs Nimic disponibil MediaConverter+:SaveDirectory MediaConverter ConvertorMedia+:DosarSalvare -Error read audio frame %Ld MediaConverter Eroare la citirea cadrului audio %Ld %.1f kHz %ld channel / %lld frames MediaFileInfo %.1f kHz %ld canal / %lld cadre Error launching: %strError% MediaConverter Eroare la lansare: %strError% High MediaConverter Sus @@ -62,6 +59,5 @@ Video quality: %3d%% MediaConverter Calitate video: %3d%% Output folder MediaConverter Dosar de ieșire Audio quality: %3d%% MediaConverter Calitate audio: %3d%% An error has occurred reading the file info.\n\nError : MediaConverter-FileInfo A apărut o eroare la citirea informațiilor despre fișier.\n\nEroare: -Error read video frame %Ld MediaConverter Eroare la citirea cadrului video %Ld %amountOfFiles files were not recognized as supported media files: MediaConverter %amountOfFiles fișiere nu au fost recunoscute ca fișiere media suportate: %.1f kHz mono / %lld frames MediaFileInfo %.1f kHz mono / %lld cadre diff --git a/data/catalogs/apps/mediaconverter/ru.catkeys b/data/catalogs/apps/mediaconverter/ru.catkeys index 3e7b5b4070..0e8b435053 100644 --- a/data/catalogs/apps/mediaconverter/ru.catkeys +++ b/data/catalogs/apps/mediaconverter/ru.catkeys @@ -1,4 +1,4 @@ -1 russian x-vnd.Haiku-MediaConverter 296071315 +1 russian x-vnd.Haiku-MediaConverter 2955071341 Video using parameters form settings MediaConverter Видео использует параметры из настроек Video encoding: MediaConverter Кодирование видео: No audio Audio codecs list Без аудио @@ -15,7 +15,6 @@ MediaConverter System name Медиаконвертер No video Video codecs list Без видео Duration: MediaConverter-FileInfo Длительность: OK MediaConverter ОК -Error writing audio frame %Ld MediaConverter Ошибка записи аудио кадра %Ld Error converting '%filename' MediaConverter Ошибка конвертации '%filename' Low MediaConverter Низкое Conversion completed MediaConverter Конвертация завершена @@ -30,7 +29,6 @@ Cancel MediaConverter Отмена None available Video codecs Не доступно Conversion cancelled MediaConverter Конвертация отменена No file selected MediaConverter-FileInfo Файл не выбран -Error writing video frame %Ld MediaConverter Ошибка записи видеокадра %Ld Select this folder MediaConverter Выбрать эту папку Continue MediaConverter Продолжить Encoder parameters MediaConverter-EncoderWindow Параметры кодирования @@ -48,7 +46,6 @@ Preview MediaConverter Предпросмотр File format: MediaConverter Формат файла: None available Audio codecs Недоступно MediaConverter+:SaveDirectory MediaConverter Медиаконвертер: выбор папки сохранения -Error read audio frame %Ld MediaConverter Ошибка чтения аудио кадра %Ld %.1f kHz %ld channel / %lld frames MediaFileInfo %.1f кГц каналов: %ld / кадров: %lld Error launching: %strError% MediaConverter Ошибка запуска: %strError% High MediaConverter Высокое @@ -63,6 +60,5 @@ Video quality: %3d%% MediaConverter Качество видео: %3d%% Output folder MediaConverter Сохранять в папку Audio quality: %3d%% MediaConverter Качество аудио: %3d%% An error has occurred reading the file info.\n\nError : MediaConverter-FileInfo Произошла ошибка при чтении информации о файле.\n\nОшибка: -Error read video frame %Ld MediaConverter Ошибка чтения видеокадра %Ld %amountOfFiles files were not recognized as supported media files: MediaConverter %amountOfFiles файлов не были распознаны как поддерживаемые медиа файлы: %.1f kHz mono / %lld frames MediaFileInfo %.1f кГц моно / кадров: %lld diff --git a/data/catalogs/apps/mediaconverter/sk.catkeys b/data/catalogs/apps/mediaconverter/sk.catkeys index 9925f39e79..1a78964596 100644 --- a/data/catalogs/apps/mediaconverter/sk.catkeys +++ b/data/catalogs/apps/mediaconverter/sk.catkeys @@ -1,4 +1,4 @@ -1 slovak x-vnd.Haiku-MediaConverter 296071315 +1 slovak x-vnd.Haiku-MediaConverter 2955071341 Video using parameters form settings MediaConverter Video používajúce parametre z nastavení Video encoding: MediaConverter Kódovanie videa: No audio Audio codecs list Bez zvuku @@ -15,7 +15,6 @@ MediaConverter System name Konvertor multimédií No video Video codecs list Bez videa Duration: MediaConverter-FileInfo Trvanie: OK MediaConverter OK -Error writing audio frame %Ld MediaConverter Chyba pri zápise zvukového rámca %Ld Error converting '%filename' MediaConverter Chyba pri konverzii „%filename“ Low MediaConverter Nízka Conversion completed MediaConverter Konverzia dokončená @@ -30,7 +29,6 @@ Cancel MediaConverter Zrušiť None available Video codecs Žiadny nie je dostupný Conversion cancelled MediaConverter Konverzia zrušená No file selected MediaConverter-FileInfo Žiadny súbor nie je vybraný -Error writing video frame %Ld MediaConverter Chyba pri zápise video rámca %Ld Select this folder MediaConverter Vybrať tento priečinok Continue MediaConverter Poračovať Encoder parameters MediaConverter-EncoderWindow Parametre kódovania @@ -48,7 +46,6 @@ Preview MediaConverter Náhľad File format: MediaConverter Formát súboru: None available Audio codecs Žiadne nie sú dostupné MediaConverter+:SaveDirectory MediaConverter MediaConverter+:AdresárNaUloženie -Error read audio frame %Ld MediaConverter Chyba pri čítaní zvukového rámca %Ld %.1f kHz %ld channel / %lld frames MediaFileInfo %.1f kHz %ld kanál / %lld rámcov Error launching: %strError% MediaConverter Chyba pri spúšťaní: %strError% High MediaConverter Vysoká @@ -63,6 +60,5 @@ Video quality: %3d%% MediaConverter Kvalita videa: %3d%% Output folder MediaConverter Výstupný priečinok Audio quality: %3d%% MediaConverter Kvalita zvuku: %3d%% An error has occurred reading the file info.\n\nError : MediaConverter-FileInfo Vyskytla sa chyba pri čítaní informácií súboru.\n\nChyba: -Error read video frame %Ld MediaConverter Chyba pri čítaní video rámca %Ld %amountOfFiles files were not recognized as supported media files: MediaConverter %amountOfFiles súborov nebolo rozpoznaných ako podporovaný typ multimédia: %.1f kHz mono / %lld frames MediaFileInfo %.1f kHz mono / %lld rámcov diff --git a/data/catalogs/apps/mediaconverter/sv.catkeys b/data/catalogs/apps/mediaconverter/sv.catkeys index 8a8d118933..19cfd8a106 100644 --- a/data/catalogs/apps/mediaconverter/sv.catkeys +++ b/data/catalogs/apps/mediaconverter/sv.catkeys @@ -1,4 +1,4 @@ -1 swedish x-vnd.Haiku-MediaConverter 296071315 +1 swedish x-vnd.Haiku-MediaConverter 2955071341 Video using parameters form settings MediaConverter Video med parametrar från inställningar Video encoding: MediaConverter Videokodning: No audio Audio codecs list Inget ljud @@ -15,7 +15,6 @@ MediaConverter System name MediaKonverterare No video Video codecs list Inga filmer Duration: MediaConverter-FileInfo Speltid: OK MediaConverter OK -Error writing audio frame %Ld MediaConverter Fel vid skrivning av ljudstycke %Ld Error converting '%filename' MediaConverter Fel vid konvertering av '%filename' Low MediaConverter Låg Conversion completed MediaConverter Konverteringen klar @@ -30,7 +29,6 @@ Cancel MediaConverter Avbryt None available Video codecs Inga tillgängliga Conversion cancelled MediaConverter Konverteringen avbröts No file selected MediaConverter-FileInfo Ingen fil vald -Error writing video frame %Ld MediaConverter Fel vid skrivande av bildruta %Ld Select this folder MediaConverter Välj denna mapp Continue MediaConverter Fortsätt Encoder parameters MediaConverter-EncoderWindow Kodningsparametrar @@ -48,7 +46,6 @@ Preview MediaConverter Förhandsvisa File format: MediaConverter Filformat: None available Audio codecs Inte tillgängliga MediaConverter+:SaveDirectory MediaConverter MediaKonverterare+:SaveDirectory -Error read audio frame %Ld MediaConverter Fel vid inläsning av ljudstycke %Ld %.1f kHz %ld channel / %lld frames MediaFileInfo %.1f kHz %ld kanal / %lld rutor Error launching: %strError% MediaConverter Fel vid start: %strError% High MediaConverter Hög @@ -63,6 +60,5 @@ Video quality: %3d%% MediaConverter Videokvalité: %3d%% Output folder MediaConverter Utmapp Audio quality: %3d%% MediaConverter Ljudkvalité: %3d%% An error has occurred reading the file info.\n\nError : MediaConverter-FileInfo Ett fel uppstod vid inläsning av filinformationen.\n\nFel: -Error read video frame %Ld MediaConverter Fel vid inläsning av bildruta %Ld %amountOfFiles files were not recognized as supported media files: MediaConverter %amountOfFiles kändes inte igen som mediafiler: %.1f kHz mono / %lld frames MediaFileInfo %.1f kHz mono / %lld rutor diff --git a/data/catalogs/apps/mediaconverter/uk.catkeys b/data/catalogs/apps/mediaconverter/uk.catkeys index 31d96db84d..7258b61445 100644 --- a/data/catalogs/apps/mediaconverter/uk.catkeys +++ b/data/catalogs/apps/mediaconverter/uk.catkeys @@ -1,4 +1,4 @@ -1 ukrainian x-vnd.Haiku-MediaConverter 3564609505 +1 ukrainian x-vnd.Haiku-MediaConverter 1928642235 Video using parameters form settings MediaConverter Настройки форми використання параметрів відео Video encoding: MediaConverter Кодування відео: No audio Audio codecs list без звуку @@ -15,7 +15,6 @@ MediaConverter System name MediaConverter No video Video codecs list Немає відео Duration: MediaConverter-FileInfo Тривалість: OK MediaConverter Гаразд -Error writing audio frame %Ld MediaConverter Помилка запису аудіо фрагменту %Ld Error converting '%filename' MediaConverter Помилка перетворення '%filename' Low MediaConverter Низька Conversion completed MediaConverter Конверсія завершена @@ -29,7 +28,6 @@ Cancel MediaConverter Відмінити None available Video codecs Недоступний Conversion cancelled MediaConverter Конверсію відмінено No file selected MediaConverter-FileInfo Файлу не вибрано -Error writing video frame %Ld MediaConverter Помилка запису відео фрейму %Ld Select this folder MediaConverter Вибрати цю папку Continue MediaConverter Продовжити Encoder parameters MediaConverter-EncoderWindow Параметри декодера @@ -47,7 +45,6 @@ Preview MediaConverter Попередній перегляд File format: MediaConverter Формат файлу: None available Audio codecs Не доступний жоден MediaConverter+:SaveDirectory MediaConverter MediaConverter+:SaveDirectory -Error read audio frame %Ld MediaConverter Помилка читання аудіо фрейму %Ld %.1f kHz %ld channel / %lld frames MediaFileInfo %.1f kHz %ld каналу / %lld фреймів Error launching: %strError% MediaConverter Помилка підключення: %strError% High MediaConverter Висока @@ -62,6 +59,5 @@ Video quality: %3d%% MediaConverter Якість відео: %3d%% Output folder MediaConverter Вихідна папка Audio quality: %3d%% MediaConverter Якість звуку: %3d%% An error has occurred reading the file info.\n\nError : MediaConverter-FileInfo Сталася помилка при зчитуванні даних про файл.\n\nПомилка : -Error read video frame %Ld MediaConverter Помилка при читанні відео фрейму %Ld %amountOfFiles files were not recognized as supported media files: MediaConverter %amountOfFiles файлів не було розпізнано як підтримувані медіа файли: %.1f kHz mono / %lld frames MediaFileInfo %.1f kHz моно / %lld фреймів diff --git a/data/catalogs/apps/mediaconverter/zh_Hans.catkeys b/data/catalogs/apps/mediaconverter/zh_Hans.catkeys index 0165fe8aef..2e69517e32 100644 --- a/data/catalogs/apps/mediaconverter/zh_Hans.catkeys +++ b/data/catalogs/apps/mediaconverter/zh_Hans.catkeys @@ -1,4 +1,4 @@ -1 english x-vnd.Haiku-MediaConverter 296071315 +1 english x-vnd.Haiku-MediaConverter 2955071341 Video using parameters form settings MediaConverter 视频参数表使用设置 Video encoding: MediaConverter 视频编码: No audio Audio codecs list 无音频 @@ -15,7 +15,6 @@ MediaConverter System name 媒体转换器 No video Video codecs list 无视频 Duration: MediaConverter-FileInfo 持续时间: OK MediaConverter 确定 -Error writing audio frame %Ld MediaConverter 写入音频框架 %LD 错误 Error converting '%filename' MediaConverter 转换 '%filename' 错误 Low MediaConverter 低 Conversion completed MediaConverter 转换结束 @@ -30,7 +29,6 @@ Cancel MediaConverter 取消 None available Video codecs 无可用 Conversion cancelled MediaConverter 转换取消 No file selected MediaConverter-FileInfo 无选中文件 -Error writing video frame %Ld MediaConverter 写入视频框架 %Ld 错误 Select this folder MediaConverter 选中该文件件 Continue MediaConverter 继续 Encoder parameters MediaConverter-EncoderWindow 编码器参数 @@ -48,7 +46,6 @@ Preview MediaConverter 预览 File format: MediaConverter 文件格式: None available Audio codecs 无可用 MediaConverter+:SaveDirectory MediaConverter MediaConverter+:SaveDirectory -Error read audio frame %Ld MediaConverter 读取音频帧 %Ld 错误 %.1f kHz %ld channel / %lld frames MediaFileInfo %.1f kHz %ld 通道 / %lld 帧 Error launching: %strError% MediaConverter 启动错误:%strError% High MediaConverter 高 @@ -63,6 +60,5 @@ Video quality: %3d%% MediaConverter 视频质量:%3d%% Output folder MediaConverter 输出目录 Audio quality: %3d%% MediaConverter 音频质量:%3d%% An error has occurred reading the file info.\n\nError : MediaConverter-FileInfo 读取文件信息错误。\n\n错误: -Error read video frame %Ld MediaConverter 读取视频帧 %Ld 错误 %amountOfFiles files were not recognized as supported media files: MediaConverter %amountOfFiles 文件为不支持的媒体类型: %.1f kHz mono / %lld frames MediaFileInfo %.1f kHz 单声道 / %lld 帧 diff --git a/data/catalogs/apps/people/be.catkeys b/data/catalogs/apps/people/be.catkeys index 109cbf8639..453facf114 100644 --- a/data/catalogs/apps/people/be.catkeys +++ b/data/catalogs/apps/people/be.catkeys @@ -1,4 +1,4 @@ -1 belarusian x-vnd.Be-PEPL 2993050801 +1 belarusian x-vnd.Be-PEPL 2332202134 Edit People Правіць Error People Памылка City People Горад @@ -21,9 +21,9 @@ Nickname People Нік Quit People Выйсці Name People Імя Revert People Вярнуць +Don't save People Не захоўваць Undo People Адмяніць E-mail People Эл. пошта -Save changes before quitting? People Захаваць змены перад выхадам? Load image… People Загрузіць выяву… OK People ОК Remove image People Выдаліць выяву @@ -31,6 +31,7 @@ Launching the FileTypes preflet to configure Person attributes has failed.\n\nEr Home phone People Хатні тэлефон Save as… People Захаваць як… Redo People Перарабіць +Save changes before closing? People Захаваць змены перад закрыццём? Paste People Уставіць Drop an image here,\nor use the contextual menu. People Перацягніце выяву сюды,\nці выкарыстайце кантэкстнае меню. Save People Захаваць diff --git a/data/catalogs/apps/people/de.catkeys b/data/catalogs/apps/people/de.catkeys index c34712c5e3..84e7189e93 100644 --- a/data/catalogs/apps/people/de.catkeys +++ b/data/catalogs/apps/people/de.catkeys @@ -1,4 +1,4 @@ -1 german x-vnd.Be-PEPL 2993050801 +1 german x-vnd.Be-PEPL 2332202134 Edit People Bearbeiten Error People Fehler City People Stadt @@ -21,9 +21,9 @@ Nickname People Spitzname Quit People Beenden Name People Name Revert People Anfangswerte +Don't save People Nicht speichern Undo People Rückgängig E-mail People E-mail -Save changes before quitting? People Änderungen vor dem Beenden speichern? Load image… People Bild laden… OK People OK Remove image People Bild löschen @@ -31,6 +31,7 @@ Launching the FileTypes preflet to configure Person attributes has failed.\n\nEr Home phone People Telefon (Privat) Save as… People Speichern als… Redo People Wiederholen +Save changes before closing? People Änderungen vor dem Schließen speichern? Paste People Einfügen Drop an image here,\nor use the contextual menu. People Bild hier fallen lassen,\noder Kontextmenü nutzen. Save People Speichern diff --git a/data/catalogs/apps/people/el.catkeys b/data/catalogs/apps/people/el.catkeys index 951fc25e24..80587de64e 100644 --- a/data/catalogs/apps/people/el.catkeys +++ b/data/catalogs/apps/people/el.catkeys @@ -1,4 +1,4 @@ -1 greek, modern (1453-) x-vnd.Be-PEPL 2993050801 +1 greek, modern (1453-) x-vnd.Be-PEPL 3273435274 Edit People Επεξεργασία Error People Σφάλμα City People Πόλη @@ -23,7 +23,6 @@ Name People Όνομα Revert People Επαναφόρα Undo People Αναίρεση E-mail People E-Mail -Save changes before quitting? People Αποθήκευση των αλλαγών πριν το κλείσιμο; Load image… People Φόρτωση εικόνας... OK People Εντάξει Remove image People Αφαίρεση εικόνας diff --git a/data/catalogs/apps/people/fi.catkeys b/data/catalogs/apps/people/fi.catkeys index 0d9b90e3db..cae47d9cac 100644 --- a/data/catalogs/apps/people/fi.catkeys +++ b/data/catalogs/apps/people/fi.catkeys @@ -1,4 +1,4 @@ -1 finnish x-vnd.Be-PEPL 2993050801 +1 finnish x-vnd.Be-PEPL 3273435274 Edit People Muokkaa Error People Virhe City People Kaupunki @@ -23,7 +23,6 @@ Name People Nimi Revert People Palauta Undo People Peru E-mail People Sähköposti -Save changes before quitting? People Tallennetaanko muutokset ennen poistumista? Load image… People Lataa kuva… OK People Valmis Remove image People Poista kuva diff --git a/data/catalogs/apps/people/fr.catkeys b/data/catalogs/apps/people/fr.catkeys index f5535ff6bb..af46402665 100644 --- a/data/catalogs/apps/people/fr.catkeys +++ b/data/catalogs/apps/people/fr.catkeys @@ -1,4 +1,4 @@ -1 french x-vnd.Be-PEPL 2993050801 +1 french x-vnd.Be-PEPL 2332202134 Edit People Éditer Error People Erreur City People Ville @@ -21,9 +21,9 @@ Nickname People Surnom Quit People Quitter Name People Nom Revert People Rétablir +Don't save People Ne pas sauvegarder Undo People Annuler E-mail People E-mail -Save changes before quitting? People Voulez-vous enregistrer les changements avant de sortir ? Load image… People Charger une image… OK People OK Remove image People Supprimer l'image @@ -31,6 +31,7 @@ Launching the FileTypes preflet to configure Person attributes has failed.\n\nEr Home phone People Téléphone du domicile Save as… People Enregistrer sous… Redo People Rétablir +Save changes before closing? People Voulez-vous enregistrer les modifications avant de fermer ? Paste People Coller Drop an image here,\nor use the contextual menu. People Déposez une image ici,\nou utilisez le menu contextuel. Save People Enregistrer diff --git a/data/catalogs/apps/people/hi.catkeys b/data/catalogs/apps/people/hi.catkeys index 69600fa16a..be96e5a27b 100644 --- a/data/catalogs/apps/people/hi.catkeys +++ b/data/catalogs/apps/people/hi.catkeys @@ -1,4 +1,4 @@ -1 hindi x-vnd.Be-PEPL 2993050801 +1 hindi x-vnd.Be-PEPL 3273435274 Edit People संपादित करें Error People त्रुटि City People शहर @@ -23,7 +23,6 @@ Name People नाम Revert People वापस लौटाना Undo People पूर्ववत् E-mail People ई मेल करें -Save changes before quitting? People छोड़ने से पहले परिवर्तन सहेजें? Load image… People चित्र को लोड करें... OK People ठीक है Remove image People चित्र को हटाएँ diff --git a/data/catalogs/apps/people/hu.catkeys b/data/catalogs/apps/people/hu.catkeys index 39960313cc..56f9d75494 100644 --- a/data/catalogs/apps/people/hu.catkeys +++ b/data/catalogs/apps/people/hu.catkeys @@ -1,4 +1,4 @@ -1 hungarian x-vnd.Be-PEPL 2993050801 +1 hungarian x-vnd.Be-PEPL 2332202134 Edit People Szerkesztés Error People Hiba City People Város @@ -21,9 +21,9 @@ Nickname People Becenév Quit People Kilépés Name People Név Revert People Visszaállít +Don't save People Ne mentse Undo People Visszavonás E-mail People E-mail -Save changes before quitting? People Kilépés előtt mentsük a változtatásokat? Load image… People Kép betöltése… OK People Rendben Remove image People Kép eltávolítása @@ -31,6 +31,7 @@ Launching the FileTypes preflet to configure Person attributes has failed.\n\nEr Home phone People Otthoni telefon Save as… People Mentés másként… Redo People Újra +Save changes before closing? People Menti a változtatásokat kilépés előtt? Paste People Beillesztés Drop an image here,\nor use the contextual menu. People Húzzon ide egy képet,\nvagy válasszon a menüben. Save People Mentés diff --git a/data/catalogs/apps/people/ja.catkeys b/data/catalogs/apps/people/ja.catkeys index 568250345e..29584d9173 100644 --- a/data/catalogs/apps/people/ja.catkeys +++ b/data/catalogs/apps/people/ja.catkeys @@ -1,4 +1,4 @@ -1 japanese x-vnd.Be-PEPL 2993050801 +1 japanese x-vnd.Be-PEPL 2332202134 Edit People 編集 Error People エラー City People 市町村 @@ -21,9 +21,9 @@ Nickname People ニックネーム Quit People 終了 Name People 名前 Revert People 元に戻す +Don't save People 保存しない Undo People 元に戻す E-mail People E-mail -Save changes before quitting? People 終了前に保存しますか? Load image… People イメージを読み込む… OK People OK Remove image People イメージを削除する @@ -31,6 +31,7 @@ Launching the FileTypes preflet to configure Person attributes has failed.\n\nEr Home phone People 自宅の電話番号 Save as… People 名前を付けて保存… Redo People やり直し +Save changes before closing? People 閉じる前に保存しますか? Paste People 貼り付け Drop an image here,\nor use the contextual menu. People 画像をここにドロップしてください。\nまたは、コンテクストメニューを使ってください。 Save People 保存 diff --git a/data/catalogs/apps/people/lt.catkeys b/data/catalogs/apps/people/lt.catkeys index 4843723e23..0d33f57c8b 100644 --- a/data/catalogs/apps/people/lt.catkeys +++ b/data/catalogs/apps/people/lt.catkeys @@ -1,4 +1,4 @@ -1 lithuanian x-vnd.Be-PEPL 2993050801 +1 lithuanian x-vnd.Be-PEPL 3273435274 Edit People Taisa Error People Klaida City People Miestas @@ -23,7 +23,6 @@ Name People Vardas Revert People Atšaukti pakeitimus Undo People Atšaukti E-mail People El. paštas -Save changes before quitting? People Ar įrašyti pakeitimus prieš baigiant darbą? Load image… People Parinkti paveikslą… OK People Gerai Remove image People Pašalinti paveikslą diff --git a/data/catalogs/apps/people/nl.catkeys b/data/catalogs/apps/people/nl.catkeys index 8a6edc3261..ac69327509 100644 --- a/data/catalogs/apps/people/nl.catkeys +++ b/data/catalogs/apps/people/nl.catkeys @@ -1,4 +1,4 @@ -1 dutch; flemish x-vnd.Be-PEPL 2993050801 +1 dutch; flemish x-vnd.Be-PEPL 3273435274 Edit People Aanpassen Error People Fout City People Stad @@ -23,7 +23,6 @@ Name People Naam Revert People Omkeren Undo People Ongedaan maken E-mail People E-mail -Save changes before quitting? People Veranderingen opslaan voordat u afsluit? Load image… People Afbeelding laden... OK People Oké Remove image People Afbeelding verwijderen diff --git a/data/catalogs/apps/people/pl.catkeys b/data/catalogs/apps/people/pl.catkeys index 6d5c9cc630..85b96bf7e4 100644 --- a/data/catalogs/apps/people/pl.catkeys +++ b/data/catalogs/apps/people/pl.catkeys @@ -1,4 +1,4 @@ -1 polish x-vnd.Be-PEPL 2993050801 +1 polish x-vnd.Be-PEPL 3676386979 Edit People Edytuj Error People Błąd City People Miasto @@ -23,7 +23,6 @@ Name People Imię i nazwisko Revert People Przywróć Undo People Cofnij E-mail People E-mail -Save changes before quitting? People Zapisać zmiany przed wyjściem? Load image… People Wczytaj obraz… OK People OK Remove image People Usuń obraz @@ -31,6 +30,7 @@ Launching the FileTypes preflet to configure Person attributes has failed.\n\nEr Home phone People Telefon domowy Save as… People Zapisz jako… Redo People Powtórz +Save changes before closing? People Czy zapisać zmiany przed zamknięciem? Paste People Wklej Drop an image here,\nor use the contextual menu. People Opuść obraz tutaj,\nlub użyj menu kontekstowego. Save People Zapisz diff --git a/data/catalogs/apps/people/pt_BR.catkeys b/data/catalogs/apps/people/pt_BR.catkeys index 031be7e86f..0321cf402d 100644 --- a/data/catalogs/apps/people/pt_BR.catkeys +++ b/data/catalogs/apps/people/pt_BR.catkeys @@ -1,4 +1,4 @@ -1 portuguese (brazil) x-vnd.Be-PEPL 2993050801 +1 portuguese (brazil) x-vnd.Be-PEPL 2332202134 Edit People Editar Error People Erro City People Cidade @@ -21,9 +21,9 @@ Nickname People Apelido Quit People Sair Name People Nome Revert People Reverter +Don't save People Não salvar Undo People Desfazer E-mail People E-mail -Save changes before quitting? People Salvar mudanças antes de sair? Load image… People Carregar imagem… OK People OK Remove image People Remover imagem @@ -31,6 +31,7 @@ Launching the FileTypes preflet to configure Person attributes has failed.\n\nEr Home phone People Fone residencial Save as… People Salvar como... Redo People Refazer +Save changes before closing? People Salvar mudanças antes de fechar? Paste People Colar Drop an image here,\nor use the contextual menu. People Solte uma imagem aqui,\nou use o menu de contexto. Save People Salvar diff --git a/data/catalogs/apps/people/ro.catkeys b/data/catalogs/apps/people/ro.catkeys index 0dc181afb8..7de3f2bc2b 100644 --- a/data/catalogs/apps/people/ro.catkeys +++ b/data/catalogs/apps/people/ro.catkeys @@ -1,4 +1,4 @@ -1 romanian x-vnd.Be-PEPL 2993050801 +1 romanian x-vnd.Be-PEPL 3273435274 Edit People Editează Error People Eroare City People Oraș @@ -23,7 +23,6 @@ Name People Nume Revert People Revenire Undo People Refă E-mail People Email -Save changes before quitting? People Salvați modificările înainte de părăsire? Load image… People Încarcă imagine... OK People OK Remove image People Elimină imaginea diff --git a/data/catalogs/apps/people/ru.catkeys b/data/catalogs/apps/people/ru.catkeys index 53c47c7b8b..7d340e096b 100644 --- a/data/catalogs/apps/people/ru.catkeys +++ b/data/catalogs/apps/people/ru.catkeys @@ -1,4 +1,4 @@ -1 russian x-vnd.Be-PEPL 2993050801 +1 russian x-vnd.Be-PEPL 3273435274 Edit People Изменить Error People Ошибка City People Город @@ -23,7 +23,6 @@ Name People Имя Revert People Вернуть Undo People Отменить E-mail People E-mail -Save changes before quitting? People Сохранить изменения перед выходом? Load image… People Выбрать рисунок… OK People ОК Remove image People Удалить рисунок diff --git a/data/catalogs/apps/people/sk.catkeys b/data/catalogs/apps/people/sk.catkeys index e1ec3736b2..79e820cb64 100644 --- a/data/catalogs/apps/people/sk.catkeys +++ b/data/catalogs/apps/people/sk.catkeys @@ -1,4 +1,4 @@ -1 slovak x-vnd.Be-PEPL 2993050801 +1 slovak x-vnd.Be-PEPL 3273435274 Edit People Upraviť Error People Chyba City People Mesto @@ -23,7 +23,6 @@ Name People Meno Revert People Vrátiť Undo People Späť E-mail People E-mail -Save changes before quitting? People Uložiť zmeny pred ukončením? Load image… People Načítať obrázok… OK People OK Remove image People Odstrániť obrázok diff --git a/data/catalogs/apps/people/sv.catkeys b/data/catalogs/apps/people/sv.catkeys index 2c24f9aff6..ea945041d6 100644 --- a/data/catalogs/apps/people/sv.catkeys +++ b/data/catalogs/apps/people/sv.catkeys @@ -1,4 +1,4 @@ -1 swedish x-vnd.Be-PEPL 2993050801 +1 swedish x-vnd.Be-PEPL 3273435274 Edit People Redigera Error People Fel City People Stad @@ -23,7 +23,6 @@ Name People Namn Revert People Återställ Undo People Ångra E-mail People E-post -Save changes before quitting? People Spara ändringar innan avslut? Load image… People Välj bild... OK People OK Remove image People Ta bort bild diff --git a/data/catalogs/apps/people/uk.catkeys b/data/catalogs/apps/people/uk.catkeys index 3181335d3a..7eec7a0e88 100644 --- a/data/catalogs/apps/people/uk.catkeys +++ b/data/catalogs/apps/people/uk.catkeys @@ -1,4 +1,4 @@ -1 ukrainian x-vnd.Be-PEPL 2993050801 +1 ukrainian x-vnd.Be-PEPL 3273435274 Edit People Редагувати Error People Помилка City People Місто @@ -23,7 +23,6 @@ Name People Ім'я Revert People Повернути Undo People Cкасувати E-mail People E-mail -Save changes before quitting? People Зберегти настройки перед виходом? Load image… People Завантажити зображення… OK People Гаразд Remove image People Видалити зображення diff --git a/data/catalogs/apps/people/zh_Hans.catkeys b/data/catalogs/apps/people/zh_Hans.catkeys index a128d5a2a6..5c213ab7f2 100644 --- a/data/catalogs/apps/people/zh_Hans.catkeys +++ b/data/catalogs/apps/people/zh_Hans.catkeys @@ -1,4 +1,4 @@ -1 english x-vnd.Be-PEPL 2993050801 +1 english x-vnd.Be-PEPL 2332202134 Edit People 编辑 Error People 错误 City People 城市 @@ -21,9 +21,9 @@ Nickname People 昵称 Quit People 退出 Name People 名字 Revert People 恢复 +Don't save People 不保存 Undo People 取消 E-mail People 电子邮箱 -Save changes before quitting? People 退出前保存更改? Load image… People 载入图像... OK People 确定 Remove image People 删除图像 @@ -31,6 +31,7 @@ Launching the FileTypes preflet to configure Person attributes has failed.\n\nEr Home phone People 家庭电话 Save as… People 保存为... Redo People 重复 +Save changes before closing? People 关闭前是否保存修改? Paste People 粘贴 Drop an image here,\nor use the contextual menu. People 向这里拖动图像,\n或者使用上下文菜单。 Save People 保存 diff --git a/data/catalogs/apps/stylededit/be.catkeys b/data/catalogs/apps/stylededit/be.catkeys index fcef47d268..c734134d11 100644 --- a/data/catalogs/apps/stylededit/be.catkeys +++ b/data/catalogs/apps/stylededit/be.catkeys @@ -1,13 +1,16 @@ -1 belarusian x-vnd.Haiku-StyledEdit 3417936913 +1 belarusian x-vnd.Haiku-StyledEdit 3208803155 StyledEdit System name Стыльны Рэдактар +This file is marked read-only. Save changes to the document \"%s\"? SaveAlert Гэты файл пазначаны толькі для чытання. Захаваць змены ў дакумент \"%s\"? Paste Menus Уставіць OK LoadAlert Так File Menus Файл ??? LoadAlert ??? +Modified StatusView Мадыфікаваны Lines: Statistics Радкоў: Italic Menus Нахілены Left Menus Левы Search backwards FindandReplaceWindow Шукаць ў адваротным накірунку +Unlock file StatusView Разблакаваць Size Menus Памер Save QuitAlert Захаваць Page setup… Menus Наладкі старонкі… @@ -19,21 +22,27 @@ Cancel SaveAlert Адмена Cannot revert, file not found: \"%s\". RevertToSavedAlert Немагчыма вярнуцца, файл \"%s\" ня знойдзены. Case-sensitive FindandReplaceWindow З улікам рэгістру Green Menus Зялёны +Reload NodeMonitorAlerts Перазагрузіць Yellow Menus Жоўты Replace in all windows FindandReplaceWindow Замяняць ва ўсіх вокнах Wrap lines Menus Пераносіць радкі Quit Menus Выйсці +File \"%file%\" was removed by another application, recover it? NodeMonitorAlerts Файл \"%file%\" быў выдалены іншай праграмай, аднавіць яго? Document statistics Statistics Статыстыка дакументу Cancel RevertToSavedAlert Скасаваць +Autodetect Menus Аўтаматычна Document Menus Дакумент Save changes to the document \"%s\"? QuitAlert Захаваць адрэдагаваны дакумент \"%s\"? Edit Menus Рэдагаваць +Revert RevertToSavedAlert Вярнуць Font Menus Шрыфт Replace all FindandReplaceWindow Замяняць усё Statistics… Menus Статыстыка… Default Open_and_SaveAsPanel Прадвызначаны Replace next Menus Замяніць наступны +\"%s\" has unsaved changes.\nRevert it to the last saved version? RevertToSavedAlert \"%s\" мае незахаваныя змены.\nВярнуць яго да раней захаванага стану? Cancel FindandReplaceWindow Адмена +Text encoding Menus Кадоўка Close Menus Закрыць Save SaveAlert Захаваць Words: Statistics Словаў: @@ -43,10 +52,13 @@ Don't save QuitAlert Не захоўваць Align Menus Раўнаванне Color Menus Колер Red Menus Чырвоны +OK QuitAlert Так Open… Menus Адкрыць… Center Menus Цэнтар Blue Menus Сіні +Unable to unlock file\n\t%s QuitAlert Немагчыма разблакаваць файл\n\t%s Cyan Menus Блакітны +line %d, column %d StatusView радок %d, пазіцыя %d OK Statistics ОК Magenta Menus Пурпурны New Menus Новы @@ -57,15 +69,18 @@ Find: FindandReplaceWindow Пошук: Error saving \"%s\":\n%s SaveAlert Немагчыма захаваць \"%s\":\n%s Copy Menus Капіяваць Cut Menus Выразаць +File \"%file%\" was modified by another application, reload it? NodeMonitorAlerts Файл \"%file%\" быў мадыфікаваны іншай праграмай, перачытаць? Replace FindandReplaceWindow Замяніць Find again Menus Шукаць далей Cancel QuitAlert Скасаваць Find… Menus Пошук… Select all Menus Абраць усё Don't save SaveAlert Не захоўваць +Recover NodeMonitorAlerts Аднавіць Error loading \"%s\":\n\t%s LoadAlert Немагчыма загрузіць \"%s\":\n\t%s +Ignore NodeMonitorAlerts Ігнараваць +Read-only StatusView Толькі-чытанне Undo typing QuitAlert Адмяніць увод -This file is marked Read-Only. Save changes to the document \"%s\"? SaveAlert Гэты файл пазначаны толькі для чытання. Захаваць змены ў дакумент \"%s\"? Black Menus Чорны Untitled StyledEditWindow Без назвы OK SaveAlert ОК @@ -74,5 +89,6 @@ Encoding Open_and_SaveAsPanel Кадоўка Characters: Statistics Знакаў: Save as… Menus Захаваць як… Redo typing QuitAlert Паўтарыць увод +Reload… Menus Перачытаць… Replace… Menus Замяняць… Right Menus Права diff --git a/data/catalogs/apps/stylededit/de.catkeys b/data/catalogs/apps/stylededit/de.catkeys index 46f532c6be..e427aa892a 100644 --- a/data/catalogs/apps/stylededit/de.catkeys +++ b/data/catalogs/apps/stylededit/de.catkeys @@ -1,13 +1,16 @@ -1 german x-vnd.Haiku-StyledEdit 1195515839 +1 german x-vnd.Haiku-StyledEdit 3208803155 StyledEdit System name Texteditor +This file is marked read-only. Save changes to the document \"%s\"? SaveAlert Diese Datei ist als schreibgeschützt gekennzeichnet. Änderungen am Dokument \"%s\" speichern? Paste Menus Einfügen OK LoadAlert OK File Menus Datei ??? LoadAlert ??? +Modified StatusView Geändert Lines: Statistics Zeilen: Italic Menus Kursiv Left Menus Links Search backwards FindandReplaceWindow Rückwärts suchen +Unlock file StatusView Datei entsperren Size Menus Größe Save QuitAlert Speichern Page setup… Menus Seite einrichten… @@ -31,6 +34,7 @@ Autodetect Menus Automatisch Document Menus Dokument Save changes to the document \"%s\"? QuitAlert Änderungen an Dokument \"%s\" speichern? Edit Menus Bearbeiten +Revert RevertToSavedAlert Wiederherstellen Font Menus Schrift Replace all FindandReplaceWindow Alle ersetzen Statistics… Menus Statistik… @@ -48,10 +52,13 @@ Don't save QuitAlert Verwerfen Align Menus Ausrichtung Color Menus Farbe Red Menus Rot +OK QuitAlert OK Open… Menus Öffnen… Center Menus Zentriert Blue Menus Blau +Unable to unlock file\n\t%s QuitAlert Die Datei '%s' konnte nicht entsperrt werden. Cyan Menus Türkis +line %d, column %d StatusView Zeile %d, Spalte %d OK Statistics OK Magenta Menus Magenta New Menus Neu @@ -72,8 +79,8 @@ Don't save SaveAlert Verwerfen Recover NodeMonitorAlerts Wiederherstellen Error loading \"%s\":\n\t%s LoadAlert Fehler beim Laden von "%s":\n\t%s Ignore NodeMonitorAlerts Ignorieren +Read-only StatusView Schreibgeschützt Undo typing QuitAlert Rückgängig: Eingabe -This file is marked Read-Only. Save changes to the document \"%s\"? SaveAlert Diese Datei ist als schreibgeschützt gekennzeichnet. Änderungen am Dokument \"%s\" speichern? Black Menus Schwarz Untitled StyledEditWindow Unbenannt OK SaveAlert OK diff --git a/data/catalogs/apps/stylededit/el.catkeys b/data/catalogs/apps/stylededit/el.catkeys index 8c25d6fc41..f008442bd1 100644 --- a/data/catalogs/apps/stylededit/el.catkeys +++ b/data/catalogs/apps/stylededit/el.catkeys @@ -1,4 +1,4 @@ -1 greek, modern (1453-) x-vnd.Haiku-StyledEdit 3417936913 +1 greek, modern (1453-) x-vnd.Haiku-StyledEdit 3117187160 StyledEdit System name StyledEdit Paste Menus Επικόλληση OK LoadAlert Εντάξει @@ -65,7 +65,6 @@ Select all Menus Επιλογή όλων Don't save SaveAlert Χωρίς αποθήκευση Error loading \"%s\":\n\t%s LoadAlert Σφάλμα φόρτωσης \"%s\":\n\t%s Undo typing QuitAlert Αναίρεση πληκτρολόγησης -This file is marked Read-Only. Save changes to the document \"%s\"? SaveAlert Το αρχείο είναι μόνο για ανάγνωση. Να αποθηκευτούν οι αλλαγές στο έγγραφο \"%s\"; Black Menus Μαύρο Untitled StyledEditWindow Χωρίς τίτλο OK SaveAlert Εντάξει diff --git a/data/catalogs/apps/stylededit/fi.catkeys b/data/catalogs/apps/stylededit/fi.catkeys index de337609f3..8e06eb729f 100644 --- a/data/catalogs/apps/stylededit/fi.catkeys +++ b/data/catalogs/apps/stylededit/fi.catkeys @@ -1,13 +1,15 @@ -1 finnish x-vnd.Haiku-StyledEdit 3417936913 +1 finnish x-vnd.Haiku-StyledEdit 2574742746 StyledEdit System name Tyylitetty editori Paste Menus Liitä OK LoadAlert Valmis File Menus Tiedosto ??? LoadAlert ??? +Modified StatusView Muokattu Lines: Statistics Rivejä: Italic Menus Kursivointi Left Menus Vasen Search backwards FindandReplaceWindow Etsi taaksepäin +Unlock file StatusView Poista tiedoston lukitus Size Menus Koko Save QuitAlert Tallenna Page setup… Menus Sivuasetus... @@ -19,21 +21,27 @@ Cancel SaveAlert Peru Cannot revert, file not found: \"%s\". RevertToSavedAlert Ei voi palauttaa, tiedostoa ei löytynyt: ”%s”. Case-sensitive FindandReplaceWindow Kirjainkoosta riippuva Green Menus Vihreä +Reload NodeMonitorAlerts Lataa uudelleen Yellow Menus Keltainen Replace in all windows FindandReplaceWindow Korvaa kaikissa ikkunoissa Wrap lines Menus Rivitä Quit Menus Lopeta +File \"%file%\" was removed by another application, recover it? NodeMonitorAlerts Jokin muu sovellus poisti tiedoston \”%file%\”, palautetaanko se? Document statistics Statistics Asiakirjan tilastot Cancel RevertToSavedAlert Peru +Autodetect Menus Automaattinen tunnistus Document Menus Asiakirja Save changes to the document \"%s\"? QuitAlert Tallenna muutokset asiakirjaan ”%s”? Edit Menus Muokkaa +Revert RevertToSavedAlert Palauta Font Menus Kirjasin Replace all FindandReplaceWindow Korvaa kaikki Statistics… Menus Tilastot... Default Open_and_SaveAsPanel Oletus Replace next Menus Korvaa seuraava +\"%s\" has unsaved changes.\nRevert it to the last saved version? RevertToSavedAlert tiedostossa \”%s\” tallentamattomia muutoksia.\nPalautetaanko se viimeiseen tallennettuun versioon? Cancel FindandReplaceWindow Peru +Text encoding Menus Tekstikoodaus Close Menus Sulje Save SaveAlert Tallenna Words: Statistics Sanoja: @@ -43,10 +51,13 @@ Don't save QuitAlert Älä tallenna Align Menus Tasaa Color Menus Väri Red Menus Punainen +OK QuitAlert Valmis Open… Menus Avaa… Center Menus Keskitä Blue Menus Sininen +Unable to unlock file\n\t%s QuitAlert Tiedoston lukituksen poisto epäonnistui\n\t%s Cyan Menus Turkoosi +line %d, column %d StatusView rivi %d, sarake %d OK Statistics Valmis Magenta Menus Punasininen New Menus Uusi @@ -57,15 +68,18 @@ Find: FindandReplaceWindow Haku: Error saving \"%s\":\n%s SaveAlert Virhe tallennettaessa ”%s”:\n%s Copy Menus Kopioi Cut Menus Leikkaa +File \"%file%\" was modified by another application, reload it? NodeMonitorAlerts Jokin toinen sovellus muokkasi tiedostoa \”%file%\”, ladataanko se uudelleen? Replace FindandReplaceWindow Korvaa Find again Menus Hae uudelleen Cancel QuitAlert Peru Find… Menus Hae… Select all Menus Valitse kaikki Don't save SaveAlert Älä tallenna +Recover NodeMonitorAlerts Palauta Error loading \"%s\":\n\t%s LoadAlert Virhe ladattaessa ”%s”:\n\t%s +Ignore NodeMonitorAlerts Ohita +Read-only StatusView Kirjoitussuojattu Undo typing QuitAlert Peru kirjoitus -This file is marked Read-Only. Save changes to the document \"%s\"? SaveAlert Tämä tiedosto on merkitty kirjoitussuojatuksi. Tallennetaanko muutokset asiakirjaan ”%s”? Black Menus Musta Untitled StyledEditWindow Otsikoton OK SaveAlert Valmis @@ -74,5 +88,6 @@ Encoding Open_and_SaveAsPanel Koodaus Characters: Statistics Merkkejä: Save as… Menus Tallenna nimellä... Redo typing QuitAlert Toista kirjoitus +Reload… Menus Lataa uudelleen… Replace… Menus Korvaa… Right Menus Oikea diff --git a/data/catalogs/apps/stylededit/fr.catkeys b/data/catalogs/apps/stylededit/fr.catkeys index 92cd41341b..c962b446dd 100644 --- a/data/catalogs/apps/stylededit/fr.catkeys +++ b/data/catalogs/apps/stylededit/fr.catkeys @@ -1,13 +1,16 @@ -1 french x-vnd.Haiku-StyledEdit 3417936913 +1 french x-vnd.Haiku-StyledEdit 94944799 StyledEdit System name Éditeur stylé +This file is marked read-only. Save changes to the document \"%s\"? SaveAlert Ce fichier est en lecture seule. Voulez-vous sauvegarder les modifications dans le document « %s » ? Paste Menus Coller OK LoadAlert OK File Menus Fichier ??? LoadAlert ??? +Modified StatusView Modifié Lines: Statistics Lignes : Italic Menus Italique Left Menus À gauche Search backwards FindandReplaceWindow Chercher en arrière +Unlock file StatusView Déverrouiller le fichier Size Menus Taille Save QuitAlert Sauvegarder Page setup… Menus Mise en page… @@ -19,20 +22,25 @@ Cancel SaveAlert Annuler Cannot revert, file not found: \"%s\". RevertToSavedAlert Rétablissement impossible, fichier non trouvé : « %s ». Case-sensitive FindandReplaceWindow Sensible à la casse Green Menus Vert +Reload NodeMonitorAlerts Recharger Yellow Menus Jaune Replace in all windows FindandReplaceWindow Remplacer dans toutes les fenêtres Wrap lines Menus Retour à la ligne Quit Menus Quitter +File \"%file%\" was removed by another application, recover it? NodeMonitorAlerts Le fichier « %file% » a été supprimé par une autre application, voulez-vous le restaurer ? Document statistics Statistics Statistiques du document Cancel RevertToSavedAlert Annuler +Autodetect Menus Détection automatique Document Menus Document Save changes to the document \"%s\"? QuitAlert Enregistrer les modifications du document « %s » ? Edit Menus Édition +Revert RevertToSavedAlert Rétablir Font Menus Police Replace all FindandReplaceWindow Tout remplacer Statistics… Menus Statistiques… Default Open_and_SaveAsPanel Défaut Replace next Menus Remplacer le suivant +\"%s\" has unsaved changes.\nRevert it to the last saved version? RevertToSavedAlert « %s » a des modifications en suspens.\nVoulez-vous rétablir la dernière version sauvegardée ? Cancel FindandReplaceWindow Annuler Close Menus Fermer Save SaveAlert Sauvegarder @@ -43,10 +51,12 @@ Don't save QuitAlert Ne pas enregistrer Align Menus Aligner Color Menus Couleur Red Menus Rouge +OK QuitAlert OK Open… Menus Ouvrir… Center Menus Centré Blue Menus Bleu Cyan Menus Cyan +line %d, column %d StatusView ligne %d, colonne %d OK Statistics OK Magenta Menus Magenta New Menus Nouveau @@ -65,7 +75,6 @@ Select all Menus Selectionner tout Don't save SaveAlert Ne pas enregistrer Error loading \"%s\":\n\t%s LoadAlert Erreur au de chargement de « %s » :\n\t%s Undo typing QuitAlert Annuler la saisie -This file is marked Read-Only. Save changes to the document \"%s\"? SaveAlert Ce fichier est en lecture seule. Voulez-vous sauvegarder les modifications dans le document « %s » ? Black Menus Noir Untitled StyledEditWindow Sans titre OK SaveAlert OK diff --git a/data/catalogs/apps/stylededit/hi.catkeys b/data/catalogs/apps/stylededit/hi.catkeys index efe28d0b35..9643c275aa 100644 --- a/data/catalogs/apps/stylededit/hi.catkeys +++ b/data/catalogs/apps/stylededit/hi.catkeys @@ -1,4 +1,4 @@ -1 hindi x-vnd.Haiku-StyledEdit 3417936913 +1 hindi x-vnd.Haiku-StyledEdit 3117187160 StyledEdit System name StyledEdit Paste Menus पेस्ट OK LoadAlert ठीक है @@ -65,7 +65,6 @@ Select all Menus सभी का चयन करें Don't save SaveAlert मत सहेजें Error loading \"%s\":\n\t%s LoadAlert लोड करने में त्रुटि \"%s\":\n\t%s Undo typing QuitAlert पूर्ववत टाइपिंग -This file is marked Read-Only. Save changes to the document \"%s\"? SaveAlert इस फ़ाइल को केवल पढ़ने के लिए चिह्नित किया है. दस्तावेज़ में परिवर्तन सहेजें\"%s\"? Black Menus काला Untitled StyledEditWindow शीर्षकहीन OK SaveAlert ठीक है diff --git a/data/catalogs/apps/stylededit/hu.catkeys b/data/catalogs/apps/stylededit/hu.catkeys index 00f7e01367..ed12a94c2a 100644 --- a/data/catalogs/apps/stylededit/hu.catkeys +++ b/data/catalogs/apps/stylededit/hu.catkeys @@ -1,13 +1,16 @@ -1 hungarian x-vnd.Haiku-StyledEdit 1195515839 +1 hungarian x-vnd.Haiku-StyledEdit 3208803155 StyledEdit System name StyledEdit +This file is marked read-only. Save changes to the document \"%s\"? SaveAlert Ez a fájl írásvédett. Menti dokumentum (%s) változtatásait? Paste Menus Beillesztés OK LoadAlert Rendben File Menus Fájl ??? LoadAlert ??? +Modified StatusView Módosítva Lines: Statistics Sor: Italic Menus Dőlt Left Menus Balra Search backwards FindandReplaceWindow Keresés visszafelé +Unlock file StatusView Fájl feloldása Size Menus Méret Save QuitAlert Mentés Page setup… Menus Oldalbeállítás… @@ -31,6 +34,7 @@ Autodetect Menus Automatikus felismerés Document Menus Dokumentum Save changes to the document \"%s\"? QuitAlert Menti a dokumentum (%s) változtatásait? Edit Menus Szerkesztés +Revert RevertToSavedAlert Visszaállítás Font Menus Betűtípus Replace all FindandReplaceWindow Mindet cseréli Statistics… Menus Statisztika… @@ -48,10 +52,13 @@ Don't save QuitAlert Ne mentse Align Menus Igazítás Color Menus Szín Red Menus Vörös +OK QuitAlert Rendben Open… Menus Megnyitás… Center Menus Középre Blue Menus Kék +Unable to unlock file\n\t%s QuitAlert Nem tudom feloldani a fájlt:\n\t %s Cyan Menus Cián +line %d, column %d StatusView %d. sor, %d. oszlop OK Statistics Rendben Magenta Menus Bíbor New Menus Új @@ -72,8 +79,8 @@ Don't save SaveAlert Ne mentsen Recover NodeMonitorAlerts Helyreállítás Error loading \"%s\":\n\t%s LoadAlert Hiba történt a betöltés (%s) közben:\n\t%s Ignore NodeMonitorAlerts Mellőzés +Read-only StatusView Csak olvasható Undo typing QuitAlert Gépelés visszavonása -This file is marked Read-Only. Save changes to the document \"%s\"? SaveAlert Ez a fájl írásvédett. Menti dokumentum (%s) változtatásait? Black Menus Fekete Untitled StyledEditWindow Névtelen OK SaveAlert Rendben diff --git a/data/catalogs/apps/stylededit/ja.catkeys b/data/catalogs/apps/stylededit/ja.catkeys index f913b38836..962f357cb8 100644 --- a/data/catalogs/apps/stylededit/ja.catkeys +++ b/data/catalogs/apps/stylededit/ja.catkeys @@ -1,5 +1,6 @@ -1 japanese x-vnd.Haiku-StyledEdit 1195515839 +1 japanese x-vnd.Haiku-StyledEdit 2434449144 StyledEdit System name StyledEdit +This file is marked read-only. Save changes to the document \"%s\"? SaveAlert このファイルは読み取り専用です。変更を\"%s\"ドキュメントに保存しますか? Paste Menus 貼り付け OK LoadAlert OK File Menus ファイル @@ -8,6 +9,7 @@ Lines: Statistics 行数: Italic Menus イタリック Left Menus 左揃え Search backwards FindandReplaceWindow 逆方向検索 +Unlock file StatusView ロック解除 Size Menus サイズ Save QuitAlert 保存 Page setup… Menus ページ設定… @@ -31,6 +33,7 @@ Autodetect Menus 自動判別 Document Menus ドキュメント Save changes to the document \"%s\"? QuitAlert \"%s\" が変更されましたが、保存されていません。終了前に保存しますか? Edit Menus 編集 +Revert RevertToSavedAlert 取り消し Font Menus フォント Replace all FindandReplaceWindow すべて置換 Statistics… Menus 統計… @@ -48,10 +51,13 @@ Don't save QuitAlert 保存しない Align Menus 配置 Color Menus 色 Red Menus 赤 +OK QuitAlert OK Open… Menus 開く… Center Menus 中央揃え Blue Menus 青 +Unable to unlock file\n\t%s QuitAlert 以下のファイルのロック解除が出来ません\n\t%s Cyan Menus 水色 +line %d, column %d StatusView %d 行, %d 列 OK Statistics OK Magenta Menus 紫 New Menus 新規作成 @@ -72,8 +78,8 @@ Don't save SaveAlert 保存しない Recover NodeMonitorAlerts 回復 Error loading \"%s\":\n\t%s LoadAlert \"%s\" を読み込み中にエラー発生:\n\t%s Ignore NodeMonitorAlerts 無視 +Read-only StatusView 読み込み専用 Undo typing QuitAlert 元に戻す -This file is marked Read-Only. Save changes to the document \"%s\"? SaveAlert このファイルは読み取り専用です。変更を\"%s\"ドキュメントに保存しますか? Black Menus 黒 Untitled StyledEditWindow 無題 OK SaveAlert Ok diff --git a/data/catalogs/apps/stylededit/lt.catkeys b/data/catalogs/apps/stylededit/lt.catkeys index c9cbeab174..8110421733 100644 --- a/data/catalogs/apps/stylededit/lt.catkeys +++ b/data/catalogs/apps/stylededit/lt.catkeys @@ -1,13 +1,15 @@ -1 lithuanian x-vnd.Haiku-StyledEdit 3417936913 +1 lithuanian x-vnd.Haiku-StyledEdit 1514650816 StyledEdit System name Rašyklė Paste Menus Įdėti OK LoadAlert Gerai File Menus Failas ??? LoadAlert ??? +Modified StatusView Modifikavimo data Lines: Statistics Eilučių: Italic Menus Kursyvas Left Menus Kairinė Search backwards FindandReplaceWindow Ieškoti viršun +Unlock file StatusView Atrakinti failą Size Menus Dydis Save QuitAlert Įrašyti Page setup… Menus Puslapio nuostatos… @@ -19,21 +21,27 @@ Cancel SaveAlert Atsisakyti Cannot revert, file not found: \"%s\". RevertToSavedAlert Negrįžtama, failas nerastas: „%s“. Case-sensitive FindandReplaceWindow Paisyti raidžių registro Green Menus Žalia +Reload NodeMonitorAlerts Įkelti iš naujo Yellow Menus Geltona Replace in all windows FindandReplaceWindow Keisti visuose languose Wrap lines Menus Laužyti eilutes Quit Menus Baigti darbą +File \"%file%\" was removed by another application, recover it? NodeMonitorAlerts Failą „%file%“ pašalino kita programa. Ar atkurti? Document statistics Statistics Dokumento statistika Cancel RevertToSavedAlert Atsisakyti +Autodetect Menus Nustatyti automatiškai Document Menus Dokumentas Save changes to the document \"%s\"? QuitAlert Įrašyti dokumento „%s“ pakeitimus? Edit Menus Taisa +Revert RevertToSavedAlert Atšaukti pakeitimus Font Menus Šriftas Replace all FindandReplaceWindow Pakeisti visus Statistics… Menus Statistika… Default Open_and_SaveAsPanel Numatytai Replace next Menus Pakeisti kitą +\"%s\" has unsaved changes.\nRevert it to the last saved version? RevertToSavedAlert Yra neįrašytų „%s“ pakeitimų.\nAr grąžinti paskiausiai įrašytą versiją? Cancel FindandReplaceWindow Atsisakyti +Text encoding Menus Teksto koduotė Close Menus Užverti Save SaveAlert Įrašyti Words: Statistics Žodžių: @@ -43,10 +51,13 @@ Don't save QuitAlert Neįrašyti Align Menus Lygiuotė Color Menus Spalva Red Menus Raudona +OK QuitAlert Gerai Open… Menus Atverti… Center Menus Centrinė Blue Menus Mėlyna +Unable to unlock file\n\t%s QuitAlert Failo atrakinti nepavyko\n\t %s Cyan Menus Žydra +line %d, column %d StatusView %d eilutė, %d stulpelis OK Statistics Gerai Magenta Menus Purpurinė New Menus Naujas @@ -57,6 +68,7 @@ Find: FindandReplaceWindow Ieškoti: Error saving \"%s\":\n%s SaveAlert Klaida įrašant „%s“:\n%s Copy Menus Kopijuoti Cut Menus Iškirpti +File \"%file%\" was modified by another application, reload it? NodeMonitorAlerts Failą „%file%“ modifikavo kita programa. Ar įkelti jį iš naujo? Replace FindandReplaceWindow Pakeisti Find again Menus Ieškoti kito Cancel QuitAlert Atsisakyti @@ -64,8 +76,9 @@ Find… Menus Ieškoti… Select all Menus Pažymėti viską Don't save SaveAlert Neįrašyti Error loading \"%s\":\n\t%s LoadAlert Klaida įkeliant „%s“:\n\t%s +Ignore NodeMonitorAlerts Nepaisyti +Read-only StatusView Tik skaitymui Undo typing QuitAlert Atšaukti -This file is marked Read-Only. Save changes to the document \"%s\"? SaveAlert Failas skirtas tik skaitymui. Išsaugoti dokumento „%s“ pakeitimus? Black Menus Juoda Untitled StyledEditWindow Bevardis OK SaveAlert Gerai @@ -74,5 +87,6 @@ Encoding Open_and_SaveAsPanel Koduotė Characters: Statistics Simbolių: Save as… Menus Įrašyti kaip… Redo typing QuitAlert Grąžinti +Reload… Menus Įkelti iš naujo… Replace… Menus Pakeisti… Right Menus Dešininė diff --git a/data/catalogs/apps/stylededit/nl.catkeys b/data/catalogs/apps/stylededit/nl.catkeys index 0c2d6295b2..8dddca1e39 100644 --- a/data/catalogs/apps/stylededit/nl.catkeys +++ b/data/catalogs/apps/stylededit/nl.catkeys @@ -1,4 +1,4 @@ -1 dutch; flemish x-vnd.Haiku-StyledEdit 3417936913 +1 dutch; flemish x-vnd.Haiku-StyledEdit 3117187160 StyledEdit System name StyledEdit Paste Menus Plakken OK LoadAlert Oké @@ -65,7 +65,6 @@ Select all Menus Alles selecteren Don't save SaveAlert Niet opslaan Error loading \"%s\":\n\t%s LoadAlert Fout bij het laden van \"%s\":\n\t%s Undo typing QuitAlert Typen ongedaan maken -This file is marked Read-Only. Save changes to the document \"%s\"? SaveAlert Dit bestand is Alleen-Lezen. Wijzigingen aan het document opslaan \"%s\"? Black Menus Zwart Untitled StyledEditWindow Naamloos OK SaveAlert Oké diff --git a/data/catalogs/apps/stylededit/pl.catkeys b/data/catalogs/apps/stylededit/pl.catkeys index 45399900c1..5ff5b8aa27 100644 --- a/data/catalogs/apps/stylededit/pl.catkeys +++ b/data/catalogs/apps/stylededit/pl.catkeys @@ -1,5 +1,6 @@ -1 polish x-vnd.Haiku-StyledEdit 1195515839 +1 polish x-vnd.Haiku-StyledEdit 1430674159 StyledEdit System name StyledEdit +This file is marked read-only. Save changes to the document \"%s\"? SaveAlert Ten plik jest oznaczony jako tylko do odczytu. Czy zapisać zmiany w dokumencie \"%s\"? Paste Menus Wklej OK LoadAlert OK File Menus Plik @@ -48,6 +49,7 @@ Don't save QuitAlert Nie zapisuj Align Menus Wyrównaj Color Menus Kolor Red Menus Czerwony +OK QuitAlert OK Open… Menus Otwórz… Center Menus Wyśrodkuj Blue Menus Niebieski @@ -73,7 +75,6 @@ Recover NodeMonitorAlerts Odzyskaj Error loading \"%s\":\n\t%s LoadAlert Błąd podczas ładowania \"%s\":\n\t%s Ignore NodeMonitorAlerts Ignoruj Undo typing QuitAlert Cofnij pisanie -This file is marked Read-Only. Save changes to the document \"%s\"? SaveAlert Ten plik jest oznaczony jako tylko do odczytu. Zapisać zmiany w dokumencie \"%s\"? Black Menus Czarny Untitled StyledEditWindow Bez tytułu OK SaveAlert OK diff --git a/data/catalogs/apps/stylededit/pt_BR.catkeys b/data/catalogs/apps/stylededit/pt_BR.catkeys index 3e60448d23..a1ec5d047a 100644 --- a/data/catalogs/apps/stylededit/pt_BR.catkeys +++ b/data/catalogs/apps/stylededit/pt_BR.catkeys @@ -1,13 +1,16 @@ -1 portuguese (brazil) x-vnd.Haiku-StyledEdit 3417936913 +1 portuguese (brazil) x-vnd.Haiku-StyledEdit 3208803155 StyledEdit System name Estilo de Edição +This file is marked read-only. Save changes to the document \"%s\"? SaveAlert Este arquivo está marcado como somente leitura. Salvar alterações para o documento \"%s\"? Paste Menus Colar OK LoadAlert OK File Menus Arquivo ??? LoadAlert ??? +Modified StatusView Modificado Lines: Statistics Linhas: Italic Menus Itálico Left Menus Esquerda Search backwards FindandReplaceWindow Pesquisar para trás +Unlock file StatusView Desbloquear arquivo Size Menus Tamanho Save QuitAlert Salvar Page setup… Menus Configurar página… @@ -19,21 +22,27 @@ Cancel SaveAlert Cancelar Cannot revert, file not found: \"%s\". RevertToSavedAlert Impossível reverter, arquivo não encontrado: \"%s\". Case-sensitive FindandReplaceWindow Diferenciar maiúsculas/minúsculas Green Menus Verde +Reload NodeMonitorAlerts Atualizar Yellow Menus Amarelo Replace in all windows FindandReplaceWindow Substituir em todas as janelas Wrap lines Menus Quebrar linhas Quit Menus Sair +File \"%file%\" was removed by another application, recover it? NodeMonitorAlerts Arquivo \"%file%\" foi removido por outro aplicativo, recuperar? Document statistics Statistics Estatísticas do documento Cancel RevertToSavedAlert Cancelar +Autodetect Menus Auto-detectar Document Menus Documento Save changes to the document \"%s\"? QuitAlert Salvar as alterações ao documento \"%s\"? Edit Menus Editar +Revert RevertToSavedAlert Reverter Font Menus Fonte Replace all FindandReplaceWindow Substituir tudo Statistics… Menus Estatísticas… Default Open_and_SaveAsPanel Padrões Replace next Menus Substituir próximo +\"%s\" has unsaved changes.\nRevert it to the last saved version? RevertToSavedAlert \"%s\" tem mudanças não salvas.\nReverter para a última versão salva? Cancel FindandReplaceWindow Cancelar +Text encoding Menus Codificação de texto Close Menus Fechar Save SaveAlert Salvar Words: Statistics Palavras: @@ -43,10 +52,13 @@ Don't save QuitAlert Não salvar Align Menus Alinhar Color Menus Cor Red Menus Vermelho +OK QuitAlert OK Open… Menus Abrir... Center Menus Centralizado Blue Menus Azul +Unable to unlock file\n\t%s QuitAlert Não foi possível desbloquear o arquivo\n\t %s Cyan Menus Ciano +line %d, column %d StatusView linha %d, coluna %d OK Statistics OK Magenta Menus Magenta New Menus Novo @@ -57,15 +69,18 @@ Find: FindandReplaceWindow Localizar: Error saving \"%s\":\n%s SaveAlert Erro ao salvar \"%s\":\n%s Copy Menus Copiar Cut Menus Recortar +File \"%file%\" was modified by another application, reload it? NodeMonitorAlerts Arquivo \"%file\" foi modificado por outro aplicativo, recarregar? Replace FindandReplaceWindow Substituir Find again Menus Localizar novamente Cancel QuitAlert Cancelar Find… Menus Localizar… Select all Menus Selecionar tudo Don't save SaveAlert Não salvar +Recover NodeMonitorAlerts Recuperar Error loading \"%s\":\n\t%s LoadAlert Erro ao salvar \"%s\":\n%s +Ignore NodeMonitorAlerts Ignorar +Read-only StatusView Somente leitura Undo typing QuitAlert Desfazer digitação -This file is marked Read-Only. Save changes to the document \"%s\"? SaveAlert Este arquivo está marcado como somente leitura. Salvar alterações ao documento \"%s\"? Black Menus Preto Untitled StyledEditWindow Sem título OK SaveAlert OK @@ -74,5 +89,6 @@ Encoding Open_and_SaveAsPanel Codificação Characters: Statistics Caracteres: Save as… Menus Salvar como... Redo typing QuitAlert Refazer digitação +Reload… Menus Atualizar… Replace… Menus Substituir… Right Menus Direito diff --git a/data/catalogs/apps/stylededit/ro.catkeys b/data/catalogs/apps/stylededit/ro.catkeys index 225cd6e263..3bd9422f48 100644 --- a/data/catalogs/apps/stylededit/ro.catkeys +++ b/data/catalogs/apps/stylededit/ro.catkeys @@ -1,4 +1,4 @@ -1 romanian x-vnd.Haiku-StyledEdit 3417936913 +1 romanian x-vnd.Haiku-StyledEdit 3117187160 StyledEdit System name EditorText Paste Menus Lipește OK LoadAlert OK @@ -65,7 +65,6 @@ Select all Menus Selectează tot Don't save SaveAlert Nu salva Error loading \"%s\":\n\t%s LoadAlert Eroare la încărcarea lui „%s”:\n\t%s Undo typing QuitAlert Refă tastarea -This file is marked Read-Only. Save changes to the document \"%s\"? SaveAlert Acest fișier este marcat ca fiind protejat la scriere. Salvați modificările la documentul „%s”? Black Menus Negru Untitled StyledEditWindow Fără titlu OK SaveAlert OK diff --git a/data/catalogs/apps/stylededit/ru.catkeys b/data/catalogs/apps/stylededit/ru.catkeys index 3e44098673..f7b027fa81 100644 --- a/data/catalogs/apps/stylededit/ru.catkeys +++ b/data/catalogs/apps/stylededit/ru.catkeys @@ -1,4 +1,4 @@ -1 russian x-vnd.Haiku-StyledEdit 3417936913 +1 russian x-vnd.Haiku-StyledEdit 3117187160 StyledEdit System name Стильный редактор Paste Menus Вставить OK LoadAlert ОК @@ -65,7 +65,6 @@ Select all Menus Выделить всё Don't save SaveAlert Не сохранять Error loading \"%s\":\n\t%s LoadAlert Ошибка загрузки \"%s\":\n\t%s Undo typing QuitAlert Отменить ввод -This file is marked Read-Only. Save changes to the document \"%s\"? SaveAlert Этот файл отмечен только для чтения. Сохранить изменения в документе \"%s\"? Black Menus Черный Untitled StyledEditWindow Новый документ OK SaveAlert ОК diff --git a/data/catalogs/apps/stylededit/sk.catkeys b/data/catalogs/apps/stylededit/sk.catkeys index fff9124e6f..54d2b9ef3b 100644 --- a/data/catalogs/apps/stylededit/sk.catkeys +++ b/data/catalogs/apps/stylededit/sk.catkeys @@ -1,13 +1,15 @@ -1 slovak x-vnd.Haiku-StyledEdit 3417936913 +1 slovak x-vnd.Haiku-StyledEdit 2574742746 StyledEdit System name StyledEdit Paste Menus Vložiť OK LoadAlert OK File Menus Súbor ??? LoadAlert ??? +Modified StatusView Zmenený Lines: Statistics Riadkov: Italic Menus Kurzíva Left Menus Vľavo Search backwards FindandReplaceWindow Hľadať dozadu +Unlock file StatusView Odomknúť súbor Size Menus Veľkosť Save QuitAlert Uložiť Page setup… Menus Nastavenie stránky… @@ -19,21 +21,27 @@ Cancel SaveAlert Zrušiť Cannot revert, file not found: \"%s\". RevertToSavedAlert Nie je možné vrátiť späť, súbor nebol nájdený: „%s“. Case-sensitive FindandReplaceWindow Rozlišovať veľkosť písmen Green Menus Zelená +Reload NodeMonitorAlerts Obnoviť Yellow Menus Žltá Replace in all windows FindandReplaceWindow Nahradiť vo všetkých oknách Wrap lines Menus Zalamovať riadky Quit Menus Ukončiť +File \"%file%\" was removed by another application, recover it? NodeMonitorAlerts Súbor „%file%“ odstránila iná aplikácia. Chcete ho obnoviť? Document statistics Statistics Štatistika dokumentu Cancel RevertToSavedAlert Zrušiť +Autodetect Menus Zistiť automaticky Document Menus Dokument Save changes to the document \"%s\"? QuitAlert Uložiť zmeny v dokumente „%s“? Edit Menus Upraviť +Revert RevertToSavedAlert Vrátiť späť Font Menus Písmo Replace all FindandReplaceWindow Nahradiť všetky Statistics… Menus Štatistika… Default Open_and_SaveAsPanel Predvolené Replace next Menus Nahradiť ďalší +\"%s\" has unsaved changes.\nRevert it to the last saved version? RevertToSavedAlert „%s“ má neuložené zmeny.\nChcete vrátiť späť jeho poslednú uloženú verziu? Cancel FindandReplaceWindow Zrušiť +Text encoding Menus Kódovanie textu Close Menus Zatvoriť Save SaveAlert Uložiť Words: Statistics Slov: @@ -43,10 +51,13 @@ Don't save QuitAlert Neukladať Align Menus Zarovnať Color Menus Farba Red Menus Červená +OK QuitAlert OK Open… Menus Otvoriť… Center Menus Stred Blue Menus Modrá +Unable to unlock file\n\t%s QuitAlert Nebolo možné odomknúť súbor\n\t%s Cyan Menus Azúrová +line %d, column %d StatusView riadok %d, stĺpec %d OK Statistics OK Magenta Menus Purpurová New Menus Nový @@ -57,15 +68,18 @@ Find: FindandReplaceWindow Nájsť: Error saving \"%s\":\n%s SaveAlert Chyba pri ukladaní „%s“:\n%s Copy Menus Kopírovať Cut Menus Vystrihnúť +File \"%file%\" was modified by another application, reload it? NodeMonitorAlerts Súbor „%file%“ zmenila iná aplikácia. Chcete ho znovu načítať? Replace FindandReplaceWindow Nahradiť Find again Menus Nájsť znova Cancel QuitAlert Zrušiť Find… Menus Nájsť… Select all Menus Vybrať všetky Don't save SaveAlert Neukladať +Recover NodeMonitorAlerts Obnoviť Error loading \"%s\":\n\t%s LoadAlert Chyba pri načítaní „%s“:\n\t%s +Ignore NodeMonitorAlerts Ignorovať +Read-only StatusView Iba na čítanie Undo typing QuitAlert Vrátiť späť písanie -This file is marked Read-Only. Save changes to the document \"%s\"? SaveAlert Tetnto súbor je označený ako len na čítanie. Uložiť zmeny do dokumentu „%s“? Black Menus Čierna Untitled StyledEditWindow Bez názvu OK SaveAlert OK @@ -74,5 +88,6 @@ Encoding Open_and_SaveAsPanel Kódovanie Characters: Statistics Znakov: Save as… Menus Uložiť ako… Redo typing QuitAlert Opakovať písanie +Reload… Menus Znovu načítať... Replace… Menus Nahradiť… Right Menus Vpravo diff --git a/data/catalogs/apps/stylededit/sv.catkeys b/data/catalogs/apps/stylededit/sv.catkeys index 6f102e16d8..0b28bbfa8e 100644 --- a/data/catalogs/apps/stylededit/sv.catkeys +++ b/data/catalogs/apps/stylededit/sv.catkeys @@ -1,4 +1,4 @@ -1 swedish x-vnd.Haiku-StyledEdit 1195515839 +1 swedish x-vnd.Haiku-StyledEdit 894766086 StyledEdit System name SkrivStiligt Paste Menus Klistra in OK LoadAlert OK @@ -73,7 +73,6 @@ Recover NodeMonitorAlerts Återskapa Error loading \"%s\":\n\t%s LoadAlert Fel vid inläsning "%s":\n\t%s Ignore NodeMonitorAlerts Ignorera Undo typing QuitAlert Ångra inmatning -This file is marked Read-Only. Save changes to the document \"%s\"? SaveAlert Denna fil är markerad som endast läsbar. Vill du spara ändringarna till dokumentet "%s"? Black Menus Svart Untitled StyledEditWindow Namnlös OK SaveAlert OK diff --git a/data/catalogs/apps/stylededit/uk.catkeys b/data/catalogs/apps/stylededit/uk.catkeys index f500f4038c..4d6aaf7162 100644 --- a/data/catalogs/apps/stylededit/uk.catkeys +++ b/data/catalogs/apps/stylededit/uk.catkeys @@ -1,4 +1,4 @@ -1 ukrainian x-vnd.Haiku-StyledEdit 3417936913 +1 ukrainian x-vnd.Haiku-StyledEdit 3117187160 StyledEdit System name Редактор тексту StyledEdit Paste Menus Вставити OK LoadAlert Гаразд @@ -65,7 +65,6 @@ Select all Menus Вибрати все Don't save SaveAlert Не зберігати Error loading \"%s\":\n\t%s LoadAlert Помилка загрузки "%s":\n\t%s Undo typing QuitAlert Відміна друку -This file is marked Read-Only. Save changes to the document \"%s\"? SaveAlert Файл помічений, як такий, що є тільки для читання. Зберегти зміни в документі \"%s\"? Black Menus Чорний Untitled StyledEditWindow Неназваний OK SaveAlert Гаразд diff --git a/data/catalogs/apps/stylededit/zh_Hans.catkeys b/data/catalogs/apps/stylededit/zh_Hans.catkeys index a4424ebf74..3519390c26 100644 --- a/data/catalogs/apps/stylededit/zh_Hans.catkeys +++ b/data/catalogs/apps/stylededit/zh_Hans.catkeys @@ -1,13 +1,16 @@ -1 english x-vnd.Haiku-StyledEdit 3417936913 +1 english x-vnd.Haiku-StyledEdit 3208803155 StyledEdit System name StyledEdit +This file is marked read-only. Save changes to the document \"%s\"? SaveAlert 文件标记为只读。是否将修改保存到文档 \"%s\" ? Paste Menus 粘贴 OK LoadAlert 确定 File Menus 文件 ??? LoadAlert ??? +Modified StatusView 已修改 Lines: Statistics 行数: Italic Menus 斜体 Left Menus 居左 Search backwards FindandReplaceWindow 后台搜索 +Unlock file StatusView 解锁文件 Size Menus 大小 Save QuitAlert 保存 Page setup… Menus 页面设置… @@ -19,21 +22,27 @@ Cancel SaveAlert 取消 Cannot revert, file not found: \"%s\". RevertToSavedAlert 无法恢复,文件未找到:\"%s\"。 Case-sensitive FindandReplaceWindow 区分大小写 Green Menus 绿 +Reload NodeMonitorAlerts 重新载入 Yellow Menus 黄 Replace in all windows FindandReplaceWindow 在所有窗口进行替换 Wrap lines Menus 收起 Quit Menus 退出 +File \"%file%\" was removed by another application, recover it? NodeMonitorAlerts \"%file%\" 文件已被其他应用删除,是否恢复该文件? Document statistics Statistics 文档统计 Cancel RevertToSavedAlert 取消 +Autodetect Menus 自动删除 Document Menus 文档 Save changes to the document \"%s\"? QuitAlert 将所做更改存入文档\"%s\"中吗? Edit Menus 编辑 +Revert RevertToSavedAlert 取消 Font Menus 字体 Replace all FindandReplaceWindow 全部替换 Statistics… Menus 统计... Default Open_and_SaveAsPanel 默认 Replace next Menus 替换文本 +\"%s\" has unsaved changes.\nRevert it to the last saved version? RevertToSavedAlert \"%s\" 有未保存的更改。\n恢复到最近保存版本? Cancel FindandReplaceWindow 取消 +Text encoding Menus 文本编码 Close Menus 关闭 Save SaveAlert 保存 Words: Statistics 字数: @@ -43,10 +52,13 @@ Don't save QuitAlert 不保存 Align Menus 对齐 Color Menus 颜色 Red Menus 红 +OK QuitAlert 确定 Open… Menus 打开… Center Menus 居中 Blue Menus 蓝 +Unable to unlock file\n\t%s QuitAlert 无法解锁文件\n\t%s Cyan Menus 青绿 +line %d, column %d StatusView 行 %d, 列 %d OK Statistics 确定 Magenta Menus 洋红 New Menus 新建 @@ -57,15 +69,18 @@ Find: FindandReplaceWindow 查找: Error saving \"%s\":\n%s SaveAlert 保存\"%s\"出错:\n%s Copy Menus 复制 Cut Menus 剪切 +File \"%file%\" was modified by another application, reload it? NodeMonitorAlerts 文件 \"%file%\" 已由其他程序修改,是否重新载入? Replace FindandReplaceWindow 替换 Find again Menus 再次查找 Cancel QuitAlert 取消 Find… Menus 查找… Select all Menus 全选 Don't save SaveAlert 不保存 +Recover NodeMonitorAlerts 恢复 Error loading \"%s\":\n\t%s LoadAlert 加载错误 \"%s\"\n\t%s +Ignore NodeMonitorAlerts 忽略 +Read-only StatusView 只读 Undo typing QuitAlert 取消输入 -This file is marked Read-Only. Save changes to the document \"%s\"? SaveAlert 文件为只读。将所做更改保存到文档\"%s\"吗? Black Menus 黑色 Untitled StyledEditWindow 未命名 OK SaveAlert 确定 @@ -74,5 +89,6 @@ Encoding Open_and_SaveAsPanel 编码 Characters: Statistics 字符数: Save as… Menus 保存为... Redo typing QuitAlert 重复输入 +Reload… Menus 重新载入… Replace… Menus 替换… Right Menus 居右 diff --git a/data/catalogs/apps/terminal/be.catkeys b/data/catalogs/apps/terminal/be.catkeys index a1e156ff34..500a649e71 100644 --- a/data/catalogs/apps/terminal/be.catkeys +++ b/data/catalogs/apps/terminal/be.catkeys @@ -1,7 +1,9 @@ -1 belarusian x-vnd.Haiku-Terminal 2912171349 +1 belarusian x-vnd.Haiku-Terminal 3561344903 Not found. Terminal TermWindow Не знойдзена. Switch Terminals Terminal TermWindow Пераключыць Тэрміналы Change directory Terminal TermView Змяніць дырэкторыю +Cursor Terminal AppearancePrefView Курсор +Professional Terminal colors scheme Прафесіянал OK Terminal TermWindow ОК New Terminal Terminal TermWindow Новы Тэрмінал Terminal couldn't start the shell. Sorry. Terminal TermApp Тэрмінал не змог запусціць абалонку. Выбачайце. @@ -19,8 +21,11 @@ Font: Terminal AppearancePrefView Шрыфт: Copy here Terminal TermView Капіяваць сюды Really close? Terminal TermWindow Сапраўды закрыць? Copy Terminal TermWindow Капіяваць +Color scheme: Terminal AppearancePrefView Каляровая схема: Window title: Terminal TermWindow Імя вакна: Unrecognized option \"%s\"\n Terminal arguments parsing Невядомая опцыя \"%s\"\n +Blue Terminal colors scheme Сіні +Custom Terminal colors scheme Спецыяльнае %app% settings Terminal PrefWindow window title Наладкі %app% Cancel Terminal SetTitleWindow Адмена Increase Terminal TermWindow Павялічыць @@ -44,6 +49,8 @@ The following processes are still running:\n\n\t%1\n\nIf you close the Terminal, Insert path Terminal TermView Уставіць пуць Haiku Terminal\nCopyright 2001-2009 Haiku, Inc.\nCopyright(C) 1999 Kazuho Okui and Takashi Murai.\n\nUsage: %s [OPTION] [SHELL]\n Terminal TermApp Тэрмінал Haiku\nCopyright 2001-2009 Haiku, Inc.\nCopyright(C) 1999 Kazuho Okui, Takashi Murai.\n\nКарыстанне: %s [OPTION] [SHELL]\n No search string was entered. Terminal TermWindow Страка для пошуку не ўведзена. +Font size Terminal TermWindow Памер шрыфта +Blinking cursor Terminal AppearancePrefView Мільгаючы курсор Don't save Terminal PrefWindow Не захоўваць Set window title Terminal TermWindow Прызначыць імя вакна Terminal System name Тэрмінал @@ -55,11 +62,16 @@ Find… Terminal TermWindow Пошук… The process \"%1\" is still running.\nIf you close the Terminal, the process will be killed. Terminal TermWindow Працэс \"%1\" яшчэ актыўны.\nКалі вы закрыеце Тэрмінал, працэс будзе забіты. Move here Terminal TermView Перамясціць сюды \t%d\t-\tThe current working directory of the active process in the\n\t\t\tcurrent tab. Optionally the maximum number of path components\n\t\t\tcan be specified. E.g. '%2d' for at most two components.\n\t%i\t-\tThe index of the window.\n\t%p\t-\tThe name of the active process in the current tab.\n\t%t\t-\tThe title of the current tab.\n\t%%\t-\tThe character '%'. Terminal ToolTips \t%d\t-\tРабочы каталог актыўнага працэсу\n\t\t\tў цякучай укладцы.Дадаткова можна ўказаць макісмальную колькасць кампанентаў пуці.\n\t\t\t Напрыклад, '%2d' - не больша за два кампаненты.\n\t%i\t-\tІндэкс вакна.\n\t%p\t-\tІмя актыўнага працэсу ў цякучай укладцы.\n\t%t\t-\tІмя цякучай укладкі.\n\t%%\t-\tСімвал '%'. +Retro Terminal colors scheme Даўніна Error! Terminal getString Памылка! New tab Terminal TermWindow Новая ўкладка The pattern specifying the tab titles. The following placeholders\ncan be used:\n Terminal AppearancePrefView Шаблон для імёнаў ўкладак. Можна ўжываць наступныя\n запаўняльнікі:\n Selected background Terminal AppearancePrefView Выбраны фон +Slate Terminal colors scheme Шыфер +Text under cursor Terminal AppearancePrefView Тэкст пад курсорам +Midnight Terminal colors scheme Поўнач Decrease Terminal TermWindow Паменшыць +Default Terminal colors scheme Дапомная Create link here Terminal TermView Стварыць спасылку сюды Close Terminal TermWindow Закрыць Text Terminal AppearancePrefView Тэкст diff --git a/data/catalogs/apps/terminal/fi.catkeys b/data/catalogs/apps/terminal/fi.catkeys index da707a5a7e..bef5051c40 100644 --- a/data/catalogs/apps/terminal/fi.catkeys +++ b/data/catalogs/apps/terminal/fi.catkeys @@ -1,7 +1,8 @@ -1 finnish x-vnd.Haiku-Terminal 4226482962 +1 finnish x-vnd.Haiku-Terminal 3561344903 Not found. Terminal TermWindow Ei löytynyt. Switch Terminals Terminal TermWindow Vaihda pääteikkunoita Change directory Terminal TermView Vaihda hakemistoa +Cursor Terminal AppearancePrefView Kohdistin Professional Terminal colors scheme Ammattilaistaso OK Terminal TermWindow Valmis New Terminal Terminal TermWindow Uusi Pääteikkuna @@ -67,6 +68,7 @@ New tab Terminal TermWindow Uusi välilehti The pattern specifying the tab titles. The following placeholders\ncan be used:\n Terminal AppearancePrefView Välilehtiotsikot määrittävä malli. Seuraavia paikanpitäjiä\nvoidaan käyttää:\n Selected background Terminal AppearancePrefView Valitse tausta Slate Terminal colors scheme Laatta +Text under cursor Terminal AppearancePrefView Teksti kohdistimen alla Midnight Terminal colors scheme Keskiyö Decrease Terminal TermWindow Vähennä Default Terminal colors scheme Oletus diff --git a/data/catalogs/apps/terminal/fr.catkeys b/data/catalogs/apps/terminal/fr.catkeys index fea25bcd6d..cca9c2cd11 100644 --- a/data/catalogs/apps/terminal/fr.catkeys +++ b/data/catalogs/apps/terminal/fr.catkeys @@ -1,7 +1,9 @@ -1 french x-vnd.Haiku-Terminal 1829613568 +1 french x-vnd.Haiku-Terminal 3561344903 Not found. Terminal TermWindow Non trouvé. Switch Terminals Terminal TermWindow Inverser les Terminaux Change directory Terminal TermView Changer de répertoire +Cursor Terminal AppearancePrefView Curseur +Professional Terminal colors scheme Professionnel OK Terminal TermWindow OK New Terminal Terminal TermWindow Nouveau Terminal Terminal couldn't start the shell. Sorry. Terminal TermApp Terminal ne peut pas démarrer l'interpréteur de commande. @@ -19,8 +21,11 @@ Font: Terminal AppearancePrefView Police : Copy here Terminal TermView Copier ici Really close? Terminal TermWindow Êtes-vous sûr de vouloir fermer ? Copy Terminal TermWindow Copier +Color scheme: Terminal AppearancePrefView Profil de couleurs : Window title: Terminal TermWindow Titre de la fenêtre : Unrecognized option \"%s\"\n Terminal arguments parsing Option « %s » non reconnue\n +Blue Terminal colors scheme Bleu +Custom Terminal colors scheme Personnalisé %app% settings Terminal PrefWindow window title Réglages du %app% Cancel Terminal SetTitleWindow Annuler Increase Terminal TermWindow Augmenter @@ -44,6 +49,7 @@ The following processes are still running:\n\n\t%1\n\nIf you close the Terminal, Insert path Terminal TermView Insérer un chemin de recherche Haiku Terminal\nCopyright 2001-2009 Haiku, Inc.\nCopyright(C) 1999 Kazuho Okui and Takashi Murai.\n\nUsage: %s [OPTION] [SHELL]\n Terminal TermApp Haiku Terminal\nCopyright 2001-2009 Haiku, Inc.\nCopyright(C) 1999 Kazuho Okui et Takashi Murai.\n\nUtilisation : %s [OPTION] [SHELL]\n No search string was entered. Terminal TermWindow Aucun texte à rechercher n'a été indiqué. +Font size Terminal TermWindow Taille de la police Blinking cursor Terminal AppearancePrefView Curseur clignotant Don't save Terminal PrefWindow Ne pas sauver Set window title Terminal TermWindow Changer le titre de la fenêtre @@ -56,11 +62,16 @@ Find… Terminal TermWindow Rechercher… The process \"%1\" is still running.\nIf you close the Terminal, the process will be killed. Terminal TermWindow L'application « %1 » fonctionne encore.\nSi vous fermez le Terminal, l'application sera interrompue. Move here Terminal TermView Déplacer ici \t%d\t-\tThe current working directory of the active process in the\n\t\t\tcurrent tab. Optionally the maximum number of path components\n\t\t\tcan be specified. E.g. '%2d' for at most two components.\n\t%i\t-\tThe index of the window.\n\t%p\t-\tThe name of the active process in the current tab.\n\t%t\t-\tThe title of the current tab.\n\t%%\t-\tThe character '%'. Terminal ToolTips \t%d\t-\tLe répertoire de travail courant du processus actif dans l'onglet\n\t\t\tcourant. Optionnellement, le nombre maximum d'élément peut-être\n\t\t\tspécifié. E.g. '%2d' pour au plus 2 éléments.\n\t%i\t-\tL'index de la fenêtre.\n\t%p\t-\tLe nom du processus actif dans l'onglet courant.\n\t%t\t-\tLe titre de l'onglet courant.\n\t%%\t-\tLe caractère '%'. +Retro Terminal colors scheme Rétro Error! Terminal getString Erreur ! New tab Terminal TermWindow Nouvel onglet The pattern specifying the tab titles. The following placeholders\ncan be used:\n Terminal AppearancePrefView Le modèle utilisé pour composer le titre des onglets\ncontenir les éléments suivants :\n Selected background Terminal AppearancePrefView Fond sélectionné +Slate Terminal colors scheme Ardoise +Text under cursor Terminal AppearancePrefView Texte sous le curseur +Midnight Terminal colors scheme Minuit Decrease Terminal TermWindow Réduire +Default Terminal colors scheme Par défaut Create link here Terminal TermView Créer un raccourci ici Close Terminal TermWindow Fermer Text Terminal AppearancePrefView Texte diff --git a/data/catalogs/apps/terminal/lt.catkeys b/data/catalogs/apps/terminal/lt.catkeys index 2d33d9c853..9d484e4cc7 100644 --- a/data/catalogs/apps/terminal/lt.catkeys +++ b/data/catalogs/apps/terminal/lt.catkeys @@ -1,7 +1,9 @@ -1 lithuanian x-vnd.Haiku-Terminal 2912171349 +1 lithuanian x-vnd.Haiku-Terminal 2178478404 Not found. Terminal TermWindow Nerasta. Switch Terminals Terminal TermWindow Pereiti į kitą terminalą Change directory Terminal TermView Keisti aplanką +Cursor Terminal AppearancePrefView Žymeklis +Professional Terminal colors scheme Profesionali OK Terminal TermWindow Gerai New Terminal Terminal TermWindow Naujas langas Terminal couldn't start the shell. Sorry. Terminal TermApp Apgailestaujame, terminalui nepavyko paleisti apvalkalo. @@ -19,8 +21,11 @@ Font: Terminal AppearancePrefView Šriftas: Copy here Terminal TermView Kopijuoti čia Really close? Terminal TermWindow Ar tikrai užverti? Copy Terminal TermWindow Kopijuoti +Color scheme: Terminal AppearancePrefView Spalvų schema: Window title: Terminal TermWindow Lango antraštė: Unrecognized option \"%s\"\n Terminal arguments parsing Nežinomas argumentas: „%s“\n +Blue Terminal colors scheme Mėlyna +Custom Terminal colors scheme Pasirinktinė %app% settings Terminal PrefWindow window title Terminalo nuostatos Cancel Terminal SetTitleWindow Atsisakyti Increase Terminal TermWindow Padidinti @@ -44,6 +49,8 @@ The following processes are still running:\n\n\t%1\n\nIf you close the Terminal, Insert path Terminal TermView Įterpti kelią Haiku Terminal\nCopyright 2001-2009 Haiku, Inc.\nCopyright(C) 1999 Kazuho Okui and Takashi Murai.\n\nUsage: %s [OPTION] [SHELL]\n Terminal TermApp „Haiku“ terminalas\n© 2001–2009 Haiku, Inc.\n© 1999 Kazuho Okui ir Takashi Murai.\n\nNaudojimas: %s [ARGUMENTAS] [APVALKALAS]\n No search string was entered. Terminal TermWindow Neįvestas ieškotinas tekstas. +Font size Terminal TermWindow Šrifto dydis +Blinking cursor Terminal AppearancePrefView Mirksintis žymeklis Don't save Terminal PrefWindow Neįrašyti Set window title Terminal TermWindow Keisti lango antraštę Terminal System name Terminalas @@ -55,11 +62,15 @@ Find… Terminal TermWindow Ieškoti… The process \"%1\" is still running.\nIf you close the Terminal, the process will be killed. Terminal TermWindow Užduotis „%1“ dar vykdoma.\nUžvėrus langą, jos darbas bus nutrauktas. Move here Terminal TermView Perkelti čia \t%d\t-\tThe current working directory of the active process in the\n\t\t\tcurrent tab. Optionally the maximum number of path components\n\t\t\tcan be specified. E.g. '%2d' for at most two components.\n\t%i\t-\tThe index of the window.\n\t%p\t-\tThe name of the active process in the current tab.\n\t%t\t-\tThe title of the current tab.\n\t%%\t-\tThe character '%'. Terminal ToolTips \t%d\t-\tAktyvioje kortelėje vydomos aktyvios užduoties veikiamasis \t\t\taplankas. Taip pat galima nurodyti didžiausią kelio komponenčių\n\t\t\tskaičių. Pavyzdžiui, „%2d“ reikš ne daugiau kaip dvi komponentes.\n\t%i\t-\tLango eilės numeris.\n\t%p\t-\tAktyvioje kortelėje vykdomos aktyvios užduoties pavadinimas.\n\t%t\t-\tAktyvios kortelės antraštė.\n\t%%\t-\tSimbolis „%“. +Retro Terminal colors scheme Retro Error! Terminal getString Klaida! New tab Terminal TermWindow Nauja kortelė The pattern specifying the tab titles. The following placeholders\ncan be used:\n Terminal AppearancePrefView Kortelių antraščių šablonas. Galite naudoti šiuos vietaženklius:\n Selected background Terminal AppearancePrefView Pažymėto teksto fono +Text under cursor Terminal AppearancePrefView Tekstas po žymekliu +Midnight Terminal colors scheme Vidurnaktis Decrease Terminal TermWindow Pamažinti +Default Terminal colors scheme Numatytoji Create link here Terminal TermView Kurti nuorodą čia Close Terminal TermWindow Užverti Text Terminal AppearancePrefView Teksto diff --git a/data/catalogs/apps/terminal/pt_BR.catkeys b/data/catalogs/apps/terminal/pt_BR.catkeys index a887dad2f2..dd4b655590 100644 --- a/data/catalogs/apps/terminal/pt_BR.catkeys +++ b/data/catalogs/apps/terminal/pt_BR.catkeys @@ -1,7 +1,9 @@ -1 portuguese (brazil) x-vnd.Haiku-Terminal 1829613568 +1 portuguese (brazil) x-vnd.Haiku-Terminal 3561344903 Not found. Terminal TermWindow Não localizado. Switch Terminals Terminal TermWindow Alternar Terminais Change directory Terminal TermView Mudar de pasta +Cursor Terminal AppearancePrefView Cursor +Professional Terminal colors scheme Profissional OK Terminal TermWindow OK New Terminal Terminal TermWindow Novo Terminal Terminal couldn't start the shell. Sorry. Terminal TermApp Terminal não pôde iniciar o shell. Desculpe. @@ -19,8 +21,11 @@ Font: Terminal AppearancePrefView Fonte: Copy here Terminal TermView Copiar aqui Really close? Terminal TermWindow Deseja realmente fechar? Copy Terminal TermWindow Copiar +Color scheme: Terminal AppearancePrefView Esquema de cores: Window title: Terminal TermWindow Título da janela: Unrecognized option \"%s\"\n Terminal arguments parsing Opção não reconhecida \"%s\"\n +Blue Terminal colors scheme Azul +Custom Terminal colors scheme Personalizado %app% settings Terminal PrefWindow window title %app% definições Cancel Terminal SetTitleWindow Cancelar Increase Terminal TermWindow Aumentar @@ -44,6 +49,7 @@ The following processes are still running:\n\n\t%1\n\nIf you close the Terminal, Insert path Terminal TermView Inserir caminho Haiku Terminal\nCopyright 2001-2009 Haiku, Inc.\nCopyright(C) 1999 Kazuho Okui and Takashi Murai.\n\nUsage: %s [OPTION] [SHELL]\n Terminal TermApp Terminal Haiku\nCopyright 2001-2009 Haiku, Inc.\nCopyright(C) 1999 Kazuho Okui e Takashi Murai.\n\nUtilização: %s [OPTION] [SHELL]\n No search string was entered. Terminal TermWindow Não foi introduzida nenhuma expressão para localizar. +Font size Terminal TermWindow Tamanho da fonte Blinking cursor Terminal AppearancePrefView Cursor piscante Don't save Terminal PrefWindow Não salvar Set window title Terminal TermWindow Definir título da janela @@ -56,11 +62,16 @@ Find… Terminal TermWindow Localizar… The process \"%1\" is still running.\nIf you close the Terminal, the process will be killed. Terminal TermWindow O processo \"%1\" ainda está executando.\nSe fechar o Terminal, o processo será morto. Move here Terminal TermView Mover aqui \t%d\t-\tThe current working directory of the active process in the\n\t\t\tcurrent tab. Optionally the maximum number of path components\n\t\t\tcan be specified. E.g. '%2d' for at most two components.\n\t%i\t-\tThe index of the window.\n\t%p\t-\tThe name of the active process in the current tab.\n\t%t\t-\tThe title of the current tab.\n\t%%\t-\tThe character '%'. Terminal ToolTips \t %d\t -\t O diretório de trabalho atual do processo ativo na\n\t \t \t guia atual. Opcionalmente o número máximo de componentes do caminho\n\t \t \t pode ser especificado. Por exemplo, '%2d' para o máximo de dois componentes.\n\t %i\t -\t O índice da janela.\n\t %p\t -\t O nome do processo ativo na guia atual.\n\t %t\t -\t O título da guia atual.\n\t %%\t -\t O caractere '%'. +Retro Terminal colors scheme Retrô Error! Terminal getString Erro! New tab Terminal TermWindow Nova aba The pattern specifying the tab titles. The following placeholders\ncan be used:\n Terminal AppearancePrefView O padrão especificando os títulos da guia. Os seguintes espaços reservados podem ser usados:\n Selected background Terminal AppearancePrefView Plano de fundo selecionado +Slate Terminal colors scheme Ardósia +Text under cursor Terminal AppearancePrefView Texto sob cursor +Midnight Terminal colors scheme Meia-noite Decrease Terminal TermWindow Diminuir +Default Terminal colors scheme Padrão Create link here Terminal TermView Criar vínculo aqui Close Terminal TermWindow Fechar Text Terminal AppearancePrefView Texto diff --git a/data/catalogs/apps/terminal/sk.catkeys b/data/catalogs/apps/terminal/sk.catkeys index c996f8fd6b..22ba127f1b 100644 --- a/data/catalogs/apps/terminal/sk.catkeys +++ b/data/catalogs/apps/terminal/sk.catkeys @@ -1,7 +1,9 @@ -1 slovak x-vnd.Haiku-Terminal 2912171349 +1 slovak x-vnd.Haiku-Terminal 3561344903 Not found. Terminal TermWindow Nenájdené. Switch Terminals Terminal TermWindow Prepnúť terminály Change directory Terminal TermView Zmeniť adresár +Cursor Terminal AppearancePrefView Kurzor +Professional Terminal colors scheme Profesionálna OK Terminal TermWindow OK New Terminal Terminal TermWindow Nový terminál Terminal couldn't start the shell. Sorry. Terminal TermApp Terminálu sa nepodarilo spustiť shell. Ľutujeme. @@ -19,8 +21,11 @@ Font: Terminal AppearancePrefView Písmo: Copy here Terminal TermView Skopírovať sem Really close? Terminal TermWindow Skutočne zatvoriť? Copy Terminal TermWindow Skopírovať +Color scheme: Terminal AppearancePrefView Schéma farieb: Window title: Terminal TermWindow Titulok okna: Unrecognized option \"%s\"\n Terminal arguments parsing Nerozpoznaná voľba „%s“\n +Blue Terminal colors scheme Modrá +Custom Terminal colors scheme Vlastné %app% settings Terminal PrefWindow window title %app% - nastavenia Cancel Terminal SetTitleWindow Zrušiť Increase Terminal TermWindow Zväčšiť @@ -44,6 +49,8 @@ The following processes are still running:\n\n\t%1\n\nIf you close the Terminal, Insert path Terminal TermView Vložiť cestu Haiku Terminal\nCopyright 2001-2009 Haiku, Inc.\nCopyright(C) 1999 Kazuho Okui and Takashi Murai.\n\nUsage: %s [OPTION] [SHELL]\n Terminal TermApp Terminál Haiku\nCopyright 2001-2009 Haiku, Inc.\nCopyright(C) 1999 Kazuho Okui a Takashi Murai.\n\nPoužitie: %s [VOĽBA] [SHELL]\n No search string was entered. Terminal TermWindow Nebol zadaný vyhľadávací reťazec. +Font size Terminal TermWindow Veľkosť písma +Blinking cursor Terminal AppearancePrefView Blikajúci kurzor Don't save Terminal PrefWindow Neukladať Set window title Terminal TermWindow Nastaviť titulok okna Terminal System name Terminál @@ -55,11 +62,16 @@ Find… Terminal TermWindow Nájsť… The process \"%1\" is still running.\nIf you close the Terminal, the process will be killed. Terminal TermWindow Proces „%1“ ešte stále beží.\nAk zatvoríte Terminál, proces bude zabitý. Move here Terminal TermView Presunúť sem \t%d\t-\tThe current working directory of the active process in the\n\t\t\tcurrent tab. Optionally the maximum number of path components\n\t\t\tcan be specified. E.g. '%2d' for at most two components.\n\t%i\t-\tThe index of the window.\n\t%p\t-\tThe name of the active process in the current tab.\n\t%t\t-\tThe title of the current tab.\n\t%%\t-\tThe character '%'. Terminal ToolTips \t%d\t-\tAktuálny adresár aktívneho procesu\n\t\t\tv aktuálnej karte. Nepovinne je možné určiť maximálny počet\n\t\t\tzložiek cesty. Napr. „%2d“ pre najviac dve zložky.\n\t%i\t-\tIndex okna.\n\t%p\t-\tNázov aktívneho procesu v aktuálnej karte.\n\t%t\t-\tTitulok aktuálnej karty.\n\t%%\t-\tZnak „%“. +Retro Terminal colors scheme Retro Error! Terminal getString Chyba! New tab Terminal TermWindow Nová karta The pattern specifying the tab titles. The following placeholders\ncan be used:\n Terminal AppearancePrefView Vzor určujúci titulky kariet. Možno použiť\nnasledovné zástupné symboly:\n Selected background Terminal AppearancePrefView Vybrané pozadie +Slate Terminal colors scheme Bridlica +Text under cursor Terminal AppearancePrefView Text pod kurzorom +Midnight Terminal colors scheme Polnoc Decrease Terminal TermWindow Zmenšiť +Default Terminal colors scheme Predvolená Create link here Terminal TermView Vytvoriť tu odkaz Close Terminal TermWindow Zatvoriť Text Terminal AppearancePrefView Text diff --git a/data/catalogs/apps/terminal/zh_Hans.catkeys b/data/catalogs/apps/terminal/zh_Hans.catkeys index 1576b24e48..d4f7e46002 100644 --- a/data/catalogs/apps/terminal/zh_Hans.catkeys +++ b/data/catalogs/apps/terminal/zh_Hans.catkeys @@ -1,7 +1,9 @@ -1 english x-vnd.Haiku-Terminal 2912171349 +1 english x-vnd.Haiku-Terminal 3561344903 Not found. Terminal TermWindow 未找到。 Switch Terminals Terminal TermWindow 切换终端 Change directory Terminal TermView 更改目录 +Cursor Terminal AppearancePrefView 游标 +Professional Terminal colors scheme 专业主题 OK Terminal TermWindow 确定 New Terminal Terminal TermWindow 新建窗口 Terminal couldn't start the shell. Sorry. Terminal TermApp 终端无法启动shell,非常抱歉。 @@ -19,8 +21,11 @@ Font: Terminal AppearancePrefView 字体: Copy here Terminal TermView 复制到此 Really close? Terminal TermWindow 确定关闭吗? Copy Terminal TermWindow 复制 +Color scheme: Terminal AppearancePrefView 色彩模式: Window title: Terminal TermWindow 窗口标题: Unrecognized option \"%s\"\n Terminal arguments parsing 无法识别的选项\"%s\"\n +Blue Terminal colors scheme 蓝色 +Custom Terminal colors scheme 自定义 %app% settings Terminal PrefWindow window title %app% 设置 Cancel Terminal SetTitleWindow 取消 Increase Terminal TermWindow 增大 @@ -44,6 +49,8 @@ The following processes are still running:\n\n\t%1\n\nIf you close the Terminal, Insert path Terminal TermView 插入路径 Haiku Terminal\nCopyright 2001-2009 Haiku, Inc.\nCopyright(C) 1999 Kazuho Okui and Takashi Murai.\n\nUsage: %s [OPTION] [SHELL]\n Terminal TermApp Haiku终端\n版权所有 2001-2009 Haiku Inc。\n版权所有(C)1999 Kazuho Okui 和 Takashi Murai。\n\n用法:%s 【OPTION】【SHELL】\n No search string was entered. Terminal TermWindow 未输入任何字符。 +Font size Terminal TermWindow 字体大小 +Blinking cursor Terminal AppearancePrefView 闪烁游标 Don't save Terminal PrefWindow 不保存 Set window title Terminal TermWindow 设置窗口标题 Terminal System name 终端 @@ -55,11 +62,16 @@ Find… Terminal TermWindow 查找… The process \"%1\" is still running.\nIf you close the Terminal, the process will be killed. Terminal TermWindow \"%1\" 进程仍在运行。\n如果关闭终端,该进程将被杀死。 Move here Terminal TermView 移动到此 \t%d\t-\tThe current working directory of the active process in the\n\t\t\tcurrent tab. Optionally the maximum number of path components\n\t\t\tcan be specified. E.g. '%2d' for at most two components.\n\t%i\t-\tThe index of the window.\n\t%p\t-\tThe name of the active process in the current tab.\n\t%t\t-\tThe title of the current tab.\n\t%%\t-\tThe character '%'. Terminal ToolTips \t%d\t-\t当前标签中,活动进程的当前工作目录。\n\t\t组件可以指定的最大路径数量。例如,'%2d',可以指定至多两个组件。\n\t%i\t-\t窗口的索引。\n\t%p\t-\t当前标签中的活动进程。\n\t%t\t-\t当前标签的标题。\n\t%%\t-\t字符 '%'。 +Retro Terminal colors scheme 复古主题 Error! Terminal getString 错误! New tab Terminal TermWindow 新建标签 The pattern specifying the tab titles. The following placeholders\ncan be used:\n Terminal AppearancePrefView 该图案指定了标签标题。可以使用下述的\n占位符:\n Selected background Terminal AppearancePrefView 选中背景 +Slate Terminal colors scheme 岩石主题 +Text under cursor Terminal AppearancePrefView 下划线 +Midnight Terminal colors scheme 午夜主题 Decrease Terminal TermWindow 缩小 +Default Terminal colors scheme 默认主题 Create link here Terminal TermView 创建链接 Close Terminal TermWindow 关闭 Text Terminal AppearancePrefView 文本 diff --git a/data/catalogs/bin/desklink/lt.catkeys b/data/catalogs/bin/desklink/lt.catkeys index d196b89923..f9d2ccdc3b 100644 --- a/data/catalogs/bin/desklink/lt.catkeys +++ b/data/catalogs/bin/desklink/lt.catkeys @@ -1,9 +1,10 @@ -1 lithuanian x-vnd.Haiku-desklink 3053930521 +1 lithuanian x-vnd.Haiku-desklink 2797960853 Control physical output MediaReplicant Valdyti fizinę išvestį Couldn't launch MediaReplicant Nepavyko paleisti OK MediaReplicant Gerai Sound preferences… MediaReplicant Garsų nuostatos… %g dB MediaReplicant %g dB +Open %name DeskButton Don't translate variable %name Atverti %name No media server running VolumeControl Nepaleista įvairialypės terpės tarnyba Media preferences… MediaReplicant Įvairialypės terpės nuostatos… Open MediaPlayer MediaReplicant Atverti Medijos leistuvę diff --git a/data/catalogs/bin/desklink/zh_Hans.catkeys b/data/catalogs/bin/desklink/zh_Hans.catkeys index aed8bac378..9f6b958d00 100644 --- a/data/catalogs/bin/desklink/zh_Hans.catkeys +++ b/data/catalogs/bin/desklink/zh_Hans.catkeys @@ -1,9 +1,10 @@ -1 english x-vnd.Haiku-desklink 3053930521 +1 english x-vnd.Haiku-desklink 2797960853 Control physical output MediaReplicant 控件物理输出 Couldn't launch MediaReplicant 无法启动 OK MediaReplicant 确定 Sound preferences… MediaReplicant 声音首选项... %g dB MediaReplicant %g dB +Open %name DeskButton Don't translate variable %name 打开 %name No media server running VolumeControl 无媒体服务器运行 Media preferences… MediaReplicant 多媒体首选项... Open MediaPlayer MediaReplicant 打开媒体播放器 diff --git a/data/catalogs/kits/be.catkeys b/data/catalogs/kits/be.catkeys index 129173bd75..55fa824a9f 100644 --- a/data/catalogs/kits/be.catkeys +++ b/data/catalogs/kits/be.catkeys @@ -1,21 +1,29 @@ -1 belarusian x-vnd.Haiku-libbe 864109244 +1 belarusian x-vnd.Haiku-libbe 672385853 +gamma AboutWindow гамма +beta AboutWindow бэта %3.2f GiB StringForSize %3.2f ГіБ Written by: AboutWindow Аўтар(ы): About %app% AboutMenuItem Пра %app% Cut TextView Выразаць +Version AboutWindow Версія Cannot create the replicant for \"%description\".\n%error ZombieReplicantView Немагчыма стварыць рэплікант \"%description\".\n%error +About AboutWindow Пра праграму Copy TextView Капіяваць %3.2f KiB StringForSize %3.2f КіБ %d bytes StringForSize %d байтаў +alpha AboutWindow альфа Error PrintJob Памылка No Pages to print! PrintJob Няма старонак для друку! +All Rights Reserved. AboutWindow Усе правы захаваныя. OK Dragger ОК OK PrintJob ОК Green: ColorControl Зялёны: +Version history: AboutWindow Гісторыя версій: Remove replicant Dragger Выдаліць рэпліканта OK ZombieReplicantView ОК Print Server is not responding. PrintJob Сервер друку не адказвае. Paste TextView Уставіць +Special Thanks: AboutWindow Адмысловыя падзякі: %.2f TiB StringForSize %.2f ТіБ Cannot locate the application for the replicant. No application signature supplied.\n%error ZombieReplicantView Праграма рэпліканата не знойдзена. Подпис праграмы не зададзены.\n%error Redo TextView Зрабіць наноў @@ -26,6 +34,8 @@ Undo TextView Адвярнуць Red: ColorControl Чырвоны: %3.2f MiB StringForSize %3.2f МіБ About %app… Dragger Пра праграму %app… +development AboutWindow распрацоўны Error ZombieReplicantView Памылка Blue: ColorControl Сіні: +gold master AboutWindow залатая Can't delete this replicant from its original application. Life goes on. Dragger Не ўдалося выдаліць рэплікант з яго праграмы. Але жыццё працягваецца. diff --git a/data/catalogs/kits/lt.catkeys b/data/catalogs/kits/lt.catkeys index 374a9edeaa..eee56ee208 100644 --- a/data/catalogs/kits/lt.catkeys +++ b/data/catalogs/kits/lt.catkeys @@ -1,21 +1,29 @@ -1 lithuanian x-vnd.Haiku-libbe 864109244 +1 lithuanian x-vnd.Haiku-libbe 3528204916 +gamma AboutWindow gama +beta AboutWindow beta %3.2f GiB StringForSize %3.2f GiB Written by: AboutWindow Sukūrė: About %app% AboutMenuItem Apie „%app%“ Cut TextView Iškirpti +Version AboutWindow Versija Cannot create the replicant for \"%description\".\n%error ZombieReplicantView Nepavyko sukurti „%description“ replikanto.\n%error +About AboutWindow Apie Copy TextView Kopijuoti %3.2f KiB StringForSize %3.2f KiB %d bytes StringForSize %d B +alpha AboutWindow alfa Error PrintJob Klaida No Pages to print! PrintJob Nėra spausdintinų puslapių! +All Rights Reserved. AboutWindow Visos teisės saugomos. OK Dragger Gerai OK PrintJob Gerai Green: ColorControl Žalia: +Version history: AboutWindow Versijų istorija: Remove replicant Dragger Pašalinti replikantą OK ZombieReplicantView Gerai Print Server is not responding. PrintJob Spausdinimo serveris neatsako. Paste TextView Įdėti +Special Thanks: AboutWindow Ypatingos padėkos: %.2f TiB StringForSize %.2f TiB Cannot locate the application for the replicant. No application signature supplied.\n%error ZombieReplicantView Nepavyko rasti replikantą suteikiančios programos. Nepateiktas programos identifikatorius.\n%error Redo TextView Grąžinti diff --git a/data/catalogs/kits/pl.catkeys b/data/catalogs/kits/pl.catkeys index 283150fe6b..518b939955 100644 --- a/data/catalogs/kits/pl.catkeys +++ b/data/catalogs/kits/pl.catkeys @@ -1,4 +1,4 @@ -1 polish x-vnd.Haiku-libbe 1921499696 +1 polish x-vnd.Haiku-libbe 1916257017 gamma AboutWindow gamma beta AboutWindow beta %3.2f GiB StringForSize %3.2f GiB @@ -7,6 +7,7 @@ About %app% AboutMenuItem O %app% Cut TextView Wytnij Version AboutWindow Wersja Cannot create the replicant for \"%description\".\n%error ZombieReplicantView Nie można stworzyć replikanta dla \"%description\".\n%error +About AboutWindow O… Copy TextView Skopiuj %3.2f KiB StringForSize %3.2f KiB %d bytes StringForSize %d bajtów diff --git a/data/catalogs/kits/sk.catkeys b/data/catalogs/kits/sk.catkeys index 8cec89f300..1e7d145079 100644 --- a/data/catalogs/kits/sk.catkeys +++ b/data/catalogs/kits/sk.catkeys @@ -1,21 +1,29 @@ -1 slovak x-vnd.Haiku-libbe 864109244 +1 slovak x-vnd.Haiku-libbe 672385853 +gamma AboutWindow gama +beta AboutWindow beta %3.2f GiB StringForSize %3.2f GiB Written by: AboutWindow Napísal: About %app% AboutMenuItem O aplikácii %app% Cut TextView Vystrihnúť +Version AboutWindow Verzia Cannot create the replicant for \"%description\".\n%error ZombieReplicantView Nemožno vytvoriť replikanta pre „%description“.\n%error +About AboutWindow O aplikácii Copy TextView Kopírovať %3.2f KiB StringForSize %3.2f KiB %d bytes StringForSize %d bajtov +alpha AboutWindow alfa Error PrintJob Chyba No Pages to print! PrintJob Žiadne strany na tlačenie! +All Rights Reserved. AboutWindow Všetky práva vyhradené. OK Dragger OK OK PrintJob OK Green: ColorControl Zelená: +Version history: AboutWindow História verzií: Remove replicant Dragger Odstrániť replikanta OK ZombieReplicantView OK Print Server is not responding. PrintJob Tlačový server neodpovedá. Paste TextView Vložiť +Special Thanks: AboutWindow Zvláštne poďakovanie: %.2f TiB StringForSize %.2f TiB Cannot locate the application for the replicant. No application signature supplied.\n%error ZombieReplicantView Nemožno nájsť aplikáciu pre replikanta. Nebol dodaný žiaden podpis aplikácie.\n%error Redo TextView Opakovať @@ -26,6 +34,8 @@ Undo TextView Späť Red: ColorControl Červená: %3.2f MiB StringForSize %3.2f MiB About %app… Dragger O aplikácii %app… +development AboutWindow vývoj Error ZombieReplicantView Chyba Blue: ColorControl Modrá: +gold master AboutWindow gold master Can't delete this replicant from its original application. Life goes on. Dragger Nemožno zmazať tohto replikanta z jeho pôvodnej aplikácie. C'est la vie. diff --git a/data/catalogs/kits/tracker/be.catkeys b/data/catalogs/kits/tracker/be.catkeys index 4ae8b65db2..bbea15998d 100644 --- a/data/catalogs/kits/tracker/be.catkeys +++ b/data/catalogs/kits/tracker/be.catkeys @@ -1,4 +1,4 @@ -1 belarusian x-vnd.Haiku-libtracker 1301055003 +1 belarusian x-vnd.Haiku-libtracker 3779634732 common B_COMMON_DIRECTORY агульны OK WidgetAttributeText ОК Icon view VolumeWindow Від іконак @@ -411,7 +411,6 @@ Paste layout ContainerWindow Уставіць макет Select InfoWindow Выбраць Could not update permissions of file \"%name\". %error FSUtils Не ўдалося абнавіць правы файла \"%name\". %error Select… FilePanelPriv Выбраць… -Don't move files to Trash SettingsView Не перамяшчаць файлы ў Сметніцу There was an error resolving the link. Tracker Адбылася памылка пры разборы спасылкі. %BytesPerSecond/s StatusWindow %BytesPerSecond/s You can't move or copy the trash. FSUtils Вы не можаце перамяшчаць ці капіяваць у Сметніцу. @@ -442,7 +441,6 @@ Automatic disk mounting AutoMounterSettings Аўтаматычнае манта Original name ContainerWindow Першапачатковае імя Find FSUtils Знайсці Error copying file \"%name\":\n\t%error\n\nWould you like to continue? FSUtils Памылка пры капіяванні файла \"%name\":\n\t%error\n\nЖадаеце працягваць? -Ask before delete SettingsView Пытаць перад выдаленнем Single window navigation SettingsView Навігацыя ў адным вакне parent folder NavMenu бацькоўскі каталог contains FindPanel месціць @@ -452,6 +450,7 @@ Mount DeskWindow Змантаваць Mount ContainerWindow Змантаваць %capacity (%used used -- %free free) InfoWindow %capacity (%used выкарыстана -- %free свабодна) Cancel FSClipBoard Адмена +Restart Deskbar DeskWindow Перазапусціць Дэсктоп Cut more ContainerWindow Выразаць яшчэ Deleting: StatusWindow Выдаляецца: Empty Trash InfoWindow Ачысціць сметніцу diff --git a/data/catalogs/kits/tracker/de.catkeys b/data/catalogs/kits/tracker/de.catkeys index 0542621061..0b3b973988 100644 --- a/data/catalogs/kits/tracker/de.catkeys +++ b/data/catalogs/kits/tracker/de.catkeys @@ -1,4 +1,4 @@ -1 german x-vnd.Haiku-libtracker 3955647850 +1 german x-vnd.Haiku-libtracker 3779634732 common B_COMMON_DIRECTORY Allgemein OK WidgetAttributeText OK Icon view VolumeWindow Icon-Ansicht @@ -411,7 +411,6 @@ Paste layout ContainerWindow Anordnung einfügen Select InfoWindow Auswählen Could not update permissions of file \"%name\". %error FSUtils Konnte die Berechtigungen der Datei \"%name\" nicht aktualisieren. %error Select… FilePanelPriv Auswählen… -Don't move files to Trash SettingsView Dateien nicht in den Papierkorb verschieben There was an error resolving the link. Tracker Fehler beim Auflösen der Verknüpfung. %BytesPerSecond/s StatusWindow %BytesPerSecond/s You can't move or copy the trash. FSUtils Der Papierkorb kann nicht verschoben oder kopiert werden. @@ -442,7 +441,6 @@ Automatic disk mounting AutoMounterSettings Automatisch Einhängen Original name ContainerWindow Ursprung Find FSUtils Suchen Error copying file \"%name\":\n\t%error\n\nWould you like to continue? FSUtils Fehler beim Kopieren der Datei \"%name\":\n\t%error\n\nSoll fortgefahren werden? -Ask before delete SettingsView Vor dem Leeren nachfragen Single window navigation SettingsView Einzelfenster-Modus parent folder NavMenu Übergeordneter Ordner contains FindPanel enthält diff --git a/data/catalogs/kits/tracker/el.catkeys b/data/catalogs/kits/tracker/el.catkeys index 3dce1bfa11..e23164b0db 100644 --- a/data/catalogs/kits/tracker/el.catkeys +++ b/data/catalogs/kits/tracker/el.catkeys @@ -1,4 +1,4 @@ -1 greek, modern (1453-) x-vnd.Haiku-libtracker 3595866216 +1 greek, modern (1453-) x-vnd.Haiku-libtracker 3419853098 common B_COMMON_DIRECTORY κοινό OK WidgetAttributeText Εντάξει Icon view VolumeWindow Προβολή εικονιδίου @@ -388,7 +388,6 @@ Paste layout ContainerWindow Επικόλληση διάταξης Select InfoWindow Επιλογή Could not update permissions of file \"%name\". %error FSUtils Αδυναμία αναθεώρησης των δικαιωμάτων του αρχείου \"%name\". %error Select… FilePanelPriv Επιλογή... -Don't move files to Trash SettingsView Να μη μετακινόυνται αρχεία στα απορρίματα There was an error resolving the link. Tracker Υπήρξε κάποιο σφάλμα κατά την επίλυση του συνδέσμου. %BytesPerSecond/s StatusWindow %BytesPerSecond/s You can't move or copy the trash. FSUtils Δεν μπορείτε να μετακινήσετε ή να αντιγράψετε στο καλάθι αχρήστων. @@ -419,7 +418,6 @@ Automatic disk mounting AutoMounterSettings Αυτόματη προσάρτησ Original name ContainerWindow Πρωτότυπο όνομα Find FSUtils Εύρεση Error copying file \"%name\":\n\t%error\n\nWould you like to continue? FSUtils Σφάλμα αντιγραφής του αρχείου\"%name\":\n\t%error\n\nΘέλετε να συνεχίσετε; -Ask before delete SettingsView Ερώτηση πριν τη διαγραφή Single window navigation SettingsView Πλοήγηση απλού παράθυρου parent folder NavMenu φάκελος γονέα contains FindPanel περιέχει diff --git a/data/catalogs/kits/tracker/fi.catkeys b/data/catalogs/kits/tracker/fi.catkeys index fc2e07d27c..aaf60b9047 100644 --- a/data/catalogs/kits/tracker/fi.catkeys +++ b/data/catalogs/kits/tracker/fi.catkeys @@ -1,4 +1,4 @@ -1 finnish x-vnd.Haiku-libtracker 3955647850 +1 finnish x-vnd.Haiku-libtracker 3779634732 common B_COMMON_DIRECTORY yhteinen OK WidgetAttributeText Valmis Icon view VolumeWindow Kuvakenäkymä @@ -411,7 +411,6 @@ Paste layout ContainerWindow Liitä sijoittelu Select InfoWindow Valitse Could not update permissions of file \"%name\". %error FSUtils Ei voitu päivittää tiedoston ”%name” käyttöoikeuksia. %error Select… FilePanelPriv Valitse... -Don't move files to Trash SettingsView Älä siirrä tiedostoja roskakoriin There was an error resolving the link. Tracker Virhe linkin ratkaisemisessa. %BytesPerSecond/s StatusWindow %BytesPerSecond/s You can't move or copy the trash. FSUtils Et voi siirtää tai kopioida roskakoriin. @@ -442,7 +441,6 @@ Automatic disk mounting AutoMounterSettings Automaattinen levyliittäminen Original name ContainerWindow Alkuperäinen nimi Find FSUtils Etsi Error copying file \"%name\":\n\t%error\n\nWould you like to continue? FSUtils Virhe kopioitaessa tiedostoa ”%name”:\n\t%error\n\nHaluaisitko jatkaa? -Ask before delete SettingsView Kysy ennen poistoa Single window navigation SettingsView Yksittäisikkunanavigointi parent folder NavMenu Ylemmän tason kansio contains FindPanel sisältää diff --git a/data/catalogs/kits/tracker/fr.catkeys b/data/catalogs/kits/tracker/fr.catkeys index 815979bb6a..c0cefc8faa 100644 --- a/data/catalogs/kits/tracker/fr.catkeys +++ b/data/catalogs/kits/tracker/fr.catkeys @@ -1,4 +1,4 @@ -1 french x-vnd.Haiku-libtracker 3955647850 +1 french x-vnd.Haiku-libtracker 3779634732 common B_COMMON_DIRECTORY commun OK WidgetAttributeText OK Icon view VolumeWindow Vue en icônes @@ -411,7 +411,6 @@ Paste layout ContainerWindow Coller la disposition Select InfoWindow Sélectionner Could not update permissions of file \"%name\". %error FSUtils Impossible de modifier les permissions du fichier « %name ». %error Select… FilePanelPriv Sélectionner… -Don't move files to Trash SettingsView Ne pas envoyer les fichiers vers la corbeille There was an error resolving the link. Tracker Une erreur est survenue lors de la résolution du lien. %BytesPerSecond/s StatusWindow %BytesPerSecond/s You can't move or copy the trash. FSUtils Vous ne pouvez ni déplacer, ni copier la Corbeille. @@ -442,7 +441,6 @@ Automatic disk mounting AutoMounterSettings Montage automatique des disques Original name ContainerWindow Nom d'origine Find FSUtils Rechercher Error copying file \"%name\":\n\t%error\n\nWould you like to continue? FSUtils Erreur à la copie du fichier « %name » :\n\t%error\n\nVoulez-vous continuer ? -Ask before delete SettingsView Demander avant de supprimer Single window navigation SettingsView Naviguer dans une fenêtre unique parent folder NavMenu dossier parent contains FindPanel contient diff --git a/data/catalogs/kits/tracker/hi.catkeys b/data/catalogs/kits/tracker/hi.catkeys index 4d2d230103..6f9fef73ee 100644 --- a/data/catalogs/kits/tracker/hi.catkeys +++ b/data/catalogs/kits/tracker/hi.catkeys @@ -1,4 +1,4 @@ -1 hindi x-vnd.Haiku-libtracker 2038664208 +1 hindi x-vnd.Haiku-libtracker 1862651090 common B_COMMON_DIRECTORY सामान्य OK WidgetAttributeText ठीक है Icon view VolumeWindow चिह्न दृश्य @@ -391,7 +391,6 @@ Paste layout ContainerWindow लेआउट चिपकाएँ Select InfoWindow चुनें Could not update permissions of file \"%name\". %error FSUtils फ़ाइल की अनुमतियाँ अद्यतन नहीं कि जा सकती \"%name\". %error Select… FilePanelPriv चुनें ... -Don't move files to Trash SettingsView रद्दी में फाइलों मत डालें There was an error resolving the link. Tracker एक कड़ी को हल करने में त्रुटि हुई. %BytesPerSecond/s StatusWindow %BytesPerSecond/s You can't move or copy the trash. FSUtils आप रद्दी को कॉपी या स्थानांतरित नहीं कर सकते हैं. @@ -422,7 +421,6 @@ Automatic disk mounting AutoMounterSettings स्वचालित डिस Original name ContainerWindow मूल नाम Find FSUtils खोजें Error copying file \"%name\":\n\t%error\n\nWould you like to continue? FSUtils फ़ाइल की प्रतिलिपि में त्रुटि \"%name\":\n\t%error\n\nक्या आप जारी रखना चाहेंगे? -Ask before delete SettingsView हटाने से पहले पूछें Single window navigation SettingsView एक खिड़की मे नैवगेशन parent folder NavMenu मूल फ़ोल्डर contains FindPanel शामिल हैं diff --git a/data/catalogs/kits/tracker/hu.catkeys b/data/catalogs/kits/tracker/hu.catkeys index 84609a2bce..e2628fa962 100644 --- a/data/catalogs/kits/tracker/hu.catkeys +++ b/data/catalogs/kits/tracker/hu.catkeys @@ -1,4 +1,4 @@ -1 hungarian x-vnd.Haiku-libtracker 3955647850 +1 hungarian x-vnd.Haiku-libtracker 3779634732 common B_COMMON_DIRECTORY Közös OK WidgetAttributeText Rendben Icon view VolumeWindow Ikon nézet @@ -411,7 +411,6 @@ Paste layout ContainerWindow Elrendezés beillesztése Select InfoWindow Kijelölés Could not update permissions of file \"%name\". %error FSUtils Nem sikerült módosítani a fájl (%name) jogosultságait.\n\t%error Select… FilePanelPriv Kijelölés… -Don't move files to Trash SettingsView Ne mozgassa a fájlokat a Szemetesbe There was an error resolving the link. Tracker Hiba történt a hivatkozás feloldása során. %BytesPerSecond/s StatusWindow %BytesPerSecond/mp You can't move or copy the trash. FSUtils A Szemetest nem lehet mozgatni vagy másolni. @@ -442,7 +441,6 @@ Automatic disk mounting AutoMounterSettings Automatikus lemezcsatolás Original name ContainerWindow Eredeti név Find FSUtils Keresés Error copying file \"%name\":\n\t%error\n\nWould you like to continue? FSUtils Hiba történt a másolás közben: %name\n\t%error\n\nSzeretné folytatni? -Ask before delete SettingsView Kérdezzen törlés előtt Single window navigation SettingsView Egyablakos navigáció parent folder NavMenu szülőmappa contains FindPanel tartalmazza diff --git a/data/catalogs/kits/tracker/ja.catkeys b/data/catalogs/kits/tracker/ja.catkeys index 1ed581b26e..c0f8a20d3e 100644 --- a/data/catalogs/kits/tracker/ja.catkeys +++ b/data/catalogs/kits/tracker/ja.catkeys @@ -1,4 +1,4 @@ -1 japanese x-vnd.Haiku-libtracker 40324107 +1 japanese x-vnd.Haiku-libtracker 4159278285 OK WidgetAttributeText OK Icon view VolumeWindow アイコン表示 Add-ons FilePanelPriv アドオン @@ -406,7 +406,6 @@ Paste layout ContainerWindow レイアウトを貼り付ける Select InfoWindow 選択 Could not update permissions of file \"%name\". %error FSUtils \"%name\"の権限を更新できませんでした。%error Select… FilePanelPriv 選択… -Don't move files to Trash SettingsView ごみ箱を経由せずに削除する There was an error resolving the link. Tracker リンクの解釈に失敗しました。 %BytesPerSecond/s StatusWindow %BytesPerSecond/秒 You can't move or copy the trash. FSUtils ごみ箱の移動やコピーはできません。 @@ -437,7 +436,6 @@ Automatic disk mounting AutoMounterSettings ディスクの自動マウント Original name ContainerWindow 元の名前 Find FSUtils 検索 Error copying file \"%name\":\n\t%error\n\nWould you like to continue? FSUtils \"%name\" をコピー中にエラーが発生しました:\n\t%error\n\nそれでも続けますか? -Ask before delete SettingsView 削除前に確認する Single window navigation SettingsView シングルウィンドウナビゲーション parent folder NavMenu 親フォルダー contains FindPanel 含む diff --git a/data/catalogs/kits/tracker/lt.catkeys b/data/catalogs/kits/tracker/lt.catkeys index 1a823bb0e9..44dc196c25 100644 --- a/data/catalogs/kits/tracker/lt.catkeys +++ b/data/catalogs/kits/tracker/lt.catkeys @@ -1,4 +1,4 @@ -1 lithuanian x-vnd.Haiku-libtracker 1301055003 +1 lithuanian x-vnd.Haiku-libtracker 3779634732 common B_COMMON_DIRECTORY Bendra OK WidgetAttributeText Gerai Icon view VolumeWindow Rodyti piktogramas @@ -411,7 +411,6 @@ Paste layout ContainerWindow Pritaikyti nukopijuotą išdėstymą Select InfoWindow Pažymėti Could not update permissions of file \"%name\". %error FSUtils Nepavyko atnaujinti failo „%name“ leidimų. %error Select… FilePanelPriv Pažymėti… -Don't move files to Trash SettingsView Šiukšlinėn objektų nemesti There was an error resolving the link. Tracker Nustatant nuorodos tikslą, įvyko klaida. %BytesPerSecond/s StatusWindow %BytesPerSecond/s You can't move or copy the trash. FSUtils Šiukšlinės negalima nei perkelti, nei nukopijuoti. @@ -442,7 +441,6 @@ Automatic disk mounting AutoMounterSettings Automatiškai prijungti tomus: Original name ContainerWindow Tikras vardas Find FSUtils Ieškoti Error copying file \"%name\":\n\t%error\n\nWould you like to continue? FSUtils Klaida kopijuojant failą „%name“:\n\t%error\n\nAr norite tęsti? -Ask before delete SettingsView Atsiklausti prieš šalinant Single window navigation SettingsView Naršyti viename lange parent folder NavMenu Viršaplankis contains FindPanel savyje turi @@ -452,6 +450,7 @@ Mount DeskWindow Prijungti Mount ContainerWindow Prijungti %capacity (%used used -- %free free) InfoWindow %capacity (užpildyta %used, laisva %free) Cancel FSClipBoard Atsisakyti +Restart Deskbar DeskWindow Perleisti Užduočių juostą Cut more ContainerWindow Iškirpti dar Deleting: StatusWindow Šalinama: Empty Trash InfoWindow Ištuštinti šiukšlinę diff --git a/data/catalogs/kits/tracker/nl.catkeys b/data/catalogs/kits/tracker/nl.catkeys index 22a473ae61..30d7f08adf 100644 --- a/data/catalogs/kits/tracker/nl.catkeys +++ b/data/catalogs/kits/tracker/nl.catkeys @@ -1,4 +1,4 @@ -1 dutch; flemish x-vnd.Haiku-libtracker 1301055003 +1 dutch; flemish x-vnd.Haiku-libtracker 1125041885 common B_COMMON_DIRECTORY algemeen OK WidgetAttributeText OK Icon view VolumeWindow Icoonweergave @@ -411,7 +411,6 @@ Paste layout ContainerWindow Lay-out plakken Select InfoWindow Selecteren Could not update permissions of file \"%name\". %error FSUtils De machtigingen voor het bestand \"%name\" konden niet bijgewerkt worden. %error Select… FilePanelPriv Selecteren... -Don't move files to Trash SettingsView Verplaats geen bestanden naar de prullenbak There was an error resolving the link. Tracker Er is een fout opgetreden bij het toekennen van de link. %BytesPerSecond/s StatusWindow %BytesPerSecond/s You can't move or copy the trash. FSUtils U kunt de prullenbak niet verplaatsen of kopiëren. @@ -442,7 +441,6 @@ Automatic disk mounting AutoMounterSettings Automatische schijfbetrekking Original name ContainerWindow Oorspronkelijke naam Find FSUtils Zoeken Error copying file \"%name\":\n\t%error\n\nWould you like to continue? FSUtils Fout bij het kopiëren van het bestand \"%name\":\n\t%error\n\nWilt u doorgaan? -Ask before delete SettingsView Vraag voor verwijderen Single window navigation SettingsView Enkel-venster-navigatie parent folder NavMenu bovenliggende map contains FindPanel bevat diff --git a/data/catalogs/kits/tracker/pl.catkeys b/data/catalogs/kits/tracker/pl.catkeys index 5f33be8b9c..61040b7c54 100644 --- a/data/catalogs/kits/tracker/pl.catkeys +++ b/data/catalogs/kits/tracker/pl.catkeys @@ -1,4 +1,4 @@ -1 polish x-vnd.Haiku-libtracker 75125649 +1 polish x-vnd.Haiku-libtracker 628096147 common B_COMMON_DIRECTORY common OK WidgetAttributeText OK Icon view VolumeWindow Widok ikon @@ -93,6 +93,7 @@ Replace FilePanelPriv Zastąp Select all VolumeWindow Zaznacz wszystko Opens with: InfoWindow Otwórz za pomocą: Open ContainerWindow Otwórz +96 x 96 DeskWindow 96 x 96 Error calculating folder size. InfoWindow Błąd przy obliczaniu rozmiaru folderu. New folder FilePanelPriv Nowy folder %name info InfoWindow InfoWindow Title %name informacje @@ -313,6 +314,7 @@ The Tracker must be running to see Info windows. PoseView Tracker musi być wł Other FilePermissionsView Inne Query name: FindPanel Nazwa zapytania: Permissions ContainerWindow Uprawnienia +96 x 96 ContainerWindow 96 x 96 moving FSUtils przenoszenie Identify InfoWindow Zidentyfikuj Recent folders ContainerWindow Ostatnio otwierane foldery @@ -403,7 +405,6 @@ Paste layout ContainerWindow Wklej motyw Select InfoWindow Wybierz Could not update permissions of file \"%name\". %error FSUtils Nie można zauktualizować uprawnień dla pliku \"%name\". %error Select… FilePanelPriv Wybierz… -Don't move files to Trash SettingsView Nie przenoś plików do kosza There was an error resolving the link. Tracker Pojawił się problem przy przetwarzaniu skrótu. %BytesPerSecond/s StatusWindow %BytesPerSecond/s You can't move or copy the trash. FSUtils nie możesz przenieść ani skopiować kosza. @@ -434,7 +435,6 @@ Automatic disk mounting AutoMounterSettings Automatyczne montowanie dysku Original name ContainerWindow Nazwa orygialna Find FSUtils Znajdź Error copying file \"%name\":\n\t%error\n\nWould you like to continue? FSUtils Błąd przy kopiowaniu pliku \"%name\":\n\t%error\n\nCzy chcesz kontynuować? -Ask before delete SettingsView Potwierdzaj przed usunięciem Single window navigation SettingsView Nawigacja pojedyńczym oknem parent folder NavMenu folder główny contains FindPanel zawiera diff --git a/data/catalogs/kits/tracker/pt_BR.catkeys b/data/catalogs/kits/tracker/pt_BR.catkeys index c780c2d527..1b0034f463 100644 --- a/data/catalogs/kits/tracker/pt_BR.catkeys +++ b/data/catalogs/kits/tracker/pt_BR.catkeys @@ -1,4 +1,4 @@ -1 portuguese (brazil) x-vnd.Haiku-libtracker 3955647850 +1 portuguese (brazil) x-vnd.Haiku-libtracker 3779634732 common B_COMMON_DIRECTORY comum OK WidgetAttributeText OK Icon view VolumeWindow Em ícones @@ -411,7 +411,6 @@ Paste layout ContainerWindow Colar disposição Select InfoWindow Selecionar Could not update permissions of file \"%name\". %error FSUtils Não foi possível atualizar permissões do arquivo \"%name\". %error Select… FilePanelPriv Selecionar… -Don't move files to Trash SettingsView Não mover arquivos para a Lixeira There was an error resolving the link. Tracker Ocorreu um erro resolvendo um vínculo. %BytesPerSecond/s StatusWindow %BytesPerSecond/s You can't move or copy the trash. FSUtils Não é possível mover ou copiar a lixeira. @@ -442,7 +441,6 @@ Automatic disk mounting AutoMounterSettings Montagem automática de disco Original name ContainerWindow Nome original Find FSUtils Localizar Error copying file \"%name\":\n\t%error\n\nWould you like to continue? FSUtils Erro ao copiar o arquivo \"%name\":\n\t %error\n\nGostaria de continuar? -Ask before delete SettingsView Perguntar antes de excluir Single window navigation SettingsView Navegação em janela única parent folder NavMenu pasta de origem contains FindPanel contém diff --git a/data/catalogs/kits/tracker/ro.catkeys b/data/catalogs/kits/tracker/ro.catkeys index 436628348b..ad36dfbf29 100644 --- a/data/catalogs/kits/tracker/ro.catkeys +++ b/data/catalogs/kits/tracker/ro.catkeys @@ -1,4 +1,4 @@ -1 romanian x-vnd.Haiku-libtracker 3411026851 +1 romanian x-vnd.Haiku-libtracker 3235013733 OK WidgetAttributeText OK Icon view VolumeWindow Vizualizare pictogramă Add-ons FilePanelPriv Module @@ -326,7 +326,6 @@ OK FSUtils OK Paste layout ContainerWindow Lipește aranjament Select InfoWindow Selectează Select… FilePanelPriv Selectează... -Don't move files to Trash SettingsView Nu muta fișierele la gunoi There was an error resolving the link. Tracker A apărut o eroare la rezolvarea legăturii. You can't move or copy the trash. FSUtils Nu puteți să mutați sau să copiați gunoiul. ends with SelectionWindow se termină cu @@ -352,7 +351,6 @@ Move to Trash FSUtils Mută la gunoi Automatic disk mounting AutoMounterSettings Montare de disc automată Original name ContainerWindow Nume original Find FSUtils Găsește -Ask before delete SettingsView Întreabă înainte de a șterge Single window navigation SettingsView Navigare cu o singură fereastră parent folder NavMenu dosar superior contains FindPanel conține diff --git a/data/catalogs/kits/tracker/ru.catkeys b/data/catalogs/kits/tracker/ru.catkeys index db9b6868b2..14283c719e 100644 --- a/data/catalogs/kits/tracker/ru.catkeys +++ b/data/catalogs/kits/tracker/ru.catkeys @@ -1,4 +1,4 @@ -1 russian x-vnd.Haiku-libtracker 1301055003 +1 russian x-vnd.Haiku-libtracker 1125041885 common B_COMMON_DIRECTORY Общие OK WidgetAttributeText ОК Icon view VolumeWindow Большие значки @@ -411,7 +411,6 @@ Paste layout ContainerWindow Вставить вид папки Select InfoWindow Выделить Could not update permissions of file \"%name\". %error FSUtils Невозможно обновить права файла \"%name\". %error Select… FilePanelPriv Выделить… -Don't move files to Trash SettingsView Не помещать файлы в корзину There was an error resolving the link. Tracker Возникла ошибка при открытии ссылки. %BytesPerSecond/s StatusWindow %BytesPerSecond/с You can't move or copy the trash. FSUtils Вы не можете перемещать или копировать корзину. @@ -442,7 +441,6 @@ Automatic disk mounting AutoMounterSettings Автоматическое под Original name ContainerWindow Оригинальное имя Find FSUtils Найти Error copying file \"%name\":\n\t%error\n\nWould you like to continue? FSUtils Ошибка при копировании файла \"%name\":\n\t%error\n\nВы хотите продолжить? -Ask before delete SettingsView Спрашивать перед удалением Single window navigation SettingsView Открывать папки в одном окне parent folder NavMenu родительский каталог contains FindPanel содержит diff --git a/data/catalogs/kits/tracker/sk.catkeys b/data/catalogs/kits/tracker/sk.catkeys index 7c16094773..c8145f266a 100644 --- a/data/catalogs/kits/tracker/sk.catkeys +++ b/data/catalogs/kits/tracker/sk.catkeys @@ -1,4 +1,4 @@ -1 slovak x-vnd.Haiku-libtracker 1574172506 +1 slovak x-vnd.Haiku-libtracker 4052752235 common B_COMMON_DIRECTORY spoločné OK WidgetAttributeText OK Icon view VolumeWindow Zobrazenie ikon @@ -410,7 +410,6 @@ Paste layout ContainerWindow Vložiť rozloženie Select InfoWindow Vybrať Could not update permissions of file \"%name\". %error FSUtils Nepodarilo sa aktualizovať oprávnenia súboru „%name“. %error Select… FilePanelPriv Vybrať… -Don't move files to Trash SettingsView Nepresúvať súbory do Koša There was an error resolving the link. Tracker Vyskytla sa chyba pri preklade odkazu. %BytesPerSecond/s StatusWindow %BytesPerSecond/s You can't move or copy the trash. FSUtils Nemôžete presunúť alebo skopírovať Kôš. @@ -441,7 +440,6 @@ Automatic disk mounting AutoMounterSettings Automatické pripájanie diskov Original name ContainerWindow Pôvodný názov Find FSUtils Nájsť Error copying file \"%name\":\n\t%error\n\nWould you like to continue? FSUtils Chyba pri kopírovaní súboru „%name“:\n\t%error\n\nChcete pokračovať? -Ask before delete SettingsView Pýtať sa pred zmazaním Single window navigation SettingsView Navigácia v jednom okne parent folder NavMenu nadradený priečinok contains FindPanel obsahuje @@ -451,6 +449,7 @@ Mount DeskWindow Pripojiť Mount ContainerWindow Pripojiť %capacity (%used used -- %free free) InfoWindow %capacity (%used využité -- %free voľné) Cancel FSClipBoard Zrušiť +Restart Deskbar DeskWindow Reštartovať Panel Cut more ContainerWindow Vystrihnúť viac Deleting: StatusWindow Maže sa: Empty Trash InfoWindow Vyprázdniť Kôš diff --git a/data/catalogs/kits/tracker/sv.catkeys b/data/catalogs/kits/tracker/sv.catkeys index 2da0d6013e..e6c168f23d 100644 --- a/data/catalogs/kits/tracker/sv.catkeys +++ b/data/catalogs/kits/tracker/sv.catkeys @@ -1,4 +1,4 @@ -1 swedish x-vnd.Haiku-libtracker 3955647850 +1 swedish x-vnd.Haiku-libtracker 3779634732 common B_COMMON_DIRECTORY gemensam OK WidgetAttributeText OK Icon view VolumeWindow Ikonvy @@ -411,7 +411,6 @@ Paste layout ContainerWindow Klistra in layout Select InfoWindow Markera Could not update permissions of file \"%name\". %error FSUtils Kunde inte uppdatera rättigheterna i filen "%name". %error Select… FilePanelPriv Markera... -Don't move files to Trash SettingsView Flytta inte filerna till Papperskorgen There was an error resolving the link. Tracker Det uppstod ett fel vid uppslag av länk. %BytesPerSecond/s StatusWindow %BytesPerSecond/s You can't move or copy the trash. FSUtils Du kan inte flytta eller kopiera Papperskorgen. @@ -442,7 +441,6 @@ Automatic disk mounting AutoMounterSettings Montera volymer automatiskt Original name ContainerWindow Originalnamn Find FSUtils Sök Error copying file \"%name\":\n\t%error\n\nWould you like to continue? FSUtils Fel vid kopiering av filen "%name".\n\t%error\n\nVill du fortsätta? -Ask before delete SettingsView Fråga innan borttagning Single window navigation SettingsView Enfönsternavigation parent folder NavMenu föräldrakatalog contains FindPanel innehåller diff --git a/data/catalogs/kits/tracker/uk.catkeys b/data/catalogs/kits/tracker/uk.catkeys index c78b042977..2568c29495 100644 --- a/data/catalogs/kits/tracker/uk.catkeys +++ b/data/catalogs/kits/tracker/uk.catkeys @@ -1,4 +1,4 @@ -1 ukrainian x-vnd.Haiku-libtracker 3680490064 +1 ukrainian x-vnd.Haiku-libtracker 3504476946 common B_COMMON_DIRECTORY common OK WidgetAttributeText Гаразд Icon view VolumeWindow У вигляді іконок @@ -393,7 +393,6 @@ Paste layout ContainerWindow Вставити макет Select InfoWindow Вибрати Could not update permissions of file \"%name\". %error FSUtils Не вдалося обновити дозволи файлу \"%name\". %error Select… FilePanelPriv Вибрати… -Don't move files to Trash SettingsView Не переміщайте файли до Кошика There was an error resolving the link. Tracker Виникла проблема відтворення посилання. %BytesPerSecond/s StatusWindow %BytesPerSecond/s You can't move or copy the trash. FSUtils Ви не можете копіювати або переміщати Кошик. @@ -424,7 +423,6 @@ Automatic disk mounting AutoMounterSettings Автоматичне монтув Original name ContainerWindow Справжнє ім'я Find FSUtils Знайти Error copying file \"%name\":\n\t%error\n\nWould you like to continue? FSUtils Помилка копіювання файлу \"%name\":\n\t%error\n\nЧи хочете ви продовжити? -Ask before delete SettingsView Спитати перед видаленням Single window navigation SettingsView Одновіконна навігація parent folder NavMenu батьківська папка contains FindPanel містить diff --git a/data/catalogs/kits/tracker/zh_Hans.catkeys b/data/catalogs/kits/tracker/zh_Hans.catkeys index affaddb61e..fa2f5371e5 100644 --- a/data/catalogs/kits/tracker/zh_Hans.catkeys +++ b/data/catalogs/kits/tracker/zh_Hans.catkeys @@ -1,4 +1,4 @@ -1 english x-vnd.Haiku-libtracker 1301055003 +1 english x-vnd.Haiku-libtracker 3779634732 common B_COMMON_DIRECTORY 常用 OK WidgetAttributeText 确定 Icon view VolumeWindow 图标视图 @@ -411,7 +411,6 @@ Paste layout ContainerWindow 粘贴布局 Select InfoWindow 选择 Could not update permissions of file \"%name\". %error FSUtils 无法更新 \"%name\" 的文件权限。错误:%error Select… FilePanelPriv 选择... -Don't move files to Trash SettingsView 无法移动文件到垃圾箱 There was an error resolving the link. Tracker 恢复链接出错。 %BytesPerSecond/s StatusWindow %BytesPerSecond/s You can't move or copy the trash. FSUtils 您无法移动或复制垃圾箱。 @@ -442,7 +441,6 @@ Automatic disk mounting AutoMounterSettings 磁盘自动挂载 Original name ContainerWindow 原始名称 Find FSUtils 搜索 Error copying file \"%name\":\n\t%error\n\nWould you like to continue? FSUtils 复制文件 \"%name\" 出错:\n\t%error\n\n是否继续? -Ask before delete SettingsView 删除之前询问 Single window navigation SettingsView 单个窗口导航 parent folder NavMenu 上级目录 contains FindPanel 包含 @@ -452,6 +450,7 @@ Mount DeskWindow 挂载 Mount ContainerWindow 挂载 %capacity (%used used -- %free free) InfoWindow %capacity(已用 %used -- 空闲 %free) Cancel FSClipBoard 取消 +Restart Deskbar DeskWindow 重启桌面栏 Cut more ContainerWindow 更多剪切 Deleting: StatusWindow 删除: Empty Trash InfoWindow 清空垃圾箱 diff --git a/data/catalogs/kits/zh_Hans.catkeys b/data/catalogs/kits/zh_Hans.catkeys index 21c7bda683..7e92ed2dbb 100644 --- a/data/catalogs/kits/zh_Hans.catkeys +++ b/data/catalogs/kits/zh_Hans.catkeys @@ -1,21 +1,29 @@ -1 english x-vnd.Haiku-libbe 864109244 +1 english x-vnd.Haiku-libbe 672385853 +gamma AboutWindow 伽马 +beta AboutWindow beta %3.2f GiB StringForSize %3.2f GiB Written by: AboutWindow 编写: About %app% AboutMenuItem 关于 %app% Cut TextView 剪切 +Version AboutWindow 版本 Cannot create the replicant for \"%description\".\n%error ZombieReplicantView 无法为 \"%description\" 创建克隆控件。\n%error +About AboutWindow 关于 Copy TextView 复制 %3.2f KiB StringForSize %3.2f KiB %d bytes StringForSize %d bytes +alpha AboutWindow 测试 Error PrintJob 错误 No Pages to print! PrintJob 无打印页面! +All Rights Reserved. AboutWindow 保留所有权利 OK Dragger 确定 OK PrintJob 确定 Green: ColorControl 绿色: +Version history: AboutWindow 版本历史: Remove replicant Dragger 删除克隆控件 OK ZombieReplicantView 确定 Print Server is not responding. PrintJob 打印服务未响应。 Paste TextView 粘贴 +Special Thanks: AboutWindow 特别感谢: %.2f TiB StringForSize %.2f TiB Cannot locate the application for the replicant. No application signature supplied.\n%error ZombieReplicantView 无法定位克隆控件应用。未提供应用程序署名。\n%error Redo TextView 恢复 @@ -26,6 +34,8 @@ Undo TextView 撤销 Red: ColorControl 红色: %3.2f MiB StringForSize %3.2f MiB About %app… Dragger 关于 %app... +development AboutWindow 开发 Error ZombieReplicantView 错误 Blue: ColorControl 蓝色: +gold master AboutWindow 最终测试版 Can't delete this replicant from its original application. Life goes on. Dragger 无法从原始应用中删除克隆控件。它将继续存在。 diff --git a/data/catalogs/preferences/appearance/be.catkeys b/data/catalogs/preferences/appearance/be.catkeys index 1cf9a07c59..2c4e816658 100644 --- a/data/catalogs/preferences/appearance/be.catkeys +++ b/data/catalogs/preferences/appearance/be.catkeys @@ -1,4 +1,4 @@ -1 belarusian x-vnd.Haiku-Appearance 1428480647 +1 belarusian x-vnd.Haiku-Appearance 2950529393 Plain font: Font view Просты шрыфт: Control highlight Colors tab Выдзяленне кнопак Control border Colors tab Аблямоўка кнопак @@ -23,27 +23,33 @@ Tooltip background Colors tab Фон падказкі Selected menu item background Colors tab Фон пазначанага пункту меню Antialiasing APRWindow Згладжванне Navigation base Colors tab Базавы колер навігацыі +Selected list item text Colors tab Тэкст пазначанага пункту меню Window border Colors tab Мяжа вакна +Double: DecorSettingsView Падвойны: Window tab text Colors tab Тэкст загалоўку акна Document text Colors tab Тэкст дакументу Navigation pulse Colors tab Колер падсветкі навігацыі Window decorator: DecorSettingsView Дэкаратар вокнаў: Selected menu item text Colors tab Тэкст пазначанага пункту меню Menu background Colors tab Фон меню +List background Colors tab Фон радкоў OK DecorSettingsView Так Control mark Colors tab Адзнакі кнопак Size: Font Selection view Памер: +Selected list item background Colors tab Фон пазначанага радку спіса Panel background Colors tab Фон панэлі Menu font: Font view Шрыфт меню: Colors APRWindow Колеры Control background Colors tab Фон кнопак Inactive window tab Colors tab Неактыўная ўкладка +List item text Colors tab Тэкст радку спіса Appearance System name Афармленне Fixed font: Font view Роўнашырокі шрыфт: The quick brown fox jumps over the lazy dog. Font Selection view Don't translate this literally ! Use a phrase showing all chars from A to Z. У рудога вераб’я ў сховішчы пад фатэлем ляжаць нейкія гаючыя зёлкі. Reduce colored edges filter strength: AntialiasingSettingsView Паменьшыць інтэнсіўнасць фільтру каляровых краёў: Subpixel based anti-aliasing in combination with glyph hinting is not available in this build of Haiku to avoid possible patent issues. To enable this feature, you have to build Haiku yourself and enable certain options in the libfreetype configuration header. AntialiasingSettingsView Субпіксельнае згладжванне ў камбінацыі з хінтынгам сімвалаў недаступнае ў гэтай зборцы Haiku з-за магчымых канфліктаў з патэнтамі. Каб уключыць гэтую функцыю, вы павінны сабрать Haiku самастойна і уключыць канкрэтныя опцыі ў канфігурацыйным загалоўку libfreetype. Control text Colors tab Тэкст кнопак +Single: DecorSettingsView Адзіночны: Tooltip text Colors tab Тэкст падказак Bold font: Font view Тлусты шрыфт: Inactive window border Colors tab Неактыўная мяжа вакна @@ -52,6 +58,7 @@ LCD subpixel AntialiasingSettingsView Субпіксельнае (LCD) Selected menu item border Colors tab Аблямоўка пазначанага пункту меню Strong AntialiasingSettingsView Жырны Panel text Colors tab Тэкст панэлі +Arrow style DecorSettingsView Стыль стрэлкі Monospaced fonts only AntialiasingSettingsView Толькі монашырынныя шрыфты Look and feel APRWindow Выгляд і паводзіны Antialiasing menu AntialiasingSettingsView Меню згладжвання diff --git a/data/catalogs/preferences/appearance/fr.catkeys b/data/catalogs/preferences/appearance/fr.catkeys index 03c0b5ab48..80db42eb66 100644 --- a/data/catalogs/preferences/appearance/fr.catkeys +++ b/data/catalogs/preferences/appearance/fr.catkeys @@ -1,4 +1,4 @@ -1 french x-vnd.Haiku-Appearance 963769669 +1 french x-vnd.Haiku-Appearance 2950529393 Plain font: Font view Police simple : Control highlight Colors tab Mise en valeur de contrôle Control border Colors tab Bordure des contrôles @@ -58,6 +58,7 @@ LCD subpixel AntialiasingSettingsView Sous-pixel LCD Selected menu item border Colors tab Bordure de l'élément sélectionné dans le menu Strong AntialiasingSettingsView Épais Panel text Colors tab Texte des panneaux +Arrow style DecorSettingsView Style de flèche Monospaced fonts only AntialiasingSettingsView Seulement les polices à chasse fixe Look and feel APRWindow Aspect et comportement Antialiasing menu AntialiasingSettingsView Menu lissage diff --git a/data/catalogs/preferences/appearance/lt.catkeys b/data/catalogs/preferences/appearance/lt.catkeys index 96ad3e3b59..04680f6f14 100644 --- a/data/catalogs/preferences/appearance/lt.catkeys +++ b/data/catalogs/preferences/appearance/lt.catkeys @@ -1,4 +1,4 @@ -1 lithuanian x-vnd.Haiku-Appearance 1933110481 +1 lithuanian x-vnd.Haiku-Appearance 3654950032 Plain font: Font view Paprastas šriftas: Control highlight Colors tab Valdiklių paryškinimas Control border Colors tab Valdiklių rėmeliai @@ -24,25 +24,30 @@ Selected menu item background Colors tab Veikiamojo meniu elemento fonas Antialiasing APRWindow Glodinimas Navigation base Colors tab Veikiamojo elemento (židinio) rėmelis Window border Colors tab Veikiamojo lango rėmelis +Double: DecorSettingsView Dvigubas: Window tab text Colors tab Veikiamojo lango antraštės tekstas Document text Colors tab Dokumento tekstas Navigation pulse Colors tab Veikiamojo elemento (židinio) žybsniai Window decorator: DecorSettingsView Langų dekoruoklis: Selected menu item text Colors tab Veikiamojo meniu elemento tekstas Menu background Colors tab Meniu fonas +List background Colors tab Sąrašo fonas OK DecorSettingsView Gerai Size: Font Selection view Dydis: +Selected list item background Colors tab Pasirinktojo sąrašo elemento fonas Panel background Colors tab Skydelių fonas Menu font: Font view Meniu šriftas: Colors APRWindow Spalvos Control background Colors tab Valdiklių fonas Inactive window tab Colors tab Foninių lango antraštės +List item text Colors tab Sąrašo elemento tekstas Appearance System name Išvaizda Fixed font: Font view Lygiaplotis šriftas: The quick brown fox jumps over the lazy dog. Font Selection view Don't translate this literally ! Use a phrase showing all chars from A to Z. Įlinkdama fechtuotojo špaga sublykčiojusi pragręžė apvalų arbūzą. Reduce colored edges filter strength: AntialiasingSettingsView Spalvotų kraštų filtro intensyvumas: Subpixel based anti-aliasing in combination with glyph hinting is not available in this build of Haiku to avoid possible patent issues. To enable this feature, you have to build Haiku yourself and enable certain options in the libfreetype configuration header. AntialiasingSettingsView Subpikselinis glodinimas kartu su taškine korekcija šioje „Haiku“ versijoje yra neprieinamas, dėl galimų patentinių problemų. Norėdami įjungti šią galimybę, turite savarankiškai sukompiliuoti „Haiku“, įjungdami atitinkamas savybes „FreeType“ bibliotekos (libfreetype) antraštiniame derinimo faile. Control text Colors tab Valdiklių tekstas +Single: DecorSettingsView Viengubas: Tooltip text Colors tab Iškylančiųjų paaiškinimų tekstas Bold font: Font view Pastorintas šriftas: Inactive window border Colors tab Foninių langų rėmeliai @@ -51,7 +56,9 @@ LCD subpixel AntialiasingSettingsView subpikselinis LCD Selected menu item border Colors tab Veikiamojo meniu elemento rėmelis Strong AntialiasingSettingsView Intensyvus Panel text Colors tab Skydelių tekstas +Arrow style DecorSettingsView Rodyklės stilius Monospaced fonts only AntialiasingSettingsView tik lygiapločių šriftų +Look and feel APRWindow Išvaizda ir jausena Antialiasing menu AntialiasingSettingsView Glodinimo meniu Fonts APRWindow Šriftai Glyph hinting: AntialiasingSettingsView Rašmenų taškinė korekcija: diff --git a/data/catalogs/preferences/appearance/sk.catkeys b/data/catalogs/preferences/appearance/sk.catkeys index a71000bb34..97d918baf3 100644 --- a/data/catalogs/preferences/appearance/sk.catkeys +++ b/data/catalogs/preferences/appearance/sk.catkeys @@ -1,4 +1,4 @@ -1 slovak x-vnd.Haiku-Appearance 1428480647 +1 slovak x-vnd.Haiku-Appearance 2950529393 Plain font: Font view Základné písmo: Control highlight Colors tab Zvýraznenie ovládacieho prvku Control border Colors tab Okraj ovládacieho prvku @@ -23,27 +23,33 @@ Tooltip background Colors tab Pozadie tipov Selected menu item background Colors tab Pozadie položky zvoleného menu Antialiasing APRWindow Antialiasing Navigation base Colors tab Základ navigácie +Selected list item text Colors tab Text zvolenej položky menu Window border Colors tab Okraj okna +Double: DecorSettingsView Dvojité: Window tab text Colors tab Text záložky okna Document text Colors tab Text dokumentu Navigation pulse Colors tab Pulz navigácie Window decorator: DecorSettingsView Dekorátor okna: Selected menu item text Colors tab Text položky zvoleného menu Menu background Colors tab Pozadie menu +List background Colors tab Pozadie zoznamu OK DecorSettingsView OK Control mark Colors tab Riadiaca značka Size: Font Selection view Veľkosť: +Selected list item background Colors tab Pozadie zvolenej položky menu Panel background Colors tab Pozadie panelu Menu font: Font view Písmo menu: Colors APRWindow Farby Control background Colors tab Pozadie ovládacieho prvku Inactive window tab Colors tab Záložka neaktívneho okna +List item text Colors tab Text položky menu Appearance System name Vzhľad Fixed font: Font view Písmo s pevnou šírkou: The quick brown fox jumps over the lazy dog. Font Selection view Don't translate this literally ! Use a phrase showing all chars from A to Z. Kŕdeľ ďatľov učí koňa obhrýzať kôru a žrať mäso. Reduce colored edges filter strength: AntialiasingSettingsView Zmenšiť silu filtra farebných hrán: Subpixel based anti-aliasing in combination with glyph hinting is not available in this build of Haiku to avoid possible patent issues. To enable this feature, you have to build Haiku yourself and enable certain options in the libfreetype configuration header. AntialiasingSettingsView Subpixlový antialiasing v kombinácii s tipmi grafém nie je v tomto zostavení Haiku dostupný, aby sme sa vyhli možným problémom s pantentmi. Ak chcete túto možnosť zapnúť, musíte si Haiku zostaviť sami a zapnúť isté voľby v konfiguračnom hlavičkovom súbore libfreetype. Control text Colors tab Text ovládacieho prvku +Single: DecorSettingsView Jednoduché: Tooltip text Colors tab Text tipu Bold font: Font view Hrubé písmo: Inactive window border Colors tab Okraj neaktívneho okna @@ -52,6 +58,7 @@ LCD subpixel AntialiasingSettingsView LCD subpixel Selected menu item border Colors tab Okraj vybranej položky menu Strong AntialiasingSettingsView Hrubý Panel text Colors tab Text panelu +Arrow style DecorSettingsView Štýl šípky Monospaced fonts only AntialiasingSettingsView Iba písma s pevnou šírkou znaku Look and feel APRWindow Správanie a vzhľad Antialiasing menu AntialiasingSettingsView Menu antialiasing diff --git a/data/catalogs/preferences/appearance/zh_Hans.catkeys b/data/catalogs/preferences/appearance/zh_Hans.catkeys index 7d2087a955..758da32a71 100644 --- a/data/catalogs/preferences/appearance/zh_Hans.catkeys +++ b/data/catalogs/preferences/appearance/zh_Hans.catkeys @@ -1,4 +1,4 @@ -1 english x-vnd.Haiku-Appearance 1428480647 +1 english x-vnd.Haiku-Appearance 2950529393 Plain font: Font view 常规字体 Control highlight Colors tab 控件亮度 Control border Colors tab 控件边界 @@ -23,27 +23,33 @@ Tooltip background Colors tab 工具提示背景 Selected menu item background Colors tab 选择菜单背景 Antialiasing APRWindow 抗锯齿 Navigation base Colors tab 快速导航 +Selected list item text Colors tab 选中列表项文本 Window border Colors tab 窗口边框 +Double: DecorSettingsView 双行: Window tab text Colors tab 窗口标签文本 Document text Colors tab 文件文本 Navigation pulse Colors tab 导航引导 Window decorator: DecorSettingsView 窗口装饰: Selected menu item text Colors tab 选择菜单文本 Menu background Colors tab 菜单背景 +List background Colors tab 列表背景 OK DecorSettingsView 确定 Control mark Colors tab 控件标记 Size: Font Selection view 大小: +Selected list item background Colors tab 选中列表项背景 Panel background Colors tab 面板背景 Menu font: Font view 菜单字体: Colors APRWindow 颜色 Control background Colors tab 控件背景 Inactive window tab Colors tab 活动窗口标签 +List item text Colors tab 列表项文本 Appearance System name 外观 Fixed font: Font view 等宽字体 The quick brown fox jumps over the lazy dog. Font Selection view Don't translate this literally ! Use a phrase showing all chars from A to Z. 迅捷的棕毛小狐狸越过了懒惰的大黄狗。 Reduce colored edges filter strength: AntialiasingSettingsView 减小彩色边缘滤色强度: Subpixel based anti-aliasing in combination with glyph hinting is not available in this build of Haiku to avoid possible patent issues. To enable this feature, you have to build Haiku yourself and enable certain options in the libfreetype configuration header. AntialiasingSettingsView 为了避免可能的版权争端,基于抗锯齿技术的“象形文字亚像素精度”显示在当前编译的 Haiku 中尚不可用。为了使用该特性,你必须自己进行 Haiku 的编译,并且只需在 libfreetype 设置头文件中使用相关的选项即可。 Control text Colors tab 控件文本 +Single: DecorSettingsView 单行: Tooltip text Colors tab 提示文本 Bold font: Font view 粗体: Inactive window border Colors tab 禁用窗口边框 @@ -52,6 +58,7 @@ LCD subpixel AntialiasingSettingsView LCD 亚像素精度 Selected menu item border Colors tab 选择菜单项边界 Strong AntialiasingSettingsView 强 Panel text Colors tab 面板文本 +Arrow style DecorSettingsView 箭头样式 Monospaced fonts only AntialiasingSettingsView 仅等宽字体 Look and feel APRWindow 外观感觉 Antialiasing menu AntialiasingSettingsView 抗锯齿菜单 diff --git a/data/catalogs/preferences/filetypes/be.catkeys b/data/catalogs/preferences/filetypes/be.catkeys index 79d3054d82..2ce235f1b9 100644 --- a/data/catalogs/preferences/filetypes/be.catkeys +++ b/data/catalogs/preferences/filetypes/be.catkeys @@ -1,4 +1,4 @@ -1 belarusian x-vnd.Haiku-FileTypes 2496450458 +1 belarusian x-vnd.Haiku-FileTypes 133192727 Application types… FileTypes Window Тыпы праграм… Description: Application Types Window Апісанне: Args only Application Type Window Толькі аргументы @@ -16,7 +16,6 @@ New file type New File Type Window Стварыць новы тып Rule: FileTypes Window Правіла: Add icon… Icon View Дадаць іконку… Multiple files from \"%s\" file type FileType Window Множныя файлы тыпу \"%s\" -Do you want to save the changes? Application Type Window Жадаеце захаваць змены? File type FileType Window Тып файла Could not change attributes Attribute Window Немагчыма змяніць атрыбуты Could not retrieve preferred application of this file Preferred App Menu Не ўдалося вызначыць пажаданую праграму для гэтага файла @@ -50,6 +49,8 @@ Group name: New File Type Window Імя групы: Preferred application FileType Window Пажаданая праграма Progress Application Types Window Прагрэс Set preferred application Preferred App Menu Прызначыць пажаданую праграму +Don't save Application Type Window Не захоўваць +Save changes before closing? Application Type Window Захаваць змены перад зачыненнем? File Application Type Window Файл Version: Application Type Window Версія: Select… FileTypes Window Выбраць… @@ -72,7 +73,6 @@ Special: Attribute Window Спецыяльны: Alpha Application Type Window Альфа Add… FileTypes Window Дадаць… Signature: Application Type Window Подпіс: -Quit, don't save Application Type Window Выйсьці, не захоўваць Add… Application Type Window Дадаць… [Multiple files] file types FileType Window [Множныя файлы] тыпы файлаў Information Application Types Window Інфармацыя diff --git a/data/catalogs/preferences/filetypes/de.catkeys b/data/catalogs/preferences/filetypes/de.catkeys index 79763e6ac9..ee9e358d1b 100644 --- a/data/catalogs/preferences/filetypes/de.catkeys +++ b/data/catalogs/preferences/filetypes/de.catkeys @@ -1,4 +1,4 @@ -1 german x-vnd.Haiku-FileTypes 2496450458 +1 german x-vnd.Haiku-FileTypes 133192727 Application types… FileTypes Window Anwendungstypen… Description: Application Types Window Beschreibung: Args only Application Type Window Nur Argumente @@ -16,7 +16,6 @@ New file type New File Type Window Neuer Dateityp Rule: FileTypes Window Regel: Add icon… Icon View Icon hinzufügen… Multiple files from \"%s\" file type FileType Window Mehrere Dateien vom Typ \"%s\" -Do you want to save the changes? Application Type Window Sollen die Änderungen gespeichert werden? File type FileType Window Dateityp Could not change attributes Attribute Window Attribute konnten nicht verändert werden Could not retrieve preferred application of this file Preferred App Menu Die bevorzugte Anwendung für diese Datei konnte nicht gefunden werden @@ -50,6 +49,8 @@ Group name: New File Type Window Gruppenname: Preferred application FileType Window Bevorzugte Anwendung Progress Application Types Window Fortschritt Set preferred application Preferred App Menu Bevorzugte Anwendung wählen +Don't save Application Type Window Nicht speichern +Save changes before closing? Application Type Window Änderungen vor dem Schließen speichern? File Application Type Window Datei Version: Application Type Window Version: Select… FileTypes Window Auswählen… @@ -72,7 +73,6 @@ Special: Attribute Window Spezial: Alpha Application Type Window Alpha Add… FileTypes Window Hinzu… Signature: Application Type Window Signatur: -Quit, don't save Application Type Window Beenden, nicht speichern Add… Application Type Window Hinzu… [Multiple files] file types FileType Window [Mehrere Dateien] Dateitypen Information Application Types Window Information diff --git a/data/catalogs/preferences/filetypes/el.catkeys b/data/catalogs/preferences/filetypes/el.catkeys index a4853892e8..d355f03267 100644 --- a/data/catalogs/preferences/filetypes/el.catkeys +++ b/data/catalogs/preferences/filetypes/el.catkeys @@ -1,4 +1,4 @@ -1 greek, modern (1453-) x-vnd.Haiku-FileTypes 2037267651 +1 greek, modern (1453-) x-vnd.Haiku-FileTypes 599989122 Application types… FileTypes Window Τύποι εφαρμογής... Description: Application Types Window Περιγραφή: Args only Application Type Window Μόνο παράμετροι @@ -16,7 +16,6 @@ New file type New File Type Window Νέος τύπος αρχείου Rule: FileTypes Window Κανόνας: Add icon… Icon View Προσθήκη εικονίδιου... Multiple files from \"%s\" file type FileType Window Πολλαπλά αρχεία από \"%s\" τύπος αρχείου -Do you want to save the changes? Application Type Window Θέλετε να αποθηκεύσετε τις αλλαγές; File type FileType Window Τύπος αρχείου Could not change attributes Attribute Window Δεν ήταν δυνατή η αλλαγή των ιδιοτήτων Could not retrieve preferred application of this file Preferred App Menu Αδυναμία ανάκτησης προτεινόμενης εφαρμογής του αρχείου @@ -71,7 +70,6 @@ Special: Attribute Window Ειδικό: Alpha Application Type Window Άλφα Add… FileTypes Window Προσθήκη... Signature: Application Type Window Υπογραφή: -Quit, don't save Application Type Window Έξοδος, χωρίς αποθήκευση Add… Application Type Window Προσθήκη... [Multiple files] file types FileType Window [Πολλαπλά αρχεία] τύποι αρχείων Information Application Types Window Πληροφορίες diff --git a/data/catalogs/preferences/filetypes/fi.catkeys b/data/catalogs/preferences/filetypes/fi.catkeys index 20d319dd1e..76c56037dc 100644 --- a/data/catalogs/preferences/filetypes/fi.catkeys +++ b/data/catalogs/preferences/filetypes/fi.catkeys @@ -1,4 +1,4 @@ -1 finnish x-vnd.Haiku-FileTypes 2496450458 +1 finnish x-vnd.Haiku-FileTypes 1059171929 Application types… FileTypes Window Sovellustyypit… Description: Application Types Window Kuvaus: Args only Application Type Window Vain argumentit @@ -16,7 +16,6 @@ New file type New File Type Window Uusi tiedostotyyppi Rule: FileTypes Window Sääntö: Add icon… Icon View Lisää kuvake… Multiple files from \"%s\" file type FileType Window Useita tiedostoja ”%s”-tiedostotyypistä -Do you want to save the changes? Application Type Window Haluatko tallentaa muutokset? File type FileType Window Tiedostotyyppi Could not change attributes Attribute Window Ei voitu muuttaa attribuutteja Could not retrieve preferred application of this file Preferred App Menu Ei voitu noutaa tämän tiedoston ensisijaista sovellusta @@ -72,7 +71,6 @@ Special: Attribute Window Erityinen: Alpha Application Type Window Alfa Add… FileTypes Window Lisää… Signature: Application Type Window Allekirjoitus: -Quit, don't save Application Type Window Poistu, älä tallenna Add… Application Type Window Lisää… [Multiple files] file types FileType Window [Useita tiedostoja] tiedostotyypit Information Application Types Window Tiedot diff --git a/data/catalogs/preferences/filetypes/fr.catkeys b/data/catalogs/preferences/filetypes/fr.catkeys index 7d3b639bd9..d5db1ca5b5 100644 --- a/data/catalogs/preferences/filetypes/fr.catkeys +++ b/data/catalogs/preferences/filetypes/fr.catkeys @@ -1,4 +1,4 @@ -1 french x-vnd.Haiku-FileTypes 2496450458 +1 french x-vnd.Haiku-FileTypes 133192727 Application types… FileTypes Window Types d'applications… Description: Application Types Window Description : Args only Application Type Window Arguments seuls @@ -16,7 +16,6 @@ New file type New File Type Window Nouveau type de fichier Rule: FileTypes Window Règle : Add icon… Icon View Ajouter une icône… Multiple files from \"%s\" file type FileType Window Plusieurs fichiers sont basés sur le type « %s » -Do you want to save the changes? Application Type Window Voulez-vous enregistrer les changements ? File type FileType Window Type de fichier Could not change attributes Attribute Window Impossible de modifier les attributs Could not retrieve preferred application of this file Preferred App Menu L'application préférée de ce fichier n'a pas pu être récupérée @@ -50,6 +49,8 @@ Group name: New File Type Window Nom de groupe : Preferred application FileType Window Application préférée Progress Application Types Window Progression Set preferred application Preferred App Menu Définir l'application préférée +Don't save Application Type Window Ne pas sauvegarder +Save changes before closing? Application Type Window Voulez-vous enregistrer les modifications avant de fermer ? File Application Type Window Fichier Version: Application Type Window Version : Select… FileTypes Window Sélectioner… @@ -72,7 +73,6 @@ Special: Attribute Window Spécial : Alpha Application Type Window Alpha Add… FileTypes Window Ajouter… Signature: Application Type Window Signature : -Quit, don't save Application Type Window Quitter sans enregistrer Add… Application Type Window Ajouter… [Multiple files] file types FileType Window [Plusieurs fichiers] types de fichiers Information Application Types Window Information diff --git a/data/catalogs/preferences/filetypes/hi.catkeys b/data/catalogs/preferences/filetypes/hi.catkeys index 3f2dcaf57c..bf554699df 100644 --- a/data/catalogs/preferences/filetypes/hi.catkeys +++ b/data/catalogs/preferences/filetypes/hi.catkeys @@ -1,4 +1,4 @@ -1 hindi x-vnd.Haiku-FileTypes 2037267651 +1 hindi x-vnd.Haiku-FileTypes 599989122 Application types… FileTypes Window आवेदन के प्रकार... Description: Application Types Window विवरण Args only Application Type Window केवल अर्ग्स @@ -16,7 +16,6 @@ New file type New File Type Window नए फ़ाइल के प्रक Rule: FileTypes Window नियम: Add icon… Icon View चिह्न जोड़... Multiple files from \"%s\" file type FileType Window \"%s\" प्रकार के फ़ाइल में से एकाधिक फाइल -Do you want to save the changes? Application Type Window क्या आप परिवर्तनों को सेव चाहते हैं File type FileType Window फ़ाइल के प्रकार Could not change attributes Attribute Window गुणों को बदलने नहीं जा सका Could not retrieve preferred application of this file Preferred App Menu इस फाइल के वरीय अनुप्रयोग पुनर्प्राप्त नहीं कर सके @@ -71,7 +70,6 @@ Special: Attribute Window विशेष: Alpha Application Type Window अल्फा Add… FileTypes Window जोड़ें... Signature: Application Type Window हस्ताक्षर: -Quit, don't save Application Type Window छोड़ो, जमा मत करो Add… Application Type Window जोड़ें... [Multiple files] file types FileType Window फ़ाइल प्रकार [एकाधिक फाइलें] Information Application Types Window जानकारी diff --git a/data/catalogs/preferences/filetypes/hu.catkeys b/data/catalogs/preferences/filetypes/hu.catkeys index cf71233d44..16551cc3f1 100644 --- a/data/catalogs/preferences/filetypes/hu.catkeys +++ b/data/catalogs/preferences/filetypes/hu.catkeys @@ -1,4 +1,4 @@ -1 hungarian x-vnd.Haiku-FileTypes 2496450458 +1 hungarian x-vnd.Haiku-FileTypes 133192727 Application types… FileTypes Window Programtípusok… Description: Application Types Window Leírás: Args only Application Type Window Csak paraméterek @@ -16,7 +16,6 @@ New file type New File Type Window Új fájltípus Rule: FileTypes Window Szabály: Add icon… Icon View Ikon hozzáadása… Multiple files from \"%s\" file type FileType Window Több \"%s\" típusú fájl -Do you want to save the changes? Application Type Window Elmenti a változtatásokat? File type FileType Window Fájltípus Could not change attributes Attribute Window Nem lehetett módosítani a jellemzőket Could not retrieve preferred application of this file Preferred App Menu Nem található az ehhez a fájlhoz használandó program @@ -50,6 +49,8 @@ Group name: New File Type Window Csoport neve: Preferred application FileType Window Előnyben részesített program Progress Application Types Window Folyamat Set preferred application Preferred App Menu Előnyben részesített program megadása +Don't save Application Type Window Ne mentse +Save changes before closing? Application Type Window Menti a változtatásokat kilépés előtt? File Application Type Window Fájl Version: Application Type Window Verzió: Select… FileTypes Window Kiválasztás… @@ -72,7 +73,6 @@ Special: Attribute Window Különleges: Alpha Application Type Window Alfa Add… FileTypes Window Hozzáadás… Signature: Application Type Window Aláírás: -Quit, don't save Application Type Window Kilépés mentés nélkül Add… Application Type Window Hozzáadás… [Multiple files] file types FileType Window [Többféle fájl] fájltípusai Information Application Types Window Információ diff --git a/data/catalogs/preferences/filetypes/ja.catkeys b/data/catalogs/preferences/filetypes/ja.catkeys index f8d883d34d..eb1926017d 100644 --- a/data/catalogs/preferences/filetypes/ja.catkeys +++ b/data/catalogs/preferences/filetypes/ja.catkeys @@ -1,4 +1,4 @@ -1 japanese x-vnd.Haiku-FileTypes 2496450458 +1 japanese x-vnd.Haiku-FileTypes 133192727 Application types… FileTypes Window アプリケーションタイプ… Description: Application Types Window 説明: Args only Application Type Window 引数のみ @@ -16,7 +16,6 @@ New file type New File Type Window 新規ファイルタイプ Rule: FileTypes Window ルール: Add icon… Icon View アイコンを追加… Multiple files from \"%s\" file type FileType Window \"%s\"というファイルタイプで始まる複数ファイル -Do you want to save the changes? Application Type Window 変更を保存しますか? File type FileType Window ファイルタイプ Could not change attributes Attribute Window 属性を変更できません Could not retrieve preferred application of this file Preferred App Menu このファイルの優先アプリケーションを検索できませんでした。 @@ -50,6 +49,8 @@ Group name: New File Type Window グループ名: Preferred application FileType Window 優先アプリケーション Progress Application Types Window 進行状況 Set preferred application Preferred App Menu 優先アプリケーションを設定する +Don't save Application Type Window 保存しない +Save changes before closing? Application Type Window 閉じる前に変更を保存しますか? File Application Type Window ファイル Version: Application Type Window バージョン: Select… FileTypes Window 選択… @@ -72,7 +73,6 @@ Special: Attribute Window 特別: Alpha Application Type Window アルファ版 Add… FileTypes Window 追加… Signature: Application Type Window 署名: -Quit, don't save Application Type Window 保存せずに終了する Add… Application Type Window 追加… [Multiple files] file types FileType Window [複数ファイル] ファイルタイプ Information Application Types Window 情報 diff --git a/data/catalogs/preferences/filetypes/lt.catkeys b/data/catalogs/preferences/filetypes/lt.catkeys index f1ccb631e3..76242390e8 100644 --- a/data/catalogs/preferences/filetypes/lt.catkeys +++ b/data/catalogs/preferences/filetypes/lt.catkeys @@ -1,4 +1,4 @@ -1 lithuanian x-vnd.Haiku-FileTypes 2496450458 +1 lithuanian x-vnd.Haiku-FileTypes 1059171929 Application types… FileTypes Window Programų tipai… Description: Application Types Window Aprašas: Args only Application Type Window Tik argumentai @@ -16,7 +16,6 @@ New file type New File Type Window Naujas failų tipas Rule: FileTypes Window Taisyklė: Add icon… Icon View Pridėti piktogramą… Multiple files from \"%s\" file type FileType Window Keleto aplanke „%s“ esančių failų tipas -Do you want to save the changes? Application Type Window Ar norite įrašyti pakeitimus? File type FileType Window Failo (-ų) tipas Could not change attributes Attribute Window Požymių pakeisti nepavyko Could not retrieve preferred application of this file Preferred App Menu Pageidautina programa šiam failui nerasta @@ -72,7 +71,6 @@ Special: Attribute Window Ypatingas: Alpha Application Type Window Alfa Add… FileTypes Window Pridėti… Signature: Application Type Window Identifikatorius: -Quit, don't save Application Type Window Baigti neišsaugant Add… Application Type Window Pridėti… [Multiple files] file types FileType Window (Keleto) failų tipas Information Application Types Window Informacija diff --git a/data/catalogs/preferences/filetypes/nl.catkeys b/data/catalogs/preferences/filetypes/nl.catkeys index ff0d3d41ff..ce90eca4f3 100644 --- a/data/catalogs/preferences/filetypes/nl.catkeys +++ b/data/catalogs/preferences/filetypes/nl.catkeys @@ -1,4 +1,4 @@ -1 dutch; flemish x-vnd.Haiku-FileTypes 2496450458 +1 dutch; flemish x-vnd.Haiku-FileTypes 1059171929 Application types… FileTypes Window Toepassingstypes... Description: Application Types Window Beschrijving: Args only Application Type Window Alleen argumenten @@ -16,7 +16,6 @@ New file type New File Type Window Nieuw bestandstype Rule: FileTypes Window Regel: Add icon… Icon View Icoon toevoegen… Multiple files from \"%s\" file type FileType Window Meerdere bestanden van \"%s\" bestandstype -Do you want to save the changes? Application Type Window Wilt u de veranderingen opslaan? File type FileType Window Bestandstype Could not change attributes Attribute Window Kon attributen niet veranderen Could not retrieve preferred application of this file Preferred App Menu Kon de voorkeurstoepassing van dit bestand niet verkrijgen @@ -72,7 +71,6 @@ Special: Attribute Window Speciaal: Alpha Application Type Window Alfa Add… FileTypes Window Toevoegen... Signature: Application Type Window Onderschrift: -Quit, don't save Application Type Window Afsluiten zonder opslaan Add… Application Type Window Toevoegen… [Multiple files] file types FileType Window [Meerdere bestanden] Bestandstypen Information Application Types Window Informatie diff --git a/data/catalogs/preferences/filetypes/pl.catkeys b/data/catalogs/preferences/filetypes/pl.catkeys index 0762738b87..fd9e9eed24 100644 --- a/data/catalogs/preferences/filetypes/pl.catkeys +++ b/data/catalogs/preferences/filetypes/pl.catkeys @@ -1,4 +1,4 @@ -1 polish x-vnd.Haiku-FileTypes 2496450458 +1 polish x-vnd.Haiku-FileTypes 1059171929 Application types… FileTypes Window Typy aplikacji… Description: Application Types Window Opis: Args only Application Type Window Tylko argumenty @@ -16,7 +16,6 @@ New file type New File Type Window Nowy typ pliku Rule: FileTypes Window Zasada: Add icon… Icon View Dodaj ikonę… Multiple files from \"%s\" file type FileType Window Wiele plików z typu pliku \"%s\" -Do you want to save the changes? Application Type Window Czy chcesz zapisać zmiany? File type FileType Window Typ pliku Could not change attributes Attribute Window Nie można zmienić atrybutów Could not retrieve preferred application of this file Preferred App Menu Nie można odnaleźć preferowanej aplikacji dla tego typu pliku @@ -72,7 +71,6 @@ Special: Attribute Window Specjalne: Alpha Application Type Window Alpha Add… FileTypes Window Dodaj… Signature: Application Type Window Sygnatura: -Quit, don't save Application Type Window Wyjdź i nie zapisuj Add… Application Type Window Dodaj… [Multiple files] file types FileType Window [Wiele plików] typów plików Information Application Types Window Informacje diff --git a/data/catalogs/preferences/filetypes/pt_BR.catkeys b/data/catalogs/preferences/filetypes/pt_BR.catkeys index 1e67cd8aa4..5f732d562d 100644 --- a/data/catalogs/preferences/filetypes/pt_BR.catkeys +++ b/data/catalogs/preferences/filetypes/pt_BR.catkeys @@ -1,4 +1,4 @@ -1 portuguese (brazil) x-vnd.Haiku-FileTypes 2496450458 +1 portuguese (brazil) x-vnd.Haiku-FileTypes 133192727 Application types… FileTypes Window Tipos de aplicativo... Description: Application Types Window Descrição: Args only Application Type Window Somente argumentos @@ -16,7 +16,6 @@ New file type New File Type Window Novo tipo de arquivo Rule: FileTypes Window Regra: Add icon… Icon View Adicionar ícone… Multiple files from \"%s\" file type FileType Window Multiplos arquivos do tipo \"%s\" -Do you want to save the changes? Application Type Window Você deseja salvar as alterações? File type FileType Window Tipo de arquivo Could not change attributes Attribute Window Não foi possível alterar atributos Could not retrieve preferred application of this file Preferred App Menu Não foi possível encontrar o aplicativo preferido desse arquivo @@ -50,6 +49,8 @@ Group name: New File Type Window Nome do grupo: Preferred application FileType Window Aplicativo preferido Progress Application Types Window Progresso Set preferred application Preferred App Menu Definir aplicativo preferido +Don't save Application Type Window Não salvar +Save changes before closing? Application Type Window Salvar alterações antes de fechar? File Application Type Window Arquivo Version: Application Type Window Versão: Select… FileTypes Window Selecionar... @@ -72,7 +73,6 @@ Special: Attribute Window Especial: Alpha Application Type Window Alfa Add… FileTypes Window Adicionar... Signature: Application Type Window Assinatura: -Quit, don't save Application Type Window Sair sem salvar Add… Application Type Window Adicionar… [Multiple files] file types FileType Window tipos de arquivo [Multiplos arquivos] Information Application Types Window Informação diff --git a/data/catalogs/preferences/filetypes/ro.catkeys b/data/catalogs/preferences/filetypes/ro.catkeys index c89695f08b..c497d11fdb 100644 --- a/data/catalogs/preferences/filetypes/ro.catkeys +++ b/data/catalogs/preferences/filetypes/ro.catkeys @@ -1,4 +1,4 @@ -1 romanian x-vnd.Haiku-FileTypes 2037267651 +1 romanian x-vnd.Haiku-FileTypes 599989122 Application types… FileTypes Window Tipuri de aplicații... Description: Application Types Window Descriere: Args only Application Type Window Doar arg @@ -16,7 +16,6 @@ New file type New File Type Window Tip de fișier nou: Rule: FileTypes Window Regulă: Add icon… Icon View Adaugă pictogramă... Multiple files from \"%s\" file type FileType Window Fișiere multiple de la tipul de fișier \„%s\” -Do you want to save the changes? Application Type Window Doriți să salvați modificările? File type FileType Window Tip de fișier Could not change attributes Attribute Window Nu s-au putut modifica atributele Could not retrieve preferred application of this file Preferred App Menu Nu s-a putut obține aplicația preferată a acestui fișier @@ -71,7 +70,6 @@ Special: Attribute Window Special: Alpha Application Type Window Alfa Add… FileTypes Window Adaugă... Signature: Application Type Window Semnătură: -Quit, don't save Application Type Window Părăsește, nu salva Add… Application Type Window Adaugă... [Multiple files] file types FileType Window [Fișiere multiple] tipuri de fișiere Information Application Types Window Infomație diff --git a/data/catalogs/preferences/filetypes/ru.catkeys b/data/catalogs/preferences/filetypes/ru.catkeys index 57afccff5e..7065db88df 100644 --- a/data/catalogs/preferences/filetypes/ru.catkeys +++ b/data/catalogs/preferences/filetypes/ru.catkeys @@ -1,4 +1,4 @@ -1 russian x-vnd.Haiku-FileTypes 2496450458 +1 russian x-vnd.Haiku-FileTypes 1059171929 Application types… FileTypes Window Типы приложений… Description: Application Types Window Описание: Args only Application Type Window Только аргументы @@ -16,7 +16,6 @@ New file type New File Type Window Новый тип файла Rule: FileTypes Window Правило: Add icon… Icon View Добавить значок… Multiple files from \"%s\" file type FileType Window Множество файлов из типа файла \"%s\" -Do you want to save the changes? Application Type Window Хотите сохранить изменения? File type FileType Window Тип файла Could not change attributes Attribute Window Невозможно изменить атрибуты Could not retrieve preferred application of this file Preferred App Menu Невозможно определить предпочтительное приложение этого файла @@ -72,7 +71,6 @@ Special: Attribute Window Особый: Alpha Application Type Window Альфа Add… FileTypes Window Добавить… Signature: Application Type Window Сигнатура: -Quit, don't save Application Type Window Выйти без сохранения Add… Application Type Window Добавить… [Multiple files] file types FileType Window [Несколько файлов] типы файлов Information Application Types Window Информация diff --git a/data/catalogs/preferences/filetypes/sk.catkeys b/data/catalogs/preferences/filetypes/sk.catkeys index c10632762f..75482c088d 100644 --- a/data/catalogs/preferences/filetypes/sk.catkeys +++ b/data/catalogs/preferences/filetypes/sk.catkeys @@ -1,4 +1,4 @@ -1 slovak x-vnd.Haiku-FileTypes 2496450458 +1 slovak x-vnd.Haiku-FileTypes 1059171929 Application types… FileTypes Window Typy aplikácií… Description: Application Types Window Popis: Args only Application Type Window Iba argumenty @@ -16,7 +16,6 @@ New file type New File Type Window Nový typ súboru Rule: FileTypes Window Pravidlo: Add icon… Icon View Pridať ikonu… Multiple files from \"%s\" file type FileType Window Viaceré súbory z typu „%s“ -Do you want to save the changes? Application Type Window Chcete uložiť zmeny? File type FileType Window Typ súboru Could not change attributes Attribute Window Nepodarilo sa zmeniť atribúty Could not retrieve preferred application of this file Preferred App Menu Nepodarilo sa získať preferovanú aplikáciu pre tento typ súboru @@ -72,7 +71,6 @@ Special: Attribute Window Špeciálne: Alpha Application Type Window Alfa Add… FileTypes Window Pridať… Signature: Application Type Window Podpis: -Quit, don't save Application Type Window Ukončiť, neukladať Add… Application Type Window Pridať… [Multiple files] file types FileType Window [Viaceré súbory] typy súborov Information Application Types Window Informácie diff --git a/data/catalogs/preferences/filetypes/sv.catkeys b/data/catalogs/preferences/filetypes/sv.catkeys index 2332dfd985..dd569e8a51 100644 --- a/data/catalogs/preferences/filetypes/sv.catkeys +++ b/data/catalogs/preferences/filetypes/sv.catkeys @@ -1,4 +1,4 @@ -1 swedish x-vnd.Haiku-FileTypes 2496450458 +1 swedish x-vnd.Haiku-FileTypes 1059171929 Application types… FileTypes Window Programtyper... Description: Application Types Window Beskrivning: Args only Application Type Window Endast argument @@ -16,7 +16,6 @@ New file type New File Type Window Ny filtyp Rule: FileTypes Window Regel: Add icon… Icon View Lägg till ikon… Multiple files from \"%s\" file type FileType Window Flera filer från \"%s" filtypen -Do you want to save the changes? Application Type Window Vill du spara ändringarna? File type FileType Window Filtyp Could not change attributes Attribute Window Kan inte ändra attribut Could not retrieve preferred application of this file Preferred App Menu Kunde inte hämta förinställt program för denna fil @@ -72,7 +71,6 @@ Special: Attribute Window Special: Alpha Application Type Window Alfa Add… FileTypes Window Lägg till... Signature: Application Type Window Signatur: -Quit, don't save Application Type Window Avsluta utan att spara Add… Application Type Window Lägg till… [Multiple files] file types FileType Window [Flera filer] filtyper Information Application Types Window Information diff --git a/data/catalogs/preferences/filetypes/uk.catkeys b/data/catalogs/preferences/filetypes/uk.catkeys index 3ffdd7a74f..2fe8cd6c3b 100644 --- a/data/catalogs/preferences/filetypes/uk.catkeys +++ b/data/catalogs/preferences/filetypes/uk.catkeys @@ -1,4 +1,4 @@ -1 ukrainian x-vnd.Haiku-FileTypes 2037267651 +1 ukrainian x-vnd.Haiku-FileTypes 599989122 Application types… FileTypes Window Типи додатків… Description: Application Types Window Опис: Args only Application Type Window Тільки аргументи @@ -16,7 +16,6 @@ New file type New File Type Window Новий тип файлу Rule: FileTypes Window Правило: Add icon… Icon View Додати іконку… Multiple files from \"%s\" file type FileType Window Багаточисельні файли з\"%s\" типу файлу -Do you want to save the changes? Application Type Window Бажаєте зберегти зміни? File type FileType Window Тип файлу Could not change attributes Attribute Window Неможливо змінити атрибути Could not retrieve preferred application of this file Preferred App Menu Неможливо виправити бажаний додаток для цього файлу @@ -71,7 +70,6 @@ Special: Attribute Window Особливий: Alpha Application Type Window Альфа Add… FileTypes Window Додати… Signature: Application Type Window Підпис -Quit, don't save Application Type Window Вийти без збереження Add… Application Type Window Додати… [Multiple files] file types FileType Window [Множинні файли] типи файлів Information Application Types Window Інформація diff --git a/data/catalogs/preferences/filetypes/zh_Hans.catkeys b/data/catalogs/preferences/filetypes/zh_Hans.catkeys index 714c742428..0acab181cd 100644 --- a/data/catalogs/preferences/filetypes/zh_Hans.catkeys +++ b/data/catalogs/preferences/filetypes/zh_Hans.catkeys @@ -1,4 +1,4 @@ -1 english x-vnd.Haiku-FileTypes 2496450458 +1 english x-vnd.Haiku-FileTypes 133192727 Application types… FileTypes Window 应用程序类型... Description: Application Types Window 描述: Args only Application Type Window 仅含参数 @@ -16,7 +16,6 @@ New file type New File Type Window 新建文件类型 Rule: FileTypes Window 规则: Add icon… Icon View 增加图标… Multiple files from \"%s\" file type FileType Window \"%s\"文件类型的复合文件 -Do you want to save the changes? Application Type Window 是否保留配置? File type FileType Window 文件类型 Could not change attributes Attribute Window 无法改变属性 Could not retrieve preferred application of this file Preferred App Menu 未检索到该文件的首选程序 @@ -50,6 +49,8 @@ Group name: New File Type Window 组名: Preferred application FileType Window 首选程序 Progress Application Types Window 进程 Set preferred application Preferred App Menu 设置首选应用 +Don't save Application Type Window 不保存 +Save changes before closing? Application Type Window 关闭前是否保存修改? File Application Type Window 文件 Version: Application Type Window 版本: Select… FileTypes Window 选择 @@ -72,7 +73,6 @@ Special: Attribute Window 特性: Alpha Application Type Window 内测版 Add… FileTypes Window 添加... Signature: Application Type Window 署名: -Quit, don't save Application Type Window 不保存,退出 Add… Application Type Window 添加… [Multiple files] file types FileType Window [复合文件]类型 Information Application Types Window 信息 diff --git a/data/catalogs/preferences/shortcuts/be.catkeys b/data/catalogs/preferences/shortcuts/be.catkeys index 6ba7c712e1..85fd759c62 100644 --- a/data/catalogs/preferences/shortcuts/be.catkeys +++ b/data/catalogs/preferences/shortcuts/be.catkeys @@ -1,4 +1,4 @@ -1 belarusian x-vnd.Haiku-Shortcuts 621368175 +1 belarusian x-vnd.Haiku-Shortcuts 3661393357 Error, NULL state description?\n ShortcutsSpec Памылка, апісанне стану NULL?\n MoveMouse ShortcutsSpec РухацьМыш OK ShortcutsWindow ОК @@ -25,6 +25,7 @@ Save ShortcutsWindow Захаваць *MouseButton 1 ShortcutsWindow *КнопкаМышы 1 *MoveMouse +20 +0 ShortcutsWindow *РухацьМыш +20 +0 MouseDown ShortcutsSpec МышУніз +Save changes before closing? ShortcutsWindow Захаваць змены перад зачыненнем? Remove selected shortcut ShortcutsWindow Выдаліць выбраную гарачую клавішу MouseButton ShortcutsSpec КнопкаМышы Add new shortcut ShortcutsWindow Дадаць новую гарачую клавішу @@ -43,7 +44,6 @@ Shift ShortcutsSpec Name for modifier on keyboard Shift *MoveMouseTo 50% 50% ShortcutsWindow *РухацьМышДа 50% 50% Save KeySet as… ShortcutsWindow Захаваць KeySet як… Open ShortcutsWindow Адкрыць -Really quit without saving your changes? ShortcutsWindow Сапраўды выйсці, не захоўваючы змены? Shortcuts was unable to parse your KeySet file! ShortcutsWindow Рэдактар Гарачых Клавішаў не змог разабраць ваш файл KeySet! Select ShortcutsWindow Выбраць Shortcuts was unable to save your KeySet file! ShortcutsWindow Рэдактар Гарачых Клавішаў не змог захаваць ваш файл KeySet! diff --git a/data/catalogs/preferences/shortcuts/de.catkeys b/data/catalogs/preferences/shortcuts/de.catkeys index 577e45b266..5c23a24f85 100644 --- a/data/catalogs/preferences/shortcuts/de.catkeys +++ b/data/catalogs/preferences/shortcuts/de.catkeys @@ -1,4 +1,4 @@ -1 german x-vnd.Haiku-Shortcuts 621368175 +1 german x-vnd.Haiku-Shortcuts 3661393357 Error, NULL state description?\n ShortcutsSpec Fehler, NULL Status Beschreibung?\n MoveMouse ShortcutsSpec Bewege Maus OK ShortcutsWindow OK @@ -25,6 +25,7 @@ Save ShortcutsWindow Speichern *MouseButton 1 ShortcutsWindow *Maustaste 1 drücken *MoveMouse +20 +0 ShortcutsWindow *Maus 20 Pixel nach rechts bewegen MouseDown ShortcutsSpec Maustaste gedrückt +Save changes before closing? ShortcutsWindow Änderungen vor dem Schließen speichern? Remove selected shortcut ShortcutsWindow Markierten Eintrag entfernen MouseButton ShortcutsSpec Maustaste Add new shortcut ShortcutsWindow Neue Tasten-Kombi @@ -43,7 +44,6 @@ Shift ShortcutsSpec Name for modifier on keyboard Shift *MoveMouseTo 50% 50% ShortcutsWindow *Maus zur Bildschirmmitte bewegen Save KeySet as… ShortcutsWindow Tastenbelegung speichern unter… Open ShortcutsWindow Öffnen -Really quit without saving your changes? ShortcutsWindow Beenden ohne die Änderungen zu speichern? Shortcuts was unable to parse your KeySet file! ShortcutsWindow Die Tastenbelegungsdatei konnte nicht gelesen werden. Select ShortcutsWindow Auswählen Shortcuts was unable to save your KeySet file! ShortcutsWindow Die Tastenbelegungsdatei konnte nicht gespeichert werden. diff --git a/data/catalogs/preferences/shortcuts/el.catkeys b/data/catalogs/preferences/shortcuts/el.catkeys index 2112c44e1a..f51fb62691 100644 --- a/data/catalogs/preferences/shortcuts/el.catkeys +++ b/data/catalogs/preferences/shortcuts/el.catkeys @@ -1,4 +1,4 @@ -1 greek, modern (1453-) x-vnd.Haiku-Shortcuts 621368175 +1 greek, modern (1453-) x-vnd.Haiku-Shortcuts 1741147146 Error, NULL state description?\n ShortcutsSpec Σφάλμα, ΚΕΝΗ αναφορά περιγραφής;\n MoveMouse ShortcutsSpec Μετακίνηση Ποντικιού OK ShortcutsWindow Εντάξει @@ -43,7 +43,6 @@ Shift ShortcutsSpec Name for modifier on keyboard Shift *MoveMouseTo 50% 50% ShortcutsWindow *Μετακίνηση ποντικιού στο 50% 50% Save KeySet as… ShortcutsWindow Αποθήκευση σετ πλήκτρων ως... Open ShortcutsWindow Άνοιγμα -Really quit without saving your changes? ShortcutsWindow Πράγματι θέλετε να εγκαταλείψετε χωρίς να αποθηκεύσετε τις αλλαγές σας; Shortcuts was unable to parse your KeySet file! ShortcutsWindow Οι συντομέυσεις δεν ήταν δυνατό να αναλυθούν στο αρχείο του σετ πλήκτρων! Select ShortcutsWindow Επιλογή Shortcuts was unable to save your KeySet file! ShortcutsWindow Οι συντομέυσεις δεν ήταν δυνατό να αποθηκευτούν στο αρχείο του σετ πλήκτρων! diff --git a/data/catalogs/preferences/shortcuts/fi.catkeys b/data/catalogs/preferences/shortcuts/fi.catkeys index d0632858f3..5ad0edb974 100644 --- a/data/catalogs/preferences/shortcuts/fi.catkeys +++ b/data/catalogs/preferences/shortcuts/fi.catkeys @@ -1,4 +1,4 @@ -1 finnish x-vnd.Haiku-Shortcuts 621368175 +1 finnish x-vnd.Haiku-Shortcuts 1741147146 Error, NULL state description?\n ShortcutsSpec Virhe, NULL-tilakuvaus?\n MoveMouse ShortcutsSpec SiirräHiirtä OK ShortcutsWindow Valmis @@ -43,7 +43,6 @@ Shift ShortcutsSpec Name for modifier on keyboard Vaihto-painike *MoveMouseTo 50% 50% ShortcutsWindow *SiirräHiiriKohteeseen 50% 50% Save KeySet as… ShortcutsWindow Tallenna KeySet-tiedosto nimellä… Open ShortcutsWindow Avaa -Really quit without saving your changes? ShortcutsWindow Poistutko todella tallentamatta muutoksia? Shortcuts was unable to parse your KeySet file! ShortcutsWindow Pikanäppäinasetukset ei kyennyt jäsentämään KeySet-tiedostoa! Select ShortcutsWindow Valitse Shortcuts was unable to save your KeySet file! ShortcutsWindow Pikanäppäinsetukset eivät kyennyt tallentamaan KeySet-tiedostoa! diff --git a/data/catalogs/preferences/shortcuts/fr.catkeys b/data/catalogs/preferences/shortcuts/fr.catkeys index c6115b5e73..667787f5c8 100644 --- a/data/catalogs/preferences/shortcuts/fr.catkeys +++ b/data/catalogs/preferences/shortcuts/fr.catkeys @@ -1,4 +1,4 @@ -1 french x-vnd.Haiku-Shortcuts 621368175 +1 french x-vnd.Haiku-Shortcuts 3661393357 Error, NULL state description?\n ShortcutsSpec Erreur : description d'état NULL ?\n MoveMouse ShortcutsSpec BougerSouris OK ShortcutsWindow OK @@ -25,6 +25,7 @@ Save ShortcutsWindow Enregistrer *MouseButton 1 ShortcutsWindow *BoutonSouris 1 *MoveMouse +20 +0 ShortcutsWindow *BougeSouris +20 +0 MouseDown ShortcutsSpec SourisEnBas +Save changes before closing? ShortcutsWindow Voulez-vous enregistrer les modifications avant de fermer ? Remove selected shortcut ShortcutsWindow Supprimer le raccourci sélectionné MouseButton ShortcutsSpec BoutonSouris Add new shortcut ShortcutsWindow Ajouter un nouveau raccourci @@ -43,7 +44,6 @@ Shift ShortcutsSpec Name for modifier on keyboard Majuscule *MoveMouseTo 50% 50% ShortcutsWindow *BougerLaSourisEn 50% 50% Save KeySet as… ShortcutsWindow Enregistrer le jeu de touches sous… Open ShortcutsWindow Ouvrir -Really quit without saving your changes? ShortcutsWindow Voulez-vous vraiment sortir sans enregistrer vos modifications ? Shortcuts was unable to parse your KeySet file! ShortcutsWindow Raccourcis n'a pas pu analyser votre fichier de jeu de touches ! Select ShortcutsWindow Sélectionner Shortcuts was unable to save your KeySet file! ShortcutsWindow Raccourcis n'a pas pu enregistrer votre fichier de jeu de touches ! diff --git a/data/catalogs/preferences/shortcuts/hi.catkeys b/data/catalogs/preferences/shortcuts/hi.catkeys index 040242191d..087fa754e6 100644 --- a/data/catalogs/preferences/shortcuts/hi.catkeys +++ b/data/catalogs/preferences/shortcuts/hi.catkeys @@ -1,4 +1,4 @@ -1 hindi x-vnd.Haiku-Shortcuts 621368175 +1 hindi x-vnd.Haiku-Shortcuts 1741147146 Error, NULL state description?\n ShortcutsSpec त्रुटि, नल स्थिति का विवरण?\n MoveMouse ShortcutsSpec माउस को हिलाएँ OK ShortcutsWindow ठीक है @@ -43,7 +43,6 @@ Shift ShortcutsSpec Name for modifier on keyboard स्थान बदले *MoveMouseTo 50% 50% ShortcutsWindow *माउस को 50प्रतिशत 50प्रतिशत पर ले जायें Save KeySet as… ShortcutsWindow कीसेट को ऐसे सुरक्षित करे Open ShortcutsWindow खुला -Really quit without saving your changes? ShortcutsWindow क्या आप वास्तव में अपने बदलाव को बिना सहेजे छोड़ना चाहते हैँ? Shortcuts was unable to parse your KeySet file! ShortcutsWindow शॉर्टकट्स आपकी कीसेट फ़ाइल को पार्स करने में असमर्थ रहा ! Select ShortcutsWindow चुनें Shortcuts was unable to save your KeySet file! ShortcutsWindow शॉर्टकट्स कीसेट फ़ाइल को सहेजने में असमर्थ रहा ! diff --git a/data/catalogs/preferences/shortcuts/hu.catkeys b/data/catalogs/preferences/shortcuts/hu.catkeys index efafa7e5ef..b3de8f2d6d 100644 --- a/data/catalogs/preferences/shortcuts/hu.catkeys +++ b/data/catalogs/preferences/shortcuts/hu.catkeys @@ -1,4 +1,4 @@ -1 hungarian x-vnd.Haiku-Shortcuts 621368175 +1 hungarian x-vnd.Haiku-Shortcuts 3661393357 Error, NULL state description?\n ShortcutsSpec Hiba, NULL állapotleírás?\n MoveMouse ShortcutsSpec EgérMozgatás OK ShortcutsWindow Rendben @@ -25,6 +25,7 @@ Save ShortcutsWindow Mentés *MouseButton 1 ShortcutsWindow *EgérGomb 1 *MoveMouse +20 +0 ShortcutsWindow *EgérMozgatás +20 +0 MouseDown ShortcutsSpec EgérLe +Save changes before closing? ShortcutsWindow Menti a változtatásokat kilépés előtt? Remove selected shortcut ShortcutsWindow Kiválasztott gyorsbillentyű eltávolítása MouseButton ShortcutsSpec EgérGomb Add new shortcut ShortcutsWindow Új gyorsbillentyű hozzáadása @@ -43,7 +44,6 @@ Shift ShortcutsSpec Name for modifier on keyboard Shift *MoveMouseTo 50% 50% ShortcutsWindow *EgérMozgatásIde 50% 50% Save KeySet as… ShortcutsWindow Beállítások mentése másként… Open ShortcutsWindow Megnyitás -Really quit without saving your changes? ShortcutsWindow Biztos ki akar lépni a változtatásainak mentése nélkül? Shortcuts was unable to parse your KeySet file! ShortcutsWindow A Parancsgombok nem tudta beolvasni a beállításait! Select ShortcutsWindow Kiválasztás Shortcuts was unable to save your KeySet file! ShortcutsWindow A Parancsgombok nem tudta elmenteni a beállításait! diff --git a/data/catalogs/preferences/shortcuts/ja.catkeys b/data/catalogs/preferences/shortcuts/ja.catkeys index efc41264f7..b57abaa485 100644 --- a/data/catalogs/preferences/shortcuts/ja.catkeys +++ b/data/catalogs/preferences/shortcuts/ja.catkeys @@ -1,4 +1,4 @@ -1 japanese x-vnd.Haiku-Shortcuts 621368175 +1 japanese x-vnd.Haiku-Shortcuts 3661393357 Error, NULL state description?\n ShortcutsSpec エラー、記述がありません?\n MoveMouse ShortcutsSpec MoveMouse OK ShortcutsWindow OK @@ -25,6 +25,7 @@ Save ShortcutsWindow 保存 *MouseButton 1 ShortcutsWindow *MouseButton 1 *MoveMouse +20 +0 ShortcutsWindow *MoveMouse +20 +0 MouseDown ShortcutsSpec MouseDown +Save changes before closing? ShortcutsWindow 閉じる前に変更を保存しますか? Remove selected shortcut ShortcutsWindow 選択部を削除 MouseButton ShortcutsSpec MouseButton Add new shortcut ShortcutsWindow 新規作成 @@ -43,7 +44,6 @@ Shift ShortcutsSpec Name for modifier on keyboard Shift *MoveMouseTo 50% 50% ShortcutsWindow *MoveMouseTo 50% 50% Save KeySet as… ShortcutsWindow キーセットを名前を付けて保存… Open ShortcutsWindow 開く -Really quit without saving your changes? ShortcutsWindow 本当に変更を保存せずに終了してよいですか? Shortcuts was unable to parse your KeySet file! ShortcutsWindow キーセットファイルを解析できませんでした。 Select ShortcutsWindow 選択 Shortcuts was unable to save your KeySet file! ShortcutsWindow キーセットファイルを保存できませんでした! diff --git a/data/catalogs/preferences/shortcuts/lt.catkeys b/data/catalogs/preferences/shortcuts/lt.catkeys index d119fb826c..a74963b330 100644 --- a/data/catalogs/preferences/shortcuts/lt.catkeys +++ b/data/catalogs/preferences/shortcuts/lt.catkeys @@ -1,4 +1,4 @@ -1 lithuanian x-vnd.Haiku-Shortcuts 843427514 +1 lithuanian x-vnd.Haiku-Shortcuts 1963206485 Error, NULL state description?\n ShortcutsSpec Klaida. Neapibrėžta būsena?\n OK ShortcutsWindow Gerai Shortcuts wasn't able to save your keyset. ShortcutsWindow Sparčiųjų klavišų rinkinio įrašyti nepavyko. @@ -25,7 +25,6 @@ Application ShortcutsWindow Programa Shift ShortcutsSpec Name for modifier on keyboard Lyg2 Save KeySet as… ShortcutsWindow Įrašyti sparčiųjų klavišų rinkinį kaip… Open ShortcutsWindow Atverti -Really quit without saving your changes? ShortcutsWindow Ar tikrai baigti programos darbą neįrašius pakeitimų? Shortcuts was unable to parse your KeySet file! ShortcutsWindow Sparčiųjų klavišų rinkinio išanalizuoti nepavyko! Select ShortcutsWindow Pažymėti Shortcuts was unable to save your KeySet file! ShortcutsWindow Sparčiųjų klavišų rinkinio įrašyti nepavyko! diff --git a/data/catalogs/preferences/shortcuts/nl.catkeys b/data/catalogs/preferences/shortcuts/nl.catkeys index 39d642b368..521e046422 100644 --- a/data/catalogs/preferences/shortcuts/nl.catkeys +++ b/data/catalogs/preferences/shortcuts/nl.catkeys @@ -1,4 +1,4 @@ -1 dutch; flemish x-vnd.Haiku-Shortcuts 621368175 +1 dutch; flemish x-vnd.Haiku-Shortcuts 1741147146 Error, NULL state description?\n ShortcutsSpec Fout, NULL-statusbeschrijving?\n MoveMouse ShortcutsSpec VerplaatsMuis OK ShortcutsWindow Oké @@ -43,7 +43,6 @@ Shift ShortcutsSpec Name for modifier on keyboard Shift *MoveMouseTo 50% 50% ShortcutsWindow *VerplaatsMuisNaar 50% 50% Save KeySet as… ShortcutsWindow Toetsencombinatie opslaan als... Open ShortcutsWindow Openen -Really quit without saving your changes? ShortcutsWindow Wilt u echt afsluiten zonder uw veranderingen op te slaan? Shortcuts was unable to parse your KeySet file! ShortcutsWindow Sneltoetsen was niet in staat om uw toetsencombinatiebestand te lezen! Select ShortcutsWindow Selecteren Shortcuts was unable to save your KeySet file! ShortcutsWindow Sneltoetsen was niet in staat om uw toetsencombinatiebestand op te slaan! diff --git a/data/catalogs/preferences/shortcuts/pl.catkeys b/data/catalogs/preferences/shortcuts/pl.catkeys index 5937a2f804..8dabc1514c 100644 --- a/data/catalogs/preferences/shortcuts/pl.catkeys +++ b/data/catalogs/preferences/shortcuts/pl.catkeys @@ -1,4 +1,4 @@ -1 polish x-vnd.Haiku-Shortcuts 621368175 +1 polish x-vnd.Haiku-Shortcuts 1741147146 Error, NULL state description?\n ShortcutsSpec Błąd, brak opisu stanu?\n MoveMouse ShortcutsSpec MoveMouse OK ShortcutsWindow OK @@ -43,7 +43,6 @@ Shift ShortcutsSpec Name for modifier on keyboard Shift *MoveMouseTo 50% 50% ShortcutsWindow *MoveMouseTo 50% 50% Save KeySet as… ShortcutsWindow Zapisz KeySet jako… Open ShortcutsWindow Otwórz -Really quit without saving your changes? ShortcutsWindow Wyjść nie zapisując zmian? Shortcuts was unable to parse your KeySet file! ShortcutsWindow Skróty nie zdołały przetworzyć pliku Keyset! Select ShortcutsWindow Wybierz Shortcuts was unable to save your KeySet file! ShortcutsWindow Skróty nie zdołały zapisać pliku Keyset! diff --git a/data/catalogs/preferences/shortcuts/pt_BR.catkeys b/data/catalogs/preferences/shortcuts/pt_BR.catkeys index 629bc040f2..f3597591f2 100644 --- a/data/catalogs/preferences/shortcuts/pt_BR.catkeys +++ b/data/catalogs/preferences/shortcuts/pt_BR.catkeys @@ -1,4 +1,4 @@ -1 portuguese (brazil) x-vnd.Haiku-Shortcuts 621368175 +1 portuguese (brazil) x-vnd.Haiku-Shortcuts 3661393357 Error, NULL state description?\n ShortcutsSpec Erro, descrição de estado em branco?\n MoveMouse ShortcutsSpec Mover o Mouse OK ShortcutsWindow OK @@ -25,6 +25,7 @@ Save ShortcutsWindow Salvar *MouseButton 1 ShortcutsWindow *Botão do Mouse 1 *MoveMouse +20 +0 ShortcutsWindow *Mover Mouse +20 +0 MouseDown ShortcutsSpec Mouse para baixo +Save changes before closing? ShortcutsWindow Salvar alterações antes de fechar? Remove selected shortcut ShortcutsWindow Remover atalho selecionado MouseButton ShortcutsSpec Botão do Mouse Add new shortcut ShortcutsWindow Adicionar novo atalho @@ -43,7 +44,6 @@ Shift ShortcutsSpec Name for modifier on keyboard Shift *MoveMouseTo 50% 50% ShortcutsWindow *Mover Mouse Para 50% 50% Save KeySet as… ShortcutsWindow Salvar combinação de teclas como... Open ShortcutsWindow Abrir -Really quit without saving your changes? ShortcutsWindow Você deseja sair sem salvar as mudanças? Shortcuts was unable to parse your KeySet file! ShortcutsWindow O Atalhos não pode analisar seu arquivo de combinação de teclas! Select ShortcutsWindow Selecionar Shortcuts was unable to save your KeySet file! ShortcutsWindow O Atalhos não pode salvar seu arquivo combinação de teclas! diff --git a/data/catalogs/preferences/shortcuts/ro.catkeys b/data/catalogs/preferences/shortcuts/ro.catkeys index 9bbaf9cf01..a51558e58f 100644 --- a/data/catalogs/preferences/shortcuts/ro.catkeys +++ b/data/catalogs/preferences/shortcuts/ro.catkeys @@ -1,4 +1,4 @@ -1 romanian x-vnd.Haiku-Shortcuts 621368175 +1 romanian x-vnd.Haiku-Shortcuts 1741147146 Error, NULL state description?\n ShortcutsSpec Eroare, descriere stare NULL?\n MoveMouse ShortcutsSpec MutăMaus OK ShortcutsWindow OK @@ -43,7 +43,6 @@ Shift ShortcutsSpec Name for modifier on keyboard Shift *MoveMouseTo 50% 50% ShortcutsWindow *MutăMausLa 50% 50% Save KeySet as… ShortcutsWindow Salvează set de taste ca... Open ShortcutsWindow Deschide -Really quit without saving your changes? ShortcutsWindow Sigur doriți să închideți fără a salva modificările? Shortcuts was unable to parse your KeySet file! ShortcutsWindow Scurtături nu a putut analiza fișierul dumneavoastră set de taste! Select ShortcutsWindow Selectează Shortcuts was unable to save your KeySet file! ShortcutsWindow Scurtături nu a putut salva fișierul dumneavoastră set de taste! diff --git a/data/catalogs/preferences/shortcuts/ru.catkeys b/data/catalogs/preferences/shortcuts/ru.catkeys index 4df555b948..d2bafd8cae 100644 --- a/data/catalogs/preferences/shortcuts/ru.catkeys +++ b/data/catalogs/preferences/shortcuts/ru.catkeys @@ -1,4 +1,4 @@ -1 russian x-vnd.Haiku-Shortcuts 621368175 +1 russian x-vnd.Haiku-Shortcuts 1741147146 Error, NULL state description?\n ShortcutsSpec Ошибка, состояние описания NULL?\n MoveMouse ShortcutsSpec MoveMouse OK ShortcutsWindow ОК @@ -43,7 +43,6 @@ Shift ShortcutsSpec Name for modifier on keyboard Shift *MoveMouseTo 50% 50% ShortcutsWindow *MoveMouseTo 50% 50% Save KeySet as… ShortcutsWindow Сохранить список как… Open ShortcutsWindow Открыть -Really quit without saving your changes? ShortcutsWindow Сохранить изменения перед выходом? Shortcuts was unable to parse your KeySet file! ShortcutsWindow Не удалось прочитать файл списка горячих клавиш! Select ShortcutsWindow Выбрать Shortcuts was unable to save your KeySet file! ShortcutsWindow Не удалось сохранить ваш файл список горячих клавиш! diff --git a/data/catalogs/preferences/shortcuts/sk.catkeys b/data/catalogs/preferences/shortcuts/sk.catkeys index 56d238c758..c8f0092516 100644 --- a/data/catalogs/preferences/shortcuts/sk.catkeys +++ b/data/catalogs/preferences/shortcuts/sk.catkeys @@ -1,4 +1,4 @@ -1 slovak x-vnd.Haiku-Shortcuts 621368175 +1 slovak x-vnd.Haiku-Shortcuts 1741147146 Error, NULL state description?\n ShortcutsSpec Chyba, NULL popis stavu?\n MoveMouse ShortcutsSpec PosunúťMyš OK ShortcutsWindow OK @@ -43,7 +43,6 @@ Shift ShortcutsSpec Name for modifier on keyboard Shift *MoveMouseTo 50% 50% ShortcutsWindow *PresunúťMyšNa 50% 50% Save KeySet as… ShortcutsWindow Uložiť SaduKláves ako… Open ShortcutsWindow Otvoriť -Really quit without saving your changes? ShortcutsWindow Skutočne ukončiť bez uloženia vašich zmien? Shortcuts was unable to parse your KeySet file! ShortcutsWindow Aplikácia skratky nedokázala prečítať formát vášho súboru SadaKláves! Select ShortcutsWindow Vybrať Shortcuts was unable to save your KeySet file! ShortcutsWindow Aplikácia skratky nedokázala uložiť váš súbor SadaKláves! diff --git a/data/catalogs/preferences/shortcuts/sv.catkeys b/data/catalogs/preferences/shortcuts/sv.catkeys index 2fee155bee..a3c5ffefc0 100644 --- a/data/catalogs/preferences/shortcuts/sv.catkeys +++ b/data/catalogs/preferences/shortcuts/sv.catkeys @@ -1,4 +1,4 @@ -1 swedish x-vnd.Haiku-Shortcuts 621368175 +1 swedish x-vnd.Haiku-Shortcuts 1741147146 Error, NULL state description?\n ShortcutsSpec Fel: NULL i tillståndsbeskrivning?\n MoveMouse ShortcutsSpec FlyttaMus OK ShortcutsWindow OK @@ -43,7 +43,6 @@ Shift ShortcutsSpec Name for modifier on keyboard Skift *MoveMouseTo 50% 50% ShortcutsWindow *FlyttaMuspekareTill 50% 50% Save KeySet as… ShortcutsWindow Spara som... Open ShortcutsWindow Öppna -Really quit without saving your changes? ShortcutsWindow Vill du verkligen avsluta utan att spara ändringarna? Shortcuts was unable to parse your KeySet file! ShortcutsWindow Genvägar kunde inte läsa dina inställningar! Select ShortcutsWindow Välj Shortcuts was unable to save your KeySet file! ShortcutsWindow Genvägar kunde inte spara dina inställningar! diff --git a/data/catalogs/preferences/shortcuts/uk.catkeys b/data/catalogs/preferences/shortcuts/uk.catkeys index 323110a9c3..bf9edb4503 100644 --- a/data/catalogs/preferences/shortcuts/uk.catkeys +++ b/data/catalogs/preferences/shortcuts/uk.catkeys @@ -1,4 +1,4 @@ -1 ukrainian x-vnd.Haiku-Shortcuts 621368175 +1 ukrainian x-vnd.Haiku-Shortcuts 1741147146 Error, NULL state description?\n ShortcutsSpec Помилка, NULL опису стану?\n MoveMouse ShortcutsSpec Переміщення мишки OK ShortcutsWindow Гаразд @@ -43,7 +43,6 @@ Shift ShortcutsSpec Name for modifier on keyboard Shift *MoveMouseTo 50% 50% ShortcutsWindow *Переміщення мишки в 50% 50% Save KeySet as… ShortcutsWindow Зберегти список як… Open ShortcutsWindow Відкрити -Really quit without saving your changes? ShortcutsWindow Насправді вийди без збереження ваших змін? Shortcuts was unable to parse your KeySet file! ShortcutsWindow Ярлику невдалось розібрати ваш файл Ключів! Select ShortcutsWindow Вибрати Shortcuts was unable to save your KeySet file! ShortcutsWindow Не вдалося зберегти ваш файл список горячих клавіш! diff --git a/data/catalogs/preferences/shortcuts/zh_Hans.catkeys b/data/catalogs/preferences/shortcuts/zh_Hans.catkeys index 4c0e2ce848..f976f37ff5 100644 --- a/data/catalogs/preferences/shortcuts/zh_Hans.catkeys +++ b/data/catalogs/preferences/shortcuts/zh_Hans.catkeys @@ -1,4 +1,4 @@ -1 english x-vnd.Haiku-Shortcuts 621368175 +1 english x-vnd.Haiku-Shortcuts 3661393357 Error, NULL state description?\n ShortcutsSpec 错误,无效状态描述?\n MoveMouse ShortcutsSpec 鼠标移动 OK ShortcutsWindow 确定 @@ -25,6 +25,7 @@ Save ShortcutsWindow 保存 *MouseButton 1 ShortcutsWindow *MouseButton 1 *MoveMouse +20 +0 ShortcutsWindow *MoveMouse +20 +0 MouseDown ShortcutsSpec MouseDown +Save changes before closing? ShortcutsWindow 关闭前是否保存修改? Remove selected shortcut ShortcutsWindow 删除选定快捷键 MouseButton ShortcutsSpec MouseButton Add new shortcut ShortcutsWindow 添加快捷键 @@ -43,7 +44,6 @@ Shift ShortcutsSpec Name for modifier on keyboard Shift *MoveMouseTo 50% 50% ShortcutsWindow *MoveMouseTo 50% 5o% Save KeySet as… ShortcutsWindow 保存按键设置… Open ShortcutsWindow 打开 -Really quit without saving your changes? ShortcutsWindow 退出,不保存您的修改 Shortcuts was unable to parse your KeySet file! ShortcutsWindow 无法解析您的按键设置文件! Select ShortcutsWindow 选择 Shortcuts was unable to save your KeySet file! ShortcutsWindow 无法保存您的按键设置文件! diff --git a/data/catalogs/preferences/sounds/be.catkeys b/data/catalogs/preferences/sounds/be.catkeys index b6e90dc4dc..472e000516 100644 --- a/data/catalogs/preferences/sounds/be.catkeys +++ b/data/catalogs/preferences/sounds/be.catkeys @@ -1,4 +1,5 @@ -1 belarusian x-vnd.Haiku-Sounds 150798324 +1 belarusian x-vnd.Haiku-Sounds 1668150342 +Sound file: HWindow Аўдыё файл: Sounds System name Гукі No such file or directory HEventList Няма такога файла ці каталога OK SoundsHApp ОК diff --git a/data/catalogs/preferences/sounds/fi.catkeys b/data/catalogs/preferences/sounds/fi.catkeys index 147ed5453a..49d15a27bc 100644 --- a/data/catalogs/preferences/sounds/fi.catkeys +++ b/data/catalogs/preferences/sounds/fi.catkeys @@ -1,4 +1,5 @@ -1 finnish x-vnd.Haiku-Sounds 150798324 +1 finnish x-vnd.Haiku-Sounds 1668150342 +Sound file: HWindow Äänitiedosto: Sounds System name Ääniasetukset No such file or directory HEventList Tiedostoa tai hakemistoa ei löydy OK SoundsHApp Valmis diff --git a/data/catalogs/preferences/sounds/fr.catkeys b/data/catalogs/preferences/sounds/fr.catkeys index 29db9edd0f..805d7b5be1 100644 --- a/data/catalogs/preferences/sounds/fr.catkeys +++ b/data/catalogs/preferences/sounds/fr.catkeys @@ -1,4 +1,5 @@ -1 french x-vnd.Haiku-Sounds 150798324 +1 french x-vnd.Haiku-Sounds 1668150342 +Sound file: HWindow Fichier son : Sounds System name Sons No such file or directory HEventList Pas de tel fichier ou répertoire OK SoundsHApp OK diff --git a/data/catalogs/preferences/sounds/lt.catkeys b/data/catalogs/preferences/sounds/lt.catkeys index cab87d72ea..cf60558e87 100644 --- a/data/catalogs/preferences/sounds/lt.catkeys +++ b/data/catalogs/preferences/sounds/lt.catkeys @@ -1,4 +1,5 @@ -1 lithuanian x-vnd.Haiku-Sounds 150798324 +1 lithuanian x-vnd.Haiku-Sounds 1668150342 +Sound file: HWindow Garso failas: Sounds System name Garsai No such file or directory HEventList Tokio failo ar aplanko nėra OK SoundsHApp Gerai diff --git a/data/catalogs/preferences/sounds/pt_BR.catkeys b/data/catalogs/preferences/sounds/pt_BR.catkeys index 4a49a9f809..dd9afd6d8a 100644 --- a/data/catalogs/preferences/sounds/pt_BR.catkeys +++ b/data/catalogs/preferences/sounds/pt_BR.catkeys @@ -1,4 +1,5 @@ -1 portuguese (brazil) x-vnd.Haiku-Sounds 150798324 +1 portuguese (brazil) x-vnd.Haiku-Sounds 1668150342 +Sound file: HWindow Arquivo de som: Sounds System name Sons No such file or directory HEventList Arquivo ou pasta inexistente OK SoundsHApp OK diff --git a/data/catalogs/preferences/sounds/sk.catkeys b/data/catalogs/preferences/sounds/sk.catkeys index a5cb4bab9b..f113d227c1 100644 --- a/data/catalogs/preferences/sounds/sk.catkeys +++ b/data/catalogs/preferences/sounds/sk.catkeys @@ -1,4 +1,5 @@ -1 slovak x-vnd.Haiku-Sounds 150798324 +1 slovak x-vnd.Haiku-Sounds 1668150342 +Sound file: HWindow Zvukový súbor: Sounds System name Zvuky No such file or directory HEventList Taký súbor alebo adresár neexistuje OK SoundsHApp OK diff --git a/data/catalogs/preferences/sounds/zh_Hans.catkeys b/data/catalogs/preferences/sounds/zh_Hans.catkeys index 1703662a04..db15dff7b5 100644 --- a/data/catalogs/preferences/sounds/zh_Hans.catkeys +++ b/data/catalogs/preferences/sounds/zh_Hans.catkeys @@ -1,4 +1,5 @@ -1 english x-vnd.Haiku-Sounds 150798324 +1 english x-vnd.Haiku-Sounds 1668150342 +Sound file: HWindow 声音文件: Sounds System name 声音 No such file or directory HEventList 该文件或者目录不存在。 OK SoundsHApp 确定 diff --git a/data/catalogs/preferences/time/be.catkeys b/data/catalogs/preferences/time/be.catkeys index 6786260d82..4294263f31 100644 --- a/data/catalogs/preferences/time/be.catkeys +++ b/data/catalogs/preferences/time/be.catkeys @@ -1,4 +1,4 @@ -1 belarusian x-vnd.Haiku-Time 3249243267 +1 belarusian x-vnd.Haiku-Time 3544635877 GMT (UNIX compatible) Time GMT (як у UNIX) OK Time ОК Asia Time Азія @@ -40,5 +40,6 @@ Try all servers Time Паспрабаваць усе серверы Time zone Time Часавы пояс Could not create socket Time Немагчыма стварыць сеткавы сокет Synchronize again Time Сінхранізаваць ізноў +Clock Time Гадзіннік Network time Time Сеткавы час Atlantic Time Атлантыка diff --git a/data/catalogs/preferences/time/fi.catkeys b/data/catalogs/preferences/time/fi.catkeys index d951b7cb7f..ddfd8ab012 100644 --- a/data/catalogs/preferences/time/fi.catkeys +++ b/data/catalogs/preferences/time/fi.catkeys @@ -1,4 +1,4 @@ -1 finnish x-vnd.Haiku-Time 3249243267 +1 finnish x-vnd.Haiku-Time 3544635877 GMT (UNIX compatible) Time Greenwichin aika (UNIX-yhteensopiva) OK Time Valmis Asia Time Aasia @@ -40,5 +40,6 @@ Try all servers Time Yritä kaikkia palvelimia Time zone Time Aikavyöhyke Could not create socket Time Pistokkeen luominen epäonnistui Synchronize again Time Synkronoi uudelleen +Clock Time Kello Network time Time Verkkoaika Atlantic Time Atlantin valtameri diff --git a/data/catalogs/preferences/time/fr.catkeys b/data/catalogs/preferences/time/fr.catkeys index a61af2897c..0fc73b0f3a 100644 --- a/data/catalogs/preferences/time/fr.catkeys +++ b/data/catalogs/preferences/time/fr.catkeys @@ -1,4 +1,4 @@ -1 french x-vnd.Haiku-Time 3249243267 +1 french x-vnd.Haiku-Time 3544635877 GMT (UNIX compatible) Time GMT (compatible UNIX) OK Time OK Asia Time Asie @@ -40,5 +40,6 @@ Try all servers Time Essayer tous les serveurs Time zone Time Fuseau horaire Could not create socket Time Impossible de créer le socket Synchronize again Time Synchroniser à nouveau +Clock Time Horloge Network time Time Heure réseau Atlantic Time Atlantique diff --git a/data/catalogs/preferences/time/lt.catkeys b/data/catalogs/preferences/time/lt.catkeys index 5986138f9e..c7f715e338 100644 --- a/data/catalogs/preferences/time/lt.catkeys +++ b/data/catalogs/preferences/time/lt.catkeys @@ -1,4 +1,4 @@ -1 lithuanian x-vnd.Haiku-Time 3249243267 +1 lithuanian x-vnd.Haiku-Time 3544635877 GMT (UNIX compatible) Time Pasaulinis (Grinvičo) laikas (suderinama su UNIX) OK Time Gerai Asia Time Azija @@ -40,5 +40,6 @@ Try all servers Time Bandyti visus serverius Time zone Time Laiko zona Could not create socket Time Nepavyko sukurti lizdo Synchronize again Time Sinchronizuoti vėl +Clock Time Laikrodis Network time Time Sinchronizavimas Atlantic Time Atlanto vandenynas diff --git a/data/catalogs/preferences/time/pt_BR.catkeys b/data/catalogs/preferences/time/pt_BR.catkeys index 3a80ce3478..e8a2116993 100644 --- a/data/catalogs/preferences/time/pt_BR.catkeys +++ b/data/catalogs/preferences/time/pt_BR.catkeys @@ -1,4 +1,4 @@ -1 portuguese (brazil) x-vnd.Haiku-Time 3249243267 +1 portuguese (brazil) x-vnd.Haiku-Time 3544635877 GMT (UNIX compatible) Time GMT (compatível com UNIX) OK Time OK Asia Time Ásia @@ -40,5 +40,6 @@ Try all servers Time Tentar todos os servidores Time zone Time Fuso horário Could not create socket Time Não foi possível criar o socket Synchronize again Time Sincronizar novamente +Clock Time Relógio Network time Time Hora da rede Atlantic Time Atlântico diff --git a/data/catalogs/preferences/time/sk.catkeys b/data/catalogs/preferences/time/sk.catkeys index 521a536583..a8f1711e5c 100644 --- a/data/catalogs/preferences/time/sk.catkeys +++ b/data/catalogs/preferences/time/sk.catkeys @@ -1,4 +1,4 @@ -1 slovak x-vnd.Haiku-Time 3249243267 +1 slovak x-vnd.Haiku-Time 3544635877 GMT (UNIX compatible) Time GMT (kompatibilné s Unixom) OK Time OK Asia Time Ázia @@ -40,5 +40,6 @@ Try all servers Time Skúsiť všetky servery Time zone Time Časové pásmo Could not create socket Time Nepodarilo sa vytvoriť socket Synchronize again Time Synchronizovať znova +Clock Time Hodiny Network time Time Čas v sieti Atlantic Time Atlantik diff --git a/data/catalogs/preferences/time/zh_Hans.catkeys b/data/catalogs/preferences/time/zh_Hans.catkeys index 4dbec9cd90..28b2e9a05d 100644 --- a/data/catalogs/preferences/time/zh_Hans.catkeys +++ b/data/catalogs/preferences/time/zh_Hans.catkeys @@ -1,4 +1,4 @@ -1 english x-vnd.Haiku-Time 3249243267 +1 english x-vnd.Haiku-Time 3544635877 GMT (UNIX compatible) Time GMT(UNIX 兼容) OK Time 确定 Asia Time 亚洲 @@ -40,5 +40,6 @@ Try all servers Time 尝试所有服务器 Time zone Time 时区 Could not create socket Time 无法创建套接字 Synchronize again Time 再次同步 +Clock Time 时钟 Network time Time 网络时间 Atlantic Time 大西洋 diff --git a/data/catalogs/preferences/virtualmemory/be.catkeys b/data/catalogs/preferences/virtualmemory/be.catkeys index 20947c2dfd..57a7881ccd 100644 --- a/data/catalogs/preferences/virtualmemory/be.catkeys +++ b/data/catalogs/preferences/virtualmemory/be.catkeys @@ -1,4 +1,4 @@ -1 belarusian x-vnd.Haiku-VirtualMemory 1952476689 +1 belarusian x-vnd.Haiku-VirtualMemory 4238590117 Quit SettingsWindow Выйсці Turn off SettingsWindow Адключыць Disabling virtual memory will have unwanted effects on system stability once the memory is used up.\nVirtual memory does not affect system performance until this point is reached.\n\nAre you really sure you want to turn it off? SettingsWindow Адмова ад ужывання уяўнай памяці можа спарадзіць нечаканыя праблемы ў функцыянаванні праграмаў падчас працы сістэмы ў рэжыме скарыстання усёй фізічнай памяці. Але майце на ўвазе, што да таго моманту як сістэма вычарпае ўсю фізічную памяць, наладкі ўяўнай памяці ніяк ня будуць ўплываць на агульную прадукцыйнасьць сістэмы.\n\nВы упэўнены у тым, што сістэма не павінна карыстацца уяўнаю памяццю? @@ -10,7 +10,6 @@ Use volume: SettingsWindow Дыскавы том: Keep enabled SettingsWindow Захаваць актыўным Revert SettingsWindow Вярнуць VirtualMemory System name Уяўная памяць -Choose swap size automatically SettingsWindow Аўтаматычна выбраць памер уяўнай памяці Use boot volume SettingsWindow Выкарыстаць загрузачны падзел Load defaults SettingsWindow Дапомныя OK VirtualMemoryApp Так diff --git a/data/catalogs/preferences/virtualmemory/de.catkeys b/data/catalogs/preferences/virtualmemory/de.catkeys index 30b37b60b7..a3904d3f8c 100644 --- a/data/catalogs/preferences/virtualmemory/de.catkeys +++ b/data/catalogs/preferences/virtualmemory/de.catkeys @@ -1,4 +1,4 @@ -1 german x-vnd.Haiku-VirtualMemory 1952476689 +1 german x-vnd.Haiku-VirtualMemory 4238590117 Quit SettingsWindow Beenden Turn off SettingsWindow Ausschalten Disabling virtual memory will have unwanted effects on system stability once the memory is used up.\nVirtual memory does not affect system performance until this point is reached.\n\nAre you really sure you want to turn it off? SettingsWindow Wird der virtuelle Speicher ausgeschaltet, kann es zu unerwünschten Effekten und Einschränkungen der Systemstabilität kommen, sobald der physische Speicher nahezu aufgebraucht ist.\nVirtueller Speicher hat keine Auswirkungen auf die Systemleistung, bis dieser Punkt erreicht ist.\n\nSoll er trotzdem ausgeschaltet werden? @@ -10,7 +10,6 @@ Use volume: SettingsWindow Auf Laufwerk: Keep enabled SettingsWindow Aktiviert lassen Revert SettingsWindow Anfangswerte VirtualMemory System name Virtueller Speicher -Choose swap size automatically SettingsWindow Größe automatisch festlegen Use boot volume SettingsWindow Boot-Laufwerk verwenden Load defaults SettingsWindow Standardwerte laden OK VirtualMemoryApp OK diff --git a/data/catalogs/preferences/virtualmemory/fi.catkeys b/data/catalogs/preferences/virtualmemory/fi.catkeys index 62ebee015e..d41f42ee43 100644 --- a/data/catalogs/preferences/virtualmemory/fi.catkeys +++ b/data/catalogs/preferences/virtualmemory/fi.catkeys @@ -1,4 +1,4 @@ -1 finnish x-vnd.Haiku-VirtualMemory 1952476689 +1 finnish x-vnd.Haiku-VirtualMemory 4238590117 Quit SettingsWindow Lopeta Turn off SettingsWindow Käännä pois päältä Disabling virtual memory will have unwanted effects on system stability once the memory is used up.\nVirtual memory does not affect system performance until this point is reached.\n\nAre you really sure you want to turn it off? SettingsWindow Virtuaalimuistin ottamisella pois käytöstä on odottamattomia vaikutuksia järjestelmän stabiilisuuteen silloin kun muisti on kerran käytetty loppuun.\nVirtuaalimuisti ei vaikuta järjestelmän suorituskykyyn jos tätä pistettä ei ole saavutettu.\n\nOletko todella varma, että haluat ottaa sen pois päältä? @@ -10,7 +10,6 @@ Use volume: SettingsWindow Käytä taltiota: Keep enabled SettingsWindow Pidä käytössä Revert SettingsWindow Palauta VirtualMemory System name Virtuaalimuistiasetukset -Choose swap size automatically SettingsWindow Valitse virtuaalimuistin koko automaattisesti Use boot volume SettingsWindow Käytä alkulataustaltiota Load defaults SettingsWindow Lataa oletusasetukset OK VirtualMemoryApp Valmis diff --git a/data/catalogs/preferences/virtualmemory/fr.catkeys b/data/catalogs/preferences/virtualmemory/fr.catkeys index c22de1a4f0..766fe10016 100644 --- a/data/catalogs/preferences/virtualmemory/fr.catkeys +++ b/data/catalogs/preferences/virtualmemory/fr.catkeys @@ -1,4 +1,4 @@ -1 french x-vnd.Haiku-VirtualMemory 1952476689 +1 french x-vnd.Haiku-VirtualMemory 4238590117 Quit SettingsWindow Quitter Turn off SettingsWindow Désactiver Disabling virtual memory will have unwanted effects on system stability once the memory is used up.\nVirtual memory does not affect system performance until this point is reached.\n\nAre you really sure you want to turn it off? SettingsWindow Désactiver la mémoire virtuelle perturbe le système quand la mémoire est pleine.\nLa mémoire virtuelle n'affecte pas les performances avant que ce point soit atteint.\n\nÊtes-vous vraiment sur de vouloir la désactiver ? @@ -10,7 +10,6 @@ Use volume: SettingsWindow Utiliser le volume : Keep enabled SettingsWindow Laisser actif Revert SettingsWindow Défaire VirtualMemory System name Mémoire Virtuelle -Choose swap size automatically SettingsWindow Choisir la taille du fichier d'échange automatiquement Use boot volume SettingsWindow Utiliser le volume d'amorçage Load defaults SettingsWindow Charger les valeurs par défaut OK VirtualMemoryApp OK diff --git a/data/catalogs/preferences/virtualmemory/hu.catkeys b/data/catalogs/preferences/virtualmemory/hu.catkeys index f85545b18f..fc598fed7e 100644 --- a/data/catalogs/preferences/virtualmemory/hu.catkeys +++ b/data/catalogs/preferences/virtualmemory/hu.catkeys @@ -1,4 +1,4 @@ -1 hungarian x-vnd.Haiku-VirtualMemory 1952476689 +1 hungarian x-vnd.Haiku-VirtualMemory 4238590117 Quit SettingsWindow Kilépés Turn off SettingsWindow Kikapcsol Disabling virtual memory will have unwanted effects on system stability once the memory is used up.\nVirtual memory does not affect system performance until this point is reached.\n\nAre you really sure you want to turn it off? SettingsWindow A virtuális memória kikapcsolása egyes esetekkor nem kívánt hatással lehet a rendszer stabilitására.\nAmíg a rendszermemória el nem fogy, addig a virtuális memória használatára nincs szükség.\n\nBiztosan ki szeretné kapcsolni ezt a funkciót? @@ -10,7 +10,6 @@ Use volume: SettingsWindow Lemez: Keep enabled SettingsWindow Tartsa bekapcsolva Revert SettingsWindow Visszaállít VirtualMemory System name Virtuális memória -Choose swap size automatically SettingsWindow Automatikus méret Use boot volume SettingsWindow Használja a rendszer lemezt Load defaults SettingsWindow Eredeti beállítások betöltése OK VirtualMemoryApp Rendben diff --git a/data/catalogs/preferences/virtualmemory/ja.catkeys b/data/catalogs/preferences/virtualmemory/ja.catkeys index 7034c097d2..1da2bcb06a 100644 --- a/data/catalogs/preferences/virtualmemory/ja.catkeys +++ b/data/catalogs/preferences/virtualmemory/ja.catkeys @@ -1,4 +1,4 @@ -1 japanese x-vnd.Haiku-VirtualMemory 1952476689 +1 japanese x-vnd.Haiku-VirtualMemory 4238590117 Quit SettingsWindow 終了 Turn off SettingsWindow 無効にする Disabling virtual memory will have unwanted effects on system stability once the memory is used up.\nVirtual memory does not affect system performance until this point is reached.\n\nAre you really sure you want to turn it off? SettingsWindow 仮想メモリを無効にすると、使用可能な物理メモリが少なくなったときにシステムが不安定になることもあります。\n物理メモリが少なくなるまでは仮想メモリがシステムパフォーマンスに影響を与えることはありません。\n\n仮想メモリを本当に無効にしますか? @@ -10,7 +10,6 @@ Use volume: SettingsWindow パーティション: Keep enabled SettingsWindow 有効のままにする Revert SettingsWindow 元に戻す VirtualMemory System name 仮想メモリ -Choose swap size automatically SettingsWindow スワップファイルのサイズを自動で選択する Use boot volume SettingsWindow 起動ボリュームを使用 Load defaults SettingsWindow デフォルト値を読み込む OK VirtualMemoryApp OK diff --git a/data/catalogs/preferences/virtualmemory/lt.catkeys b/data/catalogs/preferences/virtualmemory/lt.catkeys index 7493532af2..c6e2d4012a 100644 --- a/data/catalogs/preferences/virtualmemory/lt.catkeys +++ b/data/catalogs/preferences/virtualmemory/lt.catkeys @@ -1,12 +1,18 @@ -1 lithuanian x-vnd.Haiku-VirtualMemory 1828586495 +1 lithuanian x-vnd.Haiku-VirtualMemory 1167248241 +Quit SettingsWindow Baigti darbą Turn off SettingsWindow Išjungti Disabling virtual memory will have unwanted effects on system stability once the memory is used up.\nVirtual memory does not affect system performance until this point is reached.\n\nAre you really sure you want to turn it off? SettingsWindow Virtualiosios atminties išjungimas gali turėti neigiamos įtakos sistemos stabilumui, kai fizinė atmintis visiškai užsipildys.\nVirtualioji atmintis neįtakoja sistemos našumo tol, kol yra laisvos fizinės atminties.\n\nAr tikrai norite išjungti virtualiąją atmintį? Requested swap file size: SettingsWindow Reikalingas sukeitimų failo dydis: +The settings specified in the settings file are invalid. You can load the defaults or quit. SettingsWindow Nuostatų faile įrašytos negalimos nuostatos. Galite įkelti numatytąsias nuostatas arba baigti darbą. Defaults SettingsWindow Numatytai Use volume: SettingsWindow Naudoti tomą: Keep enabled SettingsWindow Palikti įjungtą Revert SettingsWindow Atšaukti pakeitimus VirtualMemory System name Virtualioji atmintis +Use boot volume SettingsWindow Naudoti paleidimo tomą +Load defaults SettingsWindow Įkelti numatytąsias OK VirtualMemoryApp Gerai +Changes will take effect upon reboot. SettingsWindow Pakeitimai įsigalios, paleidus sistemą iš naujo. VirtualMemory\n\twritten by Axel Dörfler\n\tCopyright 2005, Haiku.\n VirtualMemoryApp Virtualioji atmintis\n\tparašyta Axel'io Dörfler'io\n\t© 2005, Haiku.\n +The volume specified in the settings file could not be found. You can use the boot volume or quit. SettingsWindow Nuostatų faile nurodytas tomas nerastas. Galima naudoti paleidimo tomą arba baigti darbą. Enable virtual memory SettingsWindow Įjungti virtualiąją atmintį diff --git a/data/catalogs/preferences/virtualmemory/nl.catkeys b/data/catalogs/preferences/virtualmemory/nl.catkeys index 3246dc0cb4..24d8ec8242 100644 --- a/data/catalogs/preferences/virtualmemory/nl.catkeys +++ b/data/catalogs/preferences/virtualmemory/nl.catkeys @@ -1,4 +1,4 @@ -1 dutch; flemish x-vnd.Haiku-VirtualMemory 1952476689 +1 dutch; flemish x-vnd.Haiku-VirtualMemory 4238590117 Quit SettingsWindow Afsluiten Turn off SettingsWindow Zet uit Disabling virtual memory will have unwanted effects on system stability once the memory is used up.\nVirtual memory does not affect system performance until this point is reached.\n\nAre you really sure you want to turn it off? SettingsWindow Uitzetten van het virtueel geheugen zal ongewenste effecten hebben op de stabiliteit van het systeem zodra het geheugen is verbruikt.\nHet virtueel geheugen tast de systeemprestatie niet aan totdat dit\n punt is bereikt.\n\nBent u volkomen zeker dat u het wilt uitzetten? @@ -10,7 +10,6 @@ Use volume: SettingsWindow Gebruik gegevensdrager: Keep enabled SettingsWindow Toegepast houden Revert SettingsWindow Herstellen VirtualMemory System name VirtualMemory -Choose swap size automatically SettingsWindow Automatisch de swapgrootte kiezen Use boot volume SettingsWindow Gebruik opstartvolume Load defaults SettingsWindow Standaardwaarden laden OK VirtualMemoryApp Oké diff --git a/data/catalogs/preferences/virtualmemory/pl.catkeys b/data/catalogs/preferences/virtualmemory/pl.catkeys index 1e4e6f92b4..ecc37e46a9 100644 --- a/data/catalogs/preferences/virtualmemory/pl.catkeys +++ b/data/catalogs/preferences/virtualmemory/pl.catkeys @@ -1,4 +1,4 @@ -1 polish x-vnd.Haiku-VirtualMemory 1952476689 +1 polish x-vnd.Haiku-VirtualMemory 4238590117 Quit SettingsWindow Wyjdź Turn off SettingsWindow Wyłącz Disabling virtual memory will have unwanted effects on system stability once the memory is used up.\nVirtual memory does not affect system performance until this point is reached.\n\nAre you really sure you want to turn it off? SettingsWindow Wyłączenie pamięci wirtualnej może mieć niepożądany wpływ na stabilność systemu, gdy cała dostępna pamięć zostanie zużyta.\nPamięć wirtualna nie wpływa na wydajność systemu, aż do tego momentu.\n\nNa pewno chcesz ją wyłączyc? @@ -10,7 +10,6 @@ Use volume: SettingsWindow Użyj woluminu: Keep enabled SettingsWindow Pozostaw włączoną Revert SettingsWindow Przywróć VirtualMemory System name PamięćWirtualna -Choose swap size automatically SettingsWindow Ustaw rozmiar pliku wymiany automatycznie Use boot volume SettingsWindow Użyj woluminu rozruchowego Load defaults SettingsWindow Załaduj domyślne ustawienia OK VirtualMemoryApp OK diff --git a/data/catalogs/preferences/virtualmemory/pt_BR.catkeys b/data/catalogs/preferences/virtualmemory/pt_BR.catkeys index 711ad4c812..f229959161 100644 --- a/data/catalogs/preferences/virtualmemory/pt_BR.catkeys +++ b/data/catalogs/preferences/virtualmemory/pt_BR.catkeys @@ -1,4 +1,4 @@ -1 portuguese (brazil) x-vnd.Haiku-VirtualMemory 1952476689 +1 portuguese (brazil) x-vnd.Haiku-VirtualMemory 4238590117 Quit SettingsWindow Sair Turn off SettingsWindow Desligar Disabling virtual memory will have unwanted effects on system stability once the memory is used up.\nVirtual memory does not affect system performance until this point is reached.\n\nAre you really sure you want to turn it off? SettingsWindow Desabilitar a memória virtual irá trazer efeitos indesejados na estabilidade do sistema assim que a memória estiver cheia.\nA memória virtual não irá afetar a performance do sistema até que isso aconteça.\n\nTem certeza que deseja desligá-la? @@ -10,7 +10,6 @@ Use volume: SettingsWindow Volume em uso: Keep enabled SettingsWindow Manter habilitado Revert SettingsWindow Reverter VirtualMemory System name MemóriaVirtual -Choose swap size automatically SettingsWindow Escolher tamanho de troca automaticamente Use boot volume SettingsWindow Utilizar inicialização de volume Load defaults SettingsWindow Carregar padrão OK VirtualMemoryApp OK diff --git a/data/catalogs/preferences/virtualmemory/ru.catkeys b/data/catalogs/preferences/virtualmemory/ru.catkeys index a0f609fa70..a0174c9e68 100644 --- a/data/catalogs/preferences/virtualmemory/ru.catkeys +++ b/data/catalogs/preferences/virtualmemory/ru.catkeys @@ -1,4 +1,4 @@ -1 russian x-vnd.Haiku-VirtualMemory 1952476689 +1 russian x-vnd.Haiku-VirtualMemory 4238590117 Quit SettingsWindow Выйти Turn off SettingsWindow Выключить Disabling virtual memory will have unwanted effects on system stability once the memory is used up.\nVirtual memory does not affect system performance until this point is reached.\n\nAre you really sure you want to turn it off? SettingsWindow Отключение виртуальной памяти может повлиять на стабильность системы, когда вся память будет израсходована.\nВиртуальная память не влияет на производительность системы пока она не используется.\n\nВы уверены, что хотите выключить ее? @@ -10,7 +10,6 @@ Use volume: SettingsWindow Использовать раздел: Keep enabled SettingsWindow Оставить включенной Revert SettingsWindow Вернуть VirtualMemory System name Виртуальная память -Choose swap size automatically SettingsWindow Автоматически выбирать размер файла подкачки Use boot volume SettingsWindow Использовать загрузочный раздел Load defaults SettingsWindow По умолчанию OK VirtualMemoryApp ОК diff --git a/data/catalogs/preferences/virtualmemory/sk.catkeys b/data/catalogs/preferences/virtualmemory/sk.catkeys index 46fd6b0763..7b3fd60559 100644 --- a/data/catalogs/preferences/virtualmemory/sk.catkeys +++ b/data/catalogs/preferences/virtualmemory/sk.catkeys @@ -1,4 +1,4 @@ -1 slovak x-vnd.Haiku-VirtualMemory 1952476689 +1 slovak x-vnd.Haiku-VirtualMemory 4238590117 Quit SettingsWindow Ukončiť Turn off SettingsWindow Vypnúť Disabling virtual memory will have unwanted effects on system stability once the memory is used up.\nVirtual memory does not affect system performance until this point is reached.\n\nAre you really sure you want to turn it off? SettingsWindow Vypnutie virtuálnej pamäte bude mať nežiadúce účinky na stabilitu systému v prípade vyčerpania pamäte.\nVirtuálna pamäť nemá vplyv na výkon systému pred dosiahnutím tohto stavu.\n\nSte si naozaj istí, že ju chcete vypnúť? @@ -10,7 +10,6 @@ Use volume: SettingsWindow Použiť zväzok: Keep enabled SettingsWindow Ponechať zapnuté Revert SettingsWindow Vrátiť VirtualMemory System name Virtuálna pamäť -Choose swap size automatically SettingsWindow Voliť veľkosť odkladacieho priestoru automaticky Use boot volume SettingsWindow Použiť zavádzací zväzok Load defaults SettingsWindow Načítať predvoľby OK VirtualMemoryApp OK diff --git a/data/catalogs/preferences/virtualmemory/sv.catkeys b/data/catalogs/preferences/virtualmemory/sv.catkeys index 545c28b3db..642671128f 100644 --- a/data/catalogs/preferences/virtualmemory/sv.catkeys +++ b/data/catalogs/preferences/virtualmemory/sv.catkeys @@ -1,4 +1,4 @@ -1 swedish x-vnd.Haiku-VirtualMemory 1952476689 +1 swedish x-vnd.Haiku-VirtualMemory 4238590117 Quit SettingsWindow Avsluta Turn off SettingsWindow Stäng av Disabling virtual memory will have unwanted effects on system stability once the memory is used up.\nVirtual memory does not affect system performance until this point is reached.\n\nAre you really sure you want to turn it off? SettingsWindow Om du stänger av det virtuella minnet så kommer det att orsaka instabilitet i systemet när minnet är fullt.\nVirtuellt minne påverkar inte systemets prestanda när det inte används.\n\nÄr du säker på att du vill inaktivera virtuellt minne? @@ -10,7 +10,6 @@ Use volume: SettingsWindow Använd volym: Keep enabled SettingsWindow Behåll aktiverad Revert SettingsWindow Återgå VirtualMemory System name VirtuelltMinne -Choose swap size automatically SettingsWindow Välj swap storlek automatiskt Use boot volume SettingsWindow Använd boot volym Load defaults SettingsWindow Läs in standardvärden OK VirtualMemoryApp OK diff --git a/data/catalogs/preferences/virtualmemory/zh_Hans.catkeys b/data/catalogs/preferences/virtualmemory/zh_Hans.catkeys index 81b41f14b1..64e48268de 100644 --- a/data/catalogs/preferences/virtualmemory/zh_Hans.catkeys +++ b/data/catalogs/preferences/virtualmemory/zh_Hans.catkeys @@ -1,4 +1,4 @@ -1 english x-vnd.Haiku-VirtualMemory 1952476689 +1 english x-vnd.Haiku-VirtualMemory 4238590117 Quit SettingsWindow 退出 Turn off SettingsWindow 关闭 Disabling virtual memory will have unwanted effects on system stability once the memory is used up.\nVirtual memory does not affect system performance until this point is reached.\n\nAre you really sure you want to turn it off? SettingsWindow 当物理内存不足时,禁用虚拟内存,会影响系统的稳定性。\n除非物理内存已用完,使用虚拟内存不会对您的系统性能造成任何影响。\n\n您确定禁用虚拟内存吗? @@ -10,7 +10,6 @@ Use volume: SettingsWindow 已用磁卷: Keep enabled SettingsWindow 保持启用 Revert SettingsWindow 取消 VirtualMemory System name 虚拟内存 -Choose swap size automatically SettingsWindow 自动选择交换分区大小 Use boot volume SettingsWindow 使用引导卷 Load defaults SettingsWindow 载入默认设置 OK VirtualMemoryApp 确定 diff --git a/data/catalogs/servers/debug/be.catkeys b/data/catalogs/servers/debug/be.catkeys index fe46e539a2..dde2c8e0d2 100644 --- a/data/catalogs/servers/debug/be.catkeys +++ b/data/catalogs/servers/debug/be.catkeys @@ -1,3 +1,5 @@ -1 belarusian x-vnd.Haiku-debug_server 3203333611 +1 belarusian x-vnd.Haiku-debug_server 1440673937 +Terminate DebugServer Спыніць Debug DebugServer Адладка +Save report DebugServer Захаваць справаздачу The application:\n\n %app\n\nhas encountered an error which prevents it from continuing. Haiku will terminate the application and clean up. DebugServer Праграма:\n\n %app\n\nапавясцiла аб памылцы, якая перешкаджае яе працы. Haiku вымушана спыніць гэтую праграму. diff --git a/data/catalogs/servers/debug/de.catkeys b/data/catalogs/servers/debug/de.catkeys index 0560e72c4b..d533f754a1 100644 --- a/data/catalogs/servers/debug/de.catkeys +++ b/data/catalogs/servers/debug/de.catkeys @@ -1,4 +1,5 @@ -1 german x-vnd.Haiku-debug_server 857491333 +1 german x-vnd.Haiku-debug_server 1440673937 Terminate DebugServer Beenden Debug DebugServer Debug +Save report DebugServer Bericht speichern The application:\n\n %app\n\nhas encountered an error which prevents it from continuing. Haiku will terminate the application and clean up. DebugServer Die Anwendung:\n\n %app\n\nist auf einen Fehler gestoßen und kann nicht weiter ausgeführt werden. Haiku wird die Anwendung beenden und das System säubern. diff --git a/data/catalogs/servers/debug/fi.catkeys b/data/catalogs/servers/debug/fi.catkeys index ad5c6ab1fa..2b95e13ea0 100644 --- a/data/catalogs/servers/debug/fi.catkeys +++ b/data/catalogs/servers/debug/fi.catkeys @@ -1,3 +1,5 @@ -1 finnish x-vnd.Haiku-debug_server 3203333611 +1 finnish x-vnd.Haiku-debug_server 1440673937 +Terminate DebugServer Lopeta Debug DebugServer Vikajäljitä +Save report DebugServer Tallenna ilmoitus The application:\n\n %app\n\nhas encountered an error which prevents it from continuing. Haiku will terminate the application and clean up. DebugServer Sovellus:\n\n %app\n\non kohdannut virheen, joka estää ohjelman jatkamisen. Haiku lopettaa sovelluksen ja siistii jäljet. diff --git a/data/catalogs/servers/debug/fr.catkeys b/data/catalogs/servers/debug/fr.catkeys index 3cac33e52c..e9ffd171ee 100644 --- a/data/catalogs/servers/debug/fr.catkeys +++ b/data/catalogs/servers/debug/fr.catkeys @@ -1,3 +1,5 @@ -1 french x-vnd.Haiku-debug_server 3203333611 +1 french x-vnd.Haiku-debug_server 1440673937 +Terminate DebugServer Terminer Debug DebugServer Déboguer +Save report DebugServer Enregistrer le rapport The application:\n\n %app\n\nhas encountered an error which prevents it from continuing. Haiku will terminate the application and clean up. DebugServer L'application :\n\n %app\n\na rencontré une erreur l'empêchant de continuer. Haiku va fermer l'application et libérer ses ressources. diff --git a/data/catalogs/servers/debug/hu.catkeys b/data/catalogs/servers/debug/hu.catkeys index 0a64e74eb4..b277c75d06 100644 --- a/data/catalogs/servers/debug/hu.catkeys +++ b/data/catalogs/servers/debug/hu.catkeys @@ -1,4 +1,5 @@ -1 hungarian x-vnd.Haiku-debug_server 857491333 +1 hungarian x-vnd.Haiku-debug_server 1440673937 Terminate DebugServer Megszakítás Debug DebugServer Hibakeresés +Save report DebugServer Jelentés mentése The application:\n\n %app\n\nhas encountered an error which prevents it from continuing. Haiku will terminate the application and clean up. DebugServer A következő program:\n\n %app\n\nhibába ütközött, és nem tud tovább futni. A Haiku leállítja a programot. diff --git a/data/catalogs/servers/debug/ja.catkeys b/data/catalogs/servers/debug/ja.catkeys index ec7fe2276b..5f39244c3f 100644 --- a/data/catalogs/servers/debug/ja.catkeys +++ b/data/catalogs/servers/debug/ja.catkeys @@ -1,4 +1,5 @@ -1 japanese x-vnd.Haiku-debug_server 857491333 +1 japanese x-vnd.Haiku-debug_server 1440673937 Terminate DebugServer 終了 Debug DebugServer デバッグ +Save report DebugServer レポートを保存 The application:\n\n %app\n\nhas encountered an error which prevents it from continuing. Haiku will terminate the application and clean up. DebugServer アプリケーション:\n\n %app\n\nは、エラーのため続行できません。Haiku はアプリケーションを終了し、後始末をします。 diff --git a/data/catalogs/servers/debug/lt.catkeys b/data/catalogs/servers/debug/lt.catkeys index f91c90bcdb..e487e45ded 100644 --- a/data/catalogs/servers/debug/lt.catkeys +++ b/data/catalogs/servers/debug/lt.catkeys @@ -1,3 +1,5 @@ -1 lithuanian x-vnd.Haiku-debug_server 3203333611 +1 lithuanian x-vnd.Haiku-debug_server 1440673937 +Terminate DebugServer Nutraukti darbą Debug DebugServer Derinti +Save report DebugServer Įrašyti ataskaitą The application:\n\n %app\n\nhas encountered an error which prevents it from continuing. Haiku will terminate the application and clean up. DebugServer Programa:\n\n%app\n\nsusidūrė su tęsti darbo neleidžiančia klaida. „Haiku“ nutrauks programos darbą ir apsitvarkys. diff --git a/data/catalogs/servers/debug/pl.catkeys b/data/catalogs/servers/debug/pl.catkeys index fca02dfba3..39ce6cebf3 100644 --- a/data/catalogs/servers/debug/pl.catkeys +++ b/data/catalogs/servers/debug/pl.catkeys @@ -1,4 +1,5 @@ -1 polish x-vnd.Haiku-debug_server 857491333 +1 polish x-vnd.Haiku-debug_server 1440673937 Terminate DebugServer Przerwij Debug DebugServer Debug +Save report DebugServer Zapisz raport The application:\n\n %app\n\nhas encountered an error which prevents it from continuing. Haiku will terminate the application and clean up. DebugServer W aplikacji:\n\n %app\n\nwystąpił błąd który uniemożliwia kontynuację. Haiku przerwie działanie aplikacji i posprząta po niej. diff --git a/data/catalogs/servers/debug/pt_BR.catkeys b/data/catalogs/servers/debug/pt_BR.catkeys index 8a29165750..30e646e44f 100644 --- a/data/catalogs/servers/debug/pt_BR.catkeys +++ b/data/catalogs/servers/debug/pt_BR.catkeys @@ -1,3 +1,5 @@ -1 portuguese (brazil) x-vnd.Haiku-debug_server 3203333611 +1 portuguese (brazil) x-vnd.Haiku-debug_server 1440673937 +Terminate DebugServer Finalizar Debug DebugServer Depurar +Save report DebugServer Salvar relatório The application:\n\n %app\n\nhas encountered an error which prevents it from continuing. Haiku will terminate the application and clean up. DebugServer A aplicação:\n\n %app\n\nencontrou um erro que a impede de continuar. Haiku irá fechar a aplicação. diff --git a/data/catalogs/servers/debug/sk.catkeys b/data/catalogs/servers/debug/sk.catkeys index 272e5f4f52..2d9a476e79 100644 --- a/data/catalogs/servers/debug/sk.catkeys +++ b/data/catalogs/servers/debug/sk.catkeys @@ -1,3 +1,5 @@ -1 slovak x-vnd.Haiku-debug_server 3203333611 +1 slovak x-vnd.Haiku-debug_server 1440673937 +Terminate DebugServer Ukončiť Debug DebugServer Ladenie +Save report DebugServer Uložiť hlásenie The application:\n\n %app\n\nhas encountered an error which prevents it from continuing. Haiku will terminate the application and clean up. DebugServer V aplikácii:\n\n %app\n\n sa vyskytla chyba, ktorá jej bráni pokračovať. Haiku aplikáciu ukončí a uprace po nej. diff --git a/data/catalogs/servers/debug/zh_Hans.catkeys b/data/catalogs/servers/debug/zh_Hans.catkeys index e6f542211b..750d1fd2b1 100644 --- a/data/catalogs/servers/debug/zh_Hans.catkeys +++ b/data/catalogs/servers/debug/zh_Hans.catkeys @@ -1,3 +1,5 @@ -1 english x-vnd.Haiku-debug_server 3203333611 +1 english x-vnd.Haiku-debug_server 1440673937 +Terminate DebugServer 终止 Debug DebugServer 调试器 +Save report DebugServer 保存报告 The application:\n\n %app\n\nhas encountered an error which prevents it from continuing. Haiku will terminate the application and clean up. DebugServer 应用程序:\n\n %app\n\n出现错误,无法继续运行。Haiku 将终止该程序并予以清除。 diff --git a/data/catalogs/tests/kits/game/chart/be.catkeys b/data/catalogs/tests/kits/game/chart/be.catkeys index 9a6b7e181d..f4f1efabca 100644 --- a/data/catalogs/tests/kits/game/chart/be.catkeys +++ b/data/catalogs/tests/kits/game/chart/be.catkeys @@ -1,4 +1,4 @@ -1 belarusian x-vnd.Be.ChartDemo 986636897 +1 belarusian x-vnd.Haiku-ChartDemo 986636897 Slow rotation ChartWindow Паступовы паварот Pink ChartWindow Ружовы Comet ChartWindow Камета diff --git a/data/catalogs/tests/kits/game/chart/de.catkeys b/data/catalogs/tests/kits/game/chart/de.catkeys index 97ff445d29..20d1742a29 100644 --- a/data/catalogs/tests/kits/game/chart/de.catkeys +++ b/data/catalogs/tests/kits/game/chart/de.catkeys @@ -1,4 +1,4 @@ -1 german x-vnd.Be.ChartDemo 986636897 +1 german x-vnd.Haiku-ChartDemo 986636897 Slow rotation ChartWindow Langsame Drehung Pink ChartWindow Pink Comet ChartWindow Kometen diff --git a/data/catalogs/tests/kits/game/chart/el.catkeys b/data/catalogs/tests/kits/game/chart/el.catkeys index 2993f8b23c..0b199d167b 100644 --- a/data/catalogs/tests/kits/game/chart/el.catkeys +++ b/data/catalogs/tests/kits/game/chart/el.catkeys @@ -1,4 +1,4 @@ -1 greek, modern (1453-) x-vnd.Be.ChartDemo 557376150 +1 greek, modern (1453-) x-vnd.Haiku-ChartDemo 557376150 Slow rotation ChartWindow Αργή περιστροφή Pink ChartWindow Ρόζ Comet ChartWindow Κομήτης diff --git a/data/catalogs/tests/kits/game/chart/fi.catkeys b/data/catalogs/tests/kits/game/chart/fi.catkeys index 3d9bbf4c5a..c2cb584fdf 100644 --- a/data/catalogs/tests/kits/game/chart/fi.catkeys +++ b/data/catalogs/tests/kits/game/chart/fi.catkeys @@ -1,4 +1,4 @@ -1 finnish x-vnd.Be.ChartDemo 986636897 +1 finnish x-vnd.Haiku-ChartDemo 986636897 Slow rotation ChartWindow Hidas kierto Pink ChartWindow Vaaleanpunainen Comet ChartWindow Komeetta diff --git a/data/catalogs/tests/kits/game/chart/fr.catkeys b/data/catalogs/tests/kits/game/chart/fr.catkeys index 4ec8011c4c..1517279ef8 100644 --- a/data/catalogs/tests/kits/game/chart/fr.catkeys +++ b/data/catalogs/tests/kits/game/chart/fr.catkeys @@ -1,4 +1,4 @@ -1 french x-vnd.Be.ChartDemo 986636897 +1 french x-vnd.Haiku-ChartDemo 986636897 Slow rotation ChartWindow Rotation lente Pink ChartWindow Rose Comet ChartWindow Comète diff --git a/data/catalogs/tests/kits/game/chart/hi.catkeys b/data/catalogs/tests/kits/game/chart/hi.catkeys index 2a7d93eac4..dc549d1a2a 100644 --- a/data/catalogs/tests/kits/game/chart/hi.catkeys +++ b/data/catalogs/tests/kits/game/chart/hi.catkeys @@ -1,4 +1,4 @@ -1 hindi x-vnd.Be.ChartDemo 2347439535 +1 hindi x-vnd.Haiku-ChartDemo 2347439535 Slow rotation ChartWindow धीरे चक्रानुक्रम Pink ChartWindow गुलाबी Comet ChartWindow धूमकेतु diff --git a/data/catalogs/tests/kits/game/chart/hu.catkeys b/data/catalogs/tests/kits/game/chart/hu.catkeys index 815de43afd..0d3cace628 100644 --- a/data/catalogs/tests/kits/game/chart/hu.catkeys +++ b/data/catalogs/tests/kits/game/chart/hu.catkeys @@ -1,4 +1,4 @@ -1 hungarian x-vnd.Be.ChartDemo 986636897 +1 hungarian x-vnd.Haiku-ChartDemo 986636897 Slow rotation ChartWindow Lassú forgatás Pink ChartWindow Rózsaszín Comet ChartWindow Üstökös diff --git a/data/catalogs/tests/kits/game/chart/ja.catkeys b/data/catalogs/tests/kits/game/chart/ja.catkeys index 71cf92a164..d845f6a26a 100644 --- a/data/catalogs/tests/kits/game/chart/ja.catkeys +++ b/data/catalogs/tests/kits/game/chart/ja.catkeys @@ -1,4 +1,4 @@ -1 japanese x-vnd.Be.ChartDemo 986636897 +1 japanese x-vnd.Haiku-ChartDemo 986636897 Slow rotation ChartWindow 遅い回転 Pink ChartWindow ピンク Comet ChartWindow 彗星 diff --git a/data/catalogs/tests/kits/game/chart/lt.catkeys b/data/catalogs/tests/kits/game/chart/lt.catkeys index e57557d4cf..9893e17562 100644 --- a/data/catalogs/tests/kits/game/chart/lt.catkeys +++ b/data/catalogs/tests/kits/game/chart/lt.catkeys @@ -1,4 +1,4 @@ -1 lithuanian x-vnd.Be.ChartDemo 986636897 +1 lithuanian x-vnd.Haiku-ChartDemo 986636897 Slow rotation ChartWindow Lėtas sukimasis Pink ChartWindow Rožinė Comet ChartWindow Kometos diff --git a/data/catalogs/tests/kits/game/chart/nl.catkeys b/data/catalogs/tests/kits/game/chart/nl.catkeys index 7f7e637889..db1e029c79 100644 --- a/data/catalogs/tests/kits/game/chart/nl.catkeys +++ b/data/catalogs/tests/kits/game/chart/nl.catkeys @@ -1,4 +1,4 @@ -1 dutch; flemish x-vnd.Be.ChartDemo 986636897 +1 dutch; flemish x-vnd.Haiku-ChartDemo 986636897 Slow rotation ChartWindow Trage rotatie Pink ChartWindow Roze Comet ChartWindow Komeet diff --git a/data/catalogs/tests/kits/game/chart/pl.catkeys b/data/catalogs/tests/kits/game/chart/pl.catkeys index 579dd6f491..7f92723e6f 100644 --- a/data/catalogs/tests/kits/game/chart/pl.catkeys +++ b/data/catalogs/tests/kits/game/chart/pl.catkeys @@ -1,4 +1,4 @@ -1 polish x-vnd.Be.ChartDemo 986636897 +1 polish x-vnd.Haiku-ChartDemo 986636897 Slow rotation ChartWindow Powolny obrót Pink ChartWindow Różowy Comet ChartWindow Kometa diff --git a/data/catalogs/tests/kits/game/chart/pt_BR.catkeys b/data/catalogs/tests/kits/game/chart/pt_BR.catkeys index 6d044f5b76..bc7416555b 100644 --- a/data/catalogs/tests/kits/game/chart/pt_BR.catkeys +++ b/data/catalogs/tests/kits/game/chart/pt_BR.catkeys @@ -1,4 +1,4 @@ -1 portuguese (brazil) x-vnd.Be.ChartDemo 986636897 +1 portuguese (brazil) x-vnd.Haiku-ChartDemo 986636897 Slow rotation ChartWindow Rotação lenta Pink ChartWindow Rosa Comet ChartWindow Cometa diff --git a/data/catalogs/tests/kits/game/chart/ro.catkeys b/data/catalogs/tests/kits/game/chart/ro.catkeys index 67fc420850..c377cb6c82 100644 --- a/data/catalogs/tests/kits/game/chart/ro.catkeys +++ b/data/catalogs/tests/kits/game/chart/ro.catkeys @@ -1,4 +1,4 @@ -1 romanian x-vnd.Be.ChartDemo 557376150 +1 romanian x-vnd.Haiku-ChartDemo 557376150 Slow rotation ChartWindow Rotaţie lentă Pink ChartWindow Roz Comet ChartWindow Cometă diff --git a/data/catalogs/tests/kits/game/chart/ru.catkeys b/data/catalogs/tests/kits/game/chart/ru.catkeys index af6877cdad..1f8d913d1f 100644 --- a/data/catalogs/tests/kits/game/chart/ru.catkeys +++ b/data/catalogs/tests/kits/game/chart/ru.catkeys @@ -1,4 +1,4 @@ -1 russian x-vnd.Be.ChartDemo 986636897 +1 russian x-vnd.Haiku-ChartDemo 986636897 Slow rotation ChartWindow Медленное вращение Pink ChartWindow Розовый Comet ChartWindow Комета diff --git a/data/catalogs/tests/kits/game/chart/sk.catkeys b/data/catalogs/tests/kits/game/chart/sk.catkeys index 017b5e64c8..1d2fcc48ce 100644 --- a/data/catalogs/tests/kits/game/chart/sk.catkeys +++ b/data/catalogs/tests/kits/game/chart/sk.catkeys @@ -1,4 +1,4 @@ -1 slovak x-vnd.Be.ChartDemo 986636897 +1 slovak x-vnd.Haiku-ChartDemo 986636897 Slow rotation ChartWindow Pomalá rotácia Pink ChartWindow Ružová Comet ChartWindow Kométa diff --git a/data/catalogs/tests/kits/game/chart/sv.catkeys b/data/catalogs/tests/kits/game/chart/sv.catkeys index 27c2998697..7588544f2e 100644 --- a/data/catalogs/tests/kits/game/chart/sv.catkeys +++ b/data/catalogs/tests/kits/game/chart/sv.catkeys @@ -1,4 +1,4 @@ -1 swedish x-vnd.Be.ChartDemo 986636897 +1 swedish x-vnd.Haiku-ChartDemo 986636897 Slow rotation ChartWindow Långsam rotation Pink ChartWindow Rosa Comet ChartWindow Komet diff --git a/data/catalogs/tests/kits/game/chart/uk.catkeys b/data/catalogs/tests/kits/game/chart/uk.catkeys index 10dbea0d79..9228782144 100644 --- a/data/catalogs/tests/kits/game/chart/uk.catkeys +++ b/data/catalogs/tests/kits/game/chart/uk.catkeys @@ -1,4 +1,4 @@ -1 ukrainian x-vnd.Be.ChartDemo 557376150 +1 ukrainian x-vnd.Haiku-ChartDemo 557376150 Slow rotation ChartWindow Повільне обертання Pink ChartWindow Рожевий Comet ChartWindow Комета diff --git a/data/catalogs/tests/kits/game/chart/zh_Hans.catkeys b/data/catalogs/tests/kits/game/chart/zh_Hans.catkeys index eccf7c2445..4d50580ba6 100644 --- a/data/catalogs/tests/kits/game/chart/zh_Hans.catkeys +++ b/data/catalogs/tests/kits/game/chart/zh_Hans.catkeys @@ -1,4 +1,4 @@ -1 english x-vnd.Be.ChartDemo 986636897 +1 english x-vnd.Haiku-ChartDemo 986636897 Slow rotation ChartWindow 慢速旋转 Pink ChartWindow 粉红色 Comet ChartWindow 彗星 diff --git a/data/develop/makefile-engine b/data/develop/makefile-engine index 1a2194c77e..274b0724a7 100644 --- a/data/develop/makefile-engine +++ b/data/develop/makefile-engine @@ -148,7 +148,7 @@ VPATH := VPATH += $(addprefix :, $(subst ,:, $(filter-out $($(subst, :, ,$(VPATH))), $(SRC_PATHS)))) # SETTING: build the local and system include paths, compose C++ libs -ifeq ($(CPU), x86) +ifneq (,$(filter $(CPU),x86 x86_64)) LOC_INCLUDES = $(foreach path, $(SRC_PATHS) $(LOCAL_INCLUDE_PATHS), $(addprefix -I, $(path))) ifeq ($(CC_VER), 2) INCLUDES = $(LOC_INCLUDES) diff --git a/data/system/data/firmware/ralinkwifi/RT2860_Firmware_V26.zip b/data/system/data/firmware/ralinkwifi/RT2860_Firmware_V26.zip new file mode 100644 index 0000000000..5361dd2147 Binary files /dev/null and b/data/system/data/firmware/ralinkwifi/RT2860_Firmware_V26.zip differ diff --git a/docs/user/Doxyfile b/docs/user/Doxyfile index cfbbf00967..b7791ede72 100644 --- a/docs/user/Doxyfile +++ b/docs/user/Doxyfile @@ -1,4 +1,4 @@ -# Doxyfile 1.7.3 +# Doxyfile 1.7.5.1 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project. @@ -22,8 +22,9 @@ DOXYFILE_ENCODING = UTF-8 -# The PROJECT_NAME tag is a single word (or a sequence of words surrounded -# by quotes) that should identify the project. +# The PROJECT_NAME tag is a single word (or sequence of words) that should +# identify the project. Note that if you do not use Doxywizard you need +# to put quotes around the project name if it contains spaces. PROJECT_NAME = "The Haiku Book" @@ -33,7 +34,9 @@ PROJECT_NAME = "The Haiku Book" PROJECT_NUMBER = pre-R1 -# Using the PROJECT_BRIEF tag one can provide an optional one line description for a project that appears at the top of each page and should give viewer a quick idea about the purpose of the project. Keep the description short. +# Using the PROJECT_BRIEF tag one can provide an optional one line description +# for a project that appears at the top of each page and should give viewer +# a quick idea about the purpose of the project. Keep the description short. PROJECT_BRIEF = @@ -274,6 +277,22 @@ DISTRIBUTE_GROUP_DOC = NO SUBGROUPING = YES +# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and +# unions are shown inside the group in which they are included (e.g. using +# @ingroup) instead of on a separate page (for HTML and Man pages) or +# section (for LaTeX and RTF). + +INLINE_GROUPED_CLASSES = NO + +# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and +# unions with only public data fields will be shown inline in the documentation +# of the scope in which they are defined (i.e. file, namespace, or group +# documentation), provided this scope is documented. If set to NO (the default), +# structs, classes, and unions are shown on a separate page (for HTML and Man +# pages) or section (for LaTeX and RTF). + +INLINE_SIMPLE_STRUCTS = NO + # When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum # is documented as struct, union, or enum with the name of the typedef. So # typedef struct TypeS {} TypeT, will appear in the documentation as a struct @@ -449,8 +468,11 @@ SORT_GROUP_NAMES = NO SORT_BY_SCOPE_NAME = NO -# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper type resolution of all parameters of a function it will reject a -# match between the prototype and the implementation of a member function even if there is only one candidate or it is obvious which candidate to choose by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen +# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to +# do proper type resolution of all parameters of a function it will reject a +# match between the prototype and the implementation of a member function even +# if there is only one candidate or it is obvious which candidate to choose +# by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen # will still accept a match between prototype and implementation in such cases. STRICT_PROTO_MATCHING = NO @@ -538,6 +560,15 @@ FILE_VERSION_FILTER = LAYOUT_FILE = +# The CITE_BIB_FILES tag can be used to specify one or more bib files +# containing the references data. This must be a list of .bib files. The +# .bib extension is automatically appended if omitted. Using this command +# requires the bibtex tool to be installed. See also +# http://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style +# of the bibliography can be controlled using LATEX_BIB_STYLE. + +CITE_BIB_FILES = + #--------------------------------------------------------------------------- # configuration options related to warning and progress messages #--------------------------------------------------------------------------- @@ -654,6 +685,7 @@ RECURSIVE = NO # The EXCLUDE tag can be used to specify files and/or directories that should # excluded from the INPUT source files. This way you can easily exclude a # subdirectory from a directory tree whose root is specified with the INPUT tag. +# Note that relative paths are relative to directory from which doxygen is run. EXCLUDE = @@ -706,7 +738,8 @@ EXAMPLE_RECURSIVE = NO IMAGE_PATH = . \ interface \ keyboard \ - midi2 + midi2 \ + storage # The INPUT_FILTER tag can be used to specify a program that doxygen should # invoke to filter for each input file. Doxygen will invoke the filter program @@ -846,7 +879,14 @@ HTML_FILE_EXTENSION = .html # The HTML_HEADER tag can be used to specify a personal HTML header for # each generated HTML page. If it is left blank doxygen will generate a -# standard header. +# standard header. Note that when using a custom header you are responsible +# for the proper inclusion of any scripts and style sheets that doxygen +# needs, which is dependent on the configuration options used. +# It is adviced to generate a default header using "doxygen -w html +# header.html footer.html stylesheet.css YourConfigFile" and then modify +# that header. Note that the header is subject to change so you typically +# have to redo this when upgrading to a newer version of doxygen or when +# changing the value of configuration settings such as GENERATE_TREEVIEW! HTML_HEADER = header.html @@ -865,6 +905,15 @@ HTML_FOOTER = footer.html HTML_STYLESHEET = book.css +# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or +# other source files which should be copied to the HTML output directory. Note +# that these files will be copied to the base HTML output directory. Use the +# $relpath$ marker in the HTML_HEADER and/or HTML_FOOTER files to load these +# files. In the HTML_STYLESHEET file, use the file name only. Also note that +# the files will be copied as-is; there are no commands or markers available. + +HTML_EXTRA_FILES = + # The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. # Doxygen will adjust the colors in the stylesheet and background images # according to this color. Hue is specified as an angle on a colorwheel, @@ -1067,9 +1116,10 @@ ECLIPSE_DOC_ID = org.doxygen.Project DISABLE_INDEX = NO -# This tag can be used to set the number of enum values (range [0,1..20]) -# that doxygen will group on one line in the generated HTML documentation. -# Note that a value of 0 will completely suppress the enum values from appearing in the overview section. +# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values +# (range [0,1..20]) that doxygen will group on one line in the generated HTML +# documentation. Note that a value of 0 will completely suppress the enum +# values from appearing in the overview section. ENUM_VALUES_PER_LINE = 1 @@ -1128,12 +1178,18 @@ USE_MATHJAX = NO # HTML output directory using the MATHJAX_RELPATH option. The destination # directory should contain the MathJax.js script. For instance, if the mathjax # directory is located at the same level as the HTML output directory, then -# MATHJAX_RELPATH should be ../mathjax. The default value points to the mathjax.org site, so you can quickly see the result without installing +# MATHJAX_RELPATH should be ../mathjax. The default value points to the +# mathjax.org site, so you can quickly see the result without installing # MathJax, but it is strongly recommended to install a local copy of MathJax # before deployment. MATHJAX_RELPATH = http://www.mathjax.org/mathjax +# The MATHJAX_EXTENSIONS tag can be used to specify one or MathJax extension +# names that should be enabled during MathJax rendering. + +MATHJAX_EXTENSIONS = + # When the SEARCHENGINE tag is enabled doxygen will generate a search box # for the HTML output. The underlying search engine uses javascript # and DHTML and should work on any modern browser. Note that when using @@ -1207,6 +1263,13 @@ EXTRA_PACKAGES = LATEX_HEADER = +# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for +# the generated latex document. The footer should contain everything after +# the last chapter. If it is left blank doxygen will generate a +# standard footer. Notice: only use this tag if you know what you are doing! + +LATEX_FOOTER = + # If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated # is prepared for conversion to pdf (using ps2pdf). The pdf file will # contain links (just like the HTML output) instead of page references @@ -1240,6 +1303,12 @@ LATEX_HIDE_INDICES = NO LATEX_SOURCE_CODE = NO +# The LATEX_BIB_STYLE tag can be used to specify the style to use for the +# bibliography, e.g. plainnat, or ieeetr. The default style is "plain". See +# http://en.wikipedia.org/wiki/BibTeX for more info. + +LATEX_BIB_STYLE = plain + #--------------------------------------------------------------------------- # configuration options related to the RTF output #--------------------------------------------------------------------------- @@ -1416,7 +1485,7 @@ MACRO_EXPANSION = NO EXPAND_ONLY_PREDEF = NO # If the SEARCH_INCLUDES tag is set to YES (the default) the includes files -# in the INCLUDE_PATH (see below) will be search if a #include is found. +# pointed to by INCLUDE_PATH will be searched when a #include is found. SEARCH_INCLUDES = YES @@ -1447,7 +1516,8 @@ PREDEFINED = __cplusplus \ # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then # this tag can be used to specify a list of macro names that should be expanded. # The macro definition that is found in the sources will be used. -# Use the PREDEFINED tag if you want to use a different macro definition that overrules the definition found in the source code. +# Use the PREDEFINED tag if you want to use a different macro definition that +# overrules the definition found in the source code. EXPAND_AS_DEFINED = @@ -1545,13 +1615,12 @@ HAVE_DOT = NO DOT_NUM_THREADS = 0 -# By default doxygen will write a font called Helvetica to the output -# directory and reference it in all dot files that doxygen generates. -# When you want a differently looking font you can specify the font name -# using DOT_FONTNAME. You need to make sure dot is able to find the font, -# which can be done by putting it in a standard location or by setting the -# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory -# containing the font. +# By default doxygen will use the Helvetica font for all dot files that +# doxygen generates. When you want a differently looking font you can specify +# the font name using DOT_FONTNAME. You need to make sure dot is able to find +# the font, which can be done by putting it in a standard location or by setting +# the DOTFONTPATH environment variable or by setting DOT_FONTPATH to the +# directory containing the font. DOT_FONTNAME = Helvetica @@ -1560,10 +1629,9 @@ DOT_FONTNAME = Helvetica DOT_FONTSIZE = 10 -# By default doxygen will tell dot to use the output directory to look for the -# FreeSans.ttf font (which doxygen will put there itself). If you specify a -# different font using DOT_FONTNAME you can set the path where dot -# can find it using this tag. +# By default doxygen will tell dot to use the Helvetica font. +# If you specify a different font using DOT_FONTNAME you can use DOT_FONTPATH to +# set the path where dot can find it. DOT_FONTPATH = @@ -1640,11 +1708,22 @@ GRAPHICAL_HIERARCHY = YES DIRECTORY_GRAPH = YES # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images -# generated by dot. Possible values are png, svg, gif or svg. -# If left blank png will be used. +# generated by dot. Possible values are svg, png, jpg, or gif. +# If left blank png will be used. If you choose svg you need to set +# HTML_FILE_EXTENSION to xhtml in order to make the SVG files +# visible in IE 9+ (other browsers do not have this requirement). DOT_IMAGE_FORMAT = png +# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to +# enable generation of interactive SVG images that allow zooming and panning. +# Note that this requires a modern browser other than Internet Explorer. +# Tested and working are Firefox, Chrome, Safari, and Opera. For IE 9+ you +# need to set HTML_FILE_EXTENSION to xhtml in order to make the SVG files +# visible. Older versions of IE do not have SVG support. + +INTERACTIVE_SVG = NO + # The tag DOT_PATH can be used to specify the path where the dot tool can be # found. If left blank, it is assumed the dot tool can be found in the path. diff --git a/docs/user/interface/GridLayout.dox b/docs/user/interface/GridLayout.dox index f610cacd0b..f2e709c906 100644 --- a/docs/user/interface/GridLayout.dox +++ b/docs/user/interface/GridLayout.dox @@ -12,7 +12,7 @@ /*! \file GridLayout.h - Provides the BGridLayout class. + \brief Provides the BGridLayout class. */ diff --git a/docs/user/interface/GroupLayout.dox b/docs/user/interface/GroupLayout.dox index 5562aa00b8..0749828d48 100644 --- a/docs/user/interface/GroupLayout.dox +++ b/docs/user/interface/GroupLayout.dox @@ -10,8 +10,9 @@ */ -/*! \file GroupLayout.h - Describes the BGroupLayout class +/*! + \file GroupLayout.h + \brief Describes the BGroupLayout class. */ diff --git a/docs/user/interface/LayoutItem.dox b/docs/user/interface/LayoutItem.dox index db06d6d109..e4c069c5c9 100644 --- a/docs/user/interface/LayoutItem.dox +++ b/docs/user/interface/LayoutItem.dox @@ -12,7 +12,7 @@ /*! \file LayoutItem.h - Describes the BLayoutItem class + \brief Describes the BLayoutItem class */ diff --git a/docs/user/midi2/Midi2Defs.dox b/docs/user/midi2/Midi2Defs.dox index 11de6a7a37..49ee5574c9 100644 --- a/docs/user/midi2/Midi2Defs.dox +++ b/docs/user/midi2/Midi2Defs.dox @@ -1,5 +1,6 @@ /*! \file Midi2Defs.h +\brief Some definitions to define raw MIDI events. \ingroup midi2 */ diff --git a/docs/user/storage/BFilePanel_example.png b/docs/user/storage/BFilePanel_example.png new file mode 100644 index 0000000000..0c417e2acd Binary files /dev/null and b/docs/user/storage/BFilePanel_example.png differ diff --git a/docs/user/storage/Entry.dox b/docs/user/storage/Entry.dox index b9eafdb08d..7f1bd9704a 100644 --- a/docs/user/storage/Entry.dox +++ b/docs/user/storage/Entry.dox @@ -14,7 +14,7 @@ /*! \file Entry.h - Provides the BEntry class and entry_ref implementations. + \brief Provides the BEntry class and entry_ref implementations. */ diff --git a/docs/user/storage/File.dox b/docs/user/storage/File.dox index 503e0aa614..d6e256d2d6 100644 --- a/docs/user/storage/File.dox +++ b/docs/user/storage/File.dox @@ -15,7 +15,7 @@ /*! \file File.h - Provides the BFile class. + \brief Provides the BFile class. */ diff --git a/docs/user/storage/FilePanel.dox b/docs/user/storage/FilePanel.dox new file mode 100644 index 0000000000..bcfa4edba8 --- /dev/null +++ b/docs/user/storage/FilePanel.dox @@ -0,0 +1,356 @@ +/* + * Copyright 2009-2012 Haiku, Inc. All rights reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * John Scipione, jscipione@gmail.com + * + * Corresponds to: + * headers/os/storage/FilePanel.h hrev45162 + * src/kits/tracker/FilePanel.cpp hrev45162 + */ + + +/*! + \file FilePanel.h + \brief Provides the BFilePanel and BRefFilter classes and support enums. +*/ + + +/*! + \enum file_panel_mode + Whether the file panel is a save or open panel. +*/ + + +/*! + \var file_panel_mode B_OPEN_PANEL + Open panel +*/ + + +/*! + \var file_panel_mode B_SAVE_PANEL + Save panel +*/ + + +/*! + \enum file_panel_button + List of buttons used by the file panel +*/ + + +/*! + \var file_panel_button B_CANCEL_BUTTON + Cancel button +*/ + + +/*! + \var file_panel_button B_DEFAULT_BUTTON + Default button +*/ + + +/*! + \class BRefFilter + \ingroup storage + \ingroup libbe + \brief Allows you to filter the items displayed in a file panel. +*/ + + +/*! + \fn virtual bool Filter(const entry_ref* ref, BNode* node, + struct stat_beos* stat, const char* mimeType) + \brief Hook method that's called on each file in the target directory + displayed by a file panel. + + \param ref The file currently under consideration. + \param node The node currently under consideration. + \param stat The stat information of the file. + \param mimeType The MIME type of the file. + + \returns Whether or not the entry is a valid candidate for an open/save + dialog. + + \see BFilePanel::SetRefFilter() +*/ + + +/*! + \class BFilePanel + \ingroup storage + \ingroup libbe + \brief Displays a standard Open/Save dialog. + + A save panel looks like this: + + \image html BFilePanel_example.png + + An open dialog looks similar but doesn't have a text box for the file name. + + Creating a basic open or save panel is easy: + +\code + BFilePanel* openPanel = new BFilePanel(B_OPEN_PANEL); + BFilePanel* savePanel = new BFilePanel(B_SAVE_PANEL); +\endcode + + There are many options but they can generally be set after the object has + been constructed. +*/ + + +/*! + \fn BFilePanel::BFilePanel(file_panel_mode mode, BMessenger* target, + const entry_ref* ref, uint32 nodeFlavors, bool multipleSelection, + BMessage* message, BRefFilter* filter, bool modal, bool hideWhenDone) + \brief Creates and initializes a BFilePanel object. + + The panel is not displayed until call the Show() method. + + \param mode Either \c B_OPEN_PANEL or \c B_SAVE_PANEL. + \param target The BMessenger object that sends messages to the BLooper + or BHandler controlled by the file panel. + \param ref The directory to display, by default the current working + directory. + \param nodeFlavors Option flags, this applies to open panels only. + \param multipleSelection Determines whether or not the user is allowed + to select more than one item. + \param message Override the default message sent by the file panel. + \param filter Filter Hook function to call. + \param modal Whether or not the panel is modal, defaults to \c false. + \param hideWhenDone Set to \c false to keep the panel even after the user + confirms or cancels. The close button will hide the panel regardless. +*/ + + +/*! + \fn BFilePanel::~BFilePanel() + \brief Destroys the file panel object. + + If file panel is currently being displayed it is closed. The BRefFilter + object references by this panel is not destroyed by this method. +*/ + + +/*! + \fn void BFilePanel::Show() + \brief Displays the file panel on screen. +*/ + + +/*! + \fn void BFilePanel::Hide() + \brief Hides the file panel. +*/ + + +/*! + \fn bool BFilePanel::IsShowing() const + \brief Determines whether or not the file panel is shown. + + \returns \c true if visible, \c false if hidden. +*/ + + +/*! + \fn void BFilePanel::SendMessage(const BMessenger* messenger, + BMessage* message) + \brief Sends the \a message to the target BHandler \a messenger. + + \param messenger The target BHandler to send the message to. + \param message The message to send. + + \see BMessenger::SendMessage() +*/ + + +/*! + \fn file_panel_mode BFilePanel::PanelMode() const + \brief Gets the panel mode, either \c B_OPEN_PANEL or \c B_SAVE_PANEL. + + \returns \c B_OPEN_PANEL if the panel is an open panel or \c B_SAVE_PANEL + if the panel is a save panel. +*/ + + +/*! + \fn BMessenger BFilePanel::Messenger() const + \brief Gets the panel's target messenger object. + + \returns The BMessenger object that sends messages for this panel. +*/ + + +/*! + \fn void BFilePanel::SetTarget(BMessenger target) + \brief Sets the target messenger. + + \param target the target BMessenger object to set. +*/ + + +/*! + \fn void BFilePanel::SetMessage(BMessage* message) + \brief Sets the target messenge. + + \param message The BMessage object to send on confirm. +*/ + + +/*! + \fn void BFilePanel::Refresh() + \brief Refresh the directory or the panel causing the entries to be re-run + through the BRefFilter::Filter() method. +*/ + + +/*! + \fn BRefFilter* BFilePanel::RefFilter() const + \brief Gets the BRefFilter object associated with the panel. + + \returns The BRefFilter set to the panel. + + \see BRefFilter::Filter() +*/ + + +/*! + \fn void BFilePanel::SetRefFilter(BRefFilter* filter) + \brief Sets the BRefFilter used by the panel to filter entries. + + \param filter The BRefFilter object to set. + + \see BRefFilter::Filter() +*/ + + +/*! + \fn void BFilePanel::SetButtonLabel(file_panel_button button, + const char* text) + \brief Set the button label specified by \a button to \a text. + + \param button The button to set the label of. + \param text The text to set the button label to. +*/ + + +/*! + \fn void BFilePanel::GetPanelDirectory(entry_ref* ref) const + \brief Gets the entry ref of the panel and sets \a ref to point to it. + + \param ref The \c entry_ref pointer you want set. +*/ + + +/*! + \fn void BFilePanel::SetSaveText(const char* text) + \brief Set some save text to display in the save dialog. + + \param text The text to display. +*/ + + +/*! + \fn void BFilePanel::SetPanelDirectory(const entry_ref* ref) + \brief Sets the entry ref of the panel to the directory contained + by \a ref. + + \param ref The entry contained by the desired panel directory. +*/ + + +/*! + \fn void BFilePanel::SetPanelDirectory(const char* path) + \brief Sets the entry ref of the panel to the directory referenced + by \a path. + + \param path The path of the desired directory. +*/ + + +/*! + \fn void BFilePanel::SetPanelDirectory(const BEntry* entry) + \brief Sets the entry ref of the panel to the directory referenced + by \a entry. + + \param entry The BEntry object pointing to the desired directory. +*/ + + +/*! + \fn void BFilePanel::SetPanelDirectory(const BDirectory* dir) + \brief Sets the entry ref of the panel to the directory referenced + by \a dir. + + \param dir The BDirectory object pointing to the desired directory. +*/ + + +/*! + \fn BWindow* BFilePanel::Window() const + \brief Gets a pointer to the BWindow object used by the file panel. + + \returns A pointer to the BWindow object used by the file panel. +*/ + + +/*! + \fn void BFilePanel::Rewind() + \brief Sets the entry ref back to the top of the list. + + \see SelectionChanged() +*/ + + +/*! + \fn status_t BFilePanel::GetNextSelectedRef(entry_ref* ref) + \brief Sets the \a ref pointer to the next entry in the directory. + + \returns a status message. + \retval B_OK Everything went fine. + \retval B_ERROR Couldn't attain a lock on the window. + \retval B_ENTRY_NOT_FOUND End of the entry list. + + \see SelectionChanged() +*/ + + +/*! + \fn void BFilePanel::SetHideWhenDone(bool on) + \brief Sets whether or not the panel should hide on confirm or cancel. + + \param on \c true to hide, \c false to not hide when done. +*/ + + +/*! + \fn bool BFilePanel::HidesWhenDone(void) const + \brief Gets whether or not the panel should hide on confirm or cancel. + + Panel always hides if the user clicks the window's close button. + + \returns \c true if panel will hide, \c false if panel will not hide. +*/ + + +/*! + \fn void BFilePanel::WasHidden() + \brief Hook method that gets called when the file panel is hidden due to + a user action. + + WasHidden() is not called if you call Hide() manually. +*/ + + +/*! + \fn void BFilePanel::SelectionChanged() + \brief Hook method that gets called when the entry ref references by the + file panel changes. + + \see GetNextSelectedRef() + \see Rewind() +*/ diff --git a/headers/os/interface/TextView.h b/headers/os/interface/TextView.h index cf23a1a51b..4e746fda13 100644 --- a/headers/os/interface/TextView.h +++ b/headers/os/interface/TextView.h @@ -455,6 +455,8 @@ private: int32 fLastClickOffset; bool fInstalledNavigateWordwiseShortcuts; bool fInstalledNavigateToTopOrBottomShortcuts; + bool fInstalledSelectWordwiseShortcuts; + bool fInstalledSelectToTopOrBottomShortcuts; uint32 _reserved[6]; }; diff --git a/headers/posix/fts.h b/headers/posix/fts.h new file mode 100644 index 0000000000..2f3780b715 --- /dev/null +++ b/headers/posix/fts.h @@ -0,0 +1,138 @@ +/* + * Copyright (c) 1989, 1993 + * The Regents of the University of California. 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 University 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 REGENTS 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 REGENTS 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. + * + * @(#)fts.h 8.3 (Berkeley) 8/14/94 + * $FreeBSD$ + */ + +#ifndef _FTS_H_ +#define _FTS_H_ + +#include + +typedef struct { + struct _ftsent *fts_cur; /* current node */ + struct _ftsent *fts_child; /* linked list of children */ + struct _ftsent **fts_array; /* sort array */ + dev_t fts_dev; /* starting device # */ + char *fts_path; /* path for this descent */ + int fts_rfd; /* fd for root */ + size_t fts_pathlen; /* sizeof(path) */ + size_t fts_nitems; /* elements in the sort array */ + int (*fts_compar) /* compare function */ + (const struct _ftsent * const *, const struct _ftsent * const *); + +#define FTS_COMFOLLOW 0x001 /* follow command line symlinks */ +#define FTS_LOGICAL 0x002 /* logical walk */ +#define FTS_NOCHDIR 0x004 /* don't change directories */ +#define FTS_NOSTAT 0x008 /* don't get stat info */ +#define FTS_PHYSICAL 0x010 /* physical walk */ +#define FTS_SEEDOT 0x020 /* return dot and dot-dot */ +#define FTS_XDEV 0x040 /* don't cross devices */ +#if !defined(__HAIKU__) +#define FTS_WHITEOUT 0x080 /* return whiteout information */ +#endif +#define FTS_OPTIONMASK 0x0ff /* valid user option mask */ + +#define FTS_NAMEONLY 0x100 /* (private) child names only */ +#define FTS_STOP 0x200 /* (private) unrecoverable error */ + int fts_options; /* fts_open options, global flags */ + void *fts_clientptr; /* thunk for sort function */ +} FTS; + +typedef struct _ftsent { + struct _ftsent *fts_cycle; /* cycle node */ + struct _ftsent *fts_parent; /* parent directory */ + struct _ftsent *fts_link; /* next file in directory */ + long long fts_number; /* local numeric value */ +#define fts_bignum fts_number /* XXX non-std, should go away */ + void *fts_pointer; /* local address value */ + char *fts_accpath; /* access path */ + char *fts_path; /* root path */ + int fts_errno; /* errno for this node */ + int fts_symfd; /* fd for symlink */ + size_t fts_pathlen; /* strlen(fts_path) */ + size_t fts_namelen; /* strlen(fts_name) */ + + ino_t fts_ino; /* inode */ + dev_t fts_dev; /* device */ + nlink_t fts_nlink; /* link count */ + +#define FTS_ROOTPARENTLEVEL -1 +#define FTS_ROOTLEVEL 0 + long fts_level; /* depth (-1 to N) */ + +#define FTS_D 1 /* preorder directory */ +#define FTS_DC 2 /* directory that causes cycles */ +#define FTS_DEFAULT 3 /* none of the above */ +#define FTS_DNR 4 /* unreadable directory */ +#define FTS_DOT 5 /* dot or dot-dot */ +#define FTS_DP 6 /* postorder directory */ +#define FTS_ERR 7 /* error; errno is set */ +#define FTS_F 8 /* regular file */ +#define FTS_INIT 9 /* initialized only */ +#define FTS_NS 10 /* stat(2) failed */ +#define FTS_NSOK 11 /* no stat(2) requested */ +#define FTS_SL 12 /* symbolic link */ +#define FTS_SLNONE 13 /* symbolic link without target */ +#define FTS_W 14 /* whiteout object */ + int fts_info; /* user status for FTSENT structure */ + +#define FTS_DONTCHDIR 0x01 /* don't chdir .. to the parent */ +#define FTS_SYMFOLLOW 0x02 /* followed a symlink to get here */ +#define FTS_ISW 0x04 /* this is a whiteout object */ + unsigned fts_flags; /* private flags for FTSENT structure */ + +#define FTS_AGAIN 1 /* read node again */ +#define FTS_FOLLOW 2 /* follow symbolic link */ +#define FTS_NOINSTR 3 /* no instructions */ +#define FTS_SKIP 4 /* discard node */ + int fts_instr; /* fts_set() instructions */ + + struct stat *fts_statp; /* stat(2) information */ + char *fts_name; /* file name */ + FTS *fts_fts; /* back pointer to main FTS */ +} FTSENT; + +#include + +__BEGIN_DECLS +FTSENT *fts_children(FTS *, int); +int fts_close(FTS *); +void *fts_get_clientptr(FTS *); +#define fts_get_clientptr(fts) ((fts)->fts_clientptr) +FTS *fts_get_stream(FTSENT *); +#define fts_get_stream(ftsent) ((ftsent)->fts_fts) +FTS *fts_open(char * const *, int, + int (*)(const FTSENT * const *, const FTSENT * const *)); +FTSENT *fts_read(FTS *); +int fts_set(FTS *, FTSENT *, int); +void fts_set_clientptr(FTS *, void *); +__END_DECLS + +#endif /* !_FTS_H_ */ diff --git a/headers/posix/ftw.h b/headers/posix/ftw.h new file mode 100644 index 0000000000..a42f74d6f2 --- /dev/null +++ b/headers/posix/ftw.h @@ -0,0 +1,63 @@ +/* $OpenBSD: ftw.h,v 1.1 2003/07/21 21:13:18 millert Exp $ */ + +/* + * Copyright (c) 2003 Todd C. Miller + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Sponsored in part by the Defense Advanced Research Projects + * Agency (DARPA) and Air Force Research Laboratory, Air Force + * Materiel Command, USAF, under agreement number F39502-99-1-0512. + * + * $FreeBSD$ + */ + +#ifndef _FTW_H +#define _FTW_H + +#include +#include +#include + +/* + * Valid flags for the 3rd argument to the function that is passed as the + * second argument to ftw(3) and nftw(3). Say it three times fast! + */ +#define FTW_F 0 /* File. */ +#define FTW_D 1 /* Directory. */ +#define FTW_DNR 2 /* Directory without read permission. */ +#define FTW_DP 3 /* Directory with subdirectories visited. */ +#define FTW_NS 4 /* Unknown type; stat() failed. */ +#define FTW_SL 5 /* Symbolic link. */ +#define FTW_SLN 6 /* Sym link that names a nonexistent file. */ + +/* + * Flags for use as the 4th argument to nftw(3). These may be ORed together. + */ +#define FTW_PHYS 0x01 /* Physical walk, don't follow sym links. */ +#define FTW_MOUNT 0x02 /* The walk does not cross a mount point. */ +#define FTW_DEPTH 0x04 /* Subdirs visited before the dir itself. */ +#define FTW_CHDIR 0x08 /* Change to a directory before reading it. */ + +struct FTW { + int base; + int level; +}; + +__BEGIN_DECLS +int ftw(const char *, int (*)(const char *, const struct stat *, int), int); +int nftw(const char *, int (*)(const char *, const struct stat *, int, + struct FTW *), int, int); +__END_DECLS + +#endif /* !_FTW_H */ diff --git a/headers/private/bluetooth/debug.h b/headers/private/bluetooth/debug.h new file mode 100644 index 0000000000..6b1f8d0362 --- /dev/null +++ b/headers/private/bluetooth/debug.h @@ -0,0 +1,62 @@ +#ifndef _BLUETOOTH_DEBUG_SERVER_H_ +#define _BLUETOOTH_DEBUG_SERVER_H_ + +#ifndef DEBUG + #define DEBUG 3 +#endif + +#include +#include + +#undef TRACE +#undef PRINT +#if DEBUG > 0 + inline void ERROR(const char *fmt, ...) + { + va_list ap; + va_start(ap, fmt); + printf("### ERROR: "); + vprintf(fmt, ap); va_end(ap); + } +/* + inline void PRINT(int level, const char *fmt, ...) + { + va_list ap; + if (level > DEBUG) + return; + va_start(ap, fmt); + vprintf(fmt, ap); + va_end(ap); + } + + inline void PRINT(const char *fmt, ...) + { + va_list ap; + va_start(ap, fmt); + vprintf(fmt, ap); + va_end(ap); + }*/ + + #if DEBUG >= 2 + #define TRACE(a...) printf("TRACE %s : %s\n", __PRETTY_FUNCTION__, a) + #else + #define TRACE(a...) ((void)0) + #endif + + #if DEBUG >= 3 + #define END() printf("ENDING %s\n",__PRETTY_FUNCTION__) + #define CALLED() printf("CALLED %s\n",__PRETTY_FUNCTION__) + #else + #define END() ((void)0) + #define CALLED() ((void)0) + #endif +#else + #define END() ((void)0) + #define CALLED() ((void)0) + #define ERROR(a...) fprintf(stderr, a) + #define TRACE(a...) ((void)0) +#endif + +#define PRINT(l, a...) printf(l, a) + +#endif /* _BLUETOOTH_DEBUG_SERVER_H_ */ diff --git a/src/add-ons/accelerants/radeon_hd/display.cpp b/src/add-ons/accelerants/radeon_hd/display.cpp index d09bd8f58d..7b212ee090 100644 --- a/src/add-ons/accelerants/radeon_hd/display.cpp +++ b/src/add-ons/accelerants/radeon_hd/display.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2006-2011, Haiku, Inc. All Rights Reserved. + * Copyright 2006-2013, Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. * * Authors: @@ -21,6 +21,7 @@ #include "accelerant_protos.h" #include "bios.h" #include "connector.h" +#include "displayport.h" #include "encoder.h" @@ -225,8 +226,7 @@ detect_crt_ranges(uint32 crtid) edid1_detailed_monitor* monitor = &edid->detailed_monitor[index]; - if (monitor->monitor_desc_type - == EDID1_MONITOR_RANGES) { + if (monitor->monitor_desc_type == EDID1_MONITOR_RANGES) { edid1_monitor_range range = monitor->data.monitor_range; gDisplay[crtid]->vfreqMin = range.min_v; /* in Hz */ gDisplay[crtid]->vfreqMax = range.max_v; @@ -258,11 +258,24 @@ detect_displays() continue; if (gConnector[id]->type == VIDEO_CONNECTOR_9DIN) { - TRACE("%s: Skipping 9DIN connector (not yet supported)\n", - __func__); + TRACE("%s: connector(%" B_PRIu32 "): Skipping 9DIN connector " + "(not yet supported)\n", __func__, id); continue; } + if (gConnector[id]->type == VIDEO_CONNECTOR_DP) { + edid1_info* edid = &gDisplay[displayIndex]->edidData; + + TRACE("%s: connector(%" B_PRIu32 "): Checking DP.\n", __func__, id); + status_t dpHasEDID = ddc2_dp_read_edid1(id, edid); + gDisplay[displayIndex]->attached + = (dpHasEDID == B_OK ? true : false); + if (gDisplay[displayIndex]->attached) { + TRACE("%s: connector(%" B_PRIu32 "): Found DisplayPort EDID!\n", + __func__); + } + } + // TODO: As DP aux transactions don't work yet, just use LVDS as a hack #if 0 if (gConnector[id]->encoderExternal.isDPBridge == true) { @@ -276,17 +289,22 @@ detect_displays() // TODO: DDC Router switching for DisplayPort (and others?) } else if (gConnector[id]->type == VIDEO_CONNECTOR_LVDS) { #endif - if (gConnector[id]->type == VIDEO_CONNECTOR_LVDS) { + + if (gDisplay[displayIndex]->attached == false + && gConnector[id]->type == VIDEO_CONNECTOR_LVDS) { // If plain (non-DP) laptop LVDS, read mode info from AtomBIOS //TRACE("%s: non-DP laptop LVDS detected\n", __func__); - gDisplay[displayIndex]->attached - = connector_read_mode_lvds(id, - &gDisplay[displayIndex]->preferredMode); + gDisplay[displayIndex]->attached = connector_read_mode_lvds(id, + &gDisplay[displayIndex]->preferredMode); + if (gDisplay[displayIndex]->attached) { + TRACE("%s: connector(%" B_PRIu32 "): found LVDS preferred " + "mode\n", __func__, id); + } } // If no display found yet, try more standard detection methods if (gDisplay[displayIndex]->attached == false) { - TRACE("%s: bit-banging ddc for EDID on connector %" B_PRIu32 "\n", + TRACE("%s: connector(%" B_PRIu32 "): bit-banging ddc for EDID.\n", __func__, id); // Lets try bit-banging edid from connector @@ -299,7 +317,7 @@ detect_displays() // Found EDID data? if (gDisplay[displayIndex]->attached) { - TRACE("%s: found EDID data on connector %" B_PRIu32 "\n", + TRACE("%s: connector(%" B_PRIu32 "): found EDID data.\n", __func__, id); bool analogEncoder @@ -309,20 +327,20 @@ detect_displays() edid1_info* edid = &gDisplay[displayIndex]->edidData; if (!edid->display.input_type && analogEncoder) { // If non-digital EDID + the encoder is analog... - TRACE("%s: connector %" B_PRIu32 " has non-digital EDID " + TRACE("%s: connector(%" B_PRIu32 "): has non-digital EDID " "and a analog encoder.\n", __func__, id); gDisplay[displayIndex]->attached = encoder_analog_load_detect(id); } else if (edid->display.input_type && !analogEncoder) { // If EDID is digital, we make an assumption here. - TRACE("%s: connector %" B_PRIu32 " has digital EDID " + TRACE("%s: connector(%" B_PRIu32 "): has digital EDID " "and is not a analog encoder.\n", __func__, id); } else { // This generally means the monitor is of poor design // Since we *know* there is no load on the analog encoder // we assume that it is a digital display. - TRACE("%s: Warning: monitor on connector %" B_PRIu32 " has " - "false digital EDID flag and unloaded analog encoder!\n", + TRACE("%s: connector(%" B_PRIu32 "): Warning: monitor has " + "false digital EDID flag + unloaded analog encoder!\n", __func__, id); } } diff --git a/src/add-ons/accelerants/radeon_hd/displayport.cpp b/src/add-ons/accelerants/radeon_hd/displayport.cpp index 2aff239213..3acd66d267 100644 --- a/src/add-ons/accelerants/radeon_hd/displayport.cpp +++ b/src/add-ons/accelerants/radeon_hd/displayport.cpp @@ -1,9 +1,10 @@ /* - * Copyright 2011, Haiku, Inc. All Rights Reserved. + * Copyright 2011-2013, Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. * * Authors: * Alexander von Gluck IV, kallisti5@unixzen.com + * Bill Randle, billr@neocat.org */ @@ -178,14 +179,14 @@ dpcd_reg_read(uint32 hwPin, uint16 address) status_t -dp_aux_get_i2c_byte(uint32 hwPin, uint16 address, uint8* data, bool end) +dp_aux_get_i2c_byte(uint32 hwPin, uint16 address, uint8* data, bool start, bool stop) { uint8 auxMessage[5]; int auxMessageBytes = 4; // 4 for read /* Set up the command byte */ auxMessage[2] = AUX_I2C_READ << 4; - if (end == false) + if (stop == false) auxMessage[2] |= AUX_I2C_MOT << 4; auxMessage[0] = address; @@ -193,6 +194,12 @@ dp_aux_get_i2c_byte(uint32 hwPin, uint16 address, uint8* data, bool end) auxMessage[3] = auxMessageBytes << 4; + /* special case for sending the START or STOP */ + if (start || stop) { + auxMessage[3] = 3 << 4; + auxMessageBytes = 4; + } + int retry; for (retry = 0; retry < 4; retry++) { uint8 ack; @@ -249,14 +256,14 @@ dp_aux_get_i2c_byte(uint32 hwPin, uint16 address, uint8* data, bool end) status_t -dp_aux_set_i2c_byte(uint32 hwPin, uint16 address, uint8* data, bool end) +dp_aux_set_i2c_byte(uint32 hwPin, uint16 address, uint8* data, bool start, bool stop) { uint8 auxMessage[5]; int auxMessageBytes = 5; // 5 for write /* Set up the command byte */ auxMessage[2] = AUX_I2C_WRITE << 4; - if (end == false) + if (stop == false) auxMessage[2] |= AUX_I2C_MOT << 4; auxMessage[0] = address; @@ -265,6 +272,12 @@ dp_aux_set_i2c_byte(uint32 hwPin, uint16 address, uint8* data, bool end) auxMessage[3] = auxMessageBytes << 4; auxMessage[4] = *data; + /* special case for sending the START or STOP */ + if (start || stop) { + auxMessage[3] = 3 << 4; + auxMessageBytes = 4; + } + int retry; for (retry = 0; retry < 4; retry++) { uint8 ack; @@ -328,7 +341,7 @@ dp_get_lane_count(uint32 connectorIndex, display_mode* mode) size_t pixelChunk; size_t pixelsPerChunk; - status_t result = get_pixel_size_for((color_space)mode->space, &pixelChunk, + status_t result = dp_get_pixel_size_for((color_space)mode->space, &pixelChunk, NULL, &pixelsPerChunk); if (result != B_OK) { @@ -367,7 +380,7 @@ dp_get_link_rate(uint32 connectorIndex, display_mode* mode) size_t pixelChunk; size_t pixelsPerChunk; - status_t result = get_pixel_size_for((color_space)mode->space, &pixelChunk, + status_t result = dp_get_pixel_size_for((color_space)mode->space, &pixelChunk, NULL, &pixelsPerChunk); if (result != B_OK) { @@ -859,6 +872,74 @@ dp_link_train(uint32 connectorIndex, display_mode* mode) } +status_t +ddc2_dp_read_edid1(uint32 connectorIndex, edid1_info* edid) +{ + TRACE("%s\n", __func__); + + dp_info* dpInfo = &gConnector[connectorIndex]->dpInfo; + + if (!dpInfo->valid) + return B_ERROR; + + edid1_raw raw; + uint8* rdata = (uint8_t*)&raw; + uint8 sdata = 0; + + // The following sequence is from a trace of the Linux kernel + // radeon code; not sure if the initial writes to address 0 are + // requried. + dp_aux_set_i2c_byte(dpInfo->auxPin, 0x00, &sdata, true, false); + dp_aux_set_i2c_byte(dpInfo->auxPin, 0x00, &sdata, false, true); + + dp_aux_set_i2c_byte(dpInfo->auxPin, 0x50, &sdata, true, false); + dp_aux_set_i2c_byte(dpInfo->auxPin, 0x50, &sdata, false, false); + dp_aux_get_i2c_byte(dpInfo->auxPin, 0x50, rdata, true, false); + dp_aux_get_i2c_byte(dpInfo->auxPin, 0x50, rdata, false, false); + dp_aux_get_i2c_byte(dpInfo->auxPin, 0x50, rdata, false, true); + dp_aux_set_i2c_byte(dpInfo->auxPin, 0x50, &sdata, true, false); + dp_aux_set_i2c_byte(dpInfo->auxPin, 0x50, &sdata, false, false); + dp_aux_get_i2c_byte(dpInfo->auxPin, 0x50, rdata, true, false); + + for (uint32 i = 0; i < sizeof(raw); i++) { + status_t result = dp_aux_get_i2c_byte(dpInfo->auxPin, 0x50, rdata++, + false, false); + if (result) { + ERROR("%s: error reading EDID data at index %" B_PRIu32 "\n", + __func__, i); + dp_aux_get_i2c_byte(dpInfo->auxPin, 0x50, &sdata, false, true); + return B_ERROR; + } + } + dp_aux_get_i2c_byte(dpInfo->auxPin, 0x50, &sdata, false, true); + + if (raw.version.version != 1 || raw.version.revision > 4) { + ERROR("%s: EDID version or revision out of range\n", __func__); + return B_ERROR; + } + + edid_decode(edid, &raw); + + return B_OK; +} + + +status_t +dp_get_pixel_size_for(color_space space, size_t *pixelChunk, + size_t *rowAlignment, size_t *pixelsPerChunk) +{ + status_t result = get_pixel_size_for(space, pixelChunk, NULL, + pixelsPerChunk); + + if ((space == B_RGB32) || (space == B_RGBA32) || (space == B_RGB32_BIG) + || (space == B_RGBA32_BIG)) { + *pixelChunk = 3; + } + + return result; +} + + void debug_dp_info() { diff --git a/src/add-ons/accelerants/radeon_hd/displayport.h b/src/add-ons/accelerants/radeon_hd/displayport.h index fa06dc6e74..ae484d081a 100644 --- a/src/add-ons/accelerants/radeon_hd/displayport.h +++ b/src/add-ons/accelerants/radeon_hd/displayport.h @@ -1,9 +1,10 @@ /* - * Copyright 2011, Haiku, Inc. All Rights Reserved. + * Copyright 2011-2013, Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. * * Authors: * Alexander von Gluck IV, kallisti5@unixzen.com + * Bill Randle, billr@neocat.org */ #ifndef RADEON_HD_DISPLAYPORT_H #define RADEON_HD_DISPLAYPORT_H @@ -30,9 +31,9 @@ int dp_aux_write(uint32 hwPin, uint16 address, uint8* send, int dp_aux_read(uint32 hwPin, uint16 address, uint8* recv, int recvBytes, uint8 delay); status_t dp_aux_set_i2c_byte(uint32 hwPin, uint16 address, - uint8* data, bool end); + uint8* data, bool start, bool stop); status_t dp_aux_get_i2c_byte(uint32 hwPin, uint16 address, - uint8* data, bool end); + uint8* data, bool start, bool stop); uint32 dp_get_link_rate(uint32 connectorIndex, display_mode* mode); uint32 dp_get_lane_count(uint32 connectorIndex, display_mode* mode); @@ -45,4 +46,9 @@ status_t dp_link_train_ce(uint32 connectorIndex); void debug_dp_info(); -#endif /* RADEON_HD_DISPLAYPORT_H */ +status_t dp_get_pixel_size_for(color_space space, size_t *pixelChunk, + size_t *rowAlignment, size_t *pixelsPerChunk); +status_t ddc2_dp_read_edid1(uint32 connectorIndex, edid1_info *edid); + + +#endif /* RADEON_HD_DISPLAYPORT_H */ \ No newline at end of file diff --git a/src/add-ons/kernel/drivers/network/3com/dev/mii/bmtphy.c b/src/add-ons/kernel/drivers/network/3com/dev/mii/bmtphy.c index ba4b509866..81c2bd2ae1 100644 --- a/src/add-ons/kernel/drivers/network/3com/dev/mii/bmtphy.c +++ b/src/add-ons/kernel/drivers/network/3com/dev/mii/bmtphy.c @@ -56,7 +56,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/mii/bmtphy.c,v 1.12.10.8.2.1 2010/12/21 17:09:25 kensmith Exp $"); +__FBSDID("$FreeBSD$"); /* * Driver for the Broadcom BCM5201/BCM5202 "Mini-Theta" PHYs. This also @@ -91,8 +91,7 @@ static device_method_t bmtphy_methods[] = { DEVMETHOD(device_attach, bmtphy_attach), DEVMETHOD(device_detach, mii_phy_detach), DEVMETHOD(device_shutdown, bus_generic_shutdown), - - { 0, 0 } + DEVMETHOD_END }; static devclass_t bmtphy_devclass; diff --git a/src/add-ons/kernel/drivers/network/3com/dev/mii/bmtphyreg.h b/src/add-ons/kernel/drivers/network/3com/dev/mii/bmtphyreg.h index 45ad8e75ef..6aa141deb4 100644 --- a/src/add-ons/kernel/drivers/network/3com/dev/mii/bmtphyreg.h +++ b/src/add-ons/kernel/drivers/network/3com/dev/mii/bmtphyreg.h @@ -28,7 +28,7 @@ * * from NetBSD: bmtphyreg.h,v 1.1 2001/06/02 21:42:10 thorpej Exp * - * $FreeBSD: src/sys/dev/mii/bmtphyreg.h,v 1.2.22.2.2.1 2010/12/21 17:09:25 kensmith Exp $ + * $FreeBSD$ */ #ifndef _DEV_MII_BMTPHYREG_H_ diff --git a/src/add-ons/kernel/drivers/network/3com/dev/mii/ukphy.c b/src/add-ons/kernel/drivers/network/3com/dev/mii/ukphy.c index 4ecfce29d3..9d52eb580c 100644 --- a/src/add-ons/kernel/drivers/network/3com/dev/mii/ukphy.c +++ b/src/add-ons/kernel/drivers/network/3com/dev/mii/ukphy.c @@ -55,7 +55,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/mii/ukphy.c,v 1.20.10.6.2.1 2010/12/21 17:09:25 kensmith Exp $"); +__FBSDID("$FreeBSD$"); /* * driver for generic unknown PHYs @@ -86,7 +86,7 @@ static device_method_t ukphy_methods[] = { DEVMETHOD(device_attach, ukphy_attach), DEVMETHOD(device_detach, mii_phy_detach), DEVMETHOD(device_shutdown, bus_generic_shutdown), - { 0, 0 } + DEVMETHOD_END }; static devclass_t ukphy_devclass; diff --git a/src/add-ons/kernel/drivers/network/3com/dev/mii/ukphy_subr.c b/src/add-ons/kernel/drivers/network/3com/dev/mii/ukphy_subr.c index 73007e197b..5f2f6341ba 100644 --- a/src/add-ons/kernel/drivers/network/3com/dev/mii/ukphy_subr.c +++ b/src/add-ons/kernel/drivers/network/3com/dev/mii/ukphy_subr.c @@ -31,7 +31,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/mii/ukphy_subr.c,v 1.10.2.4.2.1 2010/12/21 17:09:25 kensmith Exp $"); +__FBSDID("$FreeBSD$"); /* * Subroutines shared by the ukphy driver and other PHY drivers. diff --git a/src/add-ons/kernel/drivers/network/3com/dev/xl/if_xl.c b/src/add-ons/kernel/drivers/network/3com/dev/xl/if_xl.c index 77b4c43220..989c5a731e 100644 --- a/src/add-ons/kernel/drivers/network/3com/dev/xl/if_xl.c +++ b/src/add-ons/kernel/drivers/network/3com/dev/xl/if_xl.c @@ -31,7 +31,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/xl/if_xl.c,v 1.8.2.7.2.1 2010/12/21 17:09:25 kensmith Exp $"); +__FBSDID("$FreeBSD$"); /* * 3Com 3c90x Etherlink XL PCI NIC driver @@ -310,17 +310,13 @@ static device_method_t xl_methods[] = { DEVMETHOD(device_suspend, xl_suspend), DEVMETHOD(device_resume, xl_resume), - /* bus interface */ - DEVMETHOD(bus_print_child, bus_generic_print_child), - DEVMETHOD(bus_driver_added, bus_generic_driver_added), - /* MII interface */ DEVMETHOD(miibus_readreg, xl_miibus_readreg), DEVMETHOD(miibus_writereg, xl_miibus_writereg), DEVMETHOD(miibus_statchg, xl_miibus_statchg), DEVMETHOD(miibus_mediainit, xl_miibus_mediainit), - { 0, 0 } + DEVMETHOD_END }; static driver_t xl_driver = { @@ -331,8 +327,9 @@ static driver_t xl_driver = { static devclass_t xl_devclass; -DRIVER_MODULE(xl, pci, xl_driver, xl_devclass, 0, 0); -DRIVER_MODULE(miibus, xl, miibus_driver, miibus_devclass, 0, 0); +DRIVER_MODULE_ORDERED(xl, pci, xl_driver, xl_devclass, NULL, NULL, + SI_ORDER_ANY); +DRIVER_MODULE(miibus, xl, miibus_driver, miibus_devclass, NULL, NULL); static void xl_dma_map_addr(void *arg, bus_dma_segment_t *segs, int nseg, int error) @@ -2185,12 +2182,9 @@ xl_intr(void *arg) #endif if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) break; - if (status & XL_STAT_UP_COMPLETE) { - int curpkts; - curpkts = ifp->if_ipackets; - xl_rxeof(sc); - if (curpkts == ifp->if_ipackets) { + if (status & XL_STAT_UP_COMPLETE) { + if (xl_rxeof(sc) == 0) { while (xl_rx_resync(sc)) xl_rxeof(sc); } @@ -2226,7 +2220,7 @@ xl_intr(void *arg) } if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd) && - ifp->if_drv_flags & IFF_DRV_RUNNING) { + ifp->if_drv_flags & IFF_DRV_RUNNING) { if (sc->xl_type == XL_TYPE_905B) xl_start_90xB_locked(ifp); else diff --git a/src/add-ons/kernel/drivers/network/3com/dev/xl/if_xlreg.h b/src/add-ons/kernel/drivers/network/3com/dev/xl/if_xlreg.h index cd1df20104..17457beefc 100644 --- a/src/add-ons/kernel/drivers/network/3com/dev/xl/if_xlreg.h +++ b/src/add-ons/kernel/drivers/network/3com/dev/xl/if_xlreg.h @@ -29,7 +29,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/sys/dev/xl/if_xlreg.h,v 1.1.2.2.2.1 2010/12/21 17:09:25 kensmith Exp $ + * $FreeBSD$ */ #define XL_EE_READ 0x0080 /* read, 5 bit address */ diff --git a/src/add-ons/kernel/drivers/network/3com/dev/xl/xlphy.c b/src/add-ons/kernel/drivers/network/3com/dev/xl/xlphy.c index e5ac9fce4b..2fe9e0d905 100644 --- a/src/add-ons/kernel/drivers/network/3com/dev/xl/xlphy.c +++ b/src/add-ons/kernel/drivers/network/3com/dev/xl/xlphy.c @@ -86,7 +86,7 @@ static device_method_t xlphy_methods[] = { DEVMETHOD(device_attach, xlphy_attach), DEVMETHOD(device_detach, mii_phy_detach), DEVMETHOD(device_shutdown, bus_generic_shutdown), - { 0, 0 } + DEVMETHOD_END }; static devclass_t xlphy_devclass; diff --git a/src/add-ons/kernel/drivers/network/Jamfile b/src/add-ons/kernel/drivers/network/Jamfile index 5dadc90165..2940c7eb1e 100644 --- a/src/add-ons/kernel/drivers/network/Jamfile +++ b/src/add-ons/kernel/drivers/network/Jamfile @@ -34,6 +34,7 @@ SubInclude HAIKU_TOP src add-ons kernel drivers network dec21xxx ; SubInclude HAIKU_TOP src add-ons kernel drivers network ipro100 ; SubInclude HAIKU_TOP src add-ons kernel drivers network ipro1000 ; SubInclude HAIKU_TOP src add-ons kernel drivers network jmicron2x0 ; +SubInclude HAIKU_TOP src add-ons kernel drivers network rdc ; SubInclude HAIKU_TOP src add-ons kernel drivers network rtl8139 ; SubInclude HAIKU_TOP src add-ons kernel drivers network vt612x ; diff --git a/src/add-ons/kernel/drivers/network/ar81xx/dev/ale/if_ale.c b/src/add-ons/kernel/drivers/network/ar81xx/dev/ale/if_ale.c index 9c3dfd99e1..78c0b4eeaa 100644 --- a/src/add-ons/kernel/drivers/network/ar81xx/dev/ale/if_ale.c +++ b/src/add-ons/kernel/drivers/network/ar81xx/dev/ale/if_ale.c @@ -91,11 +91,11 @@ TUNABLE_INT("hw.ale.msix_disable", &msix_disable); /* * Devices supported by this driver. */ -static struct ale_dev { +static const struct ale_dev { uint16_t ale_vendorid; uint16_t ale_deviceid; const char *ale_name; -} ale_devs[] = { +} const ale_devs[] = { { VENDORID_ATHEROS, DEVICEID_ATHEROS_AR81XX, "Atheros AR8121/AR8113/AR8114 PCIe Ethernet" }, }; @@ -115,7 +115,6 @@ static void ale_init_tx_ring(struct ale_softc *); static void ale_int_task(void *, int); static int ale_intr(void *); static int ale_ioctl(struct ifnet *, u_long, caddr_t); -static void ale_link_task(void *, int); static void ale_mac_config(struct ale_softc *); static int ale_miibus_readreg(device_t, int, int); static void ale_miibus_statchg(device_t); @@ -164,7 +163,7 @@ static device_method_t ale_methods[] = { DEVMETHOD(miibus_writereg, ale_miibus_writereg), DEVMETHOD(miibus_statchg, ale_miibus_statchg), - { NULL, NULL } + DEVMETHOD_END }; static driver_t ale_driver = { @@ -175,8 +174,8 @@ static driver_t ale_driver = { static devclass_t ale_devclass; -DRIVER_MODULE(ale, pci, ale_driver, ale_devclass, 0, 0); -DRIVER_MODULE(miibus, ale, miibus_driver, miibus_devclass, 0, 0); +DRIVER_MODULE(ale, pci, ale_driver, ale_devclass, NULL, NULL); +DRIVER_MODULE(miibus, ale, miibus_driver, miibus_devclass, NULL, NULL); static struct resource_spec ale_res_spec_mem[] = { { SYS_RES_MEMORY, PCIR_BAR(0), RF_ACTIVE }, @@ -253,10 +252,45 @@ static void ale_miibus_statchg(device_t dev) { struct ale_softc *sc; + struct mii_data *mii; + struct ifnet *ifp; + uint32_t reg; sc = device_get_softc(dev); + mii = device_get_softc(sc->ale_miibus); + ifp = sc->ale_ifp; + if (mii == NULL || ifp == NULL || + (ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) + return; - taskqueue_enqueue(taskqueue_swi, &sc->ale_link_task); + sc->ale_flags &= ~ALE_FLAG_LINK; + if ((mii->mii_media_status & (IFM_ACTIVE | IFM_AVALID)) == + (IFM_ACTIVE | IFM_AVALID)) { + switch (IFM_SUBTYPE(mii->mii_media_active)) { + case IFM_10_T: + case IFM_100_TX: + sc->ale_flags |= ALE_FLAG_LINK; + break; + case IFM_1000_T: + if ((sc->ale_flags & ALE_FLAG_FASTETHER) == 0) + sc->ale_flags |= ALE_FLAG_LINK; + break; + default: + break; + } + } + + /* Stop Rx/Tx MACs. */ + ale_stop_mac(sc); + + /* Program MACs with resolved speed/duplex/flow-control. */ + if ((sc->ale_flags & ALE_FLAG_LINK) != 0) { + ale_mac_config(sc); + /* Reenable Tx/Rx MACs. */ + reg = CSR_READ_4(sc, ALE_MAC_CFG); + reg |= MAC_CFG_TX_ENB | MAC_CFG_RX_ENB; + CSR_WRITE_4(sc, ALE_MAC_CFG, reg); + } } static void @@ -267,12 +301,16 @@ ale_mediastatus(struct ifnet *ifp, struct ifmediareq *ifmr) sc = ifp->if_softc; ALE_LOCK(sc); + if ((ifp->if_flags & IFF_UP) == 0) { + ALE_UNLOCK(sc); + return; + } mii = device_get_softc(sc->ale_miibus); mii_pollstat(mii); - ALE_UNLOCK(sc); ifmr->ifm_status = mii->mii_media_status; ifmr->ifm_active = mii->mii_media_active; + ALE_UNLOCK(sc); } static int @@ -297,7 +335,7 @@ ale_mediachange(struct ifnet *ifp) static int ale_probe(device_t dev) { - struct ale_dev *sp; + const struct ale_dev *sp; int i; uint16_t vendor, devid; @@ -414,7 +452,7 @@ ale_attach(device_t dev) struct ale_softc *sc; struct ifnet *ifp; uint16_t burst; - int error, i, msic, msixc; + int error, i, msic, msixc, pmc; uint32_t rxf_len, txf_len; error = 0; @@ -425,7 +463,6 @@ ale_attach(device_t dev) MTX_DEF); callout_init_mtx(&sc->ale_tick_ch, &sc->ale_mtx, 0); TASK_INIT(&sc->ale_int_task, 0, ale_int_task, sc); - TASK_INIT(&sc->ale_link_task, 0, ale_link_task, sc); /* Map the device. */ pci_enable_busmaster(dev); @@ -589,18 +626,16 @@ ale_attach(device_t dev) IFQ_SET_READY(&ifp->if_snd); ifp->if_capabilities = IFCAP_RXCSUM | IFCAP_TXCSUM | IFCAP_TSO4; ifp->if_hwassist = ALE_CSUM_FEATURES | CSUM_TSO; -#ifdef ENABLE_WOL if (pci_find_cap(dev, PCIY_PMG, &pmc) == 0) { sc->ale_flags |= ALE_FLAG_PMCAP; ifp->if_capabilities |= IFCAP_WOL_MAGIC | IFCAP_WOL_MCAST; } -#endif ifp->if_capenable = ifp->if_capabilities; /* Set up MII bus. */ error = mii_attach(dev, &sc->ale_miibus, ifp, ale_mediachange, ale_mediastatus, BMSR_DEFCAPMASK, sc->ale_phyaddr, MII_OFFSET_ANY, - 0); + MIIF_DOPAUSE); if (error != 0) { device_printf(dev, "attaching PHYs failed\n"); goto fail; @@ -681,7 +716,6 @@ ale_detach(device_t dev) ALE_UNLOCK(sc); callout_drain(&sc->ale_tick_ch); taskqueue_drain(sc->ale_tq, &sc->ale_int_task); - taskqueue_drain(taskqueue_swi, &sc->ale_link_task); } if (sc->ale_tq != NULL) { @@ -1399,7 +1433,6 @@ ale_shutdown(device_t dev) static void ale_setlinkspeed(struct ale_softc *sc) { -#ifdef ENABLE_WOL struct mii_data *mii; int aneg, i; @@ -1458,13 +1491,11 @@ ale_setlinkspeed(struct ale_softc *sc) mii->mii_media_status = IFM_AVALID | IFM_ACTIVE; mii->mii_media_active = IFM_ETHER | IFM_100_TX | IFM_FDX; ale_mac_config(sc); -#endif } static void ale_setwol(struct ale_softc *sc) { -#ifdef ENABLE_WOL struct ifnet *ifp; uint32_t reg, pmcs; uint16_t pmstat; @@ -1523,7 +1554,6 @@ ale_setwol(struct ale_softc *sc) if ((ifp->if_capenable & IFCAP_WOL) != 0) pmstat |= PCIM_PSTAT_PME | PCIM_PSTAT_PMEENABLE; pci_write_config(sc->ale_dev, pmc + PCIR_POWER_STATUS, pmstat, 2); -#endif } static int @@ -2017,14 +2047,12 @@ ale_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) ifp->if_hwassist &= ~CSUM_TSO; } -#ifdef ENABLE_WOL if ((mask & IFCAP_WOL_MCAST) != 0 && (ifp->if_capabilities & IFCAP_WOL_MCAST) != 0) ifp->if_capenable ^= IFCAP_WOL_MCAST; if ((mask & IFCAP_WOL_MAGIC) != 0 && (ifp->if_capabilities & IFCAP_WOL_MAGIC) != 0) ifp->if_capenable ^= IFCAP_WOL_MAGIC; -#endif if ((mask & IFCAP_VLAN_HWCSUM) != 0 && (ifp->if_capabilities & IFCAP_VLAN_HWCSUM) != 0) ifp->if_capenable ^= IFCAP_VLAN_HWCSUM; @@ -2073,67 +2101,14 @@ ale_mac_config(struct ale_softc *sc) } if ((IFM_OPTIONS(mii->mii_media_active) & IFM_FDX) != 0) { reg |= MAC_CFG_FULL_DUPLEX; -#ifdef notyet if ((IFM_OPTIONS(mii->mii_media_active) & IFM_ETH_TXPAUSE) != 0) reg |= MAC_CFG_TX_FC; if ((IFM_OPTIONS(mii->mii_media_active) & IFM_ETH_RXPAUSE) != 0) reg |= MAC_CFG_RX_FC; -#endif } CSR_WRITE_4(sc, ALE_MAC_CFG, reg); } -static void -ale_link_task(void *arg, int pending) -{ - struct ale_softc *sc; - struct mii_data *mii; - struct ifnet *ifp; - uint32_t reg; - - sc = (struct ale_softc *)arg; - - ALE_LOCK(sc); - mii = device_get_softc(sc->ale_miibus); - ifp = sc->ale_ifp; - if (mii == NULL || ifp == NULL || - (ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) { - ALE_UNLOCK(sc); - return; - } - - sc->ale_flags &= ~ALE_FLAG_LINK; - if ((mii->mii_media_status & (IFM_ACTIVE | IFM_AVALID)) == - (IFM_ACTIVE | IFM_AVALID)) { - switch (IFM_SUBTYPE(mii->mii_media_active)) { - case IFM_10_T: - case IFM_100_TX: - sc->ale_flags |= ALE_FLAG_LINK; - break; - case IFM_1000_T: - if ((sc->ale_flags & ALE_FLAG_FASTETHER) == 0) - sc->ale_flags |= ALE_FLAG_LINK; - break; - default: - break; - } - } - - /* Stop Rx/Tx MACs. */ - ale_stop_mac(sc); - - /* Program MACs with resolved speed/duplex/flow-control. */ - if ((sc->ale_flags & ALE_FLAG_LINK) != 0) { - ale_mac_config(sc); - /* Reenable Tx/Rx MACs. */ - reg = CSR_READ_4(sc, ALE_MAC_CFG); - reg |= MAC_CFG_TX_ENB | MAC_CFG_RX_ENB; - CSR_WRITE_4(sc, ALE_MAC_CFG, reg); - } - - ALE_UNLOCK(sc); -} - static void ale_stats_clear(struct ale_softc *sc) { @@ -2821,7 +2796,7 @@ ale_init_locked(struct ale_softc *sc) ((rxf_lo << RX_FIFO_PAUSE_THRESH_LO_SHIFT) & RX_FIFO_PAUSE_THRESH_LO_MASK) | ((rxf_hi << RX_FIFO_PAUSE_THRESH_HI_SHIFT) & - RX_FIFO_PAUSE_THRESH_HI_MASK)); + RX_FIFO_PAUSE_THRESH_HI_MASK)); } /* Disable RSS. */ @@ -2884,14 +2859,14 @@ ale_init_locked(struct ale_softc *sc) CSR_WRITE_4(sc, ALE_INTR_STATUS, 0xFFFFFFFF); CSR_WRITE_4(sc, ALE_INTR_STATUS, 0); + ifp->if_drv_flags |= IFF_DRV_RUNNING; + ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; + sc->ale_flags &= ~ALE_FLAG_LINK; /* Switch to the current media. */ mii_mediachg(mii); callout_reset(&sc->ale_tick_ch, hz, ale_tick, sc); - - ifp->if_drv_flags |= IFF_DRV_RUNNING; - ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; } static void diff --git a/src/add-ons/kernel/drivers/network/ar81xx/dev/ale/if_alevar.h b/src/add-ons/kernel/drivers/network/ar81xx/dev/ale/if_alevar.h index dcf48d6aa1..abf2d2e39a 100644 --- a/src/add-ons/kernel/drivers/network/ar81xx/dev/ale/if_alevar.h +++ b/src/add-ons/kernel/drivers/network/ar81xx/dev/ale/if_alevar.h @@ -221,7 +221,6 @@ struct ale_softc { int ale_pagesize; struct task ale_int_task; - struct task ale_link_task; struct taskqueue *ale_tq; struct mtx ale_mtx; }; diff --git a/src/add-ons/kernel/drivers/network/ar81xx/dev/mii/ukphy.c b/src/add-ons/kernel/drivers/network/ar81xx/dev/mii/ukphy.c index fc1cf4d259..9d52eb580c 100644 --- a/src/add-ons/kernel/drivers/network/ar81xx/dev/mii/ukphy.c +++ b/src/add-ons/kernel/drivers/network/ar81xx/dev/mii/ukphy.c @@ -16,13 +16,6 @@ * 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. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the NetBSD - * Foundation, Inc. and its contributors. - * 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED @@ -48,11 +41,6 @@ * 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. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Manuel Bouyer. - * 4. 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 @@ -67,7 +55,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/mii/ukphy.c,v 1.20 2007/01/20 00:52:29 marius Exp $"); +__FBSDID("$FreeBSD$"); /* * driver for generic unknown PHYs @@ -98,7 +86,7 @@ static device_method_t ukphy_methods[] = { DEVMETHOD(device_attach, ukphy_attach), DEVMETHOD(device_detach, mii_phy_detach), DEVMETHOD(device_shutdown, bus_generic_shutdown), - { 0, 0 } + DEVMETHOD_END }; static devclass_t ukphy_devclass; @@ -134,11 +122,9 @@ static int ukphy_attach(device_t dev) { struct mii_softc *sc; - struct mii_attach_args *ma; - struct mii_data *mii; sc = device_get_softc(dev); - + mii_phy_dev_attach(dev, MIIF_NOMANPAUSE, &ukphy_funcs, 1); mii_phy_setmedia(sc); @@ -148,29 +134,12 @@ ukphy_attach(device_t dev) static int ukphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd) { - struct ifmedia_entry *ife = mii->mii_media.ifm_cur; - int reg; switch (cmd) { case MII_POLLSTAT: - /* - * If we're not polling our PHY instance, just return. - */ - if (IFM_INST(ife->ifm_media) != sc->mii_inst) - return (0); break; case MII_MEDIACHG: - /* - * If the media indicates a different PHY instance, - * isolate ourselves. - */ - if (IFM_INST(ife->ifm_media) != sc->mii_inst) { - reg = PHY_READ(sc, MII_BMCR); - PHY_WRITE(sc, MII_BMCR, reg | BMCR_ISO); - return (0); - } - /* * If the interface is not up, don't do anything. */ @@ -181,11 +150,6 @@ ukphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd) break; case MII_TICK: - /* - * If we're not currently selected, just return. - */ - if (IFM_INST(ife->ifm_media) != sc->mii_inst) - return (0); if (mii_phy_tick(sc) == EJUSTRETURN) return (0); break; diff --git a/src/add-ons/kernel/drivers/network/ar81xx/dev/mii/ukphy_subr.c b/src/add-ons/kernel/drivers/network/ar81xx/dev/mii/ukphy_subr.c index fb40b75c1d..5f2f6341ba 100644 --- a/src/add-ons/kernel/drivers/network/ar81xx/dev/mii/ukphy_subr.c +++ b/src/add-ons/kernel/drivers/network/ar81xx/dev/mii/ukphy_subr.c @@ -16,13 +16,6 @@ * 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. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the NetBSD - * Foundation, Inc. and its contributors. - * 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED @@ -38,7 +31,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/mii/ukphy_subr.c,v 1.8.8.1 2006/07/19 04:40:26 yongari Exp $"); +__FBSDID("$FreeBSD$"); /* * Subroutines shared by the ukphy driver and other PHY drivers. @@ -111,19 +104,26 @@ ukphy_status(struct mii_softc *phy) mii->mii_media_active |= IFM_1000_T|IFM_FDX; else if ((gtcr & GTCR_ADV_1000THDX) && (gtsr & GTSR_LP_1000THDX)) - mii->mii_media_active |= IFM_1000_T; - else if (anlpar & ANLPAR_T4) - mii->mii_media_active |= IFM_100_T4; + mii->mii_media_active |= IFM_1000_T|IFM_HDX; else if (anlpar & ANLPAR_TX_FD) mii->mii_media_active |= IFM_100_TX|IFM_FDX; + else if (anlpar & ANLPAR_T4) + mii->mii_media_active |= IFM_100_T4|IFM_HDX; else if (anlpar & ANLPAR_TX) - mii->mii_media_active |= IFM_100_TX; + mii->mii_media_active |= IFM_100_TX|IFM_HDX; else if (anlpar & ANLPAR_10_FD) mii->mii_media_active |= IFM_10_T|IFM_FDX; else if (anlpar & ANLPAR_10) - mii->mii_media_active |= IFM_10_T; + mii->mii_media_active |= IFM_10_T|IFM_HDX; else mii->mii_media_active |= IFM_NONE; + + if ((mii->mii_media_active & IFM_1000_T) != 0 && + (gtsr & GTSR_MS_RES) != 0) + mii->mii_media_active |= IFM_ETH_MASTER; + + if ((mii->mii_media_active & IFM_FDX) != 0) + mii->mii_media_active |= mii_phy_flowstatus(phy); } else mii->mii_media_active = ife->ifm_media; } diff --git a/src/add-ons/kernel/drivers/network/atheros813x/dev/alc/if_alc.c b/src/add-ons/kernel/drivers/network/atheros813x/dev/alc/if_alc.c index c13cb188dc..c73075c6a8 100644 --- a/src/add-ons/kernel/drivers/network/atheros813x/dev/alc/if_alc.c +++ b/src/add-ons/kernel/drivers/network/atheros813x/dev/alc/if_alc.c @@ -349,9 +349,9 @@ alc_mediastatus(struct ifnet *ifp, struct ifmediareq *ifmr) mii = device_get_softc(sc->alc_miibus); mii_pollstat(mii); - ALC_UNLOCK(sc); ifmr->ifm_status = mii->mii_media_status; ifmr->ifm_active = mii->mii_media_active; + ALC_UNLOCK(sc); } static int diff --git a/src/add-ons/kernel/drivers/network/atheros813x/dev/mii/ukphy.c b/src/add-ons/kernel/drivers/network/atheros813x/dev/mii/ukphy.c index 4ecfce29d3..9d52eb580c 100644 --- a/src/add-ons/kernel/drivers/network/atheros813x/dev/mii/ukphy.c +++ b/src/add-ons/kernel/drivers/network/atheros813x/dev/mii/ukphy.c @@ -55,7 +55,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/mii/ukphy.c,v 1.20.10.6.2.1 2010/12/21 17:09:25 kensmith Exp $"); +__FBSDID("$FreeBSD$"); /* * driver for generic unknown PHYs @@ -86,7 +86,7 @@ static device_method_t ukphy_methods[] = { DEVMETHOD(device_attach, ukphy_attach), DEVMETHOD(device_detach, mii_phy_detach), DEVMETHOD(device_shutdown, bus_generic_shutdown), - { 0, 0 } + DEVMETHOD_END }; static devclass_t ukphy_devclass; diff --git a/src/add-ons/kernel/drivers/network/atheros813x/dev/mii/ukphy_subr.c b/src/add-ons/kernel/drivers/network/atheros813x/dev/mii/ukphy_subr.c index 73007e197b..5f2f6341ba 100644 --- a/src/add-ons/kernel/drivers/network/atheros813x/dev/mii/ukphy_subr.c +++ b/src/add-ons/kernel/drivers/network/atheros813x/dev/mii/ukphy_subr.c @@ -31,7 +31,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/mii/ukphy_subr.c,v 1.10.2.4.2.1 2010/12/21 17:09:25 kensmith Exp $"); +__FBSDID("$FreeBSD$"); /* * Subroutines shared by the ukphy driver and other PHY drivers. diff --git a/src/add-ons/kernel/drivers/network/attansic_l1/dev/age/if_age.c b/src/add-ons/kernel/drivers/network/attansic_l1/dev/age/if_age.c index cecc339e2f..f4287b0dd6 100644 --- a/src/add-ons/kernel/drivers/network/attansic_l1/dev/age/if_age.c +++ b/src/add-ons/kernel/drivers/network/attansic_l1/dev/age/if_age.c @@ -282,9 +282,9 @@ age_mediastatus(struct ifnet *ifp, struct ifmediareq *ifmr) mii = device_get_softc(sc->age_miibus); mii_pollstat(mii); - AGE_UNLOCK(sc); ifmr->ifm_status = mii->mii_media_status; ifmr->ifm_active = mii->mii_media_active; + AGE_UNLOCK(sc); } /* @@ -1405,7 +1405,7 @@ age_setwol(struct age_softc *sc) AGE_UNLOCK(sc); #ifdef __HAIKU__ DELAY(1); -#else +#else pause("agelnk", hz); #endif AGE_LOCK(sc); diff --git a/src/add-ons/kernel/drivers/network/attansic_l1/dev/mii/atphy.c b/src/add-ons/kernel/drivers/network/attansic_l1/dev/mii/atphy.c index b5cf14f44f..cca8813a7c 100644 --- a/src/add-ons/kernel/drivers/network/attansic_l1/dev/mii/atphy.c +++ b/src/add-ons/kernel/drivers/network/attansic_l1/dev/mii/atphy.c @@ -59,7 +59,7 @@ static device_method_t atphy_methods[] = { DEVMETHOD(device_attach, atphy_attach), DEVMETHOD(device_detach, mii_phy_detach), DEVMETHOD(device_shutdown, bus_generic_shutdown), - { NULL, NULL } + DEVMETHOD_END }; static devclass_t atphy_devclass; diff --git a/src/add-ons/kernel/drivers/network/attansic_l2/dev/ae/if_ae.c b/src/add-ons/kernel/drivers/network/attansic_l2/dev/ae/if_ae.c index 3ab598abc6..02a1e796f9 100644 --- a/src/add-ons/kernel/drivers/network/attansic_l2/dev/ae/if_ae.c +++ b/src/add-ons/kernel/drivers/network/attansic_l2/dev/ae/if_ae.c @@ -1385,12 +1385,13 @@ ae_pm_init(ae_softc_t *sc) /* * Configure PME. */ - pci_find_cap(sc->dev, PCIY_PMG, &pmc); - pmstat = pci_read_config(sc->dev, pmc + PCIR_POWER_STATUS, 2); - pmstat &= ~(PCIM_PSTAT_PME | PCIM_PSTAT_PMEENABLE); - if ((ifp->if_capenable & IFCAP_WOL) != 0) - pmstat |= PCIM_PSTAT_PME | PCIM_PSTAT_PMEENABLE; - pci_write_config(sc->dev, pmc + PCIR_POWER_STATUS, pmstat, 2); + if (pci_find_cap(sc->dev, PCIY_PMG, &pmc) == 0) { + pmstat = pci_read_config(sc->dev, pmc + PCIR_POWER_STATUS, 2); + pmstat &= ~(PCIM_PSTAT_PME | PCIM_PSTAT_PMEENABLE); + if ((ifp->if_capenable & IFCAP_WOL) != 0) + pmstat |= PCIM_PSTAT_PME | PCIM_PSTAT_PMEENABLE; + pci_write_config(sc->dev, pmc + PCIR_POWER_STATUS, pmstat, 2); + } } static int @@ -1435,7 +1436,7 @@ ae_tx_avail_size(ae_softc_t *sc) else avail = sc->txd_ack - sc->txd_cur; - return (avail - 4); /* 4-byte header. */ + return (avail); } static int @@ -1452,7 +1453,7 @@ ae_encap(ae_softc_t *sc, struct mbuf **m_head) len = m0->m_pkthdr.len; if ((sc->flags & AE_FLAG_TXAVAIL) == 0 || - ae_tx_avail_size(sc) < len) { + len + sizeof(ae_txd_t) + 3 > ae_tx_avail_size(sc)) { #ifdef AE_DEBUG if_printf(sc->ifp, "No free Tx available.\n"); #endif @@ -1461,11 +1462,10 @@ ae_encap(ae_softc_t *sc, struct mbuf **m_head) hdr = (ae_txd_t *)(sc->txd_base + sc->txd_cur); bzero(hdr, sizeof(*hdr)); - sc->txd_cur = (sc->txd_cur + 4) % AE_TXD_BUFSIZE_DEFAULT; /* Header - size. */ - to_end = AE_TXD_BUFSIZE_DEFAULT - sc->txd_cur; /* Space available to - * the end of the ring - */ + /* Skip header size. */ + sc->txd_cur = (sc->txd_cur + sizeof(ae_txd_t)) % AE_TXD_BUFSIZE_DEFAULT; + /* Space available to the end of the ring */ + to_end = AE_TXD_BUFSIZE_DEFAULT - sc->txd_cur; if (to_end >= len) { m_copydata(m0, 0, len, (caddr_t)(sc->txd_base + sc->txd_cur)); } else { @@ -1844,8 +1844,8 @@ ae_tx_intr(ae_softc_t *sc) /* * Move txd ack and align on 4-byte boundary. */ - sc->txd_ack = ((sc->txd_ack + le16toh(txd->len) + 4 + 3) & ~3) % - AE_TXD_BUFSIZE_DEFAULT; + sc->txd_ack = ((sc->txd_ack + le16toh(txd->len) + + sizeof(ae_txs_t) + 3) & ~3) % AE_TXD_BUFSIZE_DEFAULT; if ((flags & AE_TXS_SUCCESS) != 0) ifp->if_opackets++; diff --git a/src/add-ons/kernel/drivers/network/attansic_l2/dev/mii/ukphy.c b/src/add-ons/kernel/drivers/network/attansic_l2/dev/mii/ukphy.c index 4ecfce29d3..9d52eb580c 100644 --- a/src/add-ons/kernel/drivers/network/attansic_l2/dev/mii/ukphy.c +++ b/src/add-ons/kernel/drivers/network/attansic_l2/dev/mii/ukphy.c @@ -55,7 +55,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/mii/ukphy.c,v 1.20.10.6.2.1 2010/12/21 17:09:25 kensmith Exp $"); +__FBSDID("$FreeBSD$"); /* * driver for generic unknown PHYs @@ -86,7 +86,7 @@ static device_method_t ukphy_methods[] = { DEVMETHOD(device_attach, ukphy_attach), DEVMETHOD(device_detach, mii_phy_detach), DEVMETHOD(device_shutdown, bus_generic_shutdown), - { 0, 0 } + DEVMETHOD_END }; static devclass_t ukphy_devclass; diff --git a/src/add-ons/kernel/drivers/network/attansic_l2/dev/mii/ukphy_subr.c b/src/add-ons/kernel/drivers/network/attansic_l2/dev/mii/ukphy_subr.c index 73007e197b..5f2f6341ba 100644 --- a/src/add-ons/kernel/drivers/network/attansic_l2/dev/mii/ukphy_subr.c +++ b/src/add-ons/kernel/drivers/network/attansic_l2/dev/mii/ukphy_subr.c @@ -31,7 +31,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/mii/ukphy_subr.c,v 1.10.2.4.2.1 2010/12/21 17:09:25 kensmith Exp $"); +__FBSDID("$FreeBSD$"); /* * Subroutines shared by the ukphy driver and other PHY drivers. diff --git a/src/add-ons/kernel/drivers/network/broadcom440x/dev/bfe/if_bfe.c b/src/add-ons/kernel/drivers/network/broadcom440x/dev/bfe/if_bfe.c index 7f970f4ac4..6dd33cd591 100644 --- a/src/add-ons/kernel/drivers/network/broadcom440x/dev/bfe/if_bfe.c +++ b/src/add-ons/kernel/drivers/network/broadcom440x/dev/bfe/if_bfe.c @@ -137,16 +137,12 @@ static device_method_t bfe_methods[] = { DEVMETHOD(device_suspend, bfe_suspend), DEVMETHOD(device_resume, bfe_resume), - /* bus interface */ - DEVMETHOD(bus_print_child, bus_generic_print_child), - DEVMETHOD(bus_driver_added, bus_generic_driver_added), - /* MII interface */ DEVMETHOD(miibus_readreg, bfe_miibus_readreg), DEVMETHOD(miibus_writereg, bfe_miibus_writereg), DEVMETHOD(miibus_statchg, bfe_miibus_statchg), - { 0, 0 } + DEVMETHOD_END }; static driver_t bfe_driver = { diff --git a/src/add-ons/kernel/drivers/network/broadcom440x/dev/mii/bmtphy.c b/src/add-ons/kernel/drivers/network/broadcom440x/dev/mii/bmtphy.c index 3f91a61cae..9af56e92da 100644 --- a/src/add-ons/kernel/drivers/network/broadcom440x/dev/mii/bmtphy.c +++ b/src/add-ons/kernel/drivers/network/broadcom440x/dev/mii/bmtphy.c @@ -91,8 +91,7 @@ static device_method_t bmtphy_methods[] = { DEVMETHOD(device_attach, bmtphy_attach), DEVMETHOD(device_detach, mii_phy_detach), DEVMETHOD(device_shutdown, bus_generic_shutdown), - - { 0, 0 } + DEVMETHOD_END }; static devclass_t bmtphy_devclass; diff --git a/src/add-ons/kernel/drivers/network/broadcom570x/dev/bce/if_bcereg.h b/src/add-ons/kernel/drivers/network/broadcom570x/dev/bce/if_bcereg.h index f4215db49b..be206081a2 100644 --- a/src/add-ons/kernel/drivers/network/broadcom570x/dev/bce/if_bcereg.h +++ b/src/add-ons/kernel/drivers/network/broadcom570x/dev/bce/if_bcereg.h @@ -576,7 +576,6 @@ default: DBPRINT(sc, BCE_INSANE_PHY, \ #define BCE_CHIP_NUM_5706 0x57060000 #define BCE_CHIP_NUM_5708 0x57080000 #define BCE_CHIP_NUM_5709 0x57090000 -#define BCE_CHIP_NUM_5716 0x57160000 #define BCE_CHIP_REV(sc) (((sc)->bce_chipid) & 0x0000f000) #define BCE_CHIP_REV_Ax 0x00000000 @@ -601,7 +600,6 @@ default: DBPRINT(sc, BCE_INSANE_PHY, \ #define BCE_CHIP_ID_5709_B1 0x57091010 #define BCE_CHIP_ID_5709_B2 0x57091020 #define BCE_CHIP_ID_5709_C0 0x57092000 -#define BCE_CHIP_ID_5716_C0 0x57162000 #define BCE_CHIP_BOND_ID(sc) (((sc)->bce_chipid) & 0xf) @@ -816,6 +814,23 @@ struct flash_spec { #define BCE_DRV_PULSE_SEQ_MASK 0x00007fff #define BCE_MB_ARGS_0 0x00000014 +#define BCE_NETLINK_SPEED_10HALF (1<<0) +#define BCE_NETLINK_SPEED_10FULL (1<<1) +#define BCE_NETLINK_SPEED_100HALF (1<<2) +#define BCE_NETLINK_SPEED_100FULL (1<<3) +#define BCE_NETLINK_SPEED_1000HALF (1<<4) +#define BCE_NETLINK_SPEED_1000FULL (1<<5) +#define BCE_NETLINK_SPEED_2500HALF (1<<6) +#define BCE_NETLINK_SPEED_2500FULL (1<<7) +#define BCE_NETLINK_SPEED_10GHALF (1<<8) +#define BCE_NETLINK_SPEED_10GFULL (1<<9) +#define BCE_NETLINK_ANEG_ENB (1<<10) +#define BCE_NETLINK_PHY_APP_REMOTE (1<<11) +#define BCE_NETLINK_FC_PAUSE_SYM (1<<12) +#define BCE_NETLINK_FC_PAUSE_ASYM (1<<13) +#define BCE_NETLINK_ETH_AT_WIRESPEED (1<<14) +#define BCE_NETLINK_PHY_RESET (1<<15) + #define BCE_MB_ARGS_1 0x00000018 /* Indicate to the firmware not to go into the @@ -1081,6 +1096,26 @@ struct flash_spec { #define BCE_BC_STATE_BC_DBG_CMD_LOOP_CNT_MASK 0xffff #define BCE_BC_STATE_BC_DBG_CMD_LOOP_INFINITE 0xffff +#define BCE_FW_EVT_CODE_MB 0x00000354 +#define BCE_FW_EVT_CODE_SW_TIMER_EXPIRE_EVENT 0x00000000 +#define BCE_FW_EVT_CODE_LINK_EVENT 0x00000001 + +#define BCE_DRV_ACK_CAP_MB 0x00000364 +#define BCE_DRV_ACK_CAP_SIGNATURE_MAGIC 0x35450000 + +#define BCE_FW_CAP_MB 0x00000368 +#define BCE_FW_CAP_SIGNATURE_MAGIC 0xaa550000 +#define BCE_FW_ACK_SIGNATURE_MAGIC 0x52500000 +#define BCE_FW_CAP_SIGNATURE_MAGIC_MASK 0xffff0000 +#define BCE_FW_CAP_REMOTE_PHY_CAP 0x00000001 +#define BCE_FW_CAP_REMOTE_PHY_PRESENT 0x00000002 +#define BCE_FW_CAP_MFW_KEEP_VLAN 0x00000008 +#define BCE_FW_CAP_BC_KEEP_VLAN 0x00000010 + +#define BCE_RPHY_SERDES_LINK 0x00000374 + +#define BCE_RPHY_COPPER_LINK 0x00000378 + #define HOST_VIEW_SHMEM_BASE 0x167c00 /* @@ -6456,6 +6491,8 @@ struct bce_softc #define BCE_PHY_INT_MODE_AUTO_POLLING_FLAG 0x00000100 #define BCE_PHY_INT_MODE_LINK_READY_FLAG 0x00000200 #define BCE_PHY_IEEE_CLAUSE_45_FLAG 0x00000400 +#define BCE_PHY_REMOTE_CAP_FLAG 0x00000800 +#define BCE_PHY_REMOTE_PORT_FIBER_FLAG 0x00001000 /* Values that need to be shared with the PHY driver. */ u32 bce_shared_hw_cfg; diff --git a/src/add-ons/kernel/drivers/network/broadcom570x/dev/bge/if_bge.c b/src/add-ons/kernel/drivers/network/broadcom570x/dev/bge/if_bge.c index d4567743fd..d635000c52 100644 --- a/src/add-ons/kernel/drivers/network/broadcom570x/dev/bge/if_bge.c +++ b/src/add-ons/kernel/drivers/network/broadcom570x/dev/bge/if_bge.c @@ -301,6 +301,7 @@ static const struct bge_revision { { BGE_CHIPID_BCM5717_A0, "BCM5717 A0" }, { BGE_CHIPID_BCM5717_B0, "BCM5717 B0" }, { BGE_CHIPID_BCM5719_A0, "BCM5719 A0" }, + { BGE_CHIPID_BCM5720_A0, "BCM5720 A0" }, { BGE_CHIPID_BCM5755_A0, "BCM5755 A0" }, { BGE_CHIPID_BCM5755_A1, "BCM5755 A1" }, { BGE_CHIPID_BCM5755_A2, "BCM5755 A2" }, @@ -349,6 +350,7 @@ static const struct bge_revision const bge_majorrevs[] = { { BGE_ASICREV_BCM57780, "unknown BCM57780" }, { BGE_ASICREV_BCM5717, "unknown BCM5717" }, { BGE_ASICREV_BCM5719, "unknown BCM5719" }, + { BGE_ASICREV_BCM5720, "unknown BCM5720" }, { 0, NULL } }; @@ -378,6 +380,9 @@ static void bge_dma_free(struct bge_softc *); static int bge_dma_ring_alloc(struct bge_softc *, bus_size_t, bus_size_t, bus_dma_tag_t *, uint8_t **, bus_dmamap_t *, bus_addr_t *, const char *); +static void bge_devinfo(struct bge_softc *); +static int bge_mbox_reorder(struct bge_softc *); + static int bge_get_eaddr_fw(struct bge_softc *sc, uint8_t ether_addr[]); static int bge_get_eaddr_mem(struct bge_softc *, uint8_t[]); static int bge_get_eaddr_nvram(struct bge_softc *, uint8_t[]); @@ -437,6 +442,7 @@ static int bge_init_tx_ring(struct bge_softc *); static int bge_chipinit(struct bge_softc *); static int bge_blockinit(struct bge_softc *); +static uint32_t bge_dma_swap_options(struct bge_softc *); static int bge_has_eaddr(struct bge_softc *); static uint32_t bge_readmem_ind(struct bge_softc *, int); @@ -492,16 +498,12 @@ static device_method_t bge_methods[] = { DEVMETHOD(device_suspend, bge_suspend), DEVMETHOD(device_resume, bge_resume), - /* bus interface */ - DEVMETHOD(bus_print_child, bus_generic_print_child), - DEVMETHOD(bus_driver_added, bus_generic_driver_added), - /* MII interface */ DEVMETHOD(miibus_readreg, bge_miibus_readreg), DEVMETHOD(miibus_writereg, bge_miibus_writereg), DEVMETHOD(miibus_statchg, bge_miibus_statchg), - { 0, 0 } + DEVMETHOD_END }; static driver_t bge_driver = { @@ -642,6 +644,8 @@ bge_writembx(struct bge_softc *sc, int off, int val) off += BGE_LPMBX_IRQ0_HI - BGE_MBX_IRQ0_HI; CSR_WRITE_4(sc, off, val); + if ((sc->bge_flags & BGE_FLAG_MBOX_REORDER) != 0) + CSR_READ_4(sc, off); } /* @@ -1315,15 +1319,17 @@ bge_sig_pre_reset(struct bge_softc *sc, int type) * Some chips don't like this so only do this if ASF is enabled */ if (sc->bge_asf_mode) - bge_writemem_ind(sc, BGE_SOFTWARE_GENCOMM, BGE_MAGIC_NUMBER); + bge_writemem_ind(sc, BGE_SRAM_FW_MB, BGE_SRAM_FW_MB_MAGIC); if (sc->bge_asf_mode & ASF_NEW_HANDSHAKE) { switch (type) { case BGE_RESET_START: - bge_writemem_ind(sc, BGE_SDI_STATUS, 0x1); /* START */ + bge_writemem_ind(sc, BGE_SRAM_FW_DRV_STATE_MB, + BGE_FW_DRV_STATE_START); break; case BGE_RESET_STOP: - bge_writemem_ind(sc, BGE_SDI_STATUS, 0x2); /* UNLOAD */ + bge_writemem_ind(sc, BGE_SRAM_FW_DRV_STATE_MB, + BGE_FW_DRV_STATE_UNLOAD); break; } } @@ -1336,11 +1342,13 @@ bge_sig_post_reset(struct bge_softc *sc, int type) if (sc->bge_asf_mode & ASF_NEW_HANDSHAKE) { switch (type) { case BGE_RESET_START: - bge_writemem_ind(sc, BGE_SDI_STATUS, 0x80000001); + bge_writemem_ind(sc, BGE_SRAM_FW_DRV_STATE_MB, + BGE_FW_DRV_STATE_START_DONE); /* START DONE */ break; case BGE_RESET_STOP: - bge_writemem_ind(sc, BGE_SDI_STATUS, 0x80000002); + bge_writemem_ind(sc, BGE_SRAM_FW_DRV_STATE_MB, + BGE_FW_DRV_STATE_UNLOAD_DONE); break; } } @@ -1353,10 +1361,12 @@ bge_sig_legacy(struct bge_softc *sc, int type) if (sc->bge_asf_mode) { switch (type) { case BGE_RESET_START: - bge_writemem_ind(sc, BGE_SDI_STATUS, 0x1); /* START */ + bge_writemem_ind(sc, BGE_SRAM_FW_DRV_STATE_MB, + BGE_FW_DRV_STATE_START); break; case BGE_RESET_STOP: - bge_writemem_ind(sc, BGE_SDI_STATUS, 0x2); /* UNLOAD */ + bge_writemem_ind(sc, BGE_SRAM_FW_DRV_STATE_MB, + BGE_FW_DRV_STATE_UNLOAD); break; } } @@ -1368,25 +1378,44 @@ bge_stop_fw(struct bge_softc *sc) int i; if (sc->bge_asf_mode) { - bge_writemem_ind(sc, BGE_SOFTWARE_GENCOMM_FW, BGE_FW_PAUSE); - CSR_WRITE_4(sc, BGE_CPU_EVENT, - CSR_READ_4(sc, BGE_CPU_EVENT) | (1 << 14)); + bge_writemem_ind(sc, BGE_SRAM_FW_CMD_MB, BGE_FW_CMD_PAUSE); + CSR_WRITE_4(sc, BGE_RX_CPU_EVENT, + CSR_READ_4(sc, BGE_RX_CPU_EVENT) | BGE_RX_CPU_DRV_EVENT); for (i = 0; i < 100; i++ ) { - if (!(CSR_READ_4(sc, BGE_CPU_EVENT) & (1 << 14))) + if (!(CSR_READ_4(sc, BGE_RX_CPU_EVENT) & + BGE_RX_CPU_DRV_EVENT)) break; DELAY(10); } } } +static uint32_t +bge_dma_swap_options(struct bge_softc *sc) +{ + uint32_t dma_options; + + dma_options = BGE_MODECTL_WORDSWAP_NONFRAME | + BGE_MODECTL_BYTESWAP_DATA | BGE_MODECTL_WORDSWAP_DATA; +#if BYTE_ORDER == BIG_ENDIAN + dma_options |= BGE_MODECTL_BYTESWAP_NONFRAME; +#endif + if ((sc)->bge_asicrev == BGE_ASICREV_BCM5720) + dma_options |= BGE_MODECTL_BYTESWAP_B2HRX_DATA | + BGE_MODECTL_WORDSWAP_B2HRX_DATA | BGE_MODECTL_B2HRX_ENABLE | + BGE_MODECTL_HTX2B_ENABLE; + + return (dma_options); +} + /* * Do endian, PCI and DMA initialization. */ static int bge_chipinit(struct bge_softc *sc) { - uint32_t dma_rw_ctl, misc_ctl; + uint32_t dma_rw_ctl, misc_ctl, mode_ctl; uint16_t val; int i; @@ -1504,9 +1533,8 @@ bge_chipinit(struct bge_softc *sc) /* * Set up general mode register. */ - CSR_WRITE_4(sc, BGE_MODE_CTL, BGE_DMA_SWAP_OPTIONS | - BGE_MODECTL_MAC_ATTN_INTR | BGE_MODECTL_HOST_SEND_BDS | - BGE_MODECTL_TX_NO_PHDR_CSUM); + mode_ctl = bge_dma_swap_options(sc) | BGE_MODECTL_MAC_ATTN_INTR | + BGE_MODECTL_HOST_SEND_BDS | BGE_MODECTL_TX_NO_PHDR_CSUM; /* * BCM5701 B5 have a bug causing data corruption when using @@ -1516,13 +1544,15 @@ bge_chipinit(struct bge_softc *sc) */ if (sc->bge_asicrev == BGE_ASICREV_BCM5701 && sc->bge_chipid == BGE_CHIPID_BCM5701_B5) - BGE_SETBIT(sc, BGE_MODE_CTL, BGE_MODECTL_FORCE_PCI32); + mode_ctl |= BGE_MODECTL_FORCE_PCI32; /* * Tell the firmware the driver is running */ if (sc->bge_asf_mode & ASF_STACKUP) - BGE_SETBIT(sc, BGE_MODE_CTL, BGE_MODECTL_STACKUP); + mode_ctl |= BGE_MODECTL_STACKUP; + + CSR_WRITE_4(sc, BGE_MODE_CTL, mode_ctl); /* * Disable memory write invalidate. Apparently it is not supported @@ -1582,8 +1612,7 @@ bge_blockinit(struct bge_softc *sc) } /* Configure mbuf pool watermarks */ - if (sc->bge_asicrev == BGE_ASICREV_BCM5717 || - sc->bge_asicrev == BGE_ASICREV_BCM57765) { + if (BGE_IS_5717_PLUS(sc)) { CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_READDMA_LOWAT, 0x0); if (sc->bge_ifp->if_mtu > ETHERMTU) { CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_MACRX_LOWAT, 0x7e); @@ -1718,7 +1747,8 @@ bge_blockinit(struct bge_softc *sc) BGE_RCB_MAXLEN_FLAGS(BGE_MAX_FRAMELEN, 0); } if (sc->bge_asicrev == BGE_ASICREV_BCM5717 || - sc->bge_asicrev == BGE_ASICREV_BCM5719) + sc->bge_asicrev == BGE_ASICREV_BCM5719 || + sc->bge_asicrev == BGE_ASICREV_BCM5720) rcb->bge_nicaddr = BGE_STD_RX_RINGS_5717; else rcb->bge_nicaddr = BGE_STD_RX_RINGS; @@ -1751,7 +1781,8 @@ bge_blockinit(struct bge_softc *sc) rcb->bge_maxlen_flags = BGE_RCB_MAXLEN_FLAGS(0, BGE_RCB_FLAG_USE_EXT_RX_BD | BGE_RCB_FLAG_RING_DISABLED); if (sc->bge_asicrev == BGE_ASICREV_BCM5717 || - sc->bge_asicrev == BGE_ASICREV_BCM5719) + sc->bge_asicrev == BGE_ASICREV_BCM5719 || + sc->bge_asicrev == BGE_ASICREV_BCM5720) rcb->bge_nicaddr = BGE_JUMBO_RX_RINGS_5717; else rcb->bge_nicaddr = BGE_JUMBO_RX_RINGS; @@ -1840,7 +1871,8 @@ bge_blockinit(struct bge_softc *sc) RCB_WRITE_4(sc, vrcb, bge_hostaddr.bge_addr_hi, taddr.bge_addr_hi); RCB_WRITE_4(sc, vrcb, bge_hostaddr.bge_addr_lo, taddr.bge_addr_lo); if (sc->bge_asicrev == BGE_ASICREV_BCM5717 || - sc->bge_asicrev == BGE_ASICREV_BCM5719) + sc->bge_asicrev == BGE_ASICREV_BCM5719 || + sc->bge_asicrev == BGE_ASICREV_BCM5720) RCB_WRITE_4(sc, vrcb, bge_nicaddr, BGE_SEND_RING_5717); else RCB_WRITE_4(sc, vrcb, bge_nicaddr, @@ -1854,7 +1886,8 @@ bge_blockinit(struct bge_softc *sc) * return ring control blocks, located in NIC memory. */ if (sc->bge_asicrev == BGE_ASICREV_BCM5717 || - sc->bge_asicrev == BGE_ASICREV_BCM5719) { + sc->bge_asicrev == BGE_ASICREV_BCM5719 || + sc->bge_asicrev == BGE_ASICREV_BCM5720) { /* Should be 17, use 16 until we get an SRAM map. */ limit = 16; } else if (!BGE_IS_5705_PLUS(sc)) @@ -1898,7 +1931,11 @@ bge_blockinit(struct bge_softc *sc) BGE_TX_BACKOFF_SEED_MASK); /* Set inter-packet gap */ - CSR_WRITE_4(sc, BGE_TX_LENGTHS, 0x2620); + val = 0x2620; + if (sc->bge_asicrev == BGE_ASICREV_BCM5720) + val |= CSR_READ_4(sc, BGE_TX_LENGTHS) & + (BGE_TXLEN_JMB_FRM_LEN_MSK | BGE_TXLEN_CNT_DN_VAL_MSK); + CSR_WRITE_4(sc, BGE_TX_LENGTHS, val); /* * Specify which ring to use for packets that don't match @@ -2053,6 +2090,17 @@ bge_blockinit(struct bge_softc *sc) sc->bge_asicrev == BGE_ASICREV_BCM57780) val |= BGE_RDMAMODE_TSO6_ENABLE; } + + if (sc->bge_asicrev == BGE_ASICREV_BCM5720) { + val |= CSR_READ_4(sc, BGE_RDMA_MODE) & + BGE_RDMAMODE_H2BNC_VLAN_DET; + /* + * Allow multiple outstanding read requests from + * non-LSO read DMA engine. + */ + val &= ~BGE_RDMAMODE_MULT_DMA_RD_DIS; + } + if (sc->bge_asicrev == BGE_ASICREV_BCM5761 || sc->bge_asicrev == BGE_ASICREV_BCM5784 || sc->bge_asicrev == BGE_ASICREV_BCM5785 || @@ -2063,7 +2111,8 @@ bge_blockinit(struct bge_softc *sc) * Adjust tx margin to prevent TX data corruption and * fix internal FIFO overflow. */ - if (sc->bge_asicrev == BGE_ASICREV_BCM5719) { + if (sc->bge_asicrev == BGE_ASICREV_BCM5719 || + sc->bge_asicrev == BGE_ASICREV_BCM5720) { dmactl &= ~(BGE_RDMA_RSRVCTRL_FIFO_LWM_MASK | BGE_RDMA_RSRVCTRL_FIFO_HWM_MASK | BGE_RDMA_RSRVCTRL_TXMRGN_MASK); @@ -2085,6 +2134,15 @@ bge_blockinit(struct bge_softc *sc) CSR_READ_4(sc, BGE_RDMA_LSO_CRPTEN_CTRL) | BGE_RDMA_LSO_CRPTEN_CTRL_BLEN_BD_4K | BGE_RDMA_LSO_CRPTEN_CTRL_BLEN_LSO_4K); + } else if (sc->bge_asicrev == BGE_ASICREV_BCM5720) { + /* + * Allow 4KB burst length reads for non-LSO frames. + * Enable 512B burst length reads for buffer descriptors. + */ + CSR_WRITE_4(sc, BGE_RDMA_LSO_CRPTEN_CTRL, + CSR_READ_4(sc, BGE_RDMA_LSO_CRPTEN_CTRL) | + BGE_RDMA_LSO_CRPTEN_CTRL_BLEN_BD_512 | + BGE_RDMA_LSO_CRPTEN_CTRL_BLEN_LSO_4K); } CSR_WRITE_4(sc, BGE_RDMA_MODE, val); @@ -2239,6 +2297,7 @@ bge_probe(device_t dev) case BCOM_DEVICEID_BCM5717: case BCOM_DEVICEID_BCM5718: case BCOM_DEVICEID_BCM5719: + case BCOM_DEVICEID_BCM5720: id = pci_read_config(dev, BGE_PCI_GEN2_PRODID_ASICREV, 4); break; @@ -2310,10 +2369,11 @@ bge_dma_free(struct bge_softc *sc) if (sc->bge_cdata.bge_rx_mtag) bus_dma_tag_destroy(sc->bge_cdata.bge_rx_mtag); + if (sc->bge_cdata.bge_mtag_jumbo) + bus_dma_tag_destroy(sc->bge_cdata.bge_mtag_jumbo); if (sc->bge_cdata.bge_tx_mtag) bus_dma_tag_destroy(sc->bge_cdata.bge_tx_mtag); - /* Destroy standard RX ring. */ if (sc->bge_cdata.bge_rx_std_ring_map) bus_dmamap_unload(sc->bge_cdata.bge_rx_std_ring_tag, @@ -2559,10 +2619,10 @@ bge_dma_alloc(struct bge_softc *sc) * XXX * watchdog timeout issue was observed on BCM5704 which * lives behind PCI-X bridge(e.g AMD 8131 PCI-X bridge). - * Limiting DMA address space to 32bits seems to address - * it. + * Both limiting DMA address space to 32bits and flushing + * mailbox write seem to address the issue. */ - if (sc->bge_flags & BGE_FLAG_PCIX) + if (sc->bge_pcixcap != 0) lowaddr = BUS_SPACE_MAXADDR_32BIT; } error = bus_dma_tag_create(bus_get_dma_tag(sc->bge_dev), @@ -2701,6 +2761,9 @@ bge_can_use_msi(struct bge_softc *sc) return 0; #endif + if (sc->bge_msi == 0) + return (0); + /* Disable MSI for polling(4). */ #ifdef DEVICE_POLLING return (0); @@ -2727,6 +2790,102 @@ bge_can_use_msi(struct bge_softc *sc) return (can_use_msi); } +static int +bge_mbox_reorder(struct bge_softc *sc) +{ +#ifndef __HAIKU__ + /* Lists of PCI bridges that are known to reorder mailbox writes. */ + static const struct mbox_reorder { + const uint16_t vendor; + const uint16_t device; + const char *desc; + } const mbox_reorder_lists[] = { + { 0x1022, 0x7450, "AMD-8131 PCI-X Bridge" }, + }; + devclass_t pci, pcib; + device_t bus, dev; + int i; + + pci = devclass_find("pci"); + pcib = devclass_find("pcib"); + dev = sc->bge_dev; + bus = device_get_parent(dev); + for (;;) { + dev = device_get_parent(bus); + bus = device_get_parent(dev); + if (device_get_devclass(dev) != pcib) + break; + for (i = 0; i < nitems(mbox_reorder_lists); i++) { + if (pci_get_vendor(dev) == + mbox_reorder_lists[i].vendor && + pci_get_device(dev) == + mbox_reorder_lists[i].device) { + device_printf(sc->bge_dev, + "enabling MBOX workaround for %s\n", + mbox_reorder_lists[i].desc); + return (1); + } + } + if (device_get_devclass(bus) != pci) + break; + } +#endif + return (0); +} + +static void +bge_devinfo(struct bge_softc *sc) +{ + uint32_t cfg, clk; + + device_printf(sc->bge_dev, + "CHIP ID 0x%08x; ASIC REV 0x%02x; CHIP REV 0x%02x; ", + sc->bge_chipid, sc->bge_asicrev, sc->bge_chiprev); + if (sc->bge_flags & BGE_FLAG_PCIE) + printf("PCI-E\n"); + else if (sc->bge_flags & BGE_FLAG_PCIX) { + printf("PCI-X "); + cfg = CSR_READ_4(sc, BGE_MISC_CFG) & BGE_MISCCFG_BOARD_ID_MASK; + if (cfg == BGE_MISCCFG_BOARD_ID_5704CIOBE) + clk = 133; + else { + clk = CSR_READ_4(sc, BGE_PCI_CLKCTL) & 0x1F; + switch (clk) { + case 0: + clk = 33; + break; + case 2: + clk = 50; + break; + case 4: + clk = 66; + break; + case 6: + clk = 100; + break; + case 7: + clk = 133; + break; + } + } + printf("%u MHz\n", clk); + } else { + if (sc->bge_pcixcap != 0) + printf("PCI on PCI-X "); + else + printf("PCI "); + cfg = pci_read_config(sc->bge_dev, BGE_PCI_PCISTATE, 4); + if (cfg & BGE_PCISTATE_PCI_BUSSPEED) + clk = 66; + else + clk = 33; + if (cfg & BGE_PCISTATE_32BIT_BUS) + printf("%u MHz; 32bit\n", clk); + else + printf("%u MHz; 64bit\n", clk); + } +} + static int bge_attach(device_t dev) { @@ -2769,6 +2928,7 @@ bge_attach(device_t dev) case BCOM_DEVICEID_BCM5717: case BCOM_DEVICEID_BCM5718: case BCOM_DEVICEID_BCM5719: + case BCOM_DEVICEID_BCM5720: sc->bge_chipid = pci_read_config(dev, BGE_PCI_GEN2_PRODID_ASICREV, 4); break; @@ -2800,12 +2960,14 @@ bge_attach(device_t dev) * BCM5704 | 1 | X | 1 | X | * BCM5717 | 1 | 8 | 2 | 9 | * BCM5719 | 1 | 8 | 2 | 9 | + * BCM5720 | 1 | 8 | 2 | 9 | * * Other addresses may respond but they are not * IEEE compliant PHYs and should be ignored. */ if (sc->bge_asicrev == BGE_ASICREV_BCM5717 || - sc->bge_asicrev == BGE_ASICREV_BCM5719) { + sc->bge_asicrev == BGE_ASICREV_BCM5719 || + sc->bge_asicrev == BGE_ASICREV_BCM5720) { f = pci_get_function(dev); if (sc->bge_chipid == BGE_CHIPID_BCM5717_A0) { if (CSR_READ_4(sc, BGE_SGDIG_STS) & @@ -2840,7 +3002,7 @@ bge_attach(device_t dev) switch (sc->bge_asicrev) { case BGE_ASICREV_BCM5717: case BGE_ASICREV_BCM5719: - sc->bge_flags |= BGE_FLAG_SHORT_DMA_BUG; + case BGE_ASICREV_BCM5720: case BGE_ASICREV_BCM57765: sc->bge_flags |= BGE_FLAG_5717_PLUS | BGE_FLAG_5755_PLUS | BGE_FLAG_575X_PLUS | BGE_FLAG_5705_PLUS | BGE_FLAG_JUMBO | @@ -2875,14 +3037,15 @@ bge_attach(device_t dev) case BGE_ASICREV_BCM5752: case BGE_ASICREV_BCM5906: sc->bge_flags |= BGE_FLAG_575X_PLUS; - if (sc->bge_asicrev == BGE_ASICREV_BCM5906) - sc->bge_flags |= BGE_FLAG_SHORT_DMA_BUG; /* FALLTHROUGH */ case BGE_ASICREV_BCM5705: sc->bge_flags |= BGE_FLAG_5705_PLUS; break; } + /* Add SYSCTLs, requires the chipset family to be set. */ + bge_add_sysctls(sc); + /* Set various PHY bug flags. */ if (sc->bge_chipid == BGE_CHIPID_BCM5701_A0 || sc->bge_chipid == BGE_CHIPID_BCM5701_B0) @@ -2898,6 +3061,7 @@ bge_attach(device_t dev) sc->bge_asicrev != BGE_ASICREV_BCM5906 && sc->bge_asicrev != BGE_ASICREV_BCM5717 && sc->bge_asicrev != BGE_ASICREV_BCM5719 && + sc->bge_asicrev != BGE_ASICREV_BCM5720 && sc->bge_asicrev != BGE_ASICREV_BCM5785 && sc->bge_asicrev != BGE_ASICREV_BCM57765 && sc->bge_asicrev != BGE_ASICREV_BCM57780) { @@ -2930,17 +3094,28 @@ bge_attach(device_t dev) sc->bge_mi_mode |= BGE_MIMODE_AUTOPOLL; /* - * All controllers that are not 5755 or higher have 4GB - * boundary DMA bug. + * All Broadcom controllers have 4GB boundary DMA bug. * Whenever an address crosses a multiple of the 4GB boundary * (including 4GB, 8Gb, 12Gb, etc.) and makes the transition * from 0xX_FFFF_FFFF to 0x(X+1)_0000_0000 an internal DMA * state machine will lockup and cause the device to hang. */ - if (BGE_IS_5755_PLUS(sc) == 0) - sc->bge_flags |= BGE_FLAG_4G_BNDRY_BUG; + sc->bge_flags |= BGE_FLAG_4G_BNDRY_BUG; - misccfg = CSR_READ_4(sc, BGE_MISC_CFG) & BGE_MISCCFG_BOARD_ID; + /* BCM5755 or higher and BCM5906 have short DMA bug. */ + if (BGE_IS_5755_PLUS(sc) || sc->bge_asicrev == BGE_ASICREV_BCM5906) + sc->bge_flags |= BGE_FLAG_SHORT_DMA_BUG; + + /* + * BCM5719 cannot handle DMA requests for DMA segments that + * have larger than 4KB in size. However the maximum DMA + * segment size created in DMA tag is 4KB for TSO, so we + * wouldn't encounter the issue here. + */ + if (sc->bge_asicrev == BGE_ASICREV_BCM5719) + sc->bge_flags |= BGE_FLAG_4K_RDMA_BUG; + + misccfg = CSR_READ_4(sc, BGE_MISC_CFG) & BGE_MISCCFG_BOARD_ID_MASK; if (sc->bge_asicrev == BGE_ASICREV_BCM5705) { if (misccfg == BGE_MISCCFG_BOARD_ID_5788 || misccfg == BGE_MISCCFG_BOARD_ID_5788M) @@ -2997,9 +3172,9 @@ bge_attach(device_t dev) sc->bge_flags |= BGE_FLAG_TSO; } - /* + /* * Check if this is a PCI-X or PCI Express device. - */ + */ if (pci_find_cap(dev, PCIY_EXPRESS, ®) == 0) { /* * Found a PCI Express capabilities register, this @@ -3007,7 +3182,8 @@ bge_attach(device_t dev) */ sc->bge_flags |= BGE_FLAG_PCIE; sc->bge_expcap = reg; - if (sc->bge_asicrev == BGE_ASICREV_BCM5719) + if (sc->bge_asicrev == BGE_ASICREV_BCM5719 || + sc->bge_asicrev == BGE_ASICREV_BCM5720) pci_set_max_read_req(dev, 2048); else if (pci_get_max_read_req(dev) != 4096) pci_set_max_read_req(dev, 4096); @@ -3030,6 +3206,16 @@ bge_attach(device_t dev) */ if (BGE_IS_5714_FAMILY(sc) && (sc->bge_flags & BGE_FLAG_PCIX)) sc->bge_flags |= BGE_FLAG_40BIT_BUG; + /* + * Some PCI-X bridges are known to trigger write reordering to + * the mailbox registers. Typical phenomena is watchdog timeouts + * caused by out-of-order TX completions. Enable workaround for + * PCI-X devices that live behind these bridges. + * Note, PCI-X controllers can run in PCI mode so we can't use + * BGE_FLAG_PCIX flag to detect PCI-X controllers. + */ + if (sc->bge_pcixcap != 0 && bge_mbox_reorder(sc) != 0) + sc->bge_flags |= BGE_FLAG_MBOX_REORDER; /* * Allocate the interrupt, using MSI if possible. These devices * support 8 MSI messages, but only the first one is used in @@ -3069,11 +3255,7 @@ bge_attach(device_t dev) goto fail; } - device_printf(dev, - "CHIP ID 0x%08x; ASIC REV 0x%02x; CHIP REV 0x%02x; %s\n", - sc->bge_chipid, sc->bge_asicrev, sc->bge_chiprev, - (sc->bge_flags & BGE_FLAG_PCIX) ? "PCI-X" : - ((sc->bge_flags & BGE_FLAG_PCIE) ? "PCI-E" : "PCI")); + bge_devinfo(sc); BGE_LOCK_INIT(sc, device_get_nameunit(dev)); @@ -3085,9 +3267,9 @@ bge_attach(device_t dev) } sc->bge_asf_mode = 0; - if (bge_allow_asf && (bge_readmem_ind(sc, BGE_SOFTWARE_GENCOMM_SIG) - == BGE_MAGIC_NUMBER)) { - if (bge_readmem_ind(sc, BGE_SOFTWARE_GENCOMM_NICCFG) + if (bge_allow_asf && (bge_readmem_ind(sc, BGE_SRAM_DATA_SIG) == + BGE_SRAM_DATA_SIG_MAGIC)) { + if (bge_readmem_ind(sc, BGE_SRAM_DATA_CFG) & BGE_HWCFG_ASF) { sc->bge_asf_mode |= ASF_ENABLE; sc->bge_asf_mode |= ASF_STACKUP; @@ -3137,8 +3319,6 @@ bge_attach(device_t dev) goto fail; } - bge_add_sysctls(sc); - /* Set default tuneable values. */ sc->bge_stat_ticks = BGE_TICKS_PER_SEC; sc->bge_rx_coal_ticks = 150; @@ -3201,8 +3381,8 @@ bge_attach(device_t dev) * by its PCI subsystem ID, as we do below for the SysKonnect * SK-9D41. */ - if (bge_readmem_ind(sc, BGE_SOFTWARE_GENCOMM_SIG) == BGE_MAGIC_NUMBER) - hwcfg = bge_readmem_ind(sc, BGE_SOFTWARE_GENCOMM_NICCFG); + if (bge_readmem_ind(sc, BGE_SRAM_DATA_SIG) == BGE_SRAM_DATA_SIG_MAGIC) + hwcfg = bge_readmem_ind(sc, BGE_SRAM_DATA_CFG); else if ((sc->bge_flags & BGE_FLAG_EADDR) && (sc->bge_asicrev != BGE_ASICREV_BCM5906)) { if (bge_read_eeprom(sc, (caddr_t)&hwcfg, BGE_EE_HWCFG_OFFSET, @@ -3437,9 +3617,9 @@ bge_reset(struct bge_softc *sc) /* * Write the magic number to SRAM at offset 0xB50. * When firmware finishes its initialization it will - * write ~BGE_MAGIC_NUMBER to the same location. + * write ~BGE_SRAM_FW_MB_MAGIC to the same location. */ - bge_writemem_ind(sc, BGE_SOFTWARE_GENCOMM, BGE_MAGIC_NUMBER); + bge_writemem_ind(sc, BGE_SRAM_FW_MB, BGE_SRAM_FW_MB_MAGIC); reset = BGE_MISCCFG_RESET_CORE_CLOCKS | BGE_32BITTIME_66MHZ; @@ -3458,7 +3638,8 @@ bge_reset(struct bge_softc *sc) * Set GPHY Power Down Override to leave GPHY * powered up in D0 uninitialized. */ - if (BGE_IS_5705_PLUS(sc)) + if (BGE_IS_5705_PLUS(sc) && + (sc->bge_flags & BGE_FLAG_CPMU_PRESENT) == 0) reset |= BGE_MISCCFG_GPHY_PD_OVERRIDE; /* Issue global reset */ @@ -3487,8 +3668,6 @@ bge_reset(struct bge_softc *sc) /* Clear enable no snoop and disable relaxed ordering. */ devctl &= ~(PCIM_EXP_CTL_RELAXED_ORD_ENABLE | PCIM_EXP_CTL_NOSNOOP_ENABLE); - /* Set PCIE max payload size to 128. */ - devctl &= ~PCIM_EXP_CTL_MAX_PAYLOAD; pci_write_config(dev, sc->bge_expcap + PCIR_EXPRESS_DEVICE_CTL, devctl, 2); /* Clear error status. */ @@ -3563,8 +3742,8 @@ bge_reset(struct bge_softc *sc) */ for (i = 0; i < BGE_TIMEOUT; i++) { DELAY(10); - val = bge_readmem_ind(sc, BGE_SOFTWARE_GENCOMM); - if (val == ~BGE_MAGIC_NUMBER) + val = bge_readmem_ind(sc, BGE_SRAM_FW_MB); + if (val == ~BGE_SRAM_FW_MB_MAGIC) break; } @@ -3592,8 +3771,7 @@ bge_reset(struct bge_softc *sc) } /* Fix up byte swapping. */ - CSR_WRITE_4(sc, BGE_MODE_CTL, BGE_DMA_SWAP_OPTIONS | - BGE_MODECTL_BYTESWAP_DATA); + CSR_WRITE_4(sc, BGE_MODE_CTL, bge_dma_swap_options(sc)); /* Tell the ASF firmware we are up */ if (sc->bge_asf_mode & ASF_STACKUP) @@ -3624,6 +3802,10 @@ bge_reset(struct bge_softc *sc) } DELAY(10000); + if (sc->bge_asicrev == BGE_ASICREV_BCM5720) + BGE_CLRBIT(sc, BGE_CPMU_CLCK_ORIDE, + CPMU_CLCK_ORIDE_MAC_ORIDE_EN); + return (0); } @@ -4007,7 +4189,7 @@ bge_intr_task(void *arg, int pending) if (ifp->if_drv_flags & IFF_DRV_RUNNING) { /* Check TX ring producer/consumer. */ bge_txeof(sc, tx_cons); - if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) + if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) bge_start_locked(ifp); } BGE_UNLOCK(sc); @@ -4103,12 +4285,14 @@ bge_asf_driver_up(struct bge_softc *sc) sc->bge_asf_count --; else { sc->bge_asf_count = 2; - bge_writemem_ind(sc, BGE_SOFTWARE_GENCOMM_FW, - BGE_FW_DRV_ALIVE); - bge_writemem_ind(sc, BGE_SOFTWARE_GENNCOMM_FW_LEN, 4); - bge_writemem_ind(sc, BGE_SOFTWARE_GENNCOMM_FW_DATA, 3); - CSR_WRITE_4(sc, BGE_CPU_EVENT, - CSR_READ_4(sc, BGE_CPU_EVENT) | (1 << 14)); + bge_writemem_ind(sc, BGE_SRAM_FW_CMD_MB, + BGE_FW_CMD_DRV_ALIVE); + bge_writemem_ind(sc, BGE_SRAM_FW_CMD_LEN_MB, 4); + bge_writemem_ind(sc, BGE_SRAM_FW_CMD_DATA_MB, + BGE_FW_HB_TIMEOUT_SEC); + CSR_WRITE_4(sc, BGE_RX_CPU_EVENT, + CSR_READ_4(sc, BGE_RX_CPU_EVENT) | + BGE_RX_CPU_DRV_EVENT); } } } @@ -4124,7 +4308,7 @@ bge_tick(void *xsc) /* Synchronize with possible callout reset/stop. */ if (callout_pending(&sc->bge_stat_ch) || !callout_active(&sc->bge_stat_ch)) - return; + return; if (BGE_IS_5705_PLUS(sc)) bge_stats_update_regs(sc); @@ -4239,8 +4423,30 @@ bge_stats_update_regs(struct bge_softc *sc) CSR_READ_4(sc, BGE_RXLP_LOCSTAT_DMA_HPWRQ_FULL); stats->NoMoreRxBDs += CSR_READ_4(sc, BGE_RXLP_LOCSTAT_OUT_OF_BDS); - stats->InputDiscards += - CSR_READ_4(sc, BGE_RXLP_LOCSTAT_IFIN_DROPS); + /* + * XXX + * Unlike other controllers, BGE_RXLP_LOCSTAT_IFIN_DROPS + * counter of BCM5717, BCM5718, BCM5719 A0 and BCM5720 A0 + * includes number of unwanted multicast frames. This comes + * from silicon bug and known workaround to get rough(not + * exact) counter is to enable interrupt on MBUF low water + * attention. This can be accomplished by setting + * BGE_HCCMODE_ATTN bit of BGE_HCC_MODE, + * BGE_BMANMODE_LOMBUF_ATTN bit of BGE_BMAN_MODE and + * BGE_MODECTL_FLOWCTL_ATTN_INTR bit of BGE_MODE_CTL. + * However that change would generate more interrupts and + * there are still possibilities of losing multiple frames + * during BGE_MODECTL_FLOWCTL_ATTN_INTR interrupt handling. + * Given that the workaround still would not get correct + * counter I don't think it's worth to implement it. So + * ignore reading the counter on controllers that have the + * silicon bug. + */ + if (sc->bge_asicrev != BGE_ASICREV_BCM5717 && + sc->bge_chipid != BGE_CHIPID_BCM5719_A0 && + sc->bge_chipid != BGE_CHIPID_BCM5720_A0) + stats->InputDiscards += + CSR_READ_4(sc, BGE_RXLP_LOCSTAT_IFIN_DROPS); stats->InputErrors += CSR_READ_4(sc, BGE_RXLP_LOCSTAT_IFIN_ERRORS); stats->RecvThresholdHit += @@ -4311,6 +4517,12 @@ bge_stats_update(struct bge_softc *sc) ifp->if_collisions += (uint32_t)(cnt - sc->bge_tx_collisions); sc->bge_tx_collisions = cnt; + cnt = READ_STAT(sc, stats, nicNoMoreRxBDs.bge_addr_lo); + ifp->if_ierrors += (uint32_t)(cnt - sc->bge_rx_nobds); + sc->bge_rx_nobds = cnt; + cnt = READ_STAT(sc, stats, ifInErrors.bge_addr_lo); + ifp->if_ierrors += (uint32_t)(cnt - sc->bge_rx_inerrs); + sc->bge_rx_inerrs = cnt; cnt = READ_STAT(sc, stats, ifInDiscards.bge_addr_lo); ifp->if_ierrors += (uint32_t)(cnt - sc->bge_rx_discards); sc->bge_rx_discards = cnt; @@ -4836,6 +5048,11 @@ bge_init_locked(struct bge_softc *sc) mode = CSR_READ_4(sc, BGE_TX_MODE); if (BGE_IS_5755_PLUS(sc) || sc->bge_asicrev == BGE_ASICREV_BCM5906) mode |= BGE_TXMODE_MBUF_LOCKUP_FIX; + if (sc->bge_asicrev == BGE_ASICREV_BCM5720) { + mode &= ~(BGE_TXMODE_JMB_FRM_LEN | BGE_TXMODE_CNT_DN_MODE); + mode |= CSR_READ_4(sc, BGE_TX_MODE) & + (BGE_TXMODE_JMB_FRM_LEN | BGE_TXMODE_CNT_DN_MODE); + } /* Turn on transmitter. */ CSR_WRITE_4(sc, BGE_TX_MODE, mode | BGE_TXMODE_ENABLE); @@ -5048,7 +5265,7 @@ bge_ioctl(struct ifnet *ifp, u_long command, caddr_t data) break; } } else if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > ETHERMTU) { - error = EINVAL; + error = EINVAL; break; } BGE_LOCK(sc); @@ -5536,6 +5753,12 @@ bge_add_sysctls(struct bge_softc *sc) "Number of fragmented TX buffers of a frame allowed before " "forced collapsing"); + sc->bge_msi = 1; + snprintf(tn, sizeof(tn), "dev.bge.%d.msi", unit); + TUNABLE_INT_FETCH(tn, &sc->bge_msi); + SYSCTL_ADD_INT(ctx, children, OID_AUTO, "msi", + CTLFLAG_RD, &sc->bge_msi, 0, "Enable MSI"); + /* * It seems all Broadcom controllers have a bug that can generate UDP * datagrams with checksum value 0 when TX UDP checksum offloading is @@ -5809,8 +6032,7 @@ bge_sysctl_debug_info(SYSCTL_HANDLER_ARGS) { struct bge_softc *sc; uint16_t *sbdata; - int error; - int result; + int error, result, sbsz; int i, j; result = -1; @@ -5821,14 +6043,21 @@ bge_sysctl_debug_info(SYSCTL_HANDLER_ARGS) if (result == 1) { sc = (struct bge_softc *)arg1; + if (sc->bge_asicrev == BGE_ASICREV_BCM5700 && + sc->bge_chipid != BGE_CHIPID_BCM5700_C0) + sbsz = BGE_STATUS_BLK_SZ; + else + sbsz = 32; sbdata = (uint16_t *)sc->bge_ldata.bge_status_block; printf("Status Block:\n"); - for (i = 0x0; i < (BGE_STATUS_BLK_SZ / 4); ) { + BGE_LOCK(sc); + bus_dmamap_sync(sc->bge_cdata.bge_status_tag, + sc->bge_cdata.bge_status_map, + BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); + for (i = 0x0; i < sbsz / sizeof(uint16_t); ) { printf("%06x:", i); - for (j = 0; j < 8; j++) { - printf(" %04x", sbdata[i]); - i += 4; - } + for (j = 0; j < 8; j++) + printf(" %04x", sbdata[i++]); printf("\n"); } @@ -5841,8 +6070,11 @@ bge_sysctl_debug_info(SYSCTL_HANDLER_ARGS) } printf("\n"); } + BGE_UNLOCK(sc); printf("Hardware Flags:\n"); + if (BGE_IS_5717_PLUS(sc)) + printf(" - 5717 Plus\n"); if (BGE_IS_5755_PLUS(sc)) printf(" - 5755 Plus\n"); if (BGE_IS_575X_PLUS(sc)) @@ -5932,11 +6164,11 @@ bge_get_eaddr_mem(struct bge_softc *sc, uint8_t ether_addr[]) { uint32_t mac_addr; - mac_addr = bge_readmem_ind(sc, 0x0c14); + mac_addr = bge_readmem_ind(sc, BGE_SRAM_MAC_ADDR_HIGH_MB); if ((mac_addr >> 16) == 0x484b) { ether_addr[0] = (uint8_t)(mac_addr >> 8); ether_addr[1] = (uint8_t)mac_addr; - mac_addr = bge_readmem_ind(sc, 0x0c18); + mac_addr = bge_readmem_ind(sc, BGE_SRAM_MAC_ADDR_LOW_MB); ether_addr[2] = (uint8_t)(mac_addr >> 24); ether_addr[3] = (uint8_t)(mac_addr >> 16); ether_addr[4] = (uint8_t)(mac_addr >> 8); diff --git a/src/add-ons/kernel/drivers/network/broadcom570x/dev/bge/if_bgereg.h b/src/add-ons/kernel/drivers/network/broadcom570x/dev/bge/if_bgereg.h index 889efcec43..4413775d56 100644 --- a/src/add-ons/kernel/drivers/network/broadcom570x/dev/bge/if_bgereg.h +++ b/src/add-ons/kernel/drivers/network/broadcom570x/dev/bge/if_bgereg.h @@ -71,12 +71,15 @@ #define BGE_STATS_BLOCK_END 0x00000AFF #define BGE_STATUS_BLOCK 0x00000B00 #define BGE_STATUS_BLOCK_END 0x00000B4F -#define BGE_SOFTWARE_GENCOMM 0x00000B50 -#define BGE_SOFTWARE_GENCOMM_SIG 0x00000B54 -#define BGE_SOFTWARE_GENCOMM_NICCFG 0x00000B58 -#define BGE_SOFTWARE_GENCOMM_FW 0x00000B78 -#define BGE_SOFTWARE_GENNCOMM_FW_LEN 0x00000B7C -#define BGE_SOFTWARE_GENNCOMM_FW_DATA 0x00000B80 +#define BGE_SRAM_FW_MB 0x00000B50 +#define BGE_SRAM_DATA_SIG 0x00000B54 +#define BGE_SRAM_DATA_CFG 0x00000B58 +#define BGE_SRAM_FW_CMD_MB 0x00000B78 +#define BGE_SRAM_FW_CMD_LEN_MB 0x00000B7C +#define BGE_SRAM_FW_CMD_DATA_MB 0x00000B80 +#define BGE_SRAM_FW_DRV_STATE_MB 0x00000C04 +#define BGE_SRAM_MAC_ADDR_HIGH_MB 0x00000C14 +#define BGE_SRAM_MAC_ADDR_LOW_MB 0x00000C18 #define BGE_SOFTWARE_GENCOMM_END 0x00000FFF #define BGE_UNMAPPED 0x00001000 #define BGE_UNMAPPED_END 0x00001FFF @@ -87,8 +90,24 @@ #define BGE_SEND_RING_1_TO_4_END 0x00005FFF /* Firmware interface */ -#define BGE_FW_DRV_ALIVE 0x00000001 -#define BGE_FW_PAUSE 0x00000002 +#define BGE_SRAM_DATA_SIG_MAGIC 0x4B657654 /* 'KevT' */ + +#define BGE_FW_CMD_DRV_ALIVE 0x00000001 +#define BGE_FW_CMD_PAUSE 0x00000002 +#define BGE_FW_CMD_IPV4_ADDR_CHANGE 0x00000003 +#define BGE_FW_CMD_IPV6_ADDR_CHANGE 0x00000004 +#define BGE_FW_CMD_LINK_UPDATE 0x0000000C +#define BGE_FW_CMD_DRV_ALIVE2 0x0000000D +#define BGE_FW_CMD_DRV_ALIVE3 0x0000000E + +#define BGE_FW_HB_TIMEOUT_SEC 3 + +#define BGE_FW_DRV_STATE_START 0x00000001 +#define BGE_FW_DRV_STATE_START_DONE 0x80000001 +#define BGE_FW_DRV_STATE_UNLOAD 0x00000002 +#define BGE_FW_DRV_STATE_UNLOAD_DONE 0x80000002 +#define BGE_FW_DRV_STATE_WOL 0x00000003 +#define BGE_FW_DRV_STATE_SUSPEND 0x00000004 /* Mappings for internal memory configuration */ #define BGE_STD_RX_RINGS 0x00006000 @@ -239,15 +258,6 @@ #define BGE_PCIMISCCTL_ASICREV_SHIFT 16 #define BGE_HIF_SWAP_OPTIONS (BGE_PCIMISCCTL_ENDIAN_WORDSWAP) -#if BYTE_ORDER == LITTLE_ENDIAN -#define BGE_DMA_SWAP_OPTIONS \ - BGE_MODECTL_WORDSWAP_NONFRAME| \ - BGE_MODECTL_BYTESWAP_DATA|BGE_MODECTL_WORDSWAP_DATA -#else -#define BGE_DMA_SWAP_OPTIONS \ - BGE_MODECTL_WORDSWAP_NONFRAME|BGE_MODECTL_BYTESWAP_NONFRAME| \ - BGE_MODECTL_BYTESWAP_DATA|BGE_MODECTL_WORDSWAP_DATA -#endif #define BGE_INIT \ (BGE_HIF_SWAP_OPTIONS|BGE_PCIMISCCTL_CLEAR_INTA| \ @@ -320,6 +330,7 @@ #define BGE_CHIPID_BCM5717_A0 0x05717000 #define BGE_CHIPID_BCM5717_B0 0x05717100 #define BGE_CHIPID_BCM5719_A0 0x05719000 +#define BGE_CHIPID_BCM5720_A0 0x05720000 #define BGE_CHIPID_BCM57765_A0 0x57785000 #define BGE_CHIPID_BCM57765_B0 0x57785100 @@ -344,6 +355,7 @@ /* BGE_PCI_PRODID_ASICREV ASIC rev. identifiers. */ #define BGE_ASICREV_BCM5717 0x5717 #define BGE_ASICREV_BCM5719 0x5719 +#define BGE_ASICREV_BCM5720 0x5720 #define BGE_ASICREV_BCM5761 0x5761 #define BGE_ASICREV_BCM5784 0x5784 #define BGE_ASICREV_BCM5785 0x5785 @@ -788,6 +800,8 @@ #define BGE_TXMODE_BIGBACKOFF_ENABLE 0x00000020 #define BGE_TXMODE_LONGPAUSE_ENABLE 0x00000040 #define BGE_TXMODE_MBUF_LOCKUP_FIX 0x00000100 +#define BGE_TXMODE_JMB_FRM_LEN 0x00400000 +#define BGE_TXMODE_CNT_DN_MODE 0x00800000 /* Transmit MAC status register */ #define BGE_TXSTAT_RX_XOFFED 0x00000001 @@ -801,6 +815,8 @@ #define BGE_TXLEN_SLOTTIME 0x000000FF #define BGE_TXLEN_IPG 0x00000F00 #define BGE_TXLEN_CRS 0x00003000 +#define BGE_TXLEN_JMB_FRM_LEN_MSK 0x00FF0000 +#define BGE_TXLEN_CNT_DN_VAL_MSK 0xFF000000 /* Receive MAC mode register */ #define BGE_RXMODE_RESET 0x00000001 @@ -1258,6 +1274,7 @@ #define BGE_CPMU_LSPD_1000MB_CLK 0x360C #define BGE_CPMU_LNK_AWARE_PWRMD 0x3610 #define BGE_CPMU_HST_ACC 0x361C +#define BGE_CPMU_CLCK_ORIDE 0x3624 #define BGE_CPMU_CLCK_STAT 0x3630 #define BGE_CPMU_MUTEX_REQ 0x365C #define BGE_CPMU_MUTEX_GNT 0x3660 @@ -1285,6 +1302,9 @@ #define BGE_CPMU_HST_ACC_MACCLK_MASK 0x001F0000 #define BGE_CPMU_HST_ACC_MACCLK_6_25 0x00130000 +/* Clock Speed Override Policy register */ +#define CPMU_CLCK_ORIDE_MAC_ORIDE_EN 0x80000000 + /* CPMU Clock Status register */ #define BGE_CPMU_CLCK_STAT_MAC_CLCK_MASK 0x001F0000 #define BGE_CPMU_CLCK_STAT_MAC_CLCK_62_5 0x00000000 @@ -1532,6 +1552,7 @@ #define BGE_RDMAMODE_MULT_DMA_RD_DIS 0x01000000 #define BGE_RDMAMODE_TSO4_ENABLE 0x08000000 #define BGE_RDMAMODE_TSO6_ENABLE 0x10000000 +#define BGE_RDMAMODE_H2BNC_VLAN_DET 0x20000000 /* Read DMA status register */ #define BGE_RDMASTAT_PCI_TGT_ABRT_ATTN 0x00000004 @@ -1552,6 +1573,7 @@ #define BGE_RDMA_RSRVCTRL_FIFO_HWM_MASK 0x000FF000 #define BGE_RDMA_RSRVCTRL_TXMRGN_MASK 0xFFE00000 +#define BGE_RDMA_LSO_CRPTEN_CTRL_BLEN_BD_512 0x00020000 #define BGE_RDMA_LSO_CRPTEN_CTRL_BLEN_BD_4K 0x00030000 #define BGE_RDMA_LSO_CRPTEN_CTRL_BLEN_LSO_4K 0x000C0000 @@ -1875,7 +1897,8 @@ #define BGE_MODE_CTL 0x6800 #define BGE_MISC_CFG 0x6804 #define BGE_MISC_LOCAL_CTL 0x6808 -#define BGE_CPU_EVENT 0x6810 +#define BGE_RX_CPU_EVENT 0x6810 +#define BGE_TX_CPU_EVENT 0x6820 #define BGE_EE_ADDR 0x6838 #define BGE_EE_DATA 0x683C #define BGE_EE_CTL 0x6840 @@ -1883,6 +1906,8 @@ #define BGE_EE_DELAY 0x6848 #define BGE_FASTBOOT_PC 0x6894 +#define BGE_RX_CPU_DRV_EVENT 0x00004000 + /* * NVRAM Control registers */ @@ -1939,14 +1964,18 @@ #define BGE_MODECTL_WORDSWAP_NONFRAME 0x00000004 #define BGE_MODECTL_BYTESWAP_DATA 0x00000010 #define BGE_MODECTL_WORDSWAP_DATA 0x00000020 +#define BGE_MODECTL_BYTESWAP_B2HRX_DATA 0x00000040 +#define BGE_MODECTL_WORDSWAP_B2HRX_DATA 0x00000080 #define BGE_MODECTL_NO_FRAME_CRACKING 0x00000200 #define BGE_MODECTL_NO_RX_CRC 0x00000400 #define BGE_MODECTL_RX_BADFRAMES 0x00000800 #define BGE_MODECTL_NO_TX_INTR 0x00002000 #define BGE_MODECTL_NO_RX_INTR 0x00004000 #define BGE_MODECTL_FORCE_PCI32 0x00008000 +#define BGE_MODECTL_B2HRX_ENABLE 0x00008000 #define BGE_MODECTL_STACKUP 0x00010000 #define BGE_MODECTL_HOST_SEND_BDS 0x00020000 +#define BGE_MODECTL_HTX2B_ENABLE 0x00040000 #define BGE_MODECTL_TX_NO_PHDR_CSUM 0x00100000 #define BGE_MODECTL_RX_NO_PHDR_CSUM 0x00800000 #define BGE_MODECTL_TX_ATTN_INTR 0x01000000 @@ -1960,7 +1989,9 @@ /* Misc. config register */ #define BGE_MISCCFG_RESET_CORE_CLOCKS 0x00000001 #define BGE_MISCCFG_TIMER_PRESCALER 0x000000FE -#define BGE_MISCCFG_BOARD_ID 0x0001E000 +#define BGE_MISCCFG_BOARD_ID_MASK 0x0001E000 +#define BGE_MISCCFG_BOARD_ID_5704 0x00000000 +#define BGE_MISCCFG_BOARD_ID_5704CIOBE 0x00004000 #define BGE_MISCCFG_BOARD_ID_5788 0x00010000 #define BGE_MISCCFG_BOARD_ID_5788M 0x00018000 #define BGE_MISCCFG_EPHY_IDDQ 0x00200000 @@ -2052,10 +2083,10 @@ * This magic number is written to the firmware mailbox at 0xb50 * before a software reset is issued. After the internal firmware * has completed its initialization it will write the opposite of - * this value, ~BGE_MAGIC_NUMBER, to the same location, allowing the - * driver to synchronize with the firmware. + * this value, ~BGE_SRAM_FW_MB_MAGIC, to the same location, + * allowing the driver to synchronize with the firmware. */ -#define BGE_MAGIC_NUMBER 0x4B657654 +#define BGE_SRAM_FW_MB_MAGIC 0x4B657654 typedef struct { uint32_t bge_addr_hi; @@ -2276,7 +2307,8 @@ struct bge_status_block { #define BCOM_DEVICEID_BCM5717 0x1655 #define BCOM_DEVICEID_BCM5718 0x1656 #define BCOM_DEVICEID_BCM5719 0x1657 -#define BCOM_DEVICEID_BCM5720 0x1658 +#define BCOM_DEVICEID_BCM5720_PP 0x1658 /* Not released to public. */ +#define BCOM_DEVICEID_BCM5720 0x165F #define BCOM_DEVICEID_BCM5721 0x1659 #define BCOM_DEVICEID_BCM5722 0x165A #define BCOM_DEVICEID_BCM5723 0x165B @@ -2797,6 +2829,8 @@ struct bge_softc { #define BGE_FLAG_4G_BNDRY_BUG 0x02000000 #define BGE_FLAG_RX_ALIGNBUG 0x04000000 #define BGE_FLAG_SHORT_DMA_BUG 0x08000000 +#define BGE_FLAG_4K_RDMA_BUG 0x10000000 +#define BGE_FLAG_MBOX_REORDER 0x20000000 uint32_t bge_phy_flags; #define BGE_PHY_NO_WIRESPEED 0x00000001 #define BGE_PHY_ADC_BUG 0x00000002 @@ -2833,9 +2867,12 @@ struct bge_softc { int bge_timer; int bge_forced_collapse; int bge_forced_udpcsum; + int bge_msi; int bge_csum_features; struct callout bge_stat_ch; uint32_t bge_rx_discards; + uint32_t bge_rx_inerrs; + uint32_t bge_rx_nobds; uint32_t bge_tx_discards; uint32_t bge_tx_collisions; #ifdef DEVICE_POLLING diff --git a/src/add-ons/kernel/drivers/network/broadcom570x/dev/mii/brgphy.c b/src/add-ons/kernel/drivers/network/broadcom570x/dev/mii/brgphy.c index 88090b7607..57646e56bd 100644 --- a/src/add-ons/kernel/drivers/network/broadcom570x/dev/mii/brgphy.c +++ b/src/add-ons/kernel/drivers/network/broadcom570x/dev/mii/brgphy.c @@ -82,7 +82,7 @@ static device_method_t brgphy_methods[] = { DEVMETHOD(device_attach, brgphy_attach), DEVMETHOD(device_detach, mii_phy_detach), DEVMETHOD(device_shutdown, bus_generic_shutdown), - { 0, 0 } + DEVMETHOD_END }; static devclass_t brgphy_devclass; @@ -139,9 +139,14 @@ static const struct mii_phydesc brgphys[] = { MII_PHY_DESC(BROADCOM2, BCM5754), MII_PHY_DESC(BROADCOM2, BCM5761), MII_PHY_DESC(BROADCOM2, BCM5784), +#ifdef notyet /* better handled by ukphy(4) until WARs are implemented */ + MII_PHY_DESC(BROADCOM2, BCM5785), +#endif MII_PHY_DESC(BROADCOM3, BCM5717C), MII_PHY_DESC(BROADCOM3, BCM5719C), + MII_PHY_DESC(BROADCOM3, BCM5720C), MII_PHY_DESC(BROADCOM3, BCM57765), + MII_PHY_DESC(BROADCOM3, BCM57780), MII_PHY_DESC(xxBROADCOM_ALT1, BCM5906), MII_PHY_END }; @@ -221,7 +226,8 @@ brgphy_attach(device_t dev) sc->mii_flags |= MIIF_HAVEFIBER; } break; - } break; + } + break; case MII_OUI_BROADCOM2: switch (sc->mii_mpd_model) { case MII_MODEL_BROADCOM2_BCM5708S: @@ -938,7 +944,8 @@ brgphy_reset(struct mii_softc *sc) if (bge_sc->bge_phy_flags & BGE_PHY_JITTER_BUG) brgphy_fixup_jitter_bug(sc); - brgphy_jumbo_settings(sc, ifp->if_mtu); + if (bge_sc->bge_flags & BGE_FLAG_JUMBO) + brgphy_jumbo_settings(sc, ifp->if_mtu); if ((bge_sc->bge_phy_flags & BGE_PHY_NO_WIRESPEED) == 0) brgphy_ethernet_wirespeed(sc); diff --git a/src/add-ons/kernel/drivers/network/broadcom570x/dev/mii/ukphy.c b/src/add-ons/kernel/drivers/network/broadcom570x/dev/mii/ukphy.c index 4ecfce29d3..9d52eb580c 100644 --- a/src/add-ons/kernel/drivers/network/broadcom570x/dev/mii/ukphy.c +++ b/src/add-ons/kernel/drivers/network/broadcom570x/dev/mii/ukphy.c @@ -55,7 +55,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/mii/ukphy.c,v 1.20.10.6.2.1 2010/12/21 17:09:25 kensmith Exp $"); +__FBSDID("$FreeBSD$"); /* * driver for generic unknown PHYs @@ -86,7 +86,7 @@ static device_method_t ukphy_methods[] = { DEVMETHOD(device_attach, ukphy_attach), DEVMETHOD(device_detach, mii_phy_detach), DEVMETHOD(device_shutdown, bus_generic_shutdown), - { 0, 0 } + DEVMETHOD_END }; static devclass_t ukphy_devclass; diff --git a/src/add-ons/kernel/drivers/network/broadcom570x/dev/mii/ukphy_subr.c b/src/add-ons/kernel/drivers/network/broadcom570x/dev/mii/ukphy_subr.c index 73007e197b..5f2f6341ba 100644 --- a/src/add-ons/kernel/drivers/network/broadcom570x/dev/mii/ukphy_subr.c +++ b/src/add-ons/kernel/drivers/network/broadcom570x/dev/mii/ukphy_subr.c @@ -31,7 +31,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/mii/ukphy_subr.c,v 1.10.2.4.2.1 2010/12/21 17:09:25 kensmith Exp $"); +__FBSDID("$FreeBSD$"); /* * Subroutines shared by the ukphy driver and other PHY drivers. diff --git a/src/add-ons/kernel/drivers/network/dec21xxx/dev/dc/dcphy.c b/src/add-ons/kernel/drivers/network/dec21xxx/dev/dc/dcphy.c index 5c60ad55f5..a05f2ed4f3 100644 --- a/src/add-ons/kernel/drivers/network/dec21xxx/dev/dc/dcphy.c +++ b/src/add-ons/kernel/drivers/network/dec21xxx/dev/dc/dcphy.c @@ -95,7 +95,7 @@ static device_method_t dcphy_methods[] = { DEVMETHOD(device_attach, dcphy_attach), DEVMETHOD(device_detach, mii_phy_detach), DEVMETHOD(device_shutdown, bus_generic_shutdown), - { 0, 0 } + DEVMETHOD_END }; static devclass_t dcphy_devclass; @@ -294,7 +294,7 @@ static void dcphy_status(struct mii_softc *sc) { struct mii_data *mii = sc->mii_pdata; - int reg, anlpar, tstat = 0; + int anlpar, tstat; struct dc_softc *dc_sc; dc_sc = mii->mii_ifp->if_softc; @@ -305,13 +305,12 @@ dcphy_status(struct mii_softc *sc) if ((mii->mii_ifp->if_flags & IFF_UP) == 0) return; - reg = CSR_READ_4(dc_sc, DC_10BTSTAT); - if (!(reg & DC_TSTAT_LS10) || !(reg & DC_TSTAT_LS100)) + tstat = CSR_READ_4(dc_sc, DC_10BTSTAT); + if (!(tstat & DC_TSTAT_LS10) || !(tstat & DC_TSTAT_LS100)) mii->mii_media_status |= IFM_ACTIVE; if (CSR_READ_4(dc_sc, DC_10BTCTRL) & DC_TCTL_AUTONEGENBL) { /* Erg, still trying, I guess... */ - tstat = CSR_READ_4(dc_sc, DC_10BTSTAT); if ((tstat & DC_TSTAT_ANEGSTAT) != DC_ASTAT_AUTONEGCMP) { if ((DC_IS_MACRONIX(dc_sc) || DC_IS_PNICII(dc_sc)) && (tstat & DC_TSTAT_ANEGSTAT) == DC_ASTAT_DISABLE) @@ -351,9 +350,9 @@ dcphy_status(struct mii_softc *sc) * and hope that the user is clever enough to manually * change the media settings if we're wrong. */ - if (!(reg & DC_TSTAT_LS100)) + if (!(tstat & DC_TSTAT_LS100)) mii->mii_media_active |= IFM_100_TX | IFM_HDX; - else if (!(reg & DC_TSTAT_LS10)) + else if (!(tstat & DC_TSTAT_LS10)) mii->mii_media_active |= IFM_10_T | IFM_HDX; else mii->mii_media_active |= IFM_NONE; diff --git a/src/add-ons/kernel/drivers/network/dec21xxx/dev/dc/if_dc.c b/src/add-ons/kernel/drivers/network/dec21xxx/dev/dc/if_dc.c index 4945a0e10c..41d9ea3079 100644 --- a/src/add-ons/kernel/drivers/network/dec21xxx/dev/dc/if_dc.c +++ b/src/add-ons/kernel/drivers/network/dec21xxx/dev/dc/if_dc.c @@ -31,7 +31,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/dc/if_dc.c,v 1.201.2.3.2.1 2010/12/21 17:09:25 kensmith Exp $"); +__FBSDID("$FreeBSD$"); /* * DEC "tulip" clone ethernet driver. Supports the DEC/Intel 21143 @@ -225,6 +225,10 @@ static const struct dc_type const dc_devs[] = { "Linksys PCMPC200 CardBus 10/100" }, { DC_DEVID(DC_VENDORID_LINKSYS, DC_DEVICEID_PCMPC200_AB09), 0, "Linksys PCMPC200 CardBus 10/100" }, + { DC_DEVID(DC_VENDORID_ULI, DC_DEVICEID_M5261), 0, + "ULi M5261 FastEthernet" }, + { DC_DEVID(DC_VENDORID_ULI, DC_DEVICEID_M5263), 0, + "ULi M5263 FastEthernet" }, { 0, 0, NULL } }; @@ -253,6 +257,7 @@ static void dc_stop(struct dc_softc *); static void dc_watchdog(void *); static int dc_shutdown(device_t); static int dc_ifmedia_upd(struct ifnet *); +static int dc_ifmedia_upd_locked(struct dc_softc *); static void dc_ifmedia_sts(struct ifnet *, struct ifmediareq *); static int dc_dma_alloc(struct dc_softc *); @@ -280,6 +285,7 @@ static uint32_t dc_mchash_be(const uint8_t *); static void dc_setfilt_21143(struct dc_softc *); static void dc_setfilt_asix(struct dc_softc *); static void dc_setfilt_admtek(struct dc_softc *); +static void dc_setfilt_uli(struct dc_softc *); static void dc_setfilt_xircom(struct dc_softc *); static void dc_setfilt(struct dc_softc *); @@ -331,17 +337,13 @@ static device_method_t dc_methods[] = { DEVMETHOD(device_resume, dc_resume), DEVMETHOD(device_shutdown, dc_shutdown), - /* bus interface */ - DEVMETHOD(bus_print_child, bus_generic_print_child), - DEVMETHOD(bus_driver_added, bus_generic_driver_added), - /* MII interface */ DEVMETHOD(miibus_readreg, dc_miibus_readreg), DEVMETHOD(miibus_writereg, dc_miibus_writereg), DEVMETHOD(miibus_statchg, dc_miibus_statchg), DEVMETHOD(miibus_mediainit, dc_miibus_mediainit), - { 0, 0 } + DEVMETHOD_END }; static driver_t dc_driver = { @@ -352,8 +354,9 @@ static driver_t dc_driver = { static devclass_t dc_devclass; -DRIVER_MODULE(dc, pci, dc_driver, dc_devclass, 0, 0); -DRIVER_MODULE(miibus, dc, miibus_driver, miibus_devclass, 0, 0); +DRIVER_MODULE_ORDERED(dc, pci, dc_driver, dc_devclass, NULL, NULL, + SI_ORDER_ANY); +DRIVER_MODULE(miibus, dc, miibus_driver, miibus_devclass, NULL, NULL); #define DC_SETBIT(sc, reg, x) \ CSR_WRITE_4(sc, reg, CSR_READ_4(sc, reg) | (x)) @@ -700,6 +703,23 @@ dc_miibus_readreg(device_t dev, int phy, int reg) return (0); } + if (sc->dc_type == DC_TYPE_ULI_M5263) { + CSR_WRITE_4(sc, DC_ROM, + ((phy << DC_ULI_PHY_ADDR_SHIFT) & DC_ULI_PHY_ADDR_MASK) | + ((reg << DC_ULI_PHY_REG_SHIFT) & DC_ULI_PHY_REG_MASK) | + DC_ULI_PHY_OP_READ); + for (i = 0; i < DC_TIMEOUT; i++) { + DELAY(1); + rval = CSR_READ_4(sc, DC_ROM); + if ((rval & DC_ULI_PHY_OP_DONE) != 0) { + return (rval & DC_ULI_PHY_DATA_MASK); + } + } + if (i == DC_TIMEOUT) + device_printf(dev, "phy read timed out\n"); + return (0); + } + if (DC_IS_COMET(sc)) { switch (reg) { case MII_BMCR: @@ -765,6 +785,16 @@ dc_miibus_writereg(device_t dev, int phy, int reg, int data) return (0); } + if (sc->dc_type == DC_TYPE_ULI_M5263) { + CSR_WRITE_4(sc, DC_ROM, + ((phy << DC_ULI_PHY_ADDR_SHIFT) & DC_ULI_PHY_ADDR_MASK) | + ((reg << DC_ULI_PHY_REG_SHIFT) & DC_ULI_PHY_REG_MASK) | + ((data << DC_ULI_PHY_DATA_SHIFT) & DC_ULI_PHY_DATA_MASK) | + DC_ULI_PHY_OP_WRITE); + DELAY(1); + return (0); + } + if (DC_IS_COMET(sc)) { switch (reg) { case MII_BMCR: @@ -827,12 +857,11 @@ dc_miibus_statchg(device_t dev) return; ifm = &mii->mii_media; - if (DC_IS_DAVICOM(sc) && - IFM_SUBTYPE(ifm->ifm_media) == IFM_HPNA_1) { + if (DC_IS_DAVICOM(sc) && IFM_SUBTYPE(ifm->ifm_media) == IFM_HPNA_1) { dc_setcfg(sc, ifm->ifm_media); - sc->dc_if_media = ifm->ifm_media; return; - } + } else if (!DC_IS_ADMTEK(sc)) + dc_setcfg(sc, mii->mii_media_active); sc->dc_link = 0; if ((mii->mii_media_status & (IFM_ACTIVE | IFM_AVALID)) == @@ -842,17 +871,8 @@ dc_miibus_statchg(device_t dev) case IFM_100_TX: sc->dc_link = 1; break; - default: - break; } } - if (sc->dc_link == 0) - return; - - sc->dc_if_media = mii->mii_media_active; - if (DC_IS_ADMTEK(sc)) - return; - dc_setcfg(sc, mii->mii_media_active); } /* @@ -1147,6 +1167,97 @@ dc_setfilt_asix(struct dc_softc *sc) CSR_WRITE_4(sc, DC_AX_FILTDATA, hashes[1]); } +static void +dc_setfilt_uli(struct dc_softc *sc) +{ + uint8_t eaddr[ETHER_ADDR_LEN]; + struct ifnet *ifp; + struct ifmultiaddr *ifma; + struct dc_desc *sframe; + uint32_t filter, *sp; + uint8_t *ma; + int i, mcnt; + + ifp = sc->dc_ifp; + + i = sc->dc_cdata.dc_tx_prod; + DC_INC(sc->dc_cdata.dc_tx_prod, DC_TX_LIST_CNT); + sc->dc_cdata.dc_tx_cnt++; + sframe = &sc->dc_ldata.dc_tx_list[i]; + sp = sc->dc_cdata.dc_sbuf; + bzero(sp, DC_SFRAME_LEN); + + sframe->dc_data = htole32(DC_ADDR_LO(sc->dc_saddr)); + sframe->dc_ctl = htole32(DC_SFRAME_LEN | DC_TXCTL_SETUP | + DC_TXCTL_TLINK | DC_FILTER_PERFECT | DC_TXCTL_FINT); + + sc->dc_cdata.dc_tx_chain[i] = (struct mbuf *)sc->dc_cdata.dc_sbuf; + + /* Set station address. */ + bcopy(IF_LLADDR(sc->dc_ifp), eaddr, ETHER_ADDR_LEN); + *sp++ = DC_SP_MAC(eaddr[1] << 8 | eaddr[0]); + *sp++ = DC_SP_MAC(eaddr[3] << 8 | eaddr[2]); + *sp++ = DC_SP_MAC(eaddr[5] << 8 | eaddr[4]); + + /* Set broadcast address. */ + *sp++ = DC_SP_MAC(0xFFFF); + *sp++ = DC_SP_MAC(0xFFFF); + *sp++ = DC_SP_MAC(0xFFFF); + + /* Extract current filter configuration. */ + filter = CSR_READ_4(sc, DC_NETCFG); + filter &= ~(DC_NETCFG_RX_PROMISC | DC_NETCFG_RX_ALLMULTI); + + /* Now build perfect filters. */ + mcnt = 0; + if_maddr_rlock(ifp); + TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + if (ifma->ifma_addr->sa_family != AF_LINK) + continue; + if (mcnt >= DC_ULI_FILTER_NPERF) { + filter |= DC_NETCFG_RX_ALLMULTI; + break; + } + ma = LLADDR((struct sockaddr_dl *)ifma->ifma_addr); + *sp++ = DC_SP_MAC(ma[1] << 8 | ma[0]); + *sp++ = DC_SP_MAC(ma[3] << 8 | ma[2]); + *sp++ = DC_SP_MAC(ma[5] << 8 | ma[4]); + mcnt++; + } + if_maddr_runlock(ifp); + + for (; mcnt < DC_ULI_FILTER_NPERF; mcnt++) { + *sp++ = DC_SP_MAC(0xFFFF); + *sp++ = DC_SP_MAC(0xFFFF); + *sp++ = DC_SP_MAC(0xFFFF); + } + + if (filter & (DC_NETCFG_TX_ON | DC_NETCFG_RX_ON)) + CSR_WRITE_4(sc, DC_NETCFG, + filter & ~(DC_NETCFG_TX_ON | DC_NETCFG_RX_ON)); + if (ifp->if_flags & IFF_PROMISC) + filter |= DC_NETCFG_RX_PROMISC | DC_NETCFG_RX_ALLMULTI; + if (ifp->if_flags & IFF_ALLMULTI) + filter |= DC_NETCFG_RX_ALLMULTI; + CSR_WRITE_4(sc, DC_NETCFG, + filter & ~(DC_NETCFG_TX_ON | DC_NETCFG_RX_ON)); + if (filter & (DC_NETCFG_TX_ON | DC_NETCFG_RX_ON)) + CSR_WRITE_4(sc, DC_NETCFG, filter); + + sframe->dc_status = htole32(DC_TXSTAT_OWN); + bus_dmamap_sync(sc->dc_tx_ltag, sc->dc_tx_lmap, BUS_DMASYNC_PREREAD | + BUS_DMASYNC_PREWRITE); + bus_dmamap_sync(sc->dc_stag, sc->dc_smap, BUS_DMASYNC_PREWRITE); + CSR_WRITE_4(sc, DC_TXSTART, 0xFFFFFFFF); + + /* + * Wait some time... + */ + DELAY(1000); + + sc->dc_wdog_timer = 5; +} + static void dc_setfilt_xircom(struct dc_softc *sc) { @@ -1235,6 +1346,9 @@ dc_setfilt(struct dc_softc *sc) if (DC_IS_ADMTEK(sc)) dc_setfilt_admtek(sc); + if (DC_IS_ULI(sc)) + dc_setfilt_uli(sc); + if (DC_IS_XIRCOM(sc)) dc_setfilt_xircom(sc); } @@ -1403,7 +1517,7 @@ dc_reset(struct dc_softc *sc) } if (DC_IS_ASIX(sc) || DC_IS_ADMTEK(sc) || DC_IS_CONEXANT(sc) || - DC_IS_XIRCOM(sc) || DC_IS_INTEL(sc)) { + DC_IS_XIRCOM(sc) || DC_IS_INTEL(sc) || DC_IS_ULI(sc)) { DELAY(10000); DC_CLRBIT(sc, DC_BUSCTL, DC_BUSCTL_RESET); i = 0; @@ -1615,7 +1729,7 @@ dc_read_srom(struct dc_softc *sc, int bits) int size; size = DC_ROM_SIZE(bits); - sc->dc_srom = malloc(size, M_DEVBUF, M_NOWAIT); + sc->dc_srom = malloc(size, M_DEVBUF, M_NOWAIT | M_ZERO); if (sc->dc_srom == NULL) { device_printf(sc->dc_dev, "Could not allocate SROM buffer\n"); return (ENOMEM); @@ -1909,7 +2023,8 @@ dc_attach(device_t dev) struct ifnet *ifp; struct dc_mediainfo *m; uint32_t reg, revision; - int error, mac_offset, phy, rid, tmp; + uint16_t *srom; + int error, mac_offset, n, phy, rid, tmp; uint8_t *mac; sc = device_get_softc(dev); @@ -2089,6 +2204,21 @@ dc_attach(device_t dev) if (error != 0) goto fail; break; + case DC_DEVID(DC_VENDORID_ULI, DC_DEVICEID_M5261): + case DC_DEVID(DC_VENDORID_ULI, DC_DEVICEID_M5263): + if (sc->dc_info->dc_devid == + DC_DEVID(DC_VENDORID_ULI, DC_DEVICEID_M5261)) + sc->dc_type = DC_TYPE_ULI_M5261; + else + sc->dc_type = DC_TYPE_ULI_M5263; + /* TX buffers should be aligned on 4 byte boundary. */ + sc->dc_flags |= DC_TX_INTR_ALWAYS | DC_TX_COALESCE | + DC_TX_ALIGN; + sc->dc_pmode = DC_PMODE_MII; + error = dc_read_srom(sc, sc->dc_romwidth); + if (error != 0) + goto fail; + break; default: device_printf(dev, "unknown device: %x\n", sc->dc_info->dc_devid); @@ -2186,6 +2316,33 @@ dc_attach(device_t dev) } bcopy(mac, eaddr, ETHER_ADDR_LEN); break; + case DC_TYPE_ULI_M5261: + case DC_TYPE_ULI_M5263: + srom = (uint16_t *)sc->dc_srom; + if (srom == NULL || *srom == 0xFFFF || *srom == 0) { + /* + * No valid SROM present, read station address + * from ID Table. + */ + device_printf(dev, + "Reading station address from ID Table.\n"); + CSR_WRITE_4(sc, DC_BUSCTL, 0x10000); + CSR_WRITE_4(sc, DC_SIARESET, 0x01C0); + CSR_WRITE_4(sc, DC_10BTCTRL, 0x0000); + CSR_WRITE_4(sc, DC_10BTCTRL, 0x0010); + CSR_WRITE_4(sc, DC_10BTCTRL, 0x0000); + CSR_WRITE_4(sc, DC_SIARESET, 0x0000); + CSR_WRITE_4(sc, DC_SIARESET, 0x01B0); + mac = (uint8_t *)eaddr; + for (n = 0; n < ETHER_ADDR_LEN; n++) + mac[n] = (uint8_t)CSR_READ_4(sc, DC_10BTCTRL); + CSR_WRITE_4(sc, DC_SIARESET, 0x0000); + CSR_WRITE_4(sc, DC_BUSCTL, 0x0000); + DELAY(10); + } else + dc_read_eeprom(sc, (caddr_t)&eaddr, DC_EE_NODEADDR, 3, + 0); + break; default: dc_read_eeprom(sc, (caddr_t)&eaddr, DC_EE_NODEADDR, 3, 0); break; @@ -2296,9 +2453,6 @@ dc_attach(device_t dev) if (sc->dc_pmode != DC_PMODE_SIA) sc->dc_pmode = DC_PMODE_SYM; sc->dc_flags |= DC_21143_NWAY; - mii_attach(dev, &sc->dc_miibus, ifp, dc_ifmedia_upd, - dc_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, - MII_OFFSET_ANY, 0); /* * For non-MII cards, we need to have the 21143 * drive the LEDs. Except there are some systems @@ -2309,7 +2463,9 @@ dc_attach(device_t dev) if (!(pci_get_subvendor(dev) == 0x1033 && pci_get_subdevice(dev) == 0x8028)) sc->dc_flags |= DC_TULIP_LEDS; - error = 0; + error = mii_attach(dev, &sc->dc_miibus, ifp, dc_ifmedia_upd, + dc_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, + MII_OFFSET_ANY, 0); } if (error) { @@ -2378,7 +2534,7 @@ dc_detach(device_t dev) ifp = sc->dc_ifp; #ifdef DEVICE_POLLING - if (ifp->if_capenable & IFCAP_POLLING) + if (ifp != NULL && ifp->if_capenable & IFCAP_POLLING) ether_poll_deregister(ifp); #endif @@ -2402,7 +2558,7 @@ dc_detach(device_t dev) if (sc->dc_res) bus_release_resource(dev, DC_RES, DC_RID, sc->dc_res); - if (ifp) + if (ifp != NULL) if_free(ifp); dc_dma_free(sc); @@ -2452,7 +2608,6 @@ dc_list_tx_init(struct dc_softc *sc) return (0); } - /* * Initialize the RX descriptors and allocate mbufs for them. Note that * we arrange the descriptors in a closed ring, so that the last descriptor @@ -3462,7 +3617,7 @@ dc_init_locked(struct dc_softc *sc) /* * Set cache alignment and burst length. */ - if (DC_IS_ASIX(sc) || DC_IS_DAVICOM(sc)) + if (DC_IS_ASIX(sc) || DC_IS_DAVICOM(sc) || DC_IS_ULI(sc)) CSR_WRITE_4(sc, DC_BUSCTL, 0); else CSR_WRITE_4(sc, DC_BUSCTL, DC_BUSCTL_MRME | DC_BUSCTL_MRLE); @@ -3575,6 +3730,11 @@ dc_init_locked(struct dc_softc *sc) CSR_WRITE_4(sc, DC_IMR, DC_INTRS); CSR_WRITE_4(sc, DC_ISR, 0xFFFFFFFF); + /* Initialize TX jabber and RX watchdog timer. */ + if (DC_IS_ULI(sc)) + CSR_WRITE_4(sc, DC_WATCHDOG, DC_WDOG_JABBERCLK | + DC_WDOG_HOSTUNJAB); + /* Enable transmitter. */ DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_TX_ON); @@ -3604,8 +3764,7 @@ dc_init_locked(struct dc_softc *sc) ifp->if_drv_flags |= IFF_DRV_RUNNING; ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; - mii_mediachg(mii); - dc_setcfg(sc, sc->dc_if_media); + dc_ifmedia_upd_locked(sc); /* Clear missed frames and overflow counter. */ CSR_READ_4(sc, DC_FRAMESDISCARDED); @@ -3631,25 +3790,37 @@ static int dc_ifmedia_upd(struct ifnet *ifp) { struct dc_softc *sc; - struct mii_data *mii; - struct ifmedia *ifm; + int error; sc = ifp->if_softc; - mii = device_get_softc(sc->dc_miibus); DC_LOCK(sc); - mii_mediachg(mii); - ifm = &mii->mii_media; - - if (DC_IS_INTEL(sc)) - dc_setcfg(sc, ifm->ifm_media); - else if (DC_IS_DAVICOM(sc) && - IFM_SUBTYPE(ifm->ifm_media) == IFM_HPNA_1) - dc_setcfg(sc, ifm->ifm_media); - else - sc->dc_link = 0; + error = dc_ifmedia_upd_locked(sc); DC_UNLOCK(sc); + return (error); +} - return (0); +static int +dc_ifmedia_upd_locked(struct dc_softc *sc) +{ + struct mii_data *mii; + struct ifmedia *ifm; + int error; + + DC_LOCK_ASSERT(sc); + + sc->dc_link = 0; + mii = device_get_softc(sc->dc_miibus); + error = mii_mediachg(mii); + if (error == 0) { + ifm = &mii->mii_media; + if (DC_IS_INTEL(sc)) + dc_setcfg(sc, ifm->ifm_media); + else if (DC_IS_DAVICOM(sc) && + IFM_SUBTYPE(ifm->ifm_media) == IFM_HPNA_1) + dc_setcfg(sc, ifm->ifm_media); + } + + return (error); } /* diff --git a/src/add-ons/kernel/drivers/network/dec21xxx/dev/dc/if_dcreg.h b/src/add-ons/kernel/drivers/network/dec21xxx/dev/dc/if_dcreg.h index 0b6afd00bd..e290881fa0 100644 --- a/src/add-ons/kernel/drivers/network/dec21xxx/dev/dc/if_dcreg.h +++ b/src/add-ons/kernel/drivers/network/dec21xxx/dev/dc/if_dcreg.h @@ -29,7 +29,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/sys/dev/dc/if_dcreg.h,v 1.57.2.2.2.1 2010/12/21 17:09:25 kensmith Exp $ + * $FreeBSD$ */ /* @@ -78,6 +78,8 @@ #define DC_TYPE_PNIC 0xA /* 82c168/82c169 PNIC I */ #define DC_TYPE_XIRCOM 0xB /* Xircom X3201 */ #define DC_TYPE_CONEXANT 0xC /* Conexant LANfinity RS7112 */ +#define DC_TYPE_ULI_M5261 0xD /* ALi/ULi M5261 */ +#define DC_TYPE_ULI_M5263 0xE /* ALi/ULi M5263 */ #define DC_IS_MACRONIX(x) \ (x->dc_type == DC_TYPE_98713 || \ @@ -88,6 +90,10 @@ (x->dc_type == DC_TYPE_AL981 || \ x->dc_type == DC_TYPE_AN983) +#define DC_IS_ULI(x) \ + (x->dc_type == DC_TYPE_ULI_M5261 || \ + x->dc_type == DC_TYPE_ULI_M5263) + #define DC_IS_INTEL(x) (x->dc_type == DC_TYPE_21143) #define DC_IS_ASIX(x) (x->dc_type == DC_TYPE_ASIX) #define DC_IS_COMET(x) (x->dc_type == DC_TYPE_AL981) @@ -707,6 +713,23 @@ struct dc_type { /* End of CONEXANT specific registers */ +/* + * ULi M5263 specific registers. + */ +#define DC_ULI_FILTER_NPERF 14 + +#define DC_ULI_PHY_DATA_MASK 0x0000FFFF +#define DC_ULI_PHY_REG_MASK 0x001F0000 +#define DC_ULI_PHY_ADDR_MASK 0x03E00000 +#define DC_ULI_PHY_OP_WRITE 0x04000000 +#define DC_ULI_PHY_OP_READ 0x08000000 +#define DC_ULI_PHY_OP_DONE 0x10000000 + +#define DC_ULI_PHY_DATA_SHIFT 0 +#define DC_ULI_PHY_REG_SHIFT 16 +#define DC_ULI_PHY_ADDR_SHIFT 21 + +/* End of ULi M5263 specific registers */ struct dc_softc { struct ifnet *dc_ifp; /* interface info */ @@ -737,7 +760,6 @@ struct dc_softc { int dc_pnic_rx_bug_save; unsigned char *dc_pnic_rx_buf; int dc_if_flags; - int dc_if_media; uint32_t dc_flags; uint32_t dc_txthresh; uint32_t dc_eaddr[2]; @@ -1014,6 +1036,17 @@ struct dc_softc { #define DC_DEVICEID_PCMPC200_AB08 0xab08 #define DC_DEVICEID_PCMPC200_AB09 0xab09 +/* + * ULi vendor ID. + */ +#define DC_VENDORID_ULI 0x10b9 + +/* + * ULi device IDs. + */ +#define DC_DEVICEID_M5261 0x5261 +#define DC_DEVICEID_M5263 0x5263 + #define DC_DEVID(vendor, device) ((device) << 16 | (vendor)) /* diff --git a/src/add-ons/kernel/drivers/network/dec21xxx/dev/dc/pnphy.c b/src/add-ons/kernel/drivers/network/dec21xxx/dev/dc/pnphy.c index 6546acdd71..98e721da2c 100644 --- a/src/add-ons/kernel/drivers/network/dec21xxx/dev/dc/pnphy.c +++ b/src/add-ons/kernel/drivers/network/dec21xxx/dev/dc/pnphy.c @@ -74,7 +74,7 @@ static device_method_t pnphy_methods[] = { DEVMETHOD(device_attach, pnphy_attach), DEVMETHOD(device_detach, mii_phy_detach), DEVMETHOD(device_shutdown, bus_generic_shutdown), - { 0, 0 } + DEVMETHOD_END }; static devclass_t pnphy_devclass; diff --git a/src/add-ons/kernel/drivers/network/dec21xxx/dev/de/dc21040reg.h b/src/add-ons/kernel/drivers/network/dec21xxx/dev/de/dc21040reg.h index 9f733f766d..c0ff191657 100644 --- a/src/add-ons/kernel/drivers/network/dec21xxx/dev/de/dc21040reg.h +++ b/src/add-ons/kernel/drivers/network/dec21xxx/dev/de/dc21040reg.h @@ -1,6 +1,6 @@ /* $NetBSD: dc21040reg.h,v 1.15 1998/05/22 18:50:59 matt Exp $ */ -/* $FreeBSD: src/sys/dev/de/dc21040reg.h,v 1.7.26.1.6.1 2010/12/21 17:09:25 kensmith Exp $ */ +/* $FreeBSD$ */ /*- * Copyright (c) 1994, 1995, 1996 Matt Thomas diff --git a/src/add-ons/kernel/drivers/network/dec21xxx/dev/de/if_de.c b/src/add-ons/kernel/drivers/network/dec21xxx/dev/de/if_de.c index cd3da4c7b3..9848c9d353 100644 --- a/src/add-ons/kernel/drivers/network/dec21xxx/dev/de/if_de.c +++ b/src/add-ons/kernel/drivers/network/dec21xxx/dev/de/if_de.c @@ -36,7 +36,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/de/if_de.c,v 1.186.2.3.4.1 2010/12/21 17:09:25 kensmith Exp $"); +__FBSDID("$FreeBSD$"); #define TULIP_HDR_DATA @@ -4496,7 +4496,8 @@ tulip_busdma_allocring(device_t dev, tulip_softc_t * const sc, size_t count, /* First, setup a tag. */ ri->ri_max = count; size = count * sizeof(tulip_desc_t); - error = bus_dma_tag_create(NULL, 32, 0, BUS_SPACE_MAXADDR_32BIT, + error = bus_dma_tag_create(bus_get_dma_tag(dev), + 32, 0, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, size, 1, size, 0, NULL, NULL, &ri->ri_ring_tag); if (error) { @@ -4524,7 +4525,7 @@ tulip_busdma_allocring(device_t dev, tulip_softc_t * const sc, size_t count, } /* Allocate a tag for the data buffers. */ - error = bus_dma_tag_create(NULL, align, 0, + error = bus_dma_tag_create(bus_get_dma_tag(dev), align, 0, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, MCLBYTES * nsegs, nsegs, MCLBYTES, 0, NULL, NULL, &ri->ri_data_tag); if (error) { @@ -4604,7 +4605,7 @@ tulip_busdma_init(device_t dev, tulip_softc_t * const sc) /* * Allocate a DMA tag, memory, and map for setup descriptor */ - error = bus_dma_tag_create(NULL, 32, 0, + error = bus_dma_tag_create(bus_get_dma_tag(dev), 32, 0, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, sizeof(sc->tulip_setupdata), 1, sizeof(sc->tulip_setupdata), 0, NULL, NULL, &sc->tulip_setup_tag); @@ -4710,7 +4711,7 @@ tulip_pci_probe(device_t dev) else name = "Digital 21140 Fast Ethernet"; break; -#ifndef __HAIKU__ +#ifndef __HAIKU__ /* * The card with the same id is supported by if_dc - screen it to * prevent duplicated dev entries. @@ -4721,7 +4722,7 @@ tulip_pci_probe(device_t dev) else name = "Digital 21142 Fast Ethernet"; break; -#endif +#endif } if (name) { device_set_desc(dev, name); diff --git a/src/add-ons/kernel/drivers/network/dec21xxx/dev/de/if_devar.h b/src/add-ons/kernel/drivers/network/dec21xxx/dev/de/if_devar.h index 12880953ed..8776be01c2 100644 --- a/src/add-ons/kernel/drivers/network/dec21xxx/dev/de/if_devar.h +++ b/src/add-ons/kernel/drivers/network/dec21xxx/dev/de/if_devar.h @@ -1,6 +1,6 @@ /* $NetBSD: if_devar.h,v 1.32 1999/04/01 14:55:25 tsubai Exp $ */ -/* $FreeBSD: src/sys/dev/de/if_devar.h,v 1.45.10.2.6.1 2010/12/21 17:09:25 kensmith Exp $ */ +/* $FreeBSD$ */ /*- * Copyright (c) 1994-1997 Matt Thomas (matt@3am-software.com) diff --git a/src/add-ons/kernel/drivers/network/dec21xxx/dev/mii/acphy.c b/src/add-ons/kernel/drivers/network/dec21xxx/dev/mii/acphy.c index df948e6cff..c61c05bf43 100644 --- a/src/add-ons/kernel/drivers/network/dec21xxx/dev/mii/acphy.c +++ b/src/add-ons/kernel/drivers/network/dec21xxx/dev/mii/acphy.c @@ -53,7 +53,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/mii/acphy.c,v 1.21.10.6.2.1 2010/12/21 17:09:25 kensmith Exp $"); +__FBSDID("$FreeBSD$"); /* * Driver for Altima AC101 10/100 PHY @@ -87,7 +87,7 @@ static device_method_t acphy_methods[] = { DEVMETHOD(device_attach, acphy_attach), DEVMETHOD(device_detach, mii_phy_detach), DEVMETHOD(device_shutdown, bus_generic_shutdown), - { 0, 0 } + DEVMETHOD_END }; static devclass_t acphy_devclass; diff --git a/src/add-ons/kernel/drivers/network/dec21xxx/dev/mii/acphyreg.h b/src/add-ons/kernel/drivers/network/dec21xxx/dev/mii/acphyreg.h index 664671aa2e..dc34010e0d 100644 --- a/src/add-ons/kernel/drivers/network/dec21xxx/dev/mii/acphyreg.h +++ b/src/add-ons/kernel/drivers/network/dec21xxx/dev/mii/acphyreg.h @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/dev/mii/acphyreg.h,v 1.2.10.1.6.1 2010/12/21 17:09:25 kensmith Exp $ + * $FreeBSD$ */ #ifndef _DEV_MII_ACPHYREG_H_ diff --git a/src/add-ons/kernel/drivers/network/dec21xxx/dev/mii/amphy.c b/src/add-ons/kernel/drivers/network/dec21xxx/dev/mii/amphy.c index 10f247bd72..bd90ccf650 100644 --- a/src/add-ons/kernel/drivers/network/dec21xxx/dev/mii/amphy.c +++ b/src/add-ons/kernel/drivers/network/dec21xxx/dev/mii/amphy.c @@ -31,7 +31,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/mii/amphy.c,v 1.24.2.5.2.1 2010/12/21 17:09:25 kensmith Exp $"); +__FBSDID("$FreeBSD$"); /* * driver for AMD AM79c873 PHYs @@ -66,7 +66,7 @@ static device_method_t amphy_methods[] = { DEVMETHOD(device_attach, amphy_attach), DEVMETHOD(device_detach, mii_phy_detach), DEVMETHOD(device_shutdown, bus_generic_shutdown), - { 0, 0 } + DEVMETHOD_END }; static devclass_t amphy_devclass; diff --git a/src/add-ons/kernel/drivers/network/dec21xxx/dev/mii/amphyreg.h b/src/add-ons/kernel/drivers/network/dec21xxx/dev/mii/amphyreg.h index 6aa82e3934..6cdbc95647 100644 --- a/src/add-ons/kernel/drivers/network/dec21xxx/dev/mii/amphyreg.h +++ b/src/add-ons/kernel/drivers/network/dec21xxx/dev/mii/amphyreg.h @@ -29,7 +29,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/sys/dev/mii/amphyreg.h,v 1.2.22.1.6.1 2010/12/21 17:09:25 kensmith Exp $ + * $FreeBSD$ */ #ifndef _DEV_MII_AMTPHYREG_H_ diff --git a/src/add-ons/kernel/drivers/network/dec21xxx/dev/mii/ukphy.c b/src/add-ons/kernel/drivers/network/dec21xxx/dev/mii/ukphy.c index 4ecfce29d3..9d52eb580c 100644 --- a/src/add-ons/kernel/drivers/network/dec21xxx/dev/mii/ukphy.c +++ b/src/add-ons/kernel/drivers/network/dec21xxx/dev/mii/ukphy.c @@ -55,7 +55,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/mii/ukphy.c,v 1.20.10.6.2.1 2010/12/21 17:09:25 kensmith Exp $"); +__FBSDID("$FreeBSD$"); /* * driver for generic unknown PHYs @@ -86,7 +86,7 @@ static device_method_t ukphy_methods[] = { DEVMETHOD(device_attach, ukphy_attach), DEVMETHOD(device_detach, mii_phy_detach), DEVMETHOD(device_shutdown, bus_generic_shutdown), - { 0, 0 } + DEVMETHOD_END }; static devclass_t ukphy_devclass; diff --git a/src/add-ons/kernel/drivers/network/dec21xxx/dev/mii/ukphy_subr.c b/src/add-ons/kernel/drivers/network/dec21xxx/dev/mii/ukphy_subr.c index 73007e197b..5f2f6341ba 100644 --- a/src/add-ons/kernel/drivers/network/dec21xxx/dev/mii/ukphy_subr.c +++ b/src/add-ons/kernel/drivers/network/dec21xxx/dev/mii/ukphy_subr.c @@ -31,7 +31,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/mii/ukphy_subr.c,v 1.10.2.4.2.1 2010/12/21 17:09:25 kensmith Exp $"); +__FBSDID("$FreeBSD$"); /* * Subroutines shared by the ukphy driver and other PHY drivers. diff --git a/src/add-ons/kernel/drivers/network/ipro100/dev/fxp/if_fxp.c b/src/add-ons/kernel/drivers/network/ipro100/dev/fxp/if_fxp.c index c0c839dd40..bcbfe1bddb 100644 --- a/src/add-ons/kernel/drivers/network/ipro100/dev/fxp/if_fxp.c +++ b/src/add-ons/kernel/drivers/network/ipro100/dev/fxp/if_fxp.c @@ -28,7 +28,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/fxp/if_fxp.c,v 1.295.2.14.2.1 2010/12/21 17:09:25 kensmith Exp $"); +__FBSDID("$FreeBSD$"); /* * Intel EtherExpress Pro/100B PCI Fast Ethernet driver @@ -194,7 +194,7 @@ static const struct fxp_ident const fxp_ident_table[] = { { 0x1229, 0x08, 0, "Intel 82559 Pro/100 Ethernet" }, { 0x1229, 0x09, 0, "Intel 82559ER Pro/100 Ethernet" }, { 0x1229, 0x0c, 0, "Intel 82550 Pro/100 Ethernet" }, - { 0x1229, 0x0d, 0, "Intel 82550 Pro/100 Ethernet" }, + { 0x1229, 0x0d, 0, "Intel 82550C Pro/100 Ethernet" }, { 0x1229, 0x0e, 0, "Intel 82550 Pro/100 Ethernet" }, { 0x1229, 0x0f, 0, "Intel 82551 Pro/100 Ethernet" }, { 0x1229, 0x10, 0, "Intel 82551 Pro/100 Ethernet" }, @@ -236,11 +236,11 @@ static int fxp_ioctl(struct ifnet *ifp, u_long command, caddr_t data); static void fxp_watchdog(struct fxp_softc *sc); static void fxp_add_rfabuf(struct fxp_softc *sc, - struct fxp_rx *rxp); + struct fxp_rx *rxp); static void fxp_discard_rfabuf(struct fxp_softc *sc, - struct fxp_rx *rxp); + struct fxp_rx *rxp); static int fxp_new_rfabuf(struct fxp_softc *sc, - struct fxp_rx *rxp); + struct fxp_rx *rxp); static int fxp_mc_addrs(struct fxp_softc *sc); static void fxp_mc_setup(struct fxp_softc *sc); static uint16_t fxp_eeprom_getword(struct fxp_softc *sc, int offset, @@ -248,6 +248,7 @@ static uint16_t fxp_eeprom_getword(struct fxp_softc *sc, int offset, static void fxp_eeprom_putword(struct fxp_softc *sc, int offset, uint16_t data); static void fxp_autosize_eeprom(struct fxp_softc *sc); +static void fxp_load_eeprom(struct fxp_softc *sc); static void fxp_read_eeprom(struct fxp_softc *sc, u_short *data, int offset, int words); static void fxp_write_eeprom(struct fxp_softc *sc, u_short *data, @@ -272,7 +273,7 @@ static int sysctl_hw_fxp_int_delay(SYSCTL_HANDLER_ARGS); static void fxp_scb_wait(struct fxp_softc *sc); static void fxp_scb_cmd(struct fxp_softc *sc, int cmd); static void fxp_dma_wait(struct fxp_softc *sc, - volatile uint16_t *status, bus_dma_tag_t dmat, + volatile uint16_t *status, bus_dma_tag_t dmat, bus_dmamap_t map); static device_method_t fxp_methods[] = { @@ -289,7 +290,7 @@ static device_method_t fxp_methods[] = { DEVMETHOD(miibus_writereg, fxp_miibus_writereg), DEVMETHOD(miibus_statchg, fxp_miibus_statchg), - { 0, 0 } + DEVMETHOD_END }; static driver_t fxp_driver = { @@ -300,8 +301,9 @@ static driver_t fxp_driver = { static devclass_t fxp_devclass; -DRIVER_MODULE(fxp, pci, fxp_driver, fxp_devclass, 0, 0); -DRIVER_MODULE(miibus, fxp, miibus_driver, miibus_devclass, 0, 0); +DRIVER_MODULE_ORDERED(fxp, pci, fxp_driver, fxp_devclass, NULL, NULL, + SI_ORDER_ANY); +DRIVER_MODULE(miibus, fxp, miibus_driver, miibus_devclass, NULL, NULL); static struct resource_spec fxp_res_spec_mem[] = { { SYS_RES_MEMORY, FXP_PCI_MMBA, RF_ACTIVE }, @@ -426,7 +428,7 @@ fxp_attach(device_t dev) struct fxp_rx *rxp; struct ifnet *ifp; uint32_t val; - uint16_t data, myea[ETHER_ADDR_LEN / 2]; + uint16_t data; u_char eaddr[ETHER_ADDR_LEN]; int error, flags, i, pmc, prefer_iomap; @@ -498,6 +500,7 @@ fxp_attach(device_t dev) * Find out how large of an SEEPROM we have. */ fxp_autosize_eeprom(sc); + fxp_load_eeprom(sc); /* * Find out the chip revision; lump all 82557 revs together. @@ -507,7 +510,7 @@ fxp_attach(device_t dev) /* Assume ICH controllers are 82559. */ sc->revision = FXP_REV_82559_A0; } else { - fxp_read_eeprom(sc, &data, 5, 1); + data = sc->eeprom[FXP_EEPROM_MAP_CNTR]; if ((data >> 8) == 1) sc->revision = FXP_REV_82557; else @@ -519,15 +522,27 @@ fxp_attach(device_t dev) */ if (sc->revision >= FXP_REV_82558_A4 && sc->revision != FXP_REV_82559S_A) { - fxp_read_eeprom(sc, &data, 10, 1); + data = sc->eeprom[FXP_EEPROM_MAP_ID]; if ((data & 0x20) != 0 && pci_find_cap(sc->dev, PCIY_PMG, &pmc) == 0) sc->flags |= FXP_FLAG_WOLCAP; } + if (sc->revision == FXP_REV_82550_C) { + /* + * 82550C with server extension requires microcode to + * receive fragmented UDP datagrams. However if the + * microcode is used for client-only featured 82550C + * it locks up controller. + */ + data = sc->eeprom[FXP_EEPROM_MAP_COMPAT]; + if ((data & 0x0400) == 0) + sc->flags |= FXP_FLAG_NO_UCODE; + } + /* Receiver lock-up workaround detection. */ if (sc->revision < FXP_REV_82558_A4) { - fxp_read_eeprom(sc, &data, 3, 1); + data = sc->eeprom[FXP_EEPROM_MAP_COMPAT]; if ((data & 0x03) != 0x03) { sc->flags |= FXP_FLAG_RXBUG; device_printf(dev, "Enabling Rx lock-up workaround\n"); @@ -537,7 +552,7 @@ fxp_attach(device_t dev) /* * Determine whether we must use the 503 serial interface. */ - fxp_read_eeprom(sc, &data, 6, 1); + data = sc->eeprom[FXP_EEPROM_MAP_PRI_PHY]; if (sc->revision == FXP_REV_82557 && (data & FXP_PHY_DEVICE_MASK) != 0 && (data & FXP_PHY_SERIAL_ONLY)) sc->flags |= FXP_FLAG_SERIAL_MEDIA; @@ -557,7 +572,7 @@ fxp_attach(device_t dev) */ if ((sc->ident->ich >= 2 && sc->ident->ich <= 3) || (sc->ident->ich == 0 && sc->revision >= FXP_REV_82559_A0)) { - fxp_read_eeprom(sc, &data, 10, 1); + data = sc->eeprom[FXP_EEPROM_MAP_ID]; if (data & 0x02) { /* STB enable */ uint16_t cksum; int i; @@ -565,27 +580,24 @@ fxp_attach(device_t dev) device_printf(dev, "Disabling dynamic standby mode in EEPROM\n"); data &= ~0x02; - fxp_write_eeprom(sc, &data, 10, 1); + sc->eeprom[FXP_EEPROM_MAP_ID] = data; + fxp_write_eeprom(sc, &data, FXP_EEPROM_MAP_ID, 1); device_printf(dev, "New EEPROM ID: 0x%x\n", data); cksum = 0; - for (i = 0; i < (1 << sc->eeprom_size) - 1; i++) { - fxp_read_eeprom(sc, &data, i, 1); - cksum += data; - } + for (i = 0; i < (1 << sc->eeprom_size) - 1; i++) + cksum += sc->eeprom[i]; i = (1 << sc->eeprom_size) - 1; cksum = 0xBABA - cksum; - fxp_read_eeprom(sc, &data, i, 1); fxp_write_eeprom(sc, &cksum, i, 1); device_printf(dev, "EEPROM checksum @ 0x%x: 0x%x -> 0x%x\n", - i, data, cksum); -#if 1 + i, sc->eeprom[i], cksum); + sc->eeprom[i] = cksum; /* * If the user elects to continue, try the software * workaround, as it is better than nothing. */ sc->flags |= FXP_FLAG_CU_RESUME_BUG; -#endif } } @@ -681,7 +693,8 @@ fxp_attach(device_t dev) goto fail; } error = bus_dmamap_load(sc->fxp_stag, sc->fxp_smap, sc->fxp_stats, - sizeof(struct fxp_stats), fxp_dma_map_addr, &sc->stats_addr, 0); + sizeof(struct fxp_stats), fxp_dma_map_addr, &sc->stats_addr, + BUS_DMA_NOWAIT); if (error) { device_printf(dev, "could not load the stats DMA buffer\n"); goto fail; @@ -705,7 +718,7 @@ fxp_attach(device_t dev) error = bus_dmamap_load(sc->cbl_tag, sc->cbl_map, sc->fxp_desc.cbl_list, FXP_TXCB_SZ, fxp_dma_map_addr, - &sc->fxp_desc.cbl_addr, 0); + &sc->fxp_desc.cbl_addr, BUS_DMA_NOWAIT); if (error) { device_printf(dev, "could not load TxCB DMA buffer\n"); goto fail; @@ -729,7 +742,8 @@ fxp_attach(device_t dev) goto fail; } error = bus_dmamap_load(sc->mcs_tag, sc->mcs_map, sc->mcsp, - sizeof(struct fxp_cb_mcs), fxp_dma_map_addr, &sc->mcs_addr, 0); + sizeof(struct fxp_cb_mcs), fxp_dma_map_addr, &sc->mcs_addr, + BUS_DMA_NOWAIT); if (error) { device_printf(dev, "can't load the multicast setup DMA buffer\n"); @@ -777,21 +791,20 @@ fxp_attach(device_t dev) /* * Read MAC address. */ - fxp_read_eeprom(sc, myea, 0, 3); - eaddr[0] = myea[0] & 0xff; - eaddr[1] = myea[0] >> 8; - eaddr[2] = myea[1] & 0xff; - eaddr[3] = myea[1] >> 8; - eaddr[4] = myea[2] & 0xff; - eaddr[5] = myea[2] >> 8; + eaddr[0] = sc->eeprom[FXP_EEPROM_MAP_IA0] & 0xff; + eaddr[1] = sc->eeprom[FXP_EEPROM_MAP_IA0] >> 8; + eaddr[2] = sc->eeprom[FXP_EEPROM_MAP_IA1] & 0xff; + eaddr[3] = sc->eeprom[FXP_EEPROM_MAP_IA1] >> 8; + eaddr[4] = sc->eeprom[FXP_EEPROM_MAP_IA2] & 0xff; + eaddr[5] = sc->eeprom[FXP_EEPROM_MAP_IA2] >> 8; if (bootverbose) { device_printf(dev, "PCI IDs: %04x %04x %04x %04x %04x\n", pci_get_vendor(dev), pci_get_device(dev), pci_get_subvendor(dev), pci_get_subdevice(dev), pci_get_revid(dev)); - fxp_read_eeprom(sc, &data, 10, 1); device_printf(dev, "Dynamic Standby mode is %s\n", - data & 0x02 ? "enabled" : "disabled"); + sc->eeprom[FXP_EEPROM_MAP_ID] & 0x02 ? "enabled" : + "disabled"); } /* @@ -900,7 +913,7 @@ fxp_attach(device_t dev) FXP_LOCK(sc); /* Clear wakeup events. */ CSR_WRITE_1(sc, FXP_CSR_PMDR, CSR_READ_1(sc, FXP_CSR_PMDR)); - fxp_init_body(sc, 1); + fxp_init_body(sc, 0); fxp_stop(sc); FXP_UNLOCK(sc); } @@ -1287,6 +1300,23 @@ fxp_write_eeprom(struct fxp_softc *sc, u_short *data, int offset, int words) fxp_eeprom_putword(sc, offset + i, data[i]); } +static void +fxp_load_eeprom(struct fxp_softc *sc) +{ + int i; + uint16_t cksum; + + fxp_read_eeprom(sc, sc->eeprom, 0, 1 << sc->eeprom_size); + cksum = 0; + for (i = 0; i < (1 << sc->eeprom_size) - 1; i++) + cksum += sc->eeprom[i]; + cksum = 0xBABA - cksum; + if (cksum != sc->eeprom[(1 << sc->eeprom_size) - 1]) + device_printf(sc->dev, + "EEPROM checksum mismatch! (0x%04x -> 0x%04x)\n", + cksum, sc->eeprom[(1 << sc->eeprom_size) - 1]); +} + /* * Grab the softc lock and call the real fxp_start_body() routine */ @@ -1454,7 +1484,7 @@ fxp_encap(struct fxp_softc *sc, struct mbuf **m_head) return (ENOBUFS); } tcp = (struct tcphdr *)(mtod(m, char *) + poff); - m = m_pullup(m, poff + sizeof(struct tcphdr) + tcp->th_off); + m = m_pullup(m, poff + (tcp->th_off << 2)); if (m == NULL) { *m_head = NULL; return (ENOBUFS); @@ -1541,7 +1571,7 @@ fxp_encap(struct fxp_softc *sc, struct mbuf **m_head) } *m_head = m; error = bus_dmamap_load_mbuf_sg(sc->fxp_txmtag, txp->tx_map, - *m_head, segs, &nseg, 0); + *m_head, segs, &nseg, 0); if (error != 0) { m_freem(*m_head); *m_head = NULL; @@ -2048,7 +2078,7 @@ fxp_update_stats(struct fxp_softc *sc) */ sc->rx_idle_secs++; } - ifp->if_ierrors += + ifp->if_ierrors += le32toh(sp->rx_crc_errors) + le32toh(sp->rx_alignment_errors) + le32toh(sp->rx_rnr_errors) + @@ -2175,7 +2205,7 @@ fxp_stop(struct fxp_softc *sc) txp = sc->fxp_desc.tx_list; if (txp != NULL) { for (i = 0; i < FXP_NTXCB; i++) { - if (txp[i].tx_mbuf != NULL) { + if (txp[i].tx_mbuf != NULL) { bus_dmamap_sync(sc->fxp_txmtag, txp[i].tx_map, BUS_DMASYNC_POSTWRITE); bus_dmamap_unload(sc->fxp_txmtag, @@ -2580,12 +2610,6 @@ fxp_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr) mii_pollstat(mii); ifmr->ifm_active = mii->mii_media_active; ifmr->ifm_status = mii->mii_media_status; - - if (IFM_SUBTYPE(ifmr->ifm_active) == IFM_10_T && - sc->flags & FXP_FLAG_CU_RESUME_BUG) - sc->cu_resume_bug = 1; - else - sc->cu_resume_bug = 0; FXP_UNLOCK(sc); } @@ -2778,6 +2802,11 @@ fxp_miibus_statchg(device_t dev) (IFM_AVALID | IFM_ACTIVE)) return; + if (IFM_SUBTYPE(mii->mii_media_active) == IFM_10_T && + sc->flags & FXP_FLAG_CU_RESUME_BUG) + sc->cu_resume_bug = 1; + else + sc->cu_resume_bug = 0; /* * Call fxp_init_body in order to adjust the flow control settings. * Note that the 82557 doesn't support hardware flow control. @@ -2808,7 +2837,7 @@ fxp_ioctl(struct ifnet *ifp, u_long command, caddr_t data) if (((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) && ((ifp->if_flags ^ sc->if_flags) & (IFF_PROMISC | IFF_ALLMULTI | IFF_LINK0)) != 0) - fxp_init_body(sc, 1); + fxp_init_body(sc, 0); else if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) fxp_init_body(sc, 1); } else { @@ -2914,7 +2943,7 @@ fxp_ioctl(struct ifnet *ifp, u_long command, caddr_t data) reinit++; } if (reinit > 0 && ifp->if_flags & IFF_UP) - fxp_init_body(sc, 1); + fxp_init_body(sc, 0); FXP_UNLOCK(sc); VLAN_CAPABILITIES(ifp); break; @@ -3012,10 +3041,8 @@ static uint32_t fxp_ucode_d101a[] = D101_A_RCVBUNDLE_UCODE; static uint32_t fxp_ucode_d101b0[] = D101_B0_RCVBUNDLE_UCODE; static uint32_t fxp_ucode_d101ma[] = D101M_B_RCVBUNDLE_UCODE; static uint32_t fxp_ucode_d101s[] = D101S_RCVBUNDLE_UCODE; -#ifdef notyet static uint32_t fxp_ucode_d102[] = D102_B_RCVBUNDLE_UCODE; static uint32_t fxp_ucode_d102c[] = D102_C_RCVBUNDLE_UCODE; -#endif static uint32_t fxp_ucode_d102e[] = D102_E_RCVBUNDLE_UCODE; #define UCODE(x) x, sizeof(x)/sizeof(uint32_t) @@ -3033,12 +3060,10 @@ static const struct ucode { D101M_CPUSAVER_DWORD, D101M_CPUSAVER_BUNDLE_MAX_DWORD }, { FXP_REV_82559S_A, UCODE(fxp_ucode_d101s), D101S_CPUSAVER_DWORD, D101S_CPUSAVER_BUNDLE_MAX_DWORD }, -#ifdef notyet { FXP_REV_82550, UCODE(fxp_ucode_d102), D102_B_CPUSAVER_DWORD, D102_B_CPUSAVER_BUNDLE_MAX_DWORD }, { FXP_REV_82550_C, UCODE(fxp_ucode_d102c), D102_C_CPUSAVER_DWORD, D102_C_CPUSAVER_BUNDLE_MAX_DWORD }, -#endif { FXP_REV_82551_F, UCODE(fxp_ucode_d102e), D102_E_CPUSAVER_DWORD, D102_E_CPUSAVER_BUNDLE_MAX_DWORD }, { FXP_REV_82551_10, UCODE(fxp_ucode_d102e), @@ -3053,6 +3078,9 @@ fxp_load_ucode(struct fxp_softc *sc) struct fxp_cb_ucode *cbp; int i; + if (sc->flags & FXP_FLAG_NO_UCODE) + return; + for (uc = ucode_table; uc->ucode != NULL; uc++) if (sc->revision == uc->revision) break; @@ -3085,6 +3113,7 @@ fxp_load_ucode(struct fxp_softc *sc) sc->tunable_int_delay, uc->bundle_max_offset == 0 ? 0 : sc->tunable_bundle_max); sc->flags |= FXP_FLAG_UCODE; + bzero(cbp, FXP_TXCB_SZ); } #define FXP_SYSCTL_STAT_ADD(c, h, n, p, d) \ diff --git a/src/add-ons/kernel/drivers/network/ipro100/dev/fxp/if_fxpreg.h b/src/add-ons/kernel/drivers/network/ipro100/dev/fxp/if_fxpreg.h index e2b1e3f498..cc764b54b2 100644 --- a/src/add-ons/kernel/drivers/network/ipro100/dev/fxp/if_fxpreg.h +++ b/src/add-ons/kernel/drivers/network/ipro100/dev/fxp/if_fxpreg.h @@ -25,7 +25,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/dev/fxp/if_fxpreg.h,v 1.43.2.3.2.1 2010/12/21 17:09:25 kensmith Exp $ + * $FreeBSD$ */ #define FXP_VENDORID_INTEL 0x8086 @@ -447,6 +447,24 @@ struct fxp_stats { #define FXP_EEPROM_OPC_WRITE 0x5 #define FXP_EEPROM_OPC_READ 0x6 +/* + * EEPROM map + */ +#define FXP_EEPROM_MAP_IA0 0x00 /* Station address */ +#define FXP_EEPROM_MAP_IA1 0x01 +#define FXP_EEPROM_MAP_IA2 0x02 +#define FXP_EEPROM_MAP_COMPAT 0x03 /* Compatibility */ +#define FXP_EEPROM_MAP_CNTR 0x05 /* Controller/connector type */ +#define FXP_EEPROM_MAP_PRI_PHY 0x06 /* Primary PHY record */ +#define FXP_EEPROM_MAP_SEC_PHY 0x07 /* Secondary PHY record */ +#define FXP_EEPROM_MAP_PWA0 0x08 /* Printed wire assembly num. */ +#define FXP_EEPROM_MAP_PWA1 0x09 /* Printed wire assembly num. */ +#define FXP_EEPROM_MAP_ID 0x0A /* EEPROM ID */ +#define FXP_EEPROM_MAP_SUBSYS 0x0B /* Subsystem ID */ +#define FXP_EEPROM_MAP_SUBVEN 0x0C /* Subsystem vendor ID */ +#define FXP_EEPROM_MAP_CKSUM64 0x3F /* 64-word EEPROM checksum */ +#define FXP_EEPROM_MAP_CKSUM256 0xFF /* 256-word EEPROM checksum */ + /* * Management Data Interface opcodes */ diff --git a/src/add-ons/kernel/drivers/network/ipro100/dev/fxp/if_fxpvar.h b/src/add-ons/kernel/drivers/network/ipro100/dev/fxp/if_fxpvar.h index 3d6ba30aad..253c4ff1ec 100644 --- a/src/add-ons/kernel/drivers/network/ipro100/dev/fxp/if_fxpvar.h +++ b/src/add-ons/kernel/drivers/network/ipro100/dev/fxp/if_fxpvar.h @@ -24,7 +24,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/dev/fxp/if_fxpvar.h,v 1.49.2.4.2.1 2010/12/21 17:09:25 kensmith Exp $ + * $FreeBSD$ */ /* @@ -219,6 +219,7 @@ struct fxp_softc { int if_flags; uint8_t rfa_size; uint32_t tx_cmd; + uint16_t eeprom[256]; }; #define FXP_FLAG_MWI_ENABLE 0x0001 /* MWI enable */ @@ -236,6 +237,7 @@ struct fxp_softc { #define FXP_FLAG_WOLCAP 0x2000 /* WOL capability */ #define FXP_FLAG_WOL 0x4000 /* WOL active */ #define FXP_FLAG_RXBUG 0x8000 /* Rx lock-up bug */ +#define FXP_FLAG_NO_UCODE 0x10000 /* ucode is not applicable */ /* Macros to ease CSR access. */ #define CSR_READ_1(sc, reg) bus_read_1(sc->fxp_res[0], reg) diff --git a/src/add-ons/kernel/drivers/network/ipro100/dev/fxp/inphy.c b/src/add-ons/kernel/drivers/network/ipro100/dev/fxp/inphy.c index b9e40a103e..587f3fd625 100644 --- a/src/add-ons/kernel/drivers/network/ipro100/dev/fxp/inphy.c +++ b/src/add-ons/kernel/drivers/network/ipro100/dev/fxp/inphy.c @@ -29,7 +29,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/mii/inphy.c,v 1.17.10.7.2.1 2010/12/21 17:09:25 kensmith Exp $"); +__FBSDID("$FreeBSD$"); /* * driver for Intel 82553 and 82555 PHYs diff --git a/src/add-ons/kernel/drivers/network/ipro100/dev/fxp/inphyreg.h b/src/add-ons/kernel/drivers/network/ipro100/dev/fxp/inphyreg.h index 33d9ad874e..42c683dbf1 100644 --- a/src/add-ons/kernel/drivers/network/ipro100/dev/fxp/inphyreg.h +++ b/src/add-ons/kernel/drivers/network/ipro100/dev/fxp/inphyreg.h @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/dev/mii/inphyreg.h,v 1.1.38.1.6.1 2010/12/21 17:09:25 kensmith Exp $ + * $FreeBSD$ */ #ifndef _INPHYREG_H diff --git a/src/add-ons/kernel/drivers/network/ipro100/dev/fxp/rcvbundl.h b/src/add-ons/kernel/drivers/network/ipro100/dev/fxp/rcvbundl.h index 39e70e96e2..2510f420b6 100644 --- a/src/add-ons/kernel/drivers/network/ipro100/dev/fxp/rcvbundl.h +++ b/src/add-ons/kernel/drivers/network/ipro100/dev/fxp/rcvbundl.h @@ -29,7 +29,7 @@ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* - * $FreeBSD: src/sys/dev/fxp/rcvbundl.h,v 1.3.22.1.6.1 2010/12/21 17:09:25 kensmith Exp $ + * $FreeBSD$ */ /* rcvbundl.h diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/Jamfile b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/Jamfile index 3f8ea6f32c..cca75a3218 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/Jamfile +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/Jamfile @@ -18,6 +18,7 @@ KernelAddon ipro1000 : e1000_82571.c e1000_82575.c e1000_api.c + e1000_i210.c e1000_ich8lan.c e1000_mac.c e1000_manage.c diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/LICENSE b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/LICENSE index 3417b58c52..f70a7cbd4a 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/LICENSE +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/LICENSE @@ -1,4 +1,4 @@ -$FreeBSD: src/sys/dev/e1000/LICENSE,v 1.1.4.2.4.1 2010/12/21 17:09:25 kensmith Exp $ +$FreeBSD$ Copyright (c) 2001-2010, Intel Corporation All rights reserved. diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/README b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/README index 6eb6512f55..88879e1840 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/README +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/README @@ -1,4 +1,4 @@ -$FreeBSD: src/sys/dev/e1000/README,v 1.1.4.1.6.1 2010/12/21 17:09:25 kensmith Exp $ +$FreeBSD$ FreeBSD* Driver for Intel Network Connection ============================================= @@ -354,6 +354,7 @@ Known Limitations include: Planex FXG-08TE I-O Data ETG-SH8 + Netgear GS105v3 The driver can be compiled with the following changes: diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_80003es2lan.c b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_80003es2lan.c index 335f075420..bdbb31cfdb 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_80003es2lan.c +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_80003es2lan.c @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2010, Intel Corporation + Copyright (c) 2001-2011, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -30,7 +30,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: src/sys/dev/e1000/e1000_80003es2lan.c,v 1.3.2.2.4.1 2010/12/21 17:09:25 kensmith Exp $*/ +/*$FreeBSD$*/ /* * 80003ES2LAN Gigabit Ethernet Controller (Copper) @@ -47,18 +47,18 @@ static void e1000_release_phy_80003es2lan(struct e1000_hw *hw); static s32 e1000_acquire_nvm_80003es2lan(struct e1000_hw *hw); static void e1000_release_nvm_80003es2lan(struct e1000_hw *hw); static s32 e1000_read_phy_reg_gg82563_80003es2lan(struct e1000_hw *hw, - u32 offset, - u16 *data); + u32 offset, + u16 *data); static s32 e1000_write_phy_reg_gg82563_80003es2lan(struct e1000_hw *hw, - u32 offset, - u16 data); + u32 offset, + u16 data); static s32 e1000_write_nvm_80003es2lan(struct e1000_hw *hw, u16 offset, - u16 words, u16 *data); + u16 words, u16 *data); static s32 e1000_get_cfg_done_80003es2lan(struct e1000_hw *hw); static s32 e1000_phy_force_speed_duplex_80003es2lan(struct e1000_hw *hw); static s32 e1000_get_cable_length_80003es2lan(struct e1000_hw *hw); static s32 e1000_get_link_up_info_80003es2lan(struct e1000_hw *hw, u16 *speed, - u16 *duplex); + u16 *duplex); static s32 e1000_reset_hw_80003es2lan(struct e1000_hw *hw); static s32 e1000_init_hw_80003es2lan(struct e1000_hw *hw); static s32 e1000_setup_copper_link_80003es2lan(struct e1000_hw *hw); @@ -68,9 +68,9 @@ static s32 e1000_cfg_kmrn_10_100_80003es2lan(struct e1000_hw *hw, u16 duplex); static s32 e1000_cfg_kmrn_1000_80003es2lan(struct e1000_hw *hw); static s32 e1000_cfg_on_link_up_80003es2lan(struct e1000_hw *hw); static s32 e1000_read_kmrn_reg_80003es2lan(struct e1000_hw *hw, u32 offset, - u16 *data); + u16 *data); static s32 e1000_write_kmrn_reg_80003es2lan(struct e1000_hw *hw, u32 offset, - u16 data); + u16 data); static s32 e1000_copper_link_setup_gg82563_80003es2lan(struct e1000_hw *hw); static void e1000_initialize_hw_bits_80003es2lan(struct e1000_hw *hw); static void e1000_release_swfw_sync_80003es2lan(struct e1000_hw *hw, u16 mask); @@ -85,8 +85,8 @@ static void e1000_power_down_phy_copper_80003es2lan(struct e1000_hw *hw); static const u16 e1000_gg82563_cable_length_table[] = { 0, 60, 115, 150, 150, 60, 115, 150, 180, 180, 0xFF }; #define GG82563_CABLE_LENGTH_TABLE_SIZE \ - (sizeof(e1000_gg82563_cable_length_table) / \ - sizeof(e1000_gg82563_cable_length_table[0])) + (sizeof(e1000_gg82563_cable_length_table) / \ + sizeof(e1000_gg82563_cable_length_table[0])) /** * e1000_init_phy_params_80003es2lan - Init ESB2 PHY func ptrs. @@ -100,34 +100,34 @@ static s32 e1000_init_phy_params_80003es2lan(struct e1000_hw *hw) DEBUGFUNC("e1000_init_phy_params_80003es2lan"); if (hw->phy.media_type != e1000_media_type_copper) { - phy->type = e1000_phy_none; + phy->type = e1000_phy_none; goto out; } else { phy->ops.power_up = e1000_power_up_phy_copper; phy->ops.power_down = e1000_power_down_phy_copper_80003es2lan; } - phy->addr = 1; - phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT; - phy->reset_delay_us = 100; - phy->type = e1000_phy_gg82563; + phy->addr = 1; + phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT; + phy->reset_delay_us = 100; + phy->type = e1000_phy_gg82563; - phy->ops.acquire = e1000_acquire_phy_80003es2lan; - phy->ops.check_polarity = e1000_check_polarity_m88; - phy->ops.check_reset_block = e1000_check_reset_block_generic; - phy->ops.commit = e1000_phy_sw_reset_generic; - phy->ops.get_cfg_done = e1000_get_cfg_done_80003es2lan; - phy->ops.get_info = e1000_get_phy_info_m88; - phy->ops.release = e1000_release_phy_80003es2lan; - phy->ops.reset = e1000_phy_hw_reset_generic; - phy->ops.set_d3_lplu_state = e1000_set_d3_lplu_state_generic; + phy->ops.acquire = e1000_acquire_phy_80003es2lan; + phy->ops.check_polarity = e1000_check_polarity_m88; + phy->ops.check_reset_block = e1000_check_reset_block_generic; + phy->ops.commit = e1000_phy_sw_reset_generic; + phy->ops.get_cfg_done = e1000_get_cfg_done_80003es2lan; + phy->ops.get_info = e1000_get_phy_info_m88; + phy->ops.release = e1000_release_phy_80003es2lan; + phy->ops.reset = e1000_phy_hw_reset_generic; + phy->ops.set_d3_lplu_state = e1000_set_d3_lplu_state_generic; phy->ops.force_speed_duplex = e1000_phy_force_speed_duplex_80003es2lan; - phy->ops.get_cable_length = e1000_get_cable_length_80003es2lan; - phy->ops.read_reg = e1000_read_phy_reg_gg82563_80003es2lan; - phy->ops.write_reg = e1000_write_phy_reg_gg82563_80003es2lan; + phy->ops.get_cable_length = e1000_get_cable_length_80003es2lan; + phy->ops.read_reg = e1000_read_phy_reg_gg82563_80003es2lan; + phy->ops.write_reg = e1000_write_phy_reg_gg82563_80003es2lan; - phy->ops.cfg_on_link_up = e1000_cfg_on_link_up_80003es2lan; + phy->ops.cfg_on_link_up = e1000_cfg_on_link_up_80003es2lan; /* This can only be done after all function pointers are setup. */ ret_val = e1000_get_phy_id(hw); @@ -154,19 +154,19 @@ static s32 e1000_init_nvm_params_80003es2lan(struct e1000_hw *hw) DEBUGFUNC("e1000_init_nvm_params_80003es2lan"); - nvm->opcode_bits = 8; - nvm->delay_usec = 1; + nvm->opcode_bits = 8; + nvm->delay_usec = 1; switch (nvm->override) { case e1000_nvm_override_spi_large: - nvm->page_size = 32; + nvm->page_size = 32; nvm->address_bits = 16; break; case e1000_nvm_override_spi_small: - nvm->page_size = 8; + nvm->page_size = 8; nvm->address_bits = 8; break; default: - nvm->page_size = eecd & E1000_EECD_ADDR_BITS ? 32 : 8; + nvm->page_size = eecd & E1000_EECD_ADDR_BITS ? 32 : 8; nvm->address_bits = eecd & E1000_EECD_ADDR_BITS ? 16 : 8; break; } @@ -174,7 +174,7 @@ static s32 e1000_init_nvm_params_80003es2lan(struct e1000_hw *hw) nvm->type = e1000_nvm_eeprom_spi; size = (u16)((eecd & E1000_EECD_SIZE_EX_MASK) >> - E1000_EECD_SIZE_EX_SHIFT); + E1000_EECD_SIZE_EX_SHIFT); /* * Added to a constant, "size" becomes the left-shift value @@ -185,16 +185,16 @@ static s32 e1000_init_nvm_params_80003es2lan(struct e1000_hw *hw) /* EEPROM access above 16k is unsupported */ if (size > 14) size = 14; - nvm->word_size = 1 << size; + nvm->word_size = 1 << size; /* Function Pointers */ - nvm->ops.acquire = e1000_acquire_nvm_80003es2lan; - nvm->ops.read = e1000_read_nvm_eerd; - nvm->ops.release = e1000_release_nvm_80003es2lan; - nvm->ops.update = e1000_update_nvm_checksum_generic; + nvm->ops.acquire = e1000_acquire_nvm_80003es2lan; + nvm->ops.read = e1000_read_nvm_eerd; + nvm->ops.release = e1000_release_nvm_80003es2lan; + nvm->ops.update = e1000_update_nvm_checksum_generic; nvm->ops.valid_led_default = e1000_valid_led_default_generic; - nvm->ops.validate = e1000_validate_nvm_checksum_generic; - nvm->ops.write = e1000_write_nvm_80003es2lan; + nvm->ops.validate = e1000_validate_nvm_checksum_generic; + nvm->ops.write = e1000_write_nvm_80003es2lan; return E1000_SUCCESS; } @@ -215,13 +215,13 @@ static s32 e1000_init_mac_params_80003es2lan(struct e1000_hw *hw) hw->phy.media_type = e1000_media_type_internal_serdes; mac->ops.check_for_link = e1000_check_for_serdes_link_generic; mac->ops.setup_physical_interface = - e1000_setup_fiber_serdes_link_generic; + e1000_setup_fiber_serdes_link_generic; break; default: hw->phy.media_type = e1000_media_type_copper; mac->ops.check_for_link = e1000_check_for_copper_link_generic; mac->ops.setup_physical_interface = - e1000_setup_copper_link_80003es2lan; + e1000_setup_copper_link_80003es2lan; break; } @@ -234,9 +234,8 @@ static s32 e1000_init_mac_params_80003es2lan(struct e1000_hw *hw) /* FWSM register */ mac->has_fwsm = TRUE; /* ARC supported; valid only if manageability features are enabled. */ - mac->arc_subsystem_valid = - (E1000_READ_REG(hw, E1000_FWSM) & E1000_FWSM_MODE_MASK) - ? TRUE : FALSE; + mac->arc_subsystem_valid = (E1000_READ_REG(hw, E1000_FWSM) & + E1000_FWSM_MODE_MASK) ? TRUE : FALSE; /* Adaptive IFS not supported */ mac->adaptive_ifs = FALSE; @@ -330,7 +329,7 @@ static void e1000_release_phy_80003es2lan(struct e1000_hw *hw) } /** - * e1000_acquire_mac_csr_80003es2lan - Acquire rights to access Kumeran register + * e1000_acquire_mac_csr_80003es2lan - Acquire right to access Kumeran register * @hw: pointer to the HW structure * * Acquire the semaphore to access the Kumeran interface. @@ -348,7 +347,7 @@ static s32 e1000_acquire_mac_csr_80003es2lan(struct e1000_hw *hw) } /** - * e1000_release_mac_csr_80003es2lan - Release rights to access Kumeran Register + * e1000_release_mac_csr_80003es2lan - Release right to access Kumeran Register * @hw: pointer to the HW structure * * Release the semaphore used to access the Kumeran interface @@ -488,7 +487,7 @@ static void e1000_release_swfw_sync_80003es2lan(struct e1000_hw *hw, u16 mask) * Read the GG82563 PHY register. **/ static s32 e1000_read_phy_reg_gg82563_80003es2lan(struct e1000_hw *hw, - u32 offset, u16 *data) + u32 offset, u16 *data) { s32 ret_val; u32 page_select; @@ -538,14 +537,14 @@ static s32 e1000_read_phy_reg_gg82563_80003es2lan(struct e1000_hw *hw, usec_delay(200); ret_val = e1000_read_phy_reg_mdic(hw, - MAX_PHY_REG_ADDRESS & offset, - data); + MAX_PHY_REG_ADDRESS & offset, + data); usec_delay(200); } else { ret_val = e1000_read_phy_reg_mdic(hw, - MAX_PHY_REG_ADDRESS & offset, - data); + MAX_PHY_REG_ADDRESS & offset, + data); } e1000_release_phy_80003es2lan(hw); @@ -563,7 +562,7 @@ out: * Write to the GG82563 PHY register. **/ static s32 e1000_write_phy_reg_gg82563_80003es2lan(struct e1000_hw *hw, - u32 offset, u16 data) + u32 offset, u16 data) { s32 ret_val; u32 page_select; @@ -613,14 +612,14 @@ static s32 e1000_write_phy_reg_gg82563_80003es2lan(struct e1000_hw *hw, usec_delay(200); ret_val = e1000_write_phy_reg_mdic(hw, - MAX_PHY_REG_ADDRESS & offset, - data); + MAX_PHY_REG_ADDRESS & offset, + data); usec_delay(200); } else { ret_val = e1000_write_phy_reg_mdic(hw, - MAX_PHY_REG_ADDRESS & offset, - data); + MAX_PHY_REG_ADDRESS & offset, + data); } e1000_release_phy_80003es2lan(hw); @@ -639,7 +638,7 @@ out: * Write "words" of data to the ESB2 NVM. **/ static s32 e1000_write_nvm_80003es2lan(struct e1000_hw *hw, u16 offset, - u16 words, u16 *data) + u16 words, u16 *data) { DEBUGFUNC("e1000_write_nvm_80003es2lan"); @@ -729,11 +728,10 @@ static s32 e1000_phy_force_speed_duplex_80003es2lan(struct e1000_hw *hw) usec_delay(1); if (hw->phy.autoneg_wait_to_complete) { - DEBUGOUT("Waiting for forced speed/duplex link " - "on GG82563 phy.\n"); + DEBUGOUT("Waiting for forced speed/duplex link on GG82563 phy.\n"); ret_val = e1000_phy_has_link_generic(hw, PHY_FORCE_LIMIT, - 100000, &link); + 100000, &link); if (ret_val) goto out; @@ -749,12 +747,13 @@ static s32 e1000_phy_force_speed_duplex_80003es2lan(struct e1000_hw *hw) /* Try once more */ ret_val = e1000_phy_has_link_generic(hw, PHY_FORCE_LIMIT, - 100000, &link); + 100000, &link); if (ret_val) goto out; } - ret_val = hw->phy.ops.read_reg(hw, GG82563_PHY_MAC_SPEC_CTRL, &phy_data); + ret_val = hw->phy.ops.read_reg(hw, GG82563_PHY_MAC_SPEC_CTRL, + &phy_data); if (ret_val) goto out; @@ -773,7 +772,8 @@ static s32 e1000_phy_force_speed_duplex_80003es2lan(struct e1000_hw *hw) * duplex. */ phy_data |= GG82563_MSCR_ASSERT_CRS_ON_TX; - ret_val = hw->phy.ops.write_reg(hw, GG82563_PHY_MAC_SPEC_CTRL, phy_data); + ret_val = hw->phy.ops.write_reg(hw, GG82563_PHY_MAC_SPEC_CTRL, + phy_data); out: return ret_val; @@ -826,21 +826,20 @@ out: * Retrieve the current speed and duplex configuration. **/ static s32 e1000_get_link_up_info_80003es2lan(struct e1000_hw *hw, u16 *speed, - u16 *duplex) + u16 *duplex) { s32 ret_val; DEBUGFUNC("e1000_get_link_up_info_80003es2lan"); if (hw->phy.media_type == e1000_media_type_copper) { - ret_val = e1000_get_speed_and_duplex_copper_generic(hw, - speed, - duplex); + ret_val = e1000_get_speed_and_duplex_copper_generic(hw, speed, + duplex); hw->phy.ops.cfg_on_link_up(hw); } else { ret_val = e1000_get_speed_and_duplex_fiber_serdes_generic(hw, - speed, - duplex); + speed, + duplex); } return ret_val; @@ -939,21 +938,21 @@ static s32 e1000_init_hw_80003es2lan(struct e1000_hw *hw) /* Disable IBIST slave mode (far-end loopback) */ e1000_read_kmrn_reg_80003es2lan(hw, E1000_KMRNCTRLSTA_INBAND_PARAM, - &kum_reg_data); + &kum_reg_data); kum_reg_data |= E1000_KMRNCTRLSTA_IBIST_DISABLE; e1000_write_kmrn_reg_80003es2lan(hw, E1000_KMRNCTRLSTA_INBAND_PARAM, - kum_reg_data); + kum_reg_data); /* Set the transmit descriptor write-back policy */ reg_data = E1000_READ_REG(hw, E1000_TXDCTL(0)); reg_data = (reg_data & ~E1000_TXDCTL_WTHRESH) | - E1000_TXDCTL_FULL_TX_DESC_WB | E1000_TXDCTL_COUNT_DESC; + E1000_TXDCTL_FULL_TX_DESC_WB | E1000_TXDCTL_COUNT_DESC; E1000_WRITE_REG(hw, E1000_TXDCTL(0), reg_data); /* ...for both queues. */ reg_data = E1000_READ_REG(hw, E1000_TXDCTL(1)); reg_data = (reg_data & ~E1000_TXDCTL_WTHRESH) | - E1000_TXDCTL_FULL_TX_DESC_WB | E1000_TXDCTL_COUNT_DESC; + E1000_TXDCTL_FULL_TX_DESC_WB | E1000_TXDCTL_COUNT_DESC; E1000_WRITE_REG(hw, E1000_TXDCTL(1), reg_data); /* Enable retransmit on late collisions */ @@ -981,9 +980,9 @@ static s32 e1000_init_hw_80003es2lan(struct e1000_hw *hw) hw->dev_spec._80003es2lan.mdic_wa_enable = TRUE; ret_val = e1000_read_kmrn_reg_80003es2lan(hw, - E1000_KMRNCTRLSTA_OFFSET >> - E1000_KMRNCTRLSTA_OFFSET_SHIFT, - &i); + E1000_KMRNCTRLSTA_OFFSET >> + E1000_KMRNCTRLSTA_OFFSET_SHIFT, + &i); if (!ret_val) { if ((i & E1000_KMRNCTRLSTA_OPMODE_MASK) == E1000_KMRNCTRLSTA_OPMODE_INBAND_MDIO) @@ -1056,11 +1055,7 @@ static s32 e1000_copper_link_setup_gg82563_80003es2lan(struct e1000_hw *hw) DEBUGFUNC("e1000_copper_link_setup_gg82563_80003es2lan"); - if (phy->reset_disable) - goto skip_reset; - - ret_val = hw->phy.ops.read_reg(hw, GG82563_PHY_MAC_SPEC_CTRL, - &data); + ret_val = hw->phy.ops.read_reg(hw, GG82563_PHY_MAC_SPEC_CTRL, &data); if (ret_val) goto out; @@ -1068,8 +1063,7 @@ static s32 e1000_copper_link_setup_gg82563_80003es2lan(struct e1000_hw *hw) /* Use 25MHz for both link down and 1000Base-T for Tx clock. */ data |= GG82563_MSCR_TX_CLK_1000MBPS_25; - ret_val = hw->phy.ops.write_reg(hw, GG82563_PHY_MAC_SPEC_CTRL, - data); + ret_val = hw->phy.ops.write_reg(hw, GG82563_PHY_MAC_SPEC_CTRL, data); if (ret_val) goto out; @@ -1122,7 +1116,6 @@ static s32 e1000_copper_link_setup_gg82563_80003es2lan(struct e1000_hw *hw) goto out; } -skip_reset: /* Bypass Rx and Tx FIFO's */ ret_val = e1000_write_kmrn_reg_80003es2lan(hw, E1000_KMRNCTRLSTA_OFFSET_FIFO_CTRL, @@ -1132,14 +1125,12 @@ skip_reset: goto out; ret_val = e1000_read_kmrn_reg_80003es2lan(hw, - E1000_KMRNCTRLSTA_OFFSET_MAC2PHY_OPMODE, - &data); + E1000_KMRNCTRLSTA_OFFSET_MAC2PHY_OPMODE, &data); if (ret_val) goto out; data |= E1000_KMRNCTRLSTA_OPMODE_E_IDLE; ret_val = e1000_write_kmrn_reg_80003es2lan(hw, - E1000_KMRNCTRLSTA_OFFSET_MAC2PHY_OPMODE, - data); + E1000_KMRNCTRLSTA_OFFSET_MAC2PHY_OPMODE, data); if (ret_val) goto out; @@ -1169,18 +1160,18 @@ skip_reset: /* Enable Electrical Idle on the PHY */ data |= GG82563_PMCR_ENABLE_ELECTRICAL_IDLE; ret_val = hw->phy.ops.write_reg(hw, GG82563_PHY_PWR_MGMT_CTRL, - data); + data); if (ret_val) goto out; ret_val = hw->phy.ops.read_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, - &data); + &data); if (ret_val) goto out; data &= ~GG82563_KMCR_PASS_FALSE_CARRIER; ret_val = hw->phy.ops.write_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, - data); + data); if (ret_val) goto out; } @@ -1228,27 +1219,25 @@ static s32 e1000_setup_copper_link_80003es2lan(struct e1000_hw *hw) * polling the phy; this fixes erroneous timeouts at 10Mbps. */ ret_val = e1000_write_kmrn_reg_80003es2lan(hw, GG82563_REG(0x34, 4), - 0xFFFF); + 0xFFFF); if (ret_val) goto out; ret_val = e1000_read_kmrn_reg_80003es2lan(hw, GG82563_REG(0x34, 9), - ®_data); + ®_data); if (ret_val) goto out; reg_data |= 0x3F; ret_val = e1000_write_kmrn_reg_80003es2lan(hw, GG82563_REG(0x34, 9), - reg_data); + reg_data); if (ret_val) goto out; ret_val = e1000_read_kmrn_reg_80003es2lan(hw, - E1000_KMRNCTRLSTA_OFFSET_INB_CTRL, - ®_data); + E1000_KMRNCTRLSTA_OFFSET_INB_CTRL, ®_data); if (ret_val) goto out; reg_data |= E1000_KMRNCTRLSTA_INB_CTRL_DIS_PADDING; ret_val = e1000_write_kmrn_reg_80003es2lan(hw, - E1000_KMRNCTRLSTA_OFFSET_INB_CTRL, - reg_data); + E1000_KMRNCTRLSTA_OFFSET_INB_CTRL, reg_data); if (ret_val) goto out; @@ -1279,9 +1268,8 @@ static s32 e1000_cfg_on_link_up_80003es2lan(struct e1000_hw *hw) DEBUGFUNC("e1000_configure_on_link_up"); if (hw->phy.media_type == e1000_media_type_copper) { - ret_val = e1000_get_speed_and_duplex_copper_generic(hw, - &speed, - &duplex); + ret_val = e1000_get_speed_and_duplex_copper_generic(hw, &speed, + &duplex); if (ret_val) goto out; @@ -1314,8 +1302,8 @@ static s32 e1000_cfg_kmrn_10_100_80003es2lan(struct e1000_hw *hw, u16 duplex) reg_data = E1000_KMRNCTRLSTA_HD_CTRL_10_100_DEFAULT; ret_val = e1000_write_kmrn_reg_80003es2lan(hw, - E1000_KMRNCTRLSTA_OFFSET_HD_CTRL, - reg_data); + E1000_KMRNCTRLSTA_OFFSET_HD_CTRL, + reg_data); if (ret_val) goto out; @@ -1327,12 +1315,12 @@ static s32 e1000_cfg_kmrn_10_100_80003es2lan(struct e1000_hw *hw, u16 duplex) do { ret_val = hw->phy.ops.read_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, - ®_data); + ®_data); if (ret_val) goto out; ret_val = hw->phy.ops.read_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, - ®_data2); + ®_data2); if (ret_val) goto out; i++; @@ -1343,7 +1331,8 @@ static s32 e1000_cfg_kmrn_10_100_80003es2lan(struct e1000_hw *hw, u16 duplex) else reg_data &= ~GG82563_KMCR_PASS_FALSE_CARRIER; - ret_val = hw->phy.ops.write_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, reg_data); + ret_val = hw->phy.ops.write_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, + reg_data); out: return ret_val; @@ -1367,8 +1356,7 @@ static s32 e1000_cfg_kmrn_1000_80003es2lan(struct e1000_hw *hw) reg_data = E1000_KMRNCTRLSTA_HD_CTRL_1000_DEFAULT; ret_val = e1000_write_kmrn_reg_80003es2lan(hw, - E1000_KMRNCTRLSTA_OFFSET_HD_CTRL, - reg_data); + E1000_KMRNCTRLSTA_OFFSET_HD_CTRL, reg_data); if (ret_val) goto out; @@ -1380,19 +1368,20 @@ static s32 e1000_cfg_kmrn_1000_80003es2lan(struct e1000_hw *hw) do { ret_val = hw->phy.ops.read_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, - ®_data); + ®_data); if (ret_val) goto out; ret_val = hw->phy.ops.read_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, - ®_data2); + ®_data2); if (ret_val) goto out; i++; } while ((reg_data != reg_data2) && (i < GG82563_MAX_KMRN_RETRY)); reg_data &= ~GG82563_KMCR_PASS_FALSE_CARRIER; - ret_val = hw->phy.ops.write_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, reg_data); + ret_val = hw->phy.ops.write_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, + reg_data); out: return ret_val; @@ -1409,7 +1398,7 @@ out: * Release the semaphore before exiting. **/ static s32 e1000_read_kmrn_reg_80003es2lan(struct e1000_hw *hw, u32 offset, - u16 *data) + u16 *data) { u32 kmrnctrlsta; s32 ret_val = E1000_SUCCESS; @@ -1421,8 +1410,9 @@ static s32 e1000_read_kmrn_reg_80003es2lan(struct e1000_hw *hw, u32 offset, goto out; kmrnctrlsta = ((offset << E1000_KMRNCTRLSTA_OFFSET_SHIFT) & - E1000_KMRNCTRLSTA_OFFSET) | E1000_KMRNCTRLSTA_REN; + E1000_KMRNCTRLSTA_OFFSET) | E1000_KMRNCTRLSTA_REN; E1000_WRITE_REG(hw, E1000_KMRNCTRLSTA, kmrnctrlsta); + E1000_WRITE_FLUSH(hw); usec_delay(2); @@ -1446,7 +1436,7 @@ out: * before exiting. **/ static s32 e1000_write_kmrn_reg_80003es2lan(struct e1000_hw *hw, u32 offset, - u16 data) + u16 data) { u32 kmrnctrlsta; s32 ret_val = E1000_SUCCESS; @@ -1458,8 +1448,9 @@ static s32 e1000_write_kmrn_reg_80003es2lan(struct e1000_hw *hw, u32 offset, goto out; kmrnctrlsta = ((offset << E1000_KMRNCTRLSTA_OFFSET_SHIFT) & - E1000_KMRNCTRLSTA_OFFSET) | data; + E1000_KMRNCTRLSTA_OFFSET) | data; E1000_WRITE_REG(hw, E1000_KMRNCTRLSTA, kmrnctrlsta); + E1000_WRITE_FLUSH(hw); usec_delay(2); diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_80003es2lan.h b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_80003es2lan.h index b685f37dcc..157468e485 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_80003es2lan.h +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_80003es2lan.h @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2010, Intel Corporation + Copyright (c) 2001-2011, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -30,53 +30,52 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: src/sys/dev/e1000/e1000_80003es2lan.h,v 1.1.4.2.4.1 2010/12/21 17:09:25 kensmith Exp $*/ +/*$FreeBSD$*/ #ifndef _E1000_80003ES2LAN_H_ #define _E1000_80003ES2LAN_H_ -#define E1000_KMRNCTRLSTA_OFFSET_FIFO_CTRL 0x00 -#define E1000_KMRNCTRLSTA_OFFSET_INB_CTRL 0x02 -#define E1000_KMRNCTRLSTA_OFFSET_HD_CTRL 0x10 -#define E1000_KMRNCTRLSTA_OFFSET_MAC2PHY_OPMODE 0x1F +#define E1000_KMRNCTRLSTA_OFFSET_FIFO_CTRL 0x00 +#define E1000_KMRNCTRLSTA_OFFSET_INB_CTRL 0x02 +#define E1000_KMRNCTRLSTA_OFFSET_HD_CTRL 0x10 +#define E1000_KMRNCTRLSTA_OFFSET_MAC2PHY_OPMODE 0x1F -#define E1000_KMRNCTRLSTA_FIFO_CTRL_RX_BYPASS 0x0008 -#define E1000_KMRNCTRLSTA_FIFO_CTRL_TX_BYPASS 0x0800 -#define E1000_KMRNCTRLSTA_INB_CTRL_DIS_PADDING 0x0010 +#define E1000_KMRNCTRLSTA_FIFO_CTRL_RX_BYPASS 0x0008 +#define E1000_KMRNCTRLSTA_FIFO_CTRL_TX_BYPASS 0x0800 +#define E1000_KMRNCTRLSTA_INB_CTRL_DIS_PADDING 0x0010 #define E1000_KMRNCTRLSTA_HD_CTRL_10_100_DEFAULT 0x0004 -#define E1000_KMRNCTRLSTA_HD_CTRL_1000_DEFAULT 0x0000 -#define E1000_KMRNCTRLSTA_OPMODE_E_IDLE 0x2000 +#define E1000_KMRNCTRLSTA_HD_CTRL_1000_DEFAULT 0x0000 +#define E1000_KMRNCTRLSTA_OPMODE_E_IDLE 0x2000 -#define E1000_KMRNCTRLSTA_OPMODE_MASK 0x000C -#define E1000_KMRNCTRLSTA_OPMODE_INBAND_MDIO 0x0004 +#define E1000_KMRNCTRLSTA_OPMODE_MASK 0x000C +#define E1000_KMRNCTRLSTA_OPMODE_INBAND_MDIO 0x0004 #define E1000_TCTL_EXT_GCEX_MASK 0x000FFC00 /* Gigabit Carry Extend Padding */ -#define DEFAULT_TCTL_EXT_GCEX_80003ES2LAN 0x00010000 +#define DEFAULT_TCTL_EXT_GCEX_80003ES2LAN 0x00010000 -#define DEFAULT_TIPG_IPGT_1000_80003ES2LAN 0x8 -#define DEFAULT_TIPG_IPGT_10_100_80003ES2LAN 0x9 +#define DEFAULT_TIPG_IPGT_1000_80003ES2LAN 0x8 +#define DEFAULT_TIPG_IPGT_10_100_80003ES2LAN 0x9 /* GG82563 PHY Specific Status Register (Page 0, Register 16 */ -#define GG82563_PSCR_POLARITY_REVERSAL_DISABLE 0x0002 /* 1=Reversal Disabled */ -#define GG82563_PSCR_CROSSOVER_MODE_MASK 0x0060 -#define GG82563_PSCR_CROSSOVER_MODE_MDI 0x0000 /* 00=Manual MDI */ -#define GG82563_PSCR_CROSSOVER_MODE_MDIX 0x0020 /* 01=Manual MDIX */ -#define GG82563_PSCR_CROSSOVER_MODE_AUTO 0x0060 /* 11=Auto crossover */ +#define GG82563_PSCR_POLARITY_REVERSAL_DISABLE 0x0002 /* 1=Reversal Disabled */ +#define GG82563_PSCR_CROSSOVER_MODE_MASK 0x0060 +#define GG82563_PSCR_CROSSOVER_MODE_MDI 0x0000 /* 00=Manual MDI */ +#define GG82563_PSCR_CROSSOVER_MODE_MDIX 0x0020 /* 01=Manual MDIX */ +#define GG82563_PSCR_CROSSOVER_MODE_AUTO 0x0060 /* 11=Auto crossover */ /* PHY Specific Control Register 2 (Page 0, Register 26) */ -#define GG82563_PSCR2_REVERSE_AUTO_NEG 0x2000 - /* 1=Reverse Auto-Negotiation */ +#define GG82563_PSCR2_REVERSE_AUTO_NEG 0x2000 /* 1=Reverse Auto-Nego */ /* MAC Specific Control Register (Page 2, Register 21) */ /* Tx clock speed for Link Down and 1000BASE-T for the following speeds */ -#define GG82563_MSCR_TX_CLK_MASK 0x0007 -#define GG82563_MSCR_TX_CLK_10MBPS_2_5 0x0004 -#define GG82563_MSCR_TX_CLK_100MBPS_25 0x0005 -#define GG82563_MSCR_TX_CLK_1000MBPS_2_5 0x0006 -#define GG82563_MSCR_TX_CLK_1000MBPS_25 0x0007 +#define GG82563_MSCR_TX_CLK_MASK 0x0007 +#define GG82563_MSCR_TX_CLK_10MBPS_2_5 0x0004 +#define GG82563_MSCR_TX_CLK_100MBPS_25 0x0005 +#define GG82563_MSCR_TX_CLK_1000MBPS_2_5 0x0006 +#define GG82563_MSCR_TX_CLK_1000MBPS_25 0x0007 -#define GG82563_MSCR_ASSERT_CRS_ON_TX 0x0010 /* 1=Assert */ +#define GG82563_MSCR_ASSERT_CRS_ON_TX 0x0010 /* 1=Assert */ /* DSP Distance Register (Page 5, Register 26) */ /* @@ -86,19 +85,19 @@ * 3 = 110-140M * 4 = >140M */ -#define GG82563_DSPD_CABLE_LENGTH 0x0007 +#define GG82563_DSPD_CABLE_LENGTH 0x0007 /* Kumeran Mode Control Register (Page 193, Register 16) */ -#define GG82563_KMCR_PASS_FALSE_CARRIER 0x0800 +#define GG82563_KMCR_PASS_FALSE_CARRIER 0x0800 /* Max number of times Kumeran read/write should be validated */ -#define GG82563_MAX_KMRN_RETRY 0x5 +#define GG82563_MAX_KMRN_RETRY 0x5 /* Power Management Control Register (Page 193, Register 20) */ -#define GG82563_PMCR_ENABLE_ELECTRICAL_IDLE 0x0001 - /* 1=Enable SERDES Electrical Idle */ +/* 1=Enable SERDES Electrical Idle */ +#define GG82563_PMCR_ENABLE_ELECTRICAL_IDLE 0x0001 /* In-Band Control Register (Page 194, Register 18) */ -#define GG82563_ICR_DIS_PADDING 0x0010 /* Disable Padding */ +#define GG82563_ICR_DIS_PADDING 0x0010 /* Disable Padding */ #endif diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_82540.c b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_82540.c index 33383df0fe..141b92e208 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_82540.c +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_82540.c @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2010, Intel Corporation + Copyright (c) 2001-2011, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -30,7 +30,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: src/sys/dev/e1000/e1000_82540.c,v 1.4.2.2.4.1 2010/12/21 17:09:25 kensmith Exp $*/ +/*$FreeBSD$*/ /* * 82540EM Gigabit Ethernet Controller @@ -68,23 +68,23 @@ static s32 e1000_init_phy_params_82540(struct e1000_hw *hw) struct e1000_phy_info *phy = &hw->phy; s32 ret_val = E1000_SUCCESS; - phy->addr = 1; - phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT; - phy->reset_delay_us = 10000; - phy->type = e1000_phy_m88; + phy->addr = 1; + phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT; + phy->reset_delay_us = 10000; + phy->type = e1000_phy_m88; /* Function Pointers */ - phy->ops.check_polarity = e1000_check_polarity_m88; - phy->ops.commit = e1000_phy_sw_reset_generic; - phy->ops.force_speed_duplex = e1000_phy_force_speed_duplex_m88; - phy->ops.get_cable_length = e1000_get_cable_length_m88; - phy->ops.get_cfg_done = e1000_get_cfg_done_generic; - phy->ops.read_reg = e1000_read_phy_reg_m88; - phy->ops.reset = e1000_phy_hw_reset_generic; - phy->ops.write_reg = e1000_write_phy_reg_m88; - phy->ops.get_info = e1000_get_phy_info_m88; - phy->ops.power_up = e1000_power_up_phy_copper; - phy->ops.power_down = e1000_power_down_phy_copper_82540; + phy->ops.check_polarity = e1000_check_polarity_m88; + phy->ops.commit = e1000_phy_sw_reset_generic; + phy->ops.force_speed_duplex = e1000_phy_force_speed_duplex_m88; + phy->ops.get_cable_length = e1000_get_cable_length_m88; + phy->ops.get_cfg_done = e1000_get_cfg_done_generic; + phy->ops.read_reg = e1000_read_phy_reg_m88; + phy->ops.reset = e1000_phy_hw_reset_generic; + phy->ops.write_reg = e1000_write_phy_reg_m88; + phy->ops.get_info = e1000_get_phy_info_m88; + phy->ops.power_up = e1000_power_up_phy_copper; + phy->ops.power_down = e1000_power_down_phy_copper_82540; ret_val = e1000_get_phy_id(hw); if (ret_val) @@ -121,32 +121,32 @@ static s32 e1000_init_nvm_params_82540(struct e1000_hw *hw) DEBUGFUNC("e1000_init_nvm_params_82540"); - nvm->type = e1000_nvm_eeprom_microwire; - nvm->delay_usec = 50; - nvm->opcode_bits = 3; + nvm->type = e1000_nvm_eeprom_microwire; + nvm->delay_usec = 50; + nvm->opcode_bits = 3; switch (nvm->override) { case e1000_nvm_override_microwire_large: - nvm->address_bits = 8; - nvm->word_size = 256; + nvm->address_bits = 8; + nvm->word_size = 256; break; case e1000_nvm_override_microwire_small: - nvm->address_bits = 6; - nvm->word_size = 64; + nvm->address_bits = 6; + nvm->word_size = 64; break; default: - nvm->address_bits = eecd & E1000_EECD_SIZE ? 8 : 6; - nvm->word_size = eecd & E1000_EECD_SIZE ? 256 : 64; + nvm->address_bits = eecd & E1000_EECD_SIZE ? 8 : 6; + nvm->word_size = eecd & E1000_EECD_SIZE ? 256 : 64; break; } /* Function Pointers */ - nvm->ops.acquire = e1000_acquire_nvm_generic; - nvm->ops.read = e1000_read_nvm_microwire; - nvm->ops.release = e1000_release_nvm_generic; - nvm->ops.update = e1000_update_nvm_checksum_generic; - nvm->ops.valid_led_default = e1000_valid_led_default_generic; - nvm->ops.validate = e1000_validate_nvm_checksum_generic; - nvm->ops.write = e1000_write_nvm_microwire; + nvm->ops.acquire = e1000_acquire_nvm_generic; + nvm->ops.read = e1000_read_nvm_microwire; + nvm->ops.release = e1000_release_nvm_generic; + nvm->ops.update = e1000_update_nvm_checksum_generic; + nvm->ops.valid_led_default = e1000_valid_led_default_generic; + nvm->ops.validate = e1000_validate_nvm_checksum_generic; + nvm->ops.write = e1000_write_nvm_microwire; return E1000_SUCCESS; } @@ -198,9 +198,9 @@ static s32 e1000_init_mac_params_82540(struct e1000_hw *hw) mac->ops.setup_link = e1000_setup_link_generic; /* physical interface setup */ mac->ops.setup_physical_interface = - (hw->phy.media_type == e1000_media_type_copper) - ? e1000_setup_copper_link_82540 - : e1000_setup_fiber_serdes_link_82540; + (hw->phy.media_type == e1000_media_type_copper) + ? e1000_setup_copper_link_82540 + : e1000_setup_fiber_serdes_link_82540; /* check for link */ switch (hw->phy.media_type) { case e1000_media_type_copper: @@ -219,9 +219,9 @@ static s32 e1000_init_mac_params_82540(struct e1000_hw *hw) } /* link info */ mac->ops.get_link_up_info = - (hw->phy.media_type == e1000_media_type_copper) - ? e1000_get_speed_and_duplex_copper_generic - : e1000_get_speed_and_duplex_fiber_serdes_generic; + (hw->phy.media_type == e1000_media_type_copper) + ? e1000_get_speed_and_duplex_copper_generic + : e1000_get_speed_and_duplex_fiber_serdes_generic; /* multicast address update */ mac->ops.update_mc_addr_list = e1000_update_mc_addr_list_generic; /* writing VFTA */ @@ -374,7 +374,7 @@ static s32 e1000_init_hw_82540(struct e1000_hw *hw) txdctl = E1000_READ_REG(hw, E1000_TXDCTL(0)); txdctl = (txdctl & ~E1000_TXDCTL_WTHRESH) | - E1000_TXDCTL_FULL_TX_DESC_WB; + E1000_TXDCTL_FULL_TX_DESC_WB; E1000_WRITE_REG(hw, E1000_TXDCTL(0), txdctl); /* @@ -427,11 +427,13 @@ static s32 e1000_setup_copper_link_82540(struct e1000_hw *hw) if (hw->mac.type == e1000_82545_rev_3 || hw->mac.type == e1000_82546_rev_3) { - ret_val = hw->phy.ops.read_reg(hw, M88E1000_PHY_SPEC_CTRL, &data); + ret_val = hw->phy.ops.read_reg(hw, M88E1000_PHY_SPEC_CTRL, + &data); if (ret_val) goto out; data |= 0x00000008; - ret_val = hw->phy.ops.write_reg(hw, M88E1000_PHY_SPEC_CTRL, data); + ret_val = hw->phy.ops.write_reg(hw, M88E1000_PHY_SPEC_CTRL, + data); if (ret_val) goto out; } @@ -508,9 +510,8 @@ static s32 e1000_adjust_serdes_amplitude_82540(struct e1000_hw *hw) if (nvm_data != NVM_RESERVED_WORD) { /* Adjust serdes output amplitude only. */ nvm_data &= NVM_SERDES_AMPLITUDE_MASK; - ret_val = hw->phy.ops.write_reg(hw, - M88E1000_PHY_EXT_CTRL, - nvm_data); + ret_val = hw->phy.ops.write_reg(hw, M88E1000_PHY_EXT_CTRL, + nvm_data); if (ret_val) goto out; } @@ -535,9 +536,8 @@ static s32 e1000_set_vco_speed_82540(struct e1000_hw *hw) /* Set PHY register 30, page 5, bit 8 to 0 */ - ret_val = hw->phy.ops.read_reg(hw, - M88E1000_PHY_PAGE_SELECT, - &default_page); + ret_val = hw->phy.ops.read_reg(hw, M88E1000_PHY_PAGE_SELECT, + &default_page); if (ret_val) goto out; @@ -570,7 +570,7 @@ static s32 e1000_set_vco_speed_82540(struct e1000_hw *hw) goto out; ret_val = hw->phy.ops.write_reg(hw, M88E1000_PHY_PAGE_SELECT, - default_page); + default_page); out: return ret_val; @@ -587,7 +587,6 @@ out: **/ static s32 e1000_set_phy_mode_82540(struct e1000_hw *hw) { - struct e1000_phy_info *phy = &hw->phy; s32 ret_val = E1000_SUCCESS; u16 nvm_data; @@ -604,20 +603,18 @@ static s32 e1000_set_phy_mode_82540(struct e1000_hw *hw) if ((nvm_data != NVM_RESERVED_WORD) && (nvm_data & NVM_PHY_CLASS_A)) { ret_val = hw->phy.ops.write_reg(hw, M88E1000_PHY_PAGE_SELECT, - 0x000B); + 0x000B); if (ret_val) { ret_val = -E1000_ERR_PHY; goto out; } - ret_val = hw->phy.ops.write_reg(hw, - M88E1000_PHY_GEN_CONTROL, - 0x8104); + ret_val = hw->phy.ops.write_reg(hw, M88E1000_PHY_GEN_CONTROL, + 0x8104); if (ret_val) { ret_val = -E1000_ERR_PHY; goto out; } - phy->reset_disable = FALSE; } out: diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_82541.c b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_82541.c index 6e0bdd9f56..781aa931fb 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_82541.c +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_82541.c @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2010, Intel Corporation + Copyright (c) 2001-2011, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -30,7 +30,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: src/sys/dev/e1000/e1000_82541.c,v 1.4.2.2.4.1 2010/12/21 17:09:25 kensmith Exp $*/ +/*$FreeBSD$*/ /* * 82541EI Gigabit Ethernet Controller @@ -300,7 +300,7 @@ void e1000_init_function_pointers_82541(struct e1000_hw *hw) **/ static s32 e1000_reset_hw_82541(struct e1000_hw *hw) { - u32 ledctl, ctrl, manc; + u32 ledctl, ctrl, icr, manc; DEBUGFUNC("e1000_reset_hw_82541"); @@ -364,7 +364,7 @@ static s32 e1000_reset_hw_82541(struct e1000_hw *hw) E1000_WRITE_REG(hw, E1000_IMC, 0xFFFFFFFF); /* Clear any pending interrupt events. */ - E1000_READ_REG(hw, E1000_ICR); + icr = E1000_READ_REG(hw, E1000_ICR); return E1000_SUCCESS; } @@ -390,7 +390,7 @@ static s32 e1000_init_hw_82541(struct e1000_hw *hw) DEBUGOUT("Error initializing identification LED\n"); /* This is not fatal and we should not stop init due to this */ } - + /* Storing the Speed Power Down value for later use */ ret_val = hw->phy.ops.read_reg(hw, IGP01E1000_GMII_FIFO, @@ -549,8 +549,6 @@ static s32 e1000_setup_copper_link_82541(struct e1000_hw *hw) ctrl &= ~(E1000_CTRL_FRCSPD | E1000_CTRL_FRCDPX); E1000_WRITE_REG(hw, E1000_CTRL, ctrl); - hw->phy.reset_disable = FALSE; - /* Earlier revs of the IGP phy require us to force MDI. */ if (hw->mac.type == e1000_82541 || hw->mac.type == e1000_82547) { dev_spec->dsp_config = e1000_dsp_config_disabled; @@ -644,7 +642,7 @@ static s32 e1000_check_for_link_82541(struct e1000_hw *hw) * of MAC speed/duplex configuration. So we only need to * configure Collision Distance in the MAC. */ - e1000_config_collision_dist_generic(hw); + mac->ops.config_collision_dist(hw); /* * Configure Flow Control now that Auto-Neg has completed. diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_82541.h b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_82541.h index 477707e515..3b6b9612ee 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_82541.h +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_82541.h @@ -30,7 +30,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: src/sys/dev/e1000/e1000_82541.h,v 1.1.4.1.6.1 2010/12/21 17:09:25 kensmith Exp $*/ +/*$FreeBSD$*/ #ifndef _E1000_82541_H_ #define _E1000_82541_H_ diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_82542.c b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_82542.c index b4159833f7..c0b4e88be9 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_82542.c +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_82542.c @@ -30,7 +30,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: src/sys/dev/e1000/e1000_82542.c,v 1.3.2.2.4.1 2010/12/21 17:09:25 kensmith Exp $*/ +/*$FreeBSD$*/ /* * 82542 Gigabit Ethernet Controller diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_82543.c b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_82543.c index 89ebf512b8..1c01658cfc 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_82543.c +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_82543.c @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2010, Intel Corporation + Copyright (c) 2001-2011, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -30,7 +30,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: src/sys/dev/e1000/e1000_82543.c,v 1.2.2.2.4.1 2010/12/21 17:09:25 kensmith Exp $*/ +/*$FreeBSD$*/ /* * 82543GC Gigabit Ethernet Controller (Fiber) @@ -901,7 +901,7 @@ static s32 e1000_phy_hw_reset_82543(struct e1000_hw *hw) **/ static s32 e1000_reset_hw_82543(struct e1000_hw *hw) { - u32 ctrl; + u32 ctrl, icr; s32 ret_val = E1000_SUCCESS; DEBUGFUNC("e1000_reset_hw_82543"); @@ -943,7 +943,7 @@ static s32 e1000_reset_hw_82543(struct e1000_hw *hw) /* Masking off and clearing any pending interrupts */ E1000_WRITE_REG(hw, E1000_IMC, 0xffffffff); - E1000_READ_REG(hw, E1000_ICR); + icr = E1000_READ_REG(hw, E1000_ICR); return ret_val; } @@ -1079,7 +1079,6 @@ static s32 e1000_setup_copper_link_82543(struct e1000_hw *hw) ret_val = hw->phy.ops.reset(hw); if (ret_val) goto out; - hw->phy.reset_disable = FALSE; } else { ctrl &= ~(E1000_CTRL_FRCSPD | E1000_CTRL_FRCDPX); E1000_WRITE_REG(hw, E1000_CTRL, ctrl); @@ -1127,7 +1126,7 @@ static s32 e1000_setup_copper_link_82543(struct e1000_hw *hw) DEBUGOUT("Valid link established!!!\n"); /* Config the MAC and PHY after link is up */ if (hw->mac.type == e1000_82544) { - e1000_config_collision_dist_generic(hw); + hw->mac.ops.config_collision_dist(hw); } else { ret_val = e1000_config_mac_to_phy_82543(hw); if (ret_val) @@ -1161,7 +1160,7 @@ static s32 e1000_setup_fiber_link_82543(struct e1000_hw *hw) /* Take the link out of reset */ ctrl &= ~E1000_CTRL_LRST; - e1000_config_collision_dist_generic(hw); + hw->mac.ops.config_collision_dist(hw); ret_val = e1000_commit_fc_settings_generic(hw); if (ret_val) @@ -1260,7 +1259,7 @@ static s32 e1000_check_for_copper_link_82543(struct e1000_hw *hw) * settings. */ if (mac->type == e1000_82544) - e1000_config_collision_dist_generic(hw); + hw->mac.ops.config_collision_dist(hw); else { ret_val = e1000_config_mac_to_phy_82543(hw); if (ret_val) { @@ -1434,7 +1433,7 @@ static s32 e1000_config_mac_to_phy_82543(struct e1000_hw *hw) if (phy_data & M88E1000_PSSR_DPLX) ctrl |= E1000_CTRL_FD; - e1000_config_collision_dist_generic(hw); + hw->mac.ops.config_collision_dist(hw); /* * Set up speed in the Device Control register depending on diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_82543.h b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_82543.h index 5388c8beaa..60e5c15dda 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_82543.h +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_82543.h @@ -30,7 +30,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: src/sys/dev/e1000/e1000_82543.h,v 1.1.4.1.6.1 2010/12/21 17:09:25 kensmith Exp $*/ +/*$FreeBSD$*/ #ifndef _E1000_82543_H_ #define _E1000_82543_H_ diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_82571.c b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_82571.c index 7bcedc2683..30015c1eaa 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_82571.c +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_82571.c @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2010, Intel Corporation + Copyright (c) 2001-2011, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -30,7 +30,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: src/sys/dev/e1000/e1000_82571.c,v 1.4.2.3.2.1 2010/12/21 17:09:25 kensmith Exp $*/ +/*$FreeBSD$*/ /* * 82571EB Gigabit Ethernet Controller @@ -57,12 +57,12 @@ static s32 e1000_init_mac_params_82571(struct e1000_hw *hw); static s32 e1000_acquire_nvm_82571(struct e1000_hw *hw); static void e1000_release_nvm_82571(struct e1000_hw *hw); static s32 e1000_write_nvm_82571(struct e1000_hw *hw, u16 offset, - u16 words, u16 *data); + u16 words, u16 *data); static s32 e1000_update_nvm_checksum_82571(struct e1000_hw *hw); static s32 e1000_validate_nvm_checksum_82571(struct e1000_hw *hw); static s32 e1000_get_cfg_done_82571(struct e1000_hw *hw); static s32 e1000_set_d0_lplu_state_82571(struct e1000_hw *hw, - bool active); + bool active); static s32 e1000_reset_hw_82571(struct e1000_hw *hw); static s32 e1000_init_hw_82571(struct e1000_hw *hw); static void e1000_clear_vfta_82571(struct e1000_hw *hw); @@ -83,12 +83,12 @@ static void e1000_put_hw_semaphore_82573(struct e1000_hw *hw); static s32 e1000_get_hw_semaphore_82574(struct e1000_hw *hw); static void e1000_put_hw_semaphore_82574(struct e1000_hw *hw); static s32 e1000_set_d0_lplu_state_82574(struct e1000_hw *hw, - bool active); + bool active); static s32 e1000_set_d3_lplu_state_82574(struct e1000_hw *hw, - bool active); + bool active); static void e1000_initialize_hw_bits_82571(struct e1000_hw *hw); static s32 e1000_write_nvm_eewr_82571(struct e1000_hw *hw, u16 offset, - u16 words, u16 *data); + u16 words, u16 *data); static s32 e1000_read_mac_addr_82571(struct e1000_hw *hw); static void e1000_power_down_phy_copper_82571(struct e1000_hw *hw); @@ -108,61 +108,61 @@ static s32 e1000_init_phy_params_82571(struct e1000_hw *hw) goto out; } - phy->addr = 1; - phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT; - phy->reset_delay_us = 100; + phy->addr = 1; + phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT; + phy->reset_delay_us = 100; - phy->ops.check_reset_block = e1000_check_reset_block_generic; - phy->ops.reset = e1000_phy_hw_reset_generic; - phy->ops.set_d0_lplu_state = e1000_set_d0_lplu_state_82571; - phy->ops.set_d3_lplu_state = e1000_set_d3_lplu_state_generic; - phy->ops.power_up = e1000_power_up_phy_copper; - phy->ops.power_down = e1000_power_down_phy_copper_82571; + phy->ops.check_reset_block = e1000_check_reset_block_generic; + phy->ops.reset = e1000_phy_hw_reset_generic; + phy->ops.set_d0_lplu_state = e1000_set_d0_lplu_state_82571; + phy->ops.set_d3_lplu_state = e1000_set_d3_lplu_state_generic; + phy->ops.power_up = e1000_power_up_phy_copper; + phy->ops.power_down = e1000_power_down_phy_copper_82571; switch (hw->mac.type) { case e1000_82571: case e1000_82572: - phy->type = e1000_phy_igp_2; - phy->ops.get_cfg_done = e1000_get_cfg_done_82571; - phy->ops.get_info = e1000_get_phy_info_igp; - phy->ops.check_polarity = e1000_check_polarity_igp; + phy->type = e1000_phy_igp_2; + phy->ops.get_cfg_done = e1000_get_cfg_done_82571; + phy->ops.get_info = e1000_get_phy_info_igp; + phy->ops.check_polarity = e1000_check_polarity_igp; phy->ops.force_speed_duplex = e1000_phy_force_speed_duplex_igp; - phy->ops.get_cable_length = e1000_get_cable_length_igp_2; - phy->ops.read_reg = e1000_read_phy_reg_igp; - phy->ops.write_reg = e1000_write_phy_reg_igp; - phy->ops.acquire = e1000_get_hw_semaphore_82571; - phy->ops.release = e1000_put_hw_semaphore_82571; + phy->ops.get_cable_length = e1000_get_cable_length_igp_2; + phy->ops.read_reg = e1000_read_phy_reg_igp; + phy->ops.write_reg = e1000_write_phy_reg_igp; + phy->ops.acquire = e1000_get_hw_semaphore_82571; + phy->ops.release = e1000_put_hw_semaphore_82571; break; case e1000_82573: - phy->type = e1000_phy_m88; - phy->ops.get_cfg_done = e1000_get_cfg_done_generic; - phy->ops.get_info = e1000_get_phy_info_m88; - phy->ops.check_polarity = e1000_check_polarity_m88; - phy->ops.commit = e1000_phy_sw_reset_generic; + phy->type = e1000_phy_m88; + phy->ops.get_cfg_done = e1000_get_cfg_done_generic; + phy->ops.get_info = e1000_get_phy_info_m88; + phy->ops.check_polarity = e1000_check_polarity_m88; + phy->ops.commit = e1000_phy_sw_reset_generic; phy->ops.force_speed_duplex = e1000_phy_force_speed_duplex_m88; - phy->ops.get_cable_length = e1000_get_cable_length_m88; - phy->ops.read_reg = e1000_read_phy_reg_m88; - phy->ops.write_reg = e1000_write_phy_reg_m88; - phy->ops.acquire = e1000_get_hw_semaphore_82571; - phy->ops.release = e1000_put_hw_semaphore_82571; + phy->ops.get_cable_length = e1000_get_cable_length_m88; + phy->ops.read_reg = e1000_read_phy_reg_m88; + phy->ops.write_reg = e1000_write_phy_reg_m88; + phy->ops.acquire = e1000_get_hw_semaphore_82571; + phy->ops.release = e1000_put_hw_semaphore_82571; break; case e1000_82574: case e1000_82583: E1000_MUTEX_INIT(&hw->dev_spec._82571.swflag_mutex); - phy->type = e1000_phy_bm; - phy->ops.get_cfg_done = e1000_get_cfg_done_generic; - phy->ops.get_info = e1000_get_phy_info_m88; - phy->ops.check_polarity = e1000_check_polarity_m88; - phy->ops.commit = e1000_phy_sw_reset_generic; + phy->type = e1000_phy_bm; + phy->ops.get_cfg_done = e1000_get_cfg_done_generic; + phy->ops.get_info = e1000_get_phy_info_m88; + phy->ops.check_polarity = e1000_check_polarity_m88; + phy->ops.commit = e1000_phy_sw_reset_generic; phy->ops.force_speed_duplex = e1000_phy_force_speed_duplex_m88; - phy->ops.get_cable_length = e1000_get_cable_length_m88; - phy->ops.read_reg = e1000_read_phy_reg_bm2; - phy->ops.write_reg = e1000_write_phy_reg_bm2; - phy->ops.acquire = e1000_get_hw_semaphore_82574; - phy->ops.release = e1000_put_hw_semaphore_82574; - phy->ops.set_d0_lplu_state = e1000_set_d0_lplu_state_82574; - phy->ops.set_d3_lplu_state = e1000_set_d3_lplu_state_82574; + phy->ops.get_cable_length = e1000_get_cable_length_m88; + phy->ops.read_reg = e1000_read_phy_reg_bm2; + phy->ops.write_reg = e1000_write_phy_reg_bm2; + phy->ops.acquire = e1000_get_hw_semaphore_82574; + phy->ops.release = e1000_put_hw_semaphore_82574; + phy->ops.set_d0_lplu_state = e1000_set_d0_lplu_state_82574; + phy->ops.set_d3_lplu_state = e1000_set_d3_lplu_state_82574; break; default: ret_val = -E1000_ERR_PHY; @@ -253,7 +253,7 @@ static s32 e1000_init_nvm_params_82571(struct e1000_hw *hw) default: nvm->type = e1000_nvm_eeprom_spi; size = (u16)((eecd & E1000_EECD_SIZE_EX_MASK) >> - E1000_EECD_SIZE_EX_SHIFT); + E1000_EECD_SIZE_EX_SHIFT); /* * Added to a constant, "size" becomes the left-shift value * for setting word_size. @@ -263,7 +263,7 @@ static s32 e1000_init_nvm_params_82571(struct e1000_hw *hw) /* EEPROM access above 16k is unsupported */ if (size > 14) size = 14; - nvm->word_size = 1 << size; + nvm->word_size = 1 << size; break; } @@ -279,11 +279,11 @@ static s32 e1000_init_nvm_params_82571(struct e1000_hw *hw) nvm->ops.release = e1000_release_nvm_82571; break; } - nvm->ops.read = e1000_read_nvm_eerd; - nvm->ops.update = e1000_update_nvm_checksum_82571; - nvm->ops.validate = e1000_validate_nvm_checksum_82571; + nvm->ops.read = e1000_read_nvm_eerd; + nvm->ops.update = e1000_update_nvm_checksum_82571; + nvm->ops.validate = e1000_validate_nvm_checksum_82571; nvm->ops.valid_led_default = e1000_valid_led_default_82571; - nvm->ops.write = e1000_write_nvm_82571; + nvm->ops.write = e1000_write_nvm_82571; return E1000_SUCCESS; } @@ -363,8 +363,6 @@ static s32 e1000_init_mac_params_82571(struct e1000_hw *hw) mac->ops.read_mac_addr = e1000_read_mac_addr_82571; /* ID LED init */ mac->ops.id_led_init = e1000_id_led_init_generic; - /* blink LED */ - mac->ops.blink_led = e1000_blink_led_generic; /* setup LED */ mac->ops.setup_led = e1000_setup_led_generic; /* cleanup LED */ @@ -380,6 +378,7 @@ static s32 e1000_init_mac_params_82571(struct e1000_hw *hw) mac->ops.set_lan_id = e1000_set_lan_id_single_port; mac->ops.check_mng_mode = e1000_check_mng_mode_generic; mac->ops.led_on = e1000_led_on_generic; + mac->ops.blink_led = e1000_blink_led_generic; /* FWSM register */ mac->has_fwsm = TRUE; @@ -387,9 +386,8 @@ static s32 e1000_init_mac_params_82571(struct e1000_hw *hw) * ARC supported; valid only if manageability features are * enabled. */ - mac->arc_subsystem_valid = - (E1000_READ_REG(hw, E1000_FWSM) & E1000_FWSM_MODE_MASK) - ? TRUE : FALSE; + mac->arc_subsystem_valid = (E1000_READ_REG(hw, E1000_FWSM) & + E1000_FWSM_MODE_MASK) ? TRUE : FALSE; break; case e1000_82574: case e1000_82583: @@ -400,6 +398,7 @@ static s32 e1000_init_mac_params_82571(struct e1000_hw *hw) default: mac->ops.check_mng_mode = e1000_check_mng_mode_generic; mac->ops.led_on = e1000_led_on_generic; + mac->ops.blink_led = e1000_blink_led_generic; /* FWSM register */ mac->has_fwsm = TRUE; @@ -420,8 +419,8 @@ static s32 e1000_init_mac_params_82571(struct e1000_hw *hw) if (!(swsm2 & E1000_SWSM2_LOCK)) { /* Only do this for the first interface on this card */ - E1000_WRITE_REG(hw, E1000_SWSM2, - swsm2 | E1000_SWSM2_LOCK); + E1000_WRITE_REG(hw, E1000_SWSM2, swsm2 | + E1000_SWSM2_LOCK); force_clear_smbi = TRUE; } else force_clear_smbi = FALSE; @@ -746,8 +745,8 @@ static s32 e1000_set_d3_lplu_state_82574(struct e1000_hw *hw, bool active) if (!active) { data &= ~E1000_PHY_CTRL_NOND0A_LPLU; } else if ((hw->phy.autoneg_advertised == E1000_ALL_SPEED_DUPLEX) || - (hw->phy.autoneg_advertised == E1000_ALL_NOT_GIG) || - (hw->phy.autoneg_advertised == E1000_ALL_10_SPEED)) { + (hw->phy.autoneg_advertised == E1000_ALL_NOT_GIG) || + (hw->phy.autoneg_advertised == E1000_ALL_10_SPEED)) { data |= E1000_PHY_CTRL_NOND0A_LPLU; } @@ -816,7 +815,7 @@ static void e1000_release_nvm_82571(struct e1000_hw *hw) * EEPROM will most likely contain an invalid checksum. **/ static s32 e1000_write_nvm_82571(struct e1000_hw *hw, u16 offset, u16 words, - u16 *data) + u16 *data) { s32 ret_val = E1000_SUCCESS; @@ -941,7 +940,7 @@ static s32 e1000_validate_nvm_checksum_82571(struct e1000_hw *hw) * EEPROM will most likely contain an invalid checksum. **/ static s32 e1000_write_nvm_eewr_82571(struct e1000_hw *hw, u16 offset, - u16 words, u16 *data) + u16 words, u16 *data) { struct e1000_nvm_info *nvm = &hw->nvm; u32 i, eewr = 0; @@ -1039,22 +1038,22 @@ static s32 e1000_set_d0_lplu_state_82571(struct e1000_hw *hw, bool active) if (active) { data |= IGP02E1000_PM_D0_LPLU; ret_val = phy->ops.write_reg(hw, IGP02E1000_PHY_POWER_MGMT, - data); + data); if (ret_val) goto out; /* When LPLU is enabled, we should disable SmartSpeed */ ret_val = phy->ops.read_reg(hw, IGP01E1000_PHY_PORT_CONFIG, - &data); + &data); data &= ~IGP01E1000_PSCFR_SMART_SPEED; ret_val = phy->ops.write_reg(hw, IGP01E1000_PHY_PORT_CONFIG, - data); + data); if (ret_val) goto out; } else { data &= ~IGP02E1000_PM_D0_LPLU; ret_val = phy->ops.write_reg(hw, IGP02E1000_PHY_POWER_MGMT, - data); + data); /* * LPLU and SmartSpeed are mutually exclusive. LPLU is used * during Dx states where the power conservation is most @@ -1063,28 +1062,28 @@ static s32 e1000_set_d0_lplu_state_82571(struct e1000_hw *hw, bool active) */ if (phy->smart_speed == e1000_smart_speed_on) { ret_val = phy->ops.read_reg(hw, - IGP01E1000_PHY_PORT_CONFIG, - &data); + IGP01E1000_PHY_PORT_CONFIG, + &data); if (ret_val) goto out; data |= IGP01E1000_PSCFR_SMART_SPEED; ret_val = phy->ops.write_reg(hw, - IGP01E1000_PHY_PORT_CONFIG, - data); + IGP01E1000_PHY_PORT_CONFIG, + data); if (ret_val) goto out; } else if (phy->smart_speed == e1000_smart_speed_off) { ret_val = phy->ops.read_reg(hw, - IGP01E1000_PHY_PORT_CONFIG, - &data); + IGP01E1000_PHY_PORT_CONFIG, + &data); if (ret_val) goto out; data &= ~IGP01E1000_PSCFR_SMART_SPEED; ret_val = phy->ops.write_reg(hw, - IGP01E1000_PHY_PORT_CONFIG, - data); + IGP01E1000_PHY_PORT_CONFIG, + data); if (ret_val) goto out; } @@ -1255,8 +1254,7 @@ static s32 e1000_init_hw_82571(struct e1000_hw *hw) /* Set the transmit descriptor write-back policy */ reg_data = E1000_READ_REG(hw, E1000_TXDCTL(0)); reg_data = (reg_data & ~E1000_TXDCTL_WTHRESH) | - E1000_TXDCTL_FULL_TX_DESC_WB | - E1000_TXDCTL_COUNT_DESC; + E1000_TXDCTL_FULL_TX_DESC_WB | E1000_TXDCTL_COUNT_DESC; E1000_WRITE_REG(hw, E1000_TXDCTL(0), reg_data); /* ...for both queues. */ @@ -1273,8 +1271,8 @@ static s32 e1000_init_hw_82571(struct e1000_hw *hw) default: reg_data = E1000_READ_REG(hw, E1000_TXDCTL(1)); reg_data = (reg_data & ~E1000_TXDCTL_WTHRESH) | - E1000_TXDCTL_FULL_TX_DESC_WB | - E1000_TXDCTL_COUNT_DESC; + E1000_TXDCTL_FULL_TX_DESC_WB | + E1000_TXDCTL_COUNT_DESC; E1000_WRITE_REG(hw, E1000_TXDCTL(1), reg_data); break; } @@ -1320,6 +1318,10 @@ static void e1000_initialize_hw_bits_82571(struct e1000_hw *hw) case e1000_82572: reg |= (1 << 23) | (1 << 24) | (1 << 25) | (1 << 26); break; + case e1000_82574: + case e1000_82583: + reg |= (1 << 26); + break; default: break; } @@ -1527,12 +1529,12 @@ bool e1000_check_phy_82574(struct e1000_hw *hw) * read the Base1000T status register If both are max then PHY is hung. */ ret_val = hw->phy.ops.read_reg(hw, E1000_RECEIVE_ERROR_COUNTER, - &receive_errors); + &receive_errors); if (ret_val) goto out; if (receive_errors == E1000_RECEIVE_ERROR_MAX) { ret_val = hw->phy.ops.read_reg(hw, E1000_BASE1000T_STATUS, - &status_1kbt); + &status_1kbt); if (ret_val) goto out; if ((status_1kbt & E1000_IDLE_ERROR_COUNT_MASK) == @@ -1640,7 +1642,8 @@ static s32 e1000_setup_fiber_serdes_link_82571(struct e1000_hw *hw) * mode. This prevents drivers from twiddling their thumbs * if another tool failed to take it out of loopback mode. */ - E1000_WRITE_REG(hw, E1000_SCTL, E1000_SCTL_DISABLE_SERDES_LOOPBACK); + E1000_WRITE_REG(hw, E1000_SCTL, + E1000_SCTL_DISABLE_SERDES_LOOPBACK); break; default: break; @@ -1664,7 +1667,7 @@ static s32 e1000_setup_fiber_serdes_link_82571(struct e1000_hw *hw) * * 1) down * 2) autoneg_progress - * 3) autoneg_complete (the link sucessfully autonegotiated) + * 3) autoneg_complete (the link successfully autonegotiated) * 4) forced_up (the link has been forced up, it did not autonegotiate) * **/ @@ -1763,7 +1766,7 @@ static s32 e1000_check_for_serdes_link_82571(struct e1000_hw *hw) break; } mac->serdes_link_state = - e1000_serdes_link_forced_up; + e1000_serdes_link_forced_up; mac->serdes_has_link = TRUE; DEBUGOUT("AN_PROG -> FORCED_UP\n"); } @@ -1777,10 +1780,10 @@ static s32 e1000_check_for_serdes_link_82571(struct e1000_hw *hw) * up. */ E1000_WRITE_REG(hw, E1000_TXCW, mac->txcw); - E1000_WRITE_REG(hw, E1000_CTRL, - (ctrl & ~E1000_CTRL_SLU)); + E1000_WRITE_REG(hw, E1000_CTRL, (ctrl & + ~E1000_CTRL_SLU)); mac->serdes_link_state = - e1000_serdes_link_autoneg_progress; + e1000_serdes_link_autoneg_progress; mac->serdes_has_link = FALSE; DEBUGOUT("DOWN -> AN_PROG\n"); break; @@ -1804,7 +1807,7 @@ static s32 e1000_check_for_serdes_link_82571(struct e1000_hw *hw) (rxcw & E1000_RXCW_C))) { mac->serdes_has_link = FALSE; mac->serdes_link_state = - e1000_serdes_link_down; + e1000_serdes_link_down; DEBUGOUT("ANYSTATE -> DOWN\n"); break; } @@ -1815,7 +1818,7 @@ static s32 e1000_check_for_serdes_link_82571(struct e1000_hw *hw) txcw |= E1000_TXCW_ANE; E1000_WRITE_REG(hw, E1000_TXCW, txcw); mac->serdes_link_state = - e1000_serdes_link_autoneg_progress; + e1000_serdes_link_autoneg_progress; mac->serdes_has_link = FALSE; DEBUGOUT("ANYSTATE -> AN_PROG\n"); } @@ -1904,8 +1907,8 @@ void e1000_set_laa_state_82571(struct e1000_hw *hw, bool state) * incoming packets directed to this port are dropped. * Eventually the LAA will be in RAR[0] and RAR[14]. */ - e1000_rar_set_generic(hw, hw->mac.addr, - hw->mac.rar_entry_count - 1); + hw->mac.ops.rar_set(hw, hw->mac.addr, + hw->mac.rar_entry_count - 1); return; } diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_82571.h b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_82571.h index c7ec58bdd3..c76f16fe17 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_82571.h +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_82571.h @@ -30,7 +30,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: src/sys/dev/e1000/e1000_82571.h,v 1.1.4.2.2.1 2010/12/21 17:09:25 kensmith Exp $*/ +/*$FreeBSD$*/ #ifndef _E1000_82571_H_ #define _E1000_82571_H_ diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_82575.c b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_82575.c index 5a6840176c..a04e3fad22 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_82575.c +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_82575.c @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2010, Intel Corporation + Copyright (c) 2001-2012, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -30,7 +30,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: src/sys/dev/e1000/e1000_82575.c,v 1.4.2.3.2.1 2010/12/21 17:09:25 kensmith Exp $*/ +/*$FreeBSD$*/ /* * 82575EB Gigabit Network Connection @@ -38,9 +38,12 @@ * 82575GB Gigabit Network Connection * 82576 Gigabit Network Connection * 82576 Quad Port Gigabit Mezzanine Adapter + * 82580 Gigabit Network Connection + * I350 Gigabit Network Connection */ #include "e1000_api.h" +#include "e1000_i210.h" static s32 e1000_init_phy_params_82575(struct e1000_hw *hw); static s32 e1000_init_mac_params_82575(struct e1000_hw *hw); @@ -51,32 +54,34 @@ static void e1000_release_nvm_82575(struct e1000_hw *hw); static s32 e1000_check_for_link_82575(struct e1000_hw *hw); static s32 e1000_get_cfg_done_82575(struct e1000_hw *hw); static s32 e1000_get_link_up_info_82575(struct e1000_hw *hw, u16 *speed, - u16 *duplex); + u16 *duplex); static s32 e1000_init_hw_82575(struct e1000_hw *hw); static s32 e1000_phy_hw_reset_sgmii_82575(struct e1000_hw *hw); static s32 e1000_read_phy_reg_sgmii_82575(struct e1000_hw *hw, u32 offset, - u16 *data); + u16 *data); static s32 e1000_reset_hw_82575(struct e1000_hw *hw); static s32 e1000_reset_hw_82580(struct e1000_hw *hw); static s32 e1000_read_phy_reg_82580(struct e1000_hw *hw, - u32 offset, u16 *data); + u32 offset, u16 *data); static s32 e1000_write_phy_reg_82580(struct e1000_hw *hw, - u32 offset, u16 data); + u32 offset, u16 data); static s32 e1000_set_d0_lplu_state_82580(struct e1000_hw *hw, - bool active); + bool active); static s32 e1000_set_d3_lplu_state_82580(struct e1000_hw *hw, - bool active); + bool active); static s32 e1000_set_d0_lplu_state_82575(struct e1000_hw *hw, - bool active); + bool active); static s32 e1000_setup_copper_link_82575(struct e1000_hw *hw); static s32 e1000_setup_serdes_link_82575(struct e1000_hw *hw); +static s32 e1000_get_media_type_82575(struct e1000_hw *hw); +static s32 e1000_set_sfp_media_type_82575(struct e1000_hw *hw); static s32 e1000_valid_led_default_82575(struct e1000_hw *hw, u16 *data); static s32 e1000_write_phy_reg_sgmii_82575(struct e1000_hw *hw, - u32 offset, u16 data); + u32 offset, u16 data); static void e1000_clear_hw_cntrs_82575(struct e1000_hw *hw); static s32 e1000_acquire_swfw_sync_82575(struct e1000_hw *hw, u16 mask); static s32 e1000_get_pcs_speed_and_duplex_82575(struct e1000_hw *hw, - u16 *speed, u16 *duplex); + u16 *speed, u16 *duplex); static s32 e1000_get_phy_id_82575(struct e1000_hw *hw); static void e1000_release_swfw_sync_82575(struct e1000_hw *hw, u16 mask); static bool e1000_sgmii_active_82575(struct e1000_hw *hw); @@ -91,15 +96,28 @@ static s32 e1000_reset_mdicnfg_82580(struct e1000_hw *hw); static s32 e1000_validate_nvm_checksum_82580(struct e1000_hw *hw); static s32 e1000_update_nvm_checksum_82580(struct e1000_hw *hw); static s32 e1000_update_nvm_checksum_with_offset(struct e1000_hw *hw, - u16 offset); + u16 offset); static s32 e1000_validate_nvm_checksum_with_offset(struct e1000_hw *hw, - u16 offset); + u16 offset); static s32 e1000_validate_nvm_checksum_i350(struct e1000_hw *hw); static s32 e1000_update_nvm_checksum_i350(struct e1000_hw *hw); +static void e1000_write_vfta_i350(struct e1000_hw *hw, u32 offset, u32 value); +static void e1000_clear_vfta_i350(struct e1000_hw *hw); -static const u16 e1000_82580_rxpbs_table[] = - { 36, 72, 144, 1, 2, 4, 8, 16, - 35, 70, 140 }; +static void e1000_i2c_start(struct e1000_hw *hw); +static void e1000_i2c_stop(struct e1000_hw *hw); +static s32 e1000_clock_in_i2c_byte(struct e1000_hw *hw, u8 *data); +static s32 e1000_clock_out_i2c_byte(struct e1000_hw *hw, u8 data); +static s32 e1000_get_i2c_ack(struct e1000_hw *hw); +static s32 e1000_clock_in_i2c_bit(struct e1000_hw *hw, bool *data); +static s32 e1000_clock_out_i2c_bit(struct e1000_hw *hw, bool data); +static void e1000_raise_i2c_clk(struct e1000_hw *hw, u32 *i2cctl); +static void e1000_lower_i2c_clk(struct e1000_hw *hw, u32 *i2cctl); +static s32 e1000_set_i2c_data(struct e1000_hw *hw, u32 *i2cctl, bool data); +static bool e1000_get_i2c_data(u32 *i2cctl); + +static const u16 e1000_82580_rxpbs_table[] = { + 36, 72, 144, 1, 2, 4, 8, 16, 35, 70, 140 }; #define E1000_82580_RXPBS_TABLE_SIZE \ (sizeof(e1000_82580_rxpbs_table)/sizeof(u16)) @@ -147,6 +165,9 @@ static s32 e1000_init_phy_params_82575(struct e1000_hw *hw) DEBUGFUNC("e1000_init_phy_params_82575"); + phy->ops.read_i2c_byte = e1000_read_i2c_byte_generic; + phy->ops.write_i2c_byte = e1000_write_i2c_byte_generic; + if (hw->phy.media_type != e1000_media_type_copper) { phy->type = e1000_phy_none; goto out; @@ -155,22 +176,22 @@ static s32 e1000_init_phy_params_82575(struct e1000_hw *hw) phy->ops.power_up = e1000_power_up_phy_copper; phy->ops.power_down = e1000_power_down_phy_copper_82575; - phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT; - phy->reset_delay_us = 100; + phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT; + phy->reset_delay_us = 100; - phy->ops.acquire = e1000_acquire_phy_82575; - phy->ops.check_reset_block = e1000_check_reset_block_generic; - phy->ops.commit = e1000_phy_sw_reset_generic; - phy->ops.get_cfg_done = e1000_get_cfg_done_82575; - phy->ops.release = e1000_release_phy_82575; + phy->ops.acquire = e1000_acquire_phy_82575; + phy->ops.check_reset_block = e1000_check_reset_block_generic; + phy->ops.commit = e1000_phy_sw_reset_generic; + phy->ops.get_cfg_done = e1000_get_cfg_done_82575; + phy->ops.release = e1000_release_phy_82575; ctrl_ext = E1000_READ_REG(hw, E1000_CTRL_EXT); if (e1000_sgmii_active_82575(hw)) { - phy->ops.reset = e1000_phy_hw_reset_sgmii_82575; + phy->ops.reset = e1000_phy_hw_reset_sgmii_82575; ctrl_ext |= E1000_CTRL_I2C_ENA; } else { - phy->ops.reset = e1000_phy_hw_reset_generic; + phy->ops.reset = e1000_phy_hw_reset_generic; ctrl_ext &= ~E1000_CTRL_I2C_ENA; } @@ -178,14 +199,24 @@ static s32 e1000_init_phy_params_82575(struct e1000_hw *hw) e1000_reset_mdicnfg_82580(hw); if (e1000_sgmii_active_82575(hw) && !e1000_sgmii_uses_mdio_82575(hw)) { - phy->ops.read_reg = e1000_read_phy_reg_sgmii_82575; - phy->ops.write_reg = e1000_write_phy_reg_sgmii_82575; - } else if (hw->mac.type >= e1000_82580) { - phy->ops.read_reg = e1000_read_phy_reg_82580; - phy->ops.write_reg = e1000_write_phy_reg_82580; + phy->ops.read_reg = e1000_read_phy_reg_sgmii_82575; + phy->ops.write_reg = e1000_write_phy_reg_sgmii_82575; } else { - phy->ops.read_reg = e1000_read_phy_reg_igp; - phy->ops.write_reg = e1000_write_phy_reg_igp; + switch (hw->mac.type) { + case e1000_82580: + case e1000_i350: + phy->ops.read_reg = e1000_read_phy_reg_82580; + phy->ops.write_reg = e1000_write_phy_reg_82580; + break; + case e1000_i210: + case e1000_i211: + phy->ops.read_reg = e1000_read_phy_reg_gs40g; + phy->ops.write_reg = e1000_write_phy_reg_gs40g; + break; + default: + phy->ops.read_reg = e1000_read_phy_reg_igp; + phy->ops.write_reg = e1000_write_phy_reg_igp; + } } /* Set phy->phy_addr and phy->id. */ @@ -197,36 +228,47 @@ static s32 e1000_init_phy_params_82575(struct e1000_hw *hw) case M88E1112_E_PHY_ID: case M88E1340M_E_PHY_ID: case M88E1111_I_PHY_ID: - phy->type = e1000_phy_m88; - phy->ops.check_polarity = e1000_check_polarity_m88; - phy->ops.get_info = e1000_get_phy_info_m88; + phy->type = e1000_phy_m88; + phy->ops.check_polarity = e1000_check_polarity_m88; + phy->ops.get_info = e1000_get_phy_info_m88; if (phy->id == I347AT4_E_PHY_ID || phy->id == M88E1112_E_PHY_ID || phy->id == M88E1340M_E_PHY_ID) - phy->ops.get_cable_length = e1000_get_cable_length_m88_gen2; + phy->ops.get_cable_length = + e1000_get_cable_length_m88_gen2; else phy->ops.get_cable_length = e1000_get_cable_length_m88; phy->ops.force_speed_duplex = e1000_phy_force_speed_duplex_m88; break; case IGP03E1000_E_PHY_ID: case IGP04E1000_E_PHY_ID: - phy->type = e1000_phy_igp_3; - phy->ops.check_polarity = e1000_check_polarity_igp; - phy->ops.get_info = e1000_get_phy_info_igp; - phy->ops.get_cable_length = e1000_get_cable_length_igp_2; + phy->type = e1000_phy_igp_3; + phy->ops.check_polarity = e1000_check_polarity_igp; + phy->ops.get_info = e1000_get_phy_info_igp; + phy->ops.get_cable_length = e1000_get_cable_length_igp_2; phy->ops.force_speed_duplex = e1000_phy_force_speed_duplex_igp; - phy->ops.set_d0_lplu_state = e1000_set_d0_lplu_state_82575; - phy->ops.set_d3_lplu_state = e1000_set_d3_lplu_state_generic; + phy->ops.set_d0_lplu_state = e1000_set_d0_lplu_state_82575; + phy->ops.set_d3_lplu_state = e1000_set_d3_lplu_state_generic; break; case I82580_I_PHY_ID: case I350_I_PHY_ID: - phy->type = e1000_phy_82580; - phy->ops.check_polarity = e1000_check_polarity_82577; - phy->ops.force_speed_duplex = e1000_phy_force_speed_duplex_82577; - phy->ops.get_cable_length = e1000_get_cable_length_82577; - phy->ops.get_info = e1000_get_phy_info_82577; - phy->ops.set_d0_lplu_state = e1000_set_d0_lplu_state_82580; - phy->ops.set_d3_lplu_state = e1000_set_d3_lplu_state_82580; + phy->type = e1000_phy_82580; + phy->ops.check_polarity = e1000_check_polarity_82577; + phy->ops.force_speed_duplex = + e1000_phy_force_speed_duplex_82577; + phy->ops.get_cable_length = e1000_get_cable_length_82577; + phy->ops.get_info = e1000_get_phy_info_82577; + phy->ops.set_d0_lplu_state = e1000_set_d0_lplu_state_82580; + phy->ops.set_d3_lplu_state = e1000_set_d3_lplu_state_82580; + break; + case I210_I_PHY_ID: + phy->type = e1000_phy_i210; + phy->ops.check_polarity = e1000_check_polarity_m88; + phy->ops.get_info = e1000_get_phy_info_m88; + phy->ops.get_cable_length = e1000_get_cable_length_m88_gen2; + phy->ops.set_d0_lplu_state = e1000_set_d0_lplu_state_82580; + phy->ops.set_d3_lplu_state = e1000_set_d3_lplu_state_82580; + phy->ops.force_speed_duplex = e1000_phy_force_speed_duplex_m88; break; default: ret_val = -E1000_ERR_PHY; @@ -250,50 +292,60 @@ s32 e1000_init_nvm_params_82575(struct e1000_hw *hw) DEBUGFUNC("e1000_init_nvm_params_82575"); size = (u16)((eecd & E1000_EECD_SIZE_EX_MASK) >> - E1000_EECD_SIZE_EX_SHIFT); + E1000_EECD_SIZE_EX_SHIFT); /* * Added to a constant, "size" becomes the left-shift value * for setting word_size. */ size += NVM_WORD_SIZE_BASE_SHIFT; + /* Just in case size is out of range, cap it to the largest + * EEPROM size supported + */ + if (size > 15) + size = 15; + nvm->word_size = 1 << size; - nvm->opcode_bits = 8; - nvm->delay_usec = 1; - switch (nvm->override) { - case e1000_nvm_override_spi_large: - nvm->page_size = 32; - nvm->address_bits = 16; - break; - case e1000_nvm_override_spi_small: - nvm->page_size = 8; - nvm->address_bits = 8; - break; - default: - nvm->page_size = eecd & E1000_EECD_ADDR_BITS ? 32 : 8; - nvm->address_bits = eecd & E1000_EECD_ADDR_BITS ? 16 : 8; - break; + if (hw->mac.type < e1000_i210) { + nvm->opcode_bits = 8; + nvm->delay_usec = 1; + + switch (nvm->override) { + case e1000_nvm_override_spi_large: + nvm->page_size = 32; + nvm->address_bits = 16; + break; + case e1000_nvm_override_spi_small: + nvm->page_size = 8; + nvm->address_bits = 8; + break; + default: + nvm->page_size = eecd & E1000_EECD_ADDR_BITS ? 32 : 8; + nvm->address_bits = eecd & E1000_EECD_ADDR_BITS ? + 16 : 8; + break; + } + if (nvm->word_size == (1 << 15)) + nvm->page_size = 128; + + nvm->type = e1000_nvm_eeprom_spi; + } else { + nvm->type = e1000_nvm_flash_hw; } - - nvm->type = e1000_nvm_eeprom_spi; - - if (nvm->word_size == (1 << 15)) - nvm->page_size = 128; - /* Function Pointers */ - nvm->ops.acquire = e1000_acquire_nvm_82575; - nvm->ops.release = e1000_release_nvm_82575; + nvm->ops.acquire = e1000_acquire_nvm_82575; + nvm->ops.release = e1000_release_nvm_82575; if (nvm->word_size < (1 << 15)) - nvm->ops.read = e1000_read_nvm_eerd; + nvm->ops.read = e1000_read_nvm_eerd; else - nvm->ops.read = e1000_read_nvm_spi; + nvm->ops.read = e1000_read_nvm_spi; - nvm->ops.write = e1000_write_nvm_spi; - nvm->ops.validate = e1000_validate_nvm_checksum_generic; - nvm->ops.update = e1000_update_nvm_checksum_generic; - nvm->ops.valid_led_default = e1000_valid_led_default_82575; + nvm->ops.write = e1000_write_nvm_spi; + nvm->ops.validate = e1000_validate_nvm_checksum_generic; + nvm->ops.update = e1000_update_nvm_checksum_generic; + nvm->ops.valid_led_default = e1000_valid_led_default_82575; - /* override genric family function pointers for specific descendants */ + /* override generic family function pointers for specific descendants */ switch (hw->mac.type) { case e1000_82580: nvm->ops.validate = e1000_validate_nvm_checksum_82580; @@ -318,34 +370,11 @@ static s32 e1000_init_mac_params_82575(struct e1000_hw *hw) { struct e1000_mac_info *mac = &hw->mac; struct e1000_dev_spec_82575 *dev_spec = &hw->dev_spec._82575; - u32 ctrl_ext = 0; DEBUGFUNC("e1000_init_mac_params_82575"); - /* Set media type */ - /* - * The 82575 uses bits 22:23 for link mode. The mode can be changed - * based on the EEPROM. We cannot rely upon device ID. There - * is no distinguishable difference between fiber and internal - * SerDes mode on the 82575. There can be an external PHY attached - * on the SGMII interface. For this, we'll set sgmii_active to TRUE. - */ - hw->phy.media_type = e1000_media_type_copper; - dev_spec->sgmii_active = FALSE; - - ctrl_ext = E1000_READ_REG(hw, E1000_CTRL_EXT); - switch (ctrl_ext & E1000_CTRL_EXT_LINK_MODE_MASK) { - case E1000_CTRL_EXT_LINK_MODE_SGMII: - dev_spec->sgmii_active = TRUE; - break; - case E1000_CTRL_EXT_LINK_MODE_1000BASE_KX: - case E1000_CTRL_EXT_LINK_MODE_PCIE_SERDES: - hw->phy.media_type = e1000_media_type_internal_serdes; - break; - default: - break; - } - + /* Derives media type */ + e1000_get_media_type_82575(hw); /* Set mta register count */ mac->mta_reg_count = 128; /* Set uta register count */ @@ -368,8 +397,7 @@ static s32 e1000_init_mac_params_82575(struct e1000_hw *hw) mac->has_fwsm = TRUE; /* ARC supported; valid only if manageability features are enabled. */ mac->arc_subsystem_valid = - (E1000_READ_REG(hw, E1000_FWSM) & E1000_FWSM_MODE_MASK) - ? TRUE : FALSE; + !!(E1000_READ_REG(hw, E1000_FWSM) & E1000_FWSM_MODE_MASK); /* Function pointers */ @@ -386,27 +414,31 @@ static s32 e1000_init_mac_params_82575(struct e1000_hw *hw) mac->ops.setup_link = e1000_setup_link_generic; /* physical interface link setup */ mac->ops.setup_physical_interface = - (hw->phy.media_type == e1000_media_type_copper) - ? e1000_setup_copper_link_82575 - : e1000_setup_serdes_link_82575; + (hw->phy.media_type == e1000_media_type_copper) + ? e1000_setup_copper_link_82575 : e1000_setup_serdes_link_82575; /* physical interface shutdown */ mac->ops.shutdown_serdes = e1000_shutdown_serdes_link_82575; /* physical interface power up */ mac->ops.power_up_serdes = e1000_power_up_serdes_link_82575; /* check for link */ mac->ops.check_for_link = e1000_check_for_link_82575; - /* receive address register setting */ - mac->ops.rar_set = e1000_rar_set_generic; /* read mac address */ mac->ops.read_mac_addr = e1000_read_mac_addr_82575; /* configure collision distance */ mac->ops.config_collision_dist = e1000_config_collision_dist_82575; /* multicast address update */ mac->ops.update_mc_addr_list = e1000_update_mc_addr_list_generic; - /* writing VFTA */ - mac->ops.write_vfta = e1000_write_vfta_generic; - /* clearing VFTA */ - mac->ops.clear_vfta = e1000_clear_vfta_generic; + if (hw->mac.type == e1000_i350) { + /* writing VFTA */ + mac->ops.write_vfta = e1000_write_vfta_i350; + /* clearing VFTA */ + mac->ops.clear_vfta = e1000_clear_vfta_i350; + } else { + /* writing VFTA */ + mac->ops.write_vfta = e1000_write_vfta_generic; + /* clearing VFTA */ + mac->ops.clear_vfta = e1000_clear_vfta_generic; + } /* ID LED init */ mac->ops.id_led_init = e1000_id_led_init_generic; /* blink LED */ @@ -422,6 +454,13 @@ static s32 e1000_init_mac_params_82575(struct e1000_hw *hw) mac->ops.clear_hw_cntrs = e1000_clear_hw_cntrs_82575; /* link info */ mac->ops.get_link_up_info = e1000_get_link_up_info_82575; + /* acquire SW_FW sync */ + mac->ops.acquire_swfw_sync = e1000_acquire_swfw_sync_82575; + mac->ops.release_swfw_sync = e1000_release_swfw_sync_82575; + if (mac->type >= e1000_i210) { + mac->ops.acquire_swfw_sync = e1000_acquire_swfw_sync_i210; + mac->ops.release_swfw_sync = e1000_release_swfw_sync_i210; + } /* set lan id for port to determine which phy lock to use */ hw->mac.ops.set_lan_id(hw); @@ -464,7 +503,7 @@ static s32 e1000_acquire_phy_82575(struct e1000_hw *hw) else if (hw->bus.func == E1000_FUNC_3) mask = E1000_SWFW_PHY3_SM; - return e1000_acquire_swfw_sync_82575(hw, mask); + return hw->mac.ops.acquire_swfw_sync(hw, mask); } /** @@ -486,7 +525,7 @@ static void e1000_release_phy_82575(struct e1000_hw *hw) else if (hw->bus.func == E1000_FUNC_3) mask = E1000_SWFW_PHY3_SM; - e1000_release_swfw_sync_82575(hw, mask); + hw->mac.ops.release_swfw_sync(hw, mask); } /** @@ -499,7 +538,7 @@ static void e1000_release_phy_82575(struct e1000_hw *hw) * interface and stores the retrieved information in data. **/ static s32 e1000_read_phy_reg_sgmii_82575(struct e1000_hw *hw, u32 offset, - u16 *data) + u16 *data) { s32 ret_val = -E1000_ERR_PARAM; @@ -532,7 +571,7 @@ out: * media independent interface. **/ static s32 e1000_write_phy_reg_sgmii_82575(struct e1000_hw *hw, u32 offset, - u16 data) + u16 data) { s32 ret_val = -E1000_ERR_PARAM; @@ -611,7 +650,7 @@ static s32 e1000_get_phy_id_82575(struct e1000_hw *hw) /* Power on sgmii phy if it is disabled */ ctrl_ext = E1000_READ_REG(hw, E1000_CTRL_EXT); E1000_WRITE_REG(hw, E1000_CTRL_EXT, - ctrl_ext & ~E1000_CTRL_EXT_SDP3_DATA); + ctrl_ext & ~E1000_CTRL_EXT_SDP3_DATA); E1000_WRITE_FLUSH(hw); msec_delay(300); @@ -623,8 +662,7 @@ static s32 e1000_get_phy_id_82575(struct e1000_hw *hw) ret_val = e1000_read_phy_reg_sgmii_82575(hw, PHY_ID1, &phy_id); if (ret_val == E1000_SUCCESS) { DEBUGOUT2("Vendor ID 0x%08X read at address %u\n", - phy_id, - phy->addr); + phy_id, phy->addr); /* * At the time of this writing, The M88 part is * the only supported SGMII PHY product. @@ -633,7 +671,7 @@ static s32 e1000_get_phy_id_82575(struct e1000_hw *hw) break; } else { DEBUGOUT1("PHY address %u was unreadable\n", - phy->addr); + phy->addr); } } @@ -719,22 +757,22 @@ static s32 e1000_set_d0_lplu_state_82575(struct e1000_hw *hw, bool active) if (active) { data |= IGP02E1000_PM_D0_LPLU; ret_val = phy->ops.write_reg(hw, IGP02E1000_PHY_POWER_MGMT, - data); + data); if (ret_val) goto out; /* When LPLU is enabled, we should disable SmartSpeed */ ret_val = phy->ops.read_reg(hw, IGP01E1000_PHY_PORT_CONFIG, - &data); + &data); data &= ~IGP01E1000_PSCFR_SMART_SPEED; ret_val = phy->ops.write_reg(hw, IGP01E1000_PHY_PORT_CONFIG, - data); + data); if (ret_val) goto out; } else { data &= ~IGP02E1000_PM_D0_LPLU; ret_val = phy->ops.write_reg(hw, IGP02E1000_PHY_POWER_MGMT, - data); + data); /* * LPLU and SmartSpeed are mutually exclusive. LPLU is used * during Dx states where the power conservation is most @@ -743,28 +781,28 @@ static s32 e1000_set_d0_lplu_state_82575(struct e1000_hw *hw, bool active) */ if (phy->smart_speed == e1000_smart_speed_on) { ret_val = phy->ops.read_reg(hw, - IGP01E1000_PHY_PORT_CONFIG, - &data); + IGP01E1000_PHY_PORT_CONFIG, + &data); if (ret_val) goto out; data |= IGP01E1000_PSCFR_SMART_SPEED; ret_val = phy->ops.write_reg(hw, - IGP01E1000_PHY_PORT_CONFIG, - data); + IGP01E1000_PHY_PORT_CONFIG, + data); if (ret_val) goto out; } else if (phy->smart_speed == e1000_smart_speed_off) { ret_val = phy->ops.read_reg(hw, - IGP01E1000_PHY_PORT_CONFIG, - &data); + IGP01E1000_PHY_PORT_CONFIG, + &data); if (ret_val) goto out; data &= ~IGP01E1000_PSCFR_SMART_SPEED; ret_val = phy->ops.write_reg(hw, - IGP01E1000_PHY_PORT_CONFIG, - data); + IGP01E1000_PHY_PORT_CONFIG, + data); if (ret_val) goto out; } @@ -791,7 +829,7 @@ static s32 e1000_set_d0_lplu_state_82580(struct e1000_hw *hw, bool active) { struct e1000_phy_info *phy = &hw->phy; s32 ret_val = E1000_SUCCESS; - u16 data; + u32 data; DEBUGFUNC("e1000_set_d0_lplu_state_82580"); @@ -811,11 +849,10 @@ static s32 e1000_set_d0_lplu_state_82580(struct e1000_hw *hw, bool active) * important. During driver activity we should enable * SmartSpeed, so performance is maintained. */ - if (phy->smart_speed == e1000_smart_speed_on) { + if (phy->smart_speed == e1000_smart_speed_on) data |= E1000_82580_PM_SPD; - } else if (phy->smart_speed == e1000_smart_speed_off) { + else if (phy->smart_speed == e1000_smart_speed_off) data &= ~E1000_82580_PM_SPD; - } } E1000_WRITE_REG(hw, E1000_82580_PHY_POWER_MGMT, data); @@ -840,7 +877,7 @@ s32 e1000_set_d3_lplu_state_82580(struct e1000_hw *hw, bool active) { struct e1000_phy_info *phy = &hw->phy; s32 ret_val = E1000_SUCCESS; - u16 data; + u32 data; DEBUGFUNC("e1000_set_d3_lplu_state_82580"); @@ -854,14 +891,13 @@ s32 e1000_set_d3_lplu_state_82580(struct e1000_hw *hw, bool active) * important. During driver activity we should enable * SmartSpeed, so performance is maintained. */ - if (phy->smart_speed == e1000_smart_speed_on) { + if (phy->smart_speed == e1000_smart_speed_on) data |= E1000_82580_PM_SPD; - } else if (phy->smart_speed == e1000_smart_speed_off) { + else if (phy->smart_speed == e1000_smart_speed_off) data &= ~E1000_82580_PM_SPD; - } } else if ((phy->autoneg_advertised == E1000_ALL_SPEED_DUPLEX) || - (phy->autoneg_advertised == E1000_ALL_NOT_GIG) || - (phy->autoneg_advertised == E1000_ALL_10_SPEED)) { + (phy->autoneg_advertised == E1000_ALL_NOT_GIG) || + (phy->autoneg_advertised == E1000_ALL_10_SPEED)) { data |= E1000_82580_PM_D3_LPLU; /* When LPLU is enabled, we should disable SmartSpeed */ data &= ~E1000_82580_PM_SPD; @@ -889,6 +925,32 @@ static s32 e1000_acquire_nvm_82575(struct e1000_hw *hw) ret_val = e1000_acquire_swfw_sync_82575(hw, E1000_SWFW_EEP_SM); if (ret_val) goto out; + + /* + * Check if there is some access + * error this access may hook on + */ + if (hw->mac.type == e1000_i350) { + u32 eecd = E1000_READ_REG(hw, E1000_EECD); + if (eecd & (E1000_EECD_BLOCKED | E1000_EECD_ABORT | + E1000_EECD_TIMEOUT)) { + /* Clear all access error flags */ + E1000_WRITE_REG(hw, E1000_EECD, eecd | + E1000_EECD_ERROR_CLR); + DEBUGOUT("Nvm bit banging access error detected and cleared.\n"); + } + } + if (hw->mac.type == e1000_82580) { + u32 eecd = E1000_READ_REG(hw, E1000_EECD); + if (eecd & E1000_EECD_BLOCKED) { + /* Clear access error flag */ + E1000_WRITE_REG(hw, E1000_EECD, eecd | + E1000_EECD_BLOCKED); + DEBUGOUT("Nvm bit banging access error detected and cleared.\n"); + } + } + + ret_val = e1000_acquire_nvm_generic(hw); if (ret_val) e1000_release_swfw_sync_82575(hw, E1000_SWFW_EEP_SM); @@ -908,6 +970,8 @@ static void e1000_release_nvm_82575(struct e1000_hw *hw) { DEBUGFUNC("e1000_release_nvm_82575"); + e1000_release_nvm_generic(hw); + e1000_release_swfw_sync_82575(hw, E1000_SWFW_EEP_SM); } @@ -977,8 +1041,8 @@ static void e1000_release_swfw_sync_82575(struct e1000_hw *hw, u16 mask) DEBUGFUNC("e1000_release_swfw_sync_82575"); - while (e1000_get_hw_semaphore_generic(hw) != E1000_SUCCESS); - /* Empty */ + while (e1000_get_hw_semaphore_generic(hw) != E1000_SUCCESS) + ; /* Empty */ swfw_sync = E1000_READ_REG(hw, E1000_SW_FW_SYNC); swfw_sync &= ~mask; @@ -1021,7 +1085,7 @@ static s32 e1000_get_cfg_done_82575(struct e1000_hw *hw) DEBUGOUT("MNG configuration cycle has not completed.\n"); /* If EEPROM is not marked present, init the PHY manually */ - if (((E1000_READ_REG(hw, E1000_EECD) & E1000_EECD_PRES) == 0) && + if (!(E1000_READ_REG(hw, E1000_EECD) & E1000_EECD_PRES) && (hw->phy.type == e1000_phy_igp_3)) e1000_phy_init_script_igp3(hw); @@ -1039,7 +1103,7 @@ static s32 e1000_get_cfg_done_82575(struct e1000_hw *hw) * Otherwise, use the generic function to get the link speed and duplex info. **/ static s32 e1000_get_link_up_info_82575(struct e1000_hw *hw, u16 *speed, - u16 *duplex) + u16 *duplex) { s32 ret_val; @@ -1047,10 +1111,10 @@ static s32 e1000_get_link_up_info_82575(struct e1000_hw *hw, u16 *speed, if (hw->phy.media_type != e1000_media_type_copper) ret_val = e1000_get_pcs_speed_and_duplex_82575(hw, speed, - duplex); + duplex); else ret_val = e1000_get_speed_and_duplex_copper_generic(hw, speed, - duplex); + duplex); return ret_val; } @@ -1071,13 +1135,14 @@ static s32 e1000_check_for_link_82575(struct e1000_hw *hw) if (hw->phy.media_type != e1000_media_type_copper) { ret_val = e1000_get_pcs_speed_and_duplex_82575(hw, &speed, - &duplex); + &duplex); /* * Use this flag to determine if link needs to be checked or * not. If we have link clear the flag so that we do not * continue to check for link. */ hw->mac.get_link_status = !hw->mac.serdes_has_link; + } else { ret_val = e1000_check_for_copper_link_generic(hw); } @@ -1124,18 +1189,13 @@ static void e1000_power_up_serdes_link_82575(struct e1000_hw *hw) * duplex, then store the values in the pointers provided. **/ static s32 e1000_get_pcs_speed_and_duplex_82575(struct e1000_hw *hw, - u16 *speed, u16 *duplex) + u16 *speed, u16 *duplex) { struct e1000_mac_info *mac = &hw->mac; u32 pcs; DEBUGFUNC("e1000_get_pcs_speed_and_duplex_82575"); - /* Set up defaults for the return values of this function */ - mac->serdes_has_link = FALSE; - *speed = 0; - *duplex = 0; - /* * Read the PCS Status register for link state. For non-copper mode, * the status register is not accurate. The PCS status register is @@ -1144,28 +1204,28 @@ static s32 e1000_get_pcs_speed_and_duplex_82575(struct e1000_hw *hw, pcs = E1000_READ_REG(hw, E1000_PCS_LSTAT); /* - * The link up bit determines when link is up on autoneg. The sync ok - * gets set once both sides sync up and agree upon link. Stable link - * can be determined by checking for both link up and link sync ok + * The link up bit determines when link is up on autoneg. */ - if ((pcs & E1000_PCS_LSTS_LINK_OK) && (pcs & E1000_PCS_LSTS_SYNK_OK)) { + if (pcs & E1000_PCS_LSTS_LINK_OK) { mac->serdes_has_link = TRUE; /* Detect and store PCS speed */ - if (pcs & E1000_PCS_LSTS_SPEED_1000) { + if (pcs & E1000_PCS_LSTS_SPEED_1000) *speed = SPEED_1000; - } else if (pcs & E1000_PCS_LSTS_SPEED_100) { + else if (pcs & E1000_PCS_LSTS_SPEED_100) *speed = SPEED_100; - } else { + else *speed = SPEED_10; - } /* Detect and store PCS duplex */ - if (pcs & E1000_PCS_LSTS_DUPLEX_FULL) { + if (pcs & E1000_PCS_LSTS_DUPLEX_FULL) *duplex = FULL_DUPLEX; - } else { + else *duplex = HALF_DUPLEX; - } + } else { + mac->serdes_has_link = FALSE; + *speed = 0; + *duplex = 0; } return E1000_SUCCESS; @@ -1225,15 +1285,13 @@ static s32 e1000_reset_hw_82575(struct e1000_hw *hw) * on the last TLP read/write transaction when MAC is reset. */ ret_val = e1000_disable_pcie_master_generic(hw); - if (ret_val) { + if (ret_val) DEBUGOUT("PCI-E Master disable polling has failed.\n"); - } /* set the completion timeout for interface */ ret_val = e1000_set_pcie_completion_timeout(hw); - if (ret_val) { + if (ret_val) DEBUGOUT("PCI-E Set completion timeout has failed.\n"); - } DEBUGOUT("Masking off all interrupts\n"); E1000_WRITE_REG(hw, E1000_IMC, 0xffffffff); @@ -1260,7 +1318,7 @@ static s32 e1000_reset_hw_82575(struct e1000_hw *hw) } /* If EEPROM is not present, run manual init scripts */ - if ((E1000_READ_REG(hw, E1000_EECD) & E1000_EECD_PRES) == 0) + if (!(E1000_READ_REG(hw, E1000_EECD) & E1000_EECD_PRES)) e1000_reset_init_script_82575(hw); /* Clear any pending interrupt events. */ @@ -1314,6 +1372,9 @@ static s32 e1000_init_hw_82575(struct e1000_hw *hw) /* Setup link and flow control */ ret_val = mac->ops.setup_link(hw); + /* Set the default MTU size */ + hw->dev_spec._82575.mtu = 1500; + /* * Clear all of the statistics registers (clear on read). It is * important that we do this after we have tried to establish link @@ -1349,7 +1410,7 @@ static s32 e1000_setup_copper_link_82575(struct e1000_hw *hw) if (ret_val) goto out; - if (e1000_sgmii_active_82575(hw) && !hw->phy.reset_disable) { + if (e1000_sgmii_active_82575(hw)) { /* allow time for SFP cage time to power up phy */ msec_delay(300); @@ -1360,6 +1421,7 @@ static s32 e1000_setup_copper_link_82575(struct e1000_hw *hw) } } switch (hw->phy.type) { + case e1000_phy_i210: case e1000_phy_m88: if (hw->phy.id == I347AT4_E_PHY_ID || hw->phy.id == M88E1112_E_PHY_ID || @@ -1400,12 +1462,14 @@ static s32 e1000_setup_serdes_link_82575(struct e1000_hw *hw) { u32 ctrl_ext, ctrl_reg, reg; bool pcs_autoneg; + s32 ret_val = E1000_SUCCESS; + u16 data; DEBUGFUNC("e1000_setup_serdes_link_82575"); if ((hw->phy.media_type != e1000_media_type_internal_serdes) && !e1000_sgmii_active_82575(hw)) - return E1000_SUCCESS; + return ret_val; /* * On the 82575, SerDes loopback mode persists until it is @@ -1444,13 +1508,25 @@ static s32 e1000_setup_serdes_link_82575(struct e1000_hw *hw) pcs_autoneg = FALSE; /* fall through to default case */ default: + if (hw->mac.type == e1000_82575 || + hw->mac.type == e1000_82576) { + ret_val = hw->nvm.ops.read(hw, NVM_COMPAT, 1, &data); + if (ret_val) { + DEBUGOUT("NVM Read Error\n"); + return ret_val; + } + + if (data & E1000_EEPROM_PCS_AUTONEG_DISABLE_BIT) + pcs_autoneg = FALSE; + } + /* * non-SGMII modes only supports a speed of 1000/Full for the * link so it is best to just force the MAC and let the pcs * link either autoneg or be forced to 1000/Full */ ctrl_reg |= E1000_CTRL_SPD_1000 | E1000_CTRL_FRCSPD | - E1000_CTRL_FD | E1000_CTRL_FRCDPX; + E1000_CTRL_FD | E1000_CTRL_FRCDPX; /* set speed of 1000/Full if speed/duplex is forced */ reg |= E1000_PCS_LCTL_FSV_1000 | E1000_PCS_LCTL_FDV_FULL; @@ -1466,7 +1542,7 @@ static s32 e1000_setup_serdes_link_82575(struct e1000_hw *hw) * However, both are supported by the hardware and some drivers/tools. */ reg &= ~(E1000_PCS_LCTL_AN_ENABLE | E1000_PCS_LCTL_FLV_LINK_UP | - E1000_PCS_LCTL_FSD | E1000_PCS_LCTL_FORCE_LINK); + E1000_PCS_LCTL_FSD | E1000_PCS_LCTL_FORCE_LINK); /* * We force flow control to prevent the CTRL register values from being @@ -1481,7 +1557,7 @@ static s32 e1000_setup_serdes_link_82575(struct e1000_hw *hw) DEBUGOUT1("Configuring Autoneg:PCS_LCTL=0x%08X\n", reg); } else { /* Set PCS register for forced link */ - reg |= E1000_PCS_LCTL_FSD; /* Force Speed */ + reg |= E1000_PCS_LCTL_FSD; /* Force Speed */ DEBUGOUT1("Configuring Forced Link:PCS_LCTL=0x%08X\n", reg); } @@ -1490,7 +1566,213 @@ static s32 e1000_setup_serdes_link_82575(struct e1000_hw *hw) if (!e1000_sgmii_active_82575(hw)) e1000_force_mac_fc_generic(hw); - return E1000_SUCCESS; + return ret_val; +} + +/** + * e1000_get_media_type_82575 - derives current media type. + * @hw: pointer to the HW structure + * + * The media type is chosen reflecting few settings. + * The following are taken into account: + * - link mode set in the current port Init Control Word #3 + * - current link mode settings in CSR register + * - MDIO vs. I2C PHY control interface chosen + * - SFP module media type + **/ +static s32 e1000_get_media_type_82575(struct e1000_hw *hw) +{ + u32 lan_id = 0; + s32 ret_val = E1000_ERR_CONFIG; + struct e1000_dev_spec_82575 *dev_spec = &hw->dev_spec._82575; + u32 ctrl_ext = 0; + u32 current_link_mode = 0; + u16 init_ctrl_wd_3 = 0; + u8 init_ctrl_wd_3_offset = 0; + u8 init_ctrl_wd_3_bit_offset = 0; + + /* Set internal phy as default */ + dev_spec->sgmii_active = FALSE; + dev_spec->module_plugged = FALSE; + + /* + * Check if NVM access method is attached already. + * If it is then Init Control Word #3 is considered + * otherwise runtime CSR register content is taken. + */ + + /* Get CSR setting */ + ctrl_ext = E1000_READ_REG(hw, E1000_CTRL_EXT); + + /* Get link mode setting */ + if ((hw->nvm.ops.read) && (hw->nvm.ops.read != e1000_null_read_nvm)) { + /* Take link mode from EEPROM */ + + /* + * Get LAN port ID to derive its + * adequate Init Control Word #3 + */ + lan_id = ((E1000_READ_REG(hw, E1000_STATUS) & + E1000_STATUS_LAN_ID_MASK) >> E1000_STATUS_LAN_ID_OFFSET); + /* + * Derive Init Control Word #3 offset + * and mask to pick up link mode setting. + */ + if (hw->mac.type < e1000_82580) { + init_ctrl_wd_3_offset = lan_id ? + NVM_INIT_CONTROL3_PORT_A : NVM_INIT_CONTROL3_PORT_B; + init_ctrl_wd_3_bit_offset = NVM_WORD24_LNK_MODE_OFFSET; + } else { + init_ctrl_wd_3_offset = + NVM_82580_LAN_FUNC_OFFSET(lan_id) + + NVM_INIT_CONTROL3_PORT_A; + init_ctrl_wd_3_bit_offset = + NVM_WORD24_82580_LNK_MODE_OFFSET; + } + /* Read Init Control Word #3*/ + hw->nvm.ops.read(hw, init_ctrl_wd_3_offset, 1, &init_ctrl_wd_3); + + /* + * Align link mode bits to + * their CTRL_EXT location. + */ + current_link_mode = init_ctrl_wd_3; + current_link_mode <<= (E1000_CTRL_EXT_LINK_MODE_OFFSET - + init_ctrl_wd_3_bit_offset); + current_link_mode &= E1000_CTRL_EXT_LINK_MODE_MASK; + + /* + * Switch to CSR for all but internal PHY. + */ + if (current_link_mode != E1000_CTRL_EXT_LINK_MODE_GMII) + /* Take link mode from CSR */ + current_link_mode = ctrl_ext & + E1000_CTRL_EXT_LINK_MODE_MASK; + } else { + /* Take link mode from CSR */ + current_link_mode = ctrl_ext & E1000_CTRL_EXT_LINK_MODE_MASK; + } + + switch (current_link_mode) { + + case E1000_CTRL_EXT_LINK_MODE_1000BASE_KX: + hw->phy.media_type = e1000_media_type_internal_serdes; + current_link_mode = E1000_CTRL_EXT_LINK_MODE_1000BASE_KX; + break; + case E1000_CTRL_EXT_LINK_MODE_GMII: + hw->phy.media_type = e1000_media_type_copper; + current_link_mode = E1000_CTRL_EXT_LINK_MODE_GMII; + break; + case E1000_CTRL_EXT_LINK_MODE_SGMII: + case E1000_CTRL_EXT_LINK_MODE_PCIE_SERDES: + /* Get phy control interface type set (MDIO vs. I2C)*/ + if (e1000_sgmii_uses_mdio_82575(hw)) { + hw->phy.media_type = e1000_media_type_copper; + dev_spec->sgmii_active = TRUE; + current_link_mode = E1000_CTRL_EXT_LINK_MODE_SGMII; + } else { + ret_val = e1000_set_sfp_media_type_82575(hw); + if (ret_val != E1000_SUCCESS) + goto out; + if (hw->phy.media_type == + e1000_media_type_internal_serdes) { + current_link_mode = + E1000_CTRL_EXT_LINK_MODE_PCIE_SERDES; + } else if (hw->phy.media_type == + e1000_media_type_copper) { + current_link_mode = + E1000_CTRL_EXT_LINK_MODE_SGMII; + } + } + break; + default: + DEBUGOUT("Link mode mask doesn't fit bit field size\n"); + goto out; + } + /* + * Do not change current link mode setting + * if media type is fibre or has not been + * recognized. + */ + if ((hw->phy.media_type != e1000_media_type_unknown) && + (hw->phy.media_type != e1000_media_type_fiber)) { + /* Update link mode */ + ctrl_ext &= ~E1000_CTRL_EXT_LINK_MODE_MASK; + E1000_WRITE_REG(hw, E1000_CTRL_EXT, ctrl_ext | + current_link_mode); + } + + ret_val = E1000_SUCCESS; +out: + /* + * If media type was not identified then return media type + * defined by the CTRL_EXT settings. + */ + if (hw->phy.media_type == e1000_media_type_unknown) { + if (current_link_mode == E1000_CTRL_EXT_LINK_MODE_SGMII) + hw->phy.media_type = e1000_media_type_copper; + else + hw->phy.media_type = e1000_media_type_internal_serdes; + } + + return ret_val; +} + +/** + * e1000_set_sfp_media_type_82575 - derives SFP module media type. + * @hw: pointer to the HW structure + * + * The media type is chosen based on SFP module. + * compatibility flags retrieved from SFP ID EEPROM. + **/ +static s32 e1000_set_sfp_media_type_82575(struct e1000_hw *hw) +{ + s32 ret_val = E1000_ERR_CONFIG; + u32 ctrl_ext = 0; + struct e1000_dev_spec_82575 *dev_spec = &hw->dev_spec._82575; + struct sfp_e1000_flags eth_flags = {0}; + u8 tranceiver_type = 0; + + /* Turn I2C interface ON */ + ctrl_ext = E1000_READ_REG(hw, E1000_CTRL_EXT); + E1000_WRITE_REG(hw, E1000_CTRL_EXT, ctrl_ext | E1000_CTRL_I2C_ENA); + + /* Read SFP module data */ + ret_val = e1000_read_sfp_data_byte(hw, + E1000_I2CCMD_SFP_DATA_ADDR(E1000_SFF_IDENTIFIER_OFFSET), + &tranceiver_type); + if (ret_val != E1000_SUCCESS) + goto out; + ret_val = e1000_read_sfp_data_byte(hw, + E1000_I2CCMD_SFP_DATA_ADDR(E1000_SFF_ETH_FLAGS_OFFSET), + (u8 *)ð_flags); + if (ret_val != E1000_SUCCESS) + goto out; + /* + * Check if there is some SFP + * module plugged and powered + */ + if ((tranceiver_type == E1000_SFF_IDENTIFIER_SFP) || + (tranceiver_type == E1000_SFF_IDENTIFIER_SFF)) { + dev_spec->module_plugged = TRUE; + if (eth_flags.e1000_base_lx || eth_flags.e1000_base_sx) { + hw->phy.media_type = e1000_media_type_internal_serdes; + } else if (eth_flags.e1000_base_t) { + dev_spec->sgmii_active = TRUE; + hw->phy.media_type = e1000_media_type_copper; + } else { + hw->phy.media_type = e1000_media_type_unknown; + DEBUGOUT("PHY module has not been recognized\n"); + goto out; + } + } else { + hw->phy.media_type = e1000_media_type_unknown; + } + ret_val = E1000_SUCCESS; +out: + /* Restore I2C interface setting */ + E1000_WRITE_REG(hw, E1000_CTRL_EXT, ctrl_ext); + return ret_val; } /** @@ -1514,7 +1796,7 @@ static s32 e1000_valid_led_default_82575(struct e1000_hw *hw, u16 *data) } if (*data == ID_LED_RESERVED_0000 || *data == ID_LED_RESERVED_FFFF) { - switch(hw->phy.media_type) { + switch (hw->phy.media_type) { case e1000_media_type_internal_serdes: *data = ID_LED_DEFAULT_82575_SERDES; break; @@ -1549,7 +1831,7 @@ static bool e1000_sgmii_active_82575(struct e1000_hw *hw) * Inits recommended HW defaults after a reset when there is no EEPROM * detected. This is only for the 82575. **/ -static s32 e1000_reset_init_script_82575(struct e1000_hw* hw) +static s32 e1000_reset_init_script_82575(struct e1000_hw *hw) { DEBUGFUNC("e1000_reset_init_script_82575"); @@ -1736,7 +2018,7 @@ void e1000_rx_fifo_flush_82575(struct e1000_hw *hw) for (i = 0; i < 4; i++) { rxdctl[i] = E1000_READ_REG(hw, E1000_RXDCTL(i)); E1000_WRITE_REG(hw, E1000_RXDCTL(i), - rxdctl[i] & ~E1000_RXDCTL_QUEUE_ENABLE); + rxdctl[i] & ~E1000_RXDCTL_QUEUE_ENABLE); } /* Poll all queues to verify they have shut down */ for (ms_wait = 0; ms_wait < 10; ms_wait++) { @@ -1822,14 +2104,14 @@ static s32 e1000_set_pcie_completion_timeout(struct e1000_hw *hw) * 16ms to 55ms */ ret_val = e1000_read_pcie_cap_reg(hw, PCIE_DEVICE_CONTROL2, - &pcie_devctl2); + &pcie_devctl2); if (ret_val) goto out; pcie_devctl2 |= PCIE_DEVICE_CONTROL2_16ms; ret_val = e1000_write_pcie_cap_reg(hw, PCIE_DEVICE_CONTROL2, - &pcie_devctl2); + &pcie_devctl2); out: /* disable completion timeout resend */ gcr &= ~E1000_GCR_CMPL_TMOUT_RESEND; @@ -1852,20 +2134,35 @@ void e1000_vmdq_set_anti_spoofing_pf(struct e1000_hw *hw, bool enable, int pf) switch (hw->mac.type) { case e1000_82576: - case e1000_i350: dtxswc = E1000_READ_REG(hw, E1000_DTXSWC); if (enable) { dtxswc |= (E1000_DTXSWC_MAC_SPOOF_MASK | E1000_DTXSWC_VLAN_SPOOF_MASK); /* The PF can spoof - it has to in order to * support emulation mode NICs */ - dtxswc ^= (1 << pf | 1 << (pf + MAX_NUM_VFS)); + dtxswc ^= (1 << pf | 1 << (pf + + E1000_DTXSWC_VLAN_SPOOF_SHIFT)); } else { dtxswc &= ~(E1000_DTXSWC_MAC_SPOOF_MASK | E1000_DTXSWC_VLAN_SPOOF_MASK); } E1000_WRITE_REG(hw, E1000_DTXSWC, dtxswc); break; + case e1000_i350: + dtxswc = E1000_READ_REG(hw, E1000_TXSWC); + if (enable) { + dtxswc |= (E1000_DTXSWC_MAC_SPOOF_MASK | + E1000_DTXSWC_VLAN_SPOOF_MASK); + /* The PF can spoof - it has to in order to + * support emulation mode NICs + */ + dtxswc ^= (1 << pf | 1 << (pf + + E1000_DTXSWC_VLAN_SPOOF_SHIFT)); + } else { + dtxswc &= ~(E1000_DTXSWC_MAC_SPOOF_MASK | + E1000_DTXSWC_VLAN_SPOOF_MASK); + } + E1000_WRITE_REG(hw, E1000_TXSWC, dtxswc); default: break; } @@ -2001,8 +2298,8 @@ static s32 e1000_reset_mdicnfg_82580(struct e1000_hw *hw) goto out; ret_val = hw->nvm.ops.read(hw, NVM_INIT_CONTROL3_PORT_A + - NVM_82580_LAN_FUNC_OFFSET(hw->bus.func), 1, - &nvm_data); + NVM_82580_LAN_FUNC_OFFSET(hw->bus.func), 1, + &nvm_data); if (ret_val) { DEBUGOUT("NVM Read Error\n"); goto out; @@ -2057,17 +2354,18 @@ static s32 e1000_reset_hw_82580(struct e1000_hw *hw) msec_delay(10); /* Determine whether or not a global dev reset is requested */ - if (global_device_reset && - e1000_acquire_swfw_sync_82575(hw, swmbsw_mask)) + if (global_device_reset && hw->mac.ops.acquire_swfw_sync(hw, + swmbsw_mask)) global_device_reset = FALSE; - if (global_device_reset && - !(E1000_READ_REG(hw, E1000_STATUS) & E1000_STAT_DEV_RST_SET)) + if (global_device_reset && !(E1000_READ_REG(hw, E1000_STATUS) & + E1000_STAT_DEV_RST_SET)) ctrl |= E1000_CTRL_DEV_RST; else ctrl |= E1000_CTRL_RST; E1000_WRITE_REG(hw, E1000_CTRL, ctrl); + E1000_WRITE_FLUSH(hw); /* Add delay to insure DEV_RST has time to complete */ if (global_device_reset) @@ -2084,7 +2382,7 @@ static s32 e1000_reset_hw_82580(struct e1000_hw *hw) } /* If EEPROM is not present, run manual init scripts */ - if ((E1000_READ_REG(hw, E1000_EECD) & E1000_EECD_PRES) == 0) + if (!(E1000_READ_REG(hw, E1000_EECD) & E1000_EECD_PRES)) e1000_reset_init_script_82575(hw); /* clear global device reset status bit */ @@ -2103,7 +2401,7 @@ static s32 e1000_reset_hw_82580(struct e1000_hw *hw) /* Release semaphore */ if (global_device_reset) - e1000_release_swfw_sync_82575(hw, swmbsw_mask); + hw->mac.ops.release_swfw_sync(hw, swmbsw_mask); return ret_val; } @@ -2192,7 +2490,7 @@ s32 e1000_update_nvm_checksum_with_offset(struct e1000_hw *hw, u16 offset) } checksum = (u16) NVM_SUM - checksum; ret_val = hw->nvm.ops.write(hw, (NVM_CHECKSUM_REG + offset), 1, - &checksum); + &checksum); if (ret_val) DEBUGOUT("NVM Write Error while updating checksum.\n"); @@ -2232,7 +2530,7 @@ static s32 e1000_validate_nvm_checksum_82580(struct e1000_hw *hw) for (j = 0; j < eeprom_regions_count; j++) { nvm_offset = NVM_82580_LAN_FUNC_OFFSET(j); ret_val = e1000_validate_nvm_checksum_with_offset(hw, - nvm_offset); + nvm_offset); if (ret_val != E1000_SUCCESS) goto out; } @@ -2259,19 +2557,17 @@ static s32 e1000_update_nvm_checksum_82580(struct e1000_hw *hw) ret_val = hw->nvm.ops.read(hw, NVM_COMPATIBILITY_REG_3, 1, &nvm_data); if (ret_val) { - DEBUGOUT("NVM Read Error while updating checksum" - " compatibility bit.\n"); + DEBUGOUT("NVM Read Error while updating checksum compatibility bit.\n"); goto out; } - if ((nvm_data & NVM_COMPATIBILITY_BIT_MASK) == 0) { + if (!(nvm_data & NVM_COMPATIBILITY_BIT_MASK)) { /* set compatibility bit to validate checksums appropriately */ nvm_data = nvm_data | NVM_COMPATIBILITY_BIT_MASK; ret_val = hw->nvm.ops.write(hw, NVM_COMPATIBILITY_REG_3, 1, - &nvm_data); + &nvm_data); if (ret_val) { - DEBUGOUT("NVM Write Error while updating checksum" - " compatibility bit.\n"); + DEBUGOUT("NVM Write Error while updating checksum compatibility bit.\n"); goto out; } } @@ -2279,9 +2575,8 @@ static s32 e1000_update_nvm_checksum_82580(struct e1000_hw *hw) for (j = 0; j < 4; j++) { nvm_offset = NVM_82580_LAN_FUNC_OFFSET(j); ret_val = e1000_update_nvm_checksum_with_offset(hw, nvm_offset); - if (ret_val) { + if (ret_val) goto out; - } } out: @@ -2307,7 +2602,7 @@ static s32 e1000_validate_nvm_checksum_i350(struct e1000_hw *hw) for (j = 0; j < 4; j++) { nvm_offset = NVM_82580_LAN_FUNC_OFFSET(j); ret_val = e1000_validate_nvm_checksum_with_offset(hw, - nvm_offset); + nvm_offset); if (ret_val != E1000_SUCCESS) goto out; } @@ -2353,37 +2648,630 @@ out: s32 e1000_set_eee_i350(struct e1000_hw *hw) { s32 ret_val = E1000_SUCCESS; - u32 ipcnfg, eeer, ctrl_ext; + u32 ipcnfg, eeer; DEBUGFUNC("e1000_set_eee_i350"); - ctrl_ext = E1000_READ_REG(hw, E1000_CTRL_EXT); - if ((hw->mac.type != e1000_i350) || - (ctrl_ext & E1000_CTRL_EXT_LINK_MODE_MASK)) + if ((hw->mac.type < e1000_i350) || + (hw->phy.media_type != e1000_media_type_copper)) goto out; ipcnfg = E1000_READ_REG(hw, E1000_IPCNFG); eeer = E1000_READ_REG(hw, E1000_EEER); /* enable or disable per user setting */ if (!(hw->dev_spec._82575.eee_disable)) { - ipcnfg |= (E1000_IPCNFG_EEE_1G_AN | - E1000_IPCNFG_EEE_100M_AN); - eeer |= (E1000_EEER_TX_LPI_EN | - E1000_EEER_RX_LPI_EN | - E1000_EEER_LPI_FC); + ipcnfg |= (E1000_IPCNFG_EEE_1G_AN | E1000_IPCNFG_EEE_100M_AN); + eeer |= (E1000_EEER_TX_LPI_EN | E1000_EEER_RX_LPI_EN | + E1000_EEER_LPI_FC); } else { - ipcnfg &= ~(E1000_IPCNFG_EEE_1G_AN | - E1000_IPCNFG_EEE_100M_AN); - eeer &= ~(E1000_EEER_TX_LPI_EN | - E1000_EEER_RX_LPI_EN | - E1000_EEER_LPI_FC); + ipcnfg &= ~(E1000_IPCNFG_EEE_1G_AN | E1000_IPCNFG_EEE_100M_AN); + eeer &= ~(E1000_EEER_TX_LPI_EN | E1000_EEER_RX_LPI_EN | + E1000_EEER_LPI_FC); } E1000_WRITE_REG(hw, E1000_IPCNFG, ipcnfg); E1000_WRITE_REG(hw, E1000_EEER, eeer); - E1000_READ_REG(hw, E1000_IPCNFG); - E1000_READ_REG(hw, E1000_EEER); + E1000_READ_REG(hw, E1000_IPCNFG); + E1000_READ_REG(hw, E1000_EEER); out: return ret_val; } + +/* Due to a hw errata, if the host tries to configure the VFTA register + * while performing queries from the BMC or DMA, then the VFTA in some + * cases won't be written. + */ + +/** + * e1000_clear_vfta_i350 - Clear VLAN filter table + * @hw: pointer to the HW structure + * + * Clears the register array which contains the VLAN filter table by + * setting all the values to 0. + **/ +void e1000_clear_vfta_i350(struct e1000_hw *hw) +{ + u32 offset; + int i; + + DEBUGFUNC("e1000_clear_vfta_350"); + + for (offset = 0; offset < E1000_VLAN_FILTER_TBL_SIZE; offset++) { + for (i = 0; i < 10; i++) + E1000_WRITE_REG_ARRAY(hw, E1000_VFTA, offset, 0); + + E1000_WRITE_FLUSH(hw); + } +} + +/** + * e1000_write_vfta_i350 - Write value to VLAN filter table + * @hw: pointer to the HW structure + * @offset: register offset in VLAN filter table + * @value: register value written to VLAN filter table + * + * Writes value at the given offset in the register array which stores + * the VLAN filter table. + **/ +void e1000_write_vfta_i350(struct e1000_hw *hw, u32 offset, u32 value) +{ + int i; + + DEBUGFUNC("e1000_write_vfta_350"); + + for (i = 0; i < 10; i++) + E1000_WRITE_REG_ARRAY(hw, E1000_VFTA, offset, value); + + E1000_WRITE_FLUSH(hw); +} + + +/** + * e1000_set_i2c_bb - Enable I2C bit-bang + * @hw: pointer to the HW structure + * + * Enable I2C bit-bang interface + * + **/ +s32 e1000_set_i2c_bb(struct e1000_hw *hw) +{ + s32 ret_val = E1000_SUCCESS; + u32 ctrl_ext, i2cparams; + + DEBUGFUNC("e1000_set_i2c_bb"); + + ctrl_ext = E1000_READ_REG(hw, E1000_CTRL_EXT); + ctrl_ext |= E1000_CTRL_I2C_ENA; + E1000_WRITE_REG(hw, E1000_CTRL_EXT, ctrl_ext); + E1000_WRITE_FLUSH(hw); + + i2cparams = E1000_READ_REG(hw, E1000_I2CPARAMS); + i2cparams |= E1000_I2CBB_EN; + i2cparams |= E1000_I2C_DATA_OE_N; + i2cparams |= E1000_I2C_CLK_OE_N; + E1000_WRITE_REG(hw, E1000_I2CPARAMS, i2cparams); + E1000_WRITE_FLUSH(hw); + + return ret_val; +} + +/** + * e1000_read_i2c_byte_generic - Reads 8 bit word over I2C + * @hw: pointer to hardware structure + * @byte_offset: byte offset to read + * @dev_addr: device address + * @data: value read + * + * Performs byte read operation over I2C interface at + * a specified device address. + **/ +s32 e1000_read_i2c_byte_generic(struct e1000_hw *hw, u8 byte_offset, + u8 dev_addr, u8 *data) +{ + s32 status = E1000_SUCCESS; + u32 max_retry = 10; + u32 retry = 1; + u16 swfw_mask = 0; + + bool nack = TRUE; + + DEBUGFUNC("e1000_read_i2c_byte_generic"); + + swfw_mask = E1000_SWFW_PHY0_SM; + + do { + if (hw->mac.ops.acquire_swfw_sync(hw, swfw_mask) + != E1000_SUCCESS) { + status = E1000_ERR_SWFW_SYNC; + goto read_byte_out; + } + + e1000_i2c_start(hw); + + /* Device Address and write indication */ + status = e1000_clock_out_i2c_byte(hw, dev_addr); + if (status != E1000_SUCCESS) + goto fail; + + status = e1000_get_i2c_ack(hw); + if (status != E1000_SUCCESS) + goto fail; + + status = e1000_clock_out_i2c_byte(hw, byte_offset); + if (status != E1000_SUCCESS) + goto fail; + + status = e1000_get_i2c_ack(hw); + if (status != E1000_SUCCESS) + goto fail; + + e1000_i2c_start(hw); + + /* Device Address and read indication */ + status = e1000_clock_out_i2c_byte(hw, (dev_addr | 0x1)); + if (status != E1000_SUCCESS) + goto fail; + + status = e1000_get_i2c_ack(hw); + if (status != E1000_SUCCESS) + goto fail; + + status = e1000_clock_in_i2c_byte(hw, data); + if (status != E1000_SUCCESS) + goto fail; + + status = e1000_clock_out_i2c_bit(hw, nack); + if (status != E1000_SUCCESS) + goto fail; + + e1000_i2c_stop(hw); + break; + +fail: + hw->mac.ops.release_swfw_sync(hw, swfw_mask); + msec_delay(100); + e1000_i2c_bus_clear(hw); + retry++; + if (retry < max_retry) + DEBUGOUT("I2C byte read error - Retrying.\n"); + else + DEBUGOUT("I2C byte read error.\n"); + + } while (retry < max_retry); + + hw->mac.ops.release_swfw_sync(hw, swfw_mask); + +read_byte_out: + + return status; +} + +/** + * e1000_write_i2c_byte_generic - Writes 8 bit word over I2C + * @hw: pointer to hardware structure + * @byte_offset: byte offset to write + * @dev_addr: device address + * @data: value to write + * + * Performs byte write operation over I2C interface at + * a specified device address. + **/ +s32 e1000_write_i2c_byte_generic(struct e1000_hw *hw, u8 byte_offset, + u8 dev_addr, u8 data) +{ + s32 status = E1000_SUCCESS; + u32 max_retry = 1; + u32 retry = 0; + u16 swfw_mask = 0; + + DEBUGFUNC("e1000_write_i2c_byte_generic"); + + swfw_mask = E1000_SWFW_PHY0_SM; + + if (hw->mac.ops.acquire_swfw_sync(hw, swfw_mask) != E1000_SUCCESS) { + status = E1000_ERR_SWFW_SYNC; + goto write_byte_out; + } + + do { + e1000_i2c_start(hw); + + status = e1000_clock_out_i2c_byte(hw, dev_addr); + if (status != E1000_SUCCESS) + goto fail; + + status = e1000_get_i2c_ack(hw); + if (status != E1000_SUCCESS) + goto fail; + + status = e1000_clock_out_i2c_byte(hw, byte_offset); + if (status != E1000_SUCCESS) + goto fail; + + status = e1000_get_i2c_ack(hw); + if (status != E1000_SUCCESS) + goto fail; + + status = e1000_clock_out_i2c_byte(hw, data); + if (status != E1000_SUCCESS) + goto fail; + + status = e1000_get_i2c_ack(hw); + if (status != E1000_SUCCESS) + goto fail; + + e1000_i2c_stop(hw); + break; + +fail: + e1000_i2c_bus_clear(hw); + retry++; + if (retry < max_retry) + DEBUGOUT("I2C byte write error - Retrying.\n"); + else + DEBUGOUT("I2C byte write error.\n"); + } while (retry < max_retry); + + hw->mac.ops.release_swfw_sync(hw, swfw_mask); + +write_byte_out: + + return status; +} + +/** + * e1000_i2c_start - Sets I2C start condition + * @hw: pointer to hardware structure + * + * Sets I2C start condition (High -> Low on SDA while SCL is High) + **/ +static void e1000_i2c_start(struct e1000_hw *hw) +{ + u32 i2cctl = E1000_READ_REG(hw, E1000_I2CPARAMS); + + DEBUGFUNC("e1000_i2c_start"); + + /* Start condition must begin with data and clock high */ + e1000_set_i2c_data(hw, &i2cctl, 1); + e1000_raise_i2c_clk(hw, &i2cctl); + + /* Setup time for start condition (4.7us) */ + usec_delay(E1000_I2C_T_SU_STA); + + e1000_set_i2c_data(hw, &i2cctl, 0); + + /* Hold time for start condition (4us) */ + usec_delay(E1000_I2C_T_HD_STA); + + e1000_lower_i2c_clk(hw, &i2cctl); + + /* Minimum low period of clock is 4.7 us */ + usec_delay(E1000_I2C_T_LOW); + +} + +/** + * e1000_i2c_stop - Sets I2C stop condition + * @hw: pointer to hardware structure + * + * Sets I2C stop condition (Low -> High on SDA while SCL is High) + **/ +static void e1000_i2c_stop(struct e1000_hw *hw) +{ + u32 i2cctl = E1000_READ_REG(hw, E1000_I2CPARAMS); + + DEBUGFUNC("e1000_i2c_stop"); + + /* Stop condition must begin with data low and clock high */ + e1000_set_i2c_data(hw, &i2cctl, 0); + e1000_raise_i2c_clk(hw, &i2cctl); + + /* Setup time for stop condition (4us) */ + usec_delay(E1000_I2C_T_SU_STO); + + e1000_set_i2c_data(hw, &i2cctl, 1); + + /* bus free time between stop and start (4.7us)*/ + usec_delay(E1000_I2C_T_BUF); +} + +/** + * e1000_clock_in_i2c_byte - Clocks in one byte via I2C + * @hw: pointer to hardware structure + * @data: data byte to clock in + * + * Clocks in one byte data via I2C data/clock + **/ +static s32 e1000_clock_in_i2c_byte(struct e1000_hw *hw, u8 *data) +{ + s32 i; + bool bit = 0; + + DEBUGFUNC("e1000_clock_in_i2c_byte"); + + *data = 0; + for (i = 7; i >= 0; i--) { + e1000_clock_in_i2c_bit(hw, &bit); + *data |= bit << i; + } + + return E1000_SUCCESS; +} + +/** + * e1000_clock_out_i2c_byte - Clocks out one byte via I2C + * @hw: pointer to hardware structure + * @data: data byte clocked out + * + * Clocks out one byte data via I2C data/clock + **/ +static s32 e1000_clock_out_i2c_byte(struct e1000_hw *hw, u8 data) +{ + s32 status = E1000_SUCCESS; + s32 i; + u32 i2cctl; + bool bit = 0; + + DEBUGFUNC("e1000_clock_out_i2c_byte"); + + for (i = 7; i >= 0; i--) { + bit = (data >> i) & 0x1; + status = e1000_clock_out_i2c_bit(hw, bit); + + if (status != E1000_SUCCESS) + break; + } + + /* Release SDA line (set high) */ + i2cctl = E1000_READ_REG(hw, E1000_I2CPARAMS); + + i2cctl |= E1000_I2C_DATA_OE_N; + E1000_WRITE_REG(hw, E1000_I2CPARAMS, i2cctl); + E1000_WRITE_FLUSH(hw); + + return status; +} + +/** + * e1000_get_i2c_ack - Polls for I2C ACK + * @hw: pointer to hardware structure + * + * Clocks in/out one bit via I2C data/clock + **/ +static s32 e1000_get_i2c_ack(struct e1000_hw *hw) +{ + s32 status = E1000_SUCCESS; + u32 i = 0; + u32 i2cctl = E1000_READ_REG(hw, E1000_I2CPARAMS); + u32 timeout = 10; + bool ack = TRUE; + + DEBUGFUNC("e1000_get_i2c_ack"); + + e1000_raise_i2c_clk(hw, &i2cctl); + + /* Minimum high period of clock is 4us */ + usec_delay(E1000_I2C_T_HIGH); + + /* Wait until SCL returns high */ + for (i = 0; i < timeout; i++) { + usec_delay(1); + i2cctl = E1000_READ_REG(hw, E1000_I2CPARAMS); + if (i2cctl & E1000_I2C_CLK_IN) + break; + } + if (!(i2cctl & E1000_I2C_CLK_IN)) + return E1000_ERR_I2C; + + ack = e1000_get_i2c_data(&i2cctl); + if (ack) { + DEBUGOUT("I2C ack was not received.\n"); + status = E1000_ERR_I2C; + } + + e1000_lower_i2c_clk(hw, &i2cctl); + + /* Minimum low period of clock is 4.7 us */ + usec_delay(E1000_I2C_T_LOW); + + return status; +} + +/** + * e1000_clock_in_i2c_bit - Clocks in one bit via I2C data/clock + * @hw: pointer to hardware structure + * @data: read data value + * + * Clocks in one bit via I2C data/clock + **/ +static s32 e1000_clock_in_i2c_bit(struct e1000_hw *hw, bool *data) +{ + u32 i2cctl = E1000_READ_REG(hw, E1000_I2CPARAMS); + + DEBUGFUNC("e1000_clock_in_i2c_bit"); + + e1000_raise_i2c_clk(hw, &i2cctl); + + /* Minimum high period of clock is 4us */ + usec_delay(E1000_I2C_T_HIGH); + + i2cctl = E1000_READ_REG(hw, E1000_I2CPARAMS); + *data = e1000_get_i2c_data(&i2cctl); + + e1000_lower_i2c_clk(hw, &i2cctl); + + /* Minimum low period of clock is 4.7 us */ + usec_delay(E1000_I2C_T_LOW); + + return E1000_SUCCESS; +} + +/** + * e1000_clock_out_i2c_bit - Clocks in/out one bit via I2C data/clock + * @hw: pointer to hardware structure + * @data: data value to write + * + * Clocks out one bit via I2C data/clock + **/ +static s32 e1000_clock_out_i2c_bit(struct e1000_hw *hw, bool data) +{ + s32 status; + u32 i2cctl = E1000_READ_REG(hw, E1000_I2CPARAMS); + + DEBUGFUNC("e1000_clock_out_i2c_bit"); + + status = e1000_set_i2c_data(hw, &i2cctl, data); + if (status == E1000_SUCCESS) { + e1000_raise_i2c_clk(hw, &i2cctl); + + /* Minimum high period of clock is 4us */ + usec_delay(E1000_I2C_T_HIGH); + + e1000_lower_i2c_clk(hw, &i2cctl); + + /* Minimum low period of clock is 4.7 us. + * This also takes care of the data hold time. + */ + usec_delay(E1000_I2C_T_LOW); + } else { + status = E1000_ERR_I2C; + DEBUGOUT1("I2C data was not set to %X\n", data); + } + + return status; +} +/** + * e1000_raise_i2c_clk - Raises the I2C SCL clock + * @hw: pointer to hardware structure + * @i2cctl: Current value of I2CCTL register + * + * Raises the I2C clock line '0'->'1' + **/ +static void e1000_raise_i2c_clk(struct e1000_hw *hw, u32 *i2cctl) +{ + DEBUGFUNC("e1000_raise_i2c_clk"); + + *i2cctl |= E1000_I2C_CLK_OUT; + *i2cctl &= ~E1000_I2C_CLK_OE_N; + E1000_WRITE_REG(hw, E1000_I2CPARAMS, *i2cctl); + E1000_WRITE_FLUSH(hw); + + /* SCL rise time (1000ns) */ + usec_delay(E1000_I2C_T_RISE); +} + +/** + * e1000_lower_i2c_clk - Lowers the I2C SCL clock + * @hw: pointer to hardware structure + * @i2cctl: Current value of I2CCTL register + * + * Lowers the I2C clock line '1'->'0' + **/ +static void e1000_lower_i2c_clk(struct e1000_hw *hw, u32 *i2cctl) +{ + + DEBUGFUNC("e1000_lower_i2c_clk"); + + *i2cctl &= ~E1000_I2C_CLK_OUT; + *i2cctl &= ~E1000_I2C_CLK_OE_N; + E1000_WRITE_REG(hw, E1000_I2CPARAMS, *i2cctl); + E1000_WRITE_FLUSH(hw); + + /* SCL fall time (300ns) */ + usec_delay(E1000_I2C_T_FALL); +} + +/** + * e1000_set_i2c_data - Sets the I2C data bit + * @hw: pointer to hardware structure + * @i2cctl: Current value of I2CCTL register + * @data: I2C data value (0 or 1) to set + * + * Sets the I2C data bit + **/ +static s32 e1000_set_i2c_data(struct e1000_hw *hw, u32 *i2cctl, bool data) +{ + s32 status = E1000_SUCCESS; + + DEBUGFUNC("e1000_set_i2c_data"); + + if (data) + *i2cctl |= E1000_I2C_DATA_OUT; + else + *i2cctl &= ~E1000_I2C_DATA_OUT; + + *i2cctl &= ~E1000_I2C_DATA_OE_N; + *i2cctl |= E1000_I2C_CLK_OE_N; + E1000_WRITE_REG(hw, E1000_I2CPARAMS, *i2cctl); + E1000_WRITE_FLUSH(hw); + + /* Data rise/fall (1000ns/300ns) and set-up time (250ns) */ + usec_delay(E1000_I2C_T_RISE + E1000_I2C_T_FALL + E1000_I2C_T_SU_DATA); + + *i2cctl = E1000_READ_REG(hw, E1000_I2CPARAMS); + if (data != e1000_get_i2c_data(i2cctl)) { + status = E1000_ERR_I2C; + DEBUGOUT1("Error - I2C data was not set to %X.\n", data); + } + + return status; +} + +/** + * e1000_get_i2c_data - Reads the I2C SDA data bit + * @hw: pointer to hardware structure + * @i2cctl: Current value of I2CCTL register + * + * Returns the I2C data bit value + **/ +static bool e1000_get_i2c_data(u32 *i2cctl) +{ + bool data; + + DEBUGFUNC("e1000_get_i2c_data"); + + if (*i2cctl & E1000_I2C_DATA_IN) + data = 1; + else + data = 0; + + return data; +} + +/** + * e1000_i2c_bus_clear - Clears the I2C bus + * @hw: pointer to hardware structure + * + * Clears the I2C bus by sending nine clock pulses. + * Used when data line is stuck low. + **/ +void e1000_i2c_bus_clear(struct e1000_hw *hw) +{ + u32 i2cctl = E1000_READ_REG(hw, E1000_I2CPARAMS); + u32 i; + + DEBUGFUNC("e1000_i2c_bus_clear"); + + e1000_i2c_start(hw); + + e1000_set_i2c_data(hw, &i2cctl, 1); + + for (i = 0; i < 9; i++) { + e1000_raise_i2c_clk(hw, &i2cctl); + + /* Min high period of clock is 4us */ + usec_delay(E1000_I2C_T_HIGH); + + e1000_lower_i2c_clk(hw, &i2cctl); + + /* Min low period of clock is 4.7us*/ + usec_delay(E1000_I2C_T_LOW); + } + + e1000_i2c_start(hw); + + /* Put the i2c bus back to default state */ + e1000_i2c_stop(hw); +} + diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_82575.h b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_82575.h index baef9d0c68..4b2b245f3d 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_82575.h +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_82575.h @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2010, Intel Corporation + Copyright (c) 2001-2011, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -30,15 +30,15 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: src/sys/dev/e1000/e1000_82575.h,v 1.4.2.4.2.1 2010/12/21 17:09:25 kensmith Exp $*/ +/*$FreeBSD$*/ #ifndef _E1000_82575_H_ #define _E1000_82575_H_ -#define ID_LED_DEFAULT_82575_SERDES ((ID_LED_DEF1_DEF2 << 12) | \ - (ID_LED_DEF1_DEF2 << 8) | \ - (ID_LED_DEF1_DEF2 << 4) | \ - (ID_LED_OFF1_ON2)) +#define ID_LED_DEFAULT_82575_SERDES ((ID_LED_DEF1_DEF2 << 12) | \ + (ID_LED_DEF1_DEF2 << 8) | \ + (ID_LED_DEF1_DEF2 << 4) | \ + (ID_LED_OFF1_ON2)) /* * Receive Address Register Count * Number of high/low register pairs in the RAR. The RAR (Receive Address @@ -49,13 +49,13 @@ * For 82576, there are an additional set of RARs that begin at an offset * separate from the first set of RARs. */ -#define E1000_RAR_ENTRIES_82575 16 -#define E1000_RAR_ENTRIES_82576 24 -#define E1000_RAR_ENTRIES_82580 24 -#define E1000_RAR_ENTRIES_I350 32 -#define E1000_SW_SYNCH_MB 0x00000100 -#define E1000_STAT_DEV_RST_SET 0x00100000 -#define E1000_CTRL_DEV_RST 0x20000000 +#define E1000_RAR_ENTRIES_82575 16 +#define E1000_RAR_ENTRIES_82576 24 +#define E1000_RAR_ENTRIES_82580 24 +#define E1000_RAR_ENTRIES_I350 32 +#define E1000_SW_SYNCH_MB 0x00000100 +#define E1000_STAT_DEV_RST_SET 0x00100000 +#define E1000_CTRL_DEV_RST 0x20000000 #ifdef E1000_BIT_FIELDS struct e1000_adv_data_desc { @@ -63,137 +63,138 @@ struct e1000_adv_data_desc { union { u32 data; struct { - u32 datalen :16; /* Data buffer length */ - u32 rsvd :4; - u32 dtyp :4; /* Descriptor type */ - u32 dcmd :8; /* Descriptor command */ + u32 datalen:16; /* Data buffer length */ + u32 rsvd:4; + u32 dtyp:4; /* Descriptor type */ + u32 dcmd:8; /* Descriptor command */ } config; } lower; union { u32 data; struct { - u32 status :4; /* Descriptor status */ - u32 idx :4; - u32 popts :6; /* Packet Options */ - u32 paylen :18; /* Payload length */ + u32 status:4; /* Descriptor status */ + u32 idx:4; + u32 popts:6; /* Packet Options */ + u32 paylen:18; /* Payload length */ } options; } upper; }; -#define E1000_TXD_DTYP_ADV_C 0x2 /* Advanced Context Descriptor */ -#define E1000_TXD_DTYP_ADV_D 0x3 /* Advanced Data Descriptor */ -#define E1000_ADV_TXD_CMD_DEXT 0x20 /* Descriptor extension (0 = legacy) */ -#define E1000_ADV_TUCMD_IPV4 0x2 /* IP Packet Type: 1=IPv4 */ -#define E1000_ADV_TUCMD_IPV6 0x0 /* IP Packet Type: 0=IPv6 */ -#define E1000_ADV_TUCMD_L4T_UDP 0x0 /* L4 Packet TYPE of UDP */ -#define E1000_ADV_TUCMD_L4T_TCP 0x4 /* L4 Packet TYPE of TCP */ -#define E1000_ADV_TUCMD_MKRREQ 0x10 /* Indicates markers are required */ -#define E1000_ADV_DCMD_EOP 0x1 /* End of Packet */ -#define E1000_ADV_DCMD_IFCS 0x2 /* Insert FCS (Ethernet CRC) */ -#define E1000_ADV_DCMD_RS 0x8 /* Report Status */ -#define E1000_ADV_DCMD_VLE 0x40 /* Add VLAN tag */ -#define E1000_ADV_DCMD_TSE 0x80 /* TCP Seg enable */ +#define E1000_TXD_DTYP_ADV_C 0x2 /* Advanced Context Descriptor */ +#define E1000_TXD_DTYP_ADV_D 0x3 /* Advanced Data Descriptor */ +#define E1000_ADV_TXD_CMD_DEXT 0x20 /* Descriptor extension (0 = legacy) */ +#define E1000_ADV_TUCMD_IPV4 0x2 /* IP Packet Type: 1=IPv4 */ +#define E1000_ADV_TUCMD_IPV6 0x0 /* IP Packet Type: 0=IPv6 */ +#define E1000_ADV_TUCMD_L4T_UDP 0x0 /* L4 Packet TYPE of UDP */ +#define E1000_ADV_TUCMD_L4T_TCP 0x4 /* L4 Packet TYPE of TCP */ +#define E1000_ADV_TUCMD_MKRREQ 0x10 /* Indicates markers are required */ +#define E1000_ADV_DCMD_EOP 0x1 /* End of Packet */ +#define E1000_ADV_DCMD_IFCS 0x2 /* Insert FCS (Ethernet CRC) */ +#define E1000_ADV_DCMD_RS 0x8 /* Report Status */ +#define E1000_ADV_DCMD_VLE 0x40 /* Add VLAN tag */ +#define E1000_ADV_DCMD_TSE 0x80 /* TCP Seg enable */ /* Extended Device Control */ -#define E1000_CTRL_EXT_NSICR 0x00000001 /* Disable Intr Clear all on read */ +#define E1000_CTRL_EXT_NSICR 0x00000001 /* Disable Intr Clear all on read */ struct e1000_adv_context_desc { union { u32 ip_config; struct { - u32 iplen :9; - u32 maclen :7; - u32 vlan_tag :16; + u32 iplen:9; + u32 maclen:7; + u32 vlan_tag:16; } fields; } ip_setup; u32 seq_num; union { u64 l4_config; struct { - u32 mkrloc :9; - u32 tucmd :11; - u32 dtyp :4; - u32 adv :8; - u32 rsvd :4; - u32 idx :4; - u32 l4len :8; - u32 mss :16; + u32 mkrloc:9; + u32 tucmd:11; + u32 dtyp:4; + u32 adv:8; + u32 rsvd:4; + u32 idx:4; + u32 l4len:8; + u32 mss:16; } fields; } l4_setup; }; #endif /* SRRCTL bit definitions */ -#define E1000_SRRCTL_BSIZEPKT_SHIFT 10 /* Shift _right_ */ -#define E1000_SRRCTL_BSIZEHDRSIZE_MASK 0x00000F00 -#define E1000_SRRCTL_BSIZEHDRSIZE_SHIFT 2 /* Shift _left_ */ -#define E1000_SRRCTL_DESCTYPE_LEGACY 0x00000000 -#define E1000_SRRCTL_DESCTYPE_ADV_ONEBUF 0x02000000 -#define E1000_SRRCTL_DESCTYPE_HDR_SPLIT 0x04000000 -#define E1000_SRRCTL_DESCTYPE_HDR_SPLIT_ALWAYS 0x0A000000 -#define E1000_SRRCTL_DESCTYPE_HDR_REPLICATION 0x06000000 +#define E1000_SRRCTL_BSIZEPKT_SHIFT 10 /* Shift _right_ */ +#define E1000_SRRCTL_BSIZEHDRSIZE_MASK 0x00000F00 +#define E1000_SRRCTL_BSIZEHDRSIZE_SHIFT 2 /* Shift _left_ */ +#define E1000_SRRCTL_DESCTYPE_LEGACY 0x00000000 +#define E1000_SRRCTL_DESCTYPE_ADV_ONEBUF 0x02000000 +#define E1000_SRRCTL_DESCTYPE_HDR_SPLIT 0x04000000 +#define E1000_SRRCTL_DESCTYPE_HDR_SPLIT_ALWAYS 0x0A000000 +#define E1000_SRRCTL_DESCTYPE_HDR_REPLICATION 0x06000000 #define E1000_SRRCTL_DESCTYPE_HDR_REPLICATION_LARGE_PKT 0x08000000 -#define E1000_SRRCTL_DESCTYPE_MASK 0x0E000000 -#define E1000_SRRCTL_TIMESTAMP 0x40000000 -#define E1000_SRRCTL_DROP_EN 0x80000000 +#define E1000_SRRCTL_DESCTYPE_MASK 0x0E000000 +#define E1000_SRRCTL_TIMESTAMP 0x40000000 +#define E1000_SRRCTL_DROP_EN 0x80000000 -#define E1000_SRRCTL_BSIZEPKT_MASK 0x0000007F -#define E1000_SRRCTL_BSIZEHDR_MASK 0x00003F00 +#define E1000_SRRCTL_BSIZEPKT_MASK 0x0000007F +#define E1000_SRRCTL_BSIZEHDR_MASK 0x00003F00 -#define E1000_TX_HEAD_WB_ENABLE 0x1 -#define E1000_TX_SEQNUM_WB_ENABLE 0x2 +#define E1000_TX_HEAD_WB_ENABLE 0x1 +#define E1000_TX_SEQNUM_WB_ENABLE 0x2 -#define E1000_MRQC_ENABLE_RSS_4Q 0x00000002 -#define E1000_MRQC_ENABLE_VMDQ 0x00000003 -#define E1000_MRQC_ENABLE_VMDQ_RSS_2Q 0x00000005 -#define E1000_MRQC_RSS_FIELD_IPV4_UDP 0x00400000 -#define E1000_MRQC_RSS_FIELD_IPV6_UDP 0x00800000 -#define E1000_MRQC_RSS_FIELD_IPV6_UDP_EX 0x01000000 -#define E1000_MRQC_ENABLE_RSS_8Q 0x00000002 +#define E1000_MRQC_ENABLE_RSS_4Q 0x00000002 +#define E1000_MRQC_ENABLE_VMDQ 0x00000003 +#define E1000_MRQC_ENABLE_VMDQ_RSS_2Q 0x00000005 +#define E1000_MRQC_RSS_FIELD_IPV4_UDP 0x00400000 +#define E1000_MRQC_RSS_FIELD_IPV6_UDP 0x00800000 +#define E1000_MRQC_RSS_FIELD_IPV6_UDP_EX 0x01000000 +#define E1000_MRQC_ENABLE_RSS_8Q 0x00000002 -#define E1000_VMRCTL_MIRROR_PORT_SHIFT 8 -#define E1000_VMRCTL_MIRROR_DSTPORT_MASK (7 << E1000_VMRCTL_MIRROR_PORT_SHIFT) -#define E1000_VMRCTL_POOL_MIRROR_ENABLE (1 << 0) -#define E1000_VMRCTL_UPLINK_MIRROR_ENABLE (1 << 1) -#define E1000_VMRCTL_DOWNLINK_MIRROR_ENABLE (1 << 2) +#define E1000_VMRCTL_MIRROR_PORT_SHIFT 8 +#define E1000_VMRCTL_MIRROR_DSTPORT_MASK (7 << \ + E1000_VMRCTL_MIRROR_PORT_SHIFT) +#define E1000_VMRCTL_POOL_MIRROR_ENABLE (1 << 0) +#define E1000_VMRCTL_UPLINK_MIRROR_ENABLE (1 << 1) +#define E1000_VMRCTL_DOWNLINK_MIRROR_ENABLE (1 << 2) #define E1000_EICR_TX_QUEUE ( \ - E1000_EICR_TX_QUEUE0 | \ - E1000_EICR_TX_QUEUE1 | \ - E1000_EICR_TX_QUEUE2 | \ - E1000_EICR_TX_QUEUE3) + E1000_EICR_TX_QUEUE0 | \ + E1000_EICR_TX_QUEUE1 | \ + E1000_EICR_TX_QUEUE2 | \ + E1000_EICR_TX_QUEUE3) #define E1000_EICR_RX_QUEUE ( \ - E1000_EICR_RX_QUEUE0 | \ - E1000_EICR_RX_QUEUE1 | \ - E1000_EICR_RX_QUEUE2 | \ - E1000_EICR_RX_QUEUE3) + E1000_EICR_RX_QUEUE0 | \ + E1000_EICR_RX_QUEUE1 | \ + E1000_EICR_RX_QUEUE2 | \ + E1000_EICR_RX_QUEUE3) -#define E1000_EIMS_RX_QUEUE E1000_EICR_RX_QUEUE -#define E1000_EIMS_TX_QUEUE E1000_EICR_TX_QUEUE +#define E1000_EIMS_RX_QUEUE E1000_EICR_RX_QUEUE +#define E1000_EIMS_TX_QUEUE E1000_EICR_TX_QUEUE #define EIMS_ENABLE_MASK ( \ - E1000_EIMS_RX_QUEUE | \ - E1000_EIMS_TX_QUEUE | \ - E1000_EIMS_TCP_TIMER | \ - E1000_EIMS_OTHER) + E1000_EIMS_RX_QUEUE | \ + E1000_EIMS_TX_QUEUE | \ + E1000_EIMS_TCP_TIMER | \ + E1000_EIMS_OTHER) /* Immediate Interrupt Rx (A.K.A. Low Latency Interrupt) */ -#define E1000_IMIR_PORT_IM_EN 0x00010000 /* TCP port enable */ -#define E1000_IMIR_PORT_BP 0x00020000 /* TCP port check bypass */ -#define E1000_IMIREXT_SIZE_BP 0x00001000 /* Packet size bypass */ -#define E1000_IMIREXT_CTRL_URG 0x00002000 /* Check URG bit in header */ -#define E1000_IMIREXT_CTRL_ACK 0x00004000 /* Check ACK bit in header */ -#define E1000_IMIREXT_CTRL_PSH 0x00008000 /* Check PSH bit in header */ -#define E1000_IMIREXT_CTRL_RST 0x00010000 /* Check RST bit in header */ -#define E1000_IMIREXT_CTRL_SYN 0x00020000 /* Check SYN bit in header */ -#define E1000_IMIREXT_CTRL_FIN 0x00040000 /* Check FIN bit in header */ -#define E1000_IMIREXT_CTRL_BP 0x00080000 /* Bypass check of ctrl bits */ +#define E1000_IMIR_PORT_IM_EN 0x00010000 /* TCP port enable */ +#define E1000_IMIR_PORT_BP 0x00020000 /* TCP port check bypass */ +#define E1000_IMIREXT_SIZE_BP 0x00001000 /* Packet size bypass */ +#define E1000_IMIREXT_CTRL_URG 0x00002000 /* Check URG bit in header */ +#define E1000_IMIREXT_CTRL_ACK 0x00004000 /* Check ACK bit in header */ +#define E1000_IMIREXT_CTRL_PSH 0x00008000 /* Check PSH bit in header */ +#define E1000_IMIREXT_CTRL_RST 0x00010000 /* Check RST bit in header */ +#define E1000_IMIREXT_CTRL_SYN 0x00020000 /* Check SYN bit in header */ +#define E1000_IMIREXT_CTRL_FIN 0x00040000 /* Check FIN bit in header */ +#define E1000_IMIREXT_CTRL_BP 0x00080000 /* Bypass check of ctrl bits */ /* Receive Descriptor - Advanced */ union e1000_adv_rx_desc { struct { - __le64 pkt_addr; /* Packet buffer address */ - __le64 hdr_addr; /* Header buffer address */ + __le64 pkt_addr; /* Packet buffer address */ + __le64 hdr_addr; /* Header buffer address */ } read; struct { struct { @@ -206,74 +207,74 @@ union e1000_adv_rx_desc { } hs_rss; } lo_dword; union { - __le32 rss; /* RSS Hash */ + __le32 rss; /* RSS Hash */ struct { - __le16 ip_id; /* IP id */ - __le16 csum; /* Packet Checksum */ + __le16 ip_id; /* IP id */ + __le16 csum; /* Packet Checksum */ } csum_ip; } hi_dword; } lower; struct { - __le32 status_error; /* ext status/error */ - __le16 length; /* Packet length */ - __le16 vlan; /* VLAN tag */ + __le32 status_error; /* ext status/error */ + __le16 length; /* Packet length */ + __le16 vlan; /* VLAN tag */ } upper; } wb; /* writeback */ }; -#define E1000_RXDADV_RSSTYPE_MASK 0x0000000F -#define E1000_RXDADV_RSSTYPE_SHIFT 12 -#define E1000_RXDADV_HDRBUFLEN_MASK 0x7FE0 -#define E1000_RXDADV_HDRBUFLEN_SHIFT 5 -#define E1000_RXDADV_SPLITHEADER_EN 0x00001000 -#define E1000_RXDADV_SPH 0x8000 -#define E1000_RXDADV_STAT_TS 0x10000 /* Pkt was time stamped */ -#define E1000_RXDADV_STAT_TSIP 0x08000 /* timestamp in packet */ -#define E1000_RXDADV_ERR_HBO 0x00800000 +#define E1000_RXDADV_RSSTYPE_MASK 0x0000000F +#define E1000_RXDADV_RSSTYPE_SHIFT 12 +#define E1000_RXDADV_HDRBUFLEN_MASK 0x7FE0 +#define E1000_RXDADV_HDRBUFLEN_SHIFT 5 +#define E1000_RXDADV_SPLITHEADER_EN 0x00001000 +#define E1000_RXDADV_SPH 0x8000 +#define E1000_RXDADV_STAT_TS 0x10000 /* Pkt was time stamped */ +#define E1000_RXDADV_STAT_TSIP 0x08000 /* timestamp in packet */ +#define E1000_RXDADV_ERR_HBO 0x00800000 /* RSS Hash results */ -#define E1000_RXDADV_RSSTYPE_NONE 0x00000000 -#define E1000_RXDADV_RSSTYPE_IPV4_TCP 0x00000001 -#define E1000_RXDADV_RSSTYPE_IPV4 0x00000002 -#define E1000_RXDADV_RSSTYPE_IPV6_TCP 0x00000003 -#define E1000_RXDADV_RSSTYPE_IPV6_EX 0x00000004 -#define E1000_RXDADV_RSSTYPE_IPV6 0x00000005 +#define E1000_RXDADV_RSSTYPE_NONE 0x00000000 +#define E1000_RXDADV_RSSTYPE_IPV4_TCP 0x00000001 +#define E1000_RXDADV_RSSTYPE_IPV4 0x00000002 +#define E1000_RXDADV_RSSTYPE_IPV6_TCP 0x00000003 +#define E1000_RXDADV_RSSTYPE_IPV6_EX 0x00000004 +#define E1000_RXDADV_RSSTYPE_IPV6 0x00000005 #define E1000_RXDADV_RSSTYPE_IPV6_TCP_EX 0x00000006 -#define E1000_RXDADV_RSSTYPE_IPV4_UDP 0x00000007 -#define E1000_RXDADV_RSSTYPE_IPV6_UDP 0x00000008 +#define E1000_RXDADV_RSSTYPE_IPV4_UDP 0x00000007 +#define E1000_RXDADV_RSSTYPE_IPV6_UDP 0x00000008 #define E1000_RXDADV_RSSTYPE_IPV6_UDP_EX 0x00000009 /* RSS Packet Types as indicated in the receive descriptor */ -#define E1000_RXDADV_PKTTYPE_NONE 0x00000000 -#define E1000_RXDADV_PKTTYPE_IPV4 0x00000010 /* IPV4 hdr present */ -#define E1000_RXDADV_PKTTYPE_IPV4_EX 0x00000020 /* IPV4 hdr + extensions */ -#define E1000_RXDADV_PKTTYPE_IPV6 0x00000040 /* IPV6 hdr present */ -#define E1000_RXDADV_PKTTYPE_IPV6_EX 0x00000080 /* IPV6 hdr + extensions */ -#define E1000_RXDADV_PKTTYPE_TCP 0x00000100 /* TCP hdr present */ -#define E1000_RXDADV_PKTTYPE_UDP 0x00000200 /* UDP hdr present */ -#define E1000_RXDADV_PKTTYPE_SCTP 0x00000400 /* SCTP hdr present */ -#define E1000_RXDADV_PKTTYPE_NFS 0x00000800 /* NFS hdr present */ +#define E1000_RXDADV_PKTTYPE_NONE 0x00000000 +#define E1000_RXDADV_PKTTYPE_IPV4 0x00000010 /* IPV4 hdr present */ +#define E1000_RXDADV_PKTTYPE_IPV4_EX 0x00000020 /* IPV4 hdr + extensions */ +#define E1000_RXDADV_PKTTYPE_IPV6 0x00000040 /* IPV6 hdr present */ +#define E1000_RXDADV_PKTTYPE_IPV6_EX 0x00000080 /* IPV6 hdr + extensions */ +#define E1000_RXDADV_PKTTYPE_TCP 0x00000100 /* TCP hdr present */ +#define E1000_RXDADV_PKTTYPE_UDP 0x00000200 /* UDP hdr present */ +#define E1000_RXDADV_PKTTYPE_SCTP 0x00000400 /* SCTP hdr present */ +#define E1000_RXDADV_PKTTYPE_NFS 0x00000800 /* NFS hdr present */ -#define E1000_RXDADV_PKTTYPE_IPSEC_ESP 0x00001000 /* IPSec ESP */ -#define E1000_RXDADV_PKTTYPE_IPSEC_AH 0x00002000 /* IPSec AH */ -#define E1000_RXDADV_PKTTYPE_LINKSEC 0x00004000 /* LinkSec Encap */ -#define E1000_RXDADV_PKTTYPE_ETQF 0x00008000 /* PKTTYPE is ETQF index */ -#define E1000_RXDADV_PKTTYPE_ETQF_MASK 0x00000070 /* ETQF has 8 indices */ -#define E1000_RXDADV_PKTTYPE_ETQF_SHIFT 4 /* Right-shift 4 bits */ +#define E1000_RXDADV_PKTTYPE_IPSEC_ESP 0x00001000 /* IPSec ESP */ +#define E1000_RXDADV_PKTTYPE_IPSEC_AH 0x00002000 /* IPSec AH */ +#define E1000_RXDADV_PKTTYPE_LINKSEC 0x00004000 /* LinkSec Encap */ +#define E1000_RXDADV_PKTTYPE_ETQF 0x00008000 /* PKTTYPE is ETQF index */ +#define E1000_RXDADV_PKTTYPE_ETQF_MASK 0x00000070 /* ETQF has 8 indices */ +#define E1000_RXDADV_PKTTYPE_ETQF_SHIFT 4 /* Right-shift 4 bits */ /* LinkSec results */ /* Security Processing bit Indication */ -#define E1000_RXDADV_LNKSEC_STATUS_SECP 0x00020000 -#define E1000_RXDADV_LNKSEC_ERROR_BIT_MASK 0x18000000 -#define E1000_RXDADV_LNKSEC_ERROR_NO_SA_MATCH 0x08000000 -#define E1000_RXDADV_LNKSEC_ERROR_REPLAY_ERROR 0x10000000 -#define E1000_RXDADV_LNKSEC_ERROR_BAD_SIG 0x18000000 +#define E1000_RXDADV_LNKSEC_STATUS_SECP 0x00020000 +#define E1000_RXDADV_LNKSEC_ERROR_BIT_MASK 0x18000000 +#define E1000_RXDADV_LNKSEC_ERROR_NO_SA_MATCH 0x08000000 +#define E1000_RXDADV_LNKSEC_ERROR_REPLAY_ERROR 0x10000000 +#define E1000_RXDADV_LNKSEC_ERROR_BAD_SIG 0x18000000 -#define E1000_RXDADV_IPSEC_STATUS_SECP 0x00020000 -#define E1000_RXDADV_IPSEC_ERROR_BIT_MASK 0x18000000 -#define E1000_RXDADV_IPSEC_ERROR_INVALID_PROTOCOL 0x08000000 -#define E1000_RXDADV_IPSEC_ERROR_INVALID_LENGTH 0x10000000 -#define E1000_RXDADV_IPSEC_ERROR_AUTHENTICATION_FAILED 0x18000000 +#define E1000_RXDADV_IPSEC_STATUS_SECP 0x00020000 +#define E1000_RXDADV_IPSEC_ERROR_BIT_MASK 0x18000000 +#define E1000_RXDADV_IPSEC_ERROR_INVALID_PROTOCOL 0x08000000 +#define E1000_RXDADV_IPSEC_ERROR_INVALID_LENGTH 0x10000000 +#define E1000_RXDADV_IPSEC_ERROR_AUTHENTICATION_FAILED 0x18000000 /* Transmit Descriptor - Advanced */ union e1000_adv_tx_desc { @@ -290,25 +291,26 @@ union e1000_adv_tx_desc { }; /* Adv Transmit Descriptor Config Masks */ -#define E1000_ADVTXD_DTYP_CTXT 0x00200000 /* Advanced Context Descriptor */ -#define E1000_ADVTXD_DTYP_DATA 0x00300000 /* Advanced Data Descriptor */ -#define E1000_ADVTXD_DCMD_EOP 0x01000000 /* End of Packet */ -#define E1000_ADVTXD_DCMD_IFCS 0x02000000 /* Insert FCS (Ethernet CRC) */ -#define E1000_ADVTXD_DCMD_RS 0x08000000 /* Report Status */ -#define E1000_ADVTXD_DCMD_DDTYP_ISCSI 0x10000000 /* DDP hdr type or iSCSI */ -#define E1000_ADVTXD_DCMD_DEXT 0x20000000 /* Descriptor extension (1=Adv) */ -#define E1000_ADVTXD_DCMD_VLE 0x40000000 /* VLAN pkt enable */ -#define E1000_ADVTXD_DCMD_TSE 0x80000000 /* TCP Seg enable */ -#define E1000_ADVTXD_MAC_LINKSEC 0x00040000 /* Apply LinkSec on packet */ -#define E1000_ADVTXD_MAC_TSTAMP 0x00080000 /* IEEE1588 Timestamp packet */ -#define E1000_ADVTXD_STAT_SN_CRC 0x00000002 /* NXTSEQ/SEED present in WB */ -#define E1000_ADVTXD_IDX_SHIFT 4 /* Adv desc Index shift */ -#define E1000_ADVTXD_POPTS_ISCO_1ST 0x00000000 /* 1st TSO of iSCSI PDU */ -#define E1000_ADVTXD_POPTS_ISCO_MDL 0x00000800 /* Middle TSO of iSCSI PDU */ -#define E1000_ADVTXD_POPTS_ISCO_LAST 0x00001000 /* Last TSO of iSCSI PDU */ -#define E1000_ADVTXD_POPTS_ISCO_FULL 0x00001800 /* 1st&Last TSO-full iSCSI PDU*/ -#define E1000_ADVTXD_POPTS_IPSEC 0x00000400 /* IPSec offload request */ -#define E1000_ADVTXD_PAYLEN_SHIFT 14 /* Adv desc PAYLEN shift */ +#define E1000_ADVTXD_DTYP_CTXT 0x00200000 /* Advanced Context Descriptor */ +#define E1000_ADVTXD_DTYP_DATA 0x00300000 /* Advanced Data Descriptor */ +#define E1000_ADVTXD_DCMD_EOP 0x01000000 /* End of Packet */ +#define E1000_ADVTXD_DCMD_IFCS 0x02000000 /* Insert FCS (Ethernet CRC) */ +#define E1000_ADVTXD_DCMD_RS 0x08000000 /* Report Status */ +#define E1000_ADVTXD_DCMD_DDTYP_ISCSI 0x10000000 /* DDP hdr type or iSCSI */ +#define E1000_ADVTXD_DCMD_DEXT 0x20000000 /* Descriptor extension (1=Adv) */ +#define E1000_ADVTXD_DCMD_VLE 0x40000000 /* VLAN pkt enable */ +#define E1000_ADVTXD_DCMD_TSE 0x80000000 /* TCP Seg enable */ +#define E1000_ADVTXD_MAC_LINKSEC 0x00040000 /* Apply LinkSec on pkt */ +#define E1000_ADVTXD_MAC_TSTAMP 0x00080000 /* IEEE1588 Timestamp pkt */ +#define E1000_ADVTXD_STAT_SN_CRC 0x00000002 /* NXTSEQ/SEED prsnt in WB */ +#define E1000_ADVTXD_IDX_SHIFT 4 /* Adv desc Index shift */ +#define E1000_ADVTXD_POPTS_ISCO_1ST 0x00000000 /* 1st TSO of iSCSI PDU */ +#define E1000_ADVTXD_POPTS_ISCO_MDL 0x00000800 /* Middle TSO of iSCSI PDU */ +#define E1000_ADVTXD_POPTS_ISCO_LAST 0x00001000 /* Last TSO of iSCSI PDU */ +/* 1st & Last TSO-full iSCSI PDU*/ +#define E1000_ADVTXD_POPTS_ISCO_FULL 0x00001800 +#define E1000_ADVTXD_POPTS_IPSEC 0x00000400 /* IPSec offload request */ +#define E1000_ADVTXD_PAYLEN_SHIFT 14 /* Adv desc PAYLEN shift */ /* Context descriptors */ struct e1000_adv_tx_context_desc { @@ -318,65 +320,66 @@ struct e1000_adv_tx_context_desc { __le32 mss_l4len_idx; }; -#define E1000_ADVTXD_MACLEN_SHIFT 9 /* Adv ctxt desc mac len shift */ -#define E1000_ADVTXD_VLAN_SHIFT 16 /* Adv ctxt vlan tag shift */ -#define E1000_ADVTXD_TUCMD_IPV4 0x00000400 /* IP Packet Type: 1=IPv4 */ -#define E1000_ADVTXD_TUCMD_IPV6 0x00000000 /* IP Packet Type: 0=IPv6 */ -#define E1000_ADVTXD_TUCMD_L4T_UDP 0x00000000 /* L4 Packet TYPE of UDP */ -#define E1000_ADVTXD_TUCMD_L4T_TCP 0x00000800 /* L4 Packet TYPE of TCP */ -#define E1000_ADVTXD_TUCMD_L4T_SCTP 0x00001000 /* L4 Packet TYPE of SCTP */ -#define E1000_ADVTXD_TUCMD_IPSEC_TYPE_ESP 0x00002000 /* IPSec Type ESP */ +#define E1000_ADVTXD_MACLEN_SHIFT 9 /* Adv ctxt desc mac len shift */ +#define E1000_ADVTXD_VLAN_SHIFT 16 /* Adv ctxt vlan tag shift */ +#define E1000_ADVTXD_TUCMD_IPV4 0x00000400 /* IP Packet Type: 1=IPv4 */ +#define E1000_ADVTXD_TUCMD_IPV6 0x00000000 /* IP Packet Type: 0=IPv6 */ +#define E1000_ADVTXD_TUCMD_L4T_UDP 0x00000000 /* L4 Packet TYPE of UDP */ +#define E1000_ADVTXD_TUCMD_L4T_TCP 0x00000800 /* L4 Packet TYPE of TCP */ +#define E1000_ADVTXD_TUCMD_L4T_SCTP 0x00001000 /* L4 Packet TYPE of SCTP */ +#define E1000_ADVTXD_TUCMD_IPSEC_TYPE_ESP 0x00002000 /* IPSec Type ESP */ /* IPSec Encrypt Enable for ESP */ -#define E1000_ADVTXD_TUCMD_IPSEC_ENCRYPT_EN 0x00004000 -#define E1000_ADVTXD_TUCMD_MKRREQ 0x00002000 /* Req requires Markers and CRC */ -#define E1000_ADVTXD_L4LEN_SHIFT 8 /* Adv ctxt L4LEN shift */ -#define E1000_ADVTXD_MSS_SHIFT 16 /* Adv ctxt MSS shift */ +#define E1000_ADVTXD_TUCMD_IPSEC_ENCRYPT_EN 0x00004000 +/* Req requires Markers and CRC */ +#define E1000_ADVTXD_TUCMD_MKRREQ 0x00002000 +#define E1000_ADVTXD_L4LEN_SHIFT 8 /* Adv ctxt L4LEN shift */ +#define E1000_ADVTXD_MSS_SHIFT 16 /* Adv ctxt MSS shift */ /* Adv ctxt IPSec SA IDX mask */ -#define E1000_ADVTXD_IPSEC_SA_INDEX_MASK 0x000000FF +#define E1000_ADVTXD_IPSEC_SA_INDEX_MASK 0x000000FF /* Adv ctxt IPSec ESP len mask */ -#define E1000_ADVTXD_IPSEC_ESP_LEN_MASK 0x000000FF +#define E1000_ADVTXD_IPSEC_ESP_LEN_MASK 0x000000FF /* Additional Transmit Descriptor Control definitions */ -#define E1000_TXDCTL_QUEUE_ENABLE 0x02000000 /* Enable specific Tx Queue */ -#define E1000_TXDCTL_SWFLSH 0x04000000 /* Tx Desc. write-back flushing */ +#define E1000_TXDCTL_QUEUE_ENABLE 0x02000000 /* Ena specific Tx Queue */ +#define E1000_TXDCTL_SWFLSH 0x04000000 /* Tx Desc. wbk flushing */ /* Tx Queue Arbitration Priority 0=low, 1=high */ -#define E1000_TXDCTL_PRIORITY 0x08000000 +#define E1000_TXDCTL_PRIORITY 0x08000000 /* Additional Receive Descriptor Control definitions */ -#define E1000_RXDCTL_QUEUE_ENABLE 0x02000000 /* Enable specific Rx Queue */ -#define E1000_RXDCTL_SWFLSH 0x04000000 /* Rx Desc. write-back flushing */ +#define E1000_RXDCTL_QUEUE_ENABLE 0x02000000 /* Ena specific Rx Queue */ +#define E1000_RXDCTL_SWFLSH 0x04000000 /* Rx Desc. wbk flushing */ /* Direct Cache Access (DCA) definitions */ -#define E1000_DCA_CTRL_DCA_ENABLE 0x00000000 /* DCA Enable */ -#define E1000_DCA_CTRL_DCA_DISABLE 0x00000001 /* DCA Disable */ +#define E1000_DCA_CTRL_DCA_ENABLE 0x00000000 /* DCA Enable */ +#define E1000_DCA_CTRL_DCA_DISABLE 0x00000001 /* DCA Disable */ -#define E1000_DCA_CTRL_DCA_MODE_CB1 0x00 /* DCA Mode CB1 */ -#define E1000_DCA_CTRL_DCA_MODE_CB2 0x02 /* DCA Mode CB2 */ +#define E1000_DCA_CTRL_DCA_MODE_CB1 0x00 /* DCA Mode CB1 */ +#define E1000_DCA_CTRL_DCA_MODE_CB2 0x02 /* DCA Mode CB2 */ -#define E1000_DCA_RXCTRL_CPUID_MASK 0x0000001F /* Rx CPUID Mask */ -#define E1000_DCA_RXCTRL_DESC_DCA_EN (1 << 5) /* DCA Rx Desc enable */ -#define E1000_DCA_RXCTRL_HEAD_DCA_EN (1 << 6) /* DCA Rx Desc header enable */ -#define E1000_DCA_RXCTRL_DATA_DCA_EN (1 << 7) /* DCA Rx Desc payload enable */ +#define E1000_DCA_RXCTRL_CPUID_MASK 0x0000001F /* Rx CPUID Mask */ +#define E1000_DCA_RXCTRL_DESC_DCA_EN (1 << 5) /* DCA Rx Desc enable */ +#define E1000_DCA_RXCTRL_HEAD_DCA_EN (1 << 6) /* DCA Rx Desc header ena */ +#define E1000_DCA_RXCTRL_DATA_DCA_EN (1 << 7) /* DCA Rx Desc payload ena */ -#define E1000_DCA_TXCTRL_CPUID_MASK 0x0000001F /* Tx CPUID Mask */ -#define E1000_DCA_TXCTRL_DESC_DCA_EN (1 << 5) /* DCA Tx Desc enable */ -#define E1000_DCA_TXCTRL_TX_WB_RO_EN (1 << 11) /* Tx Desc writeback RO bit */ +#define E1000_DCA_TXCTRL_CPUID_MASK 0x0000001F /* Tx CPUID Mask */ +#define E1000_DCA_TXCTRL_DESC_DCA_EN (1 << 5) /* DCA Tx Desc enable */ +#define E1000_DCA_TXCTRL_TX_WB_RO_EN (1 << 11) /* Tx Desc writeback RO bit */ -#define E1000_DCA_TXCTRL_CPUID_MASK_82576 0xFF000000 /* Tx CPUID Mask */ -#define E1000_DCA_RXCTRL_CPUID_MASK_82576 0xFF000000 /* Rx CPUID Mask */ -#define E1000_DCA_TXCTRL_CPUID_SHIFT_82576 24 /* Tx CPUID */ -#define E1000_DCA_RXCTRL_CPUID_SHIFT_82576 24 /* Rx CPUID */ +#define E1000_DCA_TXCTRL_CPUID_MASK_82576 0xFF000000 /* Tx CPUID Mask */ +#define E1000_DCA_RXCTRL_CPUID_MASK_82576 0xFF000000 /* Rx CPUID Mask */ +#define E1000_DCA_TXCTRL_CPUID_SHIFT_82576 24 /* Tx CPUID */ +#define E1000_DCA_RXCTRL_CPUID_SHIFT_82576 24 /* Rx CPUID */ /* Additional interrupt register bit definitions */ -#define E1000_ICR_LSECPNS 0x00000020 /* PN threshold - server */ -#define E1000_IMS_LSECPNS E1000_ICR_LSECPNS /* PN threshold - server */ -#define E1000_ICS_LSECPNS E1000_ICR_LSECPNS /* PN threshold - server */ +#define E1000_ICR_LSECPNS 0x00000020 /* PN threshold - server */ +#define E1000_IMS_LSECPNS E1000_ICR_LSECPNS /* PN threshold - server */ +#define E1000_ICS_LSECPNS E1000_ICR_LSECPNS /* PN threshold - server */ /* ETQF register bit definitions */ -#define E1000_ETQF_FILTER_ENABLE (1 << 26) -#define E1000_ETQF_IMM_INT (1 << 29) -#define E1000_ETQF_1588 (1 << 30) -#define E1000_ETQF_QUEUE_ENABLE (1 << 31) +#define E1000_ETQF_FILTER_ENABLE (1 << 26) +#define E1000_ETQF_IMM_INT (1 << 29) +#define E1000_ETQF_1588 (1 << 30) +#define E1000_ETQF_QUEUE_ENABLE (1 << 31) /* * ETQF filter list: one static filter per filter consumer. This is * to avoid filter collisions later. Add new filters @@ -385,87 +388,89 @@ struct e1000_adv_tx_context_desc { * Current filters: * EAPOL 802.1x (0x888e): Filter 0 */ -#define E1000_ETQF_FILTER_EAPOL 0 +#define E1000_ETQF_FILTER_EAPOL 0 -#define E1000_FTQF_VF_BP 0x00008000 -#define E1000_FTQF_1588_TIME_STAMP 0x08000000 -#define E1000_FTQF_MASK 0xF0000000 -#define E1000_FTQF_MASK_PROTO_BP 0x10000000 -#define E1000_FTQF_MASK_SOURCE_ADDR_BP 0x20000000 -#define E1000_FTQF_MASK_DEST_ADDR_BP 0x40000000 -#define E1000_FTQF_MASK_SOURCE_PORT_BP 0x80000000 +#define E1000_FTQF_VF_BP 0x00008000 +#define E1000_FTQF_1588_TIME_STAMP 0x08000000 +#define E1000_FTQF_MASK 0xF0000000 +#define E1000_FTQF_MASK_PROTO_BP 0x10000000 +#define E1000_FTQF_MASK_SOURCE_ADDR_BP 0x20000000 +#define E1000_FTQF_MASK_DEST_ADDR_BP 0x40000000 +#define E1000_FTQF_MASK_SOURCE_PORT_BP 0x80000000 -#define E1000_NVM_APME_82575 0x0400 -#define MAX_NUM_VFS 8 +#define E1000_NVM_APME_82575 0x0400 +#define MAX_NUM_VFS 7 -#define E1000_DTXSWC_MAC_SPOOF_MASK 0x000000FF /* Per VF MAC spoof control */ -#define E1000_DTXSWC_VLAN_SPOOF_MASK 0x0000FF00 /* Per VF VLAN spoof control */ -#define E1000_DTXSWC_LLE_MASK 0x00FF0000 /* Per VF Local LB enables */ -#define E1000_DTXSWC_VLAN_SPOOF_SHIFT 8 -#define E1000_DTXSWC_LLE_SHIFT 16 -#define E1000_DTXSWC_VMDQ_LOOPBACK_EN (1 << 31) /* global VF LB enable */ +#define E1000_DTXSWC_MAC_SPOOF_MASK 0x000000FF /* Per VF MAC spoof cntrl */ +#define E1000_DTXSWC_VLAN_SPOOF_MASK 0x0000FF00 /* Per VF VLAN spoof cntrl */ +#define E1000_DTXSWC_LLE_MASK 0x00FF0000 /* Per VF Local LB enables */ +#define E1000_DTXSWC_VLAN_SPOOF_SHIFT 8 +#define E1000_DTXSWC_LLE_SHIFT 16 +#define E1000_DTXSWC_VMDQ_LOOPBACK_EN (1 << 31) /* global VF LB enable */ /* Easy defines for setting default pool, would normally be left a zero */ -#define E1000_VT_CTL_DEFAULT_POOL_SHIFT 7 -#define E1000_VT_CTL_DEFAULT_POOL_MASK (0x7 << E1000_VT_CTL_DEFAULT_POOL_SHIFT) +#define E1000_VT_CTL_DEFAULT_POOL_SHIFT 7 +#define E1000_VT_CTL_DEFAULT_POOL_MASK (0x7 << E1000_VT_CTL_DEFAULT_POOL_SHIFT) /* Other useful VMD_CTL register defines */ -#define E1000_VT_CTL_IGNORE_MAC (1 << 28) -#define E1000_VT_CTL_DISABLE_DEF_POOL (1 << 29) -#define E1000_VT_CTL_VM_REPL_EN (1 << 30) +#define E1000_VT_CTL_IGNORE_MAC (1 << 28) +#define E1000_VT_CTL_DISABLE_DEF_POOL (1 << 29) +#define E1000_VT_CTL_VM_REPL_EN (1 << 30) /* Per VM Offload register setup */ -#define E1000_VMOLR_RLPML_MASK 0x00003FFF /* Long Packet Maximum Length mask */ -#define E1000_VMOLR_LPE 0x00010000 /* Accept Long packet */ -#define E1000_VMOLR_RSSE 0x00020000 /* Enable RSS */ -#define E1000_VMOLR_AUPE 0x01000000 /* Accept untagged packets */ -#define E1000_VMOLR_ROMPE 0x02000000 /* Accept overflow multicast */ -#define E1000_VMOLR_ROPE 0x04000000 /* Accept overflow unicast */ -#define E1000_VMOLR_BAM 0x08000000 /* Accept Broadcast packets */ -#define E1000_VMOLR_MPME 0x10000000 /* Multicast promiscuous mode */ -#define E1000_VMOLR_STRVLAN 0x40000000 /* Vlan stripping enable */ -#define E1000_VMOLR_STRCRC 0x80000000 /* CRC stripping enable */ +#define E1000_VMOLR_RLPML_MASK 0x00003FFF /* Long Packet Maximum Length mask */ +#define E1000_VMOLR_LPE 0x00010000 /* Accept Long packet */ +#define E1000_VMOLR_RSSE 0x00020000 /* Enable RSS */ +#define E1000_VMOLR_AUPE 0x01000000 /* Accept untagged packets */ +#define E1000_VMOLR_ROMPE 0x02000000 /* Accept overflow multicast */ +#define E1000_VMOLR_ROPE 0x04000000 /* Accept overflow unicast */ +#define E1000_VMOLR_BAM 0x08000000 /* Accept Broadcast packets */ +#define E1000_VMOLR_MPME 0x10000000 /* Multicast promiscuous mode */ +#define E1000_VMOLR_STRVLAN 0x40000000 /* Vlan stripping enable */ +#define E1000_VMOLR_STRCRC 0x80000000 /* CRC stripping enable */ -#define E1000_VMOLR_VPE 0x00800000 /* VLAN promiscuous enable */ -#define E1000_VMOLR_UPE 0x20000000 /* Unicast promisuous enable */ -#define E1000_DVMOLR_HIDVLAN 0x20000000 /* Vlan hiding enable */ -#define E1000_DVMOLR_STRVLAN 0x40000000 /* Vlan stripping enable */ -#define E1000_DVMOLR_STRCRC 0x80000000 /* CRC stripping enable */ +#define E1000_VMOLR_VPE 0x00800000 /* VLAN promiscuous enable */ +#define E1000_VMOLR_UPE 0x20000000 /* Unicast promisuous enable */ +#define E1000_DVMOLR_HIDVLAN 0x20000000 /* Vlan hiding enable */ +#define E1000_DVMOLR_STRVLAN 0x40000000 /* Vlan stripping enable */ +#define E1000_DVMOLR_STRCRC 0x80000000 /* CRC stripping enable */ -#define E1000_PBRWAC_WALPB 0x00000007 /* Wrap around event on LAN Rx PB */ -#define E1000_PBRWAC_PBE 0x00000008 /* Rx packet buffer empty */ +#define E1000_PBRWAC_WALPB 0x00000007 /* Wrap around event on LAN Rx PB */ +#define E1000_PBRWAC_PBE 0x00000008 /* Rx packet buffer empty */ -#define E1000_VLVF_ARRAY_SIZE 32 -#define E1000_VLVF_VLANID_MASK 0x00000FFF -#define E1000_VLVF_POOLSEL_SHIFT 12 -#define E1000_VLVF_POOLSEL_MASK (0xFF << E1000_VLVF_POOLSEL_SHIFT) -#define E1000_VLVF_LVLAN 0x00100000 -#define E1000_VLVF_VLANID_ENABLE 0x80000000 +#define E1000_VLVF_ARRAY_SIZE 32 +#define E1000_VLVF_VLANID_MASK 0x00000FFF +#define E1000_VLVF_POOLSEL_SHIFT 12 +#define E1000_VLVF_POOLSEL_MASK (0xFF << E1000_VLVF_POOLSEL_SHIFT) +#define E1000_VLVF_LVLAN 0x00100000 +#define E1000_VLVF_VLANID_ENABLE 0x80000000 -#define E1000_VMVIR_VLANA_DEFAULT 0x40000000 /* Always use default VLAN */ -#define E1000_VMVIR_VLANA_NEVER 0x80000000 /* Never insert VLAN tag */ +#define E1000_VMVIR_VLANA_DEFAULT 0x40000000 /* Always use default VLAN */ +#define E1000_VMVIR_VLANA_NEVER 0x80000000 /* Never insert VLAN tag */ -#define E1000_VF_INIT_TIMEOUT 200 /* Number of retries to clear RSTI */ +#define E1000_VF_INIT_TIMEOUT 200 /* Number of retries to clear RSTI */ -#define E1000_IOVCTL 0x05BBC -#define E1000_IOVCTL_REUSE_VFQ 0x00000001 +#define E1000_IOVCTL 0x05BBC +#define E1000_IOVCTL_REUSE_VFQ 0x00000001 -#define E1000_RPLOLR_STRVLAN 0x40000000 -#define E1000_RPLOLR_STRCRC 0x80000000 +#define E1000_RPLOLR_STRVLAN 0x40000000 +#define E1000_RPLOLR_STRCRC 0x80000000 -#define E1000_TCTL_EXT_COLD 0x000FFC00 -#define E1000_TCTL_EXT_COLD_SHIFT 10 +#define E1000_TCTL_EXT_COLD 0x000FFC00 +#define E1000_TCTL_EXT_COLD_SHIFT 10 -#define E1000_DTXCTL_8023LL 0x0004 -#define E1000_DTXCTL_VLAN_ADDED 0x0008 -#define E1000_DTXCTL_OOS_ENABLE 0x0010 -#define E1000_DTXCTL_MDP_EN 0x0020 -#define E1000_DTXCTL_SPOOF_INT 0x0040 +#define E1000_DTXCTL_8023LL 0x0004 +#define E1000_DTXCTL_VLAN_ADDED 0x0008 +#define E1000_DTXCTL_OOS_ENABLE 0x0010 +#define E1000_DTXCTL_MDP_EN 0x0020 +#define E1000_DTXCTL_SPOOF_INT 0x0040 -#define ALL_QUEUES 0xFFFF +#define E1000_EEPROM_PCS_AUTONEG_DISABLE_BIT (1 << 14) + +#define ALL_QUEUES 0xFFFF /* Rx packet buffer size defines */ -#define E1000_RXPBS_SIZE_MASK_82576 0x0000007F +#define E1000_RXPBS_SIZE_MASK_82576 0x0000007F void e1000_vmdq_set_loopback_pf(struct e1000_hw *hw, bool enable); void e1000_vmdq_set_anti_spoofing_pf(struct e1000_hw *hw, bool enable, int pf); void e1000_vmdq_set_replication_pf(struct e1000_hw *hw, bool enable); @@ -484,4 +489,23 @@ void e1000_rlpml_set_vf(struct e1000_hw *, u16); s32 e1000_promisc_set_vf(struct e1000_hw *, enum e1000_promisc_type type); u16 e1000_rxpbs_adjust_82580(u32 data); s32 e1000_set_eee_i350(struct e1000_hw *); + +/* I2C SDA and SCL timing parameters for standard mode */ +#define E1000_I2C_T_HD_STA 4 +#define E1000_I2C_T_LOW 5 +#define E1000_I2C_T_HIGH 4 +#define E1000_I2C_T_SU_STA 5 +#define E1000_I2C_T_HD_DATA 5 +#define E1000_I2C_T_SU_DATA 1 +#define E1000_I2C_T_RISE 1 +#define E1000_I2C_T_FALL 1 +#define E1000_I2C_T_SU_STO 4 +#define E1000_I2C_T_BUF 5 + +s32 e1000_set_i2c_bb(struct e1000_hw *hw); +s32 e1000_read_i2c_byte_generic(struct e1000_hw *hw, u8 byte_offset, + u8 dev_addr, u8 *data); +s32 e1000_write_i2c_byte_generic(struct e1000_hw *hw, u8 byte_offset, + u8 dev_addr, u8 data); +void e1000_i2c_bus_clear(struct e1000_hw *hw); #endif /* _E1000_82575_H_ */ diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_api.c b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_api.c index 1b7835b890..4b2a43d728 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_api.c +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_api.c @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2010, Intel Corporation + Copyright (c) 2001-2012, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -30,7 +30,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: src/sys/dev/e1000/e1000_api.c,v 1.4.2.4.2.1 2010/12/21 17:09:25 kensmith Exp $*/ +/*$FreeBSD$*/ #include "e1000_api.h" @@ -277,7 +277,6 @@ s32 e1000_set_mac_type(struct e1000_hw *hw) case E1000_DEV_ID_ICH10_D_BM_LM: case E1000_DEV_ID_ICH10_D_BM_LF: case E1000_DEV_ID_ICH10_D_BM_V: - case E1000_DEV_ID_ICH10_HANKSVILLE: mac->type = e1000_ich10lan; break; case E1000_DEV_ID_PCH_D_HV_DM: @@ -293,7 +292,6 @@ s32 e1000_set_mac_type(struct e1000_hw *hw) case E1000_DEV_ID_82575EB_COPPER: case E1000_DEV_ID_82575EB_FIBER_SERDES: case E1000_DEV_ID_82575GB_QUAD_COPPER: - case E1000_DEV_ID_82575GB_QUAD_COPPER_PM: mac->type = e1000_82575; break; case E1000_DEV_ID_82576: @@ -322,8 +320,20 @@ s32 e1000_set_mac_type(struct e1000_hw *hw) case E1000_DEV_ID_I350_FIBER: case E1000_DEV_ID_I350_SERDES: case E1000_DEV_ID_I350_SGMII: + case E1000_DEV_ID_I350_DA4: mac->type = e1000_i350; break; + case E1000_DEV_ID_I210_COPPER: + case E1000_DEV_ID_I210_COPPER_OEM1: + case E1000_DEV_ID_I210_COPPER_IT: + case E1000_DEV_ID_I210_FIBER: + case E1000_DEV_ID_I210_SERDES: + case E1000_DEV_ID_I210_SGMII: + mac->type = e1000_i210; + break; + case E1000_DEV_ID_I211_COPPER: + mac->type = e1000_i211; + break; case E1000_DEV_ID_82576_VF: mac->type = e1000_vfadapt; break; @@ -343,10 +353,10 @@ s32 e1000_set_mac_type(struct e1000_hw *hw) * e1000_setup_init_funcs - Initializes function pointers * @hw: pointer to the HW structure * @init_device: TRUE will initialize the rest of the function pointers - * getting the device ready for use. FALSE will only set - * MAC type and the function pointers for the other init - * functions. Passing FALSE will not generate any hardware - * reads or writes. + * getting the device ready for use. FALSE will only set + * MAC type and the function pointers for the other init + * functions. Passing FALSE will not generate any hardware + * reads or writes. * * This function must be called by a driver in order to use the rest * of the 'shared' code files. Called by drivers only. @@ -426,6 +436,10 @@ s32 e1000_setup_init_funcs(struct e1000_hw *hw, bool init_device) case e1000_i350: e1000_init_function_pointers_82575(hw); break; + case e1000_i210: + case e1000_i211: + e1000_init_function_pointers_i210(hw); + break; case e1000_vfadapt: e1000_init_function_pointers_vf(hw); break; @@ -518,11 +532,11 @@ void e1000_write_vfta(struct e1000_hw *hw, u32 offset, u32 value) * The caller must have a packed mc_addr_list of multicast addresses. **/ void e1000_update_mc_addr_list(struct e1000_hw *hw, u8 *mc_addr_list, - u32 mc_addr_count) + u32 mc_addr_count) { if (hw->mac.ops.update_mc_addr_list) hw->mac.ops.update_mc_addr_list(hw, mc_addr_list, - mc_addr_count); + mc_addr_count); } /** @@ -856,12 +870,12 @@ bool e1000_enable_tx_pkt_filtering(struct e1000_hw *hw) * It also does alignment considerations to do the writes in most efficient * way. Also fills up the sum of the buffer in *buffer parameter. **/ -s32 e1000_mng_host_if_write(struct e1000_hw * hw, u8 *buffer, u16 length, - u16 offset, u8 *sum) +s32 e1000_mng_host_if_write(struct e1000_hw *hw, u8 *buffer, u16 length, + u16 offset, u8 *sum) { if (hw->mac.ops.mng_host_if_write) return hw->mac.ops.mng_host_if_write(hw, buffer, length, - offset, sum); + offset, sum); return E1000_NOT_IMPLEMENTED; } @@ -874,7 +888,7 @@ s32 e1000_mng_host_if_write(struct e1000_hw * hw, u8 *buffer, u16 length, * Writes the command header after does the checksum calculation. **/ s32 e1000_mng_write_cmd_header(struct e1000_hw *hw, - struct e1000_host_mng_command_header *hdr) + struct e1000_host_mng_command_header *hdr) { if (hw->mac.ops.mng_write_cmd_header) return hw->mac.ops.mng_write_cmd_header(hw, hdr); @@ -892,7 +906,7 @@ s32 e1000_mng_write_cmd_header(struct e1000_hw *hw, * and also checks whether the previous command is completed. It busy waits * in case of previous command is not completed. **/ -s32 e1000_mng_enable_host_if(struct e1000_hw * hw) +s32 e1000_mng_enable_host_if(struct e1000_hw *hw) { if (hw->mac.ops.mng_enable_host_if) return hw->mac.ops.mng_enable_host_if(hw); @@ -1277,7 +1291,7 @@ s32 e1000_write_nvm(struct e1000_hw *hw, u16 offset, u16 words, u16 *data) * This is a function pointer entry point called by drivers. **/ s32 e1000_write_8bit_ctrl_reg(struct e1000_hw *hw, u32 reg, u32 offset, - u8 data) + u8 data) { return e1000_write_8bit_ctrl_reg_generic(hw, reg, offset, data); } diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_api.h b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_api.h index 86d4573620..4c061c0958 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_api.h +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_api.h @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2010, Intel Corporation + Copyright (c) 2001-2012, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -30,97 +30,96 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: src/sys/dev/e1000/e1000_api.h,v 1.3.2.4.2.1 2010/12/21 17:09:25 kensmith Exp $*/ +/*$FreeBSD$*/ #ifndef _E1000_API_H_ #define _E1000_API_H_ #include "e1000_hw.h" -extern void e1000_init_function_pointers_82542(struct e1000_hw *hw); -extern void e1000_init_function_pointers_82543(struct e1000_hw *hw); -extern void e1000_init_function_pointers_82540(struct e1000_hw *hw); -extern void e1000_init_function_pointers_82571(struct e1000_hw *hw); -extern void e1000_init_function_pointers_82541(struct e1000_hw *hw); -extern void e1000_init_function_pointers_80003es2lan(struct e1000_hw *hw); -extern void e1000_init_function_pointers_ich8lan(struct e1000_hw *hw); -extern void e1000_init_function_pointers_82575(struct e1000_hw *hw); -extern void e1000_rx_fifo_flush_82575(struct e1000_hw *hw); -extern void e1000_init_function_pointers_vf(struct e1000_hw *hw); -extern void e1000_power_up_fiber_serdes_link(struct e1000_hw *hw); -extern void e1000_shutdown_fiber_serdes_link(struct e1000_hw *hw); +extern void e1000_init_function_pointers_82542(struct e1000_hw *hw); +extern void e1000_init_function_pointers_82543(struct e1000_hw *hw); +extern void e1000_init_function_pointers_82540(struct e1000_hw *hw); +extern void e1000_init_function_pointers_82571(struct e1000_hw *hw); +extern void e1000_init_function_pointers_82541(struct e1000_hw *hw); +extern void e1000_init_function_pointers_80003es2lan(struct e1000_hw *hw); +extern void e1000_init_function_pointers_ich8lan(struct e1000_hw *hw); +extern void e1000_init_function_pointers_82575(struct e1000_hw *hw); +extern void e1000_rx_fifo_flush_82575(struct e1000_hw *hw); +extern void e1000_init_function_pointers_vf(struct e1000_hw *hw); +extern void e1000_power_up_fiber_serdes_link(struct e1000_hw *hw); +extern void e1000_shutdown_fiber_serdes_link(struct e1000_hw *hw); +extern void e1000_init_function_pointers_i210(struct e1000_hw *hw); -s32 e1000_set_mac_type(struct e1000_hw *hw); -s32 e1000_setup_init_funcs(struct e1000_hw *hw, bool init_device); -s32 e1000_init_mac_params(struct e1000_hw *hw); -s32 e1000_init_nvm_params(struct e1000_hw *hw); -s32 e1000_init_phy_params(struct e1000_hw *hw); -s32 e1000_init_mbx_params(struct e1000_hw *hw); -s32 e1000_get_bus_info(struct e1000_hw *hw); +s32 e1000_set_mac_type(struct e1000_hw *hw); +s32 e1000_setup_init_funcs(struct e1000_hw *hw, bool init_device); +s32 e1000_init_mac_params(struct e1000_hw *hw); +s32 e1000_init_nvm_params(struct e1000_hw *hw); +s32 e1000_init_phy_params(struct e1000_hw *hw); +s32 e1000_init_mbx_params(struct e1000_hw *hw); +s32 e1000_get_bus_info(struct e1000_hw *hw); void e1000_clear_vfta(struct e1000_hw *hw); void e1000_write_vfta(struct e1000_hw *hw, u32 offset, u32 value); -s32 e1000_force_mac_fc(struct e1000_hw *hw); -s32 e1000_check_for_link(struct e1000_hw *hw); -s32 e1000_reset_hw(struct e1000_hw *hw); -s32 e1000_init_hw(struct e1000_hw *hw); -s32 e1000_setup_link(struct e1000_hw *hw); -s32 e1000_get_speed_and_duplex(struct e1000_hw *hw, u16 *speed, - u16 *duplex); -s32 e1000_disable_pcie_master(struct e1000_hw *hw); +s32 e1000_force_mac_fc(struct e1000_hw *hw); +s32 e1000_check_for_link(struct e1000_hw *hw); +s32 e1000_reset_hw(struct e1000_hw *hw); +s32 e1000_init_hw(struct e1000_hw *hw); +s32 e1000_setup_link(struct e1000_hw *hw); +s32 e1000_get_speed_and_duplex(struct e1000_hw *hw, u16 *speed, u16 *duplex); +s32 e1000_disable_pcie_master(struct e1000_hw *hw); void e1000_config_collision_dist(struct e1000_hw *hw); void e1000_rar_set(struct e1000_hw *hw, u8 *addr, u32 index); -u32 e1000_hash_mc_addr(struct e1000_hw *hw, u8 *mc_addr); -void e1000_update_mc_addr_list(struct e1000_hw *hw, - u8 *mc_addr_list, u32 mc_addr_count); -s32 e1000_setup_led(struct e1000_hw *hw); -s32 e1000_cleanup_led(struct e1000_hw *hw); -s32 e1000_check_reset_block(struct e1000_hw *hw); -s32 e1000_blink_led(struct e1000_hw *hw); -s32 e1000_led_on(struct e1000_hw *hw); -s32 e1000_led_off(struct e1000_hw *hw); +u32 e1000_hash_mc_addr(struct e1000_hw *hw, u8 *mc_addr); +void e1000_update_mc_addr_list(struct e1000_hw *hw, u8 *mc_addr_list, + u32 mc_addr_count); +s32 e1000_setup_led(struct e1000_hw *hw); +s32 e1000_cleanup_led(struct e1000_hw *hw); +s32 e1000_check_reset_block(struct e1000_hw *hw); +s32 e1000_blink_led(struct e1000_hw *hw); +s32 e1000_led_on(struct e1000_hw *hw); +s32 e1000_led_off(struct e1000_hw *hw); s32 e1000_id_led_init(struct e1000_hw *hw); void e1000_reset_adaptive(struct e1000_hw *hw); void e1000_update_adaptive(struct e1000_hw *hw); -s32 e1000_get_cable_length(struct e1000_hw *hw); -s32 e1000_validate_mdi_setting(struct e1000_hw *hw); -s32 e1000_read_phy_reg(struct e1000_hw *hw, u32 offset, u16 *data); -s32 e1000_write_phy_reg(struct e1000_hw *hw, u32 offset, u16 data); -s32 e1000_write_8bit_ctrl_reg(struct e1000_hw *hw, u32 reg, - u32 offset, u8 data); -s32 e1000_get_phy_info(struct e1000_hw *hw); +s32 e1000_get_cable_length(struct e1000_hw *hw); +s32 e1000_validate_mdi_setting(struct e1000_hw *hw); +s32 e1000_read_phy_reg(struct e1000_hw *hw, u32 offset, u16 *data); +s32 e1000_write_phy_reg(struct e1000_hw *hw, u32 offset, u16 data); +s32 e1000_write_8bit_ctrl_reg(struct e1000_hw *hw, u32 reg, u32 offset, + u8 data); +s32 e1000_get_phy_info(struct e1000_hw *hw); void e1000_release_phy(struct e1000_hw *hw); -s32 e1000_acquire_phy(struct e1000_hw *hw); -s32 e1000_cfg_on_link_up(struct e1000_hw *hw); -s32 e1000_phy_hw_reset(struct e1000_hw *hw); -s32 e1000_phy_commit(struct e1000_hw *hw); +s32 e1000_acquire_phy(struct e1000_hw *hw); +s32 e1000_cfg_on_link_up(struct e1000_hw *hw); +s32 e1000_phy_hw_reset(struct e1000_hw *hw); +s32 e1000_phy_commit(struct e1000_hw *hw); void e1000_power_up_phy(struct e1000_hw *hw); void e1000_power_down_phy(struct e1000_hw *hw); -s32 e1000_read_mac_addr(struct e1000_hw *hw); -s32 e1000_read_pba_string(struct e1000_hw *hw, u8 *pba_num, - u32 pba_num_size); -s32 e1000_read_pba_length(struct e1000_hw *hw, u32 *pba_num_size); +s32 e1000_read_mac_addr(struct e1000_hw *hw); +s32 e1000_read_pba_string(struct e1000_hw *hw, u8 *pba_num, u32 pba_num_size); +s32 e1000_read_pba_length(struct e1000_hw *hw, u32 *pba_num_size); void e1000_reload_nvm(struct e1000_hw *hw); -s32 e1000_update_nvm_checksum(struct e1000_hw *hw); -s32 e1000_validate_nvm_checksum(struct e1000_hw *hw); -s32 e1000_read_nvm(struct e1000_hw *hw, u16 offset, u16 words, u16 *data); -s32 e1000_read_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 *data); -s32 e1000_write_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 data); -s32 e1000_write_nvm(struct e1000_hw *hw, u16 offset, u16 words, - u16 *data); -s32 e1000_wait_autoneg(struct e1000_hw *hw); -s32 e1000_set_d3_lplu_state(struct e1000_hw *hw, bool active); -s32 e1000_set_d0_lplu_state(struct e1000_hw *hw, bool active); +s32 e1000_update_nvm_checksum(struct e1000_hw *hw); +s32 e1000_validate_nvm_checksum(struct e1000_hw *hw); +s32 e1000_read_nvm(struct e1000_hw *hw, u16 offset, u16 words, u16 *data); +s32 e1000_read_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 *data); +s32 e1000_write_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 data); +s32 e1000_write_nvm(struct e1000_hw *hw, u16 offset, u16 words, u16 *data); +s32 e1000_wait_autoneg(struct e1000_hw *hw); +s32 e1000_set_d3_lplu_state(struct e1000_hw *hw, bool active); +s32 e1000_set_d0_lplu_state(struct e1000_hw *hw, bool active); bool e1000_check_mng_mode(struct e1000_hw *hw); bool e1000_enable_tx_pkt_filtering(struct e1000_hw *hw); -s32 e1000_mng_enable_host_if(struct e1000_hw *hw); -s32 e1000_mng_host_if_write(struct e1000_hw *hw, - u8 *buffer, u16 length, u16 offset, u8 *sum); -s32 e1000_mng_write_cmd_header(struct e1000_hw *hw, - struct e1000_host_mng_command_header *hdr); -s32 e1000_mng_write_dhcp_info(struct e1000_hw * hw, - u8 *buffer, u16 length); +s32 e1000_mng_enable_host_if(struct e1000_hw *hw); +s32 e1000_mng_host_if_write(struct e1000_hw *hw, u8 *buffer, u16 length, + u16 offset, u8 *sum); +s32 e1000_mng_write_cmd_header(struct e1000_hw *hw, + struct e1000_host_mng_command_header *hdr); +s32 e1000_mng_write_dhcp_info(struct e1000_hw *hw, u8 *buffer, u16 length); u32 e1000_translate_register_82542(u32 reg); + + /* * TBI_ACCEPT macro definition: * @@ -152,14 +151,15 @@ u32 e1000_translate_register_82542(u32 reg); /* The carrier extension symbol, as received by the NIC. */ #define CARRIER_EXTENSION 0x0F -#define TBI_ACCEPT(a, status, errors, length, last_byte, min_frame_size, max_frame_size) \ - (e1000_tbi_sbp_enabled_82543(a) && \ - (((errors) & E1000_RXD_ERR_FRAME_ERR_MASK) == E1000_RXD_ERR_CE) && \ - ((last_byte) == CARRIER_EXTENSION) && \ - (((status) & E1000_RXD_STAT_VP) ? \ - (((length) > (min_frame_size - VLAN_TAG_SIZE)) && \ - ((length) <= (max_frame_size + 1))) : \ - (((length) > min_frame_size) && \ - ((length) <= (max_frame_size + VLAN_TAG_SIZE + 1))))) +#define TBI_ACCEPT(a, status, errors, length, last_byte, \ + min_frame_size, max_frame_size) \ + (e1000_tbi_sbp_enabled_82543(a) && \ + (((errors) & E1000_RXD_ERR_FRAME_ERR_MASK) == E1000_RXD_ERR_CE) && \ + ((last_byte) == CARRIER_EXTENSION) && \ + (((status) & E1000_RXD_STAT_VP) ? \ + (((length) > (min_frame_size - VLAN_TAG_SIZE)) && \ + ((length) <= (max_frame_size + 1))) : \ + (((length) > min_frame_size) && \ + ((length) <= (max_frame_size + VLAN_TAG_SIZE + 1))))) #endif diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_defines.h b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_defines.h index 90fb9f1ab6..a4a0ed0500 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_defines.h +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_defines.h @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2010, Intel Corporation + Copyright (c) 2001-2012, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -30,7 +30,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: src/sys/dev/e1000/e1000_defines.h,v 1.4.2.3.2.1 2010/12/21 17:09:25 kensmith Exp $*/ +/*$FreeBSD$*/ #ifndef _E1000_DEFINES_H_ #define _E1000_DEFINES_H_ @@ -41,815 +41,826 @@ /* Definitions for power management and wakeup registers */ /* Wake Up Control */ -#define E1000_WUC_APME 0x00000001 /* APM Enable */ -#define E1000_WUC_PME_EN 0x00000002 /* PME Enable */ -#define E1000_WUC_PME_STATUS 0x00000004 /* PME Status */ -#define E1000_WUC_APMPME 0x00000008 /* Assert PME on APM Wakeup */ -#define E1000_WUC_LSCWE 0x00000010 /* Link Status wake up enable */ -#define E1000_WUC_PPROXYE 0x00000010 /* Protocol Proxy Enable */ -#define E1000_WUC_LSCWO 0x00000020 /* Link Status wake up override */ -#define E1000_WUC_SPM 0x80000000 /* Enable SPM */ -#define E1000_WUC_PHY_WAKE 0x00000100 /* if PHY supports wakeup */ -#define E1000_WUC_FLX6_PHY 0x4000 /* Flexible Filter 6 Enable */ -#define E1000_WUC_FLX7_PHY 0x8000 /* Flexible Filter 7 Enable */ +#define E1000_WUC_APME 0x00000001 /* APM Enable */ +#define E1000_WUC_PME_EN 0x00000002 /* PME Enable */ +#define E1000_WUC_PME_STATUS 0x00000004 /* PME Status */ +#define E1000_WUC_APMPME 0x00000008 /* Assert PME on APM Wakeup */ +#define E1000_WUC_LSCWE 0x00000010 /* Link Status wake up enable */ +#define E1000_WUC_PPROXYE 0x00000010 /* Protocol Proxy Enable */ +#define E1000_WUC_LSCWO 0x00000020 /* Link Status wake up override */ +#define E1000_WUC_SPM 0x80000000 /* Enable SPM */ +#define E1000_WUC_PHY_WAKE 0x00000100 /* if PHY supports wakeup */ +#define E1000_WUC_FLX6_PHY 0x4000 /* Flexible Filter 6 Enable */ +#define E1000_WUC_FLX7_PHY 0x8000 /* Flexible Filter 7 Enable */ /* Wake Up Filter Control */ -#define E1000_WUFC_LNKC 0x00000001 /* Link Status Change Wakeup Enable */ -#define E1000_WUFC_MAG 0x00000002 /* Magic Packet Wakeup Enable */ -#define E1000_WUFC_EX 0x00000004 /* Directed Exact Wakeup Enable */ -#define E1000_WUFC_MC 0x00000008 /* Directed Multicast Wakeup Enable */ -#define E1000_WUFC_BC 0x00000010 /* Broadcast Wakeup Enable */ -#define E1000_WUFC_ARP 0x00000020 /* ARP Request Packet Wakeup Enable */ -#define E1000_WUFC_IPV4 0x00000040 /* Directed IPv4 Packet Wakeup Enable */ -#define E1000_WUFC_IPV6 0x00000080 /* Directed IPv6 Packet Wakeup Enable */ +#define E1000_WUFC_LNKC 0x00000001 /* Link Status Change Wakeup Enable */ +#define E1000_WUFC_MAG 0x00000002 /* Magic Packet Wakeup Enable */ +#define E1000_WUFC_EX 0x00000004 /* Directed Exact Wakeup Enable */ +#define E1000_WUFC_MC 0x00000008 /* Directed Multicast Wakeup Enable */ +#define E1000_WUFC_BC 0x00000010 /* Broadcast Wakeup Enable */ +#define E1000_WUFC_ARP 0x00000020 /* ARP Request Packet Wakeup Enable */ +#define E1000_WUFC_IPV4 0x00000040 /* Directed IPv4 Packet Wakeup Enable */ +#define E1000_WUFC_IPV6 0x00000080 /* Directed IPv6 Packet Wakeup Enable */ #define E1000_WUFC_IGNORE_TCO_PHY 0x00000800 /* Ignore WakeOn TCO packets */ -#define E1000_WUFC_FLX0_PHY 0x00001000 /* Flexible Filter 0 Enable */ -#define E1000_WUFC_FLX1_PHY 0x00002000 /* Flexible Filter 1 Enable */ -#define E1000_WUFC_FLX2_PHY 0x00004000 /* Flexible Filter 2 Enable */ -#define E1000_WUFC_FLX3_PHY 0x00008000 /* Flexible Filter 3 Enable */ -#define E1000_WUFC_FLX4_PHY 0x00000200 /* Flexible Filter 4 Enable */ -#define E1000_WUFC_FLX5_PHY 0x00000400 /* Flexible Filter 5 Enable */ -#define E1000_WUFC_IGNORE_TCO 0x00008000 /* Ignore WakeOn TCO packets */ -#define E1000_WUFC_FLX0 0x00010000 /* Flexible Filter 0 Enable */ -#define E1000_WUFC_FLX1 0x00020000 /* Flexible Filter 1 Enable */ -#define E1000_WUFC_FLX2 0x00040000 /* Flexible Filter 2 Enable */ -#define E1000_WUFC_FLX3 0x00080000 /* Flexible Filter 3 Enable */ -#define E1000_WUFC_FLX4 0x00100000 /* Flexible Filter 4 Enable */ -#define E1000_WUFC_FLX5 0x00200000 /* Flexible Filter 5 Enable */ -#define E1000_WUFC_FLX6 0x00400000 /* Flexible Filter 6 Enable */ -#define E1000_WUFC_FLX7 0x00800000 /* Flexible Filter 7 Enable */ -#define E1000_WUFC_FW_RST 0x80000000 /* Wake on FW Reset Enable */ -#define E1000_WUFC_ALL_FILTERS_PHY_4 0x0000F0FF /*Mask for all wakeup filters*/ -#define E1000_WUFC_FLX_OFFSET_PHY 12 /* Offset to the Flexible Filters bits */ -#define E1000_WUFC_FLX_FILTERS_PHY_4 0x0000F000 /*Mask for 4 flexible filters*/ -#define E1000_WUFC_ALL_FILTERS_PHY_6 0x0000F6FF /*Mask for 6 wakeup filters */ -#define E1000_WUFC_FLX_FILTERS_PHY_6 0x0000F600 /*Mask for 6 flexible filters*/ -#define E1000_WUFC_ALL_FILTERS 0x000F00FF /* Mask for all wakeup filters */ -#define E1000_WUFC_ALL_FILTERS_6 0x003F00FF /* Mask for all 6 wakeup filters*/ -#define E1000_WUFC_ALL_FILTERS_8 0x00FF00FF /* Mask for all 8 wakeup filters*/ -#define E1000_WUFC_FLX_OFFSET 16 /* Offset to the Flexible Filters bits */ -#define E1000_WUFC_FLX_FILTERS 0x000F0000 /*Mask for the 4 flexible filters */ -#define E1000_WUFC_FLX_FILTERS_6 0x003F0000 /* Mask for 6 flexible filters */ -#define E1000_WUFC_FLX_FILTERS_8 0x00FF0000 /* Mask for 8 flexible filters */ +#define E1000_WUFC_FLX0_PHY 0x00001000 /* Flexible Filter 0 Enable */ +#define E1000_WUFC_FLX1_PHY 0x00002000 /* Flexible Filter 1 Enable */ +#define E1000_WUFC_FLX2_PHY 0x00004000 /* Flexible Filter 2 Enable */ +#define E1000_WUFC_FLX3_PHY 0x00008000 /* Flexible Filter 3 Enable */ +#define E1000_WUFC_FLX4_PHY 0x00000200 /* Flexible Filter 4 Enable */ +#define E1000_WUFC_FLX5_PHY 0x00000400 /* Flexible Filter 5 Enable */ +#define E1000_WUFC_IGNORE_TCO 0x00008000 /* Ignore WakeOn TCO packets */ +#define E1000_WUFC_FLX0 0x00010000 /* Flexible Filter 0 Enable */ +#define E1000_WUFC_FLX1 0x00020000 /* Flexible Filter 1 Enable */ +#define E1000_WUFC_FLX2 0x00040000 /* Flexible Filter 2 Enable */ +#define E1000_WUFC_FLX3 0x00080000 /* Flexible Filter 3 Enable */ +#define E1000_WUFC_FLX4 0x00100000 /* Flexible Filter 4 Enable */ +#define E1000_WUFC_FLX5 0x00200000 /* Flexible Filter 5 Enable */ +#define E1000_WUFC_FLX6 0x00400000 /* Flexible Filter 6 Enable */ +#define E1000_WUFC_FLX7 0x00800000 /* Flexible Filter 7 Enable */ +#define E1000_WUFC_FW_RST 0x80000000 /* Wake on FW Reset Enable */ +#define E1000_WUFC_ALL_FILTERS_PHY_4 0x0000F0FF /* wakeup filters mask */ +#define E1000_WUFC_FLX_OFFSET_PHY 12 /* Flexible Filters bits offset */ +#define E1000_WUFC_FLX_FILTERS_PHY_4 0x0000F000 /* 4 flexible filters mask */ +#define E1000_WUFC_ALL_FILTERS_PHY_6 0x0000F6FF /* 6 wakeup filters mask */ +#define E1000_WUFC_FLX_FILTERS_PHY_6 0x0000F600 /* 6 flexible filters mask */ +#define E1000_WUFC_ALL_FILTERS 0x000F00FF /* all wakeup filters mask */ +#define E1000_WUFC_ALL_FILTERS_6 0x003F00FF /* Mask all 6 wu filters */ +#define E1000_WUFC_ALL_FILTERS_8 0x00FF00FF /* Mask all 8 wu filters */ +#define E1000_WUFC_FLX_OFFSET 16 /* Flexible Filters bits offset */ +#define E1000_WUFC_FLX_FILTERS 0x000F0000 /* 4 flexible filters mask */ +#define E1000_WUFC_FLX_FILTERS_6 0x003F0000 /* 6 flexible filters mask */ +#define E1000_WUFC_FLX_FILTERS_8 0x00FF0000 /* 8 flexible filters mask */ /* * For 82576 to utilize Extended filter masks in addition to * existing (filter) masks */ -#define E1000_WUFC_EXT_FLX_FILTERS 0x00300000 /* Ext. FLX filter mask */ +#define E1000_WUFC_EXT_FLX_FILTERS 0x00300000 /* Ext. FLX filter mask */ /* Wake Up Status */ -#define E1000_WUS_LNKC E1000_WUFC_LNKC -#define E1000_WUS_MAG E1000_WUFC_MAG -#define E1000_WUS_EX E1000_WUFC_EX -#define E1000_WUS_MC E1000_WUFC_MC -#define E1000_WUS_BC E1000_WUFC_BC -#define E1000_WUS_ARP E1000_WUFC_ARP -#define E1000_WUS_IPV4 E1000_WUFC_IPV4 -#define E1000_WUS_IPV6 E1000_WUFC_IPV6 -#define E1000_WUS_FLX0_PHY E1000_WUFC_FLX0_PHY -#define E1000_WUS_FLX1_PHY E1000_WUFC_FLX1_PHY -#define E1000_WUS_FLX2_PHY E1000_WUFC_FLX2_PHY -#define E1000_WUS_FLX3_PHY E1000_WUFC_FLX3_PHY -#define E1000_WUS_FLX_FILTERS_PHY_4 E1000_WUFC_FLX_FILTERS_PHY_4 -#define E1000_WUS_FLX0 E1000_WUFC_FLX0 -#define E1000_WUS_FLX1 E1000_WUFC_FLX1 -#define E1000_WUS_FLX2 E1000_WUFC_FLX2 -#define E1000_WUS_FLX3 E1000_WUFC_FLX3 -#define E1000_WUS_FLX4 E1000_WUFC_FLX4 -#define E1000_WUS_FLX5 E1000_WUFC_FLX5 -#define E1000_WUS_FLX6 E1000_WUFC_FLX6 -#define E1000_WUS_FLX7 E1000_WUFC_FLX7 -#define E1000_WUS_FLX4_PHY E1000_WUFC_FLX4_PHY -#define E1000_WUS_FLX5_PHY E1000_WUFC_FLX5_PHY -#define E1000_WUS_FLX6_PHY 0x0400 -#define E1000_WUS_FLX7_PHY 0x0800 -#define E1000_WUS_FLX_FILTERS E1000_WUFC_FLX_FILTERS -#define E1000_WUS_FLX_FILTERS_6 E1000_WUFC_FLX_FILTERS_6 -#define E1000_WUS_FLX_FILTERS_8 E1000_WUFC_FLX_FILTERS_8 -#define E1000_WUS_FLX_FILTERS_PHY_6 E1000_WUFC_FLX_FILTERS_PHY_6 +#define E1000_WUS_LNKC E1000_WUFC_LNKC +#define E1000_WUS_MAG E1000_WUFC_MAG +#define E1000_WUS_EX E1000_WUFC_EX +#define E1000_WUS_MC E1000_WUFC_MC +#define E1000_WUS_BC E1000_WUFC_BC +#define E1000_WUS_ARP E1000_WUFC_ARP +#define E1000_WUS_IPV4 E1000_WUFC_IPV4 +#define E1000_WUS_IPV6 E1000_WUFC_IPV6 +#define E1000_WUS_FLX0_PHY E1000_WUFC_FLX0_PHY +#define E1000_WUS_FLX1_PHY E1000_WUFC_FLX1_PHY +#define E1000_WUS_FLX2_PHY E1000_WUFC_FLX2_PHY +#define E1000_WUS_FLX3_PHY E1000_WUFC_FLX3_PHY +#define E1000_WUS_FLX_FILTERS_PHY_4 E1000_WUFC_FLX_FILTERS_PHY_4 +#define E1000_WUS_FLX0 E1000_WUFC_FLX0 +#define E1000_WUS_FLX1 E1000_WUFC_FLX1 +#define E1000_WUS_FLX2 E1000_WUFC_FLX2 +#define E1000_WUS_FLX3 E1000_WUFC_FLX3 +#define E1000_WUS_FLX4 E1000_WUFC_FLX4 +#define E1000_WUS_FLX5 E1000_WUFC_FLX5 +#define E1000_WUS_FLX6 E1000_WUFC_FLX6 +#define E1000_WUS_FLX7 E1000_WUFC_FLX7 +#define E1000_WUS_FLX4_PHY E1000_WUFC_FLX4_PHY +#define E1000_WUS_FLX5_PHY E1000_WUFC_FLX5_PHY +#define E1000_WUS_FLX6_PHY 0x0400 +#define E1000_WUS_FLX7_PHY 0x0800 +#define E1000_WUS_FLX_FILTERS E1000_WUFC_FLX_FILTERS +#define E1000_WUS_FLX_FILTERS_6 E1000_WUFC_FLX_FILTERS_6 +#define E1000_WUS_FLX_FILTERS_8 E1000_WUFC_FLX_FILTERS_8 +#define E1000_WUS_FLX_FILTERS_PHY_6 E1000_WUFC_FLX_FILTERS_PHY_6 /* Wake Up Packet Length */ -#define E1000_WUPL_LENGTH_MASK 0x0FFF /* Only the lower 12 bits are valid */ +#define E1000_WUPL_LENGTH_MASK 0x0FFF /* Only the lower 12 bits are valid */ /* Four Flexible Filters are supported */ -#define E1000_FLEXIBLE_FILTER_COUNT_MAX 4 +#define E1000_FLEXIBLE_FILTER_COUNT_MAX 4 /* Six Flexible Filters are supported */ -#define E1000_FLEXIBLE_FILTER_COUNT_MAX_6 6 +#define E1000_FLEXIBLE_FILTER_COUNT_MAX_6 6 /* Eight Flexible Filters are supported */ -#define E1000_FLEXIBLE_FILTER_COUNT_MAX_8 8 +#define E1000_FLEXIBLE_FILTER_COUNT_MAX_8 8 /* Two Extended Flexible Filters are supported (82576) */ -#define E1000_EXT_FLEXIBLE_FILTER_COUNT_MAX 2 -#define E1000_FHFT_LENGTH_OFFSET 0xFC /* Length byte in FHFT */ -#define E1000_FHFT_LENGTH_MASK 0x0FF /* Length in lower byte */ +#define E1000_EXT_FLEXIBLE_FILTER_COUNT_MAX 2 +#define E1000_FHFT_LENGTH_OFFSET 0xFC /* Length byte in FHFT */ +#define E1000_FHFT_LENGTH_MASK 0x0FF /* Length in lower byte */ /* Each Flexible Filter is at most 128 (0x80) bytes in length */ -#define E1000_FLEXIBLE_FILTER_SIZE_MAX 128 +#define E1000_FLEXIBLE_FILTER_SIZE_MAX 128 -#define E1000_FFLT_SIZE E1000_FLEXIBLE_FILTER_COUNT_MAX -#define E1000_FFLT_SIZE_6 E1000_FLEXIBLE_FILTER_COUNT_MAX_6 -#define E1000_FFLT_SIZE_8 E1000_FLEXIBLE_FILTER_COUNT_MAX_8 -#define E1000_FFMT_SIZE E1000_FLEXIBLE_FILTER_SIZE_MAX -#define E1000_FFVT_SIZE E1000_FLEXIBLE_FILTER_SIZE_MAX +#define E1000_FFLT_SIZE E1000_FLEXIBLE_FILTER_COUNT_MAX +#define E1000_FFLT_SIZE_6 E1000_FLEXIBLE_FILTER_COUNT_MAX_6 +#define E1000_FFLT_SIZE_8 E1000_FLEXIBLE_FILTER_COUNT_MAX_8 +#define E1000_FFMT_SIZE E1000_FLEXIBLE_FILTER_SIZE_MAX +#define E1000_FFVT_SIZE E1000_FLEXIBLE_FILTER_SIZE_MAX /* Extended Device Control */ -#define E1000_CTRL_EXT_GPI0_EN 0x00000001 /* Maps SDP4 to GPI0 */ -#define E1000_CTRL_EXT_GPI1_EN 0x00000002 /* Maps SDP5 to GPI1 */ -#define E1000_CTRL_EXT_PHYINT_EN E1000_CTRL_EXT_GPI1_EN -#define E1000_CTRL_EXT_GPI2_EN 0x00000004 /* Maps SDP6 to GPI2 */ -#define E1000_CTRL_EXT_GPI3_EN 0x00000008 /* Maps SDP7 to GPI3 */ +#define E1000_CTRL_EXT_GPI0_EN 0x00000001 /* Maps SDP4 to GPI0 */ +#define E1000_CTRL_EXT_GPI1_EN 0x00000002 /* Maps SDP5 to GPI1 */ +#define E1000_CTRL_EXT_PHYINT_EN E1000_CTRL_EXT_GPI1_EN +#define E1000_CTRL_EXT_GPI2_EN 0x00000004 /* Maps SDP6 to GPI2 */ +#define E1000_CTRL_EXT_GPI3_EN 0x00000008 /* Maps SDP7 to GPI3 */ /* Reserved (bits 4,5) in >= 82575 */ -#define E1000_CTRL_EXT_SDP4_DATA 0x00000010 /* Value of SW Definable Pin 4 */ -#define E1000_CTRL_EXT_SDP5_DATA 0x00000020 /* Value of SW Definable Pin 5 */ -#define E1000_CTRL_EXT_PHY_INT E1000_CTRL_EXT_SDP5_DATA -#define E1000_CTRL_EXT_SDP6_DATA 0x00000040 /* Value of SW Definable Pin 6 */ -#define E1000_CTRL_EXT_SDP3_DATA 0x00000080 /* Value of SW Definable Pin 3 */ +#define E1000_CTRL_EXT_SDP4_DATA 0x00000010 /* SW Definable Pin 4 data */ +#define E1000_CTRL_EXT_SDP5_DATA 0x00000020 /* SW Definable Pin 5 data */ +#define E1000_CTRL_EXT_PHY_INT E1000_CTRL_EXT_SDP5_DATA +#define E1000_CTRL_EXT_SDP6_DATA 0x00000040 /* SW Definable Pin 6 data */ +#define E1000_CTRL_EXT_SDP3_DATA 0x00000080 /* SW Definable Pin 3 data */ /* SDP 4/5 (bits 8,9) are reserved in >= 82575 */ -#define E1000_CTRL_EXT_SDP4_DIR 0x00000100 /* Direction of SDP4 0=in 1=out */ -#define E1000_CTRL_EXT_SDP5_DIR 0x00000200 /* Direction of SDP5 0=in 1=out */ -#define E1000_CTRL_EXT_SDP6_DIR 0x00000400 /* Direction of SDP6 0=in 1=out */ -#define E1000_CTRL_EXT_SDP3_DIR 0x00000800 /* Direction of SDP3 0=in 1=out */ -#define E1000_CTRL_EXT_ASDCHK 0x00001000 /* Initiate an ASD sequence */ -#define E1000_CTRL_EXT_EE_RST 0x00002000 /* Reinitialize from EEPROM */ -#define E1000_CTRL_EXT_IPS 0x00004000 /* Invert Power State */ +#define E1000_CTRL_EXT_SDP4_DIR 0x00000100 /* Direction of SDP4 0=in 1=out */ +#define E1000_CTRL_EXT_SDP5_DIR 0x00000200 /* Direction of SDP5 0=in 1=out */ +#define E1000_CTRL_EXT_SDP6_DIR 0x00000400 /* Direction of SDP6 0=in 1=out */ +#define E1000_CTRL_EXT_SDP3_DIR 0x00000800 /* Direction of SDP3 0=in 1=out */ +#define E1000_CTRL_EXT_ASDCHK 0x00001000 /* Initiate an ASD sequence */ +#define E1000_CTRL_EXT_EE_RST 0x00002000 /* Reinitialize from EEPROM */ +#define E1000_CTRL_EXT_IPS 0x00004000 /* Invert Power State */ /* Physical Func Reset Done Indication */ -#define E1000_CTRL_EXT_PFRSTD 0x00004000 -#define E1000_CTRL_EXT_SPD_BYPS 0x00008000 /* Speed Select Bypass */ -#define E1000_CTRL_EXT_RO_DIS 0x00020000 /* Relaxed Ordering disable */ -#define E1000_CTRL_EXT_DMA_DYN_CLK_EN 0x00080000 /* DMA Dynamic Clock Gating */ -#define E1000_CTRL_EXT_LINK_MODE_MASK 0x00C00000 -#define E1000_CTRL_EXT_LINK_MODE_82580_MASK 0x01C00000 /*82580 bit 24:22*/ -#define E1000_CTRL_EXT_LINK_MODE_1000BASE_KX 0x00400000 -#define E1000_CTRL_EXT_LINK_MODE_GMII 0x00000000 -#define E1000_CTRL_EXT_LINK_MODE_TBI 0x00C00000 -#define E1000_CTRL_EXT_LINK_MODE_KMRN 0x00000000 -#define E1000_CTRL_EXT_LINK_MODE_PCIE_SERDES 0x00C00000 -#define E1000_CTRL_EXT_LINK_MODE_PCIX_SERDES 0x00800000 -#define E1000_CTRL_EXT_LINK_MODE_SGMII 0x00800000 -#define E1000_CTRL_EXT_EIAME 0x01000000 -#define E1000_CTRL_EXT_IRCA 0x00000001 -#define E1000_CTRL_EXT_WR_WMARK_MASK 0x03000000 -#define E1000_CTRL_EXT_WR_WMARK_256 0x00000000 -#define E1000_CTRL_EXT_WR_WMARK_320 0x01000000 -#define E1000_CTRL_EXT_WR_WMARK_384 0x02000000 -#define E1000_CTRL_EXT_WR_WMARK_448 0x03000000 -#define E1000_CTRL_EXT_CANC 0x04000000 /* Int delay cancellation */ -#define E1000_CTRL_EXT_DRV_LOAD 0x10000000 /* Driver loaded bit for FW */ +#define E1000_CTRL_EXT_PFRSTD 0x00004000 +#define E1000_CTRL_EXT_SPD_BYPS 0x00008000 /* Speed Select Bypass */ +#define E1000_CTRL_EXT_RO_DIS 0x00020000 /* Relaxed Ordering disable */ +#define E1000_CTRL_EXT_DMA_DYN_CLK_EN 0x00080000 /* DMA Dynamic Clk Gating */ +#define E1000_CTRL_EXT_LINK_MODE_MASK 0x00C00000 +/* Offset of the link mode field in Ctrl Ext register */ +#define E1000_CTRL_EXT_LINK_MODE_OFFSET 22 +#define E1000_CTRL_EXT_LINK_MODE_82580_MASK 0x01C00000 /*82580 bit 24:22*/ +#define E1000_CTRL_EXT_LINK_MODE_1000BASE_KX 0x00400000 +#define E1000_CTRL_EXT_LINK_MODE_GMII 0x00000000 +#define E1000_CTRL_EXT_LINK_MODE_TBI 0x00C00000 +#define E1000_CTRL_EXT_LINK_MODE_KMRN 0x00000000 +#define E1000_CTRL_EXT_LINK_MODE_PCIE_SERDES 0x00C00000 +#define E1000_CTRL_EXT_LINK_MODE_PCIX_SERDES 0x00800000 +#define E1000_CTRL_EXT_LINK_MODE_SGMII 0x00800000 +#define E1000_CTRL_EXT_EIAME 0x01000000 +#define E1000_CTRL_EXT_IRCA 0x00000001 +#define E1000_CTRL_EXT_WR_WMARK_MASK 0x03000000 +#define E1000_CTRL_EXT_WR_WMARK_256 0x00000000 +#define E1000_CTRL_EXT_WR_WMARK_320 0x01000000 +#define E1000_CTRL_EXT_WR_WMARK_384 0x02000000 +#define E1000_CTRL_EXT_WR_WMARK_448 0x03000000 +#define E1000_CTRL_EXT_CANC 0x04000000 /* Int delay cancellation */ +#define E1000_CTRL_EXT_DRV_LOAD 0x10000000 /* Drv loaded bit for FW */ /* IAME enable bit (27) was removed in >= 82575 */ -#define E1000_CTRL_EXT_IAME 0x08000000 /* Int acknowledge Auto-mask */ -#define E1000_CRTL_EXT_PB_PAREN 0x01000000 /* packet buffer parity error - * detection enabled */ -#define E1000_CTRL_EXT_DF_PAREN 0x02000000 /* descriptor FIFO parity - * error detection enable */ -#define E1000_CTRL_EXT_GHOST_PAREN 0x40000000 -#define E1000_CTRL_EXT_PBA_CLR 0x80000000 /* PBA Clear */ -#define E1000_CTRL_EXT_LSECCK 0x00001000 -#define E1000_CTRL_EXT_PHYPDEN 0x00100000 -#define E1000_I2CCMD_REG_ADDR_SHIFT 16 -#define E1000_I2CCMD_REG_ADDR 0x00FF0000 -#define E1000_I2CCMD_PHY_ADDR_SHIFT 24 -#define E1000_I2CCMD_PHY_ADDR 0x07000000 -#define E1000_I2CCMD_OPCODE_READ 0x08000000 -#define E1000_I2CCMD_OPCODE_WRITE 0x00000000 -#define E1000_I2CCMD_RESET 0x10000000 -#define E1000_I2CCMD_READY 0x20000000 -#define E1000_I2CCMD_INTERRUPT_ENA 0x40000000 -#define E1000_I2CCMD_ERROR 0x80000000 -#define E1000_MAX_SGMII_PHY_REG_ADDR 255 -#define E1000_I2CCMD_PHY_TIMEOUT 200 -#define E1000_IVAR_VALID 0x80 -#define E1000_GPIE_NSICR 0x00000001 -#define E1000_GPIE_MSIX_MODE 0x00000010 -#define E1000_GPIE_EIAME 0x40000000 -#define E1000_GPIE_PBA 0x80000000 +#define E1000_CTRL_EXT_IAME 0x08000000 /* Int ACK Auto-mask */ +/* packet buffer parity error detection enabled */ +#define E1000_CRTL_EXT_PB_PAREN 0x01000000 +/* descriptor FIFO parity error detection enable */ +#define E1000_CTRL_EXT_DF_PAREN 0x02000000 +#define E1000_CTRL_EXT_GHOST_PAREN 0x40000000 +#define E1000_CTRL_EXT_PBA_CLR 0x80000000 /* PBA Clear */ +#define E1000_CTRL_EXT_LSECCK 0x00001000 +#define E1000_CTRL_EXT_PHYPDEN 0x00100000 +#define E1000_I2CCMD_REG_ADDR_SHIFT 16 +#define E1000_I2CCMD_REG_ADDR 0x00FF0000 +#define E1000_I2CCMD_PHY_ADDR_SHIFT 24 +#define E1000_I2CCMD_PHY_ADDR 0x07000000 +#define E1000_I2CCMD_OPCODE_READ 0x08000000 +#define E1000_I2CCMD_OPCODE_WRITE 0x00000000 +#define E1000_I2CCMD_RESET 0x10000000 +#define E1000_I2CCMD_READY 0x20000000 +#define E1000_I2CCMD_INTERRUPT_ENA 0x40000000 +#define E1000_I2CCMD_ERROR 0x80000000 +#define E1000_I2CCMD_SFP_DATA_ADDR(a) (0x0000 + (a)) +#define E1000_I2CCMD_SFP_DIAG_ADDR(a) (0x0100 + (a)) +#define E1000_MAX_SGMII_PHY_REG_ADDR 255 +#define E1000_I2CCMD_PHY_TIMEOUT 200 +#define E1000_IVAR_VALID 0x80 +#define E1000_GPIE_NSICR 0x00000001 +#define E1000_GPIE_MSIX_MODE 0x00000010 +#define E1000_GPIE_EIAME 0x40000000 +#define E1000_GPIE_PBA 0x80000000 /* Receive Descriptor bit definitions */ -#define E1000_RXD_STAT_DD 0x01 /* Descriptor Done */ -#define E1000_RXD_STAT_EOP 0x02 /* End of Packet */ -#define E1000_RXD_STAT_IXSM 0x04 /* Ignore checksum */ -#define E1000_RXD_STAT_VP 0x08 /* IEEE VLAN Packet */ -#define E1000_RXD_STAT_UDPCS 0x10 /* UDP xsum calculated */ -#define E1000_RXD_STAT_TCPCS 0x20 /* TCP xsum calculated */ -#define E1000_RXD_STAT_IPCS 0x40 /* IP xsum calculated */ -#define E1000_RXD_STAT_PIF 0x80 /* passed in-exact filter */ -#define E1000_RXD_STAT_CRCV 0x100 /* Speculative CRC Valid */ -#define E1000_RXD_STAT_IPIDV 0x200 /* IP identification valid */ -#define E1000_RXD_STAT_UDPV 0x400 /* Valid UDP checksum */ -#define E1000_RXD_STAT_DYNINT 0x800 /* Pkt caused INT via DYNINT */ -#define E1000_RXD_STAT_ACK 0x8000 /* ACK Packet indication */ -#define E1000_RXD_ERR_CE 0x01 /* CRC Error */ -#define E1000_RXD_ERR_SE 0x02 /* Symbol Error */ -#define E1000_RXD_ERR_SEQ 0x04 /* Sequence Error */ -#define E1000_RXD_ERR_CXE 0x10 /* Carrier Extension Error */ -#define E1000_RXD_ERR_TCPE 0x20 /* TCP/UDP Checksum Error */ -#define E1000_RXD_ERR_IPE 0x40 /* IP Checksum Error */ -#define E1000_RXD_ERR_RXE 0x80 /* Rx Data Error */ -#define E1000_RXD_SPC_VLAN_MASK 0x0FFF /* VLAN ID is in lower 12 bits */ -#define E1000_RXD_SPC_PRI_MASK 0xE000 /* Priority is in upper 3 bits */ -#define E1000_RXD_SPC_PRI_SHIFT 13 -#define E1000_RXD_SPC_CFI_MASK 0x1000 /* CFI is bit 12 */ -#define E1000_RXD_SPC_CFI_SHIFT 12 +#define E1000_RXD_STAT_DD 0x01 /* Descriptor Done */ +#define E1000_RXD_STAT_EOP 0x02 /* End of Packet */ +#define E1000_RXD_STAT_IXSM 0x04 /* Ignore checksum */ +#define E1000_RXD_STAT_VP 0x08 /* IEEE VLAN Packet */ +#define E1000_RXD_STAT_UDPCS 0x10 /* UDP xsum calculated */ +#define E1000_RXD_STAT_TCPCS 0x20 /* TCP xsum calculated */ +#define E1000_RXD_STAT_IPCS 0x40 /* IP xsum calculated */ +#define E1000_RXD_STAT_PIF 0x80 /* passed in-exact filter */ +#define E1000_RXD_STAT_CRCV 0x100 /* Speculative CRC Valid */ +#define E1000_RXD_STAT_IPIDV 0x200 /* IP identification valid */ +#define E1000_RXD_STAT_UDPV 0x400 /* Valid UDP checksum */ +#define E1000_RXD_STAT_DYNINT 0x800 /* Pkt caused INT via DYNINT */ +#define E1000_RXD_STAT_ACK 0x8000 /* ACK Packet indication */ +#define E1000_RXD_ERR_CE 0x01 /* CRC Error */ +#define E1000_RXD_ERR_SE 0x02 /* Symbol Error */ +#define E1000_RXD_ERR_SEQ 0x04 /* Sequence Error */ +#define E1000_RXD_ERR_CXE 0x10 /* Carrier Extension Error */ +#define E1000_RXD_ERR_TCPE 0x20 /* TCP/UDP Checksum Error */ +#define E1000_RXD_ERR_IPE 0x40 /* IP Checksum Error */ +#define E1000_RXD_ERR_RXE 0x80 /* Rx Data Error */ +#define E1000_RXD_SPC_VLAN_MASK 0x0FFF /* VLAN ID is in lower 12 bits */ +#define E1000_RXD_SPC_PRI_MASK 0xE000 /* Priority is in upper 3 bits */ +#define E1000_RXD_SPC_PRI_SHIFT 13 +#define E1000_RXD_SPC_CFI_MASK 0x1000 /* CFI is bit 12 */ +#define E1000_RXD_SPC_CFI_SHIFT 12 -#define E1000_RXDEXT_STATERR_LB 0x00040000 -#define E1000_RXDEXT_STATERR_CE 0x01000000 -#define E1000_RXDEXT_STATERR_SE 0x02000000 -#define E1000_RXDEXT_STATERR_SEQ 0x04000000 -#define E1000_RXDEXT_STATERR_CXE 0x10000000 -#define E1000_RXDEXT_STATERR_TCPE 0x20000000 -#define E1000_RXDEXT_STATERR_IPE 0x40000000 -#define E1000_RXDEXT_STATERR_RXE 0x80000000 +#define E1000_RXDEXT_STATERR_LB 0x00040000 +#define E1000_RXDEXT_STATERR_CE 0x01000000 +#define E1000_RXDEXT_STATERR_SE 0x02000000 +#define E1000_RXDEXT_STATERR_SEQ 0x04000000 +#define E1000_RXDEXT_STATERR_CXE 0x10000000 +#define E1000_RXDEXT_STATERR_TCPE 0x20000000 +#define E1000_RXDEXT_STATERR_IPE 0x40000000 +#define E1000_RXDEXT_STATERR_RXE 0x80000000 -#define E1000_RXDEXT_LSECH 0x01000000 -#define E1000_RXDEXT_LSECE_MASK 0x60000000 -#define E1000_RXDEXT_LSECE_NO_ERROR 0x00000000 -#define E1000_RXDEXT_LSECE_NO_SA_MATCH 0x20000000 -#define E1000_RXDEXT_LSECE_REPLAY_DETECT 0x40000000 -#define E1000_RXDEXT_LSECE_BAD_SIG 0x60000000 +#define E1000_RXDEXT_LSECH 0x01000000 +#define E1000_RXDEXT_LSECE_MASK 0x60000000 +#define E1000_RXDEXT_LSECE_NO_ERROR 0x00000000 +#define E1000_RXDEXT_LSECE_NO_SA_MATCH 0x20000000 +#define E1000_RXDEXT_LSECE_REPLAY_DETECT 0x40000000 +#define E1000_RXDEXT_LSECE_BAD_SIG 0x60000000 /* mask to determine if packets should be dropped due to frame errors */ #define E1000_RXD_ERR_FRAME_ERR_MASK ( \ - E1000_RXD_ERR_CE | \ - E1000_RXD_ERR_SE | \ - E1000_RXD_ERR_SEQ | \ - E1000_RXD_ERR_CXE | \ - E1000_RXD_ERR_RXE) + E1000_RXD_ERR_CE | \ + E1000_RXD_ERR_SE | \ + E1000_RXD_ERR_SEQ | \ + E1000_RXD_ERR_CXE | \ + E1000_RXD_ERR_RXE) /* Same mask, but for extended and packet split descriptors */ #define E1000_RXDEXT_ERR_FRAME_ERR_MASK ( \ - E1000_RXDEXT_STATERR_CE | \ - E1000_RXDEXT_STATERR_SE | \ - E1000_RXDEXT_STATERR_SEQ | \ - E1000_RXDEXT_STATERR_CXE | \ - E1000_RXDEXT_STATERR_RXE) + E1000_RXDEXT_STATERR_CE | \ + E1000_RXDEXT_STATERR_SE | \ + E1000_RXDEXT_STATERR_SEQ | \ + E1000_RXDEXT_STATERR_CXE | \ + E1000_RXDEXT_STATERR_RXE) -#define E1000_MRQC_ENABLE_MASK 0x00000007 -#define E1000_MRQC_ENABLE_RSS_2Q 0x00000001 -#define E1000_MRQC_ENABLE_RSS_INT 0x00000004 -#define E1000_MRQC_RSS_FIELD_MASK 0xFFFF0000 -#define E1000_MRQC_RSS_FIELD_IPV4_TCP 0x00010000 -#define E1000_MRQC_RSS_FIELD_IPV4 0x00020000 -#define E1000_MRQC_RSS_FIELD_IPV6_TCP_EX 0x00040000 -#define E1000_MRQC_RSS_FIELD_IPV6_EX 0x00080000 -#define E1000_MRQC_RSS_FIELD_IPV6 0x00100000 -#define E1000_MRQC_RSS_FIELD_IPV6_TCP 0x00200000 +#define E1000_MRQC_ENABLE_MASK 0x00000007 +#define E1000_MRQC_ENABLE_RSS_2Q 0x00000001 +#define E1000_MRQC_ENABLE_RSS_INT 0x00000004 +#define E1000_MRQC_RSS_FIELD_MASK 0xFFFF0000 +#define E1000_MRQC_RSS_FIELD_IPV4_TCP 0x00010000 +#define E1000_MRQC_RSS_FIELD_IPV4 0x00020000 +#define E1000_MRQC_RSS_FIELD_IPV6_TCP_EX 0x00040000 +#define E1000_MRQC_RSS_FIELD_IPV6_EX 0x00080000 +#define E1000_MRQC_RSS_FIELD_IPV6 0x00100000 +#define E1000_MRQC_RSS_FIELD_IPV6_TCP 0x00200000 -#define E1000_RXDPS_HDRSTAT_HDRSP 0x00008000 -#define E1000_RXDPS_HDRSTAT_HDRLEN_MASK 0x000003FF +#define E1000_RXDPS_HDRSTAT_HDRSP 0x00008000 +#define E1000_RXDPS_HDRSTAT_HDRLEN_MASK 0x000003FF /* Management Control */ -#define E1000_MANC_SMBUS_EN 0x00000001 /* SMBus Enabled - RO */ -#define E1000_MANC_ASF_EN 0x00000002 /* ASF Enabled - RO */ -#define E1000_MANC_R_ON_FORCE 0x00000004 /* Reset on Force TCO - RO */ -#define E1000_MANC_RMCP_EN 0x00000100 /* Enable RCMP 026Fh Filtering */ -#define E1000_MANC_0298_EN 0x00000200 /* Enable RCMP 0298h Filtering */ -#define E1000_MANC_IPV4_EN 0x00000400 /* Enable IPv4 */ -#define E1000_MANC_IPV6_EN 0x00000800 /* Enable IPv6 */ -#define E1000_MANC_SNAP_EN 0x00001000 /* Accept LLC/SNAP */ -#define E1000_MANC_ARP_EN 0x00002000 /* Enable ARP Request Filtering */ +#define E1000_MANC_SMBUS_EN 0x00000001 /* SMBus Enabled - RO */ +#define E1000_MANC_ASF_EN 0x00000002 /* ASF Enabled - RO */ +#define E1000_MANC_R_ON_FORCE 0x00000004 /* Reset on Force TCO - RO */ +#define E1000_MANC_RMCP_EN 0x00000100 /* Enable RCMP 026Fh Filtering */ +#define E1000_MANC_0298_EN 0x00000200 /* Enable RCMP 0298h Filtering */ +#define E1000_MANC_IPV4_EN 0x00000400 /* Enable IPv4 */ +#define E1000_MANC_IPV6_EN 0x00000800 /* Enable IPv6 */ +#define E1000_MANC_SNAP_EN 0x00001000 /* Accept LLC/SNAP */ +#define E1000_MANC_ARP_EN 0x00002000 /* Enable ARP Request Filtering */ /* Enable Neighbor Discovery Filtering */ -#define E1000_MANC_NEIGHBOR_EN 0x00004000 -#define E1000_MANC_ARP_RES_EN 0x00008000 /* Enable ARP response Filtering */ -#define E1000_MANC_TCO_RESET 0x00010000 /* TCO Reset Occurred */ -#define E1000_MANC_RCV_TCO_EN 0x00020000 /* Receive TCO Packets Enabled */ +#define E1000_MANC_NEIGHBOR_EN 0x00004000 +#define E1000_MANC_ARP_RES_EN 0x00008000 /* Enable ARP response Filtering */ +#define E1000_MANC_TCO_RESET 0x00010000 /* TCO Reset Occurred */ +#define E1000_MANC_RCV_TCO_EN 0x00020000 /* Receive TCO Packets Enabled */ #define E1000_MANC_REPORT_STATUS 0x00040000 /* Status Reporting Enabled */ -#define E1000_MANC_RCV_ALL 0x00080000 /* Receive All Enabled */ -#define E1000_MANC_BLK_PHY_RST_ON_IDE 0x00040000 /* Block phy resets */ +#define E1000_MANC_RCV_ALL 0x00080000 /* Receive All Enabled */ +#define E1000_MANC_BLK_PHY_RST_ON_IDE 0x00040000 /* Block phy resets */ /* Enable MAC address filtering */ -#define E1000_MANC_EN_MAC_ADDR_FILTER 0x00100000 +#define E1000_MANC_EN_MAC_ADDR_FILTER 0x00100000 /* Enable MNG packets to host memory */ -#define E1000_MANC_EN_MNG2HOST 0x00200000 +#define E1000_MANC_EN_MNG2HOST 0x00200000 /* Enable IP address filtering */ -#define E1000_MANC_EN_IP_ADDR_FILTER 0x00400000 -#define E1000_MANC_EN_XSUM_FILTER 0x00800000 /* Enable checksum filtering */ -#define E1000_MANC_BR_EN 0x01000000 /* Enable broadcast filtering */ -#define E1000_MANC_SMB_REQ 0x01000000 /* SMBus Request */ -#define E1000_MANC_SMB_GNT 0x02000000 /* SMBus Grant */ -#define E1000_MANC_SMB_CLK_IN 0x04000000 /* SMBus Clock In */ -#define E1000_MANC_SMB_DATA_IN 0x08000000 /* SMBus Data In */ -#define E1000_MANC_SMB_DATA_OUT 0x10000000 /* SMBus Data Out */ -#define E1000_MANC_SMB_CLK_OUT 0x20000000 /* SMBus Clock Out */ -#define E1000_MANC_MPROXYE 0x40000000 /* Mngment Proxy Enable */ -#define E1000_MANC_EN_BMC2OS 0x10000000 /* OS2BMC is enabled or not */ +#define E1000_MANC_EN_IP_ADDR_FILTER 0x00400000 +#define E1000_MANC_EN_XSUM_FILTER 0x00800000 /* Ena checksum filtering */ +#define E1000_MANC_BR_EN 0x01000000 /* Ena broadcast filtering */ +#define E1000_MANC_SMB_REQ 0x01000000 /* SMBus Request */ +#define E1000_MANC_SMB_GNT 0x02000000 /* SMBus Grant */ +#define E1000_MANC_SMB_CLK_IN 0x04000000 /* SMBus Clock In */ +#define E1000_MANC_SMB_DATA_IN 0x08000000 /* SMBus Data In */ +#define E1000_MANC_SMB_DATA_OUT 0x10000000 /* SMBus Data Out */ +#define E1000_MANC_SMB_CLK_OUT 0x20000000 /* SMBus Clock Out */ +#define E1000_MANC_MPROXYE 0x40000000 /* Mngment Proxy Enable */ +#define E1000_MANC_EN_BMC2OS 0x10000000 /* OS2BMC is enabld or not */ -#define E1000_MANC_SMB_DATA_OUT_SHIFT 28 /* SMBus Data Out Shift */ -#define E1000_MANC_SMB_CLK_OUT_SHIFT 29 /* SMBus Clock Out Shift */ +#define E1000_MANC_SMB_DATA_OUT_SHIFT 28 /* SMBus Data Out Shift */ +#define E1000_MANC_SMB_CLK_OUT_SHIFT 29 /* SMBus Clock Out Shift */ -#define E1000_MANC2H_PORT_623 0x00000020 /* Port 0x26f */ -#define E1000_MANC2H_PORT_664 0x00000040 /* Port 0x298 */ -#define E1000_MDEF_PORT_623 0x00000800 /* Port 0x26f */ -#define E1000_MDEF_PORT_664 0x00000400 /* Port 0x298 */ +#define E1000_MANC2H_PORT_623 0x00000020 /* Port 0x26f */ +#define E1000_MANC2H_PORT_664 0x00000040 /* Port 0x298 */ +#define E1000_MDEF_PORT_623 0x00000800 /* Port 0x26f */ +#define E1000_MDEF_PORT_664 0x00000400 /* Port 0x298 */ /* Receive Control */ -#define E1000_RCTL_RST 0x00000001 /* Software reset */ -#define E1000_RCTL_EN 0x00000002 /* enable */ -#define E1000_RCTL_SBP 0x00000004 /* store bad packet */ -#define E1000_RCTL_UPE 0x00000008 /* unicast promisc enable */ -#define E1000_RCTL_MPE 0x00000010 /* multicast promisc enable */ -#define E1000_RCTL_LPE 0x00000020 /* long packet enable */ -#define E1000_RCTL_LBM_NO 0x00000000 /* no loopback mode */ -#define E1000_RCTL_LBM_MAC 0x00000040 /* MAC loopback mode */ -#define E1000_RCTL_LBM_SLP 0x00000080 /* serial link loopback mode */ -#define E1000_RCTL_LBM_TCVR 0x000000C0 /* tcvr loopback mode */ -#define E1000_RCTL_DTYP_MASK 0x00000C00 /* Descriptor type mask */ -#define E1000_RCTL_DTYP_PS 0x00000400 /* Packet Split descriptor */ -#define E1000_RCTL_RDMTS_HALF 0x00000000 /* Rx desc min thresh size */ -#define E1000_RCTL_RDMTS_QUAT 0x00000100 /* Rx desc min thresh size */ -#define E1000_RCTL_RDMTS_EIGTH 0x00000200 /* Rx desc min thresh size */ -#define E1000_RCTL_MO_SHIFT 12 /* multicast offset shift */ -#define E1000_RCTL_MO_0 0x00000000 /* multicast offset 11:0 */ -#define E1000_RCTL_MO_1 0x00001000 /* multicast offset 12:1 */ -#define E1000_RCTL_MO_2 0x00002000 /* multicast offset 13:2 */ -#define E1000_RCTL_MO_3 0x00003000 /* multicast offset 15:4 */ -#define E1000_RCTL_MDR 0x00004000 /* multicast desc ring 0 */ -#define E1000_RCTL_BAM 0x00008000 /* broadcast enable */ +#define E1000_RCTL_RST 0x00000001 /* Software reset */ +#define E1000_RCTL_EN 0x00000002 /* enable */ +#define E1000_RCTL_SBP 0x00000004 /* store bad packet */ +#define E1000_RCTL_UPE 0x00000008 /* unicast promisc enable */ +#define E1000_RCTL_MPE 0x00000010 /* multicast promisc enable */ +#define E1000_RCTL_LPE 0x00000020 /* long packet enable */ +#define E1000_RCTL_LBM_NO 0x00000000 /* no loopback mode */ +#define E1000_RCTL_LBM_MAC 0x00000040 /* MAC loopback mode */ +#define E1000_RCTL_LBM_SLP 0x00000080 /* serial link loopback mode */ +#define E1000_RCTL_LBM_TCVR 0x000000C0 /* tcvr loopback mode */ +#define E1000_RCTL_DTYP_MASK 0x00000C00 /* Descriptor type mask */ +#define E1000_RCTL_DTYP_PS 0x00000400 /* Packet Split descriptor */ +#define E1000_RCTL_RDMTS_HALF 0x00000000 /* Rx desc min thresh size */ +#define E1000_RCTL_RDMTS_QUAT 0x00000100 /* Rx desc min thresh size */ +#define E1000_RCTL_RDMTS_EIGTH 0x00000200 /* Rx desc min thresh size */ +#define E1000_RCTL_MO_SHIFT 12 /* multicast offset shift */ +#define E1000_RCTL_MO_0 0x00000000 /* multicast offset 11:0 */ +#define E1000_RCTL_MO_1 0x00001000 /* multicast offset 12:1 */ +#define E1000_RCTL_MO_2 0x00002000 /* multicast offset 13:2 */ +#define E1000_RCTL_MO_3 0x00003000 /* multicast offset 15:4 */ +#define E1000_RCTL_MDR 0x00004000 /* multicast desc ring 0 */ +#define E1000_RCTL_BAM 0x00008000 /* broadcast enable */ /* these buffer sizes are valid if E1000_RCTL_BSEX is 0 */ -#define E1000_RCTL_SZ_2048 0x00000000 /* Rx buffer size 2048 */ -#define E1000_RCTL_SZ_1024 0x00010000 /* Rx buffer size 1024 */ -#define E1000_RCTL_SZ_512 0x00020000 /* Rx buffer size 512 */ -#define E1000_RCTL_SZ_256 0x00030000 /* Rx buffer size 256 */ +#define E1000_RCTL_SZ_2048 0x00000000 /* Rx buffer size 2048 */ +#define E1000_RCTL_SZ_1024 0x00010000 /* Rx buffer size 1024 */ +#define E1000_RCTL_SZ_512 0x00020000 /* Rx buffer size 512 */ +#define E1000_RCTL_SZ_256 0x00030000 /* Rx buffer size 256 */ /* these buffer sizes are valid if E1000_RCTL_BSEX is 1 */ -#define E1000_RCTL_SZ_16384 0x00010000 /* Rx buffer size 16384 */ -#define E1000_RCTL_SZ_8192 0x00020000 /* Rx buffer size 8192 */ -#define E1000_RCTL_SZ_4096 0x00030000 /* Rx buffer size 4096 */ -#define E1000_RCTL_VFE 0x00040000 /* vlan filter enable */ -#define E1000_RCTL_CFIEN 0x00080000 /* canonical form enable */ -#define E1000_RCTL_CFI 0x00100000 /* canonical form indicator */ -#define E1000_RCTL_DPF 0x00400000 /* discard pause frames */ -#define E1000_RCTL_PMCF 0x00800000 /* pass MAC control frames */ -#define E1000_RCTL_BSEX 0x02000000 /* Buffer size extension */ -#define E1000_RCTL_SECRC 0x04000000 /* Strip Ethernet CRC */ -#define E1000_RCTL_FLXBUF_MASK 0x78000000 /* Flexible buffer size */ -#define E1000_RCTL_FLXBUF_SHIFT 27 /* Flexible buffer shift */ +#define E1000_RCTL_SZ_16384 0x00010000 /* Rx buffer size 16384 */ +#define E1000_RCTL_SZ_8192 0x00020000 /* Rx buffer size 8192 */ +#define E1000_RCTL_SZ_4096 0x00030000 /* Rx buffer size 4096 */ +#define E1000_RCTL_VFE 0x00040000 /* vlan filter enable */ +#define E1000_RCTL_CFIEN 0x00080000 /* canonical form enable */ +#define E1000_RCTL_CFI 0x00100000 /* canonical form indicator */ +#define E1000_RCTL_DPF 0x00400000 /* discard pause frames */ +#define E1000_RCTL_PMCF 0x00800000 /* pass MAC control frames */ +#define E1000_RCTL_BSEX 0x02000000 /* Buffer size extension */ +#define E1000_RCTL_SECRC 0x04000000 /* Strip Ethernet CRC */ +#define E1000_RCTL_FLXBUF_MASK 0x78000000 /* Flexible buffer size */ +#define E1000_RCTL_FLXBUF_SHIFT 27 /* Flexible buffer shift */ /* * Use byte values for the following shift parameters * Usage: * psrctl |= (((ROUNDUP(value0, 128) >> E1000_PSRCTL_BSIZE0_SHIFT) & - * E1000_PSRCTL_BSIZE0_MASK) | - * ((ROUNDUP(value1, 1024) >> E1000_PSRCTL_BSIZE1_SHIFT) & - * E1000_PSRCTL_BSIZE1_MASK) | - * ((ROUNDUP(value2, 1024) << E1000_PSRCTL_BSIZE2_SHIFT) & - * E1000_PSRCTL_BSIZE2_MASK) | - * ((ROUNDUP(value3, 1024) << E1000_PSRCTL_BSIZE3_SHIFT) |; - * E1000_PSRCTL_BSIZE3_MASK)) + * E1000_PSRCTL_BSIZE0_MASK) | + * ((ROUNDUP(value1, 1024) >> E1000_PSRCTL_BSIZE1_SHIFT) & + * E1000_PSRCTL_BSIZE1_MASK) | + * ((ROUNDUP(value2, 1024) << E1000_PSRCTL_BSIZE2_SHIFT) & + * E1000_PSRCTL_BSIZE2_MASK) | + * ((ROUNDUP(value3, 1024) << E1000_PSRCTL_BSIZE3_SHIFT) |; + * E1000_PSRCTL_BSIZE3_MASK)) * where value0 = [128..16256], default=256 * value1 = [1024..64512], default=4096 * value2 = [0..64512], default=4096 * value3 = [0..64512], default=0 */ -#define E1000_PSRCTL_BSIZE0_MASK 0x0000007F -#define E1000_PSRCTL_BSIZE1_MASK 0x00003F00 -#define E1000_PSRCTL_BSIZE2_MASK 0x003F0000 -#define E1000_PSRCTL_BSIZE3_MASK 0x3F000000 +#define E1000_PSRCTL_BSIZE0_MASK 0x0000007F +#define E1000_PSRCTL_BSIZE1_MASK 0x00003F00 +#define E1000_PSRCTL_BSIZE2_MASK 0x003F0000 +#define E1000_PSRCTL_BSIZE3_MASK 0x3F000000 -#define E1000_PSRCTL_BSIZE0_SHIFT 7 /* Shift _right_ 7 */ -#define E1000_PSRCTL_BSIZE1_SHIFT 2 /* Shift _right_ 2 */ -#define E1000_PSRCTL_BSIZE2_SHIFT 6 /* Shift _left_ 6 */ -#define E1000_PSRCTL_BSIZE3_SHIFT 14 /* Shift _left_ 14 */ +#define E1000_PSRCTL_BSIZE0_SHIFT 7 /* Shift _right_ 7 */ +#define E1000_PSRCTL_BSIZE1_SHIFT 2 /* Shift _right_ 2 */ +#define E1000_PSRCTL_BSIZE2_SHIFT 6 /* Shift _left_ 6 */ +#define E1000_PSRCTL_BSIZE3_SHIFT 14 /* Shift _left_ 14 */ /* SWFW_SYNC Definitions */ -#define E1000_SWFW_EEP_SM 0x01 -#define E1000_SWFW_PHY0_SM 0x02 -#define E1000_SWFW_PHY1_SM 0x04 -#define E1000_SWFW_CSR_SM 0x08 -#define E1000_SWFW_PHY2_SM 0x20 -#define E1000_SWFW_PHY3_SM 0x40 -#define E1000_SWFW_SW_MNG_SM 0x400 +#define E1000_SWFW_EEP_SM 0x01 +#define E1000_SWFW_PHY0_SM 0x02 +#define E1000_SWFW_PHY1_SM 0x04 +#define E1000_SWFW_CSR_SM 0x08 +#define E1000_SWFW_PHY2_SM 0x20 +#define E1000_SWFW_PHY3_SM 0x40 +#define E1000_SWFW_SW_MNG_SM 0x400 /* FACTPS Definitions */ -#define E1000_FACTPS_LFS 0x40000000 /* LAN Function Select */ +#define E1000_FACTPS_LFS 0x40000000 /* LAN Function Select */ /* Device Control */ -#define E1000_CTRL_FD 0x00000001 /* Full duplex.0=half; 1=full */ -#define E1000_CTRL_BEM 0x00000002 /* Endian Mode.0=little,1=big */ -#define E1000_CTRL_PRIOR 0x00000004 /* Priority on PCI. 0=rx,1=fair */ +#define E1000_CTRL_FD 0x00000001 /* Full duplex.0=half; 1=full */ +#define E1000_CTRL_BEM 0x00000002 /* Endian Mode.0=little,1=big */ +#define E1000_CTRL_PRIOR 0x00000004 /* Priority on PCI. 0=rx,1=fair */ #define E1000_CTRL_GIO_MASTER_DISABLE 0x00000004 /*Blocks new Master reqs */ -#define E1000_CTRL_LRST 0x00000008 /* Link reset. 0=normal,1=reset */ -#define E1000_CTRL_TME 0x00000010 /* Test mode. 0=normal,1=test */ -#define E1000_CTRL_SLE 0x00000020 /* Serial Link on 0=dis,1=en */ -#define E1000_CTRL_ASDE 0x00000020 /* Auto-speed detect enable */ -#define E1000_CTRL_SLU 0x00000040 /* Set link up (Force Link) */ -#define E1000_CTRL_ILOS 0x00000080 /* Invert Loss-Of Signal */ -#define E1000_CTRL_SPD_SEL 0x00000300 /* Speed Select Mask */ -#define E1000_CTRL_SPD_10 0x00000000 /* Force 10Mb */ -#define E1000_CTRL_SPD_100 0x00000100 /* Force 100Mb */ -#define E1000_CTRL_SPD_1000 0x00000200 /* Force 1Gb */ -#define E1000_CTRL_BEM32 0x00000400 /* Big Endian 32 mode */ -#define E1000_CTRL_FRCSPD 0x00000800 /* Force Speed */ -#define E1000_CTRL_FRCDPX 0x00001000 /* Force Duplex */ -#define E1000_CTRL_D_UD_EN 0x00002000 /* Dock/Undock enable */ -#define E1000_CTRL_D_UD_POLARITY 0x00004000 /* Defined polarity of Dock/Undock - * indication in SDP[0] */ -#define E1000_CTRL_FORCE_PHY_RESET 0x00008000 /* Reset both PHY ports, through - * PHYRST_N pin */ -#define E1000_CTRL_EXT_LINK_EN 0x00010000 /* enable link status from external - * LINK_0 and LINK_1 pins */ -#define E1000_CTRL_LANPHYPC_OVERRIDE 0x00010000 /* SW control of LANPHYPC */ -#define E1000_CTRL_LANPHYPC_VALUE 0x00020000 /* SW value of LANPHYPC */ -#define E1000_CTRL_SWDPIN0 0x00040000 /* SWDPIN 0 value */ -#define E1000_CTRL_SWDPIN1 0x00080000 /* SWDPIN 1 value */ -#define E1000_CTRL_SWDPIN2 0x00100000 /* SWDPIN 2 value */ -#define E1000_CTRL_ADVD3WUC 0x00100000 /* D3 WUC */ -#define E1000_CTRL_SWDPIN3 0x00200000 /* SWDPIN 3 value */ -#define E1000_CTRL_SWDPIO0 0x00400000 /* SWDPIN 0 Input or output */ -#define E1000_CTRL_SWDPIO1 0x00800000 /* SWDPIN 1 input or output */ -#define E1000_CTRL_SWDPIO2 0x01000000 /* SWDPIN 2 input or output */ -#define E1000_CTRL_SWDPIO3 0x02000000 /* SWDPIN 3 input or output */ -#define E1000_CTRL_RST 0x04000000 /* Global reset */ -#define E1000_CTRL_RFCE 0x08000000 /* Receive Flow Control enable */ -#define E1000_CTRL_TFCE 0x10000000 /* Transmit flow control enable */ -#define E1000_CTRL_RTE 0x20000000 /* Routing tag enable */ -#define E1000_CTRL_VME 0x40000000 /* IEEE VLAN mode enable */ -#define E1000_CTRL_PHY_RST 0x80000000 /* PHY Reset */ -#define E1000_CTRL_SW2FW_INT 0x02000000 /* Initiate an interrupt to ME */ -#define E1000_CTRL_I2C_ENA 0x02000000 /* I2C enable */ +#define E1000_CTRL_LRST 0x00000008 /* Link reset. 0=normal,1=reset */ +#define E1000_CTRL_TME 0x00000010 /* Test mode. 0=normal,1=test */ +#define E1000_CTRL_SLE 0x00000020 /* Serial Link on 0=dis,1=en */ +#define E1000_CTRL_ASDE 0x00000020 /* Auto-speed detect enable */ +#define E1000_CTRL_SLU 0x00000040 /* Set link up (Force Link) */ +#define E1000_CTRL_ILOS 0x00000080 /* Invert Loss-Of Signal */ +#define E1000_CTRL_SPD_SEL 0x00000300 /* Speed Select Mask */ +#define E1000_CTRL_SPD_10 0x00000000 /* Force 10Mb */ +#define E1000_CTRL_SPD_100 0x00000100 /* Force 100Mb */ +#define E1000_CTRL_SPD_1000 0x00000200 /* Force 1Gb */ +#define E1000_CTRL_BEM32 0x00000400 /* Big Endian 32 mode */ +#define E1000_CTRL_FRCSPD 0x00000800 /* Force Speed */ +#define E1000_CTRL_FRCDPX 0x00001000 /* Force Duplex */ +#define E1000_CTRL_D_UD_EN 0x00002000 /* Dock/Undock enable */ +/* Defined polarity of Dock/Undock indication in SDP[0] */ +#define E1000_CTRL_D_UD_POLARITY 0x00004000 +/* Reset both PHY ports, through PHYRST_N pin */ +#define E1000_CTRL_FORCE_PHY_RESET 0x00008000 +/* enable link status from external LINK_0 and LINK_1 pins */ +#define E1000_CTRL_EXT_LINK_EN 0x00010000 +#define E1000_CTRL_LANPHYPC_OVERRIDE 0x00010000 /* SW control of LANPHYPC */ +#define E1000_CTRL_LANPHYPC_VALUE 0x00020000 /* SW value of LANPHYPC */ +#define E1000_CTRL_SWDPIN0 0x00040000 /* SWDPIN 0 value */ +#define E1000_CTRL_SWDPIN1 0x00080000 /* SWDPIN 1 value */ +#define E1000_CTRL_SWDPIN2 0x00100000 /* SWDPIN 2 value */ +#define E1000_CTRL_ADVD3WUC 0x00100000 /* D3 WUC */ +#define E1000_CTRL_SWDPIN3 0x00200000 /* SWDPIN 3 value */ +#define E1000_CTRL_SWDPIO0 0x00400000 /* SWDPIN 0 Input or output */ +#define E1000_CTRL_SWDPIO1 0x00800000 /* SWDPIN 1 input or output */ +#define E1000_CTRL_SWDPIO2 0x01000000 /* SWDPIN 2 input or output */ +#define E1000_CTRL_SWDPIO3 0x02000000 /* SWDPIN 3 input or output */ +#define E1000_CTRL_RST 0x04000000 /* Global reset */ +#define E1000_CTRL_RFCE 0x08000000 /* Receive Flow Control enable */ +#define E1000_CTRL_TFCE 0x10000000 /* Transmit flow control enable */ +#define E1000_CTRL_RTE 0x20000000 /* Routing tag enable */ +#define E1000_CTRL_VME 0x40000000 /* IEEE VLAN mode enable */ +#define E1000_CTRL_PHY_RST 0x80000000 /* PHY Reset */ +#define E1000_CTRL_SW2FW_INT 0x02000000 /* Initiate an interrupt to ME */ +#define E1000_CTRL_I2C_ENA 0x02000000 /* I2C enable */ /* * Bit definitions for the Management Data IO (MDIO) and Management Data * Clock (MDC) pins in the Device Control Register. */ -#define E1000_CTRL_PHY_RESET_DIR E1000_CTRL_SWDPIO0 -#define E1000_CTRL_PHY_RESET E1000_CTRL_SWDPIN0 -#define E1000_CTRL_MDIO_DIR E1000_CTRL_SWDPIO2 -#define E1000_CTRL_MDIO E1000_CTRL_SWDPIN2 -#define E1000_CTRL_MDC_DIR E1000_CTRL_SWDPIO3 -#define E1000_CTRL_MDC E1000_CTRL_SWDPIN3 -#define E1000_CTRL_PHY_RESET_DIR4 E1000_CTRL_EXT_SDP4_DIR -#define E1000_CTRL_PHY_RESET4 E1000_CTRL_EXT_SDP4_DATA +#define E1000_CTRL_PHY_RESET_DIR E1000_CTRL_SWDPIO0 +#define E1000_CTRL_PHY_RESET E1000_CTRL_SWDPIN0 +#define E1000_CTRL_MDIO_DIR E1000_CTRL_SWDPIO2 +#define E1000_CTRL_MDIO E1000_CTRL_SWDPIN2 +#define E1000_CTRL_MDC_DIR E1000_CTRL_SWDPIO3 +#define E1000_CTRL_MDC E1000_CTRL_SWDPIN3 +#define E1000_CTRL_PHY_RESET_DIR4 E1000_CTRL_EXT_SDP4_DIR +#define E1000_CTRL_PHY_RESET4 E1000_CTRL_EXT_SDP4_DATA -#define E1000_CONNSW_ENRGSRC 0x4 -#define E1000_PCS_CFG_PCS_EN 8 -#define E1000_PCS_LCTL_FLV_LINK_UP 1 -#define E1000_PCS_LCTL_FSV_10 0 -#define E1000_PCS_LCTL_FSV_100 2 -#define E1000_PCS_LCTL_FSV_1000 4 -#define E1000_PCS_LCTL_FDV_FULL 8 -#define E1000_PCS_LCTL_FSD 0x10 -#define E1000_PCS_LCTL_FORCE_LINK 0x20 -#define E1000_PCS_LCTL_LOW_LINK_LATCH 0x40 -#define E1000_PCS_LCTL_FORCE_FCTRL 0x80 -#define E1000_PCS_LCTL_AN_ENABLE 0x10000 -#define E1000_PCS_LCTL_AN_RESTART 0x20000 -#define E1000_PCS_LCTL_AN_TIMEOUT 0x40000 -#define E1000_PCS_LCTL_AN_SGMII_BYPASS 0x80000 -#define E1000_PCS_LCTL_AN_SGMII_TRIGGER 0x100000 -#define E1000_PCS_LCTL_FAST_LINK_TIMER 0x1000000 -#define E1000_PCS_LCTL_LINK_OK_FIX 0x2000000 -#define E1000_PCS_LCTL_CRS_ON_NI 0x4000000 -#define E1000_ENABLE_SERDES_LOOPBACK 0x0410 +#define E1000_CONNSW_ENRGSRC 0x4 +#define E1000_PCS_CFG_PCS_EN 8 +#define E1000_PCS_LCTL_FLV_LINK_UP 1 +#define E1000_PCS_LCTL_FSV_10 0 +#define E1000_PCS_LCTL_FSV_100 2 +#define E1000_PCS_LCTL_FSV_1000 4 +#define E1000_PCS_LCTL_FDV_FULL 8 +#define E1000_PCS_LCTL_FSD 0x10 +#define E1000_PCS_LCTL_FORCE_LINK 0x20 +#define E1000_PCS_LCTL_LOW_LINK_LATCH 0x40 +#define E1000_PCS_LCTL_FORCE_FCTRL 0x80 +#define E1000_PCS_LCTL_AN_ENABLE 0x10000 +#define E1000_PCS_LCTL_AN_RESTART 0x20000 +#define E1000_PCS_LCTL_AN_TIMEOUT 0x40000 +#define E1000_PCS_LCTL_AN_SGMII_BYPASS 0x80000 +#define E1000_PCS_LCTL_AN_SGMII_TRIGGER 0x100000 +#define E1000_PCS_LCTL_FAST_LINK_TIMER 0x1000000 +#define E1000_PCS_LCTL_LINK_OK_FIX 0x2000000 +#define E1000_PCS_LCTL_CRS_ON_NI 0x4000000 +#define E1000_ENABLE_SERDES_LOOPBACK 0x0410 -#define E1000_PCS_LSTS_LINK_OK 1 -#define E1000_PCS_LSTS_SPEED_10 0 -#define E1000_PCS_LSTS_SPEED_100 2 -#define E1000_PCS_LSTS_SPEED_1000 4 -#define E1000_PCS_LSTS_DUPLEX_FULL 8 -#define E1000_PCS_LSTS_SYNK_OK 0x10 -#define E1000_PCS_LSTS_AN_COMPLETE 0x10000 -#define E1000_PCS_LSTS_AN_PAGE_RX 0x20000 -#define E1000_PCS_LSTS_AN_TIMED_OUT 0x40000 -#define E1000_PCS_LSTS_AN_REMOTE_FAULT 0x80000 -#define E1000_PCS_LSTS_AN_ERROR_RWS 0x100000 +#define E1000_PCS_LSTS_LINK_OK 1 +#define E1000_PCS_LSTS_SPEED_10 0 +#define E1000_PCS_LSTS_SPEED_100 2 +#define E1000_PCS_LSTS_SPEED_1000 4 +#define E1000_PCS_LSTS_DUPLEX_FULL 8 +#define E1000_PCS_LSTS_SYNK_OK 0x10 +#define E1000_PCS_LSTS_AN_COMPLETE 0x10000 +#define E1000_PCS_LSTS_AN_PAGE_RX 0x20000 +#define E1000_PCS_LSTS_AN_TIMED_OUT 0x40000 +#define E1000_PCS_LSTS_AN_REMOTE_FAULT 0x80000 +#define E1000_PCS_LSTS_AN_ERROR_RWS 0x100000 /* Device Status */ -#define E1000_STATUS_FD 0x00000001 /* Full duplex.0=half,1=full */ -#define E1000_STATUS_LU 0x00000002 /* Link up.0=no,1=link */ -#define E1000_STATUS_FUNC_MASK 0x0000000C /* PCI Function Mask */ -#define E1000_STATUS_FUNC_SHIFT 2 -#define E1000_STATUS_FUNC_0 0x00000000 /* Function 0 */ -#define E1000_STATUS_FUNC_1 0x00000004 /* Function 1 */ -#define E1000_STATUS_TXOFF 0x00000010 /* transmission paused */ -#define E1000_STATUS_TBIMODE 0x00000020 /* TBI mode */ -#define E1000_STATUS_SPEED_MASK 0x000000C0 -#define E1000_STATUS_SPEED_10 0x00000000 /* Speed 10Mb/s */ -#define E1000_STATUS_SPEED_100 0x00000040 /* Speed 100Mb/s */ -#define E1000_STATUS_SPEED_1000 0x00000080 /* Speed 1000Mb/s */ -#define E1000_STATUS_LAN_INIT_DONE 0x00000200 /* Lan Init Completion by NVM */ -#define E1000_STATUS_ASDV 0x00000300 /* Auto speed detect value */ -#define E1000_STATUS_PHYRA 0x00000400 /* PHY Reset Asserted */ -#define E1000_STATUS_DOCK_CI 0x00000800 /* Change in Dock/Undock state. - * Clear on write '0'. */ -#define E1000_STATUS_GIO_MASTER_ENABLE 0x00080000 /* Master request status */ -#define E1000_STATUS_MTXCKOK 0x00000400 /* MTX clock running OK */ -#define E1000_STATUS_PCI66 0x00000800 /* In 66Mhz slot */ -#define E1000_STATUS_BUS64 0x00001000 /* In 64 bit slot */ -#define E1000_STATUS_PCIX_MODE 0x00002000 /* PCI-X mode */ -#define E1000_STATUS_PCIX_SPEED 0x0000C000 /* PCI-X bus speed */ -#define E1000_STATUS_BMC_SKU_0 0x00100000 /* BMC USB redirect disabled */ -#define E1000_STATUS_BMC_SKU_1 0x00200000 /* BMC SRAM disabled */ -#define E1000_STATUS_BMC_SKU_2 0x00400000 /* BMC SDRAM disabled */ -#define E1000_STATUS_BMC_CRYPTO 0x00800000 /* BMC crypto disabled */ -#define E1000_STATUS_BMC_LITE 0x01000000 /* BMC external code execution - * disabled */ -#define E1000_STATUS_RGMII_ENABLE 0x02000000 /* RGMII disabled */ -#define E1000_STATUS_FUSE_8 0x04000000 -#define E1000_STATUS_FUSE_9 0x08000000 -#define E1000_STATUS_SERDES0_DIS 0x10000000 /* SERDES disabled on port 0 */ -#define E1000_STATUS_SERDES1_DIS 0x20000000 /* SERDES disabled on port 1 */ +#define E1000_STATUS_FD 0x00000001 /* Duplex 0=half 1=full */ +#define E1000_STATUS_LU 0x00000002 /* Link up.0=no,1=link */ +#define E1000_STATUS_FUNC_MASK 0x0000000C /* PCI Function Mask */ +#define E1000_STATUS_FUNC_SHIFT 2 +#define E1000_STATUS_FUNC_0 0x00000000 /* Function 0 */ +#define E1000_STATUS_FUNC_1 0x00000004 /* Function 1 */ +#define E1000_STATUS_TXOFF 0x00000010 /* transmission paused */ +#define E1000_STATUS_TBIMODE 0x00000020 /* TBI mode */ +#define E1000_STATUS_SPEED_MASK 0x000000C0 +#define E1000_STATUS_SPEED_10 0x00000000 /* Speed 10Mb/s */ +#define E1000_STATUS_SPEED_100 0x00000040 /* Speed 100Mb/s */ +#define E1000_STATUS_SPEED_1000 0x00000080 /* Speed 1000Mb/s */ +#define E1000_STATUS_LAN_INIT_DONE 0x00000200 /* Lan Init Compltn by NVM */ +#define E1000_STATUS_ASDV 0x00000300 /* Auto speed detect value */ +#define E1000_STATUS_PHYRA 0x00000400 /* PHY Reset Asserted */ +/* Change in Dock/Undock state clear on write '0'. */ +#define E1000_STATUS_DOCK_CI 0x00000800 +#define E1000_STATUS_GIO_MASTER_ENABLE 0x00080000 /* Master request status */ +#define E1000_STATUS_MTXCKOK 0x00000400 /* MTX clock running OK */ +#define E1000_STATUS_PCI66 0x00000800 /* In 66Mhz slot */ +#define E1000_STATUS_BUS64 0x00001000 /* In 64 bit slot */ +#define E1000_STATUS_PCIX_MODE 0x00002000 /* PCI-X mode */ +#define E1000_STATUS_PCIX_SPEED 0x0000C000 /* PCI-X bus speed */ +#define E1000_STATUS_BMC_SKU_0 0x00100000 /* BMC USB redirect disbld */ +#define E1000_STATUS_BMC_SKU_1 0x00200000 /* BMC SRAM disabled */ +#define E1000_STATUS_BMC_SKU_2 0x00400000 /* BMC SDRAM disabled */ +#define E1000_STATUS_BMC_CRYPTO 0x00800000 /* BMC crypto disabled */ +/* BMC external code execution disabled */ +#define E1000_STATUS_BMC_LITE 0x01000000 +#define E1000_STATUS_RGMII_ENABLE 0x02000000 /* RGMII disabled */ +#define E1000_STATUS_FUSE_8 0x04000000 +#define E1000_STATUS_FUSE_9 0x08000000 +#define E1000_STATUS_SERDES0_DIS 0x10000000 /* SERDES disbld on port 0 */ +#define E1000_STATUS_SERDES1_DIS 0x20000000 /* SERDES disbld on port 1 */ /* Constants used to interpret the masked PCI-X bus speed. */ -#define E1000_STATUS_PCIX_SPEED_66 0x00000000 /* PCI-X bus speed 50-66 MHz */ -#define E1000_STATUS_PCIX_SPEED_100 0x00004000 /* PCI-X bus speed 66-100 MHz */ -#define E1000_STATUS_PCIX_SPEED_133 0x00008000 /*PCI-X bus speed 100-133 MHz*/ +#define E1000_STATUS_PCIX_SPEED_66 0x00000000 /* PCI-X bus spd 50-66MHz */ +#define E1000_STATUS_PCIX_SPEED_100 0x00004000 /* PCI-X bus spd 66-100MHz */ +#define E1000_STATUS_PCIX_SPEED_133 0x00008000 /* PCI-X bus spd 100-133MHz*/ -#define SPEED_10 10 -#define SPEED_100 100 -#define SPEED_1000 1000 -#define HALF_DUPLEX 1 -#define FULL_DUPLEX 2 +#define SPEED_10 10 +#define SPEED_100 100 +#define SPEED_1000 1000 +#define HALF_DUPLEX 1 +#define FULL_DUPLEX 2 -#define PHY_FORCE_TIME 20 +#define PHY_FORCE_TIME 20 -#define ADVERTISE_10_HALF 0x0001 -#define ADVERTISE_10_FULL 0x0002 -#define ADVERTISE_100_HALF 0x0004 -#define ADVERTISE_100_FULL 0x0008 -#define ADVERTISE_1000_HALF 0x0010 /* Not used, just FYI */ -#define ADVERTISE_1000_FULL 0x0020 +#define ADVERTISE_10_HALF 0x0001 +#define ADVERTISE_10_FULL 0x0002 +#define ADVERTISE_100_HALF 0x0004 +#define ADVERTISE_100_FULL 0x0008 +#define ADVERTISE_1000_HALF 0x0010 /* Not used, just FYI */ +#define ADVERTISE_1000_FULL 0x0020 /* 1000/H is not supported, nor spec-compliant. */ -#define E1000_ALL_SPEED_DUPLEX (ADVERTISE_10_HALF | ADVERTISE_10_FULL | \ - ADVERTISE_100_HALF | ADVERTISE_100_FULL | \ - ADVERTISE_1000_FULL) -#define E1000_ALL_NOT_GIG (ADVERTISE_10_HALF | ADVERTISE_10_FULL | \ - ADVERTISE_100_HALF | ADVERTISE_100_FULL) -#define E1000_ALL_100_SPEED (ADVERTISE_100_HALF | ADVERTISE_100_FULL) -#define E1000_ALL_10_SPEED (ADVERTISE_10_HALF | ADVERTISE_10_FULL) -#define E1000_ALL_FULL_DUPLEX (ADVERTISE_10_FULL | ADVERTISE_100_FULL | \ - ADVERTISE_1000_FULL) -#define E1000_ALL_HALF_DUPLEX (ADVERTISE_10_HALF | ADVERTISE_100_HALF) +#define E1000_ALL_SPEED_DUPLEX ( \ + ADVERTISE_10_HALF | ADVERTISE_10_FULL | ADVERTISE_100_HALF | \ + ADVERTISE_100_FULL | ADVERTISE_1000_FULL) +#define E1000_ALL_NOT_GIG ( \ + ADVERTISE_10_HALF | ADVERTISE_10_FULL | ADVERTISE_100_HALF | \ + ADVERTISE_100_FULL) +#define E1000_ALL_100_SPEED (ADVERTISE_100_HALF | ADVERTISE_100_FULL) +#define E1000_ALL_10_SPEED (ADVERTISE_10_HALF | ADVERTISE_10_FULL) +#define E1000_ALL_FULL_DUPLEX ( \ + ADVERTISE_10_FULL | ADVERTISE_100_FULL | ADVERTISE_1000_FULL) +#define E1000_ALL_HALF_DUPLEX (ADVERTISE_10_HALF | ADVERTISE_100_HALF) -#define AUTONEG_ADVERTISE_SPEED_DEFAULT E1000_ALL_SPEED_DUPLEX +#define AUTONEG_ADVERTISE_SPEED_DEFAULT E1000_ALL_SPEED_DUPLEX /* LED Control */ -#define E1000_PHY_LED0_MODE_MASK 0x00000007 -#define E1000_PHY_LED0_IVRT 0x00000008 -#define E1000_PHY_LED0_BLINK 0x00000010 -#define E1000_PHY_LED0_MASK 0x0000001F +#define E1000_PHY_LED0_MODE_MASK 0x00000007 +#define E1000_PHY_LED0_IVRT 0x00000008 +#define E1000_PHY_LED0_BLINK 0x00000010 +#define E1000_PHY_LED0_MASK 0x0000001F -#define E1000_LEDCTL_LED0_MODE_MASK 0x0000000F -#define E1000_LEDCTL_LED0_MODE_SHIFT 0 -#define E1000_LEDCTL_LED0_BLINK_RATE 0x00000020 -#define E1000_LEDCTL_LED0_IVRT 0x00000040 -#define E1000_LEDCTL_LED0_BLINK 0x00000080 -#define E1000_LEDCTL_LED1_MODE_MASK 0x00000F00 -#define E1000_LEDCTL_LED1_MODE_SHIFT 8 -#define E1000_LEDCTL_LED1_BLINK_RATE 0x00002000 -#define E1000_LEDCTL_LED1_IVRT 0x00004000 -#define E1000_LEDCTL_LED1_BLINK 0x00008000 -#define E1000_LEDCTL_LED2_MODE_MASK 0x000F0000 -#define E1000_LEDCTL_LED2_MODE_SHIFT 16 -#define E1000_LEDCTL_LED2_BLINK_RATE 0x00200000 -#define E1000_LEDCTL_LED2_IVRT 0x00400000 -#define E1000_LEDCTL_LED2_BLINK 0x00800000 -#define E1000_LEDCTL_LED3_MODE_MASK 0x0F000000 -#define E1000_LEDCTL_LED3_MODE_SHIFT 24 -#define E1000_LEDCTL_LED3_BLINK_RATE 0x20000000 -#define E1000_LEDCTL_LED3_IVRT 0x40000000 -#define E1000_LEDCTL_LED3_BLINK 0x80000000 +#define E1000_LEDCTL_LED0_MODE_MASK 0x0000000F +#define E1000_LEDCTL_LED0_MODE_SHIFT 0 +#define E1000_LEDCTL_LED0_BLINK_RATE 0x00000020 +#define E1000_LEDCTL_LED0_IVRT 0x00000040 +#define E1000_LEDCTL_LED0_BLINK 0x00000080 +#define E1000_LEDCTL_LED1_MODE_MASK 0x00000F00 +#define E1000_LEDCTL_LED1_MODE_SHIFT 8 +#define E1000_LEDCTL_LED1_BLINK_RATE 0x00002000 +#define E1000_LEDCTL_LED1_IVRT 0x00004000 +#define E1000_LEDCTL_LED1_BLINK 0x00008000 +#define E1000_LEDCTL_LED2_MODE_MASK 0x000F0000 +#define E1000_LEDCTL_LED2_MODE_SHIFT 16 +#define E1000_LEDCTL_LED2_BLINK_RATE 0x00200000 +#define E1000_LEDCTL_LED2_IVRT 0x00400000 +#define E1000_LEDCTL_LED2_BLINK 0x00800000 +#define E1000_LEDCTL_LED3_MODE_MASK 0x0F000000 +#define E1000_LEDCTL_LED3_MODE_SHIFT 24 +#define E1000_LEDCTL_LED3_BLINK_RATE 0x20000000 +#define E1000_LEDCTL_LED3_IVRT 0x40000000 +#define E1000_LEDCTL_LED3_BLINK 0x80000000 -#define E1000_LEDCTL_MODE_LINK_10_1000 0x0 -#define E1000_LEDCTL_MODE_LINK_100_1000 0x1 -#define E1000_LEDCTL_MODE_LINK_UP 0x2 -#define E1000_LEDCTL_MODE_ACTIVITY 0x3 -#define E1000_LEDCTL_MODE_LINK_ACTIVITY 0x4 -#define E1000_LEDCTL_MODE_LINK_10 0x5 -#define E1000_LEDCTL_MODE_LINK_100 0x6 -#define E1000_LEDCTL_MODE_LINK_1000 0x7 -#define E1000_LEDCTL_MODE_PCIX_MODE 0x8 -#define E1000_LEDCTL_MODE_FULL_DUPLEX 0x9 -#define E1000_LEDCTL_MODE_COLLISION 0xA -#define E1000_LEDCTL_MODE_BUS_SPEED 0xB -#define E1000_LEDCTL_MODE_BUS_SIZE 0xC -#define E1000_LEDCTL_MODE_PAUSED 0xD -#define E1000_LEDCTL_MODE_LED_ON 0xE -#define E1000_LEDCTL_MODE_LED_OFF 0xF +#define E1000_LEDCTL_MODE_LINK_10_1000 0x0 +#define E1000_LEDCTL_MODE_LINK_100_1000 0x1 +#define E1000_LEDCTL_MODE_LINK_UP 0x2 +#define E1000_LEDCTL_MODE_ACTIVITY 0x3 +#define E1000_LEDCTL_MODE_LINK_ACTIVITY 0x4 +#define E1000_LEDCTL_MODE_LINK_10 0x5 +#define E1000_LEDCTL_MODE_LINK_100 0x6 +#define E1000_LEDCTL_MODE_LINK_1000 0x7 +#define E1000_LEDCTL_MODE_PCIX_MODE 0x8 +#define E1000_LEDCTL_MODE_FULL_DUPLEX 0x9 +#define E1000_LEDCTL_MODE_COLLISION 0xA +#define E1000_LEDCTL_MODE_BUS_SPEED 0xB +#define E1000_LEDCTL_MODE_BUS_SIZE 0xC +#define E1000_LEDCTL_MODE_PAUSED 0xD +#define E1000_LEDCTL_MODE_LED_ON 0xE +#define E1000_LEDCTL_MODE_LED_OFF 0xF /* Transmit Descriptor bit definitions */ -#define E1000_TXD_DTYP_D 0x00100000 /* Data Descriptor */ -#define E1000_TXD_DTYP_C 0x00000000 /* Context Descriptor */ -#define E1000_TXD_POPTS_SHIFT 8 /* POPTS shift */ -#define E1000_TXD_POPTS_IXSM 0x01 /* Insert IP checksum */ -#define E1000_TXD_POPTS_TXSM 0x02 /* Insert TCP/UDP checksum */ -#define E1000_TXD_CMD_EOP 0x01000000 /* End of Packet */ -#define E1000_TXD_CMD_IFCS 0x02000000 /* Insert FCS (Ethernet CRC) */ -#define E1000_TXD_CMD_IC 0x04000000 /* Insert Checksum */ -#define E1000_TXD_CMD_RS 0x08000000 /* Report Status */ -#define E1000_TXD_CMD_RPS 0x10000000 /* Report Packet Sent */ -#define E1000_TXD_CMD_DEXT 0x20000000 /* Descriptor extension (0 = legacy) */ -#define E1000_TXD_CMD_VLE 0x40000000 /* Add VLAN tag */ -#define E1000_TXD_CMD_IDE 0x80000000 /* Enable Tidv register */ -#define E1000_TXD_STAT_DD 0x00000001 /* Descriptor Done */ -#define E1000_TXD_STAT_EC 0x00000002 /* Excess Collisions */ -#define E1000_TXD_STAT_LC 0x00000004 /* Late Collisions */ -#define E1000_TXD_STAT_TU 0x00000008 /* Transmit underrun */ -#define E1000_TXD_CMD_TCP 0x01000000 /* TCP packet */ -#define E1000_TXD_CMD_IP 0x02000000 /* IP packet */ -#define E1000_TXD_CMD_TSE 0x04000000 /* TCP Seg enable */ -#define E1000_TXD_STAT_TC 0x00000004 /* Tx Underrun */ +#define E1000_TXD_DTYP_D 0x00100000 /* Data Descriptor */ +#define E1000_TXD_DTYP_C 0x00000000 /* Context Descriptor */ +#define E1000_TXD_POPTS_SHIFT 8 /* POPTS shift */ +#define E1000_TXD_POPTS_IXSM 0x01 /* Insert IP checksum */ +#define E1000_TXD_POPTS_TXSM 0x02 /* Insert TCP/UDP checksum */ +#define E1000_TXD_CMD_EOP 0x01000000 /* End of Packet */ +#define E1000_TXD_CMD_IFCS 0x02000000 /* Insert FCS (Ethernet CRC) */ +#define E1000_TXD_CMD_IC 0x04000000 /* Insert Checksum */ +#define E1000_TXD_CMD_RS 0x08000000 /* Report Status */ +#define E1000_TXD_CMD_RPS 0x10000000 /* Report Packet Sent */ +#define E1000_TXD_CMD_DEXT 0x20000000 /* Desc extension (0 = legacy) */ +#define E1000_TXD_CMD_VLE 0x40000000 /* Add VLAN tag */ +#define E1000_TXD_CMD_IDE 0x80000000 /* Enable Tidv register */ +#define E1000_TXD_STAT_DD 0x00000001 /* Descriptor Done */ +#define E1000_TXD_STAT_EC 0x00000002 /* Excess Collisions */ +#define E1000_TXD_STAT_LC 0x00000004 /* Late Collisions */ +#define E1000_TXD_STAT_TU 0x00000008 /* Transmit underrun */ +#define E1000_TXD_CMD_TCP 0x01000000 /* TCP packet */ +#define E1000_TXD_CMD_IP 0x02000000 /* IP packet */ +#define E1000_TXD_CMD_TSE 0x04000000 /* TCP Seg enable */ +#define E1000_TXD_STAT_TC 0x00000004 /* Tx Underrun */ /* Extended desc bits for Linksec and timesync */ -#define E1000_TXD_CMD_LINKSEC 0x10000000 /* Apply LinkSec on packet */ -#define E1000_TXD_EXTCMD_TSTAMP 0x00000010 /* IEEE1588 Timestamp packet */ +#define E1000_TXD_CMD_LINKSEC 0x10000000 /* Apply LinkSec on packet */ +#define E1000_TXD_EXTCMD_TSTAMP 0x00000010 /* IEEE1588 Timestamp packet */ /* Transmit Control */ -#define E1000_TCTL_RST 0x00000001 /* software reset */ -#define E1000_TCTL_EN 0x00000002 /* enable Tx */ -#define E1000_TCTL_BCE 0x00000004 /* busy check enable */ -#define E1000_TCTL_PSP 0x00000008 /* pad short packets */ -#define E1000_TCTL_CT 0x00000ff0 /* collision threshold */ -#define E1000_TCTL_COLD 0x003ff000 /* collision distance */ -#define E1000_TCTL_SWXOFF 0x00400000 /* SW Xoff transmission */ -#define E1000_TCTL_PBE 0x00800000 /* Packet Burst Enable */ -#define E1000_TCTL_RTLC 0x01000000 /* Re-transmit on late collision */ -#define E1000_TCTL_NRTU 0x02000000 /* No Re-transmit on underrun */ -#define E1000_TCTL_MULR 0x10000000 /* Multiple request support */ +#define E1000_TCTL_RST 0x00000001 /* software reset */ +#define E1000_TCTL_EN 0x00000002 /* enable Tx */ +#define E1000_TCTL_BCE 0x00000004 /* busy check enable */ +#define E1000_TCTL_PSP 0x00000008 /* pad short packets */ +#define E1000_TCTL_CT 0x00000ff0 /* collision threshold */ +#define E1000_TCTL_COLD 0x003ff000 /* collision distance */ +#define E1000_TCTL_SWXOFF 0x00400000 /* SW Xoff transmission */ +#define E1000_TCTL_PBE 0x00800000 /* Packet Burst Enable */ +#define E1000_TCTL_RTLC 0x01000000 /* Re-transmit on late collision */ +#define E1000_TCTL_NRTU 0x02000000 /* No Re-transmit on underrun */ +#define E1000_TCTL_MULR 0x10000000 /* Multiple request support */ /* Transmit Arbitration Count */ -#define E1000_TARC0_ENABLE 0x00000400 /* Enable Tx Queue 0 */ +#define E1000_TARC0_ENABLE 0x00000400 /* Enable Tx Queue 0 */ /* SerDes Control */ -#define E1000_SCTL_DISABLE_SERDES_LOOPBACK 0x0400 +#define E1000_SCTL_DISABLE_SERDES_LOOPBACK 0x0400 /* Receive Checksum Control */ -#define E1000_RXCSUM_PCSS_MASK 0x000000FF /* Packet Checksum Start */ -#define E1000_RXCSUM_IPOFL 0x00000100 /* IPv4 checksum offload */ -#define E1000_RXCSUM_TUOFL 0x00000200 /* TCP / UDP checksum offload */ -#define E1000_RXCSUM_IPV6OFL 0x00000400 /* IPv6 checksum offload */ -#define E1000_RXCSUM_CRCOFL 0x00000800 /* CRC32 offload enable */ -#define E1000_RXCSUM_IPPCSE 0x00001000 /* IP payload checksum enable */ -#define E1000_RXCSUM_PCSD 0x00002000 /* packet checksum disabled */ +#define E1000_RXCSUM_PCSS_MASK 0x000000FF /* Packet Checksum Start */ +#define E1000_RXCSUM_IPOFL 0x00000100 /* IPv4 checksum offload */ +#define E1000_RXCSUM_TUOFL 0x00000200 /* TCP / UDP checksum offload */ +#define E1000_RXCSUM_IPV6OFL 0x00000400 /* IPv6 checksum offload */ +#define E1000_RXCSUM_CRCOFL 0x00000800 /* CRC32 offload enable */ +#define E1000_RXCSUM_IPPCSE 0x00001000 /* IP payload checksum enable */ +#define E1000_RXCSUM_PCSD 0x00002000 /* packet checksum disabled */ /* Header split receive */ -#define E1000_RFCTL_ISCSI_DIS 0x00000001 -#define E1000_RFCTL_ISCSI_DWC_MASK 0x0000003E -#define E1000_RFCTL_ISCSI_DWC_SHIFT 1 -#define E1000_RFCTL_NFSW_DIS 0x00000040 -#define E1000_RFCTL_NFSR_DIS 0x00000080 -#define E1000_RFCTL_NFS_VER_MASK 0x00000300 -#define E1000_RFCTL_NFS_VER_SHIFT 8 -#define E1000_RFCTL_IPV6_DIS 0x00000400 -#define E1000_RFCTL_IPV6_XSUM_DIS 0x00000800 -#define E1000_RFCTL_ACK_DIS 0x00001000 -#define E1000_RFCTL_ACKD_DIS 0x00002000 -#define E1000_RFCTL_IPFRSP_DIS 0x00004000 -#define E1000_RFCTL_EXTEN 0x00008000 -#define E1000_RFCTL_IPV6_EX_DIS 0x00010000 -#define E1000_RFCTL_NEW_IPV6_EXT_DIS 0x00020000 -#define E1000_RFCTL_LEF 0x00040000 +#define E1000_RFCTL_ISCSI_DIS 0x00000001 +#define E1000_RFCTL_ISCSI_DWC_MASK 0x0000003E +#define E1000_RFCTL_ISCSI_DWC_SHIFT 1 +#define E1000_RFCTL_NFSW_DIS 0x00000040 +#define E1000_RFCTL_NFSR_DIS 0x00000080 +#define E1000_RFCTL_NFS_VER_MASK 0x00000300 +#define E1000_RFCTL_NFS_VER_SHIFT 8 +#define E1000_RFCTL_IPV6_DIS 0x00000400 +#define E1000_RFCTL_IPV6_XSUM_DIS 0x00000800 +#define E1000_RFCTL_ACK_DIS 0x00001000 +#define E1000_RFCTL_ACKD_DIS 0x00002000 +#define E1000_RFCTL_IPFRSP_DIS 0x00004000 +#define E1000_RFCTL_EXTEN 0x00008000 +#define E1000_RFCTL_IPV6_EX_DIS 0x00010000 +#define E1000_RFCTL_NEW_IPV6_EXT_DIS 0x00020000 +#define E1000_RFCTL_LEF 0x00040000 /* Collision related configuration parameters */ -#define E1000_COLLISION_THRESHOLD 15 -#define E1000_CT_SHIFT 4 -#define E1000_COLLISION_DISTANCE 63 -#define E1000_COLD_SHIFT 12 +#define E1000_COLLISION_THRESHOLD 15 +#define E1000_CT_SHIFT 4 +#define E1000_COLLISION_DISTANCE 63 +#define E1000_COLD_SHIFT 12 /* Default values for the transmit IPG register */ -#define DEFAULT_82542_TIPG_IPGT 10 -#define DEFAULT_82543_TIPG_IPGT_FIBER 9 -#define DEFAULT_82543_TIPG_IPGT_COPPER 8 +#define DEFAULT_82542_TIPG_IPGT 10 +#define DEFAULT_82543_TIPG_IPGT_FIBER 9 +#define DEFAULT_82543_TIPG_IPGT_COPPER 8 -#define E1000_TIPG_IPGT_MASK 0x000003FF -#define E1000_TIPG_IPGR1_MASK 0x000FFC00 -#define E1000_TIPG_IPGR2_MASK 0x3FF00000 +#define E1000_TIPG_IPGT_MASK 0x000003FF +#define E1000_TIPG_IPGR1_MASK 0x000FFC00 +#define E1000_TIPG_IPGR2_MASK 0x3FF00000 -#define DEFAULT_82542_TIPG_IPGR1 2 -#define DEFAULT_82543_TIPG_IPGR1 8 -#define E1000_TIPG_IPGR1_SHIFT 10 +#define DEFAULT_82542_TIPG_IPGR1 2 +#define DEFAULT_82543_TIPG_IPGR1 8 +#define E1000_TIPG_IPGR1_SHIFT 10 -#define DEFAULT_82542_TIPG_IPGR2 10 -#define DEFAULT_82543_TIPG_IPGR2 6 -#define DEFAULT_80003ES2LAN_TIPG_IPGR2 7 -#define E1000_TIPG_IPGR2_SHIFT 20 +#define DEFAULT_82542_TIPG_IPGR2 10 +#define DEFAULT_82543_TIPG_IPGR2 6 +#define DEFAULT_80003ES2LAN_TIPG_IPGR2 7 +#define E1000_TIPG_IPGR2_SHIFT 20 /* Ethertype field values */ -#define ETHERNET_IEEE_VLAN_TYPE 0x8100 /* 802.3ac packet */ +#define ETHERNET_IEEE_VLAN_TYPE 0x8100 /* 802.3ac packet */ -#define ETHERNET_FCS_SIZE 4 -#define MAX_JUMBO_FRAME_SIZE 0x3F00 +#define ETHERNET_FCS_SIZE 4 +#define MAX_JUMBO_FRAME_SIZE 0x3F00 /* Extended Configuration Control and Size */ -#define E1000_EXTCNF_CTRL_MDIO_SW_OWNERSHIP 0x00000020 -#define E1000_EXTCNF_CTRL_LCD_WRITE_ENABLE 0x00000001 -#define E1000_EXTCNF_CTRL_OEM_WRITE_ENABLE 0x00000008 -#define E1000_EXTCNF_CTRL_SWFLAG 0x00000020 -#define E1000_EXTCNF_CTRL_GATE_PHY_CFG 0x00000080 -#define E1000_EXTCNF_SIZE_EXT_PCIE_LENGTH_MASK 0x00FF0000 -#define E1000_EXTCNF_SIZE_EXT_PCIE_LENGTH_SHIFT 16 -#define E1000_EXTCNF_CTRL_EXT_CNF_POINTER_MASK 0x0FFF0000 -#define E1000_EXTCNF_CTRL_EXT_CNF_POINTER_SHIFT 16 +#define E1000_EXTCNF_CTRL_MDIO_SW_OWNERSHIP 0x00000020 +#define E1000_EXTCNF_CTRL_LCD_WRITE_ENABLE 0x00000001 +#define E1000_EXTCNF_CTRL_OEM_WRITE_ENABLE 0x00000008 +#define E1000_EXTCNF_CTRL_SWFLAG 0x00000020 +#define E1000_EXTCNF_CTRL_GATE_PHY_CFG 0x00000080 +#define E1000_EXTCNF_SIZE_EXT_PCIE_LENGTH_MASK 0x00FF0000 +#define E1000_EXTCNF_SIZE_EXT_PCIE_LENGTH_SHIFT 16 +#define E1000_EXTCNF_CTRL_EXT_CNF_POINTER_MASK 0x0FFF0000 +#define E1000_EXTCNF_CTRL_EXT_CNF_POINTER_SHIFT 16 -#define E1000_PHY_CTRL_SPD_EN 0x00000001 -#define E1000_PHY_CTRL_D0A_LPLU 0x00000002 -#define E1000_PHY_CTRL_NOND0A_LPLU 0x00000004 -#define E1000_PHY_CTRL_NOND0A_GBE_DISABLE 0x00000008 -#define E1000_PHY_CTRL_GBE_DISABLE 0x00000040 +#define E1000_PHY_CTRL_SPD_EN 0x00000001 +#define E1000_PHY_CTRL_D0A_LPLU 0x00000002 +#define E1000_PHY_CTRL_NOND0A_LPLU 0x00000004 +#define E1000_PHY_CTRL_NOND0A_GBE_DISABLE 0x00000008 +#define E1000_PHY_CTRL_GBE_DISABLE 0x00000040 -#define E1000_KABGTXD_BGSQLBIAS 0x00050000 +#define E1000_KABGTXD_BGSQLBIAS 0x00050000 /* PBA constants */ -#define E1000_PBA_6K 0x0006 /* 6KB */ -#define E1000_PBA_8K 0x0008 /* 8KB */ -#define E1000_PBA_10K 0x000A /* 10KB */ -#define E1000_PBA_12K 0x000C /* 12KB */ -#define E1000_PBA_14K 0x000E /* 14KB */ -#define E1000_PBA_16K 0x0010 /* 16KB */ -#define E1000_PBA_18K 0x0012 -#define E1000_PBA_20K 0x0014 -#define E1000_PBA_22K 0x0016 -#define E1000_PBA_24K 0x0018 -#define E1000_PBA_26K 0x001A -#define E1000_PBA_30K 0x001E -#define E1000_PBA_32K 0x0020 -#define E1000_PBA_34K 0x0022 -#define E1000_PBA_35K 0x0023 -#define E1000_PBA_38K 0x0026 -#define E1000_PBA_40K 0x0028 -#define E1000_PBA_48K 0x0030 /* 48KB */ -#define E1000_PBA_64K 0x0040 /* 64KB */ +#define E1000_PBA_6K 0x0006 /* 6KB */ +#define E1000_PBA_8K 0x0008 /* 8KB */ +#define E1000_PBA_10K 0x000A /* 10KB */ +#define E1000_PBA_12K 0x000C /* 12KB */ +#define E1000_PBA_14K 0x000E /* 14KB */ +#define E1000_PBA_16K 0x0010 /* 16KB */ +#define E1000_PBA_18K 0x0012 +#define E1000_PBA_20K 0x0014 +#define E1000_PBA_22K 0x0016 +#define E1000_PBA_24K 0x0018 +#define E1000_PBA_26K 0x001A +#define E1000_PBA_30K 0x001E +#define E1000_PBA_32K 0x0020 +#define E1000_PBA_34K 0x0022 +#define E1000_PBA_35K 0x0023 +#define E1000_PBA_38K 0x0026 +#define E1000_PBA_40K 0x0028 +#define E1000_PBA_48K 0x0030 /* 48KB */ +#define E1000_PBA_64K 0x0040 /* 64KB */ -#define E1000_PBS_16K E1000_PBA_16K -#define E1000_PBS_24K E1000_PBA_24K +#define E1000_PBA_RXA_MASK 0xFFFF; -#define IFS_MAX 80 -#define IFS_MIN 40 -#define IFS_RATIO 4 -#define IFS_STEP 10 -#define MIN_NUM_XMITS 1000 +#define E1000_PBS_16K E1000_PBA_16K +#define E1000_PBS_24K E1000_PBA_24K + +#define IFS_MAX 80 +#define IFS_MIN 40 +#define IFS_RATIO 4 +#define IFS_STEP 10 +#define MIN_NUM_XMITS 1000 /* SW Semaphore Register */ -#define E1000_SWSM_SMBI 0x00000001 /* Driver Semaphore bit */ -#define E1000_SWSM_SWESMBI 0x00000002 /* FW Semaphore bit */ -#define E1000_SWSM_WMNG 0x00000004 /* Wake MNG Clock */ -#define E1000_SWSM_DRV_LOAD 0x00000008 /* Driver Loaded Bit */ +#define E1000_SWSM_SMBI 0x00000001 /* Driver Semaphore bit */ +#define E1000_SWSM_SWESMBI 0x00000002 /* FW Semaphore bit */ +#define E1000_SWSM_WMNG 0x00000004 /* Wake MNG Clock */ +#define E1000_SWSM_DRV_LOAD 0x00000008 /* Driver Loaded Bit */ -#define E1000_SWSM2_LOCK 0x00000002 /* Secondary driver semaphore bit */ +#define E1000_SWSM2_LOCK 0x00000002 /* Secondary driver semaphore bit */ /* Interrupt Cause Read */ -#define E1000_ICR_TXDW 0x00000001 /* Transmit desc written back */ -#define E1000_ICR_TXQE 0x00000002 /* Transmit Queue empty */ -#define E1000_ICR_LSC 0x00000004 /* Link Status Change */ -#define E1000_ICR_RXSEQ 0x00000008 /* Rx sequence error */ -#define E1000_ICR_RXDMT0 0x00000010 /* Rx desc min. threshold (0) */ -#define E1000_ICR_RXO 0x00000040 /* Rx overrun */ -#define E1000_ICR_RXT0 0x00000080 /* Rx timer intr (ring 0) */ -#define E1000_ICR_VMMB 0x00000100 /* VM MB event */ -#define E1000_ICR_MDAC 0x00000200 /* MDIO access complete */ -#define E1000_ICR_RXCFG 0x00000400 /* Rx /c/ ordered set */ -#define E1000_ICR_GPI_EN0 0x00000800 /* GP Int 0 */ -#define E1000_ICR_GPI_EN1 0x00001000 /* GP Int 1 */ -#define E1000_ICR_GPI_EN2 0x00002000 /* GP Int 2 */ -#define E1000_ICR_GPI_EN3 0x00004000 /* GP Int 3 */ -#define E1000_ICR_TXD_LOW 0x00008000 -#define E1000_ICR_SRPD 0x00010000 -#define E1000_ICR_ACK 0x00020000 /* Receive Ack frame */ -#define E1000_ICR_MNG 0x00040000 /* Manageability event */ -#define E1000_ICR_DOCK 0x00080000 /* Dock/Undock */ -#define E1000_ICR_DRSTA 0x40000000 /* Device Reset Asserted */ -#define E1000_ICR_INT_ASSERTED 0x80000000 /* If this bit asserted, the driver - * should claim the interrupt */ -#define E1000_ICR_RXD_FIFO_PAR0 0x00100000 /* Q0 Rx desc FIFO parity error */ -#define E1000_ICR_TXD_FIFO_PAR0 0x00200000 /* Q0 Tx desc FIFO parity error */ -#define E1000_ICR_HOST_ARB_PAR 0x00400000 /* host arb read buffer parity err */ -#define E1000_ICR_PB_PAR 0x00800000 /* packet buffer parity error */ -#define E1000_ICR_RXD_FIFO_PAR1 0x01000000 /* Q1 Rx desc FIFO parity error */ -#define E1000_ICR_TXD_FIFO_PAR1 0x02000000 /* Q1 Tx desc FIFO parity error */ -#define E1000_ICR_ALL_PARITY 0x03F00000 /* all parity error bits */ -#define E1000_ICR_DSW 0x00000020 /* FW changed the status of DISSW - * bit in the FWSM */ -#define E1000_ICR_PHYINT 0x00001000 /* LAN connected device generates - * an interrupt */ -#define E1000_ICR_DOUTSYNC 0x10000000 /* NIC DMA out of sync */ -#define E1000_ICR_EPRST 0x00100000 /* ME hardware reset occurs */ -#define E1000_ICR_RXQ0 0x00100000 /* Rx Queue 0 Interrupt */ -#define E1000_ICR_RXQ1 0x00200000 /* Rx Queue 1 Interrupt */ -#define E1000_ICR_TXQ0 0x00400000 /* Tx Queue 0 Interrupt */ -#define E1000_ICR_TXQ1 0x00800000 /* Tx Queue 1 Interrupt */ -#define E1000_ICR_OTHER 0x01000000 /* Other Interrupts */ -#define E1000_ICR_FER 0x00400000 /* Fatal Error */ +#define E1000_ICR_TXDW 0x00000001 /* Transmit desc written back */ +#define E1000_ICR_TXQE 0x00000002 /* Transmit Queue empty */ +#define E1000_ICR_LSC 0x00000004 /* Link Status Change */ +#define E1000_ICR_RXSEQ 0x00000008 /* Rx sequence error */ +#define E1000_ICR_RXDMT0 0x00000010 /* Rx desc min. threshold (0) */ +#define E1000_ICR_RXO 0x00000040 /* Rx overrun */ +#define E1000_ICR_RXT0 0x00000080 /* Rx timer intr (ring 0) */ +#define E1000_ICR_VMMB 0x00000100 /* VM MB event */ +#define E1000_ICR_MDAC 0x00000200 /* MDIO access complete */ +#define E1000_ICR_RXCFG 0x00000400 /* Rx /c/ ordered set */ +#define E1000_ICR_GPI_EN0 0x00000800 /* GP Int 0 */ +#define E1000_ICR_GPI_EN1 0x00001000 /* GP Int 1 */ +#define E1000_ICR_GPI_EN2 0x00002000 /* GP Int 2 */ +#define E1000_ICR_GPI_EN3 0x00004000 /* GP Int 3 */ +#define E1000_ICR_TXD_LOW 0x00008000 +#define E1000_ICR_SRPD 0x00010000 +#define E1000_ICR_ACK 0x00020000 /* Receive Ack frame */ +#define E1000_ICR_MNG 0x00040000 /* Manageability event */ +#define E1000_ICR_DOCK 0x00080000 /* Dock/Undock */ +#define E1000_ICR_DRSTA 0x40000000 /* Device Reset Asserted */ +/* If this bit asserted, the driver should claim the interrupt */ +#define E1000_ICR_INT_ASSERTED 0x80000000 +#define E1000_ICR_RXD_FIFO_PAR0 0x00100000 /* Q0 Rx desc FIFO parity error */ +#define E1000_ICR_TXD_FIFO_PAR0 0x00200000 /* Q0 Tx desc FIFO parity error */ +#define E1000_ICR_HOST_ARB_PAR 0x00400000 /* host arb read buffer parity err */ +#define E1000_ICR_PB_PAR 0x00800000 /* packet buffer parity error */ +#define E1000_ICR_RXD_FIFO_PAR1 0x01000000 /* Q1 Rx desc FIFO parity error */ +#define E1000_ICR_TXD_FIFO_PAR1 0x02000000 /* Q1 Tx desc FIFO parity error */ +#define E1000_ICR_ALL_PARITY 0x03F00000 /* all parity error bits */ +/* FW changed the status of DISSW bit in the FWSM */ +#define E1000_ICR_DSW 0x00000020 +/* LAN connected device generates an interrupt */ +#define E1000_ICR_PHYINT 0x00001000 +#define E1000_ICR_DOUTSYNC 0x10000000 /* NIC DMA out of sync */ +#define E1000_ICR_EPRST 0x00100000 /* ME hardware reset occurs */ +#define E1000_ICR_RXQ0 0x00100000 /* Rx Queue 0 Interrupt */ +#define E1000_ICR_RXQ1 0x00200000 /* Rx Queue 1 Interrupt */ +#define E1000_ICR_TXQ0 0x00400000 /* Tx Queue 0 Interrupt */ +#define E1000_ICR_TXQ1 0x00800000 /* Tx Queue 1 Interrupt */ +#define E1000_ICR_OTHER 0x01000000 /* Other Interrupts */ +#define E1000_ICR_FER 0x00400000 /* Fatal Error */ + +#define E1000_ICR_THS 0x00800000 /* ICR.THS: Thermal Sensor Event*/ +#define E1000_ICR_MDDET 0x10000000 /* Malicious Driver Detect */ + +#define E1000_ITR_MASK 0x000FFFFF /* ITR value bitfield */ +#define E1000_ITR_MULT 256 /* ITR mulitplier in nsec */ -#define E1000_ICR_THS 0x00800000 /* ICR.THS: Thermal Sensor Event*/ -#define E1000_ICR_MDDET 0x10000000 /* Malicious Driver Detect */ /* PBA ECC Register */ -#define E1000_PBA_ECC_COUNTER_MASK 0xFFF00000 /* ECC counter mask */ -#define E1000_PBA_ECC_COUNTER_SHIFT 20 /* ECC counter shift value */ -#define E1000_PBA_ECC_CORR_EN 0x00000001 /* Enable ECC error correction */ -#define E1000_PBA_ECC_STAT_CLR 0x00000002 /* Clear ECC error counter */ -#define E1000_PBA_ECC_INT_EN 0x00000004 /* Enable ICR bit 5 on ECC error */ +#define E1000_PBA_ECC_COUNTER_MASK 0xFFF00000 /* ECC counter mask */ +#define E1000_PBA_ECC_COUNTER_SHIFT 20 /* ECC counter shift value */ +#define E1000_PBA_ECC_CORR_EN 0x00000001 /* Enable ECC error correction */ +#define E1000_PBA_ECC_STAT_CLR 0x00000002 /* Clear ECC error counter */ +#define E1000_PBA_ECC_INT_EN 0x00000004 /* Enable ICR bit 5 on ECC error */ /* Extended Interrupt Cause Read */ -#define E1000_EICR_RX_QUEUE0 0x00000001 /* Rx Queue 0 Interrupt */ -#define E1000_EICR_RX_QUEUE1 0x00000002 /* Rx Queue 1 Interrupt */ -#define E1000_EICR_RX_QUEUE2 0x00000004 /* Rx Queue 2 Interrupt */ -#define E1000_EICR_RX_QUEUE3 0x00000008 /* Rx Queue 3 Interrupt */ -#define E1000_EICR_TX_QUEUE0 0x00000100 /* Tx Queue 0 Interrupt */ -#define E1000_EICR_TX_QUEUE1 0x00000200 /* Tx Queue 1 Interrupt */ -#define E1000_EICR_TX_QUEUE2 0x00000400 /* Tx Queue 2 Interrupt */ -#define E1000_EICR_TX_QUEUE3 0x00000800 /* Tx Queue 3 Interrupt */ -#define E1000_EICR_TCP_TIMER 0x40000000 /* TCP Timer */ -#define E1000_EICR_OTHER 0x80000000 /* Interrupt Cause Active */ +#define E1000_EICR_RX_QUEUE0 0x00000001 /* Rx Queue 0 Interrupt */ +#define E1000_EICR_RX_QUEUE1 0x00000002 /* Rx Queue 1 Interrupt */ +#define E1000_EICR_RX_QUEUE2 0x00000004 /* Rx Queue 2 Interrupt */ +#define E1000_EICR_RX_QUEUE3 0x00000008 /* Rx Queue 3 Interrupt */ +#define E1000_EICR_TX_QUEUE0 0x00000100 /* Tx Queue 0 Interrupt */ +#define E1000_EICR_TX_QUEUE1 0x00000200 /* Tx Queue 1 Interrupt */ +#define E1000_EICR_TX_QUEUE2 0x00000400 /* Tx Queue 2 Interrupt */ +#define E1000_EICR_TX_QUEUE3 0x00000800 /* Tx Queue 3 Interrupt */ +#define E1000_EICR_TCP_TIMER 0x40000000 /* TCP Timer */ +#define E1000_EICR_OTHER 0x80000000 /* Interrupt Cause Active */ /* TCP Timer */ -#define E1000_TCPTIMER_KS 0x00000100 /* KickStart */ -#define E1000_TCPTIMER_COUNT_ENABLE 0x00000200 /* Count Enable */ -#define E1000_TCPTIMER_COUNT_FINISH 0x00000400 /* Count finish */ -#define E1000_TCPTIMER_LOOP 0x00000800 /* Loop */ +#define E1000_TCPTIMER_KS 0x00000100 /* KickStart */ +#define E1000_TCPTIMER_COUNT_ENABLE 0x00000200 /* Count Enable */ +#define E1000_TCPTIMER_COUNT_FINISH 0x00000400 /* Count finish */ +#define E1000_TCPTIMER_LOOP 0x00000800 /* Loop */ /* * This defines the bits that are set in the Interrupt Mask @@ -858,8 +869,8 @@ * o RXSEQ = Receive Sequence Error */ #define POLL_IMS_ENABLE_MASK ( \ - E1000_IMS_RXDMT0 | \ - E1000_IMS_RXSEQ) + E1000_IMS_RXDMT0 | \ + E1000_IMS_RXSEQ) /* * This defines the bits that are set in the Interrupt Mask @@ -871,142 +882,142 @@ * o LSC = Link Status Change */ #define IMS_ENABLE_MASK ( \ - E1000_IMS_RXT0 | \ - E1000_IMS_TXDW | \ - E1000_IMS_RXDMT0 | \ - E1000_IMS_RXSEQ | \ - E1000_IMS_LSC) + E1000_IMS_RXT0 | \ + E1000_IMS_TXDW | \ + E1000_IMS_RXDMT0 | \ + E1000_IMS_RXSEQ | \ + E1000_IMS_LSC) /* Interrupt Mask Set */ -#define E1000_IMS_TXDW E1000_ICR_TXDW /* Tx desc written back */ -#define E1000_IMS_TXQE E1000_ICR_TXQE /* Transmit Queue empty */ -#define E1000_IMS_LSC E1000_ICR_LSC /* Link Status Change */ -#define E1000_IMS_VMMB E1000_ICR_VMMB /* Mail box activity */ -#define E1000_IMS_RXSEQ E1000_ICR_RXSEQ /* Rx sequence error */ -#define E1000_IMS_RXDMT0 E1000_ICR_RXDMT0 /* Rx desc min. threshold */ -#define E1000_IMS_RXO E1000_ICR_RXO /* Rx overrun */ -#define E1000_IMS_RXT0 E1000_ICR_RXT0 /* Rx timer intr */ -#define E1000_IMS_MDAC E1000_ICR_MDAC /* MDIO access complete */ -#define E1000_IMS_RXCFG E1000_ICR_RXCFG /* Rx /c/ ordered set */ -#define E1000_IMS_GPI_EN0 E1000_ICR_GPI_EN0 /* GP Int 0 */ -#define E1000_IMS_GPI_EN1 E1000_ICR_GPI_EN1 /* GP Int 1 */ -#define E1000_IMS_GPI_EN2 E1000_ICR_GPI_EN2 /* GP Int 2 */ -#define E1000_IMS_GPI_EN3 E1000_ICR_GPI_EN3 /* GP Int 3 */ -#define E1000_IMS_TXD_LOW E1000_ICR_TXD_LOW -#define E1000_IMS_SRPD E1000_ICR_SRPD -#define E1000_IMS_ACK E1000_ICR_ACK /* Receive Ack frame */ -#define E1000_IMS_MNG E1000_ICR_MNG /* Manageability event */ -#define E1000_IMS_DOCK E1000_ICR_DOCK /* Dock/Undock */ -#define E1000_IMS_DRSTA E1000_ICR_DRSTA /* Device Reset Asserted */ -#define E1000_IMS_RXD_FIFO_PAR0 E1000_ICR_RXD_FIFO_PAR0 /* Q0 Rx desc FIFO - * parity error */ -#define E1000_IMS_TXD_FIFO_PAR0 E1000_ICR_TXD_FIFO_PAR0 /* Q0 Tx desc FIFO - * parity error */ -#define E1000_IMS_HOST_ARB_PAR E1000_ICR_HOST_ARB_PAR /* host arb read buffer - * parity error */ -#define E1000_IMS_PB_PAR E1000_ICR_PB_PAR /* packet buffer parity - * error */ -#define E1000_IMS_RXD_FIFO_PAR1 E1000_ICR_RXD_FIFO_PAR1 /* Q1 Rx desc FIFO - * parity error */ -#define E1000_IMS_TXD_FIFO_PAR1 E1000_ICR_TXD_FIFO_PAR1 /* Q1 Tx desc FIFO - * parity error */ -#define E1000_IMS_DSW E1000_ICR_DSW -#define E1000_IMS_PHYINT E1000_ICR_PHYINT -#define E1000_IMS_DOUTSYNC E1000_ICR_DOUTSYNC /* NIC DMA out of sync */ -#define E1000_IMS_EPRST E1000_ICR_EPRST -#define E1000_IMS_RXQ0 E1000_ICR_RXQ0 /* Rx Queue 0 Interrupt */ -#define E1000_IMS_RXQ1 E1000_ICR_RXQ1 /* Rx Queue 1 Interrupt */ -#define E1000_IMS_TXQ0 E1000_ICR_TXQ0 /* Tx Queue 0 Interrupt */ -#define E1000_IMS_TXQ1 E1000_ICR_TXQ1 /* Tx Queue 1 Interrupt */ -#define E1000_IMS_OTHER E1000_ICR_OTHER /* Other Interrupts */ -#define E1000_IMS_FER E1000_ICR_FER /* Fatal Error */ +#define E1000_IMS_TXDW E1000_ICR_TXDW /* Tx desc written back */ +#define E1000_IMS_TXQE E1000_ICR_TXQE /* Transmit Queue empty */ +#define E1000_IMS_LSC E1000_ICR_LSC /* Link Status Change */ +#define E1000_IMS_VMMB E1000_ICR_VMMB /* Mail box activity */ +#define E1000_IMS_RXSEQ E1000_ICR_RXSEQ /* Rx sequence error */ +#define E1000_IMS_RXDMT0 E1000_ICR_RXDMT0 /* Rx desc min. threshold */ +#define E1000_IMS_RXO E1000_ICR_RXO /* Rx overrun */ +#define E1000_IMS_RXT0 E1000_ICR_RXT0 /* Rx timer intr */ +#define E1000_IMS_MDAC E1000_ICR_MDAC /* MDIO access complete */ +#define E1000_IMS_RXCFG E1000_ICR_RXCFG /* Rx /c/ ordered set */ +#define E1000_IMS_GPI_EN0 E1000_ICR_GPI_EN0 /* GP Int 0 */ +#define E1000_IMS_GPI_EN1 E1000_ICR_GPI_EN1 /* GP Int 1 */ +#define E1000_IMS_GPI_EN2 E1000_ICR_GPI_EN2 /* GP Int 2 */ +#define E1000_IMS_GPI_EN3 E1000_ICR_GPI_EN3 /* GP Int 3 */ +#define E1000_IMS_TXD_LOW E1000_ICR_TXD_LOW +#define E1000_IMS_SRPD E1000_ICR_SRPD +#define E1000_IMS_ACK E1000_ICR_ACK /* Receive Ack frame */ +#define E1000_IMS_MNG E1000_ICR_MNG /* Manageability event */ +#define E1000_IMS_DOCK E1000_ICR_DOCK /* Dock/Undock */ +#define E1000_IMS_DRSTA E1000_ICR_DRSTA /* Device Reset Asserted */ +/* Q0 Rx desc FIFO parity error */ +#define E1000_IMS_RXD_FIFO_PAR0 E1000_ICR_RXD_FIFO_PAR0 +/* Q0 Tx desc FIFO parity error */ +#define E1000_IMS_TXD_FIFO_PAR0 E1000_ICR_TXD_FIFO_PAR0 +/* host arb read buffer parity error */ +#define E1000_IMS_HOST_ARB_PAR E1000_ICR_HOST_ARB_PAR +/* packet buffer parity error */ +#define E1000_IMS_PB_PAR E1000_ICR_PB_PAR +/* Q1 Rx desc FIFO parity error */ +#define E1000_IMS_RXD_FIFO_PAR1 E1000_ICR_RXD_FIFO_PAR1 +/* Q1 Tx desc FIFO parity error */ +#define E1000_IMS_TXD_FIFO_PAR1 E1000_ICR_TXD_FIFO_PAR1 +#define E1000_IMS_DSW E1000_ICR_DSW +#define E1000_IMS_PHYINT E1000_ICR_PHYINT +#define E1000_IMS_DOUTSYNC E1000_ICR_DOUTSYNC /* NIC DMA out of sync */ +#define E1000_IMS_EPRST E1000_ICR_EPRST +#define E1000_IMS_RXQ0 E1000_ICR_RXQ0 /* Rx Queue 0 Interrupt */ +#define E1000_IMS_RXQ1 E1000_ICR_RXQ1 /* Rx Queue 1 Interrupt */ +#define E1000_IMS_TXQ0 E1000_ICR_TXQ0 /* Tx Queue 0 Interrupt */ +#define E1000_IMS_TXQ1 E1000_ICR_TXQ1 /* Tx Queue 1 Interrupt */ +#define E1000_IMS_OTHER E1000_ICR_OTHER /* Other Interrupts */ +#define E1000_IMS_FER E1000_ICR_FER /* Fatal Error */ -#define E1000_IMS_THS E1000_ICR_THS /* ICR.TS: Thermal Sensor Event*/ -#define E1000_IMS_MDDET E1000_ICR_MDDET /* Malicious Driver Detect */ +#define E1000_IMS_THS E1000_ICR_THS /* ICR.TS: Thermal Sensor Event*/ +#define E1000_IMS_MDDET E1000_ICR_MDDET /* Malicious Driver Detect */ /* Extended Interrupt Mask Set */ -#define E1000_EIMS_RX_QUEUE0 E1000_EICR_RX_QUEUE0 /* Rx Queue 0 Interrupt */ -#define E1000_EIMS_RX_QUEUE1 E1000_EICR_RX_QUEUE1 /* Rx Queue 1 Interrupt */ -#define E1000_EIMS_RX_QUEUE2 E1000_EICR_RX_QUEUE2 /* Rx Queue 2 Interrupt */ -#define E1000_EIMS_RX_QUEUE3 E1000_EICR_RX_QUEUE3 /* Rx Queue 3 Interrupt */ -#define E1000_EIMS_TX_QUEUE0 E1000_EICR_TX_QUEUE0 /* Tx Queue 0 Interrupt */ -#define E1000_EIMS_TX_QUEUE1 E1000_EICR_TX_QUEUE1 /* Tx Queue 1 Interrupt */ -#define E1000_EIMS_TX_QUEUE2 E1000_EICR_TX_QUEUE2 /* Tx Queue 2 Interrupt */ -#define E1000_EIMS_TX_QUEUE3 E1000_EICR_TX_QUEUE3 /* Tx Queue 3 Interrupt */ -#define E1000_EIMS_TCP_TIMER E1000_EICR_TCP_TIMER /* TCP Timer */ -#define E1000_EIMS_OTHER E1000_EICR_OTHER /* Interrupt Cause Active */ +#define E1000_EIMS_RX_QUEUE0 E1000_EICR_RX_QUEUE0 /* Rx Queue 0 Interrupt */ +#define E1000_EIMS_RX_QUEUE1 E1000_EICR_RX_QUEUE1 /* Rx Queue 1 Interrupt */ +#define E1000_EIMS_RX_QUEUE2 E1000_EICR_RX_QUEUE2 /* Rx Queue 2 Interrupt */ +#define E1000_EIMS_RX_QUEUE3 E1000_EICR_RX_QUEUE3 /* Rx Queue 3 Interrupt */ +#define E1000_EIMS_TX_QUEUE0 E1000_EICR_TX_QUEUE0 /* Tx Queue 0 Interrupt */ +#define E1000_EIMS_TX_QUEUE1 E1000_EICR_TX_QUEUE1 /* Tx Queue 1 Interrupt */ +#define E1000_EIMS_TX_QUEUE2 E1000_EICR_TX_QUEUE2 /* Tx Queue 2 Interrupt */ +#define E1000_EIMS_TX_QUEUE3 E1000_EICR_TX_QUEUE3 /* Tx Queue 3 Interrupt */ +#define E1000_EIMS_TCP_TIMER E1000_EICR_TCP_TIMER /* TCP Timer */ +#define E1000_EIMS_OTHER E1000_EICR_OTHER /* Interrupt Cause Active */ /* Interrupt Cause Set */ -#define E1000_ICS_TXDW E1000_ICR_TXDW /* Tx desc written back */ -#define E1000_ICS_TXQE E1000_ICR_TXQE /* Transmit Queue empty */ -#define E1000_ICS_LSC E1000_ICR_LSC /* Link Status Change */ -#define E1000_ICS_RXSEQ E1000_ICR_RXSEQ /* Rx sequence error */ -#define E1000_ICS_RXDMT0 E1000_ICR_RXDMT0 /* Rx desc min. threshold */ -#define E1000_ICS_RXO E1000_ICR_RXO /* Rx overrun */ -#define E1000_ICS_RXT0 E1000_ICR_RXT0 /* Rx timer intr */ -#define E1000_ICS_MDAC E1000_ICR_MDAC /* MDIO access complete */ -#define E1000_ICS_RXCFG E1000_ICR_RXCFG /* Rx /c/ ordered set */ -#define E1000_ICS_GPI_EN0 E1000_ICR_GPI_EN0 /* GP Int 0 */ -#define E1000_ICS_GPI_EN1 E1000_ICR_GPI_EN1 /* GP Int 1 */ -#define E1000_ICS_GPI_EN2 E1000_ICR_GPI_EN2 /* GP Int 2 */ -#define E1000_ICS_GPI_EN3 E1000_ICR_GPI_EN3 /* GP Int 3 */ -#define E1000_ICS_TXD_LOW E1000_ICR_TXD_LOW -#define E1000_ICS_SRPD E1000_ICR_SRPD -#define E1000_ICS_ACK E1000_ICR_ACK /* Receive Ack frame */ -#define E1000_ICS_MNG E1000_ICR_MNG /* Manageability event */ -#define E1000_ICS_DOCK E1000_ICR_DOCK /* Dock/Undock */ -#define E1000_ICS_DRSTA E1000_ICR_DRSTA /* Device Reset Aserted */ -#define E1000_ICS_RXD_FIFO_PAR0 E1000_ICR_RXD_FIFO_PAR0 /* Q0 Rx desc FIFO - * parity error */ -#define E1000_ICS_TXD_FIFO_PAR0 E1000_ICR_TXD_FIFO_PAR0 /* Q0 Tx desc FIFO - * parity error */ -#define E1000_ICS_HOST_ARB_PAR E1000_ICR_HOST_ARB_PAR /* host arb read buffer - * parity error */ -#define E1000_ICS_PB_PAR E1000_ICR_PB_PAR /* packet buffer parity - * error */ -#define E1000_ICS_RXD_FIFO_PAR1 E1000_ICR_RXD_FIFO_PAR1 /* Q1 Rx desc FIFO - * parity error */ -#define E1000_ICS_TXD_FIFO_PAR1 E1000_ICR_TXD_FIFO_PAR1 /* Q1 Tx desc FIFO - * parity error */ -#define E1000_ICS_DSW E1000_ICR_DSW -#define E1000_ICS_DOUTSYNC E1000_ICR_DOUTSYNC /* NIC DMA out of sync */ -#define E1000_ICS_PHYINT E1000_ICR_PHYINT -#define E1000_ICS_EPRST E1000_ICR_EPRST +#define E1000_ICS_TXDW E1000_ICR_TXDW /* Tx desc written back */ +#define E1000_ICS_TXQE E1000_ICR_TXQE /* Transmit Queue empty */ +#define E1000_ICS_LSC E1000_ICR_LSC /* Link Status Change */ +#define E1000_ICS_RXSEQ E1000_ICR_RXSEQ /* Rx sequence error */ +#define E1000_ICS_RXDMT0 E1000_ICR_RXDMT0 /* Rx desc min. threshold */ +#define E1000_ICS_RXO E1000_ICR_RXO /* Rx overrun */ +#define E1000_ICS_RXT0 E1000_ICR_RXT0 /* Rx timer intr */ +#define E1000_ICS_MDAC E1000_ICR_MDAC /* MDIO access complete */ +#define E1000_ICS_RXCFG E1000_ICR_RXCFG /* Rx /c/ ordered set */ +#define E1000_ICS_GPI_EN0 E1000_ICR_GPI_EN0 /* GP Int 0 */ +#define E1000_ICS_GPI_EN1 E1000_ICR_GPI_EN1 /* GP Int 1 */ +#define E1000_ICS_GPI_EN2 E1000_ICR_GPI_EN2 /* GP Int 2 */ +#define E1000_ICS_GPI_EN3 E1000_ICR_GPI_EN3 /* GP Int 3 */ +#define E1000_ICS_TXD_LOW E1000_ICR_TXD_LOW +#define E1000_ICS_SRPD E1000_ICR_SRPD +#define E1000_ICS_ACK E1000_ICR_ACK /* Receive Ack frame */ +#define E1000_ICS_MNG E1000_ICR_MNG /* Manageability event */ +#define E1000_ICS_DOCK E1000_ICR_DOCK /* Dock/Undock */ +#define E1000_ICS_DRSTA E1000_ICR_DRSTA /* Device Reset Aserted */ +/* Q0 Rx desc FIFO parity error */ +#define E1000_ICS_RXD_FIFO_PAR0 E1000_ICR_RXD_FIFO_PAR0 +/* Q0 Tx desc FIFO parity error */ +#define E1000_ICS_TXD_FIFO_PAR0 E1000_ICR_TXD_FIFO_PAR0 +/* host arb read buffer parity error */ +#define E1000_ICS_HOST_ARB_PAR E1000_ICR_HOST_ARB_PAR +/* packet buffer parity error */ +#define E1000_ICS_PB_PAR E1000_ICR_PB_PAR +/* Q1 Rx desc FIFO parity error */ +#define E1000_ICS_RXD_FIFO_PAR1 E1000_ICR_RXD_FIFO_PAR1 +/* Q1 Tx desc FIFO parity error */ +#define E1000_ICS_TXD_FIFO_PAR1 E1000_ICR_TXD_FIFO_PAR1 +#define E1000_ICS_DSW E1000_ICR_DSW +#define E1000_ICS_DOUTSYNC E1000_ICR_DOUTSYNC /* NIC DMA out of sync */ +#define E1000_ICS_PHYINT E1000_ICR_PHYINT +#define E1000_ICS_EPRST E1000_ICR_EPRST /* Extended Interrupt Cause Set */ -#define E1000_EICS_RX_QUEUE0 E1000_EICR_RX_QUEUE0 /* Rx Queue 0 Interrupt */ -#define E1000_EICS_RX_QUEUE1 E1000_EICR_RX_QUEUE1 /* Rx Queue 1 Interrupt */ -#define E1000_EICS_RX_QUEUE2 E1000_EICR_RX_QUEUE2 /* Rx Queue 2 Interrupt */ -#define E1000_EICS_RX_QUEUE3 E1000_EICR_RX_QUEUE3 /* Rx Queue 3 Interrupt */ -#define E1000_EICS_TX_QUEUE0 E1000_EICR_TX_QUEUE0 /* Tx Queue 0 Interrupt */ -#define E1000_EICS_TX_QUEUE1 E1000_EICR_TX_QUEUE1 /* Tx Queue 1 Interrupt */ -#define E1000_EICS_TX_QUEUE2 E1000_EICR_TX_QUEUE2 /* Tx Queue 2 Interrupt */ -#define E1000_EICS_TX_QUEUE3 E1000_EICR_TX_QUEUE3 /* Tx Queue 3 Interrupt */ -#define E1000_EICS_TCP_TIMER E1000_EICR_TCP_TIMER /* TCP Timer */ -#define E1000_EICS_OTHER E1000_EICR_OTHER /* Interrupt Cause Active */ +#define E1000_EICS_RX_QUEUE0 E1000_EICR_RX_QUEUE0 /* Rx Queue 0 Interrupt */ +#define E1000_EICS_RX_QUEUE1 E1000_EICR_RX_QUEUE1 /* Rx Queue 1 Interrupt */ +#define E1000_EICS_RX_QUEUE2 E1000_EICR_RX_QUEUE2 /* Rx Queue 2 Interrupt */ +#define E1000_EICS_RX_QUEUE3 E1000_EICR_RX_QUEUE3 /* Rx Queue 3 Interrupt */ +#define E1000_EICS_TX_QUEUE0 E1000_EICR_TX_QUEUE0 /* Tx Queue 0 Interrupt */ +#define E1000_EICS_TX_QUEUE1 E1000_EICR_TX_QUEUE1 /* Tx Queue 1 Interrupt */ +#define E1000_EICS_TX_QUEUE2 E1000_EICR_TX_QUEUE2 /* Tx Queue 2 Interrupt */ +#define E1000_EICS_TX_QUEUE3 E1000_EICR_TX_QUEUE3 /* Tx Queue 3 Interrupt */ +#define E1000_EICS_TCP_TIMER E1000_EICR_TCP_TIMER /* TCP Timer */ +#define E1000_EICS_OTHER E1000_EICR_OTHER /* Interrupt Cause Active */ -#define E1000_EITR_ITR_INT_MASK 0x0000FFFF +#define E1000_EITR_ITR_INT_MASK 0x0000FFFF /* E1000_EITR_CNT_IGNR is only for 82576 and newer */ -#define E1000_EITR_CNT_IGNR 0x80000000 /* Don't reset counters on write */ +#define E1000_EITR_CNT_IGNR 0x80000000 /* Don't reset counters on write */ /* Transmit Descriptor Control */ -#define E1000_TXDCTL_PTHRESH 0x0000003F /* TXDCTL Prefetch Threshold */ -#define E1000_TXDCTL_HTHRESH 0x00003F00 /* TXDCTL Host Threshold */ -#define E1000_TXDCTL_WTHRESH 0x003F0000 /* TXDCTL Writeback Threshold */ -#define E1000_TXDCTL_GRAN 0x01000000 /* TXDCTL Granularity */ -#define E1000_TXDCTL_LWTHRESH 0xFE000000 /* TXDCTL Low Threshold */ -#define E1000_TXDCTL_FULL_TX_DESC_WB 0x01010000 /* GRAN=1, WTHRESH=1 */ +#define E1000_TXDCTL_PTHRESH 0x0000003F /* TXDCTL Prefetch Threshold */ +#define E1000_TXDCTL_HTHRESH 0x00003F00 /* TXDCTL Host Threshold */ +#define E1000_TXDCTL_WTHRESH 0x003F0000 /* TXDCTL Writeback Threshold */ +#define E1000_TXDCTL_GRAN 0x01000000 /* TXDCTL Granularity */ +#define E1000_TXDCTL_LWTHRESH 0xFE000000 /* TXDCTL Low Threshold */ +#define E1000_TXDCTL_FULL_TX_DESC_WB 0x01010000 /* GRAN=1, WTHRESH=1 */ #define E1000_TXDCTL_MAX_TX_DESC_PREFETCH 0x0100001F /* GRAN=1, PTHRESH=31 */ /* Enable the counting of descriptors still to be processed. */ -#define E1000_TXDCTL_COUNT_DESC 0x00400000 +#define E1000_TXDCTL_COUNT_DESC 0x00400000 /* Flow Control Constants */ -#define FLOW_CONTROL_ADDRESS_LOW 0x00C28001 -#define FLOW_CONTROL_ADDRESS_HIGH 0x00000100 -#define FLOW_CONTROL_TYPE 0x8808 +#define FLOW_CONTROL_ADDRESS_LOW 0x00C28001 +#define FLOW_CONTROL_ADDRESS_HIGH 0x00000100 +#define FLOW_CONTROL_TYPE 0x8808 /* 802.1q VLAN Packet Size */ -#define VLAN_TAG_SIZE 4 /* 802.3ac tag (not DMA'd) */ -#define E1000_VLAN_FILTER_TBL_SIZE 128 /* VLAN Filter Table (4096 bits) */ +#define VLAN_TAG_SIZE 4 /* 802.3ac tag (not DMA'd) */ +#define E1000_VLAN_FILTER_TBL_SIZE 128 /* VLAN Filter Table (4096 bits) */ /* Receive Address */ /* @@ -1016,529 +1027,575 @@ * (RAR[15]) for our directed address used by controllers with * manageability enabled, allowing us room for 15 multicast addresses. */ -#define E1000_RAR_ENTRIES 15 -#define E1000_RAH_AV 0x80000000 /* Receive descriptor valid */ -#define E1000_RAL_MAC_ADDR_LEN 4 -#define E1000_RAH_MAC_ADDR_LEN 2 -#define E1000_RAH_QUEUE_MASK_82575 0x000C0000 -#define E1000_RAH_POOL_MASK 0x03FC0000 -#define E1000_RAH_POOL_SHIFT 18 -#define E1000_RAH_POOL_1 0x00040000 +#define E1000_RAR_ENTRIES 15 +#define E1000_RAH_AV 0x80000000 /* Receive descriptor valid */ +#define E1000_RAL_MAC_ADDR_LEN 4 +#define E1000_RAH_MAC_ADDR_LEN 2 +#define E1000_RAH_QUEUE_MASK_82575 0x000C0000 +#define E1000_RAH_POOL_MASK 0x03FC0000 +#define E1000_RAH_POOL_SHIFT 18 +#define E1000_RAH_POOL_1 0x00040000 /* Error Codes */ -#define E1000_SUCCESS 0 -#define E1000_ERR_NVM 1 -#define E1000_ERR_PHY 2 -#define E1000_ERR_CONFIG 3 -#define E1000_ERR_PARAM 4 -#define E1000_ERR_MAC_INIT 5 -#define E1000_ERR_PHY_TYPE 6 -#define E1000_ERR_RESET 9 -#define E1000_ERR_MASTER_REQUESTS_PENDING 10 -#define E1000_ERR_HOST_INTERFACE_COMMAND 11 -#define E1000_BLK_PHY_RESET 12 -#define E1000_ERR_SWFW_SYNC 13 -#define E1000_NOT_IMPLEMENTED 14 -#define E1000_ERR_MBX 15 -#define E1000_ERR_INVALID_ARGUMENT 16 -#define E1000_ERR_NO_SPACE 17 -#define E1000_ERR_NVM_PBA_SECTION 18 +#define E1000_SUCCESS 0 +#define E1000_ERR_NVM 1 +#define E1000_ERR_PHY 2 +#define E1000_ERR_CONFIG 3 +#define E1000_ERR_PARAM 4 +#define E1000_ERR_MAC_INIT 5 +#define E1000_ERR_PHY_TYPE 6 +#define E1000_ERR_RESET 9 +#define E1000_ERR_MASTER_REQUESTS_PENDING 10 +#define E1000_ERR_HOST_INTERFACE_COMMAND 11 +#define E1000_BLK_PHY_RESET 12 +#define E1000_ERR_SWFW_SYNC 13 +#define E1000_NOT_IMPLEMENTED 14 +#define E1000_ERR_MBX 15 +#define E1000_ERR_INVALID_ARGUMENT 16 +#define E1000_ERR_NO_SPACE 17 +#define E1000_ERR_NVM_PBA_SECTION 18 +#define E1000_ERR_I2C 19 +#define E1000_ERR_INVM_VALUE_NOT_FOUND 20 /* Loop limit on how long we wait for auto-negotiation to complete */ -#define FIBER_LINK_UP_LIMIT 50 -#define COPPER_LINK_UP_LIMIT 10 -#define PHY_AUTO_NEG_LIMIT 45 -#define PHY_FORCE_LIMIT 20 +#define FIBER_LINK_UP_LIMIT 50 +#define COPPER_LINK_UP_LIMIT 10 +#define PHY_AUTO_NEG_LIMIT 45 +#define PHY_FORCE_LIMIT 20 /* Number of 100 microseconds we wait for PCI Express master disable */ -#define MASTER_DISABLE_TIMEOUT 800 +#define MASTER_DISABLE_TIMEOUT 800 /* Number of milliseconds we wait for PHY configuration done after MAC reset */ -#define PHY_CFG_TIMEOUT 100 +#define PHY_CFG_TIMEOUT 100 /* Number of 2 milliseconds we wait for acquiring MDIO ownership. */ -#define MDIO_OWNERSHIP_TIMEOUT 10 +#define MDIO_OWNERSHIP_TIMEOUT 10 /* Number of milliseconds for NVM auto read done after MAC reset. */ -#define AUTO_READ_DONE_TIMEOUT 10 +#define AUTO_READ_DONE_TIMEOUT 10 /* Flow Control */ -#define E1000_FCRTH_RTH 0x0000FFF8 /* Mask Bits[15:3] for RTH */ -#define E1000_FCRTH_XFCE 0x80000000 /* External Flow Control Enable */ -#define E1000_FCRTL_RTL 0x0000FFF8 /* Mask Bits[15:3] for RTL */ -#define E1000_FCRTL_XONE 0x80000000 /* Enable XON frame transmission */ +#define E1000_FCRTH_RTH 0x0000FFF8 /* Mask Bits[15:3] for RTH */ +#define E1000_FCRTH_XFCE 0x80000000 /* External Flow Control Enable */ +#define E1000_FCRTL_RTL 0x0000FFF8 /* Mask Bits[15:3] for RTL */ +#define E1000_FCRTL_XONE 0x80000000 /* Enable XON frame transmission */ /* Transmit Configuration Word */ -#define E1000_TXCW_FD 0x00000020 /* TXCW full duplex */ -#define E1000_TXCW_HD 0x00000040 /* TXCW half duplex */ -#define E1000_TXCW_PAUSE 0x00000080 /* TXCW sym pause request */ -#define E1000_TXCW_ASM_DIR 0x00000100 /* TXCW astm pause direction */ -#define E1000_TXCW_PAUSE_MASK 0x00000180 /* TXCW pause request mask */ -#define E1000_TXCW_RF 0x00003000 /* TXCW remote fault */ -#define E1000_TXCW_NP 0x00008000 /* TXCW next page */ -#define E1000_TXCW_CW 0x0000ffff /* TxConfigWord mask */ -#define E1000_TXCW_TXC 0x40000000 /* Transmit Config control */ -#define E1000_TXCW_ANE 0x80000000 /* Auto-neg enable */ +#define E1000_TXCW_FD 0x00000020 /* TXCW full duplex */ +#define E1000_TXCW_HD 0x00000040 /* TXCW half duplex */ +#define E1000_TXCW_PAUSE 0x00000080 /* TXCW sym pause request */ +#define E1000_TXCW_ASM_DIR 0x00000100 /* TXCW astm pause direction */ +#define E1000_TXCW_PAUSE_MASK 0x00000180 /* TXCW pause request mask */ +#define E1000_TXCW_RF 0x00003000 /* TXCW remote fault */ +#define E1000_TXCW_NP 0x00008000 /* TXCW next page */ +#define E1000_TXCW_CW 0x0000ffff /* TxConfigWord mask */ +#define E1000_TXCW_TXC 0x40000000 /* Transmit Config control */ +#define E1000_TXCW_ANE 0x80000000 /* Auto-neg enable */ /* Receive Configuration Word */ -#define E1000_RXCW_CW 0x0000ffff /* RxConfigWord mask */ -#define E1000_RXCW_NC 0x04000000 /* Receive config no carrier */ -#define E1000_RXCW_IV 0x08000000 /* Receive config invalid */ -#define E1000_RXCW_CC 0x10000000 /* Receive config change */ -#define E1000_RXCW_C 0x20000000 /* Receive config */ -#define E1000_RXCW_SYNCH 0x40000000 /* Receive config synch */ -#define E1000_RXCW_ANC 0x80000000 /* Auto-neg complete */ +#define E1000_RXCW_CW 0x0000ffff /* RxConfigWord mask */ +#define E1000_RXCW_NC 0x04000000 /* Receive config no carrier */ +#define E1000_RXCW_IV 0x08000000 /* Receive config invalid */ +#define E1000_RXCW_CC 0x10000000 /* Receive config change */ +#define E1000_RXCW_C 0x20000000 /* Receive config */ +#define E1000_RXCW_SYNCH 0x40000000 /* Receive config synch */ +#define E1000_RXCW_ANC 0x80000000 /* Auto-neg complete */ -#define E1000_TSYNCTXCTL_VALID 0x00000001 /* Tx timestamp valid */ -#define E1000_TSYNCTXCTL_ENABLED 0x00000010 /* enable Tx timestamping */ +#define E1000_TSYNCTXCTL_VALID 0x00000001 /* Tx timestamp valid */ +#define E1000_TSYNCTXCTL_ENABLED 0x00000010 /* enable Tx timestamping */ -#define E1000_TSYNCRXCTL_VALID 0x00000001 /* Rx timestamp valid */ -#define E1000_TSYNCRXCTL_TYPE_MASK 0x0000000E /* Rx type mask */ -#define E1000_TSYNCRXCTL_TYPE_L2_V2 0x00 -#define E1000_TSYNCRXCTL_TYPE_L4_V1 0x02 -#define E1000_TSYNCRXCTL_TYPE_L2_L4_V2 0x04 -#define E1000_TSYNCRXCTL_TYPE_ALL 0x08 -#define E1000_TSYNCRXCTL_TYPE_EVENT_V2 0x0A -#define E1000_TSYNCRXCTL_ENABLED 0x00000010 /* enable Rx timestamping */ +#define E1000_TSYNCRXCTL_VALID 0x00000001 /* Rx timestamp valid */ +#define E1000_TSYNCRXCTL_TYPE_MASK 0x0000000E /* Rx type mask */ +#define E1000_TSYNCRXCTL_TYPE_L2_V2 0x00 +#define E1000_TSYNCRXCTL_TYPE_L4_V1 0x02 +#define E1000_TSYNCRXCTL_TYPE_L2_L4_V2 0x04 +#define E1000_TSYNCRXCTL_TYPE_ALL 0x08 +#define E1000_TSYNCRXCTL_TYPE_EVENT_V2 0x0A +#define E1000_TSYNCRXCTL_ENABLED 0x00000010 /* enable Rx timestamping */ -#define E1000_TSYNCRXCFG_PTP_V1_CTRLT_MASK 0x000000FF -#define E1000_TSYNCRXCFG_PTP_V1_SYNC_MESSAGE 0x00 -#define E1000_TSYNCRXCFG_PTP_V1_DELAY_REQ_MESSAGE 0x01 -#define E1000_TSYNCRXCFG_PTP_V1_FOLLOWUP_MESSAGE 0x02 -#define E1000_TSYNCRXCFG_PTP_V1_DELAY_RESP_MESSAGE 0x03 -#define E1000_TSYNCRXCFG_PTP_V1_MANAGEMENT_MESSAGE 0x04 +#define E1000_TSYNCRXCFG_PTP_V1_CTRLT_MASK 0x000000FF +#define E1000_TSYNCRXCFG_PTP_V1_SYNC_MESSAGE 0x00 +#define E1000_TSYNCRXCFG_PTP_V1_DELAY_REQ_MESSAGE 0x01 +#define E1000_TSYNCRXCFG_PTP_V1_FOLLOWUP_MESSAGE 0x02 +#define E1000_TSYNCRXCFG_PTP_V1_DELAY_RESP_MESSAGE 0x03 +#define E1000_TSYNCRXCFG_PTP_V1_MANAGEMENT_MESSAGE 0x04 -#define E1000_TSYNCRXCFG_PTP_V2_MSGID_MASK 0x00000F00 -#define E1000_TSYNCRXCFG_PTP_V2_SYNC_MESSAGE 0x0000 -#define E1000_TSYNCRXCFG_PTP_V2_DELAY_REQ_MESSAGE 0x0100 -#define E1000_TSYNCRXCFG_PTP_V2_PATH_DELAY_REQ_MESSAGE 0x0200 -#define E1000_TSYNCRXCFG_PTP_V2_PATH_DELAY_RESP_MESSAGE 0x0300 -#define E1000_TSYNCRXCFG_PTP_V2_FOLLOWUP_MESSAGE 0x0800 -#define E1000_TSYNCRXCFG_PTP_V2_DELAY_RESP_MESSAGE 0x0900 -#define E1000_TSYNCRXCFG_PTP_V2_PATH_DELAY_FOLLOWUP_MESSAGE 0x0A00 -#define E1000_TSYNCRXCFG_PTP_V2_ANNOUNCE_MESSAGE 0x0B00 -#define E1000_TSYNCRXCFG_PTP_V2_SIGNALLING_MESSAGE 0x0C00 -#define E1000_TSYNCRXCFG_PTP_V2_MANAGEMENT_MESSAGE 0x0D00 +#define E1000_TSYNCRXCFG_PTP_V2_MSGID_MASK 0x00000F00 +#define E1000_TSYNCRXCFG_PTP_V2_SYNC_MESSAGE 0x0000 +#define E1000_TSYNCRXCFG_PTP_V2_DELAY_REQ_MESSAGE 0x0100 +#define E1000_TSYNCRXCFG_PTP_V2_PATH_DELAY_REQ_MESSAGE 0x0200 +#define E1000_TSYNCRXCFG_PTP_V2_PATH_DELAY_RESP_MESSAGE 0x0300 +#define E1000_TSYNCRXCFG_PTP_V2_FOLLOWUP_MESSAGE 0x0800 +#define E1000_TSYNCRXCFG_PTP_V2_DELAY_RESP_MESSAGE 0x0900 +#define E1000_TSYNCRXCFG_PTP_V2_PATH_DELAY_FOLLOWUP_MESSAGE 0x0A00 +#define E1000_TSYNCRXCFG_PTP_V2_ANNOUNCE_MESSAGE 0x0B00 +#define E1000_TSYNCRXCFG_PTP_V2_SIGNALLING_MESSAGE 0x0C00 +#define E1000_TSYNCRXCFG_PTP_V2_MANAGEMENT_MESSAGE 0x0D00 -#define E1000_TIMINCA_16NS_SHIFT 24 +#define E1000_TIMINCA_16NS_SHIFT 24 /* TUPLE Filtering Configuration */ -#define E1000_TTQF_DISABLE_MASK 0xF0008000 /* TTQF Disable Mask */ -#define E1000_TTQF_QUEUE_ENABLE 0x100 /* TTQF Queue Enable Bit */ -#define E1000_TTQF_PROTOCOL_MASK 0xFF /* TTQF Protocol Mask */ +#define E1000_TTQF_DISABLE_MASK 0xF0008000 /* TTQF Disable Mask */ +#define E1000_TTQF_QUEUE_ENABLE 0x100 /* TTQF Queue Enable Bit */ +#define E1000_TTQF_PROTOCOL_MASK 0xFF /* TTQF Protocol Mask */ /* TTQF TCP Bit, shift with E1000_TTQF_PROTOCOL SHIFT */ -#define E1000_TTQF_PROTOCOL_TCP 0x0 +#define E1000_TTQF_PROTOCOL_TCP 0x0 /* TTQF UDP Bit, shift with E1000_TTQF_PROTOCOL_SHIFT */ -#define E1000_TTQF_PROTOCOL_UDP 0x1 +#define E1000_TTQF_PROTOCOL_UDP 0x1 /* TTQF SCTP Bit, shift with E1000_TTQF_PROTOCOL_SHIFT */ -#define E1000_TTQF_PROTOCOL_SCTP 0x2 -#define E1000_TTQF_PROTOCOL_SHIFT 5 /* TTQF Protocol Shift */ -#define E1000_TTQF_QUEUE_SHIFT 16 /* TTQF Queue Shfit */ -#define E1000_TTQF_RX_QUEUE_MASK 0x70000 /* TTQF Queue Mask */ -#define E1000_TTQF_MASK_ENABLE 0x10000000 /* TTQF Mask Enable Bit */ -#define E1000_IMIR_CLEAR_MASK 0xF001FFFF /* IMIR Reg Clear Mask */ -#define E1000_IMIR_PORT_BYPASS 0x20000 /* IMIR Port Bypass Bit */ -#define E1000_IMIR_PRIORITY_SHIFT 29 /* IMIR Priority Shift */ -#define E1000_IMIREXT_CLEAR_MASK 0x7FFFF /* IMIREXT Reg Clear Mask */ +#define E1000_TTQF_PROTOCOL_SCTP 0x2 +#define E1000_TTQF_PROTOCOL_SHIFT 5 /* TTQF Protocol Shift */ +#define E1000_TTQF_QUEUE_SHIFT 16 /* TTQF Queue Shfit */ +#define E1000_TTQF_RX_QUEUE_MASK 0x70000 /* TTQF Queue Mask */ +#define E1000_TTQF_MASK_ENABLE 0x10000000 /* TTQF Mask Enable Bit */ +#define E1000_IMIR_CLEAR_MASK 0xF001FFFF /* IMIR Reg Clear Mask */ +#define E1000_IMIR_PORT_BYPASS 0x20000 /* IMIR Port Bypass Bit */ +#define E1000_IMIR_PRIORITY_SHIFT 29 /* IMIR Priority Shift */ +#define E1000_IMIREXT_CLEAR_MASK 0x7FFFF /* IMIREXT Reg Clear Mask */ -#define E1000_MDICNFG_EXT_MDIO 0x80000000 /* MDI ext/int destination */ -#define E1000_MDICNFG_COM_MDIO 0x40000000 /* MDI shared w/ lan 0 */ -#define E1000_MDICNFG_PHY_MASK 0x03E00000 -#define E1000_MDICNFG_PHY_SHIFT 21 +#define E1000_MDICNFG_EXT_MDIO 0x80000000 /* MDI ext/int destination */ +#define E1000_MDICNFG_COM_MDIO 0x40000000 /* MDI shared w/ lan 0 */ +#define E1000_MDICNFG_PHY_MASK 0x03E00000 +#define E1000_MDICNFG_PHY_SHIFT 21 -#define E1000_THSTAT_LOW_EVENT 0x20000000 /* Low thermal threshold */ -#define E1000_THSTAT_MID_EVENT 0x00200000 /* Mid thermal threshold */ -#define E1000_THSTAT_HIGH_EVENT 0x00002000 /* High thermal threshold */ -#define E1000_THSTAT_PWR_DOWN 0x00000001 /* Power Down Event */ -#define E1000_THSTAT_LINK_THROTTLE 0x00000002 /* Link Speed Throttle Event */ +#define E1000_THSTAT_LOW_EVENT 0x20000000 /* Low thermal threshold */ +#define E1000_THSTAT_MID_EVENT 0x00200000 /* Mid thermal threshold */ +#define E1000_THSTAT_HIGH_EVENT 0x00002000 /* High thermal threshold */ +#define E1000_THSTAT_PWR_DOWN 0x00000001 /* Power Down Event */ +#define E1000_THSTAT_LINK_THROTTLE 0x00000002 /* Link Spd Throttle Event */ -/* Powerville EEE defines */ -#define E1000_IPCNFG_EEE_1G_AN 0x00000008 /* IPCNFG EEE Enable 1G AN */ -#define E1000_IPCNFG_EEE_100M_AN 0x00000004 /* IPCNFG EEE Enable 100M AN */ -#define E1000_EEER_TX_LPI_EN 0x00010000 /* EEER Tx LPI Enable */ -#define E1000_EEER_RX_LPI_EN 0x00020000 /* EEER Rx LPI Enable */ -#define E1000_EEER_LPI_FC 0x00040000 /* EEER Enable on Flow Control*/ +/* I350 EEE defines */ +#define E1000_IPCNFG_EEE_1G_AN 0x00000008 /* IPCNFG EEE Ena 1G AN */ +#define E1000_IPCNFG_EEE_100M_AN 0x00000004 /* IPCNFG EEE Ena 100M AN */ +#define E1000_EEER_TX_LPI_EN 0x00010000 /* EEER Tx LPI Enable */ +#define E1000_EEER_RX_LPI_EN 0x00020000 /* EEER Rx LPI Enable */ +#define E1000_EEER_LPI_FC 0x00040000 /* EEER Ena on Flow Cntrl */ /* EEE status */ -#define E1000_EEER_EEE_NEG 0x20000000 /* EEE capability negotiated */ -#define E1000_EEER_RX_LPI_STATUS 0x40000000 /* Rx in LPI state */ -#define E1000_EEER_TX_LPI_STATUS 0x80000000 /* Tx in LPI state */ +#define E1000_EEER_EEE_NEG 0x20000000 /* EEE capability nego */ +#define E1000_EEER_RX_LPI_STATUS 0x40000000 /* Rx in LPI state */ +#define E1000_EEER_TX_LPI_STATUS 0x80000000 /* Tx in LPI state */ /* PCI Express Control */ -#define E1000_GCR_RXD_NO_SNOOP 0x00000001 -#define E1000_GCR_RXDSCW_NO_SNOOP 0x00000002 -#define E1000_GCR_RXDSCR_NO_SNOOP 0x00000004 -#define E1000_GCR_TXD_NO_SNOOP 0x00000008 -#define E1000_GCR_TXDSCW_NO_SNOOP 0x00000010 -#define E1000_GCR_TXDSCR_NO_SNOOP 0x00000020 -#define E1000_GCR_CMPL_TMOUT_MASK 0x0000F000 -#define E1000_GCR_CMPL_TMOUT_10ms 0x00001000 -#define E1000_GCR_CMPL_TMOUT_RESEND 0x00010000 -#define E1000_GCR_CAP_VER2 0x00040000 +#define E1000_GCR_RXD_NO_SNOOP 0x00000001 +#define E1000_GCR_RXDSCW_NO_SNOOP 0x00000002 +#define E1000_GCR_RXDSCR_NO_SNOOP 0x00000004 +#define E1000_GCR_TXD_NO_SNOOP 0x00000008 +#define E1000_GCR_TXDSCW_NO_SNOOP 0x00000010 +#define E1000_GCR_TXDSCR_NO_SNOOP 0x00000020 +#define E1000_GCR_CMPL_TMOUT_MASK 0x0000F000 +#define E1000_GCR_CMPL_TMOUT_10ms 0x00001000 +#define E1000_GCR_CMPL_TMOUT_RESEND 0x00010000 +#define E1000_GCR_CAP_VER2 0x00040000 -#define PCIE_NO_SNOOP_ALL (E1000_GCR_RXD_NO_SNOOP | \ - E1000_GCR_RXDSCW_NO_SNOOP | \ - E1000_GCR_RXDSCR_NO_SNOOP | \ - E1000_GCR_TXD_NO_SNOOP | \ - E1000_GCR_TXDSCW_NO_SNOOP | \ - E1000_GCR_TXDSCR_NO_SNOOP) +#define PCIE_NO_SNOOP_ALL (E1000_GCR_RXD_NO_SNOOP | \ + E1000_GCR_RXDSCW_NO_SNOOP | \ + E1000_GCR_RXDSCR_NO_SNOOP | \ + E1000_GCR_TXD_NO_SNOOP | \ + E1000_GCR_TXDSCW_NO_SNOOP | \ + E1000_GCR_TXDSCR_NO_SNOOP) + +/* mPHY address control and data registers */ +#define E1000_MPHY_ADDR_CTL 0x0024 /* Address Control Reg */ +#define E1000_MPHY_ADDR_CTL_OFFSET_MASK 0xFFFF0000 +#define E1000_MPHY_DATA 0x0E10 /* Data Register */ + +/* AFE CSR Offset for PCS CLK */ +#define E1000_MPHY_PCS_CLK_REG_OFFSET 0x0004 +/* Override for near end digital loopback. */ +#define E1000_MPHY_PCS_CLK_REG_DIGINELBEN 0x10 /* PHY Control Register */ -#define MII_CR_SPEED_SELECT_MSB 0x0040 /* bits 6,13: 10=1000, 01=100, 00=10 */ -#define MII_CR_COLL_TEST_ENABLE 0x0080 /* Collision test enable */ -#define MII_CR_FULL_DUPLEX 0x0100 /* FDX =1, half duplex =0 */ -#define MII_CR_RESTART_AUTO_NEG 0x0200 /* Restart auto negotiation */ -#define MII_CR_ISOLATE 0x0400 /* Isolate PHY from MII */ -#define MII_CR_POWER_DOWN 0x0800 /* Power down */ -#define MII_CR_AUTO_NEG_EN 0x1000 /* Auto Neg Enable */ -#define MII_CR_SPEED_SELECT_LSB 0x2000 /* bits 6,13: 10=1000, 01=100, 00=10 */ -#define MII_CR_LOOPBACK 0x4000 /* 0 = normal, 1 = loopback */ -#define MII_CR_RESET 0x8000 /* 0 = normal, 1 = PHY reset */ -#define MII_CR_SPEED_1000 0x0040 -#define MII_CR_SPEED_100 0x2000 -#define MII_CR_SPEED_10 0x0000 +#define MII_CR_SPEED_SELECT_MSB 0x0040 /* bits 6,13: 10=1000, 01=100, 00=10 */ +#define MII_CR_COLL_TEST_ENABLE 0x0080 /* Collision test enable */ +#define MII_CR_FULL_DUPLEX 0x0100 /* FDX =1, half duplex =0 */ +#define MII_CR_RESTART_AUTO_NEG 0x0200 /* Restart auto negotiation */ +#define MII_CR_ISOLATE 0x0400 /* Isolate PHY from MII */ +#define MII_CR_POWER_DOWN 0x0800 /* Power down */ +#define MII_CR_AUTO_NEG_EN 0x1000 /* Auto Neg Enable */ +#define MII_CR_SPEED_SELECT_LSB 0x2000 /* bits 6,13: 10=1000, 01=100, 00=10 */ +#define MII_CR_LOOPBACK 0x4000 /* 0 = normal, 1 = loopback */ +#define MII_CR_RESET 0x8000 /* 0 = normal, 1 = PHY reset */ +#define MII_CR_SPEED_1000 0x0040 +#define MII_CR_SPEED_100 0x2000 +#define MII_CR_SPEED_10 0x0000 /* PHY Status Register */ -#define MII_SR_EXTENDED_CAPS 0x0001 /* Extended register capabilities */ -#define MII_SR_JABBER_DETECT 0x0002 /* Jabber Detected */ -#define MII_SR_LINK_STATUS 0x0004 /* Link Status 1 = link */ -#define MII_SR_AUTONEG_CAPS 0x0008 /* Auto Neg Capable */ -#define MII_SR_REMOTE_FAULT 0x0010 /* Remote Fault Detect */ -#define MII_SR_AUTONEG_COMPLETE 0x0020 /* Auto Neg Complete */ +#define MII_SR_EXTENDED_CAPS 0x0001 /* Extended register capabilities */ +#define MII_SR_JABBER_DETECT 0x0002 /* Jabber Detected */ +#define MII_SR_LINK_STATUS 0x0004 /* Link Status 1 = link */ +#define MII_SR_AUTONEG_CAPS 0x0008 /* Auto Neg Capable */ +#define MII_SR_REMOTE_FAULT 0x0010 /* Remote Fault Detect */ +#define MII_SR_AUTONEG_COMPLETE 0x0020 /* Auto Neg Complete */ #define MII_SR_PREAMBLE_SUPPRESS 0x0040 /* Preamble may be suppressed */ -#define MII_SR_EXTENDED_STATUS 0x0100 /* Ext. status info in Reg 0x0F */ -#define MII_SR_100T2_HD_CAPS 0x0200 /* 100T2 Half Duplex Capable */ -#define MII_SR_100T2_FD_CAPS 0x0400 /* 100T2 Full Duplex Capable */ -#define MII_SR_10T_HD_CAPS 0x0800 /* 10T Half Duplex Capable */ -#define MII_SR_10T_FD_CAPS 0x1000 /* 10T Full Duplex Capable */ -#define MII_SR_100X_HD_CAPS 0x2000 /* 100X Half Duplex Capable */ -#define MII_SR_100X_FD_CAPS 0x4000 /* 100X Full Duplex Capable */ -#define MII_SR_100T4_CAPS 0x8000 /* 100T4 Capable */ +#define MII_SR_EXTENDED_STATUS 0x0100 /* Ext. status info in Reg 0x0F */ +#define MII_SR_100T2_HD_CAPS 0x0200 /* 100T2 Half Duplex Capable */ +#define MII_SR_100T2_FD_CAPS 0x0400 /* 100T2 Full Duplex Capable */ +#define MII_SR_10T_HD_CAPS 0x0800 /* 10T Half Duplex Capable */ +#define MII_SR_10T_FD_CAPS 0x1000 /* 10T Full Duplex Capable */ +#define MII_SR_100X_HD_CAPS 0x2000 /* 100X Half Duplex Capable */ +#define MII_SR_100X_FD_CAPS 0x4000 /* 100X Full Duplex Capable */ +#define MII_SR_100T4_CAPS 0x8000 /* 100T4 Capable */ /* Autoneg Advertisement Register */ -#define NWAY_AR_SELECTOR_FIELD 0x0001 /* indicates IEEE 802.3 CSMA/CD */ -#define NWAY_AR_10T_HD_CAPS 0x0020 /* 10T Half Duplex Capable */ -#define NWAY_AR_10T_FD_CAPS 0x0040 /* 10T Full Duplex Capable */ -#define NWAY_AR_100TX_HD_CAPS 0x0080 /* 100TX Half Duplex Capable */ -#define NWAY_AR_100TX_FD_CAPS 0x0100 /* 100TX Full Duplex Capable */ -#define NWAY_AR_100T4_CAPS 0x0200 /* 100T4 Capable */ -#define NWAY_AR_PAUSE 0x0400 /* Pause operation desired */ -#define NWAY_AR_ASM_DIR 0x0800 /* Asymmetric Pause Direction bit */ -#define NWAY_AR_REMOTE_FAULT 0x2000 /* Remote Fault detected */ -#define NWAY_AR_NEXT_PAGE 0x8000 /* Next Page ability supported */ +#define NWAY_AR_SELECTOR_FIELD 0x0001 /* indicates IEEE 802.3 CSMA/CD */ +#define NWAY_AR_10T_HD_CAPS 0x0020 /* 10T Half Duplex Capable */ +#define NWAY_AR_10T_FD_CAPS 0x0040 /* 10T Full Duplex Capable */ +#define NWAY_AR_100TX_HD_CAPS 0x0080 /* 100TX Half Duplex Capable */ +#define NWAY_AR_100TX_FD_CAPS 0x0100 /* 100TX Full Duplex Capable */ +#define NWAY_AR_100T4_CAPS 0x0200 /* 100T4 Capable */ +#define NWAY_AR_PAUSE 0x0400 /* Pause operation desired */ +#define NWAY_AR_ASM_DIR 0x0800 /* Asymmetric Pause Direction bit */ +#define NWAY_AR_REMOTE_FAULT 0x2000 /* Remote Fault detected */ +#define NWAY_AR_NEXT_PAGE 0x8000 /* Next Page ability supported */ /* Link Partner Ability Register (Base Page) */ -#define NWAY_LPAR_SELECTOR_FIELD 0x0000 /* LP protocol selector field */ -#define NWAY_LPAR_10T_HD_CAPS 0x0020 /* LP is 10T Half Duplex Capable */ -#define NWAY_LPAR_10T_FD_CAPS 0x0040 /* LP is 10T Full Duplex Capable */ -#define NWAY_LPAR_100TX_HD_CAPS 0x0080 /* LP is 100TX Half Duplex Capable */ -#define NWAY_LPAR_100TX_FD_CAPS 0x0100 /* LP is 100TX Full Duplex Capable */ -#define NWAY_LPAR_100T4_CAPS 0x0200 /* LP is 100T4 Capable */ -#define NWAY_LPAR_PAUSE 0x0400 /* LP Pause operation desired */ -#define NWAY_LPAR_ASM_DIR 0x0800 /* LP Asymmetric Pause Direction bit */ -#define NWAY_LPAR_REMOTE_FAULT 0x2000 /* LP has detected Remote Fault */ -#define NWAY_LPAR_ACKNOWLEDGE 0x4000 /* LP has rx'd link code word */ -#define NWAY_LPAR_NEXT_PAGE 0x8000 /* Next Page ability supported */ +#define NWAY_LPAR_SELECTOR_FIELD 0x0000 /* LP protocol selector field */ +#define NWAY_LPAR_10T_HD_CAPS 0x0020 /* LP 10T Half Dplx Capable */ +#define NWAY_LPAR_10T_FD_CAPS 0x0040 /* LP 10T Full Dplx Capable */ +#define NWAY_LPAR_100TX_HD_CAPS 0x0080 /* LP 100TX Half Dplx Capable */ +#define NWAY_LPAR_100TX_FD_CAPS 0x0100 /* LP 100TX Full Dplx Capable */ +#define NWAY_LPAR_100T4_CAPS 0x0200 /* LP is 100T4 Capable */ +#define NWAY_LPAR_PAUSE 0x0400 /* LP Pause operation desired */ +#define NWAY_LPAR_ASM_DIR 0x0800 /* LP Asym Pause Direction bit */ +#define NWAY_LPAR_REMOTE_FAULT 0x2000 /* LP detected Remote Fault */ +#define NWAY_LPAR_ACKNOWLEDGE 0x4000 /* LP rx'd link code word */ +#define NWAY_LPAR_NEXT_PAGE 0x8000 /* Next Page ability supported */ /* Autoneg Expansion Register */ -#define NWAY_ER_LP_NWAY_CAPS 0x0001 /* LP has Auto Neg Capability */ -#define NWAY_ER_PAGE_RXD 0x0002 /* LP is 10T Half Duplex Capable */ -#define NWAY_ER_NEXT_PAGE_CAPS 0x0004 /* LP is 10T Full Duplex Capable */ -#define NWAY_ER_LP_NEXT_PAGE_CAPS 0x0008 /* LP is 100TX Half Duplex Capable */ -#define NWAY_ER_PAR_DETECT_FAULT 0x0010 /* LP is 100TX Full Duplex Capable */ +#define NWAY_ER_LP_NWAY_CAPS 0x0001 /* LP has Auto Neg Capability */ +#define NWAY_ER_PAGE_RXD 0x0002 /* LP 10T Half Dplx Capable */ +#define NWAY_ER_NEXT_PAGE_CAPS 0x0004 /* LP 10T Full Dplx Capable */ +#define NWAY_ER_LP_NEXT_PAGE_CAPS 0x0008 /* LP 100TX Half Dplx Capable */ +#define NWAY_ER_PAR_DETECT_FAULT 0x0010 /* LP 100TX Full Dplx Capable */ /* 1000BASE-T Control Register */ -#define CR_1000T_ASYM_PAUSE 0x0080 /* Advertise asymmetric pause bit */ -#define CR_1000T_HD_CAPS 0x0100 /* Advertise 1000T HD capability */ -#define CR_1000T_FD_CAPS 0x0200 /* Advertise 1000T FD capability */ -#define CR_1000T_REPEATER_DTE 0x0400 /* 1=Repeater/switch device port */ - /* 0=DTE device */ -#define CR_1000T_MS_VALUE 0x0800 /* 1=Configure PHY as Master */ - /* 0=Configure PHY as Slave */ -#define CR_1000T_MS_ENABLE 0x1000 /* 1=Master/Slave manual config value */ - /* 0=Automatic Master/Slave config */ +#define CR_1000T_ASYM_PAUSE 0x0080 /* Advertise asymmetric pause bit */ +#define CR_1000T_HD_CAPS 0x0100 /* Advertise 1000T HD capability */ +#define CR_1000T_FD_CAPS 0x0200 /* Advertise 1000T FD capability */ +/* 1=Repeater/switch device port 0=DTE device */ +#define CR_1000T_REPEATER_DTE 0x0400 +/* 1=Configure PHY as Master 0=Configure PHY as Slave */ +#define CR_1000T_MS_VALUE 0x0800 +/* 1=Master/Slave manual config value 0=Automatic Master/Slave config */ +#define CR_1000T_MS_ENABLE 0x1000 #define CR_1000T_TEST_MODE_NORMAL 0x0000 /* Normal Operation */ -#define CR_1000T_TEST_MODE_1 0x2000 /* Transmit Waveform test */ -#define CR_1000T_TEST_MODE_2 0x4000 /* Master Transmit Jitter test */ -#define CR_1000T_TEST_MODE_3 0x6000 /* Slave Transmit Jitter test */ -#define CR_1000T_TEST_MODE_4 0x8000 /* Transmitter Distortion test */ +#define CR_1000T_TEST_MODE_1 0x2000 /* Transmit Waveform test */ +#define CR_1000T_TEST_MODE_2 0x4000 /* Master Transmit Jitter test */ +#define CR_1000T_TEST_MODE_3 0x6000 /* Slave Transmit Jitter test */ +#define CR_1000T_TEST_MODE_4 0x8000 /* Transmitter Distortion test */ /* 1000BASE-T Status Register */ -#define SR_1000T_IDLE_ERROR_CNT 0x00FF /* Num idle errors since last read */ -#define SR_1000T_ASYM_PAUSE_DIR 0x0100 /* LP asymmetric pause direction bit */ -#define SR_1000T_LP_HD_CAPS 0x0400 /* LP is 1000T HD capable */ -#define SR_1000T_LP_FD_CAPS 0x0800 /* LP is 1000T FD capable */ -#define SR_1000T_REMOTE_RX_STATUS 0x1000 /* Remote receiver OK */ -#define SR_1000T_LOCAL_RX_STATUS 0x2000 /* Local receiver OK */ -#define SR_1000T_MS_CONFIG_RES 0x4000 /* 1=Local Tx is Master, 0=Slave */ -#define SR_1000T_MS_CONFIG_FAULT 0x8000 /* Master/Slave config fault */ +#define SR_1000T_IDLE_ERROR_CNT 0x00FF /* Num idle err since last rd */ +#define SR_1000T_ASYM_PAUSE_DIR 0x0100 /* LP asym pause direction bit */ +#define SR_1000T_LP_HD_CAPS 0x0400 /* LP is 1000T HD capable */ +#define SR_1000T_LP_FD_CAPS 0x0800 /* LP is 1000T FD capable */ +#define SR_1000T_REMOTE_RX_STATUS 0x1000 /* Remote receiver OK */ +#define SR_1000T_LOCAL_RX_STATUS 0x2000 /* Local receiver OK */ +#define SR_1000T_MS_CONFIG_RES 0x4000 /* 1=Local Tx Master, 0=Slave */ +#define SR_1000T_MS_CONFIG_FAULT 0x8000 /* Master/Slave config fault */ -#define SR_1000T_PHY_EXCESSIVE_IDLE_ERR_COUNT 5 +#define SR_1000T_PHY_EXCESSIVE_IDLE_ERR_COUNT 5 /* PHY 1000 MII Register/Bit Definitions */ /* PHY Registers defined by IEEE */ -#define PHY_CONTROL 0x00 /* Control Register */ -#define PHY_STATUS 0x01 /* Status Register */ -#define PHY_ID1 0x02 /* Phy Id Reg (word 1) */ -#define PHY_ID2 0x03 /* Phy Id Reg (word 2) */ -#define PHY_AUTONEG_ADV 0x04 /* Autoneg Advertisement */ -#define PHY_LP_ABILITY 0x05 /* Link Partner Ability (Base Page) */ -#define PHY_AUTONEG_EXP 0x06 /* Autoneg Expansion Reg */ -#define PHY_NEXT_PAGE_TX 0x07 /* Next Page Tx */ -#define PHY_LP_NEXT_PAGE 0x08 /* Link Partner Next Page */ -#define PHY_1000T_CTRL 0x09 /* 1000Base-T Control Reg */ -#define PHY_1000T_STATUS 0x0A /* 1000Base-T Status Reg */ -#define PHY_EXT_STATUS 0x0F /* Extended Status Reg */ +#define PHY_CONTROL 0x00 /* Control Register */ +#define PHY_STATUS 0x01 /* Status Register */ +#define PHY_ID1 0x02 /* Phy Id Reg (word 1) */ +#define PHY_ID2 0x03 /* Phy Id Reg (word 2) */ +#define PHY_AUTONEG_ADV 0x04 /* Autoneg Advertisement */ +#define PHY_LP_ABILITY 0x05 /* Link Partner Ability (Base Page) */ +#define PHY_AUTONEG_EXP 0x06 /* Autoneg Expansion Reg */ +#define PHY_NEXT_PAGE_TX 0x07 /* Next Page Tx */ +#define PHY_LP_NEXT_PAGE 0x08 /* Link Partner Next Page */ +#define PHY_1000T_CTRL 0x09 /* 1000Base-T Control Reg */ +#define PHY_1000T_STATUS 0x0A /* 1000Base-T Status Reg */ +#define PHY_EXT_STATUS 0x0F /* Extended Status Reg */ -#define PHY_CONTROL_LB 0x4000 /* PHY Loopback bit */ +#define PHY_CONTROL_LB 0x4000 /* PHY Loopback bit */ /* NVM Control */ -#define E1000_EECD_SK 0x00000001 /* NVM Clock */ -#define E1000_EECD_CS 0x00000002 /* NVM Chip Select */ -#define E1000_EECD_DI 0x00000004 /* NVM Data In */ -#define E1000_EECD_DO 0x00000008 /* NVM Data Out */ -#define E1000_EECD_FWE_MASK 0x00000030 -#define E1000_EECD_FWE_DIS 0x00000010 /* Disable FLASH writes */ -#define E1000_EECD_FWE_EN 0x00000020 /* Enable FLASH writes */ -#define E1000_EECD_FWE_SHIFT 4 -#define E1000_EECD_REQ 0x00000040 /* NVM Access Request */ -#define E1000_EECD_GNT 0x00000080 /* NVM Access Grant */ -#define E1000_EECD_PRES 0x00000100 /* NVM Present */ -#define E1000_EECD_SIZE 0x00000200 /* NVM Size (0=64 word 1=256 word) */ +#define E1000_EECD_SK 0x00000001 /* NVM Clock */ +#define E1000_EECD_CS 0x00000002 /* NVM Chip Select */ +#define E1000_EECD_DI 0x00000004 /* NVM Data In */ +#define E1000_EECD_DO 0x00000008 /* NVM Data Out */ +#define E1000_EECD_FWE_MASK 0x00000030 +#define E1000_EECD_FWE_DIS 0x00000010 /* Disable FLASH writes */ +#define E1000_EECD_FWE_EN 0x00000020 /* Enable FLASH writes */ +#define E1000_EECD_FWE_SHIFT 4 +#define E1000_EECD_REQ 0x00000040 /* NVM Access Request */ +#define E1000_EECD_GNT 0x00000080 /* NVM Access Grant */ +#define E1000_EECD_PRES 0x00000100 /* NVM Present */ +#define E1000_EECD_SIZE 0x00000200 /* NVM Size (0=64 word 1=256 word) */ +#define E1000_EECD_BLOCKED 0x00008000 /* Bit banging access blocked flag */ +#define E1000_EECD_ABORT 0x00010000 /* NVM operation aborted flag */ +#define E1000_EECD_TIMEOUT 0x00020000 /* NVM read operation timeout flag */ +#define E1000_EECD_ERROR_CLR 0x00040000 /* NVM error status clear bit */ /* NVM Addressing bits based on type 0=small, 1=large */ -#define E1000_EECD_ADDR_BITS 0x00000400 -#define E1000_EECD_TYPE 0x00002000 /* NVM Type (1-SPI, 0-Microwire) */ +#define E1000_EECD_ADDR_BITS 0x00000400 +#define E1000_EECD_TYPE 0x00002000 /* NVM Type (1-SPI, 0-Microwire) */ #ifndef E1000_NVM_GRANT_ATTEMPTS -#define E1000_NVM_GRANT_ATTEMPTS 1000 /* NVM # attempts to gain grant */ +#define E1000_NVM_GRANT_ATTEMPTS 1000 /* NVM # attempts to gain grant */ #endif -#define E1000_EECD_AUTO_RD 0x00000200 /* NVM Auto Read done */ -#define E1000_EECD_SIZE_EX_MASK 0x00007800 /* NVM Size */ -#define E1000_EECD_SIZE_EX_SHIFT 11 -#define E1000_EECD_NVADDS 0x00018000 /* NVM Address Size */ -#define E1000_EECD_SELSHAD 0x00020000 /* Select Shadow RAM */ -#define E1000_EECD_INITSRAM 0x00040000 /* Initialize Shadow RAM */ -#define E1000_EECD_FLUPD 0x00080000 /* Update FLASH */ -#define E1000_EECD_AUPDEN 0x00100000 /* Enable Autonomous FLASH update */ -#define E1000_EECD_SHADV 0x00200000 /* Shadow RAM Data Valid */ -#define E1000_EECD_SEC1VAL 0x00400000 /* Sector One Valid */ -#define E1000_EECD_SECVAL_SHIFT 22 -#define E1000_EECD_SEC1VAL_VALID_MASK (E1000_EECD_AUTO_RD | E1000_EECD_PRES) +#define E1000_EECD_AUTO_RD 0x00000200 /* NVM Auto Read done */ +#define E1000_EECD_SIZE_EX_MASK 0x00007800 /* NVM Size */ +#define E1000_EECD_SIZE_EX_SHIFT 11 +#define E1000_EECD_NVADDS 0x00018000 /* NVM Address Size */ +#define E1000_EECD_SELSHAD 0x00020000 /* Select Shadow RAM */ +#define E1000_EECD_INITSRAM 0x00040000 /* Initialize Shadow RAM */ +#define E1000_EECD_FLUPD 0x00080000 /* Update FLASH */ +#define E1000_EECD_AUPDEN 0x00100000 /* Ena Auto FLASH update */ +#define E1000_EECD_SHADV 0x00200000 /* Shadow RAM Data Valid */ +#define E1000_EECD_SEC1VAL 0x00400000 /* Sector One Valid */ +#define E1000_EECD_SECVAL_SHIFT 22 +#define E1000_EECD_SEC1VAL_VALID_MASK (E1000_EECD_AUTO_RD | E1000_EECD_PRES) +#define E1000_EECD_FLUPD_I210 0x00800000 /* Update FLASH */ +#define E1000_EECD_FLUDONE_I210 0x04000000 /* Update FLASH done */ +#define E1000_EECD_FLASH_DETECTED_I210 0x00080000 /* FLASH detected */ +#define E1000_FLUDONE_ATTEMPTS 20000 +#define E1000_EERD_EEWR_MAX_COUNT 512 /* buffered EEPROM words rw */ +#define E1000_I210_FIFO_SEL_RX 0x00 +#define E1000_I210_FIFO_SEL_TX_QAV(_i) (0x02 + (_i)) +#define E1000_I210_FIFO_SEL_TX_LEGACY E1000_I210_FIFO_SEL_TX_QAV(0) +#define E1000_I210_FIFO_SEL_BMC2OS_TX 0x06 +#define E1000_I210_FIFO_SEL_BMC2OS_RX 0x01 -#define E1000_NVM_SWDPIN0 0x0001 /* SWDPIN 0 NVM Value */ -#define E1000_NVM_LED_LOGIC 0x0020 /* Led Logic Word */ -#define E1000_NVM_RW_REG_DATA 16 /* Offset to data in NVM read/write regs */ -#define E1000_NVM_RW_REG_DONE 2 /* Offset to READ/WRITE done bit */ -#define E1000_NVM_RW_REG_START 1 /* Start operation */ -#define E1000_NVM_RW_ADDR_SHIFT 2 /* Shift to the address bits */ -#define E1000_NVM_POLL_WRITE 1 /* Flag for polling for write complete */ -#define E1000_NVM_POLL_READ 0 /* Flag for polling for read complete */ -#define E1000_FLASH_UPDATES 2000 +#define E1000_NVM_SWDPIN0 0x0001 /* SWDPIN 0 NVM Value */ +#define E1000_NVM_LED_LOGIC 0x0020 /* Led Logic Word */ +#define E1000_NVM_RW_REG_DATA 16 /* Offset to data in NVM read/write regs */ +#define E1000_NVM_RW_REG_DONE 2 /* Offset to READ/WRITE done bit */ +#define E1000_NVM_RW_REG_START 1 /* Start operation */ +#define E1000_NVM_RW_ADDR_SHIFT 2 /* Shift to the address bits */ +#define E1000_NVM_POLL_WRITE 1 /* Flag for polling for write complete */ +#define E1000_NVM_POLL_READ 0 /* Flag for polling for read complete */ +#define E1000_FLASH_UPDATES 2000 /* NVM Word Offsets */ -#define NVM_COMPAT 0x0003 -#define NVM_ID_LED_SETTINGS 0x0004 -#define NVM_VERSION 0x0005 -#define NVM_SERDES_AMPLITUDE 0x0006 /* SERDES output amplitude */ -#define NVM_PHY_CLASS_WORD 0x0007 -#define NVM_INIT_CONTROL1_REG 0x000A -#define NVM_INIT_CONTROL2_REG 0x000F -#define NVM_SWDEF_PINS_CTRL_PORT_1 0x0010 -#define NVM_INIT_CONTROL3_PORT_B 0x0014 -#define NVM_INIT_3GIO_3 0x001A -#define NVM_SWDEF_PINS_CTRL_PORT_0 0x0020 -#define NVM_INIT_CONTROL3_PORT_A 0x0024 -#define NVM_CFG 0x0012 -#define NVM_FLASH_VERSION 0x0032 -#define NVM_ALT_MAC_ADDR_PTR 0x0037 -#define NVM_CHECKSUM_REG 0x003F -#define NVM_COMPATIBILITY_REG_3 0x0003 -#define NVM_COMPATIBILITY_BIT_MASK 0x8000 +#define NVM_COMPAT 0x0003 +#define NVM_ID_LED_SETTINGS 0x0004 +#define NVM_VERSION 0x0005 +#define NVM_SERDES_AMPLITUDE 0x0006 /* SERDES output amplitude */ +#define NVM_PHY_CLASS_WORD 0x0007 +#define NVM_ETRACK_WORD 0x0042 +#define NVM_COMB_VER_OFF 0x0083 +#define NVM_COMB_VER_PTR 0x003d -#define E1000_NVM_CFG_DONE_PORT_0 0x040000 /* MNG config cycle done */ -#define E1000_NVM_CFG_DONE_PORT_1 0x080000 /* ...for second port */ -#define E1000_NVM_CFG_DONE_PORT_2 0x100000 /* ...for third port */ -#define E1000_NVM_CFG_DONE_PORT_3 0x200000 /* ...for fourth port */ +#define NVM_MAC_ADDR 0x0000 +#define NVM_SUB_DEV_ID 0x000B +#define NVM_SUB_VEN_ID 0x000C +#define NVM_DEV_ID 0x000D +#define NVM_VEN_ID 0x000E +#define NVM_INIT_CTRL_2 0x000F +#define NVM_INIT_CTRL_4 0x0013 +#define NVM_LED_1_CFG 0x001C +#define NVM_LED_0_2_CFG 0x001F -#define NVM_82580_LAN_FUNC_OFFSET(a) (a ? (0x40 + (0x40 * a)) : 0) +#define NVM_INIT_CONTROL1_REG 0x000A +#define NVM_INIT_CONTROL2_REG 0x000F +#define NVM_SWDEF_PINS_CTRL_PORT_1 0x0010 +#define NVM_INIT_CONTROL3_PORT_B 0x0014 +#define NVM_INIT_3GIO_3 0x001A +#define NVM_SWDEF_PINS_CTRL_PORT_0 0x0020 +#define NVM_INIT_CONTROL3_PORT_A 0x0024 +#define NVM_CFG 0x0012 +#define NVM_FLASH_VERSION 0x0032 +#define NVM_ALT_MAC_ADDR_PTR 0x0037 +#define NVM_CHECKSUM_REG 0x003F +#define NVM_COMPATIBILITY_REG_3 0x0003 +#define NVM_COMPATIBILITY_BIT_MASK 0x8000 + +#define E1000_NVM_CFG_DONE_PORT_0 0x040000 /* MNG config cycle done */ +#define E1000_NVM_CFG_DONE_PORT_1 0x080000 /* ...for second port */ +#define E1000_NVM_CFG_DONE_PORT_2 0x100000 /* ...for third port */ +#define E1000_NVM_CFG_DONE_PORT_3 0x200000 /* ...for fourth port */ + +#define NVM_82580_LAN_FUNC_OFFSET(a) ((a) ? (0x40 + (0x40 * (a))) : 0) /* Mask bits for fields in Word 0x24 of the NVM */ -#define NVM_WORD24_COM_MDIO 0x0008 /* MDIO interface shared */ -#define NVM_WORD24_EXT_MDIO 0x0004 /* MDIO accesses routed external */ +#define NVM_WORD24_COM_MDIO 0x0008 /* MDIO interface shared */ +#define NVM_WORD24_EXT_MDIO 0x0004 /* MDIO accesses routed extrnl */ +/* Offset of Link Mode bits for 82575/82576 */ +#define NVM_WORD24_LNK_MODE_OFFSET 8 +/* Offset of Link Mode bits for 82580 up */ +#define NVM_WORD24_82580_LNK_MODE_OFFSET 4 + /* Mask bits for fields in Word 0x0f of the NVM */ -#define NVM_WORD0F_PAUSE_MASK 0x3000 -#define NVM_WORD0F_PAUSE 0x1000 -#define NVM_WORD0F_ASM_DIR 0x2000 -#define NVM_WORD0F_ANE 0x0800 -#define NVM_WORD0F_SWPDIO_EXT_MASK 0x00F0 -#define NVM_WORD0F_LPLU 0x0001 +#define NVM_WORD0F_PAUSE_MASK 0x3000 +#define NVM_WORD0F_PAUSE 0x1000 +#define NVM_WORD0F_ASM_DIR 0x2000 +#define NVM_WORD0F_ANE 0x0800 +#define NVM_WORD0F_SWPDIO_EXT_MASK 0x00F0 +#define NVM_WORD0F_LPLU 0x0001 /* Mask bits for fields in Word 0x1a of the NVM */ -#define NVM_WORD1A_ASPM_MASK 0x000C +#define NVM_WORD1A_ASPM_MASK 0x000C /* Mask bits for fields in Word 0x03 of the EEPROM */ -#define NVM_COMPAT_LOM 0x0800 +#define NVM_COMPAT_LOM 0x0800 /* length of string needed to store PBA number */ -#define E1000_PBANUM_LENGTH 11 +#define E1000_PBANUM_LENGTH 11 /* For checksumming, the sum of all words in the NVM should equal 0xBABA. */ -#define NVM_SUM 0xBABA +#define NVM_SUM 0xBABA -#define NVM_MAC_ADDR_OFFSET 0 -#define NVM_PBA_OFFSET_0 8 -#define NVM_PBA_OFFSET_1 9 -#define NVM_PBA_PTR_GUARD 0xFAFA -#define NVM_RESERVED_WORD 0xFFFF -#define NVM_PHY_CLASS_A 0x8000 -#define NVM_SERDES_AMPLITUDE_MASK 0x000F -#define NVM_SIZE_MASK 0x1C00 -#define NVM_SIZE_SHIFT 10 -#define NVM_WORD_SIZE_BASE_SHIFT 6 -#define NVM_SWDPIO_EXT_SHIFT 4 +#define NVM_MAC_ADDR_OFFSET 0 +#define NVM_PBA_OFFSET_0 8 +#define NVM_PBA_OFFSET_1 9 +#define NVM_PBA_PTR_GUARD 0xFAFA +#define NVM_RESERVED_WORD 0xFFFF +#define NVM_PHY_CLASS_A 0x8000 +#define NVM_SERDES_AMPLITUDE_MASK 0x000F +#define NVM_SIZE_MASK 0x1C00 +#define NVM_SIZE_SHIFT 10 +#define NVM_WORD_SIZE_BASE_SHIFT 6 +#define NVM_SWDPIO_EXT_SHIFT 4 /* NVM Commands - Microwire */ -#define NVM_READ_OPCODE_MICROWIRE 0x6 /* NVM read opcode */ -#define NVM_WRITE_OPCODE_MICROWIRE 0x5 /* NVM write opcode */ -#define NVM_ERASE_OPCODE_MICROWIRE 0x7 /* NVM erase opcode */ -#define NVM_EWEN_OPCODE_MICROWIRE 0x13 /* NVM erase/write enable */ -#define NVM_EWDS_OPCODE_MICROWIRE 0x10 /* NVM erase/write disable */ +#define NVM_READ_OPCODE_MICROWIRE 0x6 /* NVM read opcode */ +#define NVM_WRITE_OPCODE_MICROWIRE 0x5 /* NVM write opcode */ +#define NVM_ERASE_OPCODE_MICROWIRE 0x7 /* NVM erase opcode */ +#define NVM_EWEN_OPCODE_MICROWIRE 0x13 /* NVM erase/write enable */ +#define NVM_EWDS_OPCODE_MICROWIRE 0x10 /* NVM erase/write disable */ /* NVM Commands - SPI */ -#define NVM_MAX_RETRY_SPI 5000 /* Max wait of 5ms, for RDY signal */ -#define NVM_READ_OPCODE_SPI 0x03 /* NVM read opcode */ -#define NVM_WRITE_OPCODE_SPI 0x02 /* NVM write opcode */ -#define NVM_A8_OPCODE_SPI 0x08 /* opcode bit-3 = address bit-8 */ -#define NVM_WREN_OPCODE_SPI 0x06 /* NVM set Write Enable latch */ -#define NVM_WRDI_OPCODE_SPI 0x04 /* NVM reset Write Enable latch */ -#define NVM_RDSR_OPCODE_SPI 0x05 /* NVM read Status register */ -#define NVM_WRSR_OPCODE_SPI 0x01 /* NVM write Status register */ +#define NVM_MAX_RETRY_SPI 5000 /* Max wait of 5ms, for RDY signal */ +#define NVM_READ_OPCODE_SPI 0x03 /* NVM read opcode */ +#define NVM_WRITE_OPCODE_SPI 0x02 /* NVM write opcode */ +#define NVM_A8_OPCODE_SPI 0x08 /* opcode bit-3 = address bit-8 */ +#define NVM_WREN_OPCODE_SPI 0x06 /* NVM set Write Enable latch */ +#define NVM_WRDI_OPCODE_SPI 0x04 /* NVM reset Write Enable latch */ +#define NVM_RDSR_OPCODE_SPI 0x05 /* NVM read Status register */ +#define NVM_WRSR_OPCODE_SPI 0x01 /* NVM write Status register */ /* SPI NVM Status Register */ -#define NVM_STATUS_RDY_SPI 0x01 -#define NVM_STATUS_WEN_SPI 0x02 -#define NVM_STATUS_BP0_SPI 0x04 -#define NVM_STATUS_BP1_SPI 0x08 -#define NVM_STATUS_WPEN_SPI 0x80 +#define NVM_STATUS_RDY_SPI 0x01 +#define NVM_STATUS_WEN_SPI 0x02 +#define NVM_STATUS_BP0_SPI 0x04 +#define NVM_STATUS_BP1_SPI 0x08 +#define NVM_STATUS_WPEN_SPI 0x80 /* Word definitions for ID LED Settings */ -#define ID_LED_RESERVED_0000 0x0000 -#define ID_LED_RESERVED_FFFF 0xFFFF -#define ID_LED_DEFAULT ((ID_LED_OFF1_ON2 << 12) | \ - (ID_LED_OFF1_OFF2 << 8) | \ - (ID_LED_DEF1_DEF2 << 4) | \ - (ID_LED_DEF1_DEF2)) -#define ID_LED_DEF1_DEF2 0x1 -#define ID_LED_DEF1_ON2 0x2 -#define ID_LED_DEF1_OFF2 0x3 -#define ID_LED_ON1_DEF2 0x4 -#define ID_LED_ON1_ON2 0x5 -#define ID_LED_ON1_OFF2 0x6 -#define ID_LED_OFF1_DEF2 0x7 -#define ID_LED_OFF1_ON2 0x8 -#define ID_LED_OFF1_OFF2 0x9 +#define ID_LED_RESERVED_0000 0x0000 +#define ID_LED_RESERVED_FFFF 0xFFFF +#define ID_LED_DEFAULT ((ID_LED_OFF1_ON2 << 12) | \ + (ID_LED_OFF1_OFF2 << 8) | \ + (ID_LED_DEF1_DEF2 << 4) | \ + (ID_LED_DEF1_DEF2)) +#define ID_LED_DEF1_DEF2 0x1 +#define ID_LED_DEF1_ON2 0x2 +#define ID_LED_DEF1_OFF2 0x3 +#define ID_LED_ON1_DEF2 0x4 +#define ID_LED_ON1_ON2 0x5 +#define ID_LED_ON1_OFF2 0x6 +#define ID_LED_OFF1_DEF2 0x7 +#define ID_LED_OFF1_ON2 0x8 +#define ID_LED_OFF1_OFF2 0x9 -#define IGP_ACTIVITY_LED_MASK 0xFFFFF0FF -#define IGP_ACTIVITY_LED_ENABLE 0x0300 -#define IGP_LED3_MODE 0x07000000 +#define IGP_ACTIVITY_LED_MASK 0xFFFFF0FF +#define IGP_ACTIVITY_LED_ENABLE 0x0300 +#define IGP_LED3_MODE 0x07000000 /* PCI/PCI-X/PCI-EX Config space */ -#define PCIX_COMMAND_REGISTER 0xE6 -#define PCIX_STATUS_REGISTER_LO 0xE8 -#define PCIX_STATUS_REGISTER_HI 0xEA -#define PCI_HEADER_TYPE_REGISTER 0x0E -#define PCIE_LINK_STATUS 0x12 -#define PCIE_DEVICE_CONTROL2 0x28 +#define PCIX_COMMAND_REGISTER 0xE6 +#define PCIX_STATUS_REGISTER_LO 0xE8 +#define PCIX_STATUS_REGISTER_HI 0xEA +#define PCI_HEADER_TYPE_REGISTER 0x0E +#define PCIE_LINK_STATUS 0x12 +#define PCIE_DEVICE_CONTROL2 0x28 -#define PCIX_COMMAND_MMRBC_MASK 0x000C -#define PCIX_COMMAND_MMRBC_SHIFT 0x2 -#define PCIX_STATUS_HI_MMRBC_MASK 0x0060 -#define PCIX_STATUS_HI_MMRBC_SHIFT 0x5 -#define PCIX_STATUS_HI_MMRBC_4K 0x3 -#define PCIX_STATUS_HI_MMRBC_2K 0x2 -#define PCIX_STATUS_LO_FUNC_MASK 0x7 -#define PCI_HEADER_TYPE_MULTIFUNC 0x80 -#define PCIE_LINK_WIDTH_MASK 0x3F0 -#define PCIE_LINK_WIDTH_SHIFT 4 -#define PCIE_LINK_SPEED_MASK 0x0F -#define PCIE_LINK_SPEED_2500 0x01 -#define PCIE_LINK_SPEED_5000 0x02 -#define PCIE_DEVICE_CONTROL2_16ms 0x0005 +#define PCIX_COMMAND_MMRBC_MASK 0x000C +#define PCIX_COMMAND_MMRBC_SHIFT 0x2 +#define PCIX_STATUS_HI_MMRBC_MASK 0x0060 +#define PCIX_STATUS_HI_MMRBC_SHIFT 0x5 +#define PCIX_STATUS_HI_MMRBC_4K 0x3 +#define PCIX_STATUS_HI_MMRBC_2K 0x2 +#define PCIX_STATUS_LO_FUNC_MASK 0x7 +#define PCI_HEADER_TYPE_MULTIFUNC 0x80 +#define PCIE_LINK_WIDTH_MASK 0x3F0 +#define PCIE_LINK_WIDTH_SHIFT 4 +#define PCIE_LINK_SPEED_MASK 0x0F +#define PCIE_LINK_SPEED_2500 0x01 +#define PCIE_LINK_SPEED_5000 0x02 +#define PCIE_DEVICE_CONTROL2_16ms 0x0005 #ifndef ETH_ADDR_LEN -#define ETH_ADDR_LEN 6 +#define ETH_ADDR_LEN 6 #endif -#define PHY_REVISION_MASK 0xFFFFFFF0 -#define MAX_PHY_REG_ADDRESS 0x1F /* 5 bit address bus (0-0x1F) */ -#define MAX_PHY_MULTI_PAGE_REG 0xF +#define PHY_REVISION_MASK 0xFFFFFFF0 +#define MAX_PHY_REG_ADDRESS 0x1F /* 5 bit address bus (0-0x1F) */ +#define MAX_PHY_MULTI_PAGE_REG 0xF /* Bit definitions for valid PHY IDs. */ /* * I = Integrated * E = External */ -#define M88E1000_E_PHY_ID 0x01410C50 -#define M88E1000_I_PHY_ID 0x01410C30 -#define M88E1011_I_PHY_ID 0x01410C20 -#define IGP01E1000_I_PHY_ID 0x02A80380 -#define M88E1011_I_REV_4 0x04 -#define M88E1111_I_PHY_ID 0x01410CC0 -#define M88E1112_E_PHY_ID 0x01410C90 -#define I347AT4_E_PHY_ID 0x01410DC0 -#define M88E1340M_E_PHY_ID 0x01410DF0 -#define GG82563_E_PHY_ID 0x01410CA0 -#define IGP03E1000_E_PHY_ID 0x02A80390 -#define IFE_E_PHY_ID 0x02A80330 -#define IFE_PLUS_E_PHY_ID 0x02A80320 -#define IFE_C_E_PHY_ID 0x02A80310 -#define BME1000_E_PHY_ID 0x01410CB0 -#define BME1000_E_PHY_ID_R2 0x01410CB1 -#define I82577_E_PHY_ID 0x01540050 -#define I82578_E_PHY_ID 0x004DD040 -#define I82579_E_PHY_ID 0x01540090 -#define I82580_I_PHY_ID 0x015403A0 -#define I350_I_PHY_ID 0x015403B0 -#define IGP04E1000_E_PHY_ID 0x02A80391 -#define M88_VENDOR 0x0141 +#define M88E1000_E_PHY_ID 0x01410C50 +#define M88E1000_I_PHY_ID 0x01410C30 +#define M88E1011_I_PHY_ID 0x01410C20 +#define IGP01E1000_I_PHY_ID 0x02A80380 +#define M88E1011_I_REV_4 0x04 +#define M88E1111_I_PHY_ID 0x01410CC0 +#define M88E1112_E_PHY_ID 0x01410C90 +#define I347AT4_E_PHY_ID 0x01410DC0 +#define M88E1340M_E_PHY_ID 0x01410DF0 +#define GG82563_E_PHY_ID 0x01410CA0 +#define IGP03E1000_E_PHY_ID 0x02A80390 +#define IFE_E_PHY_ID 0x02A80330 +#define IFE_PLUS_E_PHY_ID 0x02A80320 +#define IFE_C_E_PHY_ID 0x02A80310 +#define BME1000_E_PHY_ID 0x01410CB0 +#define BME1000_E_PHY_ID_R2 0x01410CB1 +#define I82577_E_PHY_ID 0x01540050 +#define I82578_E_PHY_ID 0x004DD040 +#define I82579_E_PHY_ID 0x01540090 +#define I82580_I_PHY_ID 0x015403A0 +#define I350_I_PHY_ID 0x015403B0 +#define I210_I_PHY_ID 0x01410C00 +#define IGP04E1000_E_PHY_ID 0x02A80391 +#define M88_VENDOR 0x0141 /* M88E1000 Specific Registers */ -#define M88E1000_PHY_SPEC_CTRL 0x10 /* PHY Specific Control Register */ -#define M88E1000_PHY_SPEC_STATUS 0x11 /* PHY Specific Status Register */ -#define M88E1000_INT_ENABLE 0x12 /* Interrupt Enable Register */ -#define M88E1000_INT_STATUS 0x13 /* Interrupt Status Register */ -#define M88E1000_EXT_PHY_SPEC_CTRL 0x14 /* Extended PHY Specific Control */ -#define M88E1000_RX_ERR_CNTR 0x15 /* Receive Error Counter */ +#define M88E1000_PHY_SPEC_CTRL 0x10 /* PHY Specific Control Reg */ +#define M88E1000_PHY_SPEC_STATUS 0x11 /* PHY Specific Status Reg */ +#define M88E1000_INT_ENABLE 0x12 /* Interrupt Enable Reg */ +#define M88E1000_INT_STATUS 0x13 /* Interrupt Status Reg */ +#define M88E1000_EXT_PHY_SPEC_CTRL 0x14 /* Extended PHY Specific Cntrl */ +#define M88E1000_RX_ERR_CNTR 0x15 /* Receive Error Counter */ -#define M88E1000_PHY_EXT_CTRL 0x1A /* PHY extend control register */ -#define M88E1000_PHY_PAGE_SELECT 0x1D /* Reg 29 for page number setting */ -#define M88E1000_PHY_GEN_CONTROL 0x1E /* Its meaning depends on reg 29 */ -#define M88E1000_PHY_VCO_REG_BIT8 0x100 /* Bits 8 & 11 are adjusted for */ -#define M88E1000_PHY_VCO_REG_BIT11 0x800 /* improved BER performance */ +#define M88E1000_PHY_EXT_CTRL 0x1A /* PHY extend control register */ +#define M88E1000_PHY_PAGE_SELECT 0x1D /* Reg 29 for pg number setting */ +#define M88E1000_PHY_GEN_CONTROL 0x1E /* meaning depends on reg 29 */ +#define M88E1000_PHY_VCO_REG_BIT8 0x100 /* Bits 8 & 11 are adjusted for */ +#define M88E1000_PHY_VCO_REG_BIT11 0x800 /* improved BER performance */ /* M88E1000 PHY Specific Control Register */ -#define M88E1000_PSCR_JABBER_DISABLE 0x0001 /* 1=Jabber Function disabled */ -#define M88E1000_PSCR_POLARITY_REVERSAL 0x0002 /* 1=Polarity Reverse enabled */ -#define M88E1000_PSCR_SQE_TEST 0x0004 /* 1=SQE Test enabled */ +#define M88E1000_PSCR_JABBER_DISABLE 0x0001 /* 1=Jabber Function disabled */ +#define M88E1000_PSCR_POLARITY_REVERSAL 0x0002 /* 1=Polarity Reverse enabled */ +#define M88E1000_PSCR_SQE_TEST 0x0004 /* 1=SQE Test enabled */ /* 1=CLK125 low, 0=CLK125 toggling */ -#define M88E1000_PSCR_CLK125_DISABLE 0x0010 -#define M88E1000_PSCR_MDI_MANUAL_MODE 0x0000 /* MDI Crossover Mode bits 6:5 */ - /* Manual MDI configuration */ -#define M88E1000_PSCR_MDIX_MANUAL_MODE 0x0020 /* Manual MDIX configuration */ +#define M88E1000_PSCR_CLK125_DISABLE 0x0010 +/* MDI Crossover Mode bits 6:5 Manual MDI configuration */ +#define M88E1000_PSCR_MDI_MANUAL_MODE 0x0000 +#define M88E1000_PSCR_MDIX_MANUAL_MODE 0x0020 /* Manual MDIX configuration */ /* 1000BASE-T: Auto crossover, 100BASE-TX/10BASE-T: MDI Mode */ -#define M88E1000_PSCR_AUTO_X_1000T 0x0040 +#define M88E1000_PSCR_AUTO_X_1000T 0x0040 /* Auto crossover enabled all speeds */ -#define M88E1000_PSCR_AUTO_X_MODE 0x0060 +#define M88E1000_PSCR_AUTO_X_MODE 0x0060 /* * 1=Enable Extended 10BASE-T distance (Lower 10BASE-T Rx Threshold * 0=Normal 10BASE-T Rx Threshold */ -#define M88E1000_PSCR_EN_10BT_EXT_DIST 0x0080 +#define M88E1000_PSCR_EN_10BT_EXT_DIST 0x0080 /* 1=5-bit interface in 100BASE-TX, 0=MII interface in 100BASE-TX */ -#define M88E1000_PSCR_MII_5BIT_ENABLE 0x0100 -#define M88E1000_PSCR_SCRAMBLER_DISABLE 0x0200 /* 1=Scrambler disable */ -#define M88E1000_PSCR_FORCE_LINK_GOOD 0x0400 /* 1=Force link good */ -#define M88E1000_PSCR_ASSERT_CRS_ON_TX 0x0800 /* 1=Assert CRS on Tx */ +#define M88E1000_PSCR_MII_5BIT_ENABLE 0x0100 +#define M88E1000_PSCR_SCRAMBLER_DISABLE 0x0200 /* 1=Scrambler disable */ +#define M88E1000_PSCR_FORCE_LINK_GOOD 0x0400 /* 1=Force link good */ +#define M88E1000_PSCR_ASSERT_CRS_ON_TX 0x0800 /* 1=Assert CRS on Tx */ /* M88E1000 PHY Specific Status Register */ -#define M88E1000_PSSR_JABBER 0x0001 /* 1=Jabber */ -#define M88E1000_PSSR_REV_POLARITY 0x0002 /* 1=Polarity reversed */ -#define M88E1000_PSSR_DOWNSHIFT 0x0020 /* 1=Downshifted */ -#define M88E1000_PSSR_MDIX 0x0040 /* 1=MDIX; 0=MDI */ +#define M88E1000_PSSR_JABBER 0x0001 /* 1=Jabber */ +#define M88E1000_PSSR_REV_POLARITY 0x0002 /* 1=Polarity reversed */ +#define M88E1000_PSSR_DOWNSHIFT 0x0020 /* 1=Downshifted */ +#define M88E1000_PSSR_MDIX 0x0040 /* 1=MDIX; 0=MDI */ /* * 0 = <50M * 1 = 50-80M @@ -1546,62 +1603,62 @@ * 3 = 110-140M * 4 = >140M */ -#define M88E1000_PSSR_CABLE_LENGTH 0x0380 -#define M88E1000_PSSR_LINK 0x0400 /* 1=Link up, 0=Link down */ -#define M88E1000_PSSR_SPD_DPLX_RESOLVED 0x0800 /* 1=Speed & Duplex resolved */ -#define M88E1000_PSSR_PAGE_RCVD 0x1000 /* 1=Page received */ -#define M88E1000_PSSR_DPLX 0x2000 /* 1=Duplex 0=Half Duplex */ -#define M88E1000_PSSR_SPEED 0xC000 /* Speed, bits 14:15 */ -#define M88E1000_PSSR_10MBS 0x0000 /* 00=10Mbs */ -#define M88E1000_PSSR_100MBS 0x4000 /* 01=100Mbs */ -#define M88E1000_PSSR_1000MBS 0x8000 /* 10=1000Mbs */ +#define M88E1000_PSSR_CABLE_LENGTH 0x0380 +#define M88E1000_PSSR_LINK 0x0400 /* 1=Link up, 0=Link down */ +#define M88E1000_PSSR_SPD_DPLX_RESOLVED 0x0800 /* 1=Speed & Duplex resolved */ +#define M88E1000_PSSR_PAGE_RCVD 0x1000 /* 1=Page received */ +#define M88E1000_PSSR_DPLX 0x2000 /* 1=Duplex 0=Half Duplex */ +#define M88E1000_PSSR_SPEED 0xC000 /* Speed, bits 14:15 */ +#define M88E1000_PSSR_10MBS 0x0000 /* 00=10Mbs */ +#define M88E1000_PSSR_100MBS 0x4000 /* 01=100Mbs */ +#define M88E1000_PSSR_1000MBS 0x8000 /* 10=1000Mbs */ -#define M88E1000_PSSR_CABLE_LENGTH_SHIFT 7 +#define M88E1000_PSSR_CABLE_LENGTH_SHIFT 7 /* M88E1000 Extended PHY Specific Control Register */ -#define M88E1000_EPSCR_FIBER_LOOPBACK 0x4000 /* 1=Fiber loopback */ +#define M88E1000_EPSCR_FIBER_LOOPBACK 0x4000 /* 1=Fiber loopback */ /* * 1 = Lost lock detect enabled. * Will assert lost lock and bring * link down if idle not seen * within 1ms in 1000BASE-T */ -#define M88E1000_EPSCR_DOWN_NO_IDLE 0x8000 +#define M88E1000_EPSCR_DOWN_NO_IDLE 0x8000 /* * Number of times we will attempt to autonegotiate before downshifting if we * are the master */ -#define M88E1000_EPSCR_MASTER_DOWNSHIFT_MASK 0x0C00 -#define M88E1000_EPSCR_MASTER_DOWNSHIFT_1X 0x0000 -#define M88E1000_EPSCR_MASTER_DOWNSHIFT_2X 0x0400 -#define M88E1000_EPSCR_MASTER_DOWNSHIFT_3X 0x0800 -#define M88E1000_EPSCR_MASTER_DOWNSHIFT_4X 0x0C00 +#define M88E1000_EPSCR_MASTER_DOWNSHIFT_MASK 0x0C00 +#define M88E1000_EPSCR_MASTER_DOWNSHIFT_1X 0x0000 +#define M88E1000_EPSCR_MASTER_DOWNSHIFT_2X 0x0400 +#define M88E1000_EPSCR_MASTER_DOWNSHIFT_3X 0x0800 +#define M88E1000_EPSCR_MASTER_DOWNSHIFT_4X 0x0C00 /* * Number of times we will attempt to autonegotiate before downshifting if we * are the slave */ -#define M88E1000_EPSCR_SLAVE_DOWNSHIFT_MASK 0x0300 -#define M88E1000_EPSCR_SLAVE_DOWNSHIFT_DIS 0x0000 -#define M88E1000_EPSCR_SLAVE_DOWNSHIFT_1X 0x0100 -#define M88E1000_EPSCR_SLAVE_DOWNSHIFT_2X 0x0200 -#define M88E1000_EPSCR_SLAVE_DOWNSHIFT_3X 0x0300 -#define M88E1000_EPSCR_TX_CLK_2_5 0x0060 /* 2.5 MHz TX_CLK */ -#define M88E1000_EPSCR_TX_CLK_25 0x0070 /* 25 MHz TX_CLK */ -#define M88E1000_EPSCR_TX_CLK_0 0x0000 /* NO TX_CLK */ +#define M88E1000_EPSCR_SLAVE_DOWNSHIFT_MASK 0x0300 +#define M88E1000_EPSCR_SLAVE_DOWNSHIFT_DIS 0x0000 +#define M88E1000_EPSCR_SLAVE_DOWNSHIFT_1X 0x0100 +#define M88E1000_EPSCR_SLAVE_DOWNSHIFT_2X 0x0200 +#define M88E1000_EPSCR_SLAVE_DOWNSHIFT_3X 0x0300 +#define M88E1000_EPSCR_TX_CLK_2_5 0x0060 /* 2.5 MHz TX_CLK */ +#define M88E1000_EPSCR_TX_CLK_25 0x0070 /* 25 MHz TX_CLK */ +#define M88E1000_EPSCR_TX_CLK_0 0x0000 /* NO TX_CLK */ /* M88E1111 Specific Registers */ -#define M88E1111_PHY_PAGE_SELECT1 0x16 /* for registers 0-28 */ -#define M88E1111_PHY_PAGE_SELECT2 0x1D /* for registers 30-31 */ +#define M88E1111_PHY_PAGE_SELECT1 0x16 /* for registers 0-28 */ +#define M88E1111_PHY_PAGE_SELECT2 0x1D /* for registers 30-31 */ /* M88E1111 page select register mask */ -#define M88E1111_PHY_PAGE_SELECT_MASK1 0xFF -#define M88E1111_PHY_PAGE_SELECT_MASK2 0x3F +#define M88E1111_PHY_PAGE_SELECT_MASK1 0xFF +#define M88E1111_PHY_PAGE_SELECT_MASK2 0x3F /* Intel I347AT4 Registers */ -#define I347AT4_PCDL 0x10 /* PHY Cable Diagnostics Length */ -#define I347AT4_PCDC 0x15 /* PHY Cable Diagnostics Control */ -#define I347AT4_PAGE_SELECT 0x16 +#define I347AT4_PCDL 0x10 /* PHY Cable Diagnostics Length */ +#define I347AT4_PCDC 0x15 /* PHY Cable Diagnostics Control */ +#define I347AT4_PAGE_SELECT 0x16 /* I347AT4 Extended PHY Specific Control Register */ @@ -1609,213 +1666,225 @@ * Number of times we will attempt to autonegotiate before downshifting if we * are the master */ -#define I347AT4_PSCR_DOWNSHIFT_ENABLE 0x0800 -#define I347AT4_PSCR_DOWNSHIFT_MASK 0x7000 -#define I347AT4_PSCR_DOWNSHIFT_1X 0x0000 -#define I347AT4_PSCR_DOWNSHIFT_2X 0x1000 -#define I347AT4_PSCR_DOWNSHIFT_3X 0x2000 -#define I347AT4_PSCR_DOWNSHIFT_4X 0x3000 -#define I347AT4_PSCR_DOWNSHIFT_5X 0x4000 -#define I347AT4_PSCR_DOWNSHIFT_6X 0x5000 -#define I347AT4_PSCR_DOWNSHIFT_7X 0x6000 -#define I347AT4_PSCR_DOWNSHIFT_8X 0x7000 +#define I347AT4_PSCR_DOWNSHIFT_ENABLE 0x0800 +#define I347AT4_PSCR_DOWNSHIFT_MASK 0x7000 +#define I347AT4_PSCR_DOWNSHIFT_1X 0x0000 +#define I347AT4_PSCR_DOWNSHIFT_2X 0x1000 +#define I347AT4_PSCR_DOWNSHIFT_3X 0x2000 +#define I347AT4_PSCR_DOWNSHIFT_4X 0x3000 +#define I347AT4_PSCR_DOWNSHIFT_5X 0x4000 +#define I347AT4_PSCR_DOWNSHIFT_6X 0x5000 +#define I347AT4_PSCR_DOWNSHIFT_7X 0x6000 +#define I347AT4_PSCR_DOWNSHIFT_8X 0x7000 /* I347AT4 PHY Cable Diagnostics Control */ -#define I347AT4_PCDC_CABLE_LENGTH_UNIT 0x0400 /* 0=cm 1=meters */ +#define I347AT4_PCDC_CABLE_LENGTH_UNIT 0x0400 /* 0=cm 1=meters */ /* M88E1112 only registers */ -#define M88E1112_VCT_DSP_DISTANCE 0x001A +#define M88E1112_VCT_DSP_DISTANCE 0x001A /* M88EC018 Rev 2 specific DownShift settings */ -#define M88EC018_EPSCR_DOWNSHIFT_COUNTER_MASK 0x0E00 -#define M88EC018_EPSCR_DOWNSHIFT_COUNTER_1X 0x0000 -#define M88EC018_EPSCR_DOWNSHIFT_COUNTER_2X 0x0200 -#define M88EC018_EPSCR_DOWNSHIFT_COUNTER_3X 0x0400 -#define M88EC018_EPSCR_DOWNSHIFT_COUNTER_4X 0x0600 -#define M88EC018_EPSCR_DOWNSHIFT_COUNTER_5X 0x0800 -#define M88EC018_EPSCR_DOWNSHIFT_COUNTER_6X 0x0A00 -#define M88EC018_EPSCR_DOWNSHIFT_COUNTER_7X 0x0C00 -#define M88EC018_EPSCR_DOWNSHIFT_COUNTER_8X 0x0E00 +#define M88EC018_EPSCR_DOWNSHIFT_COUNTER_MASK 0x0E00 +#define M88EC018_EPSCR_DOWNSHIFT_COUNTER_1X 0x0000 +#define M88EC018_EPSCR_DOWNSHIFT_COUNTER_2X 0x0200 +#define M88EC018_EPSCR_DOWNSHIFT_COUNTER_3X 0x0400 +#define M88EC018_EPSCR_DOWNSHIFT_COUNTER_4X 0x0600 +#define M88EC018_EPSCR_DOWNSHIFT_COUNTER_5X 0x0800 +#define M88EC018_EPSCR_DOWNSHIFT_COUNTER_6X 0x0A00 +#define M88EC018_EPSCR_DOWNSHIFT_COUNTER_7X 0x0C00 +#define M88EC018_EPSCR_DOWNSHIFT_COUNTER_8X 0x0E00 -#define I82578_EPSCR_DOWNSHIFT_ENABLE 0x0020 -#define I82578_EPSCR_DOWNSHIFT_COUNTER_MASK 0x001C +#define I82578_EPSCR_DOWNSHIFT_ENABLE 0x0020 +#define I82578_EPSCR_DOWNSHIFT_COUNTER_MASK 0x001C /* BME1000 PHY Specific Control Register */ -#define BME1000_PSCR_ENABLE_DOWNSHIFT 0x0800 /* 1 = enable downshift */ +#define BME1000_PSCR_ENABLE_DOWNSHIFT 0x0800 /* 1 = enable downshift */ /* * Bits... * 15-5: page * 4-0: register offset */ -#define GG82563_PAGE_SHIFT 5 -#define GG82563_REG(page, reg) \ - (((page) << GG82563_PAGE_SHIFT) | ((reg) & MAX_PHY_REG_ADDRESS)) -#define GG82563_MIN_ALT_REG 30 +#define GG82563_PAGE_SHIFT 5 +#define GG82563_REG(page, reg) \ + (((page) << GG82563_PAGE_SHIFT) | ((reg) & MAX_PHY_REG_ADDRESS)) +#define GG82563_MIN_ALT_REG 30 /* GG82563 Specific Registers */ -#define GG82563_PHY_SPEC_CTRL \ - GG82563_REG(0, 16) /* PHY Specific Control */ -#define GG82563_PHY_SPEC_STATUS \ - GG82563_REG(0, 17) /* PHY Specific Status */ -#define GG82563_PHY_INT_ENABLE \ - GG82563_REG(0, 18) /* Interrupt Enable */ -#define GG82563_PHY_SPEC_STATUS_2 \ - GG82563_REG(0, 19) /* PHY Specific Status 2 */ -#define GG82563_PHY_RX_ERR_CNTR \ - GG82563_REG(0, 21) /* Receive Error Counter */ -#define GG82563_PHY_PAGE_SELECT \ - GG82563_REG(0, 22) /* Page Select */ -#define GG82563_PHY_SPEC_CTRL_2 \ - GG82563_REG(0, 26) /* PHY Specific Control 2 */ -#define GG82563_PHY_PAGE_SELECT_ALT \ - GG82563_REG(0, 29) /* Alternate Page Select */ -#define GG82563_PHY_TEST_CLK_CTRL \ - GG82563_REG(0, 30) /* Test Clock Control (use reg. 29 to select) */ +#define GG82563_PHY_SPEC_CTRL GG82563_REG(0, 16) /* PHY Spec Cntrl */ +#define GG82563_PHY_SPEC_STATUS GG82563_REG(0, 17) /* PHY Spec Status */ +#define GG82563_PHY_INT_ENABLE GG82563_REG(0, 18) /* Interrupt Ena */ +#define GG82563_PHY_SPEC_STATUS_2 GG82563_REG(0, 19) /* PHY Spec Stat2 */ +#define GG82563_PHY_RX_ERR_CNTR GG82563_REG(0, 21) /* Rx Err Counter */ +#define GG82563_PHY_PAGE_SELECT GG82563_REG(0, 22) /* Page Select */ +#define GG82563_PHY_SPEC_CTRL_2 GG82563_REG(0, 26) /* PHY Spec Cntrl2 */ +#define GG82563_PHY_PAGE_SELECT_ALT GG82563_REG(0, 29) /* Alt Page Select */ +/* Test Clock Control (use reg. 29 to select) */ +#define GG82563_PHY_TEST_CLK_CTRL GG82563_REG(0, 30) -#define GG82563_PHY_MAC_SPEC_CTRL \ - GG82563_REG(2, 21) /* MAC Specific Control Register */ -#define GG82563_PHY_MAC_SPEC_CTRL_2 \ - GG82563_REG(2, 26) /* MAC Specific Control 2 */ +/* MAC Specific Control Register */ +#define GG82563_PHY_MAC_SPEC_CTRL GG82563_REG(2, 21) +#define GG82563_PHY_MAC_SPEC_CTRL_2 GG82563_REG(2, 26) /* MAC Spec Ctrl 2 */ -#define GG82563_PHY_DSP_DISTANCE \ - GG82563_REG(5, 26) /* DSP Distance */ +#define GG82563_PHY_DSP_DISTANCE GG82563_REG(5, 26) /* DSP Distance */ /* Page 193 - Port Control Registers */ -#define GG82563_PHY_KMRN_MODE_CTRL \ - GG82563_REG(193, 16) /* Kumeran Mode Control */ -#define GG82563_PHY_PORT_RESET \ - GG82563_REG(193, 17) /* Port Reset */ -#define GG82563_PHY_REVISION_ID \ - GG82563_REG(193, 18) /* Revision ID */ -#define GG82563_PHY_DEVICE_ID \ - GG82563_REG(193, 19) /* Device ID */ -#define GG82563_PHY_PWR_MGMT_CTRL \ - GG82563_REG(193, 20) /* Power Management Control */ -#define GG82563_PHY_RATE_ADAPT_CTRL \ - GG82563_REG(193, 25) /* Rate Adaptation Control */ +/* Kumeran Mode Control */ +#define GG82563_PHY_KMRN_MODE_CTRL GG82563_REG(193, 16) +#define GG82563_PHY_PORT_RESET GG82563_REG(193, 17) /* Port Reset */ +#define GG82563_PHY_REVISION_ID GG82563_REG(193, 18) /* Revision ID */ +#define GG82563_PHY_DEVICE_ID GG82563_REG(193, 19) /* Device ID */ +#define GG82563_PHY_PWR_MGMT_CTRL GG82563_REG(193, 20) /* Pwr Mgt Ctrl */ +/* Rate Adaptation Control */ +#define GG82563_PHY_RATE_ADAPT_CTRL GG82563_REG(193, 25) /* Page 194 - KMRN Registers */ -#define GG82563_PHY_KMRN_FIFO_CTRL_STAT \ - GG82563_REG(194, 16) /* FIFO's Control/Status */ -#define GG82563_PHY_KMRN_CTRL \ - GG82563_REG(194, 17) /* Control */ -#define GG82563_PHY_INBAND_CTRL \ - GG82563_REG(194, 18) /* Inband Control */ -#define GG82563_PHY_KMRN_DIAGNOSTIC \ - GG82563_REG(194, 19) /* Diagnostic */ -#define GG82563_PHY_ACK_TIMEOUTS \ - GG82563_REG(194, 20) /* Acknowledge Timeouts */ -#define GG82563_PHY_ADV_ABILITY \ - GG82563_REG(194, 21) /* Advertised Ability */ -#define GG82563_PHY_LINK_PARTNER_ADV_ABILITY \ - GG82563_REG(194, 23) /* Link Partner Advertised Ability */ -#define GG82563_PHY_ADV_NEXT_PAGE \ - GG82563_REG(194, 24) /* Advertised Next Page */ -#define GG82563_PHY_LINK_PARTNER_ADV_NEXT_PAGE \ - GG82563_REG(194, 25) /* Link Partner Advertised Next page */ -#define GG82563_PHY_KMRN_MISC \ - GG82563_REG(194, 26) /* Misc. */ +/* FIFO's Control/Status */ +#define GG82563_PHY_KMRN_FIFO_CTRL_STAT GG82563_REG(194, 16) +#define GG82563_PHY_KMRN_CTRL GG82563_REG(194, 17) /* Control */ +#define GG82563_PHY_INBAND_CTRL GG82563_REG(194, 18) /* Inband Ctrl */ +#define GG82563_PHY_KMRN_DIAGNOSTIC GG82563_REG(194, 19) /* Diagnostic */ +#define GG82563_PHY_ACK_TIMEOUTS GG82563_REG(194, 20) /* Ack Timeouts */ +#define GG82563_PHY_ADV_ABILITY GG82563_REG(194, 21) /* Adver Ability */ +/* Link Partner Advertised Ability */ +#define GG82563_PHY_LINK_PARTNER_ADV_ABILITY GG82563_REG(194, 23) +#define GG82563_PHY_ADV_NEXT_PAGE GG82563_REG(194, 24) /* Adver Next Pg */ +/* Link Partner Advertised Next page */ +#define GG82563_PHY_LINK_PARTNER_ADV_NEXT_PAGE GG82563_REG(194, 25) +#define GG82563_PHY_KMRN_MISC GG82563_REG(194, 26) /* Misc. */ /* MDI Control */ -#define E1000_MDIC_DATA_MASK 0x0000FFFF -#define E1000_MDIC_REG_MASK 0x001F0000 -#define E1000_MDIC_REG_SHIFT 16 -#define E1000_MDIC_PHY_MASK 0x03E00000 -#define E1000_MDIC_PHY_SHIFT 21 -#define E1000_MDIC_OP_WRITE 0x04000000 -#define E1000_MDIC_OP_READ 0x08000000 -#define E1000_MDIC_READY 0x10000000 -#define E1000_MDIC_INT_EN 0x20000000 -#define E1000_MDIC_ERROR 0x40000000 -#define E1000_MDIC_DEST 0x80000000 +#define E1000_MDIC_DATA_MASK 0x0000FFFF +#define E1000_MDIC_REG_MASK 0x001F0000 +#define E1000_MDIC_REG_SHIFT 16 +#define E1000_MDIC_PHY_MASK 0x03E00000 +#define E1000_MDIC_PHY_SHIFT 21 +#define E1000_MDIC_OP_WRITE 0x04000000 +#define E1000_MDIC_OP_READ 0x08000000 +#define E1000_MDIC_READY 0x10000000 +#define E1000_MDIC_INT_EN 0x20000000 +#define E1000_MDIC_ERROR 0x40000000 +#define E1000_MDIC_DEST 0x80000000 /* SerDes Control */ -#define E1000_GEN_CTL_READY 0x80000000 -#define E1000_GEN_CTL_ADDRESS_SHIFT 8 -#define E1000_GEN_POLL_TIMEOUT 640 +#define E1000_GEN_CTL_READY 0x80000000 +#define E1000_GEN_CTL_ADDRESS_SHIFT 8 +#define E1000_GEN_POLL_TIMEOUT 640 /* LinkSec register fields */ -#define E1000_LSECTXCAP_SUM_MASK 0x00FF0000 -#define E1000_LSECTXCAP_SUM_SHIFT 16 -#define E1000_LSECRXCAP_SUM_MASK 0x00FF0000 -#define E1000_LSECRXCAP_SUM_SHIFT 16 +#define E1000_LSECTXCAP_SUM_MASK 0x00FF0000 +#define E1000_LSECTXCAP_SUM_SHIFT 16 +#define E1000_LSECRXCAP_SUM_MASK 0x00FF0000 +#define E1000_LSECRXCAP_SUM_SHIFT 16 -#define E1000_LSECTXCTRL_EN_MASK 0x00000003 -#define E1000_LSECTXCTRL_DISABLE 0x0 -#define E1000_LSECTXCTRL_AUTH 0x1 -#define E1000_LSECTXCTRL_AUTH_ENCRYPT 0x2 -#define E1000_LSECTXCTRL_AISCI 0x00000020 -#define E1000_LSECTXCTRL_PNTHRSH_MASK 0xFFFFFF00 -#define E1000_LSECTXCTRL_RSV_MASK 0x000000D8 +#define E1000_LSECTXCTRL_EN_MASK 0x00000003 +#define E1000_LSECTXCTRL_DISABLE 0x0 +#define E1000_LSECTXCTRL_AUTH 0x1 +#define E1000_LSECTXCTRL_AUTH_ENCRYPT 0x2 +#define E1000_LSECTXCTRL_AISCI 0x00000020 +#define E1000_LSECTXCTRL_PNTHRSH_MASK 0xFFFFFF00 +#define E1000_LSECTXCTRL_RSV_MASK 0x000000D8 -#define E1000_LSECRXCTRL_EN_MASK 0x0000000C -#define E1000_LSECRXCTRL_EN_SHIFT 2 -#define E1000_LSECRXCTRL_DISABLE 0x0 -#define E1000_LSECRXCTRL_CHECK 0x1 -#define E1000_LSECRXCTRL_STRICT 0x2 -#define E1000_LSECRXCTRL_DROP 0x3 -#define E1000_LSECRXCTRL_PLSH 0x00000040 -#define E1000_LSECRXCTRL_RP 0x00000080 -#define E1000_LSECRXCTRL_RSV_MASK 0xFFFFFF33 +#define E1000_LSECRXCTRL_EN_MASK 0x0000000C +#define E1000_LSECRXCTRL_EN_SHIFT 2 +#define E1000_LSECRXCTRL_DISABLE 0x0 +#define E1000_LSECRXCTRL_CHECK 0x1 +#define E1000_LSECRXCTRL_STRICT 0x2 +#define E1000_LSECRXCTRL_DROP 0x3 +#define E1000_LSECRXCTRL_PLSH 0x00000040 +#define E1000_LSECRXCTRL_RP 0x00000080 +#define E1000_LSECRXCTRL_RSV_MASK 0xFFFFFF33 /* Tx Rate-Scheduler Config fields */ #define E1000_RTTBCNRC_RS_ENA 0x80000000 #define E1000_RTTBCNRC_RF_DEC_MASK 0x00003FFF -#define E1000_RTTBCNRC_RF_INT_SHIFT 14 +#define E1000_RTTBCNRC_RF_INT_SHIFT 14 #define E1000_RTTBCNRC_RF_INT_MASK \ (E1000_RTTBCNRC_RF_DEC_MASK << E1000_RTTBCNRC_RF_INT_SHIFT) /* DMA Coalescing register fields */ -#define E1000_DMACR_DMACWT_MASK 0x00003FFF /* DMA Coalescing - * Watchdog Timer */ -#define E1000_DMACR_DMACTHR_MASK 0x00FF0000 /* DMA Coalescing Rx - * Threshold */ -#define E1000_DMACR_DMACTHR_SHIFT 16 -#define E1000_DMACR_DMAC_LX_MASK 0x30000000 /* Lx when no PCIe - * transactions */ -#define E1000_DMACR_DMAC_LX_SHIFT 28 -#define E1000_DMACR_DMAC_EN 0x80000000 /* Enable DMA Coalescing */ +/* DMA Coalescing Watchdog Timer */ +#define E1000_DMACR_DMACWT_MASK 0x00003FFF +/* DMA Coalescing Rx Threshold */ +#define E1000_DMACR_DMACTHR_MASK 0x00FF0000 +#define E1000_DMACR_DMACTHR_SHIFT 16 +/* Lx when no PCIe transactions */ +#define E1000_DMACR_DMAC_LX_MASK 0x30000000 +#define E1000_DMACR_DMAC_LX_SHIFT 28 +#define E1000_DMACR_DMAC_EN 0x80000000 /* Enable DMA Coalescing */ +/* DMA Coalescing BMC-to-OS Watchdog Enable */ +#define E1000_DMACR_DC_BMC2OSW_EN 0x00008000 -#define E1000_DMCTXTH_DMCTTHR_MASK 0x00000FFF /* DMA Coalescing Transmit - * Threshold */ +/* DMA Coalescing Transmit Threshold */ +#define E1000_DMCTXTH_DMCTTHR_MASK 0x00000FFF -#define E1000_DMCTLX_TTLX_MASK 0x00000FFF /* Time to LX request */ +#define E1000_DMCTLX_TTLX_MASK 0x00000FFF /* Time to LX request */ -#define E1000_DMCRTRH_UTRESH_MASK 0x0007FFFF /* Rx Traffic Rate - * Threshold */ -#define E1000_DMCRTRH_LRPRCW 0x80000000 /* Rx packet rate in - * current window */ +/* Rx Traffic Rate Threshold */ +#define E1000_DMCRTRH_UTRESH_MASK 0x0007FFFF +/* Rx packet rate in current window */ +#define E1000_DMCRTRH_LRPRCW 0x80000000 -#define E1000_DMCCNT_CCOUNT_MASK 0x01FFFFFF /* DMA Coal Rx Traffic - * Current Cnt */ +/* DMA Coal Rx Traffic Current Count */ +#define E1000_DMCCNT_CCOUNT_MASK 0x01FFFFFF -#define E1000_FCRTC_RTH_COAL_MASK 0x0003FFF0 /* Flow ctrl Rx Threshold - * High val */ -#define E1000_FCRTC_RTH_COAL_SHIFT 4 -#define E1000_PCIEMISC_LX_DECISION 0x00000080 /* Lx power decision based - on DMA coal */ +/* Flow ctrl Rx Threshold High val */ +#define E1000_FCRTC_RTH_COAL_MASK 0x0003FFF0 +#define E1000_FCRTC_RTH_COAL_SHIFT 4 +/* Lx power decision based on DMA coal */ +#define E1000_PCIEMISC_LX_DECISION 0x00000080 + +#define E1000_RXPBS_SIZE_I210_MASK 0x0000003F /* Rx packet buffer size */ +#define E1000_TXPB0S_SIZE_I210_MASK 0x0000003F /* Tx packet buffer 0 size */ +#define E1000_LTRC_EEEMS_EN 0x00000020 /* Enable EEE LTR max send */ +/* Minimum time for 1000BASE-T where no data will be transmit following move out + * of EEE LPI Tx state + */ +#define E1000_TW_SYSTEM_1000_MASK 0x000000FF +/* Minimum time for 100BASE-T where no data will be transmit following move out + * of EEE LPI Tx state + */ +#define E1000_TW_SYSTEM_100_MASK 0x0000FF00 +#define E1000_TW_SYSTEM_100_SHIFT 8 +#define E1000_LTRMINV_LTRV_MASK 0x000003FF /* LTR minimum value */ +#define E1000_LTRMAXV_LTRV_MASK 0x000003FF /* LTR maximum value */ +#define E1000_LTRMINV_SCALE_MASK 0x00001C00 /* LTR minimum scale */ +#define E1000_LTRMINV_SCALE_SHIFT 10 +/* Reg val to set scale to 1024 nsec */ +#define E1000_LTRMINV_SCALE_1024 2 +/* Reg val to set scale to 32768 nsec */ +#define E1000_LTRMINV_SCALE_32768 3 +#define E1000_LTRMINV_LSNP_REQ 0x00008000 /* LTR Snoop Requirement */ +#define E1000_LTRMAXV_SCALE_MASK 0x00001C00 /* LTR maximum scale */ +#define E1000_LTRMAXV_SCALE_SHIFT 10 +/* Reg val to set scale to 1024 nsec */ +#define E1000_LTRMAXV_SCALE_1024 2 +/* Reg val to set scale to 32768 nsec */ +#define E1000_LTRMAXV_SCALE_32768 3 +#define E1000_LTRMAXV_LSNP_REQ 0x00008000 /* LTR Snoop Requirement */ +#define E1000_DOBFFCTL_OBFFTHR_MASK 0x000000FF /* OBFF threshold */ +#define E1000_DOBFFCTL_EXIT_ACT_MASK 0x01000000 /* Exit active CB */ /* Proxy Filer Control */ -#define E1000_PROXYFC_D0 0x00000001 /* Enable offload in D0 */ -#define E1000_PROXYFC_EX 0x00000004 /* Directed exact proxy */ -#define E1000_PROXYFC_MC 0x00000008 /* Directed Multicast - * Proxy */ -#define E1000_PROXYFC_BC 0x00000010 /* Broadcast Proxy Enable */ -#define E1000_PROXYFC_ARP_DIRECTED 0x00000020 /* Directed ARP Proxy - * Enable */ -#define E1000_PROXYFC_IPV4 0x00000040 /* Directed IPv4 Enable */ -#define E1000_PROXYFC_IPV6 0x00000080 /* Directed IPv6 Enable */ -#define E1000_PROXYFC_NS 0x00000200 /* IPv4 Neighborhood - * Solicitation */ -#define E1000_PROXYFC_ARP 0x00000800 /* ARP Request Proxy - * Enable */ +#define E1000_PROXYFC_D0 0x00000001 /* Enable offload in D0 */ +#define E1000_PROXYFC_EX 0x00000004 /* Directed exact proxy */ +#define E1000_PROXYFC_MC 0x00000008 /* Directed MC Proxy */ +#define E1000_PROXYFC_BC 0x00000010 /* Broadcast Proxy Enable */ +#define E1000_PROXYFC_ARP_DIRECTED 0x00000020 /* Directed ARP Proxy Ena */ +#define E1000_PROXYFC_IPV4 0x00000040 /* Directed IPv4 Enable */ +#define E1000_PROXYFC_IPV6 0x00000080 /* Directed IPv6 Enable */ +#define E1000_PROXYFC_NS 0x00000200 /* IPv4 NBRHD Solicitation */ +#define E1000_PROXYFC_ARP 0x00000800 /* ARP Request Proxy Ena */ /* Proxy Status */ -#define E1000_PROXYS_CLEAR 0xFFFFFFFF /* Clear */ +#define E1000_PROXYS_CLEAR 0xFFFFFFFF /* Clear */ /* Firmware Status */ -#define E1000_FWSTS_FWRI 0x80000000 /* Firmware Reset - * Indication */ - +#define E1000_FWSTS_FWRI 0x80000000 /* FW Reset Indication */ +/* VF Control */ +#define E1000_VTCTRL_RST 0x04000000 /* Reset VF */ +#define E1000_STATUS_LAN_ID_MASK 0x00000000C /* Mask for Lan ID field */ +/* Lan ID bit field offset in status register */ +#define E1000_STATUS_LAN_ID_OFFSET 2 +#define E1000_VFTA_ENTRIES 128 #endif /* _E1000_DEFINES_H_ */ diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_hw.h b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_hw.h index 0e6bf1a51f..50a5ce2c28 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_hw.h +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_hw.h @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2010, Intel Corporation + Copyright (c) 2001-2012, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -30,7 +30,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: src/sys/dev/e1000/e1000_hw.h,v 1.4.2.4.2.1 2010/12/21 17:09:25 kensmith Exp $*/ +/*$FreeBSD$*/ #ifndef _E1000_HW_H_ #define _E1000_HW_H_ @@ -41,139 +41,145 @@ struct e1000_hw; -#define E1000_DEV_ID_82542 0x1000 -#define E1000_DEV_ID_82543GC_FIBER 0x1001 -#define E1000_DEV_ID_82543GC_COPPER 0x1004 -#define E1000_DEV_ID_82544EI_COPPER 0x1008 -#define E1000_DEV_ID_82544EI_FIBER 0x1009 -#define E1000_DEV_ID_82544GC_COPPER 0x100C -#define E1000_DEV_ID_82544GC_LOM 0x100D -#define E1000_DEV_ID_82540EM 0x100E -#define E1000_DEV_ID_82540EM_LOM 0x1015 -#define E1000_DEV_ID_82540EP_LOM 0x1016 -#define E1000_DEV_ID_82540EP 0x1017 -#define E1000_DEV_ID_82540EP_LP 0x101E -#define E1000_DEV_ID_82545EM_COPPER 0x100F -#define E1000_DEV_ID_82545EM_FIBER 0x1011 -#define E1000_DEV_ID_82545GM_COPPER 0x1026 -#define E1000_DEV_ID_82545GM_FIBER 0x1027 -#define E1000_DEV_ID_82545GM_SERDES 0x1028 -#define E1000_DEV_ID_82546EB_COPPER 0x1010 -#define E1000_DEV_ID_82546EB_FIBER 0x1012 -#define E1000_DEV_ID_82546EB_QUAD_COPPER 0x101D -#define E1000_DEV_ID_82546GB_COPPER 0x1079 -#define E1000_DEV_ID_82546GB_FIBER 0x107A -#define E1000_DEV_ID_82546GB_SERDES 0x107B -#define E1000_DEV_ID_82546GB_PCIE 0x108A -#define E1000_DEV_ID_82546GB_QUAD_COPPER 0x1099 -#define E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3 0x10B5 -#define E1000_DEV_ID_82541EI 0x1013 -#define E1000_DEV_ID_82541EI_MOBILE 0x1018 -#define E1000_DEV_ID_82541ER_LOM 0x1014 -#define E1000_DEV_ID_82541ER 0x1078 -#define E1000_DEV_ID_82541GI 0x1076 -#define E1000_DEV_ID_82541GI_LF 0x107C -#define E1000_DEV_ID_82541GI_MOBILE 0x1077 -#define E1000_DEV_ID_82547EI 0x1019 -#define E1000_DEV_ID_82547EI_MOBILE 0x101A -#define E1000_DEV_ID_82547GI 0x1075 -#define E1000_DEV_ID_82571EB_COPPER 0x105E -#define E1000_DEV_ID_82571EB_FIBER 0x105F -#define E1000_DEV_ID_82571EB_SERDES 0x1060 -#define E1000_DEV_ID_82571EB_SERDES_DUAL 0x10D9 -#define E1000_DEV_ID_82571EB_SERDES_QUAD 0x10DA -#define E1000_DEV_ID_82571EB_QUAD_COPPER 0x10A4 -#define E1000_DEV_ID_82571PT_QUAD_COPPER 0x10D5 -#define E1000_DEV_ID_82571EB_QUAD_FIBER 0x10A5 -#define E1000_DEV_ID_82571EB_QUAD_COPPER_LP 0x10BC -#define E1000_DEV_ID_82572EI_COPPER 0x107D -#define E1000_DEV_ID_82572EI_FIBER 0x107E -#define E1000_DEV_ID_82572EI_SERDES 0x107F -#define E1000_DEV_ID_82572EI 0x10B9 -#define E1000_DEV_ID_82573E 0x108B -#define E1000_DEV_ID_82573E_IAMT 0x108C -#define E1000_DEV_ID_82573L 0x109A -#define E1000_DEV_ID_82574L 0x10D3 -#define E1000_DEV_ID_82574LA 0x10F6 -#define E1000_DEV_ID_82583V 0x150C -#define E1000_DEV_ID_80003ES2LAN_COPPER_DPT 0x1096 -#define E1000_DEV_ID_80003ES2LAN_SERDES_DPT 0x1098 -#define E1000_DEV_ID_80003ES2LAN_COPPER_SPT 0x10BA -#define E1000_DEV_ID_80003ES2LAN_SERDES_SPT 0x10BB -#define E1000_DEV_ID_ICH8_82567V_3 0x1501 -#define E1000_DEV_ID_ICH8_IGP_M_AMT 0x1049 -#define E1000_DEV_ID_ICH8_IGP_AMT 0x104A -#define E1000_DEV_ID_ICH8_IGP_C 0x104B -#define E1000_DEV_ID_ICH8_IFE 0x104C -#define E1000_DEV_ID_ICH8_IFE_GT 0x10C4 -#define E1000_DEV_ID_ICH8_IFE_G 0x10C5 -#define E1000_DEV_ID_ICH8_IGP_M 0x104D -#define E1000_DEV_ID_ICH9_IGP_M 0x10BF -#define E1000_DEV_ID_ICH9_IGP_M_AMT 0x10F5 -#define E1000_DEV_ID_ICH9_IGP_M_V 0x10CB -#define E1000_DEV_ID_ICH9_IGP_AMT 0x10BD -#define E1000_DEV_ID_ICH9_BM 0x10E5 -#define E1000_DEV_ID_ICH9_IGP_C 0x294C -#define E1000_DEV_ID_ICH9_IFE 0x10C0 -#define E1000_DEV_ID_ICH9_IFE_GT 0x10C3 -#define E1000_DEV_ID_ICH9_IFE_G 0x10C2 -#define E1000_DEV_ID_ICH10_R_BM_LM 0x10CC -#define E1000_DEV_ID_ICH10_R_BM_LF 0x10CD -#define E1000_DEV_ID_ICH10_R_BM_V 0x10CE -#define E1000_DEV_ID_ICH10_HANKSVILLE 0xF0FE -#define E1000_DEV_ID_ICH10_D_BM_LM 0x10DE -#define E1000_DEV_ID_ICH10_D_BM_LF 0x10DF -#define E1000_DEV_ID_ICH10_D_BM_V 0x1525 +#define E1000_DEV_ID_82542 0x1000 +#define E1000_DEV_ID_82543GC_FIBER 0x1001 +#define E1000_DEV_ID_82543GC_COPPER 0x1004 +#define E1000_DEV_ID_82544EI_COPPER 0x1008 +#define E1000_DEV_ID_82544EI_FIBER 0x1009 +#define E1000_DEV_ID_82544GC_COPPER 0x100C +#define E1000_DEV_ID_82544GC_LOM 0x100D +#define E1000_DEV_ID_82540EM 0x100E +#define E1000_DEV_ID_82540EM_LOM 0x1015 +#define E1000_DEV_ID_82540EP_LOM 0x1016 +#define E1000_DEV_ID_82540EP 0x1017 +#define E1000_DEV_ID_82540EP_LP 0x101E +#define E1000_DEV_ID_82545EM_COPPER 0x100F +#define E1000_DEV_ID_82545EM_FIBER 0x1011 +#define E1000_DEV_ID_82545GM_COPPER 0x1026 +#define E1000_DEV_ID_82545GM_FIBER 0x1027 +#define E1000_DEV_ID_82545GM_SERDES 0x1028 +#define E1000_DEV_ID_82546EB_COPPER 0x1010 +#define E1000_DEV_ID_82546EB_FIBER 0x1012 +#define E1000_DEV_ID_82546EB_QUAD_COPPER 0x101D +#define E1000_DEV_ID_82546GB_COPPER 0x1079 +#define E1000_DEV_ID_82546GB_FIBER 0x107A +#define E1000_DEV_ID_82546GB_SERDES 0x107B +#define E1000_DEV_ID_82546GB_PCIE 0x108A +#define E1000_DEV_ID_82546GB_QUAD_COPPER 0x1099 +#define E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3 0x10B5 +#define E1000_DEV_ID_82541EI 0x1013 +#define E1000_DEV_ID_82541EI_MOBILE 0x1018 +#define E1000_DEV_ID_82541ER_LOM 0x1014 +#define E1000_DEV_ID_82541ER 0x1078 +#define E1000_DEV_ID_82541GI 0x1076 +#define E1000_DEV_ID_82541GI_LF 0x107C +#define E1000_DEV_ID_82541GI_MOBILE 0x1077 +#define E1000_DEV_ID_82547EI 0x1019 +#define E1000_DEV_ID_82547EI_MOBILE 0x101A +#define E1000_DEV_ID_82547GI 0x1075 +#define E1000_DEV_ID_82571EB_COPPER 0x105E +#define E1000_DEV_ID_82571EB_FIBER 0x105F +#define E1000_DEV_ID_82571EB_SERDES 0x1060 +#define E1000_DEV_ID_82571EB_SERDES_DUAL 0x10D9 +#define E1000_DEV_ID_82571EB_SERDES_QUAD 0x10DA +#define E1000_DEV_ID_82571EB_QUAD_COPPER 0x10A4 +#define E1000_DEV_ID_82571PT_QUAD_COPPER 0x10D5 +#define E1000_DEV_ID_82571EB_QUAD_FIBER 0x10A5 +#define E1000_DEV_ID_82571EB_QUAD_COPPER_LP 0x10BC +#define E1000_DEV_ID_82572EI_COPPER 0x107D +#define E1000_DEV_ID_82572EI_FIBER 0x107E +#define E1000_DEV_ID_82572EI_SERDES 0x107F +#define E1000_DEV_ID_82572EI 0x10B9 +#define E1000_DEV_ID_82573E 0x108B +#define E1000_DEV_ID_82573E_IAMT 0x108C +#define E1000_DEV_ID_82573L 0x109A +#define E1000_DEV_ID_82574L 0x10D3 +#define E1000_DEV_ID_82574LA 0x10F6 +#define E1000_DEV_ID_82583V 0x150C +#define E1000_DEV_ID_80003ES2LAN_COPPER_DPT 0x1096 +#define E1000_DEV_ID_80003ES2LAN_SERDES_DPT 0x1098 +#define E1000_DEV_ID_80003ES2LAN_COPPER_SPT 0x10BA +#define E1000_DEV_ID_80003ES2LAN_SERDES_SPT 0x10BB +#define E1000_DEV_ID_ICH8_82567V_3 0x1501 +#define E1000_DEV_ID_ICH8_IGP_M_AMT 0x1049 +#define E1000_DEV_ID_ICH8_IGP_AMT 0x104A +#define E1000_DEV_ID_ICH8_IGP_C 0x104B +#define E1000_DEV_ID_ICH8_IFE 0x104C +#define E1000_DEV_ID_ICH8_IFE_GT 0x10C4 +#define E1000_DEV_ID_ICH8_IFE_G 0x10C5 +#define E1000_DEV_ID_ICH8_IGP_M 0x104D +#define E1000_DEV_ID_ICH9_IGP_M 0x10BF +#define E1000_DEV_ID_ICH9_IGP_M_AMT 0x10F5 +#define E1000_DEV_ID_ICH9_IGP_M_V 0x10CB +#define E1000_DEV_ID_ICH9_IGP_AMT 0x10BD +#define E1000_DEV_ID_ICH9_BM 0x10E5 +#define E1000_DEV_ID_ICH9_IGP_C 0x294C +#define E1000_DEV_ID_ICH9_IFE 0x10C0 +#define E1000_DEV_ID_ICH9_IFE_GT 0x10C3 +#define E1000_DEV_ID_ICH9_IFE_G 0x10C2 +#define E1000_DEV_ID_ICH10_R_BM_LM 0x10CC +#define E1000_DEV_ID_ICH10_R_BM_LF 0x10CD +#define E1000_DEV_ID_ICH10_R_BM_V 0x10CE +#define E1000_DEV_ID_ICH10_D_BM_LM 0x10DE +#define E1000_DEV_ID_ICH10_D_BM_LF 0x10DF +#define E1000_DEV_ID_ICH10_D_BM_V 0x1525 -#define E1000_DEV_ID_PCH_M_HV_LM 0x10EA -#define E1000_DEV_ID_PCH_M_HV_LC 0x10EB -#define E1000_DEV_ID_PCH_D_HV_DM 0x10EF -#define E1000_DEV_ID_PCH_D_HV_DC 0x10F0 -#define E1000_DEV_ID_PCH2_LV_LM 0x1502 -#define E1000_DEV_ID_PCH2_LV_V 0x1503 -#define E1000_DEV_ID_82576 0x10C9 -#define E1000_DEV_ID_82576_FIBER 0x10E6 -#define E1000_DEV_ID_82576_SERDES 0x10E7 -#define E1000_DEV_ID_82576_QUAD_COPPER 0x10E8 -#define E1000_DEV_ID_82576_QUAD_COPPER_ET2 0x1526 -#define E1000_DEV_ID_82576_NS 0x150A -#define E1000_DEV_ID_82576_NS_SERDES 0x1518 -#define E1000_DEV_ID_82576_SERDES_QUAD 0x150D -#define E1000_DEV_ID_82576_VF 0x10CA -#define E1000_DEV_ID_I350_VF 0x1520 -#define E1000_DEV_ID_82575EB_COPPER 0x10A7 -#define E1000_DEV_ID_82575EB_FIBER_SERDES 0x10A9 -#define E1000_DEV_ID_82575GB_QUAD_COPPER 0x10D6 -#define E1000_DEV_ID_82575GB_QUAD_COPPER_PM 0x10E2 -#define E1000_DEV_ID_82580_COPPER 0x150E -#define E1000_DEV_ID_82580_FIBER 0x150F -#define E1000_DEV_ID_82580_SERDES 0x1510 -#define E1000_DEV_ID_82580_SGMII 0x1511 -#define E1000_DEV_ID_82580_COPPER_DUAL 0x1516 -#define E1000_DEV_ID_82580_QUAD_FIBER 0x1527 -#define E1000_DEV_ID_I350_COPPER 0x1521 -#define E1000_DEV_ID_I350_FIBER 0x1522 -#define E1000_DEV_ID_I350_SERDES 0x1523 -#define E1000_DEV_ID_I350_SGMII 0x1524 -#define E1000_DEV_ID_DH89XXCC_SGMII 0x0438 -#define E1000_DEV_ID_DH89XXCC_SERDES 0x043A -#define E1000_DEV_ID_DH89XXCC_BACKPLANE 0x043C -#define E1000_DEV_ID_DH89XXCC_SFP 0x0440 -#define E1000_REVISION_0 0 -#define E1000_REVISION_1 1 -#define E1000_REVISION_2 2 -#define E1000_REVISION_3 3 -#define E1000_REVISION_4 4 +#define E1000_DEV_ID_PCH_M_HV_LM 0x10EA +#define E1000_DEV_ID_PCH_M_HV_LC 0x10EB +#define E1000_DEV_ID_PCH_D_HV_DM 0x10EF +#define E1000_DEV_ID_PCH_D_HV_DC 0x10F0 +#define E1000_DEV_ID_PCH2_LV_LM 0x1502 +#define E1000_DEV_ID_PCH2_LV_V 0x1503 +#define E1000_DEV_ID_82576 0x10C9 +#define E1000_DEV_ID_82576_FIBER 0x10E6 +#define E1000_DEV_ID_82576_SERDES 0x10E7 +#define E1000_DEV_ID_82576_QUAD_COPPER 0x10E8 +#define E1000_DEV_ID_82576_QUAD_COPPER_ET2 0x1526 +#define E1000_DEV_ID_82576_NS 0x150A +#define E1000_DEV_ID_82576_NS_SERDES 0x1518 +#define E1000_DEV_ID_82576_SERDES_QUAD 0x150D +#define E1000_DEV_ID_82576_VF 0x10CA +#define E1000_DEV_ID_I350_VF 0x1520 +#define E1000_DEV_ID_82575EB_COPPER 0x10A7 +#define E1000_DEV_ID_82575EB_FIBER_SERDES 0x10A9 +#define E1000_DEV_ID_82575GB_QUAD_COPPER 0x10D6 +#define E1000_DEV_ID_82580_COPPER 0x150E +#define E1000_DEV_ID_82580_FIBER 0x150F +#define E1000_DEV_ID_82580_SERDES 0x1510 +#define E1000_DEV_ID_82580_SGMII 0x1511 +#define E1000_DEV_ID_82580_COPPER_DUAL 0x1516 +#define E1000_DEV_ID_82580_QUAD_FIBER 0x1527 +#define E1000_DEV_ID_I350_COPPER 0x1521 +#define E1000_DEV_ID_I350_FIBER 0x1522 +#define E1000_DEV_ID_I350_SERDES 0x1523 +#define E1000_DEV_ID_I350_SGMII 0x1524 +#define E1000_DEV_ID_I350_DA4 0x1546 +#define E1000_DEV_ID_I210_COPPER 0x1533 +#define E1000_DEV_ID_I210_COPPER_OEM1 0x1534 +#define E1000_DEV_ID_I210_COPPER_IT 0x1535 +#define E1000_DEV_ID_I210_FIBER 0x1536 +#define E1000_DEV_ID_I210_SERDES 0x1537 +#define E1000_DEV_ID_I210_SGMII 0x1538 +#define E1000_DEV_ID_I211_COPPER 0x1539 +#define E1000_DEV_ID_DH89XXCC_SGMII 0x0438 +#define E1000_DEV_ID_DH89XXCC_SERDES 0x043A +#define E1000_DEV_ID_DH89XXCC_BACKPLANE 0x043C +#define E1000_DEV_ID_DH89XXCC_SFP 0x0440 +#define E1000_REVISION_0 0 +#define E1000_REVISION_1 1 +#define E1000_REVISION_2 2 +#define E1000_REVISION_3 3 +#define E1000_REVISION_4 4 -#define E1000_FUNC_0 0 -#define E1000_FUNC_1 1 -#define E1000_FUNC_2 2 -#define E1000_FUNC_3 3 +#define E1000_FUNC_0 0 +#define E1000_FUNC_1 1 +#define E1000_FUNC_2 2 +#define E1000_FUNC_3 3 -#define E1000_ALT_MAC_ADDRESS_OFFSET_LAN0 0 -#define E1000_ALT_MAC_ADDRESS_OFFSET_LAN1 3 -#define E1000_ALT_MAC_ADDRESS_OFFSET_LAN2 6 -#define E1000_ALT_MAC_ADDRESS_OFFSET_LAN3 9 +#define E1000_ALT_MAC_ADDRESS_OFFSET_LAN0 0 +#define E1000_ALT_MAC_ADDRESS_OFFSET_LAN1 3 +#define E1000_ALT_MAC_ADDRESS_OFFSET_LAN2 6 +#define E1000_ALT_MAC_ADDRESS_OFFSET_LAN3 9 enum e1000_mac_type { e1000_undefined = 0, @@ -204,6 +210,8 @@ enum e1000_mac_type { e1000_82576, e1000_82580, e1000_i350, + e1000_i210, + e1000_i211, e1000_vfadapt, e1000_vfadapt_i350, e1000_num_macs /* List is 1-based, so subtract 1 for TRUE count. */ @@ -249,6 +257,7 @@ enum e1000_phy_type { e1000_phy_82579, e1000_phy_82580, e1000_phy_vf, + e1000_phy_i210, }; enum e1000_bus_type { @@ -342,9 +351,9 @@ enum e1000_serdes_link_state { struct e1000_rx_desc { __le64 buffer_addr; /* Address of the descriptor's data buffer */ __le16 length; /* Length of data DMAed into data buffer */ - __le16 csum; /* Packet checksum */ - u8 status; /* Descriptor status */ - u8 errors; /* Descriptor Errors */ + __le16 csum; /* Packet checksum */ + u8 status; /* Descriptor status */ + u8 errors; /* Descriptor Errors */ __le16 special; }; @@ -356,9 +365,9 @@ union e1000_rx_desc_extended { } read; struct { struct { - __le32 mrq; /* Multiple Rx Queues */ + __le32 mrq; /* Multiple Rx Queues */ union { - __le32 rss; /* RSS Hash */ + __le32 rss; /* RSS Hash */ struct { __le16 ip_id; /* IP id */ __le16 csum; /* Packet Checksum */ @@ -368,7 +377,7 @@ union e1000_rx_desc_extended { struct { __le32 status_error; /* ext status/error */ __le16 length; - __le16 vlan; /* VLAN tag */ + __le16 vlan; /* VLAN tag */ } upper; } wb; /* writeback */ }; @@ -382,9 +391,9 @@ union e1000_rx_desc_packet_split { } read; struct { struct { - __le32 mrq; /* Multiple Rx Queues */ + __le32 mrq; /* Multiple Rx Queues */ union { - __le32 rss; /* RSS Hash */ + __le32 rss; /* RSS Hash */ struct { __le16 ip_id; /* IP id */ __le16 csum; /* Packet Checksum */ @@ -393,8 +402,8 @@ union e1000_rx_desc_packet_split { } lower; struct { __le32 status_error; /* ext status/error */ - __le16 length0; /* length of buffer 0 */ - __le16 vlan; /* VLAN tag */ + __le16 length0; /* length of buffer 0 */ + __le16 vlan; /* VLAN tag */ } middle; struct { __le16 header_status; @@ -410,16 +419,16 @@ struct e1000_tx_desc { union { __le32 data; struct { - __le16 length; /* Data buffer length */ - u8 cso; /* Checksum offset */ - u8 cmd; /* Descriptor control */ + __le16 length; /* Data buffer length */ + u8 cso; /* Checksum offset */ + u8 cmd; /* Descriptor control */ } flags; } lower; union { __le32 data; struct { - u8 status; /* Descriptor status */ - u8 css; /* Checksum start */ + u8 status; /* Descriptor status */ + u8 css; /* Checksum start */ __le16 special; } fields; } upper; @@ -430,37 +439,37 @@ struct e1000_context_desc { union { __le32 ip_config; struct { - u8 ipcss; /* IP checksum start */ - u8 ipcso; /* IP checksum offset */ - __le16 ipcse; /* IP checksum end */ + u8 ipcss; /* IP checksum start */ + u8 ipcso; /* IP checksum offset */ + __le16 ipcse; /* IP checksum end */ } ip_fields; } lower_setup; union { __le32 tcp_config; struct { - u8 tucss; /* TCP checksum start */ - u8 tucso; /* TCP checksum offset */ - __le16 tucse; /* TCP checksum end */ + u8 tucss; /* TCP checksum start */ + u8 tucso; /* TCP checksum offset */ + __le16 tucse; /* TCP checksum end */ } tcp_fields; } upper_setup; __le32 cmd_and_length; union { __le32 data; struct { - u8 status; /* Descriptor status */ - u8 hdr_len; /* Header length */ - __le16 mss; /* Maximum segment size */ + u8 status; /* Descriptor status */ + u8 hdr_len; /* Header length */ + __le16 mss; /* Maximum segment size */ } fields; } tcp_seg_setup; }; /* Offload data descriptor */ struct e1000_data_desc { - __le64 buffer_addr; /* Address of the descriptor's buffer address */ + __le64 buffer_addr; /* Address of the descriptor's buffer address */ union { __le32 data; struct { - __le16 length; /* Data buffer length */ + __le16 length; /* Data buffer length */ u8 typ_len_ext; u8 cmd; } flags; @@ -468,8 +477,8 @@ struct e1000_data_desc { union { __le32 data; struct { - u8 status; /* Descriptor status */ - u8 popts; /* Packet Options */ + u8 status; /* Descriptor status */ + u8 popts; /* Packet Options */ __le16 special; } fields; } upper; @@ -553,6 +562,10 @@ struct e1000_hw_stats { u64 scvpc; u64 hrmpc; u64 doosync; + u64 o2bgptc; + u64 o2bspc; + u64 b2ospc; + u64 b2ogprc; }; struct e1000_vf_stats { @@ -611,7 +624,7 @@ struct e1000_host_command_header { u8 checksum; }; -#define E1000_HI_MAX_DATA_LENGTH 252 +#define E1000_HI_MAX_DATA_LENGTH 252 struct e1000_host_command_info { struct e1000_host_command_header command_header; u8 command_data[E1000_HI_MAX_DATA_LENGTH]; @@ -626,7 +639,7 @@ struct e1000_host_mng_command_header { u16 command_length; }; -#define E1000_HI_MAX_MNG_DATA_LENGTH 0x6F8 +#define E1000_HI_MAX_MNG_DATA_LENGTH 0x6F8 struct e1000_host_mng_command_info { struct e1000_host_mng_command_header command_header; u8 command_data[E1000_HI_MAX_MNG_DATA_LENGTH]; @@ -668,11 +681,28 @@ struct e1000_mac_operations { s32 (*validate_mdi_setting)(struct e1000_hw *); s32 (*mng_host_if_write)(struct e1000_hw *, u8*, u16, u16, u8*); s32 (*mng_write_cmd_header)(struct e1000_hw *hw, - struct e1000_host_mng_command_header*); + struct e1000_host_mng_command_header*); s32 (*mng_enable_host_if)(struct e1000_hw *); s32 (*wait_autoneg)(struct e1000_hw *); + s32 (*acquire_swfw_sync)(struct e1000_hw *, u16); + void (*release_swfw_sync)(struct e1000_hw *, u16); }; +/* + * When to use various PHY register access functions: + * + * Func Caller + * Function Does Does When to use + * ~~~~~~~~~~~~ ~~~~~ ~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + * X_reg L,P,A n/a for simple PHY reg accesses + * X_reg_locked P,A L for multiple accesses of different regs + * on different pages + * X_reg_page A L,P for multiple accesses of different regs + * on the same page + * + * Where X=[read|write], L=locking, P=sets page, A=register access + * + */ struct e1000_phy_operations { s32 (*init_params)(struct e1000_hw *); s32 (*acquire)(struct e1000_hw *); @@ -684,16 +714,21 @@ struct e1000_phy_operations { s32 (*get_cfg_done)(struct e1000_hw *hw); s32 (*get_cable_length)(struct e1000_hw *); s32 (*get_info)(struct e1000_hw *); + s32 (*set_page)(struct e1000_hw *, u16); s32 (*read_reg)(struct e1000_hw *, u32, u16 *); s32 (*read_reg_locked)(struct e1000_hw *, u32, u16 *); + s32 (*read_reg_page)(struct e1000_hw *, u32, u16 *); void (*release)(struct e1000_hw *); s32 (*reset)(struct e1000_hw *); s32 (*set_d0_lplu_state)(struct e1000_hw *, bool); s32 (*set_d3_lplu_state)(struct e1000_hw *, bool); s32 (*write_reg)(struct e1000_hw *, u32, u16); s32 (*write_reg_locked)(struct e1000_hw *, u32, u16); + s32 (*write_reg_page)(struct e1000_hw *, u32, u16); void (*power_up)(struct e1000_hw *); void (*power_down)(struct e1000_hw *); + s32 (*read_i2c_byte)(struct e1000_hw *, u8, u8, u8 *); + s32 (*write_i2c_byte)(struct e1000_hw *, u8, u8, u8); }; struct e1000_nvm_operations { @@ -781,7 +816,6 @@ struct e1000_phy_info { bool disable_polarity_correction; bool is_mdix; bool polarity_correction; - bool reset_disable; bool speed_downgraded; bool autoneg_wait_to_complete; }; @@ -811,14 +845,14 @@ struct e1000_bus_info { }; struct e1000_fc_info { - u32 high_water; /* Flow control high-water mark */ - u32 low_water; /* Flow control low-water mark */ - u16 pause_time; /* Flow control pause timer */ - u16 refresh_time; /* Flow control refresh timer */ - bool send_xon; /* Flow control send XON */ - bool strict_ieee; /* Strict IEEE mode */ - enum e1000_fc_mode current_mode; /* FC mode in effect */ - enum e1000_fc_mode requested_mode; /* FC mode requested by caller */ + u32 high_water; /* Flow control high-water mark */ + u32 low_water; /* Flow control low-water mark */ + u16 pause_time; /* Flow control pause timer */ + u16 refresh_time; /* Flow control refresh timer */ + bool send_xon; /* Flow control send XON */ + bool strict_ieee; /* Strict IEEE mode */ + enum e1000_fc_mode current_mode; /* FC mode in effect */ + enum e1000_fc_mode requested_mode; /* FC mode requested by caller */ }; struct e1000_mbx_operations { @@ -896,6 +930,8 @@ struct e1000_dev_spec_82575 { bool sgmii_active; bool global_device_reset; bool eee_disable; + bool module_plugged; + u32 mtu; }; struct e1000_dev_spec_vf { @@ -943,6 +979,7 @@ struct e1000_hw { #include "e1000_80003es2lan.h" #include "e1000_ich8lan.h" #include "e1000_82575.h" +#include "e1000_i210.h" /* These functions must be implemented by drivers */ void e1000_pci_clear_mwi(struct e1000_hw *hw); diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_i210.c b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_i210.c new file mode 100644 index 0000000000..f8e8bad0d8 --- /dev/null +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_i210.c @@ -0,0 +1,740 @@ +/****************************************************************************** + + Copyright (c) 2001-2012, Intel 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 the Intel 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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$*/ + +#include "e1000_api.h" + + +static s32 e1000_acquire_nvm_i210(struct e1000_hw *hw); +static void e1000_release_nvm_i210(struct e1000_hw *hw); +static s32 e1000_get_hw_semaphore_i210(struct e1000_hw *hw); +static void e1000_put_hw_semaphore_i210(struct e1000_hw *hw); +static s32 e1000_write_nvm_srwr(struct e1000_hw *hw, u16 offset, u16 words, + u16 *data); +static s32 e1000_pool_flash_update_done_i210(struct e1000_hw *hw); +static s32 e1000_valid_led_default_i210(struct e1000_hw *hw, u16 *data); +static s32 e1000_read_nvm_i211(struct e1000_hw *hw, u16 offset, u16 words, + u16 *data); + +/** + * e1000_acquire_nvm_i210 - Request for access to EEPROM + * @hw: pointer to the HW structure + * + * Acquire the necessary semaphores for exclusive access to the EEPROM. + * Set the EEPROM access request bit and wait for EEPROM access grant bit. + * Return successful if access grant bit set, else clear the request for + * EEPROM access and return -E1000_ERR_NVM (-1). + **/ +static s32 e1000_acquire_nvm_i210(struct e1000_hw *hw) +{ + s32 ret_val; + + DEBUGFUNC("e1000_acquire_nvm_i210"); + + ret_val = e1000_acquire_swfw_sync_i210(hw, E1000_SWFW_EEP_SM); + + return ret_val; +} + +/** + * e1000_release_nvm_i210 - Release exclusive access to EEPROM + * @hw: pointer to the HW structure + * + * Stop any current commands to the EEPROM and clear the EEPROM request bit, + * then release the semaphores acquired. + **/ +static void e1000_release_nvm_i210(struct e1000_hw *hw) +{ + DEBUGFUNC("e1000_release_nvm_i210"); + + e1000_release_swfw_sync_i210(hw, E1000_SWFW_EEP_SM); +} + +/** + * e1000_acquire_swfw_sync_i210 - Acquire SW/FW semaphore + * @hw: pointer to the HW structure + * @mask: specifies which semaphore to acquire + * + * Acquire the SW/FW semaphore to access the PHY or NVM. The mask + * will also specify which port we're acquiring the lock for. + **/ +s32 e1000_acquire_swfw_sync_i210(struct e1000_hw *hw, u16 mask) +{ + u32 swfw_sync; + u32 swmask = mask; + u32 fwmask = mask << 16; + s32 ret_val = E1000_SUCCESS; + s32 i = 0, timeout = 200; /* FIXME: find real value to use here */ + + DEBUGFUNC("e1000_acquire_swfw_sync_i210"); + + while (i < timeout) { + if (e1000_get_hw_semaphore_i210(hw)) { + ret_val = -E1000_ERR_SWFW_SYNC; + goto out; + } + + swfw_sync = E1000_READ_REG(hw, E1000_SW_FW_SYNC); + if (!(swfw_sync & fwmask)) + break; + + /* + * Firmware currently using resource (fwmask) + */ + e1000_put_hw_semaphore_i210(hw); + msec_delay_irq(5); + i++; + } + + if (i == timeout) { + DEBUGOUT("Driver can't access resource, SW_FW_SYNC timeout.\n"); + ret_val = -E1000_ERR_SWFW_SYNC; + goto out; + } + + swfw_sync |= swmask; + E1000_WRITE_REG(hw, E1000_SW_FW_SYNC, swfw_sync); + + e1000_put_hw_semaphore_i210(hw); + +out: + return ret_val; +} + +/** + * e1000_release_swfw_sync_i210 - Release SW/FW semaphore + * @hw: pointer to the HW structure + * @mask: specifies which semaphore to acquire + * + * Release the SW/FW semaphore used to access the PHY or NVM. The mask + * will also specify which port we're releasing the lock for. + **/ +void e1000_release_swfw_sync_i210(struct e1000_hw *hw, u16 mask) +{ + u32 swfw_sync; + + DEBUGFUNC("e1000_release_swfw_sync_i210"); + + while (e1000_get_hw_semaphore_i210(hw) != E1000_SUCCESS) + ; /* Empty */ + + swfw_sync = E1000_READ_REG(hw, E1000_SW_FW_SYNC); + swfw_sync &= ~mask; + E1000_WRITE_REG(hw, E1000_SW_FW_SYNC, swfw_sync); + + e1000_put_hw_semaphore_i210(hw); +} + +/** + * e1000_get_hw_semaphore_i210 - Acquire hardware semaphore + * @hw: pointer to the HW structure + * + * Acquire the HW semaphore to access the PHY or NVM + **/ +static s32 e1000_get_hw_semaphore_i210(struct e1000_hw *hw) +{ + u32 swsm; + s32 ret_val = E1000_SUCCESS; + s32 timeout = hw->nvm.word_size + 1; + s32 i = 0; + + DEBUGFUNC("e1000_get_hw_semaphore_i210"); + + /* Get the FW semaphore. */ + for (i = 0; i < timeout; i++) { + swsm = E1000_READ_REG(hw, E1000_SWSM); + E1000_WRITE_REG(hw, E1000_SWSM, swsm | E1000_SWSM_SWESMBI); + + /* Semaphore acquired if bit latched */ + if (E1000_READ_REG(hw, E1000_SWSM) & E1000_SWSM_SWESMBI) + break; + + usec_delay(50); + } + + if (i == timeout) { + /* Release semaphores */ + e1000_put_hw_semaphore_generic(hw); + DEBUGOUT("Driver can't access the NVM\n"); + ret_val = -E1000_ERR_NVM; + goto out; + } + +out: + return ret_val; +} + +/** + * e1000_put_hw_semaphore_i210 - Release hardware semaphore + * @hw: pointer to the HW structure + * + * Release hardware semaphore used to access the PHY or NVM + **/ +static void e1000_put_hw_semaphore_i210(struct e1000_hw *hw) +{ + u32 swsm; + + DEBUGFUNC("e1000_put_hw_semaphore_i210"); + + swsm = E1000_READ_REG(hw, E1000_SWSM); + + swsm &= ~E1000_SWSM_SWESMBI; + + E1000_WRITE_REG(hw, E1000_SWSM, swsm); +} + +/** + * e1000_read_nvm_srrd_i210 - Reads Shadow Ram using EERD register + * @hw: pointer to the HW structure + * @offset: offset of word in the Shadow Ram to read + * @words: number of words to read + * @data: word read from the Shadow Ram + * + * Reads a 16 bit word from the Shadow Ram using the EERD register. + * Uses necessary synchronization semaphores. + **/ +s32 e1000_read_nvm_srrd_i210(struct e1000_hw *hw, u16 offset, u16 words, + u16 *data) +{ + s32 status = E1000_SUCCESS; + u16 i, count; + + DEBUGFUNC("e1000_read_nvm_srrd_i210"); + + /* We cannot hold synchronization semaphores for too long, + * because of forceful takeover procedure. However it is more efficient + * to read in bursts than synchronizing access for each word. */ + for (i = 0; i < words; i += E1000_EERD_EEWR_MAX_COUNT) { + count = (words - i) / E1000_EERD_EEWR_MAX_COUNT > 0 ? + E1000_EERD_EEWR_MAX_COUNT : (words - i); + if (hw->nvm.ops.acquire(hw) == E1000_SUCCESS) { + status = e1000_read_nvm_eerd(hw, offset, count, + data + i); + hw->nvm.ops.release(hw); + } else { + status = E1000_ERR_SWFW_SYNC; + } + + if (status != E1000_SUCCESS) + break; + } + + return status; +} + +/** + * e1000_write_nvm_srwr_i210 - Write to Shadow RAM using EEWR + * @hw: pointer to the HW structure + * @offset: offset within the Shadow RAM to be written to + * @words: number of words to write + * @data: 16 bit word(s) to be written to the Shadow RAM + * + * Writes data to Shadow RAM at offset using EEWR register. + * + * If e1000_update_nvm_checksum is not called after this function , the + * data will not be committed to FLASH and also Shadow RAM will most likely + * contain an invalid checksum. + * + * If error code is returned, data and Shadow RAM may be inconsistent - buffer + * partially written. + **/ +s32 e1000_write_nvm_srwr_i210(struct e1000_hw *hw, u16 offset, u16 words, + u16 *data) +{ + s32 status = E1000_SUCCESS; + u16 i, count; + + DEBUGFUNC("e1000_write_nvm_srwr_i210"); + + /* We cannot hold synchronization semaphores for too long, + * because of forceful takeover procedure. However it is more efficient + * to write in bursts than synchronizing access for each word. */ + for (i = 0; i < words; i += E1000_EERD_EEWR_MAX_COUNT) { + count = (words - i) / E1000_EERD_EEWR_MAX_COUNT > 0 ? + E1000_EERD_EEWR_MAX_COUNT : (words - i); + if (hw->nvm.ops.acquire(hw) == E1000_SUCCESS) { + status = e1000_write_nvm_srwr(hw, offset, count, + data + i); + hw->nvm.ops.release(hw); + } else { + status = E1000_ERR_SWFW_SYNC; + } + + if (status != E1000_SUCCESS) + break; + } + + return status; +} + +/** + * e1000_write_nvm_srwr - Write to Shadow Ram using EEWR + * @hw: pointer to the HW structure + * @offset: offset within the Shadow Ram to be written to + * @words: number of words to write + * @data: 16 bit word(s) to be written to the Shadow Ram + * + * Writes data to Shadow Ram at offset using EEWR register. + * + * If e1000_update_nvm_checksum is not called after this function , the + * Shadow Ram will most likely contain an invalid checksum. + **/ +static s32 e1000_write_nvm_srwr(struct e1000_hw *hw, u16 offset, u16 words, + u16 *data) +{ + struct e1000_nvm_info *nvm = &hw->nvm; + u32 i, k, eewr = 0; + u32 attempts = 100000; + s32 ret_val = E1000_SUCCESS; + + DEBUGFUNC("e1000_write_nvm_srwr"); + + /* + * A check for invalid values: offset too large, too many words, + * too many words for the offset, and not enough words. + */ + if ((offset >= nvm->word_size) || (words > (nvm->word_size - offset)) || + (words == 0)) { + DEBUGOUT("nvm parameter(s) out of bounds\n"); + ret_val = -E1000_ERR_NVM; + goto out; + } + + for (i = 0; i < words; i++) { + eewr = ((offset+i) << E1000_NVM_RW_ADDR_SHIFT) | + (data[i] << E1000_NVM_RW_REG_DATA) | + E1000_NVM_RW_REG_START; + + E1000_WRITE_REG(hw, E1000_SRWR, eewr); + + for (k = 0; k < attempts; k++) { + if (E1000_NVM_RW_REG_DONE & + E1000_READ_REG(hw, E1000_SRWR)) { + ret_val = E1000_SUCCESS; + break; + } + usec_delay(5); + } + + if (ret_val != E1000_SUCCESS) { + DEBUGOUT("Shadow RAM write EEWR timed out\n"); + break; + } + } + +out: + return ret_val; +} + +/** + * e1000_read_nvm_i211 - Read NVM wrapper function for I211 + * @hw: pointer to the HW structure + * @address: the word address (aka eeprom offset) to read + * @data: pointer to the data read + * + * Wrapper function to return data formerly found in the NVM. + **/ +static s32 e1000_read_nvm_i211(struct e1000_hw *hw, u16 offset, u16 words, + u16 *data) +{ + s32 ret_val = E1000_SUCCESS; + + DEBUGFUNC("e1000_read_nvm_i211"); + + /* Only the MAC addr is required to be present in the iNVM */ + switch (offset) { + case NVM_MAC_ADDR: + ret_val = e1000_read_invm_i211(hw, (u8)offset, &data[0]); + ret_val |= e1000_read_invm_i211(hw, (u8)offset+1, &data[1]); + ret_val |= e1000_read_invm_i211(hw, (u8)offset+2, &data[2]); + if (ret_val != E1000_SUCCESS) + DEBUGOUT("MAC Addr not found in iNVM\n"); + break; + case NVM_ID_LED_SETTINGS: + case NVM_INIT_CTRL_2: + case NVM_INIT_CTRL_4: + case NVM_LED_1_CFG: + case NVM_LED_0_2_CFG: + e1000_read_invm_i211(hw, (u8)offset, data); + break; + case NVM_COMPAT: + *data = ID_LED_DEFAULT_I210; + break; + case NVM_SUB_DEV_ID: + *data = hw->subsystem_device_id; + break; + case NVM_SUB_VEN_ID: + *data = hw->subsystem_vendor_id; + break; + case NVM_DEV_ID: + *data = hw->device_id; + break; + case NVM_VEN_ID: + *data = hw->vendor_id; + break; + default: + DEBUGOUT1("NVM word 0x%02x is not mapped.\n", offset); + *data = NVM_RESERVED_WORD; + break; + } + return ret_val; +} + +/** + * e1000_read_invm_i211 - Reads OTP + * @hw: pointer to the HW structure + * @address: the word address (aka eeprom offset) to read + * @data: pointer to the data read + * + * Reads 16-bit words from the OTP. Return error when the word is not + * stored in OTP. + **/ +s32 e1000_read_invm_i211(struct e1000_hw *hw, u8 address, u16 *data) +{ + s32 status = -E1000_ERR_INVM_VALUE_NOT_FOUND; + u32 invm_dword; + u16 i; + u8 record_type, word_address; + + DEBUGFUNC("e1000_read_invm_i211"); + + for (i = 0; i < E1000_INVM_SIZE; i++) { + invm_dword = E1000_READ_REG(hw, E1000_INVM_DATA_REG(i)); + /* Get record type */ + record_type = INVM_DWORD_TO_RECORD_TYPE(invm_dword); + if (record_type == E1000_INVM_UNINITIALIZED_STRUCTURE) + break; + if (record_type == E1000_INVM_CSR_AUTOLOAD_STRUCTURE) + i += E1000_INVM_CSR_AUTOLOAD_DATA_SIZE_IN_DWORDS; + if (record_type == E1000_INVM_RSA_KEY_SHA256_STRUCTURE) + i += E1000_INVM_RSA_KEY_SHA256_DATA_SIZE_IN_DWORDS; + if (record_type == E1000_INVM_WORD_AUTOLOAD_STRUCTURE) { + word_address = INVM_DWORD_TO_WORD_ADDRESS(invm_dword); + if (word_address == address) { + *data = INVM_DWORD_TO_WORD_DATA(invm_dword); + DEBUGOUT2("Read INVM Word 0x%02x = %x", + address, *data); + status = E1000_SUCCESS; + break; + } + } + } + if (status != E1000_SUCCESS) + DEBUGOUT1("Requested word 0x%02x not found in OTP\n", address); + return status; +} + +/** + * e1000_validate_nvm_checksum_i210 - Validate EEPROM checksum + * @hw: pointer to the HW structure + * + * Calculates the EEPROM checksum by reading/adding each word of the EEPROM + * and then verifies that the sum of the EEPROM is equal to 0xBABA. + **/ +s32 e1000_validate_nvm_checksum_i210(struct e1000_hw *hw) +{ + s32 status = E1000_SUCCESS; + s32 (*read_op_ptr)(struct e1000_hw *, u16, u16, u16 *); + + DEBUGFUNC("e1000_validate_nvm_checksum_i210"); + + if (hw->nvm.ops.acquire(hw) == E1000_SUCCESS) { + + /* + * Replace the read function with semaphore grabbing with + * the one that skips this for a while. + * We have semaphore taken already here. + */ + read_op_ptr = hw->nvm.ops.read; + hw->nvm.ops.read = e1000_read_nvm_eerd; + + status = e1000_validate_nvm_checksum_generic(hw); + + /* Revert original read operation. */ + hw->nvm.ops.read = read_op_ptr; + + hw->nvm.ops.release(hw); + } else { + status = E1000_ERR_SWFW_SYNC; + } + + return status; +} + + +/** + * e1000_update_nvm_checksum_i210 - Update EEPROM checksum + * @hw: pointer to the HW structure + * + * Updates the EEPROM checksum by reading/adding each word of the EEPROM + * up to the checksum. Then calculates the EEPROM checksum and writes the + * value to the EEPROM. Next commit EEPROM data onto the Flash. + **/ +s32 e1000_update_nvm_checksum_i210(struct e1000_hw *hw) +{ + s32 ret_val = E1000_SUCCESS; + u16 checksum = 0; + u16 i, nvm_data; + + DEBUGFUNC("e1000_update_nvm_checksum_i210"); + + /* + * Read the first word from the EEPROM. If this times out or fails, do + * not continue or we could be in for a very long wait while every + * EEPROM read fails + */ + ret_val = e1000_read_nvm_eerd(hw, 0, 1, &nvm_data); + if (ret_val != E1000_SUCCESS) { + DEBUGOUT("EEPROM read failed\n"); + goto out; + } + + if (hw->nvm.ops.acquire(hw) == E1000_SUCCESS) { + /* + * Do not use hw->nvm.ops.write, hw->nvm.ops.read + * because we do not want to take the synchronization + * semaphores twice here. + */ + + for (i = 0; i < NVM_CHECKSUM_REG; i++) { + ret_val = e1000_read_nvm_eerd(hw, i, 1, &nvm_data); + if (ret_val) { + hw->nvm.ops.release(hw); + DEBUGOUT("NVM Read Error while updating checksum.\n"); + goto out; + } + checksum += nvm_data; + } + checksum = (u16) NVM_SUM - checksum; + ret_val = e1000_write_nvm_srwr(hw, NVM_CHECKSUM_REG, 1, + &checksum); + if (ret_val != E1000_SUCCESS) { + hw->nvm.ops.release(hw); + DEBUGOUT("NVM Write Error while updating checksum.\n"); + goto out; + } + + hw->nvm.ops.release(hw); + + ret_val = e1000_update_flash_i210(hw); + } else { + ret_val = E1000_ERR_SWFW_SYNC; + } +out: + return ret_val; +} + +/** + * e1000_get_flash_presence_i210 - Check if flash device is detected. + * @hw: pointer to the HW structure + * + **/ +static bool e1000_get_flash_presence_i210(struct e1000_hw *hw) +{ + u32 eec = 0; + bool ret_val = FALSE; + + DEBUGFUNC("e1000_get_flash_presence_i210"); + + eec = E1000_READ_REG(hw, E1000_EECD); + + if (eec & E1000_EECD_FLASH_DETECTED_I210) + ret_val = TRUE; + + return ret_val; +} + +/** + * e1000_update_flash_i210 - Commit EEPROM to the flash + * @hw: pointer to the HW structure + * + **/ +s32 e1000_update_flash_i210(struct e1000_hw *hw) +{ + s32 ret_val = E1000_SUCCESS; + u32 flup; + + DEBUGFUNC("e1000_update_flash_i210"); + + ret_val = e1000_pool_flash_update_done_i210(hw); + if (ret_val == -E1000_ERR_NVM) { + DEBUGOUT("Flash update time out\n"); + goto out; + } + + flup = E1000_READ_REG(hw, E1000_EECD) | E1000_EECD_FLUPD_I210; + E1000_WRITE_REG(hw, E1000_EECD, flup); + + ret_val = e1000_pool_flash_update_done_i210(hw); + if (ret_val == E1000_SUCCESS) + DEBUGOUT("Flash update complete\n"); + else + DEBUGOUT("Flash update time out\n"); + +out: + return ret_val; +} + +/** + * e1000_pool_flash_update_done_i210 - Pool FLUDONE status. + * @hw: pointer to the HW structure + * + **/ +s32 e1000_pool_flash_update_done_i210(struct e1000_hw *hw) +{ + s32 ret_val = -E1000_ERR_NVM; + u32 i, reg; + + DEBUGFUNC("e1000_pool_flash_update_done_i210"); + + for (i = 0; i < E1000_FLUDONE_ATTEMPTS; i++) { + reg = E1000_READ_REG(hw, E1000_EECD); + if (reg & E1000_EECD_FLUDONE_I210) { + ret_val = E1000_SUCCESS; + break; + } + usec_delay(5); + } + + return ret_val; +} + +/** + * e1000_init_nvm_params_i210 - Initialize i210 NVM function pointers + * @hw: pointer to the HW structure + * + * Initialize the i210 NVM parameters and function pointers. + **/ +static s32 e1000_init_nvm_params_i210(struct e1000_hw *hw) +{ + s32 ret_val = E1000_SUCCESS; + struct e1000_nvm_info *nvm = &hw->nvm; + + DEBUGFUNC("e1000_init_nvm_params_i210"); + + ret_val = e1000_init_nvm_params_82575(hw); + + nvm->ops.acquire = e1000_acquire_nvm_i210; + nvm->ops.release = e1000_release_nvm_i210; + nvm->ops.read = e1000_read_nvm_srrd_i210; + nvm->ops.write = e1000_write_nvm_srwr_i210; + nvm->ops.valid_led_default = e1000_valid_led_default_i210; + nvm->ops.validate = e1000_validate_nvm_checksum_i210; + nvm->ops.update = e1000_update_nvm_checksum_i210; + + return ret_val; +} + +/** + * e1000_init_nvm_params_i211 - Initialize i211 NVM function pointers + * @hw: pointer to the HW structure + * + * Initialize the NVM parameters and function pointers for i211. + **/ +static s32 e1000_init_nvm_params_i211(struct e1000_hw *hw) +{ + struct e1000_nvm_info *nvm = &hw->nvm; + + DEBUGFUNC("e1000_init_nvm_params_i211"); + + nvm->ops.acquire = e1000_acquire_nvm_i210; + nvm->ops.release = e1000_release_nvm_i210; + nvm->ops.read = e1000_read_nvm_i211; + nvm->ops.valid_led_default = e1000_valid_led_default_i210; + nvm->ops.write = e1000_null_write_nvm; + nvm->ops.validate = e1000_null_ops_generic; + nvm->ops.update = e1000_null_ops_generic; + + return E1000_SUCCESS; +} + +/** + * e1000_init_function_pointers_i210 - Init func ptrs. + * @hw: pointer to the HW structure + * + * Called to initialize all function pointers and parameters. + **/ +void e1000_init_function_pointers_i210(struct e1000_hw *hw) +{ + e1000_init_function_pointers_82575(hw); + + switch (hw->mac.type) { + case e1000_i210: + if (e1000_get_flash_presence_i210(hw)) + hw->nvm.ops.init_params = e1000_init_nvm_params_i210; + else + hw->nvm.ops.init_params = e1000_init_nvm_params_i211; + break; + case e1000_i211: + hw->nvm.ops.init_params = e1000_init_nvm_params_i211; + break; + default: + break; + } + return; +} + +/** + * e1000_valid_led_default_i210 - Verify a valid default LED config + * @hw: pointer to the HW structure + * @data: pointer to the NVM (EEPROM) + * + * Read the EEPROM for the current default LED configuration. If the + * LED configuration is not valid, set to a valid LED configuration. + **/ +static s32 e1000_valid_led_default_i210(struct e1000_hw *hw, u16 *data) +{ + s32 ret_val; + + DEBUGFUNC("e1000_valid_led_default_i210"); + + ret_val = hw->nvm.ops.read(hw, NVM_ID_LED_SETTINGS, 1, data); + if (ret_val) { + DEBUGOUT("NVM Read Error\n"); + goto out; + } + + if (*data == ID_LED_RESERVED_0000 || *data == ID_LED_RESERVED_FFFF) { + switch (hw->phy.media_type) { + case e1000_media_type_internal_serdes: + *data = ID_LED_DEFAULT_I210_SERDES; + break; + case e1000_media_type_copper: + default: + *data = ID_LED_DEFAULT_I210; + break; + } + } +out: + return ret_val; +} diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_i210.h b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_i210.h new file mode 100644 index 0000000000..a0cd93576d --- /dev/null +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_i210.h @@ -0,0 +1,80 @@ +/****************************************************************************** + + Copyright (c) 2001-2012, Intel 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 the Intel 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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$*/ + +#ifndef _E1000_I210_H_ +#define _E1000_I210_H_ + +s32 e1000_update_flash_i210(struct e1000_hw *hw); +s32 e1000_update_nvm_checksum_i210(struct e1000_hw *hw); +s32 e1000_validate_nvm_checksum_i210(struct e1000_hw *hw); +s32 e1000_write_nvm_srwr_i210(struct e1000_hw *hw, u16 offset, + u16 words, u16 *data); +s32 e1000_read_nvm_srrd_i210(struct e1000_hw *hw, u16 offset, + u16 words, u16 *data); +s32 e1000_read_invm_i211(struct e1000_hw *hw, u8 address, u16 *data); +s32 e1000_check_for_copper_link_i210(struct e1000_hw *hw); +s32 e1000_set_ltr_i210(struct e1000_hw *hw, bool link); +s32 e1000_acquire_swfw_sync_i210(struct e1000_hw *hw, u16 mask); +void e1000_release_swfw_sync_i210(struct e1000_hw *hw, u16 mask); + +#define E1000_STM_OPCODE 0xDB00 +#define E1000_EEPROM_FLASH_SIZE_WORD 0x11 + +#define INVM_DWORD_TO_RECORD_TYPE(invm_dword) \ + (u8)((invm_dword) & 0x7) +#define INVM_DWORD_TO_WORD_ADDRESS(invm_dword) \ + (u8)(((invm_dword) & 0x0000FE00) >> 9) +#define INVM_DWORD_TO_WORD_DATA(invm_dword) \ + (u16)(((invm_dword) & 0xFFFF0000) >> 16) + +enum E1000_INVM_STRUCTURE_TYPE { + E1000_INVM_UNINITIALIZED_STRUCTURE = 0x00, + E1000_INVM_WORD_AUTOLOAD_STRUCTURE = 0x01, + E1000_INVM_CSR_AUTOLOAD_STRUCTURE = 0x02, + E1000_INVM_PHY_REGISTER_AUTOLOAD_STRUCTURE = 0x03, + E1000_INVM_RSA_KEY_SHA256_STRUCTURE = 0x04, + E1000_INVM_INVALIDATED_STRUCTURE = 0x0F, +}; + +#define E1000_INVM_RSA_KEY_SHA256_DATA_SIZE_IN_DWORDS 8 +#define E1000_INVM_CSR_AUTOLOAD_DATA_SIZE_IN_DWORDS 1 + +#define ID_LED_DEFAULT_I210 ((ID_LED_OFF1_ON2 << 8) | \ + (ID_LED_DEF1_DEF2 << 4) | \ + (ID_LED_OFF1_OFF2)) +#define ID_LED_DEFAULT_I210_SERDES ((ID_LED_DEF1_DEF2 << 8) | \ + (ID_LED_DEF1_DEF2 << 4) | \ + (ID_LED_DEF1_DEF2)) + +#endif diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_ich8lan.c b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_ich8lan.c index cff4f192d7..98aefc4fc0 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_ich8lan.c +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_ich8lan.c @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2010, Intel Corporation + Copyright (c) 2001-2011, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -30,7 +30,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: src/sys/dev/e1000/e1000_ich8lan.c,v 1.5.2.3.2.1 2010/12/21 17:09:25 kensmith Exp $*/ +/*$FreeBSD$*/ /* * 82562G 10/100 Network Connection @@ -76,23 +76,23 @@ static bool e1000_check_mng_mode_ich8lan(struct e1000_hw *hw); static bool e1000_check_mng_mode_pchlan(struct e1000_hw *hw); static void e1000_rar_set_pch2lan(struct e1000_hw *hw, u8 *addr, u32 index); static void e1000_update_mc_addr_list_pch2lan(struct e1000_hw *hw, - u8 *mc_addr_list, - u32 mc_addr_count); + u8 *mc_addr_list, + u32 mc_addr_count); static s32 e1000_check_reset_block_ich8lan(struct e1000_hw *hw); static s32 e1000_phy_hw_reset_ich8lan(struct e1000_hw *hw); static s32 e1000_set_lplu_state_pchlan(struct e1000_hw *hw, bool active); static s32 e1000_set_d0_lplu_state_ich8lan(struct e1000_hw *hw, - bool active); + bool active); static s32 e1000_set_d3_lplu_state_ich8lan(struct e1000_hw *hw, - bool active); + bool active); static s32 e1000_read_nvm_ich8lan(struct e1000_hw *hw, u16 offset, - u16 words, u16 *data); + u16 words, u16 *data); static s32 e1000_write_nvm_ich8lan(struct e1000_hw *hw, u16 offset, - u16 words, u16 *data); + u16 words, u16 *data); static s32 e1000_validate_nvm_checksum_ich8lan(struct e1000_hw *hw); static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw); static s32 e1000_valid_led_default_ich8lan(struct e1000_hw *hw, - u16 *data); + u16 *data); static s32 e1000_id_led_init_pchlan(struct e1000_hw *hw); static s32 e1000_get_bus_info_ich8lan(struct e1000_hw *hw); static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw); @@ -100,7 +100,7 @@ static s32 e1000_init_hw_ich8lan(struct e1000_hw *hw); static s32 e1000_setup_link_ich8lan(struct e1000_hw *hw); static s32 e1000_setup_copper_link_ich8lan(struct e1000_hw *hw); static s32 e1000_get_link_up_info_ich8lan(struct e1000_hw *hw, - u16 *speed, u16 *duplex); + u16 *speed, u16 *duplex); static s32 e1000_cleanup_led_ich8lan(struct e1000_hw *hw); static s32 e1000_led_on_ich8lan(struct e1000_hw *hw); static s32 e1000_led_off_ich8lan(struct e1000_hw *hw); @@ -116,17 +116,17 @@ static s32 e1000_flash_cycle_init_ich8lan(struct e1000_hw *hw); static void e1000_initialize_hw_bits_ich8lan(struct e1000_hw *hw); static s32 e1000_kmrn_lock_loss_workaround_ich8lan(struct e1000_hw *hw); static s32 e1000_read_flash_byte_ich8lan(struct e1000_hw *hw, - u32 offset, u8 *data); + u32 offset, u8 *data); static s32 e1000_read_flash_data_ich8lan(struct e1000_hw *hw, u32 offset, - u8 size, u16 *data); + u8 size, u16 *data); static s32 e1000_read_flash_word_ich8lan(struct e1000_hw *hw, - u32 offset, u16 *data); + u32 offset, u16 *data); static s32 e1000_retry_write_flash_byte_ich8lan(struct e1000_hw *hw, - u32 offset, u8 byte); + u32 offset, u8 byte); static s32 e1000_write_flash_byte_ich8lan(struct e1000_hw *hw, - u32 offset, u8 data); + u32 offset, u8 data); static s32 e1000_write_flash_data_ich8lan(struct e1000_hw *hw, u32 offset, - u8 size, u16 data); + u8 size, u16 data); static s32 e1000_get_cfg_done_ich8lan(struct e1000_hw *hw); static void e1000_power_down_phy_copper_ich8lan(struct e1000_hw *hw); static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw); @@ -135,20 +135,23 @@ static s32 e1000_sw_lcd_config_ich8lan(struct e1000_hw *hw); static s32 e1000_set_mdio_slow_mode_hv(struct e1000_hw *hw); static s32 e1000_k1_workaround_lv(struct e1000_hw *hw); static void e1000_gate_hw_phy_config_ich8lan(struct e1000_hw *hw, bool gate); +#if defined(NAHUM6_HW) && (defined(LTR_SUPPORT) || defined(OBFF_SUPPORT)) + +#endif /* NAHUM6_HW && (LTR_SUPPORT || OBFF_SUPPORT) */ /* ICH GbE Flash Hardware Sequencing Flash Status Register bit breakdown */ /* Offset 04h HSFSTS */ union ich8_hws_flash_status { struct ich8_hsfsts { - u16 flcdone :1; /* bit 0 Flash Cycle Done */ - u16 flcerr :1; /* bit 1 Flash Cycle Error */ - u16 dael :1; /* bit 2 Direct Access error Log */ - u16 berasesz :2; /* bit 4:3 Sector Erase Size */ - u16 flcinprog :1; /* bit 5 flash cycle in Progress */ - u16 reserved1 :2; /* bit 13:6 Reserved */ - u16 reserved2 :6; /* bit 13:6 Reserved */ - u16 fldesvalid :1; /* bit 14 Flash Descriptor Valid */ - u16 flockdn :1; /* bit 15 Flash Config Lock-Down */ + u16 flcdone:1; /* bit 0 Flash Cycle Done */ + u16 flcerr:1; /* bit 1 Flash Cycle Error */ + u16 dael:1; /* bit 2 Direct Access error Log */ + u16 berasesz:2; /* bit 4:3 Sector Erase Size */ + u16 flcinprog:1; /* bit 5 flash cycle in Progress */ + u16 reserved1:2; /* bit 13:6 Reserved */ + u16 reserved2:6; /* bit 13:6 Reserved */ + u16 fldesvalid:1; /* bit 14 Flash Descriptor Valid */ + u16 flockdn:1; /* bit 15 Flash Config Lock-Down */ } hsf_status; u16 regval; }; @@ -157,11 +160,11 @@ union ich8_hws_flash_status { /* Offset 06h FLCTL */ union ich8_hws_flash_ctrl { struct ich8_hsflctl { - u16 flcgo :1; /* 0 Flash Cycle Go */ - u16 flcycle :2; /* 2:1 Flash Cycle */ - u16 reserved :5; /* 7:3 Reserved */ - u16 fldbcount :2; /* 9:8 Flash Data Byte Count */ - u16 flockdn :6; /* 15:10 Reserved */ + u16 flcgo:1; /* 0 Flash Cycle Go */ + u16 flcycle:2; /* 2:1 Flash Cycle */ + u16 reserved:5; /* 7:3 Reserved */ + u16 fldbcount:2; /* 9:8 Flash Data Byte Count */ + u16 flockdn:6; /* 15:10 Reserved */ } hsf_ctrl; u16 regval; }; @@ -169,14 +172,30 @@ union ich8_hws_flash_ctrl { /* ICH Flash Region Access Permissions */ union ich8_hws_flash_regacc { struct ich8_flracc { - u32 grra :8; /* 0:7 GbE region Read Access */ - u32 grwa :8; /* 8:15 GbE region Write Access */ - u32 gmrag :8; /* 23:16 GbE Master Read Access Grant */ - u32 gmwag :8; /* 31:24 GbE Master Write Access Grant */ + u32 grra:8; /* 0:7 GbE region Read Access */ + u32 grwa:8; /* 8:15 GbE region Write Access */ + u32 gmrag:8; /* 23:16 GbE Master Read Access Grant */ + u32 gmwag:8; /* 31:24 GbE Master Write Access Grant */ } hsf_flregacc; u16 regval; }; +static void e1000_toggle_lanphypc_value_ich8lan(struct e1000_hw *hw) +{ + u32 ctrl; + + DEBUGFUNC("e1000_toggle_lanphypc_value_ich8lan"); + + ctrl = E1000_READ_REG(hw, E1000_CTRL); + ctrl |= E1000_CTRL_LANPHYPC_OVERRIDE; + ctrl &= ~E1000_CTRL_LANPHYPC_VALUE; + E1000_WRITE_REG(hw, E1000_CTRL, ctrl); + E1000_WRITE_FLUSH(hw); + usec_delay(10); + ctrl &= ~E1000_CTRL_LANPHYPC_OVERRIDE; + E1000_WRITE_REG(hw, E1000_CTRL, ctrl); +} + /** * e1000_init_phy_params_pchlan - Initialize PHY function pointers * @hw: pointer to the HW structure @@ -186,70 +205,66 @@ union ich8_hws_flash_regacc { static s32 e1000_init_phy_params_pchlan(struct e1000_hw *hw) { struct e1000_phy_info *phy = &hw->phy; - u32 ctrl, fwsm; s32 ret_val = E1000_SUCCESS; DEBUGFUNC("e1000_init_phy_params_pchlan"); - phy->addr = 1; - phy->reset_delay_us = 100; + phy->addr = 1; + phy->reset_delay_us = 100; - phy->ops.acquire = e1000_acquire_swflag_ich8lan; - phy->ops.check_reset_block = e1000_check_reset_block_ich8lan; - phy->ops.get_cfg_done = e1000_get_cfg_done_ich8lan; - phy->ops.read_reg = e1000_read_phy_reg_hv; - phy->ops.read_reg_locked = e1000_read_phy_reg_hv_locked; - phy->ops.release = e1000_release_swflag_ich8lan; - phy->ops.reset = e1000_phy_hw_reset_ich8lan; - phy->ops.set_d0_lplu_state = e1000_set_lplu_state_pchlan; - phy->ops.set_d3_lplu_state = e1000_set_lplu_state_pchlan; - phy->ops.write_reg = e1000_write_phy_reg_hv; - phy->ops.write_reg_locked = e1000_write_phy_reg_hv_locked; - phy->ops.power_up = e1000_power_up_phy_copper; - phy->ops.power_down = e1000_power_down_phy_copper_ich8lan; - phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT; + phy->ops.acquire = e1000_acquire_swflag_ich8lan; + phy->ops.check_reset_block = e1000_check_reset_block_ich8lan; + phy->ops.get_cfg_done = e1000_get_cfg_done_ich8lan; + phy->ops.set_page = e1000_set_page_igp; + phy->ops.read_reg = e1000_read_phy_reg_hv; + phy->ops.read_reg_locked = e1000_read_phy_reg_hv_locked; + phy->ops.read_reg_page = e1000_read_phy_reg_page_hv; + phy->ops.release = e1000_release_swflag_ich8lan; + phy->ops.reset = e1000_phy_hw_reset_ich8lan; + phy->ops.set_d0_lplu_state = e1000_set_lplu_state_pchlan; + phy->ops.set_d3_lplu_state = e1000_set_lplu_state_pchlan; + phy->ops.write_reg = e1000_write_phy_reg_hv; + phy->ops.write_reg_locked = e1000_write_phy_reg_hv_locked; + phy->ops.write_reg_page = e1000_write_phy_reg_page_hv; + phy->ops.power_up = e1000_power_up_phy_copper; + phy->ops.power_down = e1000_power_down_phy_copper_ich8lan; + phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT; - /* - * The MAC-PHY interconnect may still be in SMBus mode - * after Sx->S0. If the manageability engine (ME) is - * disabled, then toggle the LANPHYPC Value bit to force - * the interconnect to PCIe mode. - */ - fwsm = E1000_READ_REG(hw, E1000_FWSM); - if (!(fwsm & E1000_ICH_FWSM_FW_VALID) && - !(hw->phy.ops.check_reset_block(hw))) { - ctrl = E1000_READ_REG(hw, E1000_CTRL); - ctrl |= E1000_CTRL_LANPHYPC_OVERRIDE; - ctrl &= ~E1000_CTRL_LANPHYPC_VALUE; - E1000_WRITE_REG(hw, E1000_CTRL, ctrl); - usec_delay(10); - ctrl &= ~E1000_CTRL_LANPHYPC_OVERRIDE; - E1000_WRITE_REG(hw, E1000_CTRL, ctrl); + if (!hw->phy.ops.check_reset_block(hw)) { + u32 fwsm = E1000_READ_REG(hw, E1000_FWSM); + + /* + * The MAC-PHY interconnect may still be in SMBus mode after + * Sx->S0. If resetting the PHY is not blocked, toggle the + * LANPHYPC Value bit to force the interconnect to PCIe mode. + */ + e1000_toggle_lanphypc_value_ich8lan(hw); msec_delay(50); /* * Gate automatic PHY configuration by hardware on * non-managed 82579 */ - if (hw->mac.type == e1000_pch2lan) + if ((hw->mac.type == e1000_pch2lan) && + !(fwsm & E1000_ICH_FWSM_FW_VALID)) e1000_gate_hw_phy_config_ich8lan(hw, TRUE); - } - /* - * Reset the PHY before any acccess to it. Doing so, ensures that - * the PHY is in a known good state before we read/write PHY registers. - * The generic reset is sufficient here, because we haven't determined - * the PHY type yet. - */ - ret_val = e1000_phy_hw_reset_generic(hw); - if (ret_val) - goto out; + /* + * Reset the PHY before any access to it. Doing so, ensures + * that the PHY is in a known good state before we read/write + * PHY registers. The generic reset is sufficient here, + * because we haven't determined the PHY type yet. + */ + ret_val = e1000_phy_hw_reset_generic(hw); + if (ret_val) + goto out; - /* Ungate automatic PHY configuration on non-managed 82579 */ - if ((hw->mac.type == e1000_pch2lan) && - !(fwsm & E1000_ICH_FWSM_FW_VALID)) { - msec_delay(10); - e1000_gate_hw_phy_config_ich8lan(hw, FALSE); + /* Ungate automatic PHY configuration on non-managed 82579 */ + if ((hw->mac.type == e1000_pch2lan) && + !(fwsm & E1000_ICH_FWSM_FW_VALID)) { + msec_delay(10); + e1000_gate_hw_phy_config_ich8lan(hw, FALSE); + } } phy->id = e1000_phy_unknown; @@ -315,21 +330,21 @@ static s32 e1000_init_phy_params_ich8lan(struct e1000_hw *hw) DEBUGFUNC("e1000_init_phy_params_ich8lan"); - phy->addr = 1; - phy->reset_delay_us = 100; + phy->addr = 1; + phy->reset_delay_us = 100; - phy->ops.acquire = e1000_acquire_swflag_ich8lan; - phy->ops.check_reset_block = e1000_check_reset_block_ich8lan; - phy->ops.get_cable_length = e1000_get_cable_length_igp_2; - phy->ops.get_cfg_done = e1000_get_cfg_done_ich8lan; - phy->ops.read_reg = e1000_read_phy_reg_igp; - phy->ops.release = e1000_release_swflag_ich8lan; - phy->ops.reset = e1000_phy_hw_reset_ich8lan; - phy->ops.set_d0_lplu_state = e1000_set_d0_lplu_state_ich8lan; - phy->ops.set_d3_lplu_state = e1000_set_d3_lplu_state_ich8lan; - phy->ops.write_reg = e1000_write_phy_reg_igp; - phy->ops.power_up = e1000_power_up_phy_copper; - phy->ops.power_down = e1000_power_down_phy_copper_ich8lan; + phy->ops.acquire = e1000_acquire_swflag_ich8lan; + phy->ops.check_reset_block = e1000_check_reset_block_ich8lan; + phy->ops.get_cable_length = e1000_get_cable_length_igp_2; + phy->ops.get_cfg_done = e1000_get_cfg_done_ich8lan; + phy->ops.read_reg = e1000_read_phy_reg_igp; + phy->ops.release = e1000_release_swflag_ich8lan; + phy->ops.reset = e1000_phy_hw_reset_ich8lan; + phy->ops.set_d0_lplu_state = e1000_set_d0_lplu_state_ich8lan; + phy->ops.set_d3_lplu_state = e1000_set_d3_lplu_state_ich8lan; + phy->ops.write_reg = e1000_write_phy_reg_igp; + phy->ops.power_up = e1000_power_up_phy_copper; + phy->ops.power_down = e1000_power_down_phy_copper_ich8lan; /* * We may need to do this twice - once for IGP and if that fails, @@ -438,7 +453,7 @@ static s32 e1000_init_nvm_params_ich8lan(struct e1000_hw *hw) * size represents two separate NVM banks. */ nvm->flash_bank_size = (sector_end_addr - sector_base_addr) - << FLASH_SECTOR_ADDR_SHIFT; + << FLASH_SECTOR_ADDR_SHIFT; nvm->flash_bank_size /= 2; /* Adjust to word count */ nvm->flash_bank_size /= sizeof(u16); @@ -455,13 +470,13 @@ static s32 e1000_init_nvm_params_ich8lan(struct e1000_hw *hw) E1000_MUTEX_INIT(&dev_spec->swflag_mutex); /* Function Pointers */ - nvm->ops.acquire = e1000_acquire_nvm_ich8lan; - nvm->ops.release = e1000_release_nvm_ich8lan; - nvm->ops.read = e1000_read_nvm_ich8lan; - nvm->ops.update = e1000_update_nvm_checksum_ich8lan; + nvm->ops.acquire = e1000_acquire_nvm_ich8lan; + nvm->ops.release = e1000_release_nvm_ich8lan; + nvm->ops.read = e1000_read_nvm_ich8lan; + nvm->ops.update = e1000_update_nvm_checksum_ich8lan; nvm->ops.valid_led_default = e1000_valid_led_default_ich8lan; - nvm->ops.validate = e1000_validate_nvm_checksum_ich8lan; - nvm->ops.write = e1000_write_nvm_ich8lan; + nvm->ops.validate = e1000_validate_nvm_checksum_ich8lan; + nvm->ops.write = e1000_write_nvm_ich8lan; out: return ret_val; @@ -477,7 +492,6 @@ out: static s32 e1000_init_mac_params_ich8lan(struct e1000_hw *hw) { struct e1000_mac_info *mac = &hw->mac; - u16 pci_cfg; DEBUGFUNC("e1000_init_mac_params_ich8lan"); @@ -549,9 +563,6 @@ static s32 e1000_init_mac_params_ich8lan(struct e1000_hw *hw) e1000_update_mc_addr_list_pch2lan; /* fall-through */ case e1000_pchlan: - /* save PCH revision_id */ - e1000_read_pci_cfg(hw, 0x2, &pci_cfg); - hw->revision_id = (u8)(pci_cfg &= 0x000F); /* check management mode */ mac->ops.check_mng_mode = e1000_check_mng_mode_pchlan; /* ID LED init */ @@ -568,6 +579,11 @@ static s32 e1000_init_mac_params_ich8lan(struct e1000_hw *hw) break; } +#if defined(NAHUM6_HW) && (defined(LTR_SUPPORT) || defined(OBFF_SUPPORT)) + if (mac->type == e1000_pch_lpt) { + } + +#endif /* NAHUM6_HW && (LTR_SUPPORT || OBFF_SUPPORT) */ /* Enable PCS Lock-loss workaround for ICH8 */ if (mac->type == e1000_ich8lan) e1000_set_kmrn_lock_loss_workaround_ich8lan(hw, TRUE); @@ -589,6 +605,7 @@ static s32 e1000_init_mac_params_ich8lan(struct e1000_hw *hw) **/ static s32 e1000_set_eee_pchlan(struct e1000_hw *hw) { + struct e1000_dev_spec_ich8lan *dev_spec = &hw->dev_spec.ich8lan; s32 ret_val = E1000_SUCCESS; u16 phy_reg; @@ -601,7 +618,7 @@ static s32 e1000_set_eee_pchlan(struct e1000_hw *hw) if (ret_val) goto out; - if (hw->dev_spec.ich8lan.eee_disable) + if (dev_spec->eee_disable) phy_reg &= ~I82579_LPI_CTRL_ENABLE_MASK; else phy_reg |= I82579_LPI_CTRL_ENABLE_MASK; @@ -624,6 +641,7 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw) struct e1000_mac_info *mac = &hw->mac; s32 ret_val; bool link; + u16 phy_reg; DEBUGFUNC("e1000_check_for_copper_link_ich8lan"); @@ -653,21 +671,46 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw) goto out; } +#if defined(NAHUM6_HW) && (defined(LTR_SUPPORT) || defined(OBFF_SUPPORT)) + if (hw->mac.type == e1000_pch_lpt) { + } + +#endif /* NAHUM6_HW && (LTR_SUPPORT || OBFF_SUPPORT) */ if (!link) goto out; /* No link detected */ mac->get_link_status = FALSE; - if (hw->phy.type == e1000_phy_82578) { - ret_val = e1000_link_stall_workaround_hv(hw); - if (ret_val) - goto out; - } - - if (hw->mac.type == e1000_pch2lan) { + switch (hw->mac.type) { + case e1000_pch2lan: ret_val = e1000_k1_workaround_lv(hw); if (ret_val) goto out; + /* fall-thru */ + case e1000_pchlan: + if (hw->phy.type == e1000_phy_82578) { + ret_val = e1000_link_stall_workaround_hv(hw); + if (ret_val) + goto out; + } + + /* + * Workaround for PCHx parts in half-duplex: + * Set the number of preambles removed from the packet + * when it is passed from the PHY to the MAC to prevent + * the MAC from misinterpreting the packet type. + */ + hw->phy.ops.read_reg(hw, HV_KMRN_FIFO_CTRLSTA, &phy_reg); + phy_reg &= ~HV_KMRN_FIFO_CTRLSTA_PREAMBLE_MASK; + + if ((E1000_READ_REG(hw, E1000_STATUS) & E1000_STATUS_FD) != + E1000_STATUS_FD) + phy_reg |= (1 << HV_KMRN_FIFO_CTRLSTA_PREAMBLE_SHIFT); + + hw->phy.ops.write_reg(hw, HV_KMRN_FIFO_CTRLSTA, phy_reg); + break; + default: + break; } /* @@ -695,7 +738,7 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw) * of MAC speed/duplex configuration. So we only need to * configure Collision Distance in the MAC. */ - e1000_config_collision_dist_generic(hw); + hw->mac.ops.config_collision_dist(hw); /* * Configure Flow Control now that Auto-Neg has completed. @@ -794,7 +837,7 @@ static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw) } if (!timeout) { - DEBUGOUT("SW/FW/HW has locked the resource for too long.\n"); + DEBUGOUT("SW has already locked the resource.\n"); ret_val = -E1000_ERR_CONFIG; goto out; } @@ -814,7 +857,8 @@ static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw) } if (!timeout) { - DEBUGOUT("Failed to acquire the semaphore.\n"); + DEBUGOUT2("Failed to acquire the semaphore, FW or HW has it: FWSM=0x%8.8x EXTCNF_CTRL=0x%8.8x)\n", + E1000_READ_REG(hw, E1000_FWSM), extcnf_ctrl); extcnf_ctrl &= ~E1000_EXTCNF_CTRL_SWFLAG; E1000_WRITE_REG(hw, E1000_EXTCNF_CTRL, extcnf_ctrl); ret_val = -E1000_ERR_CONFIG; @@ -918,8 +962,8 @@ static void e1000_rar_set_pch2lan(struct e1000_hw *hw, u8 *addr, u32 index) * from network order (big endian) to little endian */ rar_low = ((u32) addr[0] | - ((u32) addr[1] << 8) | - ((u32) addr[2] << 16) | ((u32) addr[3] << 24)); + ((u32) addr[1] << 8) | + ((u32) addr[2] << 16) | ((u32) addr[3] << 24)); rar_high = ((u32) addr[4] | ((u32) addr[5] << 8)); @@ -963,22 +1007,38 @@ static void e1000_rar_set_pch2lan(struct e1000_hw *hw, u8 *addr, u32 index) * The caller must have a packed mc_addr_list of multicast addresses. **/ static void e1000_update_mc_addr_list_pch2lan(struct e1000_hw *hw, - u8 *mc_addr_list, - u32 mc_addr_count) + u8 *mc_addr_list, + u32 mc_addr_count) { + u16 phy_reg = 0; int i; + s32 ret_val; DEBUGFUNC("e1000_update_mc_addr_list_pch2lan"); e1000_update_mc_addr_list_generic(hw, mc_addr_list, mc_addr_count); + ret_val = hw->phy.ops.acquire(hw); + if (ret_val) + return; + + ret_val = e1000_enable_phy_wakeup_reg_access_bm(hw, &phy_reg); + if (ret_val) + goto release; + for (i = 0; i < hw->mac.mta_reg_count; i++) { - hw->phy.ops.write_reg(hw, BM_MTA(i), - (u16)(hw->mac.mta_shadow[i] & 0xFFFF)); - hw->phy.ops.write_reg(hw, (BM_MTA(i) + 1), - (u16)((hw->mac.mta_shadow[i] >> 16) & - 0xFFFF)); + hw->phy.ops.write_reg_page(hw, BM_MTA(i), + (u16)(hw->mac.mta_shadow[i] & + 0xFFFF)); + hw->phy.ops.write_reg_page(hw, (BM_MTA(i) + 1), + (u16)((hw->mac.mta_shadow[i] >> 16) & + 0xFFFF)); } + + e1000_disable_phy_wakeup_reg_access_bm(hw, &phy_reg); + +release: + hw->phy.ops.release(hw); } /** @@ -995,13 +1055,10 @@ static s32 e1000_check_reset_block_ich8lan(struct e1000_hw *hw) DEBUGFUNC("e1000_check_reset_block_ich8lan"); - if (hw->phy.reset_disable) - return E1000_BLK_PHY_RESET; - fwsm = E1000_READ_REG(hw, E1000_FWSM); return (fwsm & E1000_ICH_FWSM_RSPCIPHY) ? E1000_SUCCESS - : E1000_BLK_PHY_RESET; + : E1000_BLK_PHY_RESET; } /** @@ -1187,46 +1244,46 @@ static s32 e1000_k1_gig_workaround_hv(struct e1000_hw *hw, bool link) if (link) { if (hw->phy.type == e1000_phy_82578) { ret_val = hw->phy.ops.read_reg_locked(hw, BM_CS_STATUS, - &status_reg); + &status_reg); if (ret_val) goto release; status_reg &= BM_CS_STATUS_LINK_UP | - BM_CS_STATUS_RESOLVED | - BM_CS_STATUS_SPEED_MASK; + BM_CS_STATUS_RESOLVED | + BM_CS_STATUS_SPEED_MASK; if (status_reg == (BM_CS_STATUS_LINK_UP | - BM_CS_STATUS_RESOLVED | - BM_CS_STATUS_SPEED_1000)) + BM_CS_STATUS_RESOLVED | + BM_CS_STATUS_SPEED_1000)) k1_enable = FALSE; } if (hw->phy.type == e1000_phy_82577) { ret_val = hw->phy.ops.read_reg_locked(hw, HV_M_STATUS, - &status_reg); + &status_reg); if (ret_val) goto release; status_reg &= HV_M_STATUS_LINK_UP | - HV_M_STATUS_AUTONEG_COMPLETE | - HV_M_STATUS_SPEED_MASK; + HV_M_STATUS_AUTONEG_COMPLETE | + HV_M_STATUS_SPEED_MASK; if (status_reg == (HV_M_STATUS_LINK_UP | - HV_M_STATUS_AUTONEG_COMPLETE | - HV_M_STATUS_SPEED_1000)) + HV_M_STATUS_AUTONEG_COMPLETE | + HV_M_STATUS_SPEED_1000)) k1_enable = FALSE; } /* Link stall fix for link up */ ret_val = hw->phy.ops.write_reg_locked(hw, PHY_REG(770, 19), - 0x0100); + 0x0100); if (ret_val) goto release; } else { /* Link stall fix for link down */ ret_val = hw->phy.ops.write_reg_locked(hw, PHY_REG(770, 19), - 0x4100); + 0x4100); if (ret_val) goto release; } @@ -1259,9 +1316,8 @@ s32 e1000_configure_k1_ich8lan(struct e1000_hw *hw, bool k1_enable) DEBUGFUNC("e1000_configure_k1_ich8lan"); - ret_val = e1000_read_kmrn_reg_locked(hw, - E1000_KMRNCTRLSTA_K1_CONFIG, - &kmrn_reg); + ret_val = e1000_read_kmrn_reg_locked(hw, E1000_KMRNCTRLSTA_K1_CONFIG, + &kmrn_reg); if (ret_val) goto out; @@ -1270,9 +1326,8 @@ s32 e1000_configure_k1_ich8lan(struct e1000_hw *hw, bool k1_enable) else kmrn_reg &= ~E1000_KMRNCTRLSTA_K1_ENABLE; - ret_val = e1000_write_kmrn_reg_locked(hw, - E1000_KMRNCTRLSTA_K1_CONFIG, - kmrn_reg); + ret_val = e1000_write_kmrn_reg_locked(hw, E1000_KMRNCTRLSTA_K1_CONFIG, + kmrn_reg); if (ret_val) goto out; @@ -1285,9 +1340,11 @@ s32 e1000_configure_k1_ich8lan(struct e1000_hw *hw, bool k1_enable) E1000_WRITE_REG(hw, E1000_CTRL, reg); E1000_WRITE_REG(hw, E1000_CTRL_EXT, ctrl_ext | E1000_CTRL_EXT_SPD_BYPS); + E1000_WRITE_FLUSH(hw); usec_delay(20); E1000_WRITE_REG(hw, E1000_CTRL, ctrl_reg); E1000_WRITE_REG(hw, E1000_CTRL_EXT, ctrl_ext); + E1000_WRITE_FLUSH(hw); usec_delay(20); out: @@ -1303,7 +1360,7 @@ out: * collectively called OEM bits. The OEM Write Enable bit and SW Config bit * in NVM determines whether HW should configure LPLU and Gbe Disable. **/ -s32 e1000_oem_bits_config_ich8lan(struct e1000_hw *hw, bool d0_state) +static s32 e1000_oem_bits_config_ich8lan(struct e1000_hw *hw, bool d0_state) { s32 ret_val = 0; u32 mac_reg; @@ -1342,16 +1399,20 @@ s32 e1000_oem_bits_config_ich8lan(struct e1000_hw *hw, bool d0_state) if (mac_reg & E1000_PHY_CTRL_D0A_LPLU) oem_reg |= HV_OEM_BITS_LPLU; + + /* Set Restart auto-neg to activate the bits */ + if (!hw->phy.ops.check_reset_block(hw)) + oem_reg |= HV_OEM_BITS_RESTART_AN; } else { - if (mac_reg & E1000_PHY_CTRL_NOND0A_GBE_DISABLE) + if (mac_reg & (E1000_PHY_CTRL_GBE_DISABLE | + E1000_PHY_CTRL_NOND0A_GBE_DISABLE)) oem_reg |= HV_OEM_BITS_GBE_DIS; - if (mac_reg & E1000_PHY_CTRL_NOND0A_LPLU) + if (mac_reg & (E1000_PHY_CTRL_D0A_LPLU | + E1000_PHY_CTRL_NOND0A_LPLU)) oem_reg |= HV_OEM_BITS_LPLU; } - /* Restart auto-neg to activate the bits */ - if (!hw->phy.ops.check_reset_block(hw)) - oem_reg |= HV_OEM_BITS_RESTART_AN; + ret_val = hw->phy.ops.write_reg_locked(hw, HV_OEM_BITS, oem_reg); out: @@ -1361,20 +1422,6 @@ out: } -/** - * e1000_hv_phy_powerdown_workaround_ich8lan - Power down workaround on Sx - * @hw: pointer to the HW structure - **/ -s32 e1000_hv_phy_powerdown_workaround_ich8lan(struct e1000_hw *hw) -{ - DEBUGFUNC("e1000_hv_phy_powerdown_workaround_ich8lan"); - - if ((hw->phy.type != e1000_phy_82577) || (hw->revision_id > 2)) - return E1000_SUCCESS; - - return hw->phy.ops.write_reg(hw, PHY_REG(768, 25), 0x0444); -} - /** * e1000_set_mdio_slow_mode_hv - Set slow MDIO access mode * @hw: pointer to the HW structure @@ -1418,32 +1465,6 @@ static s32 e1000_hv_phy_workarounds_ich8lan(struct e1000_hw *hw) goto out; } - /* Hanksville M Phy init for IEEE. */ - if ((hw->revision_id == 2) && - (hw->phy.type == e1000_phy_82577) && - ((hw->phy.revision == 2) || (hw->phy.revision == 3))) { - hw->phy.ops.write_reg(hw, 0x10, 0x8823); - hw->phy.ops.write_reg(hw, 0x11, 0x0018); - hw->phy.ops.write_reg(hw, 0x10, 0x8824); - hw->phy.ops.write_reg(hw, 0x11, 0x0016); - hw->phy.ops.write_reg(hw, 0x10, 0x8825); - hw->phy.ops.write_reg(hw, 0x11, 0x001A); - hw->phy.ops.write_reg(hw, 0x10, 0x888C); - hw->phy.ops.write_reg(hw, 0x11, 0x0007); - hw->phy.ops.write_reg(hw, 0x10, 0x888D); - hw->phy.ops.write_reg(hw, 0x11, 0x0007); - hw->phy.ops.write_reg(hw, 0x10, 0x888E); - hw->phy.ops.write_reg(hw, 0x11, 0x0007); - hw->phy.ops.write_reg(hw, 0x10, 0x8827); - hw->phy.ops.write_reg(hw, 0x11, 0x0001); - hw->phy.ops.write_reg(hw, 0x10, 0x8835); - hw->phy.ops.write_reg(hw, 0x11, 0x0001); - hw->phy.ops.write_reg(hw, 0x10, 0x8834); - hw->phy.ops.write_reg(hw, 0x11, 0x0001); - hw->phy.ops.write_reg(hw, 0x10, 0x8833); - hw->phy.ops.write_reg(hw, 0x11, 0x0002); - } - if (((hw->phy.type == e1000_phy_82577) && ((hw->phy.revision == 1) || (hw->phy.revision == 2))) || ((hw->phy.type == e1000_phy_82578) && (hw->phy.revision == 1))) { @@ -1453,26 +1474,13 @@ static s32 e1000_hv_phy_workarounds_ich8lan(struct e1000_hw *hw) goto out; /* Preamble tuning for SSC */ - ret_val = hw->phy.ops.write_reg(hw, PHY_REG(770, 16), 0xA204); + ret_val = hw->phy.ops.write_reg(hw, HV_KMRN_FIFO_CTRLSTA, + 0xA204); if (ret_val) goto out; } if (hw->phy.type == e1000_phy_82578) { - if (hw->revision_id < 3) { - /* PHY config */ - ret_val = hw->phy.ops.write_reg(hw, (1 << 6) | 0x29, - 0x66C0); - if (ret_val) - goto out; - - /* PHY config */ - ret_val = hw->phy.ops.write_reg(hw, (1 << 6) | 0x1E, - 0xFFFF); - if (ret_val) - goto out; - } - /* * Return registers to default by doing a soft reset then * writing 0x3140 to the control register. @@ -1480,25 +1488,10 @@ static s32 e1000_hv_phy_workarounds_ich8lan(struct e1000_hw *hw) if (hw->phy.revision < 2) { e1000_phy_sw_reset_generic(hw); ret_val = hw->phy.ops.write_reg(hw, PHY_CONTROL, - 0x3140); + 0x3140); } } - if ((hw->revision_id == 2) && - (hw->phy.type == e1000_phy_82577) && - ((hw->phy.revision == 2) || (hw->phy.revision == 3))) { - /* - * Workaround for OEM (GbE) not operating after reset - - * restart AN (twice) - */ - ret_val = hw->phy.ops.write_reg(hw, PHY_REG(768, 25), 0x0400); - if (ret_val) - goto out; - ret_val = hw->phy.ops.write_reg(hw, PHY_REG(768, 25), 0x0400); - if (ret_val) - goto out; - } - /* Select page 0 */ ret_val = hw->phy.ops.acquire(hw); if (ret_val) @@ -1522,12 +1515,11 @@ static s32 e1000_hv_phy_workarounds_ich8lan(struct e1000_hw *hw) ret_val = hw->phy.ops.acquire(hw); if (ret_val) goto out; - ret_val = hw->phy.ops.read_reg_locked(hw, BM_PORT_GEN_CFG_REG, - &phy_data); + ret_val = hw->phy.ops.read_reg_locked(hw, BM_PORT_GEN_CFG, &phy_data); if (ret_val) goto release; - ret_val = hw->phy.ops.write_reg_locked(hw, BM_PORT_GEN_CFG_REG, - phy_data & 0x00FF); + ret_val = hw->phy.ops.write_reg_locked(hw, BM_PORT_GEN_CFG, + phy_data & 0x00FF); release: hw->phy.ops.release(hw); out: @@ -1541,19 +1533,38 @@ out: void e1000_copy_rx_addrs_to_phy_ich8lan(struct e1000_hw *hw) { u32 mac_reg; - u16 i; + u16 i, phy_reg = 0; + s32 ret_val; DEBUGFUNC("e1000_copy_rx_addrs_to_phy_ich8lan"); + ret_val = hw->phy.ops.acquire(hw); + if (ret_val) + return; + ret_val = e1000_enable_phy_wakeup_reg_access_bm(hw, &phy_reg); + if (ret_val) + goto release; + /* Copy both RAL/H (rar_entry_count) and SHRAL/H (+4) to PHY */ for (i = 0; i < (hw->mac.rar_entry_count + 4); i++) { mac_reg = E1000_READ_REG(hw, E1000_RAL(i)); - hw->phy.ops.write_reg(hw, BM_RAR_L(i), (u16)(mac_reg & 0xFFFF)); - hw->phy.ops.write_reg(hw, BM_RAR_M(i), (u16)((mac_reg >> 16) & 0xFFFF)); + hw->phy.ops.write_reg_page(hw, BM_RAR_L(i), + (u16)(mac_reg & 0xFFFF)); + hw->phy.ops.write_reg_page(hw, BM_RAR_M(i), + (u16)((mac_reg >> 16) & 0xFFFF)); + mac_reg = E1000_READ_REG(hw, E1000_RAH(i)); - hw->phy.ops.write_reg(hw, BM_RAR_H(i), (u16)(mac_reg & 0xFFFF)); - hw->phy.ops.write_reg(hw, BM_RAR_CTRL(i), (u16)((mac_reg >> 16) & 0x8000)); + hw->phy.ops.write_reg_page(hw, BM_RAR_H(i), + (u16)(mac_reg & 0xFFFF)); + hw->phy.ops.write_reg_page(hw, BM_RAR_CTRL(i), + (u16)((mac_reg & E1000_RAH_AV) + >> 16)); } + + e1000_disable_phy_wakeup_reg_access_bm(hw, &phy_reg); + +release: + hw->phy.ops.release(hw); } static u32 e1000_calc_rx_da_crc(u8 mac[]) @@ -1594,7 +1605,8 @@ s32 e1000_lv_jumbo_workaround_ich8lan(struct e1000_hw *hw, bool enable) /* disable Rx path while enabling/disabling workaround */ hw->phy.ops.read_reg(hw, PHY_REG(769, 20), &phy_reg); - ret_val = hw->phy.ops.write_reg(hw, PHY_REG(769, 20), phy_reg | (1 << 14)); + ret_val = hw->phy.ops.write_reg(hw, PHY_REG(769, 20), + phy_reg | (1 << 14)); if (ret_val) goto out; @@ -1676,11 +1688,12 @@ s32 e1000_lv_jumbo_workaround_ich8lan(struct e1000_hw *hw, bool enable) ret_val = hw->phy.ops.write_reg(hw, PHY_REG(776, 20), data); if (ret_val) goto out; - ret_val = hw->phy.ops.write_reg(hw, PHY_REG(776, 23), 0xFE00); + ret_val = hw->phy.ops.write_reg(hw, PHY_REG(776, 23), 0xF100); if (ret_val) goto out; hw->phy.ops.read_reg(hw, HV_PM_CTRL, &data); - ret_val = hw->phy.ops.write_reg(hw, HV_PM_CTRL, data | (1 << 10)); + ret_val = hw->phy.ops.write_reg(hw, HV_PM_CTRL, data | + (1 << 10)); if (ret_val) goto out; } else { @@ -1737,13 +1750,15 @@ s32 e1000_lv_jumbo_workaround_ich8lan(struct e1000_hw *hw, bool enable) if (ret_val) goto out; hw->phy.ops.read_reg(hw, HV_PM_CTRL, &data); - ret_val = hw->phy.ops.write_reg(hw, HV_PM_CTRL, data & ~(1 << 10)); + ret_val = hw->phy.ops.write_reg(hw, HV_PM_CTRL, data & + ~(1 << 10)); if (ret_val) goto out; } /* re-enable Rx path after enabling/disabling workaround */ - ret_val = hw->phy.ops.write_reg(hw, PHY_REG(769, 20), phy_reg & ~(1 << 14)); + ret_val = hw->phy.ops.write_reg(hw, PHY_REG(769, 20), phy_reg & + ~(1 << 14)); out: return ret_val; @@ -1765,6 +1780,28 @@ static s32 e1000_lv_phy_workarounds_ich8lan(struct e1000_hw *hw) /* Set MDIO slow mode before any other MDIO access */ ret_val = e1000_set_mdio_slow_mode_hv(hw); + ret_val = hw->phy.ops.acquire(hw); + if (ret_val) + goto out; + ret_val = hw->phy.ops.write_reg_locked(hw, I82579_EMI_ADDR, + I82579_MSE_THRESHOLD); + if (ret_val) + goto release; + /* set MSE higher to enable link to stay up when noise is high */ + ret_val = hw->phy.ops.write_reg_locked(hw, I82579_EMI_DATA, + 0x0034); + if (ret_val) + goto release; + ret_val = hw->phy.ops.write_reg_locked(hw, I82579_EMI_ADDR, + I82579_MSE_LINK_DOWN); + if (ret_val) + goto release; + /* drop link after 5 times MSE threshold was reached */ + ret_val = hw->phy.ops.write_reg_locked(hw, I82579_EMI_DATA, + 0x0005); +release: + hw->phy.ops.release(hw); + out: return ret_val; } @@ -1780,6 +1817,7 @@ static s32 e1000_k1_workaround_lv(struct e1000_hw *hw) s32 ret_val = E1000_SUCCESS; u16 status_reg = 0; u32 mac_reg; + u16 phy_reg; DEBUGFUNC("e1000_k1_workaround_lv"); @@ -1796,12 +1834,19 @@ static s32 e1000_k1_workaround_lv(struct e1000_hw *hw) mac_reg = E1000_READ_REG(hw, E1000_FEXTNVM4); mac_reg &= ~E1000_FEXTNVM4_BEACON_DURATION_MASK; - if (status_reg & HV_M_STATUS_SPEED_1000) - mac_reg |= E1000_FEXTNVM4_BEACON_DURATION_8USEC; - else - mac_reg |= E1000_FEXTNVM4_BEACON_DURATION_16USEC; + ret_val = hw->phy.ops.read_reg(hw, I82579_LPI_CTRL, &phy_reg); + if (ret_val) + goto out; + if (status_reg & HV_M_STATUS_SPEED_1000) { + mac_reg |= E1000_FEXTNVM4_BEACON_DURATION_8USEC; + phy_reg &= ~I82579_LPI_CTRL_FORCE_PLL_LOCK_COUNT; + } else { + mac_reg |= E1000_FEXTNVM4_BEACON_DURATION_16USEC; + phy_reg |= I82579_LPI_CTRL_FORCE_PLL_LOCK_COUNT; + } E1000_WRITE_REG(hw, E1000_FEXTNVM4, mac_reg); + ret_val = hw->phy.ops.write_reg(hw, I82579_LPI_CTRL, phy_reg); } out: @@ -1836,34 +1881,6 @@ static void e1000_gate_hw_phy_config_ich8lan(struct e1000_hw *hw, bool gate) return; } -/** - * e1000_hv_phy_tuning_workaround_ich8lan - This is a Phy tuning work around - * needed for Nahum3 + Hanksville testing, requested by HW team - **/ -static s32 e1000_hv_phy_tuning_workaround_ich8lan(struct e1000_hw *hw) -{ - s32 ret_val = E1000_SUCCESS; - - DEBUGFUNC("e1000_hv_phy_tuning_workaround_ich8lan"); - - ret_val = hw->phy.ops.write_reg(hw, PHY_REG(769, 25), 0x4431); - if (ret_val) - goto out; - - ret_val = hw->phy.ops.write_reg(hw, PHY_REG(770, 16), 0xA204); - if (ret_val) - goto out; - - ret_val = hw->phy.ops.write_reg(hw, (1 << 6) | 0x29, 0x66C0); - if (ret_val) - goto out; - - ret_val = hw->phy.ops.write_reg(hw, (1 << 6) | 0x1E, 0xFFFF); - -out: - return ret_val; -} - /** * e1000_lan_init_done_ich8lan - Check for PHY config completion * @hw: pointer to the HW structure @@ -1931,16 +1948,13 @@ static s32 e1000_post_phy_reset_ich8lan(struct e1000_hw *hw) break; } - if (hw->device_id == E1000_DEV_ID_ICH10_HANKSVILLE) { - ret_val = e1000_hv_phy_tuning_workaround_ich8lan(hw); - if (ret_val) - goto out; + /* Clear the host wakeup bit after lcd reset */ + if (hw->mac.type >= e1000_pchlan) { + hw->phy.ops.read_reg(hw, BM_PORT_GEN_CFG, ®); + reg &= ~BM_WUC_HOST_WU_BIT; + hw->phy.ops.write_reg(hw, BM_PORT_GEN_CFG, reg); } - /* Dummy read to clear the phy wakeup bit after lcd reset */ - if (hw->mac.type >= e1000_pchlan) - hw->phy.ops.read_reg(hw, BM_WUC, ®); - /* Configure the LCD with the extended configuration region in NVM */ ret_val = e1000_sw_lcd_config_ich8lan(hw); if (ret_val) @@ -2031,7 +2045,9 @@ static s32 e1000_set_lplu_state_pchlan(struct e1000_hw *hw, bool active) else oem_reg &= ~HV_OEM_BITS_LPLU; - oem_reg |= HV_OEM_BITS_RESTART_AN; + if (!hw->phy.ops.check_reset_block(hw)) + oem_reg |= HV_OEM_BITS_RESTART_AN; + ret_val = hw->phy.ops.write_reg(hw, HV_OEM_BITS, oem_reg); out: @@ -2081,12 +2097,12 @@ static s32 e1000_set_d0_lplu_state_ich8lan(struct e1000_hw *hw, bool active) /* When LPLU is enabled, we should disable SmartSpeed */ ret_val = phy->ops.read_reg(hw, - IGP01E1000_PHY_PORT_CONFIG, - &data); + IGP01E1000_PHY_PORT_CONFIG, + &data); data &= ~IGP01E1000_PSCFR_SMART_SPEED; ret_val = phy->ops.write_reg(hw, - IGP01E1000_PHY_PORT_CONFIG, - data); + IGP01E1000_PHY_PORT_CONFIG, + data); if (ret_val) goto out; } else { @@ -2104,28 +2120,28 @@ static s32 e1000_set_d0_lplu_state_ich8lan(struct e1000_hw *hw, bool active) */ if (phy->smart_speed == e1000_smart_speed_on) { ret_val = phy->ops.read_reg(hw, - IGP01E1000_PHY_PORT_CONFIG, - &data); + IGP01E1000_PHY_PORT_CONFIG, + &data); if (ret_val) goto out; data |= IGP01E1000_PSCFR_SMART_SPEED; ret_val = phy->ops.write_reg(hw, - IGP01E1000_PHY_PORT_CONFIG, - data); + IGP01E1000_PHY_PORT_CONFIG, + data); if (ret_val) goto out; } else if (phy->smart_speed == e1000_smart_speed_off) { ret_val = phy->ops.read_reg(hw, - IGP01E1000_PHY_PORT_CONFIG, - &data); + IGP01E1000_PHY_PORT_CONFIG, + &data); if (ret_val) goto out; data &= ~IGP01E1000_PSCFR_SMART_SPEED; ret_val = phy->ops.write_reg(hw, - IGP01E1000_PHY_PORT_CONFIG, - data); + IGP01E1000_PHY_PORT_CONFIG, + data); if (ret_val) goto out; } @@ -2174,34 +2190,34 @@ static s32 e1000_set_d3_lplu_state_ich8lan(struct e1000_hw *hw, bool active) */ if (phy->smart_speed == e1000_smart_speed_on) { ret_val = phy->ops.read_reg(hw, - IGP01E1000_PHY_PORT_CONFIG, - &data); + IGP01E1000_PHY_PORT_CONFIG, + &data); if (ret_val) goto out; data |= IGP01E1000_PSCFR_SMART_SPEED; ret_val = phy->ops.write_reg(hw, - IGP01E1000_PHY_PORT_CONFIG, - data); + IGP01E1000_PHY_PORT_CONFIG, + data); if (ret_val) goto out; } else if (phy->smart_speed == e1000_smart_speed_off) { ret_val = phy->ops.read_reg(hw, - IGP01E1000_PHY_PORT_CONFIG, - &data); + IGP01E1000_PHY_PORT_CONFIG, + &data); if (ret_val) goto out; data &= ~IGP01E1000_PSCFR_SMART_SPEED; ret_val = phy->ops.write_reg(hw, - IGP01E1000_PHY_PORT_CONFIG, - data); + IGP01E1000_PHY_PORT_CONFIG, + data); if (ret_val) goto out; } } else if ((phy->autoneg_advertised == E1000_ALL_SPEED_DUPLEX) || - (phy->autoneg_advertised == E1000_ALL_NOT_GIG) || - (phy->autoneg_advertised == E1000_ALL_10_SPEED)) { + (phy->autoneg_advertised == E1000_ALL_NOT_GIG) || + (phy->autoneg_advertised == E1000_ALL_10_SPEED)) { phy_ctrl |= E1000_PHY_CTRL_NOND0A_LPLU; E1000_WRITE_REG(hw, E1000_PHY_CTRL, phy_ctrl); @@ -2217,15 +2233,15 @@ static s32 e1000_set_d3_lplu_state_ich8lan(struct e1000_hw *hw, bool active) /* When LPLU is enabled, we should disable SmartSpeed */ ret_val = phy->ops.read_reg(hw, - IGP01E1000_PHY_PORT_CONFIG, - &data); + IGP01E1000_PHY_PORT_CONFIG, + &data); if (ret_val) goto out; data &= ~IGP01E1000_PSCFR_SMART_SPEED; ret_val = phy->ops.write_reg(hw, - IGP01E1000_PHY_PORT_CONFIG, - data); + IGP01E1000_PHY_PORT_CONFIG, + data); } out: @@ -2264,8 +2280,7 @@ static s32 e1000_valid_nvm_bank_detect_ich8lan(struct e1000_hw *hw, u32 *bank) goto out; } - DEBUGOUT("Unable to determine valid NVM bank via EEC - " - "reading flash signature\n"); + DEBUGOUT("Unable to determine valid NVM bank via EEC - reading flash signature\n"); /* fall-thru */ default: /* set bank to 0 in case flash read fails */ @@ -2273,7 +2288,7 @@ static s32 e1000_valid_nvm_bank_detect_ich8lan(struct e1000_hw *hw, u32 *bank) /* Check bank 0 */ ret_val = e1000_read_flash_byte_ich8lan(hw, act_offset, - &sig_byte); + &sig_byte); if (ret_val) goto out; if ((sig_byte & E1000_ICH_NVM_VALID_SIG_MASK) == @@ -2284,8 +2299,8 @@ static s32 e1000_valid_nvm_bank_detect_ich8lan(struct e1000_hw *hw, u32 *bank) /* Check bank 1 */ ret_val = e1000_read_flash_byte_ich8lan(hw, act_offset + - bank1_offset, - &sig_byte); + bank1_offset, + &sig_byte); if (ret_val) goto out; if ((sig_byte & E1000_ICH_NVM_VALID_SIG_MASK) == @@ -2312,7 +2327,7 @@ out: * Reads a word(s) from the NVM using the flash access registers. **/ static s32 e1000_read_nvm_ich8lan(struct e1000_hw *hw, u16 offset, u16 words, - u16 *data) + u16 *data) { struct e1000_nvm_info *nvm = &hw->nvm; struct e1000_dev_spec_ich8lan *dev_spec = &hw->dev_spec.ich8lan; @@ -2343,13 +2358,12 @@ static s32 e1000_read_nvm_ich8lan(struct e1000_hw *hw, u16 offset, u16 words, ret_val = E1000_SUCCESS; for (i = 0; i < words; i++) { - if ((dev_spec->shadow_ram) && - (dev_spec->shadow_ram[offset+i].modified)) { + if (dev_spec->shadow_ram[offset+i].modified) { data[i] = dev_spec->shadow_ram[offset+i].value; } else { ret_val = e1000_read_flash_word_ich8lan(hw, - act_offset + i, - &word); + act_offset + i, + &word); if (ret_val) break; data[i] = word; @@ -2383,8 +2397,7 @@ static s32 e1000_flash_cycle_init_ich8lan(struct e1000_hw *hw) /* Check if the flash descriptor is valid */ if (hsfsts.hsf_status.fldesvalid == 0) { - DEBUGOUT("Flash descriptor invalid. " - "SW Sequencing must be used."); + DEBUGOUT("Flash descriptor invalid. SW Sequencing must be used.\n"); goto out; } @@ -2421,7 +2434,7 @@ static s32 e1000_flash_cycle_init_ich8lan(struct e1000_hw *hw) */ for (i = 0; i < ICH_FLASH_READ_COMMAND_TIMEOUT; i++) { hsfsts.regval = E1000_READ_FLASH_REG16(hw, - ICH_FLASH_HSFSTS); + ICH_FLASH_HSFSTS); if (hsfsts.hsf_status.flcinprog == 0) { ret_val = E1000_SUCCESS; break; @@ -2435,9 +2448,9 @@ static s32 e1000_flash_cycle_init_ich8lan(struct e1000_hw *hw) */ hsfsts.hsf_status.flcdone = 1; E1000_WRITE_FLASH_REG16(hw, ICH_FLASH_HSFSTS, - hsfsts.regval); + hsfsts.regval); } else { - DEBUGOUT("Flash controller busy, cannot get access"); + DEBUGOUT("Flash controller busy, cannot get access\n"); } } @@ -2490,7 +2503,7 @@ static s32 e1000_flash_cycle_ich8lan(struct e1000_hw *hw, u32 timeout) * to bytes before read. **/ static s32 e1000_read_flash_word_ich8lan(struct e1000_hw *hw, u32 offset, - u16 *data) + u16 *data) { s32 ret_val; @@ -2519,7 +2532,7 @@ out: * Reads a single byte from the NVM using the flash access registers. **/ static s32 e1000_read_flash_byte_ich8lan(struct e1000_hw *hw, u32 offset, - u8 *data) + u8 *data) { s32 ret_val = E1000_SUCCESS; u16 word = 0; @@ -2544,7 +2557,7 @@ out: * Reads a byte or word from the NVM using the flash access registers. **/ static s32 e1000_read_flash_data_ich8lan(struct e1000_hw *hw, u32 offset, - u8 size, u16 *data) + u8 size, u16 *data) { union ich8_hws_flash_status hsfsts; union ich8_hws_flash_ctrl hsflctl; @@ -2559,7 +2572,7 @@ static s32 e1000_read_flash_data_ich8lan(struct e1000_hw *hw, u32 offset, goto out; flash_linear_addr = (ICH_FLASH_LINEAR_ADDR_MASK & offset) + - hw->nvm.flash_base_addr; + hw->nvm.flash_base_addr; do { usec_delay(1); @@ -2577,7 +2590,7 @@ static s32 e1000_read_flash_data_ich8lan(struct e1000_hw *hw, u32 offset, E1000_WRITE_FLASH_REG(hw, ICH_FLASH_FADDR, flash_linear_addr); ret_val = e1000_flash_cycle_ich8lan(hw, - ICH_FLASH_READ_COMMAND_TIMEOUT); + ICH_FLASH_READ_COMMAND_TIMEOUT); /* * Check if FCERR is set to 1, if set to 1, clear it @@ -2600,13 +2613,12 @@ static s32 e1000_read_flash_data_ich8lan(struct e1000_hw *hw, u32 offset, * ICH_FLASH_CYCLE_REPEAT_COUNT times. */ hsfsts.regval = E1000_READ_FLASH_REG16(hw, - ICH_FLASH_HSFSTS); + ICH_FLASH_HSFSTS); if (hsfsts.hsf_status.flcerr == 1) { /* Repeat for some time before giving up. */ continue; } else if (hsfsts.hsf_status.flcdone == 0) { - DEBUGOUT("Timeout error - flash cycle " - "did not complete."); + DEBUGOUT("Timeout error - flash cycle did not complete.\n"); break; } } @@ -2626,7 +2638,7 @@ out: * Writes a byte or word to the NVM using the flash access registers. **/ static s32 e1000_write_nvm_ich8lan(struct e1000_hw *hw, u16 offset, u16 words, - u16 *data) + u16 *data) { struct e1000_nvm_info *nvm = &hw->nvm; struct e1000_dev_spec_ich8lan *dev_spec = &hw->dev_spec.ich8lan; @@ -2720,8 +2732,8 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw) data = dev_spec->shadow_ram[i].value; } else { ret_val = e1000_read_flash_word_ich8lan(hw, i + - old_bank_offset, - &data); + old_bank_offset, + &data); if (ret_val) break; } @@ -2743,15 +2755,15 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw) usec_delay(100); /* Write the bytes to the new bank. */ ret_val = e1000_retry_write_flash_byte_ich8lan(hw, - act_offset, - (u8)data); + act_offset, + (u8)data); if (ret_val) break; usec_delay(100); ret_val = e1000_retry_write_flash_byte_ich8lan(hw, - act_offset + 1, - (u8)(data >> 8)); + act_offset + 1, + (u8)(data >> 8)); if (ret_val) break; } @@ -2778,8 +2790,8 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw) data &= 0xBFFF; ret_val = e1000_retry_write_flash_byte_ich8lan(hw, - act_offset * 2 + 1, - (u8)(data >> 8)); + act_offset * 2 + 1, + (u8)(data >> 8)); if (ret_val) goto release; @@ -2870,7 +2882,7 @@ out: * Writes one/two bytes to the NVM using the flash access registers. **/ static s32 e1000_write_flash_data_ich8lan(struct e1000_hw *hw, u32 offset, - u8 size, u16 data) + u8 size, u16 data) { union ich8_hws_flash_status hsfsts; union ich8_hws_flash_ctrl hsflctl; @@ -2886,7 +2898,7 @@ static s32 e1000_write_flash_data_ich8lan(struct e1000_hw *hw, u32 offset, goto out; flash_linear_addr = (ICH_FLASH_LINEAR_ADDR_MASK & offset) + - hw->nvm.flash_base_addr; + hw->nvm.flash_base_addr; do { usec_delay(1); @@ -2915,7 +2927,7 @@ static s32 e1000_write_flash_data_ich8lan(struct e1000_hw *hw, u32 offset, * and try the whole sequence a few more times else done */ ret_val = e1000_flash_cycle_ich8lan(hw, - ICH_FLASH_WRITE_COMMAND_TIMEOUT); + ICH_FLASH_WRITE_COMMAND_TIMEOUT); if (ret_val == E1000_SUCCESS) break; @@ -2930,8 +2942,7 @@ static s32 e1000_write_flash_data_ich8lan(struct e1000_hw *hw, u32 offset, /* Repeat for some time before giving up. */ continue; if (hsfsts.hsf_status.flcdone == 0) { - DEBUGOUT("Timeout error - flash cycle " - "did not complete."); + DEBUGOUT("Timeout error - flash cycle did not complete.\n"); break; } } while (count++ < ICH_FLASH_CYCLE_REPEAT_COUNT); @@ -2949,7 +2960,7 @@ out: * Writes a single byte to the NVM using the flash access registers. **/ static s32 e1000_write_flash_byte_ich8lan(struct e1000_hw *hw, u32 offset, - u8 data) + u8 data) { u16 word = (u16)data; @@ -2968,7 +2979,7 @@ static s32 e1000_write_flash_byte_ich8lan(struct e1000_hw *hw, u32 offset, * Goes through a retry algorithm before giving up. **/ static s32 e1000_retry_write_flash_byte_ich8lan(struct e1000_hw *hw, - u32 offset, u8 byte) + u32 offset, u8 byte) { s32 ret_val; u16 program_retries; @@ -3071,10 +3082,10 @@ static s32 e1000_erase_flash_bank_ich8lan(struct e1000_hw *hw, u32 bank) * Cycle field in hw flash control */ hsflctl.regval = E1000_READ_FLASH_REG16(hw, - ICH_FLASH_HSFCTL); + ICH_FLASH_HSFCTL); hsflctl.hsf_ctrl.flcycle = ICH_CYCLE_ERASE; E1000_WRITE_FLASH_REG16(hw, ICH_FLASH_HSFCTL, - hsflctl.regval); + hsflctl.regval); /* * Write the last 24 bits of an index within the @@ -3083,10 +3094,10 @@ static s32 e1000_erase_flash_bank_ich8lan(struct e1000_hw *hw, u32 bank) */ flash_linear_addr += (j * sector_size); E1000_WRITE_FLASH_REG(hw, ICH_FLASH_FADDR, - flash_linear_addr); + flash_linear_addr); ret_val = e1000_flash_cycle_ich8lan(hw, - ICH_FLASH_ERASE_COMMAND_TIMEOUT); + ICH_FLASH_ERASE_COMMAND_TIMEOUT); if (ret_val == E1000_SUCCESS) break; @@ -3130,8 +3141,7 @@ static s32 e1000_valid_led_default_ich8lan(struct e1000_hw *hw, u16 *data) goto out; } - if (*data == ID_LED_RESERVED_0000 || - *data == ID_LED_RESERVED_FFFF) + if (*data == ID_LED_RESERVED_0000 || *data == ID_LED_RESERVED_FFFF) *data = ID_LED_DEFAULT_ICH8LAN; out: @@ -3218,7 +3228,7 @@ out: * @hw: pointer to the HW structure * * ICH8 use the PCI Express bus, but does not contain a PCI Express Capability - * register, so the bus width is hard coded. + * register, so the the bus width is hard coded. **/ static s32 e1000_get_bus_info_ich8lan(struct e1000_hw *hw) { @@ -3320,10 +3330,11 @@ static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw) ret_val = e1000_acquire_swflag_ich8lan(hw); DEBUGOUT("Issuing a global reset to ich8lan\n"); E1000_WRITE_REG(hw, E1000_CTRL, (ctrl | E1000_CTRL_RST)); + /* cannot issue a flush here because it hangs the hardware */ msec_delay(20); if (!ret_val) - e1000_release_swflag_ich8lan(hw); + E1000_MUTEX_UNLOCK(&hw->dev_spec.ich8lan.swflag_mutex); if (ctrl & E1000_CTRL_PHY_RST) { ret_val = hw->phy.ops.get_cfg_done(hw); @@ -3393,11 +3404,13 @@ static s32 e1000_init_hw_ich8lan(struct e1000_hw *hw) /* * The 82578 Rx buffer will stall if wakeup is enabled in host and - * the ME. Reading the BM_WUC register will clear the host wakeup bit. + * the ME. Disable wakeup by clearing the host wakeup bit. * Reset the phy after disabling host wakeup to reset the Rx buffer. */ if (hw->phy.type == e1000_phy_82578) { - hw->phy.ops.read_reg(hw, BM_WUC, &i); + hw->phy.ops.read_reg(hw, BM_PORT_GEN_CFG, &i); + i &= ~BM_WUC_HOST_WU_BIT; + hw->phy.ops.write_reg(hw, BM_PORT_GEN_CFG, i); ret_val = e1000_phy_hw_reset_ich8lan(hw); if (ret_val) return ret_val; @@ -3411,13 +3424,13 @@ static s32 e1000_init_hw_ich8lan(struct e1000_hw *hw) txdctl = (txdctl & ~E1000_TXDCTL_WTHRESH) | E1000_TXDCTL_FULL_TX_DESC_WB; txdctl = (txdctl & ~E1000_TXDCTL_PTHRESH) | - E1000_TXDCTL_MAX_TX_DESC_PREFETCH; + E1000_TXDCTL_MAX_TX_DESC_PREFETCH; E1000_WRITE_REG(hw, E1000_TXDCTL(0), txdctl); txdctl = E1000_READ_REG(hw, E1000_TXDCTL(1)); txdctl = (txdctl & ~E1000_TXDCTL_WTHRESH) | E1000_TXDCTL_FULL_TX_DESC_WB; txdctl = (txdctl & ~E1000_TXDCTL_PTHRESH) | - E1000_TXDCTL_MAX_TX_DESC_PREFETCH; + E1000_TXDCTL_MAX_TX_DESC_PREFETCH; E1000_WRITE_REG(hw, E1000_TXDCTL(1), txdctl); /* @@ -3557,8 +3570,8 @@ static s32 e1000_setup_link_ich8lan(struct e1000_hw *hw) E1000_WRITE_REG(hw, E1000_FCRTV_PCH, hw->fc.refresh_time); ret_val = hw->phy.ops.write_reg(hw, - PHY_REG(BM_PORT_CTRL_PAGE, 27), - hw->fc.pause_time); + PHY_REG(BM_PORT_CTRL_PAGE, 27), + hw->fc.pause_time); if (ret_val) goto out; } @@ -3596,18 +3609,18 @@ static s32 e1000_setup_copper_link_ich8lan(struct e1000_hw *hw) * this fixes erroneous timeouts at 10Mbps. */ ret_val = e1000_write_kmrn_reg_generic(hw, E1000_KMRNCTRLSTA_TIMEOUTS, - 0xFFFF); + 0xFFFF); if (ret_val) goto out; ret_val = e1000_read_kmrn_reg_generic(hw, - E1000_KMRNCTRLSTA_INBAND_PARAM, - ®_data); + E1000_KMRNCTRLSTA_INBAND_PARAM, + ®_data); if (ret_val) goto out; reg_data |= 0x3F; ret_val = e1000_write_kmrn_reg_generic(hw, - E1000_KMRNCTRLSTA_INBAND_PARAM, - reg_data); + E1000_KMRNCTRLSTA_INBAND_PARAM, + reg_data); if (ret_val) goto out; @@ -3631,7 +3644,7 @@ static s32 e1000_setup_copper_link_ich8lan(struct e1000_hw *hw) break; case e1000_phy_ife: ret_val = hw->phy.ops.read_reg(hw, IFE_PHY_MDIX_CONTROL, - ®_data); + ®_data); if (ret_val) goto out; @@ -3650,7 +3663,7 @@ static s32 e1000_setup_copper_link_ich8lan(struct e1000_hw *hw) break; } ret_val = hw->phy.ops.write_reg(hw, IFE_PHY_MDIX_CONTROL, - reg_data); + reg_data); if (ret_val) goto out; break; @@ -3674,7 +3687,7 @@ out: * gigabit speeds. **/ static s32 e1000_get_link_up_info_ich8lan(struct e1000_hw *hw, u16 *speed, - u16 *duplex) + u16 *duplex) { s32 ret_val; @@ -3756,7 +3769,7 @@ static s32 e1000_kmrn_lock_loss_workaround_ich8lan(struct e1000_hw *hw) /* Disable GigE link negotiation */ phy_ctrl = E1000_READ_REG(hw, E1000_PHY_CTRL); phy_ctrl |= (E1000_PHY_CTRL_GBE_DISABLE | - E1000_PHY_CTRL_NOND0A_GBE_DISABLE); + E1000_PHY_CTRL_NOND0A_GBE_DISABLE); E1000_WRITE_REG(hw, E1000_PHY_CTRL, phy_ctrl); /* @@ -3781,7 +3794,7 @@ out: * /disabled - FALSE). **/ void e1000_set_kmrn_lock_loss_workaround_ich8lan(struct e1000_hw *hw, - bool state) + bool state) { struct e1000_dev_spec_ich8lan *dev_spec = &hw->dev_spec.ich8lan; @@ -3823,7 +3836,7 @@ void e1000_igp3_phy_powerdown_workaround_ich8lan(struct e1000_hw *hw) /* Disable link */ reg = E1000_READ_REG(hw, E1000_PHY_CTRL); reg |= (E1000_PHY_CTRL_GBE_DISABLE | - E1000_PHY_CTRL_NOND0A_GBE_DISABLE); + E1000_PHY_CTRL_NOND0A_GBE_DISABLE); E1000_WRITE_REG(hw, E1000_PHY_CTRL, reg); /* @@ -3837,7 +3850,7 @@ void e1000_igp3_phy_powerdown_workaround_ich8lan(struct e1000_hw *hw) hw->phy.ops.read_reg(hw, IGP3_VR_CTRL, &data); data &= ~IGP3_VR_CTRL_DEV_POWERDOWN_MODE_MASK; hw->phy.ops.write_reg(hw, IGP3_VR_CTRL, - data | IGP3_VR_CTRL_MODE_SHUTDOWN); + data | IGP3_VR_CTRL_MODE_SHUTDOWN); /* Read it back and test */ hw->phy.ops.read_reg(hw, IGP3_VR_CTRL, &data); @@ -3863,7 +3876,7 @@ out: * LPLU, Gig disable, MDIC PHY reset): * 1) Set Kumeran Near-end loopback * 2) Clear Kumeran Near-end loopback - * Should only be called for ICH8[m] devices with IGP_3 Phy. + * Should only be called for ICH8[m] devices with any 1G Phy. **/ void e1000_gig_downshift_workaround_ich8lan(struct e1000_hw *hw) { @@ -3873,51 +3886,54 @@ void e1000_gig_downshift_workaround_ich8lan(struct e1000_hw *hw) DEBUGFUNC("e1000_gig_downshift_workaround_ich8lan"); if ((hw->mac.type != e1000_ich8lan) || - (hw->phy.type != e1000_phy_igp_3)) + (hw->phy.type == e1000_phy_ife)) goto out; ret_val = e1000_read_kmrn_reg_generic(hw, E1000_KMRNCTRLSTA_DIAG_OFFSET, - ®_data); + ®_data); if (ret_val) goto out; reg_data |= E1000_KMRNCTRLSTA_DIAG_NELPBK; ret_val = e1000_write_kmrn_reg_generic(hw, - E1000_KMRNCTRLSTA_DIAG_OFFSET, - reg_data); + E1000_KMRNCTRLSTA_DIAG_OFFSET, + reg_data); if (ret_val) goto out; reg_data &= ~E1000_KMRNCTRLSTA_DIAG_NELPBK; ret_val = e1000_write_kmrn_reg_generic(hw, - E1000_KMRNCTRLSTA_DIAG_OFFSET, - reg_data); + E1000_KMRNCTRLSTA_DIAG_OFFSET, + reg_data); out: return; } /** - * e1000_disable_gig_wol_ich8lan - disable gig during WoL + * e1000_suspend_workarounds_ich8lan - workarounds needed during S0->Sx * @hw: pointer to the HW structure * * During S0 to Sx transition, it is possible the link remains at gig * instead of negotiating to a lower speed. Before going to Sx, set - * 'LPLU Enabled' and 'Gig Disable' to force link speed negotiation - * to a lower speed. - * - * Should only be called for applicable parts. + * 'Gig Disable' to force link speed negotiation to a lower speed based on + * the LPLU setting in the NVM or custom setting. For PCH and newer parts, + * the OEM bits PHY register (LED, GbE disable and LPLU configurations) also + * needs to be written. **/ -void e1000_disable_gig_wol_ich8lan(struct e1000_hw *hw) +void e1000_suspend_workarounds_ich8lan(struct e1000_hw *hw) { u32 phy_ctrl; s32 ret_val; - DEBUGFUNC("e1000_disable_gig_wol_ich8lan"); + DEBUGFUNC("e1000_suspend_workarounds_ich8lan"); phy_ctrl = E1000_READ_REG(hw, E1000_PHY_CTRL); - phy_ctrl |= E1000_PHY_CTRL_D0A_LPLU | E1000_PHY_CTRL_GBE_DISABLE; + phy_ctrl |= E1000_PHY_CTRL_GBE_DISABLE; E1000_WRITE_REG(hw, E1000_PHY_CTRL, phy_ctrl); + if (hw->mac.type == e1000_ich8lan) + e1000_gig_downshift_workaround_ich8lan(hw); if (hw->mac.type >= e1000_pchlan) { e1000_oem_bits_config_ich8lan(hw, FALSE); + e1000_phy_hw_reset_ich8lan(hw); ret_val = hw->phy.ops.acquire(hw); if (ret_val) return; @@ -3928,6 +3944,58 @@ void e1000_disable_gig_wol_ich8lan(struct e1000_hw *hw) return; } +/** + * e1000_resume_workarounds_pchlan - workarounds needed during Sx->S0 + * @hw: pointer to the HW structure + * + * During Sx to S0 transitions on non-managed devices or managed devices + * on which PHY resets are not blocked, if the PHY registers cannot be + * accessed properly by the s/w toggle the LANPHYPC value to power cycle + * the PHY. + **/ +void e1000_resume_workarounds_pchlan(struct e1000_hw *hw) +{ + u16 phy_id1, phy_id2; + s32 ret_val; + + DEBUGFUNC("e1000_resume_workarounds_pchlan"); + + if ((hw->mac.type != e1000_pch2lan) || + hw->phy.ops.check_reset_block(hw)) + return; + + ret_val = hw->phy.ops.acquire(hw); + if (ret_val) { + DEBUGOUT("Failed to acquire PHY semaphore in resume\n"); + return; + } + + /* Test access to the PHY registers by reading the ID regs */ + ret_val = hw->phy.ops.read_reg_locked(hw, PHY_ID1, &phy_id1); + if (ret_val) + goto release; + ret_val = hw->phy.ops.read_reg_locked(hw, PHY_ID2, &phy_id2); + if (ret_val) + goto release; + + if (hw->phy.id == ((u32)(phy_id1 << 16) | + (u32)(phy_id2 & PHY_REVISION_MASK))) + goto release; + + e1000_toggle_lanphypc_value_ich8lan(hw); + + hw->phy.ops.release(hw); + msec_delay(50); + hw->phy.ops.reset(hw); + msec_delay(50); + return; + +release: + hw->phy.ops.release(hw); + + return; +} + /** * e1000_cleanup_led_ich8lan - Restore the default LED operation * @hw: pointer to the HW structure @@ -3940,7 +4008,7 @@ static s32 e1000_cleanup_led_ich8lan(struct e1000_hw *hw) if (hw->phy.type == e1000_phy_ife) return hw->phy.ops.write_reg(hw, IFE_PHY_SPECIAL_CONTROL_LED, - 0); + 0); E1000_WRITE_REG(hw, E1000_LEDCTL, hw->mac.ledctl_default); return E1000_SUCCESS; @@ -3958,7 +4026,7 @@ static s32 e1000_led_on_ich8lan(struct e1000_hw *hw) if (hw->phy.type == e1000_phy_ife) return hw->phy.ops.write_reg(hw, IFE_PHY_SPECIAL_CONTROL_LED, - (IFE_PSCL_PROBE_MODE | IFE_PSCL_PROBE_LEDS_ON)); + (IFE_PSCL_PROBE_MODE | IFE_PSCL_PROBE_LEDS_ON)); E1000_WRITE_REG(hw, E1000_LEDCTL, hw->mac.ledctl_mode2); return E1000_SUCCESS; @@ -3976,7 +4044,7 @@ static s32 e1000_led_off_ich8lan(struct e1000_hw *hw) if (hw->phy.type == e1000_phy_ife) return hw->phy.ops.write_reg(hw, IFE_PHY_SPECIAL_CONTROL_LED, - (IFE_PSCL_PROBE_MODE | IFE_PSCL_PROBE_LEDS_OFF)); + (IFE_PSCL_PROBE_MODE | IFE_PSCL_PROBE_LEDS_OFF)); E1000_WRITE_REG(hw, E1000_LEDCTL, hw->mac.ledctl_mode1); return E1000_SUCCESS; @@ -3993,7 +4061,7 @@ static s32 e1000_setup_led_pchlan(struct e1000_hw *hw) DEBUGFUNC("e1000_setup_led_pchlan"); return hw->phy.ops.write_reg(hw, HV_LED_CONFIG, - (u16)hw->mac.ledctl_mode1); + (u16)hw->mac.ledctl_mode1); } /** @@ -4007,7 +4075,7 @@ static s32 e1000_cleanup_led_pchlan(struct e1000_hw *hw) DEBUGFUNC("e1000_cleanup_led_pchlan"); return hw->phy.ops.write_reg(hw, HV_LED_CONFIG, - (u16)hw->mac.ledctl_default); + (u16)hw->mac.ledctl_default); } /** @@ -4165,6 +4233,7 @@ static void e1000_power_down_phy_copper_ich8lan(struct e1000_hw *hw) static void e1000_clear_hw_cntrs_ich8lan(struct e1000_hw *hw) { u16 phy_data; + s32 ret_val; DEBUGFUNC("e1000_clear_hw_cntrs_ich8lan"); @@ -4188,20 +4257,29 @@ static void e1000_clear_hw_cntrs_ich8lan(struct e1000_hw *hw) if ((hw->phy.type == e1000_phy_82578) || (hw->phy.type == e1000_phy_82579) || (hw->phy.type == e1000_phy_82577)) { - hw->phy.ops.read_reg(hw, HV_SCC_UPPER, &phy_data); - hw->phy.ops.read_reg(hw, HV_SCC_LOWER, &phy_data); - hw->phy.ops.read_reg(hw, HV_ECOL_UPPER, &phy_data); - hw->phy.ops.read_reg(hw, HV_ECOL_LOWER, &phy_data); - hw->phy.ops.read_reg(hw, HV_MCC_UPPER, &phy_data); - hw->phy.ops.read_reg(hw, HV_MCC_LOWER, &phy_data); - hw->phy.ops.read_reg(hw, HV_LATECOL_UPPER, &phy_data); - hw->phy.ops.read_reg(hw, HV_LATECOL_LOWER, &phy_data); - hw->phy.ops.read_reg(hw, HV_COLC_UPPER, &phy_data); - hw->phy.ops.read_reg(hw, HV_COLC_LOWER, &phy_data); - hw->phy.ops.read_reg(hw, HV_DC_UPPER, &phy_data); - hw->phy.ops.read_reg(hw, HV_DC_LOWER, &phy_data); - hw->phy.ops.read_reg(hw, HV_TNCRS_UPPER, &phy_data); - hw->phy.ops.read_reg(hw, HV_TNCRS_LOWER, &phy_data); + ret_val = hw->phy.ops.acquire(hw); + if (ret_val) + return; + ret_val = hw->phy.ops.set_page(hw, + HV_STATS_PAGE << IGP_PAGE_SHIFT); + if (ret_val) + goto release; + hw->phy.ops.read_reg_page(hw, HV_SCC_UPPER, &phy_data); + hw->phy.ops.read_reg_page(hw, HV_SCC_LOWER, &phy_data); + hw->phy.ops.read_reg_page(hw, HV_ECOL_UPPER, &phy_data); + hw->phy.ops.read_reg_page(hw, HV_ECOL_LOWER, &phy_data); + hw->phy.ops.read_reg_page(hw, HV_MCC_UPPER, &phy_data); + hw->phy.ops.read_reg_page(hw, HV_MCC_LOWER, &phy_data); + hw->phy.ops.read_reg_page(hw, HV_LATECOL_UPPER, &phy_data); + hw->phy.ops.read_reg_page(hw, HV_LATECOL_LOWER, &phy_data); + hw->phy.ops.read_reg_page(hw, HV_COLC_UPPER, &phy_data); + hw->phy.ops.read_reg_page(hw, HV_COLC_LOWER, &phy_data); + hw->phy.ops.read_reg_page(hw, HV_DC_UPPER, &phy_data); + hw->phy.ops.read_reg_page(hw, HV_DC_LOWER, &phy_data); + hw->phy.ops.read_reg_page(hw, HV_TNCRS_UPPER, &phy_data); + hw->phy.ops.read_reg_page(hw, HV_TNCRS_LOWER, &phy_data); +release: + hw->phy.ops.release(hw); } } diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_ich8lan.h b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_ich8lan.h index 26dbaffba0..2eccb30046 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_ich8lan.h +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_ich8lan.h @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2010, Intel Corporation + Copyright (c) 2001-2011, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -30,187 +30,209 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: src/sys/dev/e1000/e1000_ich8lan.h,v 1.4.2.3.2.1 2010/12/21 17:09:25 kensmith Exp $*/ +/*$FreeBSD$*/ #ifndef _E1000_ICH8LAN_H_ #define _E1000_ICH8LAN_H_ -#define ICH_FLASH_GFPREG 0x0000 -#define ICH_FLASH_HSFSTS 0x0004 -#define ICH_FLASH_HSFCTL 0x0006 -#define ICH_FLASH_FADDR 0x0008 -#define ICH_FLASH_FDATA0 0x0010 +#define ICH_FLASH_GFPREG 0x0000 +#define ICH_FLASH_HSFSTS 0x0004 +#define ICH_FLASH_HSFCTL 0x0006 +#define ICH_FLASH_FADDR 0x0008 +#define ICH_FLASH_FDATA0 0x0010 /* Requires up to 10 seconds when MNG might be accessing part. */ -#define ICH_FLASH_READ_COMMAND_TIMEOUT 10000000 -#define ICH_FLASH_WRITE_COMMAND_TIMEOUT 10000000 -#define ICH_FLASH_ERASE_COMMAND_TIMEOUT 10000000 -#define ICH_FLASH_LINEAR_ADDR_MASK 0x00FFFFFF -#define ICH_FLASH_CYCLE_REPEAT_COUNT 10 +#define ICH_FLASH_READ_COMMAND_TIMEOUT 10000000 +#define ICH_FLASH_WRITE_COMMAND_TIMEOUT 10000000 +#define ICH_FLASH_ERASE_COMMAND_TIMEOUT 10000000 +#define ICH_FLASH_LINEAR_ADDR_MASK 0x00FFFFFF +#define ICH_FLASH_CYCLE_REPEAT_COUNT 10 -#define ICH_CYCLE_READ 0 -#define ICH_CYCLE_WRITE 2 -#define ICH_CYCLE_ERASE 3 +#define ICH_CYCLE_READ 0 +#define ICH_CYCLE_WRITE 2 +#define ICH_CYCLE_ERASE 3 -#define FLASH_GFPREG_BASE_MASK 0x1FFF -#define FLASH_SECTOR_ADDR_SHIFT 12 +#define FLASH_GFPREG_BASE_MASK 0x1FFF +#define FLASH_SECTOR_ADDR_SHIFT 12 -#define ICH_FLASH_SEG_SIZE_256 256 -#define ICH_FLASH_SEG_SIZE_4K 4096 -#define ICH_FLASH_SEG_SIZE_8K 8192 -#define ICH_FLASH_SEG_SIZE_64K 65536 -#define ICH_FLASH_SECTOR_SIZE 4096 +#define ICH_FLASH_SEG_SIZE_256 256 +#define ICH_FLASH_SEG_SIZE_4K 4096 +#define ICH_FLASH_SEG_SIZE_8K 8192 +#define ICH_FLASH_SEG_SIZE_64K 65536 +#define ICH_FLASH_SECTOR_SIZE 4096 -#define ICH_FLASH_REG_MAPSIZE 0x00A0 +#define ICH_FLASH_REG_MAPSIZE 0x00A0 -#define E1000_ICH_FWSM_RSPCIPHY 0x00000040 /* Reset PHY on PCI Reset */ -#define E1000_ICH_FWSM_DISSW 0x10000000 /* FW Disables SW Writes */ +#define E1000_ICH_FWSM_RSPCIPHY 0x00000040 /* Reset PHY on PCI Reset */ +#define E1000_ICH_FWSM_DISSW 0x10000000 /* FW Disables SW Writes */ /* FW established a valid mode */ -#define E1000_ICH_FWSM_FW_VALID 0x00008000 +#define E1000_ICH_FWSM_FW_VALID 0x00008000 +#define E1000_ICH_FWSM_PCIM2PCI 0x01000000 /* ME PCIm-to-PCI active */ +#define E1000_ICH_FWSM_PCIM2PCI_COUNT 2000 -#define E1000_ICH_MNG_IAMT_MODE 0x2 +#define E1000_ICH_MNG_IAMT_MODE 0x2 -#define E1000_FWSM_PROXY_MODE 0x00000008 /* FW is in proxy mode */ +#define E1000_FWSM_PROXY_MODE 0x00000008 /* FW is in proxy mode */ +#define E1000_FWSM_MEMC 0x00000010 /* ME Messaging capable */ /* Shared Receive Address Registers */ -#define E1000_SHRAL(_i) (0x05438 + ((_i) * 8)) -#define E1000_SHRAH(_i) (0x0543C + ((_i) * 8)) -#define E1000_SHRAH_AV 0x80000000 /* Addr Valid bit */ -#define E1000_SHRAH_MAV 0x40000000 /* Multicast Addr Valid bit */ +#define E1000_SHRAL(_i) (0x05438 + ((_i) * 8)) +#define E1000_SHRAH(_i) (0x0543C + ((_i) * 8)) +#define E1000_SHRAH_AV 0x80000000 /* Addr Valid bit */ +#define E1000_SHRAH_MAV 0x40000000 /* Multicast Addr Valid bit */ -#define E1000_H2ME 0x05B50 /* Host to ME */ -#define E1000_H2ME_LSECREQ 0x00000001 /* Linksec Request */ -#define E1000_H2ME_LSECA 0x00000002 /* Linksec Active */ -#define E1000_H2ME_LSECSF 0x00000004 /* Linksec Failed */ -#define E1000_H2ME_LSECD 0x00000008 /* Linksec Disabled */ -#define E1000_H2ME_SLCAPD 0x00000010 /* Start LCAPD */ -#define E1000_H2ME_IPV4_ARP_EN 0x00000020 /* Arp Offload enable bit */ -#define E1000_H2ME_IPV6_NS_EN 0x00000040 /* NS Offload enable bit */ +#define E1000_H2ME 0x05B50 /* Host to ME */ +#define E1000_H2ME_LSECREQ 0x00000001 /* Linksec Request */ +#define E1000_H2ME_LSECA 0x00000002 /* Linksec Active */ +#define E1000_H2ME_LSECSF 0x00000004 /* Linksec Failed */ +#define E1000_H2ME_LSECD 0x00000008 /* Linksec Disabled */ +#define E1000_H2ME_SLCAPD 0x00000010 /* Start LCAPD */ +#define E1000_H2ME_IPV4_ARP_EN 0x00000020 /* Arp Offload enable bit */ +#define E1000_H2ME_IPV6_NS_EN 0x00000040 /* NS Offload enable bit */ -#define ID_LED_DEFAULT_ICH8LAN ((ID_LED_DEF1_DEF2 << 12) | \ - (ID_LED_OFF1_OFF2 << 8) | \ - (ID_LED_OFF1_ON2 << 4) | \ - (ID_LED_DEF1_DEF2)) +#define ID_LED_DEFAULT_ICH8LAN ((ID_LED_DEF1_DEF2 << 12) | \ + (ID_LED_OFF1_OFF2 << 8) | \ + (ID_LED_OFF1_ON2 << 4) | \ + (ID_LED_DEF1_DEF2)) -#define E1000_ICH_NVM_SIG_WORD 0x13 -#define E1000_ICH_NVM_SIG_MASK 0xC000 -#define E1000_ICH_NVM_VALID_SIG_MASK 0xC0 -#define E1000_ICH_NVM_SIG_VALUE 0x80 +#define E1000_ICH_NVM_SIG_WORD 0x13 +#define E1000_ICH_NVM_SIG_MASK 0xC000 +#define E1000_ICH_NVM_VALID_SIG_MASK 0xC0 +#define E1000_ICH_NVM_SIG_VALUE 0x80 -#define E1000_ICH8_LAN_INIT_TIMEOUT 1500 +#define E1000_ICH8_LAN_INIT_TIMEOUT 1500 -#define E1000_FEXTNVM_SW_CONFIG 1 -#define E1000_FEXTNVM_SW_CONFIG_ICH8M (1 << 27) /* Bit redefined for ICH8M */ +#define E1000_FEXTNVM_SW_CONFIG 1 +#define E1000_FEXTNVM_SW_CONFIG_ICH8M (1 << 27) /* Bit redefined for ICH8M */ -#define E1000_FEXTNVM4_BEACON_DURATION_MASK 0x7 -#define E1000_FEXTNVM4_BEACON_DURATION_8USEC 0x7 -#define E1000_FEXTNVM4_BEACON_DURATION_16USEC 0x3 +#define E1000_FEXTNVM4_BEACON_DURATION_MASK 0x7 +#define E1000_FEXTNVM4_BEACON_DURATION_8USEC 0x7 +#define E1000_FEXTNVM4_BEACON_DURATION_16USEC 0x3 -#define PCIE_ICH8_SNOOP_ALL PCIE_NO_SNOOP_ALL +#define PCIE_ICH8_SNOOP_ALL PCIE_NO_SNOOP_ALL -#define E1000_ICH_RAR_ENTRIES 7 -#define E1000_PCH2_RAR_ENTRIES 5 /* RAR[0], SHRA[0-3] */ +#define E1000_ICH_RAR_ENTRIES 7 +#define E1000_PCH2_RAR_ENTRIES 5 /* RAR[0], SHRA[0-3] */ -#define PHY_PAGE_SHIFT 5 -#define PHY_REG(page, reg) (((page) << PHY_PAGE_SHIFT) | \ - ((reg) & MAX_PHY_REG_ADDRESS)) -#define IGP3_KMRN_DIAG PHY_REG(770, 19) /* KMRN Diagnostic */ -#define IGP3_VR_CTRL PHY_REG(776, 18) /* Voltage Regulator Control */ -#define IGP3_CAPABILITY PHY_REG(776, 19) /* Capability */ -#define IGP3_PM_CTRL PHY_REG(769, 20) /* Power Management Control */ +#define PHY_PAGE_SHIFT 5 +#define PHY_REG(page, reg) (((page) << PHY_PAGE_SHIFT) | \ + ((reg) & MAX_PHY_REG_ADDRESS)) +#define IGP3_KMRN_DIAG PHY_REG(770, 19) /* KMRN Diagnostic */ +#define IGP3_VR_CTRL PHY_REG(776, 18) /* Voltage Regulator Control */ +#define IGP3_CAPABILITY PHY_REG(776, 19) /* Capability */ +#define IGP3_PM_CTRL PHY_REG(769, 20) /* Power Management Control */ -#define IGP3_KMRN_DIAG_PCS_LOCK_LOSS 0x0002 -#define IGP3_VR_CTRL_DEV_POWERDOWN_MODE_MASK 0x0300 -#define IGP3_VR_CTRL_MODE_SHUTDOWN 0x0200 -#define IGP3_PM_CTRL_FORCE_PWR_DOWN 0x0020 +#define IGP3_KMRN_DIAG_PCS_LOCK_LOSS 0x0002 +#define IGP3_VR_CTRL_DEV_POWERDOWN_MODE_MASK 0x0300 +#define IGP3_VR_CTRL_MODE_SHUTDOWN 0x0200 +#define IGP3_PM_CTRL_FORCE_PWR_DOWN 0x0020 /* PHY Wakeup Registers and defines */ -#define BM_RCTL PHY_REG(BM_WUC_PAGE, 0) -#define BM_WUC PHY_REG(BM_WUC_PAGE, 1) -#define BM_WUFC PHY_REG(BM_WUC_PAGE, 2) -#define BM_WUS PHY_REG(BM_WUC_PAGE, 3) -#define BM_RAR_L(_i) (BM_PHY_REG(BM_WUC_PAGE, 16 + ((_i) << 2))) -#define BM_RAR_M(_i) (BM_PHY_REG(BM_WUC_PAGE, 17 + ((_i) << 2))) -#define BM_RAR_H(_i) (BM_PHY_REG(BM_WUC_PAGE, 18 + ((_i) << 2))) -#define BM_RAR_CTRL(_i) (BM_PHY_REG(BM_WUC_PAGE, 19 + ((_i) << 2))) -#define BM_MTA(_i) (BM_PHY_REG(BM_WUC_PAGE, 128 + ((_i) << 1))) -#define BM_IPAV (BM_PHY_REG(BM_WUC_PAGE, 64)) -#define BM_IP4AT_L(_i) (BM_PHY_REG(BM_WUC_PAGE, 82 + ((_i) * 2))) -#define BM_IP4AT_H(_i) (BM_PHY_REG(BM_WUC_PAGE, 83 + ((_i) * 2))) +#define BM_PORT_GEN_CFG PHY_REG(BM_PORT_CTRL_PAGE, 17) +#define BM_RCTL PHY_REG(BM_WUC_PAGE, 0) +#define BM_WUC PHY_REG(BM_WUC_PAGE, 1) +#define BM_WUFC PHY_REG(BM_WUC_PAGE, 2) +#define BM_WUS PHY_REG(BM_WUC_PAGE, 3) +#define BM_RAR_L(_i) (BM_PHY_REG(BM_WUC_PAGE, 16 + ((_i) << 2))) +#define BM_RAR_M(_i) (BM_PHY_REG(BM_WUC_PAGE, 17 + ((_i) << 2))) +#define BM_RAR_H(_i) (BM_PHY_REG(BM_WUC_PAGE, 18 + ((_i) << 2))) +#define BM_RAR_CTRL(_i) (BM_PHY_REG(BM_WUC_PAGE, 19 + ((_i) << 2))) +#define BM_MTA(_i) (BM_PHY_REG(BM_WUC_PAGE, 128 + ((_i) << 1))) +#define BM_IPAV (BM_PHY_REG(BM_WUC_PAGE, 64)) +#define BM_IP4AT_L(_i) (BM_PHY_REG(BM_WUC_PAGE, 82 + ((_i) * 2))) +#define BM_IP4AT_H(_i) (BM_PHY_REG(BM_WUC_PAGE, 83 + ((_i) * 2))) -#define BM_SHRAL_LOWER(_i) (BM_PHY_REG(BM_WUC_PAGE, 44 + ((_i) * 4))) -#define BM_SHRAL_UPPER(_i) (BM_PHY_REG(BM_WUC_PAGE, 45 + ((_i) * 4))) -#define BM_SHRAH_LOWER(_i) (BM_PHY_REG(BM_WUC_PAGE, 46 + ((_i) * 4))) -#define BM_SHRAH_UPPER(_i) (BM_PHY_REG(BM_WUC_PAGE, 47 + ((_i) * 4))) +#define BM_SHRAL_LOWER(_i) (BM_PHY_REG(BM_WUC_PAGE, 44 + ((_i) * 4))) +#define BM_SHRAL_UPPER(_i) (BM_PHY_REG(BM_WUC_PAGE, 45 + ((_i) * 4))) +#define BM_SHRAH_LOWER(_i) (BM_PHY_REG(BM_WUC_PAGE, 46 + ((_i) * 4))) +#define BM_SHRAH_UPPER(_i) (BM_PHY_REG(BM_WUC_PAGE, 47 + ((_i) * 4))) -#define BM_RCTL_UPE 0x0001 /* Unicast Promiscuous Mode */ -#define BM_RCTL_MPE 0x0002 /* Multicast Promiscuous Mode */ -#define BM_RCTL_MO_SHIFT 3 /* Multicast Offset Shift */ -#define BM_RCTL_MO_MASK (3 << 3) /* Multicast Offset Mask */ -#define BM_RCTL_BAM 0x0020 /* Broadcast Accept Mode */ -#define BM_RCTL_PMCF 0x0040 /* Pass MAC Control Frames */ -#define BM_RCTL_RFCE 0x0080 /* Rx Flow Control Enable */ +#define BM_RCTL_UPE 0x0001 /* Unicast Promiscuous Mode */ +#define BM_RCTL_MPE 0x0002 /* Multicast Promiscuous Mode */ +#define BM_RCTL_MO_SHIFT 3 /* Multicast Offset Shift */ +#define BM_RCTL_MO_MASK (3 << 3) /* Multicast Offset Mask */ +#define BM_RCTL_BAM 0x0020 /* Broadcast Accept Mode */ +#define BM_RCTL_PMCF 0x0040 /* Pass MAC Control Frames */ +#define BM_RCTL_RFCE 0x0080 /* Rx Flow Control Enable */ -#define HV_LED_CONFIG PHY_REG(768, 30) /* LED Configuration */ -#define HV_MUX_DATA_CTRL PHY_REG(776, 16) -#define HV_MUX_DATA_CTRL_GEN_TO_MAC 0x0400 -#define HV_MUX_DATA_CTRL_FORCE_SPEED 0x0004 -#define HV_SCC_UPPER PHY_REG(778, 16) /* Single Collision Count */ -#define HV_SCC_LOWER PHY_REG(778, 17) -#define HV_ECOL_UPPER PHY_REG(778, 18) /* Excessive Collision Count */ -#define HV_ECOL_LOWER PHY_REG(778, 19) -#define HV_MCC_UPPER PHY_REG(778, 20) /* Multiple Collision Count */ -#define HV_MCC_LOWER PHY_REG(778, 21) -#define HV_LATECOL_UPPER PHY_REG(778, 23) /* Late Collision Count */ -#define HV_LATECOL_LOWER PHY_REG(778, 24) -#define HV_COLC_UPPER PHY_REG(778, 25) /* Collision Count */ -#define HV_COLC_LOWER PHY_REG(778, 26) -#define HV_DC_UPPER PHY_REG(778, 27) /* Defer Count */ -#define HV_DC_LOWER PHY_REG(778, 28) -#define HV_TNCRS_UPPER PHY_REG(778, 29) /* Transmit with no CRS */ -#define HV_TNCRS_LOWER PHY_REG(778, 30) +#define HV_LED_CONFIG PHY_REG(768, 30) /* LED Configuration */ +#define HV_MUX_DATA_CTRL PHY_REG(776, 16) +#define HV_MUX_DATA_CTRL_GEN_TO_MAC 0x0400 +#define HV_MUX_DATA_CTRL_FORCE_SPEED 0x0004 +#define HV_STATS_PAGE 778 +#define HV_SCC_UPPER PHY_REG(HV_STATS_PAGE, 16) /* Single Collision Count */ +#define HV_SCC_LOWER PHY_REG(HV_STATS_PAGE, 17) +#define HV_ECOL_UPPER PHY_REG(HV_STATS_PAGE, 18) /* Excessive Coll. Count */ +#define HV_ECOL_LOWER PHY_REG(HV_STATS_PAGE, 19) +#define HV_MCC_UPPER PHY_REG(HV_STATS_PAGE, 20) /* Multiple Coll. Count */ +#define HV_MCC_LOWER PHY_REG(HV_STATS_PAGE, 21) +#define HV_LATECOL_UPPER PHY_REG(HV_STATS_PAGE, 23) /* Late Collision Count */ +#define HV_LATECOL_LOWER PHY_REG(HV_STATS_PAGE, 24) +#define HV_COLC_UPPER PHY_REG(HV_STATS_PAGE, 25) /* Collision Count */ +#define HV_COLC_LOWER PHY_REG(HV_STATS_PAGE, 26) +#define HV_DC_UPPER PHY_REG(HV_STATS_PAGE, 27) /* Defer Count */ +#define HV_DC_LOWER PHY_REG(HV_STATS_PAGE, 28) +#define HV_TNCRS_UPPER PHY_REG(HV_STATS_PAGE, 29) /* Transmit with no CRS */ +#define HV_TNCRS_LOWER PHY_REG(HV_STATS_PAGE, 30) -#define E1000_FCRTV_PCH 0x05F40 /* PCH Flow Control Refresh Timer Value */ +#define E1000_FCRTV_PCH 0x05F40 /* PCH Flow Control Refresh Timer Value */ -#define E1000_NVM_K1_CONFIG 0x1B /* NVM K1 Config Word */ -#define E1000_NVM_K1_ENABLE 0x1 /* NVM Enable K1 bit */ +/* + * For ICH, the name used for NVM word 17h is LED1 Config. + * For PCH, the word was re-named to OEM Config. + */ +#define E1000_NVM_LED1_CONFIG 0x17 /* NVM LED1/LPLU Config Word */ +#define E1000_NVM_LED1_CONFIG_LPLU_NONDOA 0x0400 /* NVM LPLU in non-D0a Bit */ +#define E1000_NVM_OEM_CONFIG E1000_NVM_LED1_CONFIG +#define E1000_NVM_OEM_CONFIG_LPLU_NONDOA E1000_NVM_LED1_CONFIG_LPLU_NONDOA + +#define E1000_NVM_K1_CONFIG 0x1B /* NVM K1 Config Word */ +#define E1000_NVM_K1_ENABLE 0x1 /* NVM Enable K1 bit */ /* SMBus Address Phy Register */ -#define HV_SMB_ADDR PHY_REG(768, 26) -#define HV_SMB_ADDR_MASK 0x007F -#define HV_SMB_ADDR_PEC_EN 0x0200 -#define HV_SMB_ADDR_VALID 0x0080 +#define HV_SMB_ADDR PHY_REG(768, 26) +#define HV_SMB_ADDR_MASK 0x007F +#define HV_SMB_ADDR_PEC_EN 0x0200 +#define HV_SMB_ADDR_VALID 0x0080 /* Strapping Option Register - RO */ -#define E1000_STRAP 0x0000C -#define E1000_STRAP_SMBUS_ADDRESS_MASK 0x00FE0000 -#define E1000_STRAP_SMBUS_ADDRESS_SHIFT 17 +#define E1000_STRAP 0x0000C +#define E1000_STRAP_SMBUS_ADDRESS_MASK 0x00FE0000 +#define E1000_STRAP_SMBUS_ADDRESS_SHIFT 17 /* OEM Bits Phy Register */ -#define HV_OEM_BITS PHY_REG(768, 25) -#define HV_OEM_BITS_LPLU 0x0004 /* Low Power Link Up */ -#define HV_OEM_BITS_GBE_DIS 0x0040 /* Gigabit Disable */ -#define HV_OEM_BITS_RESTART_AN 0x0400 /* Restart Auto-negotiation */ +#define HV_OEM_BITS PHY_REG(768, 25) +#define HV_OEM_BITS_LPLU 0x0004 /* Low Power Link Up */ +#define HV_OEM_BITS_GBE_DIS 0x0040 /* Gigabit Disable */ +#define HV_OEM_BITS_RESTART_AN 0x0400 /* Restart Auto-negotiation */ -#define LCD_CFG_PHY_ADDR_BIT 0x0020 /* Phy address bit from LCD Config word */ +#define LCD_CFG_PHY_ADDR_BIT 0x0020 /* Phy addr bit from LCD Config word */ /* KMRN Mode Control */ -#define HV_KMRN_MODE_CTRL PHY_REG(769, 16) -#define HV_KMRN_MDIO_SLOW 0x0400 +#define HV_KMRN_MODE_CTRL PHY_REG(769, 16) +#define HV_KMRN_MDIO_SLOW 0x0400 + +/* KMRN FIFO Control and Status */ +#define HV_KMRN_FIFO_CTRLSTA PHY_REG(770, 16) +#define HV_KMRN_FIFO_CTRLSTA_PREAMBLE_MASK 0x7000 +#define HV_KMRN_FIFO_CTRLSTA_PREAMBLE_SHIFT 12 /* PHY Power Management Control */ -#define HV_PM_CTRL PHY_REG(770, 17) +#define HV_PM_CTRL PHY_REG(770, 17) -#define SW_FLAG_TIMEOUT 1000 /* SW Semaphore flag timeout in milliseconds */ +#define SW_FLAG_TIMEOUT 1000 /* SW Semaphore flag timeout in ms */ /* PHY Low Power Idle Control */ -#define I82579_LPI_CTRL PHY_REG(772, 20) -#define I82579_LPI_CTRL_ENABLE_MASK 0x6000 +#define I82579_LPI_CTRL PHY_REG(772, 20) +#define I82579_LPI_CTRL_ENABLE_MASK 0x6000 +#define I82579_LPI_CTRL_FORCE_PLL_LOCK_COUNT 0x80 /* EMI Registers */ -#define I82579_EMI_ADDR 0x10 -#define I82579_EMI_DATA 0x11 -#define I82579_LPI_UPDATE_TIMER 0x4805 /* in 40ns units + 40 ns base value */ +#define I82579_EMI_ADDR 0x10 +#define I82579_EMI_DATA 0x11 +#define I82579_LPI_UPDATE_TIMER 0x4805 /* in 40ns units + 40 ns base value */ +#define I82579_MSE_THRESHOLD 0x084F /* Mean Square Error Threshold */ +#define I82579_MSE_LINK_DOWN 0x2411 /* MSE count before dropping link */ /* * Additional interrupts need to be handled for ICH family: @@ -219,33 +241,32 @@ * EPRST = Manageability reset event */ #define IMS_ICH_ENABLE_MASK (\ - E1000_IMS_DSW | \ - E1000_IMS_PHYINT | \ - E1000_IMS_EPRST) + E1000_IMS_DSW | \ + E1000_IMS_PHYINT | \ + E1000_IMS_EPRST) /* Additional interrupt register bit definitions */ -#define E1000_ICR_LSECPNC 0x00004000 /* PN threshold - client */ -#define E1000_IMS_LSECPNC E1000_ICR_LSECPNC /* PN threshold - client */ -#define E1000_ICS_LSECPNC E1000_ICR_LSECPNC /* PN threshold - client */ +#define E1000_ICR_LSECPNC 0x00004000 /* PN threshold - client */ +#define E1000_IMS_LSECPNC E1000_ICR_LSECPNC /* PN threshold - client */ +#define E1000_ICS_LSECPNC E1000_ICR_LSECPNC /* PN threshold - client */ /* Security Processing bit Indication */ -#define E1000_RXDEXT_LINKSEC_STATUS_LSECH 0x01000000 -#define E1000_RXDEXT_LINKSEC_ERROR_BIT_MASK 0x60000000 -#define E1000_RXDEXT_LINKSEC_ERROR_NO_SA_MATCH 0x20000000 -#define E1000_RXDEXT_LINKSEC_ERROR_REPLAY_ERROR 0x40000000 -#define E1000_RXDEXT_LINKSEC_ERROR_BAD_SIG 0x60000000 +#define E1000_RXDEXT_LINKSEC_STATUS_LSECH 0x01000000 +#define E1000_RXDEXT_LINKSEC_ERROR_BIT_MASK 0x60000000 +#define E1000_RXDEXT_LINKSEC_ERROR_NO_SA_MATCH 0x20000000 +#define E1000_RXDEXT_LINKSEC_ERROR_REPLAY_ERROR 0x40000000 +#define E1000_RXDEXT_LINKSEC_ERROR_BAD_SIG 0x60000000 /* Receive Address Initial CRC Calculation */ -#define E1000_PCH_RAICC(_n) (0x05F50 + ((_n) * 4)) +#define E1000_PCH_RAICC(_n) (0x05F50 + ((_n) * 4)) void e1000_set_kmrn_lock_loss_workaround_ich8lan(struct e1000_hw *hw, - bool state); + bool state); void e1000_igp3_phy_powerdown_workaround_ich8lan(struct e1000_hw *hw); void e1000_gig_downshift_workaround_ich8lan(struct e1000_hw *hw); -void e1000_disable_gig_wol_ich8lan(struct e1000_hw *hw); +void e1000_suspend_workarounds_ich8lan(struct e1000_hw *hw); +void e1000_resume_workarounds_pchlan(struct e1000_hw *hw); s32 e1000_configure_k1_ich8lan(struct e1000_hw *hw, bool k1_enable); -s32 e1000_oem_bits_config_ich8lan(struct e1000_hw *hw, bool d0_config); -s32 e1000_hv_phy_powerdown_workaround_ich8lan(struct e1000_hw *hw); void e1000_copy_rx_addrs_to_phy_ich8lan(struct e1000_hw *hw); s32 e1000_lv_jumbo_workaround_ich8lan(struct e1000_hw *hw, bool enable); #endif diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_mac.c b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_mac.c index a68aba7875..95d6873b13 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_mac.c +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_mac.c @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2010, Intel Corporation + Copyright (c) 2001-2012, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -30,12 +30,14 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: src/sys/dev/e1000/e1000_mac.c,v 1.4.2.3.2.1 2010/12/21 17:09:25 kensmith Exp $*/ +/*$FreeBSD$*/ #include "e1000_api.h" static s32 e1000_validate_mdi_setting_generic(struct e1000_hw *hw); static void e1000_set_lan_id_multi_port_pcie(struct e1000_hw *hw); +static void e1000_config_collision_dist_generic(struct e1000_hw *hw); +static void e1000_rar_set_generic(struct e1000_hw *hw, u8 *addr, u32 index); /** * e1000_init_mac_ops_generic - Initialize MAC function pointers @@ -177,8 +179,8 @@ s32 e1000_get_bus_info_pci_generic(struct e1000_hw *hw) /* Bus speed */ if (bus->type == e1000_bus_type_pci) { bus->speed = (status & E1000_STATUS_PCI66) - ? e1000_bus_speed_66 - : e1000_bus_speed_33; + ? e1000_bus_speed_66 + : e1000_bus_speed_33; } else { switch (status & E1000_STATUS_PCIX_SPEED) { case E1000_STATUS_PCIX_SPEED_66: @@ -198,8 +200,8 @@ s32 e1000_get_bus_info_pci_generic(struct e1000_hw *hw) /* Bus width */ bus->width = (status & E1000_STATUS_BUS64) - ? e1000_bus_width_64 - : e1000_bus_width_32; + ? e1000_bus_width_64 + : e1000_bus_width_32; /* Which PCI(-X) function? */ mac->ops.set_lan_id(hw); @@ -226,9 +228,8 @@ s32 e1000_get_bus_info_pcie_generic(struct e1000_hw *hw) bus->type = e1000_bus_type_pci_express; - ret_val = e1000_read_pcie_cap_reg(hw, - PCIE_LINK_STATUS, - &pcie_link_status); + ret_val = e1000_read_pcie_cap_reg(hw, PCIE_LINK_STATUS, + &pcie_link_status); if (ret_val) { bus->width = e1000_bus_width_unknown; bus->speed = e1000_bus_speed_unknown; @@ -246,8 +247,7 @@ s32 e1000_get_bus_info_pcie_generic(struct e1000_hw *hw) } bus->width = (enum e1000_bus_width)((pcie_link_status & - PCIE_LINK_WIDTH_MASK) >> - PCIE_LINK_WIDTH_SHIFT); + PCIE_LINK_WIDTH_MASK) >> PCIE_LINK_WIDTH_SHIFT); } mac->ops.set_lan_id(hw); @@ -292,7 +292,7 @@ void e1000_set_lan_id_multi_port_pci(struct e1000_hw *hw) if (pci_header_type & PCI_HEADER_TYPE_MULTIFUNC) { status = E1000_READ_REG(hw, E1000_STATUS); bus->func = (status & E1000_STATUS_FUNC_MASK) - >> E1000_STATUS_FUNC_SHIFT; + >> E1000_STATUS_FUNC_SHIFT; } else { bus->func = 0; } @@ -352,7 +352,7 @@ void e1000_write_vfta_generic(struct e1000_hw *hw, u32 offset, u32 value) * @hw: pointer to the HW structure * @rar_count: receive address registers * - * Setups the receive address registers by setting the base receive address + * Setup the receive address registers by setting the base receive address * register to the devices MAC address and clearing all the other receive * address registers to 0. **/ @@ -397,25 +397,30 @@ s32 e1000_check_alt_mac_addr_generic(struct e1000_hw *hw) ret_val = hw->nvm.ops.read(hw, NVM_COMPAT, 1, &nvm_data); if (ret_val) - goto out; + return ret_val; - /* Check for LOM (vs. NIC) or one of two valid mezzanine cards */ - if (!((nvm_data & NVM_COMPAT_LOM) || - (hw->device_id == E1000_DEV_ID_82571EB_SERDES_DUAL) || - (hw->device_id == E1000_DEV_ID_82571EB_SERDES_QUAD))) - goto out; + /* not supported on older hardware or 82573 */ + if ((hw->mac.type < e1000_82571) || (hw->mac.type == e1000_82573)) + return E1000_SUCCESS; + + /* + * Alternate MAC address is handled by the option ROM for 82580 + * and newer. SW support not required. + */ + if (hw->mac.type >= e1000_82580) + return E1000_SUCCESS; ret_val = hw->nvm.ops.read(hw, NVM_ALT_MAC_ADDR_PTR, 1, - &nvm_alt_mac_addr_offset); + &nvm_alt_mac_addr_offset); if (ret_val) { DEBUGOUT("NVM Read Error\n"); - goto out; + return ret_val; } - if (nvm_alt_mac_addr_offset == 0xFFFF) { + if ((nvm_alt_mac_addr_offset == 0xFFFF) || + (nvm_alt_mac_addr_offset == 0x0000)) /* There is no Alternate MAC Address */ - goto out; - } + return E1000_SUCCESS; if (hw->bus.func == E1000_FUNC_1) nvm_alt_mac_addr_offset += E1000_ALT_MAC_ADDRESS_OFFSET_LAN1; @@ -429,7 +434,7 @@ s32 e1000_check_alt_mac_addr_generic(struct e1000_hw *hw) ret_val = hw->nvm.ops.read(hw, offset, 1, &nvm_data); if (ret_val) { DEBUGOUT("NVM Read Error\n"); - goto out; + return ret_val; } alt_mac_addr[i] = (u8)(nvm_data & 0xFF); @@ -439,7 +444,7 @@ s32 e1000_check_alt_mac_addr_generic(struct e1000_hw *hw) /* if multicast bit is set, the alternate address will not be used */ if (alt_mac_addr[0] & 0x01) { DEBUGOUT("Ignoring Alternate Mac Address with MC bit set\n"); - goto out; + return E1000_SUCCESS; } /* @@ -449,8 +454,7 @@ s32 e1000_check_alt_mac_addr_generic(struct e1000_hw *hw) */ hw->mac.ops.rar_set(hw, alt_mac_addr, 0); -out: - return ret_val; + return E1000_SUCCESS; } /** @@ -462,7 +466,7 @@ out: * Sets the receive address array register at index to the address passed * in by addr. **/ -void e1000_rar_set_generic(struct e1000_hw *hw, u8 *addr, u32 index) +static void e1000_rar_set_generic(struct e1000_hw *hw, u8 *addr, u32 index) { u32 rar_low, rar_high; @@ -472,9 +476,8 @@ void e1000_rar_set_generic(struct e1000_hw *hw, u8 *addr, u32 index) * HW expects these in little endian so we reverse the byte order * from network order (big endian) to little endian */ - rar_low = ((u32) addr[0] | - ((u32) addr[1] << 8) | - ((u32) addr[2] << 16) | ((u32) addr[3] << 24)); + rar_low = ((u32) addr[0] | ((u32) addr[1] << 8) | + ((u32) addr[2] << 16) | ((u32) addr[3] << 24)); rar_high = ((u32) addr[4] | ((u32) addr[5] << 8)); @@ -493,43 +496,6 @@ void e1000_rar_set_generic(struct e1000_hw *hw, u8 *addr, u32 index) E1000_WRITE_FLUSH(hw); } -/** - * e1000_update_mc_addr_list_generic - Update Multicast addresses - * @hw: pointer to the HW structure - * @mc_addr_list: array of multicast addresses to program - * @mc_addr_count: number of multicast addresses to program - * - * Updates entire Multicast Table Array. - * The caller must have a packed mc_addr_list of multicast addresses. - **/ -void e1000_update_mc_addr_list_generic(struct e1000_hw *hw, - u8 *mc_addr_list, u32 mc_addr_count) -{ - u32 hash_value, hash_bit, hash_reg; - int i; - - DEBUGFUNC("e1000_update_mc_addr_list_generic"); - - /* clear mta_shadow */ - memset(&hw->mac.mta_shadow, 0, sizeof(hw->mac.mta_shadow)); - - /* update mta_shadow from mc_addr_list */ - for (i = 0; (u32) i < mc_addr_count; i++) { - hash_value = e1000_hash_mc_addr_generic(hw, mc_addr_list); - - hash_reg = (hash_value >> 5) & (hw->mac.mta_reg_count - 1); - hash_bit = hash_value & 0x1F; - - hw->mac.mta_shadow[hash_reg] |= (1 << hash_bit); - mc_addr_list += (ETH_ADDR_LEN); - } - - /* replace the entire MTA table */ - for (i = hw->mac.mta_reg_count - 1; i >= 0; i--) - E1000_WRITE_REG_ARRAY(hw, E1000_MTA, i, hw->mac.mta_shadow[i]); - E1000_WRITE_FLUSH(hw); -} - /** * e1000_hash_mc_addr_generic - Generate a multicast hash value * @hw: pointer to the HW structure @@ -574,7 +540,7 @@ u32 e1000_hash_mc_addr_generic(struct e1000_hw *hw, u8 *mc_addr) * values resulting from each mc_filter_type... * [0] [1] [2] [3] [4] [5] * 01 AA 00 12 34 56 - * LSB MSB + * LSB MSB * * case 0: hash_value = ((0x34 >> 4) | (0x56 << 4)) & 0xFFF = 0x563 * case 1: hash_value = ((0x34 >> 3) | (0x56 << 5)) & 0xFFF = 0xAC6 @@ -597,11 +563,48 @@ u32 e1000_hash_mc_addr_generic(struct e1000_hw *hw, u8 *mc_addr) } hash_value = hash_mask & (((mc_addr[4] >> (8 - bit_shift)) | - (((u16) mc_addr[5]) << bit_shift))); + (((u16) mc_addr[5]) << bit_shift))); return hash_value; } +/** + * e1000_update_mc_addr_list_generic - Update Multicast addresses + * @hw: pointer to the HW structure + * @mc_addr_list: array of multicast addresses to program + * @mc_addr_count: number of multicast addresses to program + * + * Updates entire Multicast Table Array. + * The caller must have a packed mc_addr_list of multicast addresses. + **/ +void e1000_update_mc_addr_list_generic(struct e1000_hw *hw, + u8 *mc_addr_list, u32 mc_addr_count) +{ + u32 hash_value, hash_bit, hash_reg; + int i; + + DEBUGFUNC("e1000_update_mc_addr_list_generic"); + + /* clear mta_shadow */ + memset(&hw->mac.mta_shadow, 0, sizeof(hw->mac.mta_shadow)); + + /* update mta_shadow from mc_addr_list */ + for (i = 0; (u32) i < mc_addr_count; i++) { + hash_value = e1000_hash_mc_addr_generic(hw, mc_addr_list); + + hash_reg = (hash_value >> 5) & (hw->mac.mta_reg_count - 1); + hash_bit = hash_value & 0x1F; + + hw->mac.mta_shadow[hash_reg] |= (1 << hash_bit); + mc_addr_list += (ETH_ADDR_LEN); + } + + /* replace the entire MTA table */ + for (i = hw->mac.mta_reg_count - 1; i >= 0; i--) + E1000_WRITE_REG_ARRAY(hw, E1000_MTA, i, hw->mac.mta_shadow[i]); + E1000_WRITE_FLUSH(hw); +} + /** * e1000_pcix_mmrbc_workaround_generic - Fix incorrect MMRBC value * @hw: pointer to the HW structure @@ -627,9 +630,9 @@ void e1000_pcix_mmrbc_workaround_generic(struct e1000_hw *hw) e1000_read_pci_cfg(hw, PCIX_COMMAND_REGISTER, &pcix_cmd); e1000_read_pci_cfg(hw, PCIX_STATUS_REGISTER_HI, &pcix_stat_hi_word); cmd_mmrbc = (pcix_cmd & PCIX_COMMAND_MMRBC_MASK) >> - PCIX_COMMAND_MMRBC_SHIFT; + PCIX_COMMAND_MMRBC_SHIFT; stat_mmrbc = (pcix_stat_hi_word & PCIX_STATUS_HI_MMRBC_MASK) >> - PCIX_STATUS_HI_MMRBC_SHIFT; + PCIX_STATUS_HI_MMRBC_SHIFT; if (stat_mmrbc == PCIX_STATUS_HI_MMRBC_4K) stat_mmrbc = PCIX_STATUS_HI_MMRBC_2K; if (cmd_mmrbc > stat_mmrbc) { @@ -710,10 +713,8 @@ s32 e1000_check_for_copper_link_generic(struct e1000_hw *hw) * get_link_status flag is set upon receiving a Link Status * Change or Rx Sequence Error interrupt. */ - if (!mac->get_link_status) { - ret_val = E1000_SUCCESS; - goto out; - } + if (!mac->get_link_status) + return E1000_SUCCESS; /* * First we want to see if the MII Status Register reports @@ -722,10 +723,10 @@ s32 e1000_check_for_copper_link_generic(struct e1000_hw *hw) */ ret_val = e1000_phy_has_link_generic(hw, 1, 0, &link); if (ret_val) - goto out; + return ret_val; if (!link) - goto out; /* No link detected */ + return E1000_SUCCESS; /* No link detected */ mac->get_link_status = FALSE; @@ -739,10 +740,8 @@ s32 e1000_check_for_copper_link_generic(struct e1000_hw *hw) * If we are forcing speed/duplex, then we simply return since * we have already determined whether we have link or not. */ - if (!mac->autoneg) { - ret_val = -E1000_ERR_CONFIG; - goto out; - } + if (!mac->autoneg) + return -E1000_ERR_CONFIG; /* * Auto-Neg is enabled. Auto Speed Detection takes care @@ -761,7 +760,6 @@ s32 e1000_check_for_copper_link_generic(struct e1000_hw *hw) if (ret_val) DEBUGOUT("Error configuring flow control\n"); -out: return ret_val; } @@ -778,7 +776,7 @@ s32 e1000_check_for_fiber_link_generic(struct e1000_hw *hw) u32 rxcw; u32 ctrl; u32 status; - s32 ret_val = E1000_SUCCESS; + s32 ret_val; DEBUGFUNC("e1000_check_for_fiber_link_generic"); @@ -795,11 +793,11 @@ s32 e1000_check_for_fiber_link_generic(struct e1000_hw *hw) * was just plugged in. The autoneg_failed flag does this. */ /* (ctrl & E1000_CTRL_SWDPIN1) == 1 == have signal */ - if ((ctrl & E1000_CTRL_SWDPIN1) && (!(status & E1000_STATUS_LU)) && - (!(rxcw & E1000_RXCW_C))) { - if (mac->autoneg_failed == 0) { - mac->autoneg_failed = 1; - goto out; + if ((ctrl & E1000_CTRL_SWDPIN1) && !(status & E1000_STATUS_LU) && + !(rxcw & E1000_RXCW_C)) { + if (!mac->autoneg_failed) { + mac->autoneg_failed = TRUE; + return E1000_SUCCESS; } DEBUGOUT("NOT Rx'ing /C/, disable AutoNeg and force link.\n"); @@ -815,7 +813,7 @@ s32 e1000_check_for_fiber_link_generic(struct e1000_hw *hw) ret_val = e1000_config_fc_after_link_up_generic(hw); if (ret_val) { DEBUGOUT("Error configuring flow control\n"); - goto out; + return ret_val; } } else if ((ctrl & E1000_CTRL_SLU) && (rxcw & E1000_RXCW_C)) { /* @@ -831,8 +829,7 @@ s32 e1000_check_for_fiber_link_generic(struct e1000_hw *hw) mac->serdes_has_link = TRUE; } -out: - return ret_val; + return E1000_SUCCESS; } /** @@ -848,7 +845,7 @@ s32 e1000_check_for_serdes_link_generic(struct e1000_hw *hw) u32 rxcw; u32 ctrl; u32 status; - s32 ret_val = E1000_SUCCESS; + s32 ret_val; DEBUGFUNC("e1000_check_for_serdes_link_generic"); @@ -864,10 +861,10 @@ s32 e1000_check_for_serdes_link_generic(struct e1000_hw *hw) * time to complete. */ /* (ctrl & E1000_CTRL_SWDPIN1) == 1 == have signal */ - if ((!(status & E1000_STATUS_LU)) && (!(rxcw & E1000_RXCW_C))) { - if (mac->autoneg_failed == 0) { - mac->autoneg_failed = 1; - goto out; + if (!(status & E1000_STATUS_LU) && !(rxcw & E1000_RXCW_C)) { + if (!mac->autoneg_failed) { + mac->autoneg_failed = TRUE; + return E1000_SUCCESS; } DEBUGOUT("NOT Rx'ing /C/, disable AutoNeg and force link.\n"); @@ -883,7 +880,7 @@ s32 e1000_check_for_serdes_link_generic(struct e1000_hw *hw) ret_val = e1000_config_fc_after_link_up_generic(hw); if (ret_val) { DEBUGOUT("Error configuring flow control\n"); - goto out; + return ret_val; } } else if ((ctrl & E1000_CTRL_SLU) && (rxcw & E1000_RXCW_C)) { /* @@ -926,12 +923,10 @@ s32 e1000_check_for_serdes_link_generic(struct e1000_hw *hw) if (rxcw & E1000_RXCW_SYNCH) { if (!(rxcw & E1000_RXCW_IV)) { mac->serdes_has_link = TRUE; - DEBUGOUT("SERDES: Link up - autoneg " - "completed sucessfully.\n"); + DEBUGOUT("SERDES: Link up - autoneg completed successfully.\n"); } else { mac->serdes_has_link = FALSE; - DEBUGOUT("SERDES: Link down - invalid" - "codewords detected in autoneg.\n"); + DEBUGOUT("SERDES: Link down - invalid codewords detected in autoneg.\n"); } } else { mac->serdes_has_link = FALSE; @@ -943,8 +938,48 @@ s32 e1000_check_for_serdes_link_generic(struct e1000_hw *hw) } } -out: - return ret_val; + return E1000_SUCCESS; +} + +/** + * e1000_set_default_fc_generic - Set flow control default values + * @hw: pointer to the HW structure + * + * Read the EEPROM for the default values for flow control and store the + * values. + **/ +s32 e1000_set_default_fc_generic(struct e1000_hw *hw) +{ + s32 ret_val; + u16 nvm_data; + + DEBUGFUNC("e1000_set_default_fc_generic"); + + /* + * Read and store word 0x0F of the EEPROM. This word contains bits + * that determine the hardware's default PAUSE (flow control) mode, + * a bit that determines whether the HW defaults to enabling or + * disabling auto-negotiation, and the direction of the + * SW defined pins. If there is no SW over-ride of the flow + * control setting, then the variable hw->fc will + * be initialized based on a value in the EEPROM. + */ + ret_val = hw->nvm.ops.read(hw, NVM_INIT_CONTROL2_REG, 1, &nvm_data); + + if (ret_val) { + DEBUGOUT("NVM Read Error\n"); + return ret_val; + } + + if (!(nvm_data & NVM_WORD0F_PAUSE_MASK)) + hw->fc.requested_mode = e1000_fc_none; + else if ((nvm_data & NVM_WORD0F_PAUSE_MASK) == + NVM_WORD0F_ASM_DIR) + hw->fc.requested_mode = e1000_fc_tx_pause; + else + hw->fc.requested_mode = e1000_fc_full; + + return E1000_SUCCESS; } /** @@ -959,7 +994,7 @@ out: **/ s32 e1000_setup_link_generic(struct e1000_hw *hw) { - s32 ret_val = E1000_SUCCESS; + s32 ret_val; DEBUGFUNC("e1000_setup_link_generic"); @@ -967,8 +1002,8 @@ s32 e1000_setup_link_generic(struct e1000_hw *hw) * In the case of the phy reset being blocked, we already have a link. * We do not need to set it up again. */ - if (e1000_check_reset_block(hw)) - goto out; + if (hw->phy.ops.check_reset_block && hw->phy.ops.check_reset_block(hw)) + return E1000_SUCCESS; /* * If requested flow control is set to default, set flow control @@ -977,7 +1012,7 @@ s32 e1000_setup_link_generic(struct e1000_hw *hw) if (hw->fc.requested_mode == e1000_fc_default) { ret_val = e1000_set_default_fc_generic(hw); if (ret_val) - goto out; + return ret_val; } /* @@ -992,7 +1027,7 @@ s32 e1000_setup_link_generic(struct e1000_hw *hw) /* Call the necessary media_type subroutine to configure the link. */ ret_val = hw->mac.ops.setup_physical_interface(hw); if (ret_val) - goto out; + return ret_val; /* * Initialize the flow control address, type, and PAUSE timer @@ -1007,139 +1042,7 @@ s32 e1000_setup_link_generic(struct e1000_hw *hw) E1000_WRITE_REG(hw, E1000_FCTTV, hw->fc.pause_time); - ret_val = e1000_set_fc_watermarks_generic(hw); - -out: - return ret_val; -} - -/** - * e1000_setup_fiber_serdes_link_generic - Setup link for fiber/serdes - * @hw: pointer to the HW structure - * - * Configures collision distance and flow control for fiber and serdes - * links. Upon successful setup, poll for link. - **/ -s32 e1000_setup_fiber_serdes_link_generic(struct e1000_hw *hw) -{ - struct e1000_mac_info *mac = &hw->mac; - u32 ctrl; - s32 ret_val = E1000_SUCCESS; - - DEBUGFUNC("e1000_setup_fiber_serdes_link_generic"); - - ctrl = E1000_READ_REG(hw, E1000_CTRL); - - /* Take the link out of reset */ - ctrl &= ~E1000_CTRL_LRST; - - mac->ops.config_collision_dist(hw); - - ret_val = e1000_commit_fc_settings_generic(hw); - if (ret_val) - goto out; - - /* - * Since auto-negotiation is enabled, take the link out of reset (the - * link will be in reset, because we previously reset the chip). This - * will restart auto-negotiation. If auto-negotiation is successful - * then the link-up status bit will be set and the flow control enable - * bits (RFCE and TFCE) will be set according to their negotiated value. - */ - DEBUGOUT("Auto-negotiation enabled\n"); - - E1000_WRITE_REG(hw, E1000_CTRL, ctrl); - E1000_WRITE_FLUSH(hw); - msec_delay(1); - - /* - * For these adapters, the SW definable pin 1 is set when the optics - * detect a signal. If we have a signal, then poll for a "Link-Up" - * indication. - */ - if (hw->phy.media_type == e1000_media_type_internal_serdes || - (E1000_READ_REG(hw, E1000_CTRL) & E1000_CTRL_SWDPIN1)) { - ret_val = e1000_poll_fiber_serdes_link_generic(hw); - } else { - DEBUGOUT("No signal detected\n"); - } - -out: - return ret_val; -} - -/** - * e1000_config_collision_dist_generic - Configure collision distance - * @hw: pointer to the HW structure - * - * Configures the collision distance to the default value and is used - * during link setup. - **/ -void e1000_config_collision_dist_generic(struct e1000_hw *hw) -{ - u32 tctl; - - DEBUGFUNC("e1000_config_collision_dist_generic"); - - tctl = E1000_READ_REG(hw, E1000_TCTL); - - tctl &= ~E1000_TCTL_COLD; - tctl |= E1000_COLLISION_DISTANCE << E1000_COLD_SHIFT; - - E1000_WRITE_REG(hw, E1000_TCTL, tctl); - E1000_WRITE_FLUSH(hw); -} - -/** - * e1000_poll_fiber_serdes_link_generic - Poll for link up - * @hw: pointer to the HW structure - * - * Polls for link up by reading the status register, if link fails to come - * up with auto-negotiation, then the link is forced if a signal is detected. - **/ -s32 e1000_poll_fiber_serdes_link_generic(struct e1000_hw *hw) -{ - struct e1000_mac_info *mac = &hw->mac; - u32 i, status; - s32 ret_val = E1000_SUCCESS; - - DEBUGFUNC("e1000_poll_fiber_serdes_link_generic"); - - /* - * If we have a signal (the cable is plugged in, or assumed TRUE for - * serdes media) then poll for a "Link-Up" indication in the Device - * Status Register. Time-out if a link isn't seen in 500 milliseconds - * seconds (Auto-negotiation should complete in less than 500 - * milliseconds even if the other end is doing it in SW). - */ - for (i = 0; i < FIBER_LINK_UP_LIMIT; i++) { - msec_delay(10); - status = E1000_READ_REG(hw, E1000_STATUS); - if (status & E1000_STATUS_LU) - break; - } - if (i == FIBER_LINK_UP_LIMIT) { - DEBUGOUT("Never got a valid link from auto-neg!!!\n"); - mac->autoneg_failed = 1; - /* - * AutoNeg failed to achieve a link, so we'll call - * mac->check_for_link. This routine will force the - * link up if we detect a signal. This will allow us to - * communicate with non-autonegotiating link partners. - */ - ret_val = mac->ops.check_for_link(hw); - if (ret_val) { - DEBUGOUT("Error while checking for link\n"); - goto out; - } - mac->autoneg_failed = 0; - } else { - mac->autoneg_failed = 0; - DEBUGOUT("Valid Link Found\n"); - } - -out: - return ret_val; + return e1000_set_fc_watermarks_generic(hw); } /** @@ -1153,7 +1056,6 @@ s32 e1000_commit_fc_settings_generic(struct e1000_hw *hw) { struct e1000_mac_info *mac = &hw->mac; u32 txcw; - s32 ret_val = E1000_SUCCESS; DEBUGFUNC("e1000_commit_fc_settings_generic"); @@ -1206,18 +1108,142 @@ s32 e1000_commit_fc_settings_generic(struct e1000_hw *hw) break; default: DEBUGOUT("Flow control param set incorrectly\n"); - ret_val = -E1000_ERR_CONFIG; - goto out; + return -E1000_ERR_CONFIG; break; } E1000_WRITE_REG(hw, E1000_TXCW, txcw); mac->txcw = txcw; -out: + return E1000_SUCCESS; +} + +/** + * e1000_poll_fiber_serdes_link_generic - Poll for link up + * @hw: pointer to the HW structure + * + * Polls for link up by reading the status register, if link fails to come + * up with auto-negotiation, then the link is forced if a signal is detected. + **/ +s32 e1000_poll_fiber_serdes_link_generic(struct e1000_hw *hw) +{ + struct e1000_mac_info *mac = &hw->mac; + u32 i, status; + s32 ret_val; + + DEBUGFUNC("e1000_poll_fiber_serdes_link_generic"); + + /* + * If we have a signal (the cable is plugged in, or assumed TRUE for + * serdes media) then poll for a "Link-Up" indication in the Device + * Status Register. Time-out if a link isn't seen in 500 milliseconds + * seconds (Auto-negotiation should complete in less than 500 + * milliseconds even if the other end is doing it in SW). + */ + for (i = 0; i < FIBER_LINK_UP_LIMIT; i++) { + msec_delay(10); + status = E1000_READ_REG(hw, E1000_STATUS); + if (status & E1000_STATUS_LU) + break; + } + if (i == FIBER_LINK_UP_LIMIT) { + DEBUGOUT("Never got a valid link from auto-neg!!!\n"); + mac->autoneg_failed = TRUE; + /* + * AutoNeg failed to achieve a link, so we'll call + * mac->check_for_link. This routine will force the + * link up if we detect a signal. This will allow us to + * communicate with non-autonegotiating link partners. + */ + ret_val = mac->ops.check_for_link(hw); + if (ret_val) { + DEBUGOUT("Error while checking for link\n"); + return ret_val; + } + mac->autoneg_failed = FALSE; + } else { + mac->autoneg_failed = FALSE; + DEBUGOUT("Valid Link Found\n"); + } + + return E1000_SUCCESS; +} + +/** + * e1000_setup_fiber_serdes_link_generic - Setup link for fiber/serdes + * @hw: pointer to the HW structure + * + * Configures collision distance and flow control for fiber and serdes + * links. Upon successful setup, poll for link. + **/ +s32 e1000_setup_fiber_serdes_link_generic(struct e1000_hw *hw) +{ + u32 ctrl; + s32 ret_val; + + DEBUGFUNC("e1000_setup_fiber_serdes_link_generic"); + + ctrl = E1000_READ_REG(hw, E1000_CTRL); + + /* Take the link out of reset */ + ctrl &= ~E1000_CTRL_LRST; + + hw->mac.ops.config_collision_dist(hw); + + ret_val = e1000_commit_fc_settings_generic(hw); + if (ret_val) + return ret_val; + + /* + * Since auto-negotiation is enabled, take the link out of reset (the + * link will be in reset, because we previously reset the chip). This + * will restart auto-negotiation. If auto-negotiation is successful + * then the link-up status bit will be set and the flow control enable + * bits (RFCE and TFCE) will be set according to their negotiated value. + */ + DEBUGOUT("Auto-negotiation enabled\n"); + + E1000_WRITE_REG(hw, E1000_CTRL, ctrl); + E1000_WRITE_FLUSH(hw); + msec_delay(1); + + /* + * For these adapters, the SW definable pin 1 is set when the optics + * detect a signal. If we have a signal, then poll for a "Link-Up" + * indication. + */ + if (hw->phy.media_type == e1000_media_type_internal_serdes || + (E1000_READ_REG(hw, E1000_CTRL) & E1000_CTRL_SWDPIN1)) { + ret_val = e1000_poll_fiber_serdes_link_generic(hw); + } else { + DEBUGOUT("No signal detected\n"); + } + return ret_val; } +/** + * e1000_config_collision_dist_generic - Configure collision distance + * @hw: pointer to the HW structure + * + * Configures the collision distance to the default value and is used + * during link setup. + **/ +static void e1000_config_collision_dist_generic(struct e1000_hw *hw) +{ + u32 tctl; + + DEBUGFUNC("e1000_config_collision_dist_generic"); + + tctl = E1000_READ_REG(hw, E1000_TCTL); + + tctl &= ~E1000_TCTL_COLD; + tctl |= E1000_COLLISION_DISTANCE << E1000_COLD_SHIFT; + + E1000_WRITE_REG(hw, E1000_TCTL, tctl); + E1000_WRITE_FLUSH(hw); +} + /** * e1000_set_fc_watermarks_generic - Set flow control high/low watermarks * @hw: pointer to the HW structure @@ -1257,48 +1283,6 @@ s32 e1000_set_fc_watermarks_generic(struct e1000_hw *hw) return E1000_SUCCESS; } -/** - * e1000_set_default_fc_generic - Set flow control default values - * @hw: pointer to the HW structure - * - * Read the EEPROM for the default values for flow control and store the - * values. - **/ -s32 e1000_set_default_fc_generic(struct e1000_hw *hw) -{ - s32 ret_val = E1000_SUCCESS; - u16 nvm_data; - - DEBUGFUNC("e1000_set_default_fc_generic"); - - /* - * Read and store word 0x0F of the EEPROM. This word contains bits - * that determine the hardware's default PAUSE (flow control) mode, - * a bit that determines whether the HW defaults to enabling or - * disabling auto-negotiation, and the direction of the - * SW defined pins. If there is no SW over-ride of the flow - * control setting, then the variable hw->fc will - * be initialized based on a value in the EEPROM. - */ - ret_val = hw->nvm.ops.read(hw, NVM_INIT_CONTROL2_REG, 1, &nvm_data); - - if (ret_val) { - DEBUGOUT("NVM Read Error\n"); - goto out; - } - - if ((nvm_data & NVM_WORD0F_PAUSE_MASK) == 0) - hw->fc.requested_mode = e1000_fc_none; - else if ((nvm_data & NVM_WORD0F_PAUSE_MASK) == - NVM_WORD0F_ASM_DIR) - hw->fc.requested_mode = e1000_fc_tx_pause; - else - hw->fc.requested_mode = e1000_fc_full; - -out: - return ret_val; -} - /** * e1000_force_mac_fc_generic - Force the MAC's flow control settings * @hw: pointer to the HW structure @@ -1312,7 +1296,6 @@ out: s32 e1000_force_mac_fc_generic(struct e1000_hw *hw) { u32 ctrl; - s32 ret_val = E1000_SUCCESS; DEBUGFUNC("e1000_force_mac_fc_generic"); @@ -1355,14 +1338,12 @@ s32 e1000_force_mac_fc_generic(struct e1000_hw *hw) break; default: DEBUGOUT("Flow control param set incorrectly\n"); - ret_val = -E1000_ERR_CONFIG; - goto out; + return -E1000_ERR_CONFIG; } E1000_WRITE_REG(hw, E1000_CTRL, ctrl); -out: - return ret_val; + return E1000_SUCCESS; } /** @@ -1400,7 +1381,7 @@ s32 e1000_config_fc_after_link_up_generic(struct e1000_hw *hw) if (ret_val) { DEBUGOUT("Error forcing flow control settings\n"); - goto out; + return ret_val; } /* @@ -1417,15 +1398,14 @@ s32 e1000_config_fc_after_link_up_generic(struct e1000_hw *hw) */ ret_val = hw->phy.ops.read_reg(hw, PHY_STATUS, &mii_status_reg); if (ret_val) - goto out; + return ret_val; ret_val = hw->phy.ops.read_reg(hw, PHY_STATUS, &mii_status_reg); if (ret_val) - goto out; + return ret_val; if (!(mii_status_reg & MII_SR_AUTONEG_COMPLETE)) { - DEBUGOUT("Copper PHY and Auto Neg " - "has not completed.\n"); - goto out; + DEBUGOUT("Copper PHY and Auto Neg has not completed.\n"); + return ret_val; } /* @@ -1436,13 +1416,13 @@ s32 e1000_config_fc_after_link_up_generic(struct e1000_hw *hw) * flow control was negotiated. */ ret_val = hw->phy.ops.read_reg(hw, PHY_AUTONEG_ADV, - &mii_nway_adv_reg); + &mii_nway_adv_reg); if (ret_val) - goto out; + return ret_val; ret_val = hw->phy.ops.read_reg(hw, PHY_LP_ABILITY, - &mii_nway_lp_ability_reg); + &mii_nway_lp_ability_reg); if (ret_val) - goto out; + return ret_val; /* * Two bits in the Auto Negotiation Advertisement Register @@ -1485,15 +1465,14 @@ s32 e1000_config_fc_after_link_up_generic(struct e1000_hw *hw) * of pause frames. In this case, we had to advertise * FULL flow control because we could not advertise Rx * ONLY. Hence, we must now check to see if we need to - * turn OFF the TRANSMISSION of PAUSE frames. + * turn OFF the TRANSMISSION of PAUSE frames. */ if (hw->fc.requested_mode == e1000_fc_full) { hw->fc.current_mode = e1000_fc_full; - DEBUGOUT("Flow Control = FULL.\r\n"); + DEBUGOUT("Flow Control = FULL.\n"); } else { hw->fc.current_mode = e1000_fc_rx_pause; - DEBUGOUT("Flow Control = " - "Rx PAUSE frames only.\r\n"); + DEBUGOUT("Flow Control = Rx PAUSE frames only.\n"); } } /* @@ -1505,11 +1484,11 @@ s32 e1000_config_fc_after_link_up_generic(struct e1000_hw *hw) * 0 | 1 | 1 | 1 | e1000_fc_tx_pause */ else if (!(mii_nway_adv_reg & NWAY_AR_PAUSE) && - (mii_nway_adv_reg & NWAY_AR_ASM_DIR) && - (mii_nway_lp_ability_reg & NWAY_LPAR_PAUSE) && - (mii_nway_lp_ability_reg & NWAY_LPAR_ASM_DIR)) { + (mii_nway_adv_reg & NWAY_AR_ASM_DIR) && + (mii_nway_lp_ability_reg & NWAY_LPAR_PAUSE) && + (mii_nway_lp_ability_reg & NWAY_LPAR_ASM_DIR)) { hw->fc.current_mode = e1000_fc_tx_pause; - DEBUGOUT("Flow Control = Tx PAUSE frames only.\r\n"); + DEBUGOUT("Flow Control = Tx PAUSE frames only.\n"); } /* * For transmitting PAUSE frames ONLY. @@ -1520,18 +1499,18 @@ s32 e1000_config_fc_after_link_up_generic(struct e1000_hw *hw) * 1 | 1 | 0 | 1 | e1000_fc_rx_pause */ else if ((mii_nway_adv_reg & NWAY_AR_PAUSE) && - (mii_nway_adv_reg & NWAY_AR_ASM_DIR) && - !(mii_nway_lp_ability_reg & NWAY_LPAR_PAUSE) && - (mii_nway_lp_ability_reg & NWAY_LPAR_ASM_DIR)) { + (mii_nway_adv_reg & NWAY_AR_ASM_DIR) && + !(mii_nway_lp_ability_reg & NWAY_LPAR_PAUSE) && + (mii_nway_lp_ability_reg & NWAY_LPAR_ASM_DIR)) { hw->fc.current_mode = e1000_fc_rx_pause; - DEBUGOUT("Flow Control = Rx PAUSE frames only.\r\n"); + DEBUGOUT("Flow Control = Rx PAUSE frames only.\n"); } else { /* * Per the IEEE spec, at this point flow control * should be disabled. */ hw->fc.current_mode = e1000_fc_none; - DEBUGOUT("Flow Control = NONE.\r\n"); + DEBUGOUT("Flow Control = NONE.\n"); } /* @@ -1542,7 +1521,7 @@ s32 e1000_config_fc_after_link_up_generic(struct e1000_hw *hw) ret_val = mac->ops.get_link_up_info(hw, &speed, &duplex); if (ret_val) { DEBUGOUT("Error getting link speed and duplex\n"); - goto out; + return ret_val; } if (duplex == HALF_DUPLEX) @@ -1555,12 +1534,11 @@ s32 e1000_config_fc_after_link_up_generic(struct e1000_hw *hw) ret_val = e1000_force_mac_fc_generic(hw); if (ret_val) { DEBUGOUT("Error forcing flow control settings\n"); - goto out; + return ret_val; } } -out: - return ret_val; + return E1000_SUCCESS; } /** @@ -1573,7 +1551,7 @@ out: * speed and duplex for copper connections. **/ s32 e1000_get_speed_and_duplex_copper_generic(struct e1000_hw *hw, u16 *speed, - u16 *duplex) + u16 *duplex) { u32 status; @@ -1612,7 +1590,7 @@ s32 e1000_get_speed_and_duplex_copper_generic(struct e1000_hw *hw, u16 *speed, * for fiber/serdes links. **/ s32 e1000_get_speed_and_duplex_fiber_serdes_generic(struct e1000_hw *hw, - u16 *speed, u16 *duplex) + u16 *speed, u16 *duplex) { DEBUGFUNC("e1000_get_speed_and_duplex_fiber_serdes_generic"); @@ -1631,7 +1609,6 @@ s32 e1000_get_speed_and_duplex_fiber_serdes_generic(struct e1000_hw *hw, s32 e1000_get_hw_semaphore_generic(struct e1000_hw *hw) { u32 swsm; - s32 ret_val = E1000_SUCCESS; s32 timeout = hw->nvm.word_size + 1; s32 i = 0; @@ -1649,8 +1626,7 @@ s32 e1000_get_hw_semaphore_generic(struct e1000_hw *hw) if (i == timeout) { DEBUGOUT("Driver can't access device - SMBI bit is set.\n"); - ret_val = -E1000_ERR_NVM; - goto out; + return -E1000_ERR_NVM; } /* Get the FW semaphore. */ @@ -1669,12 +1645,10 @@ s32 e1000_get_hw_semaphore_generic(struct e1000_hw *hw) /* Release semaphores */ e1000_put_hw_semaphore_generic(hw); DEBUGOUT("Driver can't access the NVM\n"); - ret_val = -E1000_ERR_NVM; - goto out; + return -E1000_ERR_NVM; } -out: - return ret_val; + return E1000_SUCCESS; } /** @@ -1705,7 +1679,6 @@ void e1000_put_hw_semaphore_generic(struct e1000_hw *hw) s32 e1000_get_auto_rd_done_generic(struct e1000_hw *hw) { s32 i = 0; - s32 ret_val = E1000_SUCCESS; DEBUGFUNC("e1000_get_auto_rd_done_generic"); @@ -1718,12 +1691,10 @@ s32 e1000_get_auto_rd_done_generic(struct e1000_hw *hw) if (i == AUTO_READ_DONE_TIMEOUT) { DEBUGOUT("Auto read by HW from NVM has not completed.\n"); - ret_val = -E1000_ERR_RESET; - goto out; + return -E1000_ERR_RESET; } -out: - return ret_val; + return E1000_SUCCESS; } /** @@ -1743,14 +1714,13 @@ s32 e1000_valid_led_default_generic(struct e1000_hw *hw, u16 *data) ret_val = hw->nvm.ops.read(hw, NVM_ID_LED_SETTINGS, 1, data); if (ret_val) { DEBUGOUT("NVM Read Error\n"); - goto out; + return ret_val; } if (*data == ID_LED_RESERVED_0000 || *data == ID_LED_RESERVED_FFFF) *data = ID_LED_DEFAULT; -out: - return ret_val; + return E1000_SUCCESS; } /** @@ -1772,7 +1742,7 @@ s32 e1000_id_led_init_generic(struct e1000_hw *hw) ret_val = hw->nvm.ops.valid_led_default(hw, &data); if (ret_val) - goto out; + return ret_val; mac->ledctl_default = E1000_READ_REG(hw, E1000_LEDCTL); mac->ledctl_mode1 = mac->ledctl_default; @@ -1816,8 +1786,7 @@ s32 e1000_id_led_init_generic(struct e1000_hw *hw) } } -out: - return ret_val; + return E1000_SUCCESS; } /** @@ -1830,31 +1799,26 @@ out: s32 e1000_setup_led_generic(struct e1000_hw *hw) { u32 ledctl; - s32 ret_val = E1000_SUCCESS; DEBUGFUNC("e1000_setup_led_generic"); - if (hw->mac.ops.setup_led != e1000_setup_led_generic) { - ret_val = -E1000_ERR_CONFIG; - goto out; - } + if (hw->mac.ops.setup_led != e1000_setup_led_generic) + return -E1000_ERR_CONFIG; if (hw->phy.media_type == e1000_media_type_fiber) { ledctl = E1000_READ_REG(hw, E1000_LEDCTL); hw->mac.ledctl_default = ledctl; /* Turn off LED0 */ - ledctl &= ~(E1000_LEDCTL_LED0_IVRT | - E1000_LEDCTL_LED0_BLINK | - E1000_LEDCTL_LED0_MODE_MASK); + ledctl &= ~(E1000_LEDCTL_LED0_IVRT | E1000_LEDCTL_LED0_BLINK | + E1000_LEDCTL_LED0_MODE_MASK); ledctl |= (E1000_LEDCTL_MODE_LED_OFF << - E1000_LEDCTL_LED0_MODE_SHIFT); + E1000_LEDCTL_LED0_MODE_SHIFT); E1000_WRITE_REG(hw, E1000_LEDCTL, ledctl); } else if (hw->phy.media_type == e1000_media_type_copper) { E1000_WRITE_REG(hw, E1000_LEDCTL, hw->mac.ledctl_mode1); } -out: - return ret_val; + return E1000_SUCCESS; } /** @@ -1899,7 +1863,7 @@ s32 e1000_blink_led_generic(struct e1000_hw *hw) if (((hw->mac.ledctl_mode2 >> (i * 8)) & 0xFF) == E1000_LEDCTL_MODE_LED_ON) ledctl_blink |= (E1000_LEDCTL_LED0_BLINK << - (i * 8)); + (i * 8)); } E1000_WRITE_REG(hw, E1000_LEDCTL, ledctl_blink); @@ -1979,7 +1943,7 @@ void e1000_set_pcie_no_snoop_generic(struct e1000_hw *hw, u32 no_snoop) DEBUGFUNC("e1000_set_pcie_no_snoop_generic"); if (hw->bus.type != e1000_bus_type_pci_express) - goto out; + return; if (no_snoop) { gcr = E1000_READ_REG(hw, E1000_GCR); @@ -1987,8 +1951,6 @@ void e1000_set_pcie_no_snoop_generic(struct e1000_hw *hw, u32 no_snoop) gcr |= no_snoop; E1000_WRITE_REG(hw, E1000_GCR, gcr); } -out: - return; } /** @@ -2006,12 +1968,11 @@ s32 e1000_disable_pcie_master_generic(struct e1000_hw *hw) { u32 ctrl; s32 timeout = MASTER_DISABLE_TIMEOUT; - s32 ret_val = E1000_SUCCESS; DEBUGFUNC("e1000_disable_pcie_master_generic"); if (hw->bus.type != e1000_bus_type_pci_express) - goto out; + return E1000_SUCCESS; ctrl = E1000_READ_REG(hw, E1000_CTRL); ctrl |= E1000_CTRL_GIO_MASTER_DISABLE; @@ -2027,11 +1988,10 @@ s32 e1000_disable_pcie_master_generic(struct e1000_hw *hw) if (!timeout) { DEBUGOUT("Master requests are pending.\n"); - ret_val = -E1000_ERR_MASTER_REQUESTS_PENDING; + return -E1000_ERR_MASTER_REQUESTS_PENDING; } -out: - return ret_val; + return E1000_SUCCESS; } /** @@ -2048,7 +2008,7 @@ void e1000_reset_adaptive_generic(struct e1000_hw *hw) if (!mac->adaptive_ifs) { DEBUGOUT("Not in Adaptive IFS mode!\n"); - goto out; + return; } mac->current_ifs_val = 0; @@ -2059,8 +2019,6 @@ void e1000_reset_adaptive_generic(struct e1000_hw *hw) mac->in_ifs_mode = FALSE; E1000_WRITE_REG(hw, E1000_AIT, 0); -out: - return; } /** @@ -2078,7 +2036,7 @@ void e1000_update_adaptive_generic(struct e1000_hw *hw) if (!mac->adaptive_ifs) { DEBUGOUT("Not in Adaptive IFS mode!\n"); - goto out; + return; } if ((mac->collision_delta * mac->ifs_ratio) > mac->tx_packet_delta) { @@ -2090,7 +2048,8 @@ void e1000_update_adaptive_generic(struct e1000_hw *hw) else mac->current_ifs_val += mac->ifs_step_size; - E1000_WRITE_REG(hw, E1000_AIT, mac->current_ifs_val); + E1000_WRITE_REG(hw, E1000_AIT, + mac->current_ifs_val); } } } else { @@ -2101,8 +2060,6 @@ void e1000_update_adaptive_generic(struct e1000_hw *hw) E1000_WRITE_REG(hw, E1000_AIT, 0); } } -out: - return; } /** @@ -2114,19 +2071,15 @@ out: **/ static s32 e1000_validate_mdi_setting_generic(struct e1000_hw *hw) { - s32 ret_val = E1000_SUCCESS; - DEBUGFUNC("e1000_validate_mdi_setting_generic"); if (!hw->mac.autoneg && (hw->phy.mdix == 0 || hw->phy.mdix == 3)) { DEBUGOUT("Invalid MDI setting detected\n"); hw->phy.mdix = 1; - ret_val = -E1000_ERR_CONFIG; - goto out; + return -E1000_ERR_CONFIG; } -out: - return ret_val; + return E1000_SUCCESS; } /** @@ -2141,10 +2094,9 @@ out: * completion. **/ s32 e1000_write_8bit_ctrl_reg_generic(struct e1000_hw *hw, u32 reg, - u32 offset, u8 data) + u32 offset, u8 data) { u32 i, regvalue = 0; - s32 ret_val = E1000_SUCCESS; DEBUGFUNC("e1000_write_8bit_ctrl_reg_generic"); @@ -2161,10 +2113,8 @@ s32 e1000_write_8bit_ctrl_reg_generic(struct e1000_hw *hw, u32 reg, } if (!(regvalue & E1000_GEN_CTL_READY)) { DEBUGOUT1("Reg %08x did not indicate ready\n", reg); - ret_val = -E1000_ERR_PHY; - goto out; + return -E1000_ERR_PHY; } -out: - return ret_val; + return E1000_SUCCESS; } diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_mac.h b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_mac.h index aab796b768..c18a7ec129 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_mac.h +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_mac.h @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2010, Intel Corporation + Copyright (c) 2001-2012, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -30,7 +30,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: src/sys/dev/e1000/e1000_mac.h,v 1.3.2.2.4.1 2010/12/21 17:09:25 kensmith Exp $*/ +/*$FreeBSD$*/ #ifndef _E1000_MAC_H_ #define _E1000_MAC_H_ @@ -64,31 +64,29 @@ void e1000_set_lan_id_single_port(struct e1000_hw *hw); void e1000_set_lan_id_multi_port_pci(struct e1000_hw *hw); s32 e1000_get_hw_semaphore_generic(struct e1000_hw *hw); s32 e1000_get_speed_and_duplex_copper_generic(struct e1000_hw *hw, u16 *speed, - u16 *duplex); + u16 *duplex); s32 e1000_get_speed_and_duplex_fiber_serdes_generic(struct e1000_hw *hw, - u16 *speed, u16 *duplex); + u16 *speed, u16 *duplex); s32 e1000_id_led_init_generic(struct e1000_hw *hw); s32 e1000_led_on_generic(struct e1000_hw *hw); s32 e1000_led_off_generic(struct e1000_hw *hw); void e1000_update_mc_addr_list_generic(struct e1000_hw *hw, - u8 *mc_addr_list, u32 mc_addr_count); + u8 *mc_addr_list, u32 mc_addr_count); s32 e1000_set_default_fc_generic(struct e1000_hw *hw); s32 e1000_set_fc_watermarks_generic(struct e1000_hw *hw); s32 e1000_setup_fiber_serdes_link_generic(struct e1000_hw *hw); s32 e1000_setup_led_generic(struct e1000_hw *hw); s32 e1000_setup_link_generic(struct e1000_hw *hw); s32 e1000_write_8bit_ctrl_reg_generic(struct e1000_hw *hw, u32 reg, - u32 offset, u8 data); + u32 offset, u8 data); u32 e1000_hash_mc_addr_generic(struct e1000_hw *hw, u8 *mc_addr); void e1000_clear_hw_cntrs_base_generic(struct e1000_hw *hw); void e1000_clear_vfta_generic(struct e1000_hw *hw); -void e1000_config_collision_dist_generic(struct e1000_hw *hw); void e1000_init_rx_addrs_generic(struct e1000_hw *hw, u16 rar_count); void e1000_pcix_mmrbc_workaround_generic(struct e1000_hw *hw); void e1000_put_hw_semaphore_generic(struct e1000_hw *hw); -void e1000_rar_set_generic(struct e1000_hw *hw, u8 *addr, u32 index); s32 e1000_check_alt_mac_addr_generic(struct e1000_hw *hw); void e1000_reset_adaptive_generic(struct e1000_hw *hw); void e1000_set_pcie_no_snoop_generic(struct e1000_hw *hw, u32 no_snoop); diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_manage.c b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_manage.c index b8180b3795..f11b18d20e 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_manage.c +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_manage.c @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2010, Intel Corporation + Copyright (c) 2001-2012, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -30,7 +30,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: src/sys/dev/e1000/e1000_manage.c,v 1.2.2.2.4.1 2010/12/21 17:09:25 kensmith Exp $*/ +/*$FreeBSD$*/ #include "e1000_api.h" @@ -71,23 +71,20 @@ u8 e1000_calculate_checksum(u8 *buffer, u32 length) s32 e1000_mng_enable_host_if_generic(struct e1000_hw *hw) { u32 hicr; - s32 ret_val = E1000_SUCCESS; u8 i; DEBUGFUNC("e1000_mng_enable_host_if_generic"); - if (!(hw->mac.arc_subsystem_valid)) { + if (!hw->mac.arc_subsystem_valid) { DEBUGOUT("ARC subsystem not valid.\n"); - ret_val = -E1000_ERR_HOST_INTERFACE_COMMAND; - goto out; + return -E1000_ERR_HOST_INTERFACE_COMMAND; } /* Check that the host interface is enabled. */ hicr = E1000_READ_REG(hw, E1000_HICR); - if ((hicr & E1000_HICR_EN) == 0) { + if (!(hicr & E1000_HICR_EN)) { DEBUGOUT("E1000_HOST_EN bit disabled.\n"); - ret_val = -E1000_ERR_HOST_INTERFACE_COMMAND; - goto out; + return -E1000_ERR_HOST_INTERFACE_COMMAND; } /* check the previous command is completed */ for (i = 0; i < E1000_MNG_DHCP_COMMAND_TIMEOUT; i++) { @@ -99,12 +96,10 @@ s32 e1000_mng_enable_host_if_generic(struct e1000_hw *hw) if (i == E1000_MNG_DHCP_COMMAND_TIMEOUT) { DEBUGOUT("Previous command timeout failed .\n"); - ret_val = -E1000_ERR_HOST_INTERFACE_COMMAND; - goto out; + return -E1000_ERR_HOST_INTERFACE_COMMAND; } -out: - return ret_val; + return E1000_SUCCESS; } /** @@ -122,7 +117,7 @@ bool e1000_check_mng_mode_generic(struct e1000_hw *hw) return (fwsm & E1000_FWSM_MODE_MASK) == - (E1000_MNG_IAMT_MODE << E1000_FWSM_MODE_SHIFT); + (E1000_MNG_IAMT_MODE << E1000_FWSM_MODE_SHIFT); } /** @@ -147,7 +142,7 @@ bool e1000_enable_tx_pkt_filtering_generic(struct e1000_hw *hw) /* No manageability, no filtering */ if (!hw->mac.ops.check_mng_mode(hw)) { hw->mac.tx_pkt_filtering = FALSE; - goto out; + return hw->mac.tx_pkt_filtering; } /* @@ -157,7 +152,7 @@ bool e1000_enable_tx_pkt_filtering_generic(struct e1000_hw *hw) ret_val = hw->mac.ops.mng_enable_host_if(hw); if (ret_val != E1000_SUCCESS) { hw->mac.tx_pkt_filtering = FALSE; - goto out; + return hw->mac.tx_pkt_filtering; } /* Read in the header. Length and offset are in dwords. */ @@ -165,11 +160,11 @@ bool e1000_enable_tx_pkt_filtering_generic(struct e1000_hw *hw) offset = E1000_MNG_DHCP_COOKIE_OFFSET >> 2; for (i = 0; i < len; i++) *(buffer + i) = E1000_READ_REG_ARRAY_DWORD(hw, E1000_HOST_IF, - offset + i); + offset + i); hdr_csum = hdr->checksum; hdr->checksum = 0; csum = e1000_calculate_checksum((u8 *)hdr, - E1000_MNG_DHCP_COOKIE_LENGTH); + E1000_MNG_DHCP_COOKIE_LENGTH); /* * If either the checksums or signature don't match, then * the cookie area isn't considered valid, in which case we @@ -177,66 +172,16 @@ bool e1000_enable_tx_pkt_filtering_generic(struct e1000_hw *hw) */ if ((hdr_csum != csum) || (hdr->signature != E1000_IAMT_SIGNATURE)) { hw->mac.tx_pkt_filtering = TRUE; - goto out; + return hw->mac.tx_pkt_filtering; } /* Cookie area is valid, make the final check for filtering. */ - if (!(hdr->status & E1000_MNG_DHCP_COOKIE_STATUS_PARSING)) { + if (!(hdr->status & E1000_MNG_DHCP_COOKIE_STATUS_PARSING)) hw->mac.tx_pkt_filtering = FALSE; - goto out; - } -out: return hw->mac.tx_pkt_filtering; } -/** - * e1000_mng_write_dhcp_info_generic - Writes DHCP info to host interface - * @hw: pointer to the HW structure - * @buffer: pointer to the host interface - * @length: size of the buffer - * - * Writes the DHCP information to the host interface. - **/ -s32 e1000_mng_write_dhcp_info_generic(struct e1000_hw *hw, u8 *buffer, - u16 length) -{ - struct e1000_host_mng_command_header hdr; - s32 ret_val; - u32 hicr; - - DEBUGFUNC("e1000_mng_write_dhcp_info_generic"); - - hdr.command_id = E1000_MNG_DHCP_TX_PAYLOAD_CMD; - hdr.command_length = length; - hdr.reserved1 = 0; - hdr.reserved2 = 0; - hdr.checksum = 0; - - /* Enable the host interface */ - ret_val = hw->mac.ops.mng_enable_host_if(hw); - if (ret_val) - goto out; - - /* Populate the host interface with the contents of "buffer". */ - ret_val = hw->mac.ops.mng_host_if_write(hw, buffer, length, - sizeof(hdr), &(hdr.checksum)); - if (ret_val) - goto out; - - /* Write the manageability command header */ - ret_val = hw->mac.ops.mng_write_cmd_header(hw, &hdr); - if (ret_val) - goto out; - - /* Tell the ARC a new command is pending. */ - hicr = E1000_READ_REG(hw, E1000_HICR); - E1000_WRITE_REG(hw, E1000_HICR, hicr | E1000_HICR_C); - -out: - return ret_val; -} - /** * e1000_mng_write_cmd_header_generic - Writes manageability command header * @hw: pointer to the HW structure @@ -245,7 +190,7 @@ out: * Writes the command header after does the checksum calculation. **/ s32 e1000_mng_write_cmd_header_generic(struct e1000_hw *hw, - struct e1000_host_mng_command_header *hdr) + struct e1000_host_mng_command_header *hdr) { u16 i, length = sizeof(struct e1000_host_mng_command_header); @@ -259,7 +204,7 @@ s32 e1000_mng_write_cmd_header_generic(struct e1000_hw *hw, /* Write the relevant command block into the ram area. */ for (i = 0; i < length; i++) { E1000_WRITE_REG_ARRAY_DWORD(hw, E1000_HOST_IF, i, - *((u32 *) hdr + i)); + *((u32 *) hdr + i)); E1000_WRITE_FLUSH(hw); } @@ -279,22 +224,19 @@ s32 e1000_mng_write_cmd_header_generic(struct e1000_hw *hw, * way. Also fills up the sum of the buffer in *buffer parameter. **/ s32 e1000_mng_host_if_write_generic(struct e1000_hw *hw, u8 *buffer, - u16 length, u16 offset, u8 *sum) + u16 length, u16 offset, u8 *sum) { u8 *tmp; u8 *bufptr = buffer; u32 data = 0; - s32 ret_val = E1000_SUCCESS; u16 remaining, i, j, prev_bytes; DEBUGFUNC("e1000_mng_host_if_write_generic"); /* sum = only sum of the data and it is not checksum */ - if (length == 0 || offset + length > E1000_HI_MAX_MNG_DATA_LENGTH) { - ret_val = -E1000_ERR_PARAM; - goto out; - } + if (length == 0 || offset + length > E1000_HI_MAX_MNG_DATA_LENGTH) + return -E1000_ERR_PARAM; tmp = (u8 *)&data; prev_bytes = offset & 0x3; @@ -328,7 +270,7 @@ s32 e1000_mng_host_if_write_generic(struct e1000_hw *hw, u8 *buffer, } E1000_WRITE_REG_ARRAY_DWORD(hw, E1000_HOST_IF, offset + i, - data); + data); } if (remaining) { for (j = 0; j < sizeof(u32); j++) { @@ -339,11 +281,57 @@ s32 e1000_mng_host_if_write_generic(struct e1000_hw *hw, u8 *buffer, *sum += *(tmp + j); } - E1000_WRITE_REG_ARRAY_DWORD(hw, E1000_HOST_IF, offset + i, data); + E1000_WRITE_REG_ARRAY_DWORD(hw, E1000_HOST_IF, offset + i, + data); } -out: - return ret_val; + return E1000_SUCCESS; +} + +/** + * e1000_mng_write_dhcp_info_generic - Writes DHCP info to host interface + * @hw: pointer to the HW structure + * @buffer: pointer to the host interface + * @length: size of the buffer + * + * Writes the DHCP information to the host interface. + **/ +s32 e1000_mng_write_dhcp_info_generic(struct e1000_hw *hw, u8 *buffer, + u16 length) +{ + struct e1000_host_mng_command_header hdr; + s32 ret_val; + u32 hicr; + + DEBUGFUNC("e1000_mng_write_dhcp_info_generic"); + + hdr.command_id = E1000_MNG_DHCP_TX_PAYLOAD_CMD; + hdr.command_length = length; + hdr.reserved1 = 0; + hdr.reserved2 = 0; + hdr.checksum = 0; + + /* Enable the host interface */ + ret_val = hw->mac.ops.mng_enable_host_if(hw); + if (ret_val) + return ret_val; + + /* Populate the host interface with the contents of "buffer". */ + ret_val = hw->mac.ops.mng_host_if_write(hw, buffer, length, + sizeof(hdr), &(hdr.checksum)); + if (ret_val) + return ret_val; + + /* Write the manageability command header */ + ret_val = hw->mac.ops.mng_write_cmd_header(hw, &hdr); + if (ret_val) + return ret_val; + + /* Tell the ARC a new command is pending. */ + hicr = E1000_READ_REG(hw, E1000_HICR); + E1000_WRITE_REG(hw, E1000_HICR, hicr | E1000_HICR_C); + + return E1000_SUCCESS; } /** @@ -357,17 +345,16 @@ bool e1000_enable_mng_pass_thru(struct e1000_hw *hw) { u32 manc; u32 fwsm, factps; - bool ret_val = FALSE; DEBUGFUNC("e1000_enable_mng_pass_thru"); if (!hw->mac.asf_firmware_present) - goto out; + return FALSE; manc = E1000_READ_REG(hw, E1000_MANC); if (!(manc & E1000_MANC_RCV_TCO_EN)) - goto out; + return FALSE; if (hw->mac.has_fwsm) { fwsm = E1000_READ_REG(hw, E1000_FWSM); @@ -375,10 +362,8 @@ bool e1000_enable_mng_pass_thru(struct e1000_hw *hw) if (!(factps & E1000_FACTPS_MNGCG) && ((fwsm & E1000_FWSM_MODE_MASK) == - (e1000_mng_mode_pt << E1000_FWSM_MODE_SHIFT))) { - ret_val = TRUE; - goto out; - } + (e1000_mng_mode_pt << E1000_FWSM_MODE_SHIFT))) + return TRUE; } else if ((hw->mac.type == e1000_82574) || (hw->mac.type == e1000_82583)) { u16 data; @@ -388,18 +373,14 @@ bool e1000_enable_mng_pass_thru(struct e1000_hw *hw) if (!(factps & E1000_FACTPS_MNGCG) && ((data & E1000_NVM_INIT_CTRL2_MNGM) == - (e1000_mng_mode_pt << 13))) { - ret_val = TRUE; - goto out; - } + (e1000_mng_mode_pt << 13))) + return TRUE; } else if ((manc & E1000_MANC_SMBUS_EN) && - !(manc & E1000_MANC_ASF_EN)) { - ret_val = TRUE; - goto out; + !(manc & E1000_MANC_ASF_EN)) { + return TRUE; } -out: - return ret_val; + return FALSE; } /** @@ -414,33 +395,30 @@ out: s32 e1000_host_interface_command(struct e1000_hw *hw, u8 *buffer, u32 length) { u32 hicr, i; - s32 ret_val = E1000_SUCCESS; DEBUGFUNC("e1000_host_interface_command"); if (!(hw->mac.arc_subsystem_valid)) { DEBUGOUT("Hardware doesn't support host interface command.\n"); - goto out; + return E1000_SUCCESS; } if (!hw->mac.asf_firmware_present) { DEBUGOUT("Firmware is not present.\n"); - goto out; + return E1000_SUCCESS; } if (length == 0 || length & 0x3 || length > E1000_HI_MAX_BLOCK_BYTE_LENGTH) { DEBUGOUT("Buffer length failure.\n"); - ret_val = -E1000_ERR_HOST_INTERFACE_COMMAND; - goto out; + return -E1000_ERR_HOST_INTERFACE_COMMAND; } /* Check that the host interface is enabled. */ hicr = E1000_READ_REG(hw, E1000_HICR); - if ((hicr & E1000_HICR_EN) == 0) { + if (!(hicr & E1000_HICR_EN)) { DEBUGOUT("E1000_HOST_EN bit disabled.\n"); - ret_val = -E1000_ERR_HOST_INTERFACE_COMMAND; - goto out; + return -E1000_ERR_HOST_INTERFACE_COMMAND; } /* Calculate length in DWORDs */ @@ -451,10 +429,8 @@ s32 e1000_host_interface_command(struct e1000_hw *hw, u8 *buffer, u32 length) * into the ram area. */ for (i = 0; i < length; i++) - E1000_WRITE_REG_ARRAY_DWORD(hw, - E1000_HOST_IF, - i, - *((u32 *)buffer + i)); + E1000_WRITE_REG_ARRAY_DWORD(hw, E1000_HOST_IF, i, + *((u32 *)buffer + i)); /* Setting this bit tells the ARC that a new command is pending. */ E1000_WRITE_REG(hw, E1000_HICR, hicr | E1000_HICR_C); @@ -470,16 +446,134 @@ s32 e1000_host_interface_command(struct e1000_hw *hw, u8 *buffer, u32 length) if (i == E1000_HI_COMMAND_TIMEOUT || (!(E1000_READ_REG(hw, E1000_HICR) & E1000_HICR_SV))) { DEBUGOUT("Command has failed with no status valid.\n"); - ret_val = -E1000_ERR_HOST_INTERFACE_COMMAND; - goto out; + return -E1000_ERR_HOST_INTERFACE_COMMAND; } for (i = 0; i < length; i++) *((u32 *)buffer + i) = E1000_READ_REG_ARRAY_DWORD(hw, - E1000_HOST_IF, - i); + E1000_HOST_IF, + i); -out: - return ret_val; + return E1000_SUCCESS; +} +/** + * e1000_load_firmware - Writes proxy FW code buffer to host interface + * and execute. + * @hw: pointer to the HW structure + * @buffer: contains a firmware to write + * @length: the byte length of the buffer, must be multiple of 4 bytes + * + * Upon success returns E1000_SUCCESS, returns E1000_ERR_CONFIG if not enabled + * in HW else returns E1000_ERR_HOST_INTERFACE_COMMAND. + **/ +s32 e1000_load_firmware(struct e1000_hw *hw, u8 *buffer, u32 length) +{ + u32 hicr, hibba, fwsm, icr, i; + + DEBUGFUNC("e1000_load_firmware"); + + if (hw->mac.type < e1000_i210) { + DEBUGOUT("Hardware doesn't support loading FW by the driver\n"); + return -E1000_ERR_CONFIG; + } + + /* Check that the host interface is enabled. */ + hicr = E1000_READ_REG(hw, E1000_HICR); + if (!(hicr & E1000_HICR_EN)) { + DEBUGOUT("E1000_HOST_EN bit disabled.\n"); + return -E1000_ERR_CONFIG; + } + if (!(hicr & E1000_HICR_MEMORY_BASE_EN)) { + DEBUGOUT("E1000_HICR_MEMORY_BASE_EN bit disabled.\n"); + return -E1000_ERR_CONFIG; + } + + if (length == 0 || length & 0x3 || length > E1000_HI_FW_MAX_LENGTH) { + DEBUGOUT("Buffer length failure.\n"); + return -E1000_ERR_INVALID_ARGUMENT; + } + + /* Clear notification from ROM-FW by reading ICR register */ + icr = E1000_READ_REG(hw, E1000_ICR_V2); + + /* Reset ROM-FW */ + hicr = E1000_READ_REG(hw, E1000_HICR); + hicr |= E1000_HICR_FW_RESET_ENABLE; + E1000_WRITE_REG(hw, E1000_HICR, hicr); + hicr |= E1000_HICR_FW_RESET; + E1000_WRITE_REG(hw, E1000_HICR, hicr); + E1000_WRITE_FLUSH(hw); + + /* Wait till MAC notifies about its readiness after ROM-FW reset */ + for (i = 0; i < (E1000_HI_COMMAND_TIMEOUT * 2); i++) { + icr = E1000_READ_REG(hw, E1000_ICR_V2); + if (icr & E1000_ICR_MNG) + break; + msec_delay(1); + } + + /* Check for timeout */ + if (i == E1000_HI_COMMAND_TIMEOUT) { + DEBUGOUT("FW reset failed.\n"); + return -E1000_ERR_HOST_INTERFACE_COMMAND; + } + + /* Wait till MAC is ready to accept new FW code */ + for (i = 0; i < E1000_HI_COMMAND_TIMEOUT; i++) { + fwsm = E1000_READ_REG(hw, E1000_FWSM); + if ((fwsm & E1000_FWSM_FW_VALID) && + ((fwsm & E1000_FWSM_MODE_MASK) >> E1000_FWSM_MODE_SHIFT == + E1000_FWSM_HI_EN_ONLY_MODE)) + break; + msec_delay(1); + } + + /* Check for timeout */ + if (i == E1000_HI_COMMAND_TIMEOUT) { + DEBUGOUT("FW reset failed.\n"); + return -E1000_ERR_HOST_INTERFACE_COMMAND; + } + + /* Calculate length in DWORDs */ + length >>= 2; + + /* + * The device driver writes the relevant FW code block + * into the ram area in DWORDs via 1kB ram addressing window. + */ + for (i = 0; i < length; i++) { + if (!(i % E1000_HI_FW_BLOCK_DWORD_LENGTH)) { + /* Point to correct 1kB ram window */ + hibba = E1000_HI_FW_BASE_ADDRESS + + ((E1000_HI_FW_BLOCK_DWORD_LENGTH << 2) * + (i / E1000_HI_FW_BLOCK_DWORD_LENGTH)); + + E1000_WRITE_REG(hw, E1000_HIBBA, hibba); + } + + E1000_WRITE_REG_ARRAY_DWORD(hw, E1000_HOST_IF, + i % E1000_HI_FW_BLOCK_DWORD_LENGTH, + *((u32 *)buffer + i)); + } + + /* Setting this bit tells the ARC that a new FW is ready to execute. */ + hicr = E1000_READ_REG(hw, E1000_HICR); + E1000_WRITE_REG(hw, E1000_HICR, hicr | E1000_HICR_C); + + for (i = 0; i < E1000_HI_COMMAND_TIMEOUT; i++) { + hicr = E1000_READ_REG(hw, E1000_HICR); + if (!(hicr & E1000_HICR_C)) + break; + msec_delay(1); + } + + /* Check for successful FW start. */ + if (i == E1000_HI_COMMAND_TIMEOUT) { + DEBUGOUT("New FW did not start within timeout period.\n"); + return -E1000_ERR_HOST_INTERFACE_COMMAND; + } + + return E1000_SUCCESS; } + diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_manage.h b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_manage.h index 8e0d386255..51f176719c 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_manage.h +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_manage.h @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2010, Intel Corporation + Copyright (c) 2001-2012, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -30,7 +30,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: src/sys/dev/e1000/e1000_manage.h,v 1.1.4.1.6.1 2010/12/21 17:09:25 kensmith Exp $*/ +/*$FreeBSD$*/ #ifndef _E1000_MANAGE_H_ #define _E1000_MANAGE_H_ @@ -39,14 +39,15 @@ bool e1000_check_mng_mode_generic(struct e1000_hw *hw); bool e1000_enable_tx_pkt_filtering_generic(struct e1000_hw *hw); s32 e1000_mng_enable_host_if_generic(struct e1000_hw *hw); s32 e1000_mng_host_if_write_generic(struct e1000_hw *hw, u8 *buffer, - u16 length, u16 offset, u8 *sum); + u16 length, u16 offset, u8 *sum); s32 e1000_mng_write_cmd_header_generic(struct e1000_hw *hw, - struct e1000_host_mng_command_header *hdr); + struct e1000_host_mng_command_header *hdr); s32 e1000_mng_write_dhcp_info_generic(struct e1000_hw *hw, - u8 *buffer, u16 length); + u8 *buffer, u16 length); bool e1000_enable_mng_pass_thru(struct e1000_hw *hw); u8 e1000_calculate_checksum(u8 *buffer, u32 length); s32 e1000_host_interface_command(struct e1000_hw *hw, u8 *buffer, u32 length); +s32 e1000_load_firmware(struct e1000_hw *hw, u8 *buffer, u32 length); enum e1000_mng_mode { e1000_mng_mode_none = 0, @@ -56,35 +57,40 @@ enum e1000_mng_mode { e1000_mng_mode_host_if_only }; -#define E1000_FACTPS_MNGCG 0x20000000 +#define E1000_FACTPS_MNGCG 0x20000000 -#define E1000_FWSM_MODE_MASK 0xE -#define E1000_FWSM_MODE_SHIFT 1 +#define E1000_FWSM_MODE_MASK 0xE +#define E1000_FWSM_MODE_SHIFT 1 +#define E1000_FWSM_FW_VALID 0x00008000 +#define E1000_FWSM_HI_EN_ONLY_MODE 0x4 -#define E1000_MNG_IAMT_MODE 0x3 -#define E1000_MNG_DHCP_COOKIE_LENGTH 0x10 -#define E1000_MNG_DHCP_COOKIE_OFFSET 0x6F0 -#define E1000_MNG_DHCP_COMMAND_TIMEOUT 10 -#define E1000_MNG_DHCP_TX_PAYLOAD_CMD 64 -#define E1000_MNG_DHCP_COOKIE_STATUS_PARSING 0x1 -#define E1000_MNG_DHCP_COOKIE_STATUS_VLAN 0x2 +#define E1000_MNG_IAMT_MODE 0x3 +#define E1000_MNG_DHCP_COOKIE_LENGTH 0x10 +#define E1000_MNG_DHCP_COOKIE_OFFSET 0x6F0 +#define E1000_MNG_DHCP_COMMAND_TIMEOUT 10 +#define E1000_MNG_DHCP_TX_PAYLOAD_CMD 64 +#define E1000_MNG_DHCP_COOKIE_STATUS_PARSING 0x1 +#define E1000_MNG_DHCP_COOKIE_STATUS_VLAN 0x2 -#define E1000_VFTA_ENTRY_SHIFT 5 -#define E1000_VFTA_ENTRY_MASK 0x7F -#define E1000_VFTA_ENTRY_BIT_SHIFT_MASK 0x1F +#define E1000_VFTA_ENTRY_SHIFT 5 +#define E1000_VFTA_ENTRY_MASK 0x7F +#define E1000_VFTA_ENTRY_BIT_SHIFT_MASK 0x1F -#define E1000_HI_MAX_BLOCK_BYTE_LENGTH 1792 /* Num of bytes in range */ -#define E1000_HI_MAX_BLOCK_DWORD_LENGTH 448 /* Num of dwords in range */ -#define E1000_HI_COMMAND_TIMEOUT 500 /* Process HI command limit */ - -#define E1000_HICR_EN 0x01 /* Enable bit - RO */ +#define E1000_HI_MAX_BLOCK_BYTE_LENGTH 1792 /* Num of bytes in range */ +#define E1000_HI_MAX_BLOCK_DWORD_LENGTH 448 /* Num of dwords in range */ +#define E1000_HI_COMMAND_TIMEOUT 500 /* Process HI cmd limit */ +#define E1000_HI_FW_BASE_ADDRESS 0x10000 +#define E1000_HI_FW_MAX_LENGTH (64 * 1024) /* Num of bytes */ +#define E1000_HI_FW_BLOCK_DWORD_LENGTH 256 /* Num of DWORDs per page */ +#define E1000_HICR_MEMORY_BASE_EN 0x200 /* MB Enable bit - RO */ +#define E1000_HICR_EN 0x01 /* Enable bit - RO */ /* Driver sets this bit when done to put command in RAM */ -#define E1000_HICR_C 0x02 -#define E1000_HICR_SV 0x04 /* Status Validity */ -#define E1000_HICR_FW_RESET_ENABLE 0x40 -#define E1000_HICR_FW_RESET 0x80 +#define E1000_HICR_C 0x02 +#define E1000_HICR_SV 0x04 /* Status Validity */ +#define E1000_HICR_FW_RESET_ENABLE 0x40 +#define E1000_HICR_FW_RESET 0x80 /* Intel(R) Active Management Technology signature */ -#define E1000_IAMT_SIGNATURE 0x544D4149 +#define E1000_IAMT_SIGNATURE 0x544D4149 #endif diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_mbx.c b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_mbx.c index 3f023bb1b9..14af886738 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_mbx.c +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_mbx.c @@ -30,7 +30,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: src/sys/dev/e1000/e1000_mbx.c,v 1.1.2.2.2.1 2010/12/21 17:09:25 kensmith Exp $*/ +/*$FreeBSD$*/ #include "e1000_mbx.h" diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_mbx.h b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_mbx.h index 7a451d6c97..206f00c5fa 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_mbx.h +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_mbx.h @@ -30,7 +30,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: src/sys/dev/e1000/e1000_mbx.h,v 1.1.2.2.2.1 2010/12/21 17:09:25 kensmith Exp $*/ +/*$FreeBSD$*/ #ifndef _E1000_MBX_H_ #define _E1000_MBX_H_ diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_nvm.c b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_nvm.c index dc16977d84..d8df089efe 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_nvm.c +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_nvm.c @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2010, Intel Corporation + Copyright (c) 2001-2011, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -30,7 +30,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: src/sys/dev/e1000/e1000_nvm.c,v 1.3.2.2.2.1 2010/12/21 17:09:25 kensmith Exp $*/ +/*$FreeBSD$*/ #include "e1000_api.h" @@ -313,8 +313,7 @@ static void e1000_standby_nvm(struct e1000_hw *hw) usec_delay(nvm->delay_usec); e1000_lower_eec_clk(hw, &eecd); - } else - if (nvm->type == e1000_nvm_eeprom_spi) { + } else if (nvm->type == e1000_nvm_eeprom_spi) { /* Toggle CS to flush commands */ eecd |= E1000_EECD_CS; E1000_WRITE_REG(hw, E1000_EECD, eecd); @@ -394,13 +393,13 @@ static s32 e1000_ready_nvm_eeprom(struct e1000_hw *hw) /* Set CS */ eecd |= E1000_EECD_CS; E1000_WRITE_REG(hw, E1000_EECD, eecd); - } else - if (nvm->type == e1000_nvm_eeprom_spi) { + } else if (nvm->type == e1000_nvm_eeprom_spi) { u16 timeout = NVM_MAX_RETRY_SPI; /* Clear SK and CS */ eecd &= ~(E1000_EECD_CS | E1000_EECD_SK); E1000_WRITE_REG(hw, E1000_EECD, eecd); + E1000_WRITE_FLUSH(hw); usec_delay(1); /* @@ -411,7 +410,7 @@ static s32 e1000_ready_nvm_eeprom(struct e1000_hw *hw) */ while (timeout) { e1000_shift_out_eec_bits(hw, NVM_RDSR_OPCODE_SPI, - hw->nvm.opcode_bits); + hw->nvm.opcode_bits); spi_stat_reg = (u8)e1000_shift_in_eec_bits(hw, 8); if (!(spi_stat_reg & NVM_STATUS_RDY_SPI)) break; @@ -506,7 +505,7 @@ out: * Reads a 16 bit word from the EEPROM. **/ s32 e1000_read_nvm_microwire(struct e1000_hw *hw, u16 offset, u16 words, - u16 *data) + u16 *data) { struct e1000_nvm_info *nvm = &hw->nvm; u32 i = 0; @@ -593,7 +592,7 @@ s32 e1000_read_nvm_eerd(struct e1000_hw *hw, u16 offset, u16 words, u16 *data) break; data[i] = (E1000_READ_REG(hw, E1000_EERD) >> - E1000_NVM_RW_REG_DATA); + E1000_NVM_RW_REG_DATA); } out: @@ -646,7 +645,7 @@ s32 e1000_write_nvm_spi(struct e1000_hw *hw, u16 offset, u16 words, u16 *data) /* Send the WRITE ENABLE command (8 bit opcode) */ e1000_shift_out_eec_bits(hw, NVM_WREN_OPCODE_SPI, - nvm->opcode_bits); + nvm->opcode_bits); e1000_standby_nvm(hw); @@ -660,7 +659,7 @@ s32 e1000_write_nvm_spi(struct e1000_hw *hw, u16 offset, u16 words, u16 *data) /* Send the Write command (8-bit opcode + addr) */ e1000_shift_out_eec_bits(hw, write_opcode, nvm->opcode_bits); e1000_shift_out_eec_bits(hw, (u16)((offset + widx) * 2), - nvm->address_bits); + nvm->address_bits); /* Loop to allow for up to whole page write of eeprom */ while (widx < words) { @@ -697,7 +696,7 @@ out: * EEPROM will most likely contain an invalid checksum. **/ s32 e1000_write_nvm_microwire(struct e1000_hw *hw, u16 offset, u16 words, - u16 *data) + u16 *data) { struct e1000_nvm_info *nvm = &hw->nvm; s32 ret_val; @@ -727,7 +726,7 @@ s32 e1000_write_nvm_microwire(struct e1000_hw *hw, u16 offset, u16 words, goto release; e1000_shift_out_eec_bits(hw, NVM_EWEN_OPCODE_MICROWIRE, - (u16)(nvm->opcode_bits + 2)); + (u16)(nvm->opcode_bits + 2)); e1000_shift_out_eec_bits(hw, 0, (u16)(nvm->address_bits - 2)); @@ -735,10 +734,10 @@ s32 e1000_write_nvm_microwire(struct e1000_hw *hw, u16 offset, u16 words, while (words_written < words) { e1000_shift_out_eec_bits(hw, NVM_WRITE_OPCODE_MICROWIRE, - nvm->opcode_bits); + nvm->opcode_bits); e1000_shift_out_eec_bits(hw, (u16)(offset + words_written), - nvm->address_bits); + nvm->address_bits); e1000_shift_out_eec_bits(hw, data[words_written], 16); @@ -763,7 +762,7 @@ s32 e1000_write_nvm_microwire(struct e1000_hw *hw, u16 offset, u16 words, } e1000_shift_out_eec_bits(hw, NVM_EWDS_OPCODE_MICROWIRE, - (u16)(nvm->opcode_bits + 2)); + (u16)(nvm->opcode_bits + 2)); e1000_shift_out_eec_bits(hw, 0, (u16)(nvm->address_bits - 2)); @@ -784,7 +783,7 @@ out: * the value in pba_num. **/ s32 e1000_read_pba_string_generic(struct e1000_hw *hw, u8 *pba_num, - u32 pba_num_size) + u32 pba_num_size) { s32 ret_val; u16 nvm_data; diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_nvm.h b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_nvm.h index b6d5ce7c69..ed23eb3e37 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_nvm.h +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_nvm.h @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2010, Intel Corporation + Copyright (c) 2001-2011, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -30,7 +30,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: src/sys/dev/e1000/e1000_nvm.h,v 1.2.2.2.2.1 2010/12/21 17:09:25 kensmith Exp $*/ +/*$FreeBSD$*/ #ifndef _E1000_NVM_H_ #define _E1000_NVM_H_ @@ -45,25 +45,23 @@ s32 e1000_acquire_nvm_generic(struct e1000_hw *hw); s32 e1000_poll_eerd_eewr_done(struct e1000_hw *hw, int ee_reg); s32 e1000_read_mac_addr_generic(struct e1000_hw *hw); s32 e1000_read_pba_string_generic(struct e1000_hw *hw, u8 *pba_num, - u32 pba_num_size); + u32 pba_num_size); s32 e1000_read_pba_length_generic(struct e1000_hw *hw, u32 *pba_num_size); s32 e1000_read_nvm_spi(struct e1000_hw *hw, u16 offset, u16 words, u16 *data); s32 e1000_read_nvm_microwire(struct e1000_hw *hw, u16 offset, - u16 words, u16 *data); + u16 words, u16 *data); s32 e1000_read_nvm_eerd(struct e1000_hw *hw, u16 offset, u16 words, - u16 *data); + u16 *data); s32 e1000_valid_led_default_generic(struct e1000_hw *hw, u16 *data); s32 e1000_validate_nvm_checksum_generic(struct e1000_hw *hw); -s32 e1000_write_nvm_eewr(struct e1000_hw *hw, u16 offset, - u16 words, u16 *data); s32 e1000_write_nvm_microwire(struct e1000_hw *hw, u16 offset, - u16 words, u16 *data); + u16 words, u16 *data); s32 e1000_write_nvm_spi(struct e1000_hw *hw, u16 offset, u16 words, - u16 *data); + u16 *data); s32 e1000_update_nvm_checksum_generic(struct e1000_hw *hw); void e1000_stop_nvm(struct e1000_hw *hw); void e1000_release_nvm_generic(struct e1000_hw *hw); -#define E1000_STM_OPCODE 0xDB00 +#define E1000_STM_OPCODE 0xDB00 #endif diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_osdep.c b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_osdep.c index 327cd31c4b..75a7b79a4c 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_osdep.c +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_osdep.c @@ -30,7 +30,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: src/sys/dev/e1000/e1000_osdep.c,v 1.3.2.1.6.1 2010/12/21 17:09:25 kensmith Exp $*/ +/*$FreeBSD$*/ #include "e1000_api.h" diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_osdep.h b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_osdep.h index b6d0a463c7..e6d131a52e 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_osdep.h +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_osdep.h @@ -30,7 +30,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: src/sys/dev/e1000/e1000_osdep.h,v 1.2.2.3.2.1 2010/12/21 17:09:25 kensmith Exp $*/ +/*$FreeBSD$*/ #ifndef _FREEBSD_OS_H_ @@ -72,14 +72,11 @@ #define DEBUGOUT7(S,A,B,C,D,E,F,G) do {} while (0) #define STATIC static -#ifndef __HAIKU__ #define FALSE 0 -#define false FALSE #define TRUE 1 +#ifndef __bool_true_false_are_defined +#define false FALSE #define true TRUE -#else -#define FALSE 0 -#define TRUE 1 #endif #define CMD_MEM_WRT_INVALIDATE 0x0010 /* BIT_4 */ #define PCI_COMMAND_REGISTER PCIR_COMMAND @@ -87,7 +84,8 @@ /* Mutex used in the shared code */ #define E1000_MUTEX struct mtx #define E1000_MUTEX_INIT(mutex) mtx_init((mutex), #mutex, \ - MTX_NETWORK_LOCK, MTX_DEF) + MTX_NETWORK_LOCK, \ + MTX_DEF | MTX_DUPOK) #define E1000_MUTEX_DESTROY(mutex) mtx_destroy(mutex) #define E1000_MUTEX_LOCK(mutex) mtx_lock(mutex) #define E1000_MUTEX_TRYLOCK(mutex) mtx_trylock(mutex) @@ -101,7 +99,7 @@ typedef int64_t s64; typedef int32_t s32; typedef int16_t s16; typedef int8_t s8; -#ifndef __HAIKU__ +#ifndef __bool_true_false_are_defined typedef boolean_t bool; #endif diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_phy.c b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_phy.c index 04971e53d4..fd253ba92f 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_phy.c +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_phy.c @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2010, Intel Corporation + Copyright (c) 2001-2012, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -30,23 +30,23 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: src/sys/dev/e1000/e1000_phy.c,v 1.4.2.3.2.1 2010/12/21 17:09:25 kensmith Exp $*/ +/*$FreeBSD$*/ #include "e1000_api.h" static u32 e1000_get_phy_addr_for_bm_page(u32 page, u32 reg); static s32 e1000_access_phy_wakeup_reg_bm(struct e1000_hw *hw, u32 offset, - u16 *data, bool read); + u16 *data, bool read, bool page_set); static u32 e1000_get_phy_addr_for_hv_page(u32 page); static s32 e1000_access_phy_debug_regs_hv(struct e1000_hw *hw, u32 offset, - u16 *data, bool read); + u16 *data, bool read); /* Cable length tables */ static const u16 e1000_m88_cable_length_table[] = { 0, 50, 80, 110, 140, 140, E1000_CABLE_LENGTH_UNDEFINED }; #define M88E1000_CABLE_LENGTH_TABLE_SIZE \ - (sizeof(e1000_m88_cable_length_table) / \ - sizeof(e1000_m88_cable_length_table[0])) + (sizeof(e1000_m88_cable_length_table) / \ + sizeof(e1000_m88_cable_length_table[0])) static const u16 e1000_igp_2_cable_length_table[] = { 0, 0, 0, 0, 0, 0, 0, 0, 3, 5, 8, 11, 13, 16, 18, 21, 0, 0, 0, 3, @@ -58,8 +58,8 @@ static const u16 e1000_igp_2_cable_length_table[] = { 100, 105, 109, 113, 116, 119, 122, 124, 104, 109, 114, 118, 121, 124}; #define IGP02E1000_CABLE_LENGTH_TABLE_SIZE \ - (sizeof(e1000_igp_2_cable_length_table) / \ - sizeof(e1000_igp_2_cable_length_table[0])) + (sizeof(e1000_igp_2_cable_length_table) / \ + sizeof(e1000_igp_2_cable_length_table[0])) /** * e1000_init_phy_ops_generic - Initialize PHY function pointers @@ -82,19 +82,34 @@ void e1000_init_phy_ops_generic(struct e1000_hw *hw) phy->ops.get_cfg_done = e1000_null_ops_generic; phy->ops.get_cable_length = e1000_null_ops_generic; phy->ops.get_info = e1000_null_ops_generic; + phy->ops.set_page = e1000_null_set_page; phy->ops.read_reg = e1000_null_read_reg; phy->ops.read_reg_locked = e1000_null_read_reg; + phy->ops.read_reg_page = e1000_null_read_reg; phy->ops.release = e1000_null_phy_generic; phy->ops.reset = e1000_null_ops_generic; phy->ops.set_d0_lplu_state = e1000_null_lplu_state; phy->ops.set_d3_lplu_state = e1000_null_lplu_state; phy->ops.write_reg = e1000_null_write_reg; phy->ops.write_reg_locked = e1000_null_write_reg; + phy->ops.write_reg_page = e1000_null_write_reg; phy->ops.power_up = e1000_null_phy_generic; phy->ops.power_down = e1000_null_phy_generic; + phy->ops.read_i2c_byte = e1000_read_i2c_byte_null; + phy->ops.write_i2c_byte = e1000_write_i2c_byte_null; phy->ops.cfg_on_link_up = e1000_null_ops_generic; } +/** + * e1000_null_set_page - No-op function, return 0 + * @hw: pointer to the HW structure + **/ +s32 e1000_null_set_page(struct e1000_hw *hw, u16 data) +{ + DEBUGFUNC("e1000_null_set_page"); + return E1000_SUCCESS; +} + /** * e1000_null_read_reg - No-op function, return 0 * @hw: pointer to the HW structure @@ -135,6 +150,36 @@ s32 e1000_null_write_reg(struct e1000_hw *hw, u32 offset, u16 data) return E1000_SUCCESS; } +/** + * e1000_read_i2c_byte_null - No-op function, return 0 + * @hw: pointer to hardware structure + * @byte_offset: byte offset to write + * @dev_addr: device address + * @data: data value read + * + **/ +s32 e1000_read_i2c_byte_null(struct e1000_hw *hw, u8 byte_offset, + u8 dev_addr, u8 *data) +{ + DEBUGFUNC("e1000_read_i2c_byte_null"); + return E1000_SUCCESS; +} + +/** + * e1000_write_i2c_byte_null - No-op function, return 0 + * @hw: pointer to hardware structure + * @byte_offset: byte offset to write + * @dev_addr: device address + * @data: data value to write + * + **/ +s32 e1000_write_i2c_byte_null(struct e1000_hw *hw, u8 byte_offset, + u8 dev_addr, u8 data) +{ + DEBUGFUNC("e1000_write_i2c_byte_null"); + return E1000_SUCCESS; +} + /** * e1000_check_reset_block_generic - Check if PHY reset is blocked * @hw: pointer to the HW structure @@ -171,30 +216,30 @@ s32 e1000_get_phy_id(struct e1000_hw *hw) DEBUGFUNC("e1000_get_phy_id"); - if (!(phy->ops.read_reg)) - goto out; + if (!phy->ops.read_reg) + return E1000_SUCCESS; while (retry_count < 2) { ret_val = phy->ops.read_reg(hw, PHY_ID1, &phy_id); if (ret_val) - goto out; + return ret_val; phy->id = (u32)(phy_id << 16); usec_delay(20); ret_val = phy->ops.read_reg(hw, PHY_ID2, &phy_id); if (ret_val) - goto out; + return ret_val; phy->id |= (u32)(phy_id & PHY_REVISION_MASK); phy->revision = (u32)(phy_id & ~PHY_REVISION_MASK); if (phy->id != 0 && phy->id != PHY_REVISION_MASK) - goto out; + return E1000_SUCCESS; retry_count++; } -out: - return ret_val; + + return E1000_SUCCESS; } /** @@ -205,21 +250,18 @@ out: **/ s32 e1000_phy_reset_dsp_generic(struct e1000_hw *hw) { - s32 ret_val = E1000_SUCCESS; + s32 ret_val; DEBUGFUNC("e1000_phy_reset_dsp_generic"); - if (!(hw->phy.ops.write_reg)) - goto out; + if (!hw->phy.ops.write_reg) + return E1000_SUCCESS; ret_val = hw->phy.ops.write_reg(hw, M88E1000_PHY_GEN_CONTROL, 0xC1); if (ret_val) - goto out; + return ret_val; - ret_val = hw->phy.ops.write_reg(hw, M88E1000_PHY_GEN_CONTROL, 0); - -out: - return ret_val; + return hw->phy.ops.write_reg(hw, M88E1000_PHY_GEN_CONTROL, 0); } /** @@ -235,7 +277,6 @@ s32 e1000_read_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 *data) { struct e1000_phy_info *phy = &hw->phy; u32 i, mdic = 0; - s32 ret_val = E1000_SUCCESS; DEBUGFUNC("e1000_read_phy_reg_mdic"); @@ -250,8 +291,8 @@ s32 e1000_read_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 *data) * PHY to retrieve the desired data. */ mdic = ((offset << E1000_MDIC_REG_SHIFT) | - (phy->addr << E1000_MDIC_PHY_SHIFT) | - (E1000_MDIC_OP_READ)); + (phy->addr << E1000_MDIC_PHY_SHIFT) | + (E1000_MDIC_OP_READ)); E1000_WRITE_REG(hw, E1000_MDIC, mdic); @@ -268,13 +309,11 @@ s32 e1000_read_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 *data) } if (!(mdic & E1000_MDIC_READY)) { DEBUGOUT("MDI Read did not complete\n"); - ret_val = -E1000_ERR_PHY; - goto out; + return -E1000_ERR_PHY; } if (mdic & E1000_MDIC_ERROR) { DEBUGOUT("MDI Error\n"); - ret_val = -E1000_ERR_PHY; - goto out; + return -E1000_ERR_PHY; } *data = (u16) mdic; @@ -285,8 +324,7 @@ s32 e1000_read_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 *data) if (hw->mac.type == e1000_pch2lan) usec_delay(100); -out: - return ret_val; + return E1000_SUCCESS; } /** @@ -301,7 +339,6 @@ s32 e1000_write_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 data) { struct e1000_phy_info *phy = &hw->phy; u32 i, mdic = 0; - s32 ret_val = E1000_SUCCESS; DEBUGFUNC("e1000_write_phy_reg_mdic"); @@ -316,9 +353,9 @@ s32 e1000_write_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 data) * PHY to retrieve the desired data. */ mdic = (((u32)data) | - (offset << E1000_MDIC_REG_SHIFT) | - (phy->addr << E1000_MDIC_PHY_SHIFT) | - (E1000_MDIC_OP_WRITE)); + (offset << E1000_MDIC_REG_SHIFT) | + (phy->addr << E1000_MDIC_PHY_SHIFT) | + (E1000_MDIC_OP_WRITE)); E1000_WRITE_REG(hw, E1000_MDIC, mdic); @@ -335,13 +372,11 @@ s32 e1000_write_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 data) } if (!(mdic & E1000_MDIC_READY)) { DEBUGOUT("MDI Write did not complete\n"); - ret_val = -E1000_ERR_PHY; - goto out; + return -E1000_ERR_PHY; } if (mdic & E1000_MDIC_ERROR) { DEBUGOUT("MDI Error\n"); - ret_val = -E1000_ERR_PHY; - goto out; + return -E1000_ERR_PHY; } /* @@ -351,8 +386,7 @@ s32 e1000_write_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 data) if (hw->mac.type == e1000_pch2lan) usec_delay(100); -out: - return ret_val; + return E1000_SUCCESS; } /** @@ -377,8 +411,8 @@ s32 e1000_read_phy_reg_i2c(struct e1000_hw *hw, u32 offset, u16 *data) * PHY to retrieve the desired data. */ i2ccmd = ((offset << E1000_I2CCMD_REG_ADDR_SHIFT) | - (phy->addr << E1000_I2CCMD_PHY_ADDR_SHIFT) | - (E1000_I2CCMD_OPCODE_READ)); + (phy->addr << E1000_I2CCMD_PHY_ADDR_SHIFT) | + (E1000_I2CCMD_OPCODE_READ)); E1000_WRITE_REG(hw, E1000_I2CCMD, i2ccmd); @@ -420,6 +454,13 @@ s32 e1000_write_phy_reg_i2c(struct e1000_hw *hw, u32 offset, u16 data) DEBUGFUNC("e1000_write_phy_reg_i2c"); + /* Prevent overwritting SFP I2C EEPROM which is at A0 address.*/ + if ((hw->phy.addr == 0) || (hw->phy.addr > 7)) { + DEBUGOUT1("PHY I2C Address %d is out of range.\n", + hw->phy.addr); + return -E1000_ERR_CONFIG; + } + /* Swap the data bytes for the I2C interface */ phy_data_swapped = ((data >> 8) & 0x00FF) | ((data << 8) & 0xFF00); @@ -429,9 +470,9 @@ s32 e1000_write_phy_reg_i2c(struct e1000_hw *hw, u32 offset, u16 data) * PHY to retrieve the desired data. */ i2ccmd = ((offset << E1000_I2CCMD_REG_ADDR_SHIFT) | - (phy->addr << E1000_I2CCMD_PHY_ADDR_SHIFT) | - E1000_I2CCMD_OPCODE_WRITE | - phy_data_swapped); + (phy->addr << E1000_I2CCMD_PHY_ADDR_SHIFT) | + E1000_I2CCMD_OPCODE_WRITE | + phy_data_swapped); E1000_WRITE_REG(hw, E1000_I2CCMD, i2ccmd); @@ -454,6 +495,139 @@ s32 e1000_write_phy_reg_i2c(struct e1000_hw *hw, u32 offset, u16 data) return E1000_SUCCESS; } +/** + * e1000_read_sfp_data_byte - Reads SFP module data. + * @hw: pointer to the HW structure + * @offset: byte location offset to be read + * @data: read data buffer pointer + * + * Reads one byte from SFP module data stored + * in SFP resided EEPROM memory or SFP diagnostic area. + * Function should be called with + * E1000_I2CCMD_SFP_DATA_ADDR() for SFP module database access + * E1000_I2CCMD_SFP_DIAG_ADDR() for SFP diagnostics parameters + * access + **/ +s32 e1000_read_sfp_data_byte(struct e1000_hw *hw, u16 offset, u8 *data) +{ + u32 i = 0; + u32 i2ccmd = 0; + u32 data_local = 0; + + DEBUGFUNC("e1000_read_sfp_data_byte"); + + if (offset > E1000_I2CCMD_SFP_DIAG_ADDR(255)) { + DEBUGOUT("I2CCMD command address exceeds upper limit\n"); + return -E1000_ERR_PHY; + } + + /* + * Set up Op-code, EEPROM Address,in the I2CCMD + * register. The MAC will take care of interfacing with the + * EEPROM to retrieve the desired data. + */ + i2ccmd = ((offset << E1000_I2CCMD_REG_ADDR_SHIFT) | + E1000_I2CCMD_OPCODE_READ); + + E1000_WRITE_REG(hw, E1000_I2CCMD, i2ccmd); + + /* Poll the ready bit to see if the I2C read completed */ + for (i = 0; i < E1000_I2CCMD_PHY_TIMEOUT; i++) { + usec_delay(50); + data_local = E1000_READ_REG(hw, E1000_I2CCMD); + if (data_local & E1000_I2CCMD_READY) + break; + } + if (!(data_local & E1000_I2CCMD_READY)) { + DEBUGOUT("I2CCMD Read did not complete\n"); + return -E1000_ERR_PHY; + } + if (data_local & E1000_I2CCMD_ERROR) { + DEBUGOUT("I2CCMD Error bit set\n"); + return -E1000_ERR_PHY; + } + *data = (u8) data_local & 0xFF; + + return E1000_SUCCESS; +} + +/** + * e1000_write_sfp_data_byte - Writes SFP module data. + * @hw: pointer to the HW structure + * @offset: byte location offset to write to + * @data: data to write + * + * Writes one byte to SFP module data stored + * in SFP resided EEPROM memory or SFP diagnostic area. + * Function should be called with + * E1000_I2CCMD_SFP_DATA_ADDR() for SFP module database access + * E1000_I2CCMD_SFP_DIAG_ADDR() for SFP diagnostics parameters + * access + **/ +s32 e1000_write_sfp_data_byte(struct e1000_hw *hw, u16 offset, u8 data) +{ + u32 i = 0; + u32 i2ccmd = 0; + u32 data_local = 0; + + DEBUGFUNC("e1000_write_sfp_data_byte"); + + if (offset > E1000_I2CCMD_SFP_DIAG_ADDR(255)) { + DEBUGOUT("I2CCMD command address exceeds upper limit\n"); + return -E1000_ERR_PHY; + } + /* + * The programming interface is 16 bits wide + * so we need to read the whole word first + * then update appropriate byte lane and write + * the updated word back. + */ + /* + * Set up Op-code, EEPROM Address,in the I2CCMD + * register. The MAC will take care of interfacing + * with an EEPROM to write the data given. + */ + i2ccmd = ((offset << E1000_I2CCMD_REG_ADDR_SHIFT) | + E1000_I2CCMD_OPCODE_READ); + /* Set a command to read single word */ + E1000_WRITE_REG(hw, E1000_I2CCMD, i2ccmd); + for (i = 0; i < E1000_I2CCMD_PHY_TIMEOUT; i++) { + usec_delay(50); + /* + * Poll the ready bit to see if lastly + * launched I2C operation completed + */ + i2ccmd = E1000_READ_REG(hw, E1000_I2CCMD); + if (i2ccmd & E1000_I2CCMD_READY) { + /* Check if this is READ or WRITE phase */ + if ((i2ccmd & E1000_I2CCMD_OPCODE_READ) == + E1000_I2CCMD_OPCODE_READ) { + /* + * Write the selected byte + * lane and update whole word + */ + data_local = i2ccmd & 0xFF00; + data_local |= data; + i2ccmd = ((offset << + E1000_I2CCMD_REG_ADDR_SHIFT) | + E1000_I2CCMD_OPCODE_WRITE | data_local); + E1000_WRITE_REG(hw, E1000_I2CCMD, i2ccmd); + } else { + break; + } + } + } + if (!(i2ccmd & E1000_I2CCMD_READY)) { + DEBUGOUT("I2CCMD Write did not complete\n"); + return -E1000_ERR_PHY; + } + if (i2ccmd & E1000_I2CCMD_ERROR) { + DEBUGOUT("I2CCMD Error bit set\n"); + return -E1000_ERR_PHY; + } + return E1000_SUCCESS; +} + /** * e1000_read_phy_reg_m88 - Read m88 PHY register * @hw: pointer to the HW structure @@ -466,23 +640,22 @@ s32 e1000_write_phy_reg_i2c(struct e1000_hw *hw, u32 offset, u16 data) **/ s32 e1000_read_phy_reg_m88(struct e1000_hw *hw, u32 offset, u16 *data) { - s32 ret_val = E1000_SUCCESS; + s32 ret_val; DEBUGFUNC("e1000_read_phy_reg_m88"); - if (!(hw->phy.ops.acquire)) - goto out; + if (!hw->phy.ops.acquire) + return E1000_SUCCESS; ret_val = hw->phy.ops.acquire(hw); if (ret_val) - goto out; + return ret_val; ret_val = e1000_read_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, - data); + data); hw->phy.ops.release(hw); -out: return ret_val; } @@ -497,26 +670,45 @@ out: **/ s32 e1000_write_phy_reg_m88(struct e1000_hw *hw, u32 offset, u16 data) { - s32 ret_val = E1000_SUCCESS; + s32 ret_val; DEBUGFUNC("e1000_write_phy_reg_m88"); - if (!(hw->phy.ops.acquire)) - goto out; + if (!hw->phy.ops.acquire) + return E1000_SUCCESS; ret_val = hw->phy.ops.acquire(hw); if (ret_val) - goto out; + return ret_val; ret_val = e1000_write_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, - data); + data); hw->phy.ops.release(hw); -out: return ret_val; } +/** + * e1000_set_page_igp - Set page as on IGP-like PHY(s) + * @hw: pointer to the HW structure + * @page: page to set (shifted left when necessary) + * + * Sets PHY page required for PHY register access. Assumes semaphore is + * already acquired. Note, this function sets phy.addr to 1 so the caller + * must set it appropriately (if necessary) after this function returns. + **/ +s32 e1000_set_page_igp(struct e1000_hw *hw, u16 page) +{ + DEBUGFUNC("e1000_set_page_igp"); + + DEBUGOUT1("Setting page 0x%x\n", page); + + hw->phy.addr = 1; + + return e1000_write_phy_reg_mdic(hw, IGP01E1000_PHY_PAGE_SELECT, page); +} + /** * __e1000_read_phy_reg_igp - Read igp PHY register * @hw: pointer to the HW structure @@ -529,36 +721,32 @@ out: * semaphores before exiting. **/ static s32 __e1000_read_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 *data, - bool locked) + bool locked) { s32 ret_val = E1000_SUCCESS; DEBUGFUNC("__e1000_read_phy_reg_igp"); if (!locked) { - if (!(hw->phy.ops.acquire)) - goto out; + if (!hw->phy.ops.acquire) + return E1000_SUCCESS; ret_val = hw->phy.ops.acquire(hw); if (ret_val) - goto out; + return ret_val; } - if (offset > MAX_PHY_MULTI_PAGE_REG) { + if (offset > MAX_PHY_MULTI_PAGE_REG) ret_val = e1000_write_phy_reg_mdic(hw, - IGP01E1000_PHY_PAGE_SELECT, - (u16)offset); - if (ret_val) - goto release; - } - - ret_val = e1000_read_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, - data); - -release: + IGP01E1000_PHY_PAGE_SELECT, + (u16)offset); + if (!ret_val) + ret_val = e1000_read_phy_reg_mdic(hw, + MAX_PHY_REG_ADDRESS & offset, + data); if (!locked) hw->phy.ops.release(hw); -out: + return ret_val; } @@ -602,37 +790,32 @@ s32 e1000_read_phy_reg_igp_locked(struct e1000_hw *hw, u32 offset, u16 *data) * at the offset. Release any acquired semaphores before exiting. **/ static s32 __e1000_write_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 data, - bool locked) + bool locked) { s32 ret_val = E1000_SUCCESS; DEBUGFUNC("e1000_write_phy_reg_igp"); if (!locked) { - if (!(hw->phy.ops.acquire)) - goto out; + if (!hw->phy.ops.acquire) + return E1000_SUCCESS; ret_val = hw->phy.ops.acquire(hw); if (ret_val) - goto out; + return ret_val; } - if (offset > MAX_PHY_MULTI_PAGE_REG) { + if (offset > MAX_PHY_MULTI_PAGE_REG) ret_val = e1000_write_phy_reg_mdic(hw, - IGP01E1000_PHY_PAGE_SELECT, - (u16)offset); - if (ret_val) - goto release; - } - - ret_val = e1000_write_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, - data); - -release: + IGP01E1000_PHY_PAGE_SELECT, + (u16)offset); + if (!ret_val) + ret_val = e1000_write_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & + offset, + data); if (!locked) hw->phy.ops.release(hw); -out: return ret_val; } @@ -676,25 +859,27 @@ s32 e1000_write_phy_reg_igp_locked(struct e1000_hw *hw, u32 offset, u16 data) * Release any acquired semaphores before exiting. **/ static s32 __e1000_read_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 *data, - bool locked) + bool locked) { u32 kmrnctrlsta; - s32 ret_val = E1000_SUCCESS; DEBUGFUNC("__e1000_read_kmrn_reg"); if (!locked) { - if (!(hw->phy.ops.acquire)) - goto out; + s32 ret_val = E1000_SUCCESS; + + if (!hw->phy.ops.acquire) + return E1000_SUCCESS; ret_val = hw->phy.ops.acquire(hw); if (ret_val) - goto out; + return ret_val; } kmrnctrlsta = ((offset << E1000_KMRNCTRLSTA_OFFSET_SHIFT) & - E1000_KMRNCTRLSTA_OFFSET) | E1000_KMRNCTRLSTA_REN; + E1000_KMRNCTRLSTA_OFFSET) | E1000_KMRNCTRLSTA_REN; E1000_WRITE_REG(hw, E1000_KMRNCTRLSTA, kmrnctrlsta); + E1000_WRITE_FLUSH(hw); usec_delay(2); @@ -704,8 +889,7 @@ static s32 __e1000_read_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 *data, if (!locked) hw->phy.ops.release(hw); -out: - return ret_val; + return E1000_SUCCESS; } /** @@ -750,33 +934,34 @@ s32 e1000_read_kmrn_reg_locked(struct e1000_hw *hw, u32 offset, u16 *data) * before exiting. **/ static s32 __e1000_write_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 data, - bool locked) + bool locked) { u32 kmrnctrlsta; - s32 ret_val = E1000_SUCCESS; DEBUGFUNC("e1000_write_kmrn_reg_generic"); if (!locked) { - if (!(hw->phy.ops.acquire)) - goto out; + s32 ret_val = E1000_SUCCESS; + + if (!hw->phy.ops.acquire) + return E1000_SUCCESS; ret_val = hw->phy.ops.acquire(hw); if (ret_val) - goto out; + return ret_val; } kmrnctrlsta = ((offset << E1000_KMRNCTRLSTA_OFFSET_SHIFT) & - E1000_KMRNCTRLSTA_OFFSET) | data; + E1000_KMRNCTRLSTA_OFFSET) | data; E1000_WRITE_REG(hw, E1000_KMRNCTRLSTA, kmrnctrlsta); + E1000_WRITE_FLUSH(hw); usec_delay(2); if (!locked) hw->phy.ops.release(hw); -out: - return ret_val; + return E1000_SUCCESS; } /** @@ -807,6 +992,46 @@ s32 e1000_write_kmrn_reg_locked(struct e1000_hw *hw, u32 offset, u16 data) return __e1000_write_kmrn_reg(hw, offset, data, TRUE); } +/** + * e1000_set_master_slave_mode - Setup PHY for Master/slave mode + * @hw: pointer to the HW structure + * + * Sets up Master/slave mode + **/ +static s32 e1000_set_master_slave_mode(struct e1000_hw *hw) +{ + s32 ret_val; + u16 phy_data; + + /* Resolve Master/Slave mode */ + ret_val = hw->phy.ops.read_reg(hw, PHY_1000T_CTRL, &phy_data); + if (ret_val) + return ret_val; + + /* load defaults for future use */ + hw->phy.original_ms_type = (phy_data & CR_1000T_MS_ENABLE) ? + ((phy_data & CR_1000T_MS_VALUE) ? + e1000_ms_force_master : + e1000_ms_force_slave) : e1000_ms_auto; + + switch (hw->phy.ms_type) { + case e1000_ms_force_master: + phy_data |= (CR_1000T_MS_ENABLE | CR_1000T_MS_VALUE); + break; + case e1000_ms_force_slave: + phy_data |= CR_1000T_MS_ENABLE; + phy_data &= ~(CR_1000T_MS_VALUE); + break; + case e1000_ms_auto: + phy_data &= ~CR_1000T_MS_ENABLE; + /* fall-through */ + default: + break; + } + + return hw->phy.ops.write_reg(hw, PHY_1000T_CTRL, phy_data); +} + /** * e1000_copper_link_setup_82577 - Setup 82577 PHY for copper link * @hw: pointer to the HW structure @@ -820,23 +1045,18 @@ s32 e1000_copper_link_setup_82577(struct e1000_hw *hw) DEBUGFUNC("e1000_copper_link_setup_82577"); - if (hw->phy.reset_disable) { - ret_val = E1000_SUCCESS; - goto out; - } - if (hw->phy.type == e1000_phy_82580) { ret_val = hw->phy.ops.reset(hw); if (ret_val) { DEBUGOUT("Error resetting the PHY.\n"); - goto out; + return ret_val; } } /* Enable CRS on Tx. This must be set for half-duplex operation. */ ret_val = hw->phy.ops.read_reg(hw, I82577_CFG_REG, &phy_data); if (ret_val) - goto out; + return ret_val; phy_data |= I82577_CFG_ASSERT_CRS_ON_TX; @@ -844,9 +1064,36 @@ s32 e1000_copper_link_setup_82577(struct e1000_hw *hw) phy_data |= I82577_CFG_ENABLE_DOWNSHIFT; ret_val = hw->phy.ops.write_reg(hw, I82577_CFG_REG, phy_data); + if (ret_val) + return ret_val; -out: - return ret_val; + /* Set MDI/MDIX mode */ + ret_val = hw->phy.ops.read_reg(hw, I82577_PHY_CTRL_2, &phy_data); + if (ret_val) + return ret_val; + phy_data &= ~I82577_PHY_CTRL2_MDIX_CFG_MASK; + /* + * Options: + * 0 - Auto (default) + * 1 - MDI mode + * 2 - MDI-X mode + */ + switch (hw->phy.mdix) { + case 1: + break; + case 2: + phy_data |= I82577_PHY_CTRL2_MANUAL_MDIX; + break; + case 0: + default: + phy_data |= I82577_PHY_CTRL2_AUTO_MDI_MDIX; + break; + } + ret_val = hw->phy.ops.write_reg(hw, I82577_PHY_CTRL_2, phy_data); + if (ret_val) + return ret_val; + + return e1000_set_master_slave_mode(hw); } /** @@ -864,15 +1111,11 @@ s32 e1000_copper_link_setup_m88(struct e1000_hw *hw) DEBUGFUNC("e1000_copper_link_setup_m88"); - if (phy->reset_disable) { - ret_val = E1000_SUCCESS; - goto out; - } /* Enable CRS on Tx. This must be set for half-duplex operation. */ ret_val = phy->ops.read_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data); if (ret_val) - goto out; + return ret_val; /* For BM PHY this bit is downshift enable */ if (phy->type != e1000_phy_bm) @@ -912,16 +1155,32 @@ s32 e1000_copper_link_setup_m88(struct e1000_hw *hw) * 1 - Enabled */ phy_data &= ~M88E1000_PSCR_POLARITY_REVERSAL; - if (phy->disable_polarity_correction == 1) + if (phy->disable_polarity_correction) phy_data |= M88E1000_PSCR_POLARITY_REVERSAL; /* Enable downshift on BM (disabled by default) */ - if (phy->type == e1000_phy_bm) + if (phy->type == e1000_phy_bm) { + /* For 82574/82583, first disable then enable downshift */ + if (phy->id == BME1000_E_PHY_ID_R2) { + phy_data &= ~BME1000_PSCR_ENABLE_DOWNSHIFT; + ret_val = phy->ops.write_reg(hw, M88E1000_PHY_SPEC_CTRL, + phy_data); + if (ret_val) + return ret_val; + /* Commit the changes. */ + ret_val = phy->ops.commit(hw); + if (ret_val) { + DEBUGOUT("Error committing the PHY changes\n"); + return ret_val; + } + } + phy_data |= BME1000_PSCR_ENABLE_DOWNSHIFT; + } ret_val = phy->ops.write_reg(hw, M88E1000_PHY_SPEC_CTRL, phy_data); if (ret_val) - goto out; + return ret_val; if ((phy->type == e1000_phy_m88) && (phy->revision < E1000_REVISION_4) && @@ -931,9 +1190,9 @@ s32 e1000_copper_link_setup_m88(struct e1000_hw *hw) * to 25MHz clock. */ ret_val = phy->ops.read_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL, - &phy_data); + &phy_data); if (ret_val) - goto out; + return ret_val; phy_data |= M88E1000_EPSCR_TX_CLK_25; @@ -945,52 +1204,57 @@ s32 e1000_copper_link_setup_m88(struct e1000_hw *hw) } else { /* Configure Master and Slave downshift values */ phy_data &= ~(M88E1000_EPSCR_MASTER_DOWNSHIFT_MASK | - M88E1000_EPSCR_SLAVE_DOWNSHIFT_MASK); + M88E1000_EPSCR_SLAVE_DOWNSHIFT_MASK); phy_data |= (M88E1000_EPSCR_MASTER_DOWNSHIFT_1X | - M88E1000_EPSCR_SLAVE_DOWNSHIFT_1X); + M88E1000_EPSCR_SLAVE_DOWNSHIFT_1X); } ret_val = phy->ops.write_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL, - phy_data); + phy_data); if (ret_val) - goto out; + return ret_val; } if ((phy->type == e1000_phy_bm) && (phy->id == BME1000_E_PHY_ID_R2)) { /* Set PHY page 0, register 29 to 0x0003 */ ret_val = phy->ops.write_reg(hw, 29, 0x0003); if (ret_val) - goto out; + return ret_val; /* Set PHY page 0, register 30 to 0x0000 */ ret_val = phy->ops.write_reg(hw, 30, 0x0000); if (ret_val) - goto out; + return ret_val; } /* Commit the changes. */ ret_val = phy->ops.commit(hw); if (ret_val) { DEBUGOUT("Error committing the PHY changes\n"); - goto out; + return ret_val; } if (phy->type == e1000_phy_82578) { ret_val = phy->ops.read_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL, - &phy_data); + &phy_data); if (ret_val) - goto out; + return ret_val; /* 82578 PHY - set the downshift count to 1x. */ phy_data |= I82578_EPSCR_DOWNSHIFT_ENABLE; phy_data &= ~I82578_EPSCR_DOWNSHIFT_COUNTER_MASK; ret_val = phy->ops.write_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL, - phy_data); + phy_data); if (ret_val) - goto out; + return ret_val; } -out: - return ret_val; + if (phy->type == e1000_phy_i210) { + ret_val = e1000_set_master_slave_mode(hw); + if (ret_val) + return ret_val; + } + + return E1000_SUCCESS; } /** @@ -1008,15 +1272,11 @@ s32 e1000_copper_link_setup_m88_gen2(struct e1000_hw *hw) DEBUGFUNC("e1000_copper_link_setup_m88_gen2"); - if (phy->reset_disable) { - ret_val = E1000_SUCCESS; - goto out; - } /* Enable CRS on Tx. This must be set for half-duplex operation. */ ret_val = phy->ops.read_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data); if (ret_val) - goto out; + return ret_val; /* * Options: @@ -1055,7 +1315,7 @@ s32 e1000_copper_link_setup_m88_gen2(struct e1000_hw *hw) * 1 - Enabled */ phy_data &= ~M88E1000_PSCR_POLARITY_REVERSAL; - if (phy->disable_polarity_correction == 1) + if (phy->disable_polarity_correction) phy_data |= M88E1000_PSCR_POLARITY_REVERSAL; /* Enable downshift and setting it to X6 */ @@ -1065,17 +1325,16 @@ s32 e1000_copper_link_setup_m88_gen2(struct e1000_hw *hw) ret_val = phy->ops.write_reg(hw, M88E1000_PHY_SPEC_CTRL, phy_data); if (ret_val) - goto out; + return ret_val; /* Commit the changes. */ ret_val = phy->ops.commit(hw); if (ret_val) { DEBUGOUT("Error committing the PHY changes\n"); - goto out; + return ret_val; } -out: - return ret_val; + return E1000_SUCCESS; } /** @@ -1093,15 +1352,11 @@ s32 e1000_copper_link_setup_igp(struct e1000_hw *hw) DEBUGFUNC("e1000_copper_link_setup_igp"); - if (phy->reset_disable) { - ret_val = E1000_SUCCESS; - goto out; - } ret_val = hw->phy.ops.reset(hw); if (ret_val) { DEBUGOUT("Error resetting the PHY.\n"); - goto out; + return ret_val; } /* @@ -1119,7 +1374,7 @@ s32 e1000_copper_link_setup_igp(struct e1000_hw *hw) ret_val = hw->phy.ops.set_d3_lplu_state(hw, FALSE); if (ret_val) { DEBUGOUT("Error Disabling LPLU D3\n"); - goto out; + return ret_val; } } @@ -1128,13 +1383,13 @@ s32 e1000_copper_link_setup_igp(struct e1000_hw *hw) ret_val = hw->phy.ops.set_d0_lplu_state(hw, FALSE); if (ret_val) { DEBUGOUT("Error Disabling LPLU D0\n"); - goto out; + return ret_val; } } /* Configure mdi-mdix settings */ ret_val = phy->ops.read_reg(hw, IGP01E1000_PHY_PORT_CTRL, &data); if (ret_val) - goto out; + return ret_val; data &= ~IGP01E1000_PSCR_AUTO_MDIX; @@ -1152,7 +1407,7 @@ s32 e1000_copper_link_setup_igp(struct e1000_hw *hw) } ret_val = phy->ops.write_reg(hw, IGP01E1000_PHY_PORT_CTRL, data); if (ret_val) - goto out; + return ret_val; /* set auto-master slave resolution settings */ if (hw->mac.autoneg) { @@ -1164,129 +1419,32 @@ s32 e1000_copper_link_setup_igp(struct e1000_hw *hw) if (phy->autoneg_advertised == ADVERTISE_1000_FULL) { /* Disable SmartSpeed */ ret_val = phy->ops.read_reg(hw, - IGP01E1000_PHY_PORT_CONFIG, - &data); + IGP01E1000_PHY_PORT_CONFIG, + &data); if (ret_val) - goto out; + return ret_val; data &= ~IGP01E1000_PSCFR_SMART_SPEED; ret_val = phy->ops.write_reg(hw, - IGP01E1000_PHY_PORT_CONFIG, - data); + IGP01E1000_PHY_PORT_CONFIG, + data); if (ret_val) - goto out; + return ret_val; /* Set auto Master/Slave resolution process */ ret_val = phy->ops.read_reg(hw, PHY_1000T_CTRL, &data); if (ret_val) - goto out; + return ret_val; data &= ~CR_1000T_MS_ENABLE; ret_val = phy->ops.write_reg(hw, PHY_1000T_CTRL, data); if (ret_val) - goto out; + return ret_val; } - ret_val = phy->ops.read_reg(hw, PHY_1000T_CTRL, &data); - if (ret_val) - goto out; - - /* load defaults for future use */ - phy->original_ms_type = (data & CR_1000T_MS_ENABLE) ? - ((data & CR_1000T_MS_VALUE) ? - e1000_ms_force_master : - e1000_ms_force_slave) : - e1000_ms_auto; - - switch (phy->ms_type) { - case e1000_ms_force_master: - data |= (CR_1000T_MS_ENABLE | CR_1000T_MS_VALUE); - break; - case e1000_ms_force_slave: - data |= CR_1000T_MS_ENABLE; - data &= ~(CR_1000T_MS_VALUE); - break; - case e1000_ms_auto: - data &= ~CR_1000T_MS_ENABLE; - default: - break; - } - ret_val = phy->ops.write_reg(hw, PHY_1000T_CTRL, data); - if (ret_val) - goto out; + ret_val = e1000_set_master_slave_mode(hw); } -out: - return ret_val; -} - -/** - * e1000_copper_link_autoneg - Setup/Enable autoneg for copper link - * @hw: pointer to the HW structure - * - * Performs initial bounds checking on autoneg advertisement parameter, then - * configure to advertise the full capability. Setup the PHY to autoneg - * and restart the negotiation process between the link partner. If - * autoneg_wait_to_complete, then wait for autoneg to complete before exiting. - **/ -s32 e1000_copper_link_autoneg(struct e1000_hw *hw) -{ - struct e1000_phy_info *phy = &hw->phy; - s32 ret_val; - u16 phy_ctrl; - - DEBUGFUNC("e1000_copper_link_autoneg"); - - /* - * Perform some bounds checking on the autoneg advertisement - * parameter. - */ - phy->autoneg_advertised &= phy->autoneg_mask; - - /* - * If autoneg_advertised is zero, we assume it was not defaulted - * by the calling code so we set to advertise full capability. - */ - if (phy->autoneg_advertised == 0) - phy->autoneg_advertised = phy->autoneg_mask; - - DEBUGOUT("Reconfiguring auto-neg advertisement params\n"); - ret_val = e1000_phy_setup_autoneg(hw); - if (ret_val) { - DEBUGOUT("Error Setting up Auto-Negotiation\n"); - goto out; - } - DEBUGOUT("Restarting Auto-Neg\n"); - - /* - * Restart auto-negotiation by setting the Auto Neg Enable bit and - * the Auto Neg Restart bit in the PHY control register. - */ - ret_val = phy->ops.read_reg(hw, PHY_CONTROL, &phy_ctrl); - if (ret_val) - goto out; - - phy_ctrl |= (MII_CR_AUTO_NEG_EN | MII_CR_RESTART_AUTO_NEG); - ret_val = phy->ops.write_reg(hw, PHY_CONTROL, phy_ctrl); - if (ret_val) - goto out; - - /* - * Does the user want to wait for Auto-Neg to complete here, or - * check at a later time (for example, callback routine). - */ - if (phy->autoneg_wait_to_complete) { - ret_val = hw->mac.ops.wait_autoneg(hw); - if (ret_val) { - DEBUGOUT("Error while waiting for " - "autoneg to complete\n"); - goto out; - } - } - - hw->mac.get_link_status = TRUE; - -out: return ret_val; } @@ -1313,14 +1471,14 @@ s32 e1000_phy_setup_autoneg(struct e1000_hw *hw) /* Read the MII Auto-Neg Advertisement Register (Address 4). */ ret_val = phy->ops.read_reg(hw, PHY_AUTONEG_ADV, &mii_autoneg_adv_reg); if (ret_val) - goto out; + return ret_val; if (phy->autoneg_mask & ADVERTISE_1000_FULL) { /* Read the MII 1000Base-T Control Register (Address 9). */ ret_val = phy->ops.read_reg(hw, PHY_1000T_CTRL, - &mii_1000t_ctrl_reg); + &mii_1000t_ctrl_reg); if (ret_val) - goto out; + return ret_val; } /* @@ -1337,9 +1495,9 @@ s32 e1000_phy_setup_autoneg(struct e1000_hw *hw) * the 1000Base-T Control Register (Address 9). */ mii_autoneg_adv_reg &= ~(NWAY_AR_100TX_FD_CAPS | - NWAY_AR_100TX_HD_CAPS | - NWAY_AR_10T_FD_CAPS | - NWAY_AR_10T_HD_CAPS); + NWAY_AR_100TX_HD_CAPS | + NWAY_AR_10T_FD_CAPS | + NWAY_AR_10T_HD_CAPS); mii_1000t_ctrl_reg &= ~(CR_1000T_HD_CAPS | CR_1000T_FD_CAPS); DEBUGOUT1("autoneg_advertised %x\n", phy->autoneg_advertised); @@ -1434,25 +1592,87 @@ s32 e1000_phy_setup_autoneg(struct e1000_hw *hw) break; default: DEBUGOUT("Flow control param set incorrectly\n"); - ret_val = -E1000_ERR_CONFIG; - goto out; + return -E1000_ERR_CONFIG; } ret_val = phy->ops.write_reg(hw, PHY_AUTONEG_ADV, mii_autoneg_adv_reg); if (ret_val) - goto out; + return ret_val; DEBUGOUT1("Auto-Neg Advertising %x\n", mii_autoneg_adv_reg); - if (phy->autoneg_mask & ADVERTISE_1000_FULL) { - ret_val = phy->ops.write_reg(hw, - PHY_1000T_CTRL, - mii_1000t_ctrl_reg); - if (ret_val) - goto out; + if (phy->autoneg_mask & ADVERTISE_1000_FULL) + ret_val = phy->ops.write_reg(hw, PHY_1000T_CTRL, + mii_1000t_ctrl_reg); + + return ret_val; +} + +/** + * e1000_copper_link_autoneg - Setup/Enable autoneg for copper link + * @hw: pointer to the HW structure + * + * Performs initial bounds checking on autoneg advertisement parameter, then + * configure to advertise the full capability. Setup the PHY to autoneg + * and restart the negotiation process between the link partner. If + * autoneg_wait_to_complete, then wait for autoneg to complete before exiting. + **/ +s32 e1000_copper_link_autoneg(struct e1000_hw *hw) +{ + struct e1000_phy_info *phy = &hw->phy; + s32 ret_val; + u16 phy_ctrl; + + DEBUGFUNC("e1000_copper_link_autoneg"); + + /* + * Perform some bounds checking on the autoneg advertisement + * parameter. + */ + phy->autoneg_advertised &= phy->autoneg_mask; + + /* + * If autoneg_advertised is zero, we assume it was not defaulted + * by the calling code so we set to advertise full capability. + */ + if (!phy->autoneg_advertised) + phy->autoneg_advertised = phy->autoneg_mask; + + DEBUGOUT("Reconfiguring auto-neg advertisement params\n"); + ret_val = e1000_phy_setup_autoneg(hw); + if (ret_val) { + DEBUGOUT("Error Setting up Auto-Negotiation\n"); + return ret_val; + } + DEBUGOUT("Restarting Auto-Neg\n"); + + /* + * Restart auto-negotiation by setting the Auto Neg Enable bit and + * the Auto Neg Restart bit in the PHY control register. + */ + ret_val = phy->ops.read_reg(hw, PHY_CONTROL, &phy_ctrl); + if (ret_val) + return ret_val; + + phy_ctrl |= (MII_CR_AUTO_NEG_EN | MII_CR_RESTART_AUTO_NEG); + ret_val = phy->ops.write_reg(hw, PHY_CONTROL, phy_ctrl); + if (ret_val) + return ret_val; + + /* + * Does the user want to wait for Auto-Neg to complete here, or + * check at a later time (for example, callback routine). + */ + if (phy->autoneg_wait_to_complete) { + ret_val = hw->mac.ops.wait_autoneg(hw); + if (ret_val) { + DEBUGOUT("Error while waiting for autoneg to complete\n"); + return ret_val; + } } -out: + hw->mac.get_link_status = TRUE; + return ret_val; } @@ -1479,7 +1699,7 @@ s32 e1000_setup_copper_link_generic(struct e1000_hw *hw) */ ret_val = e1000_copper_link_autoneg(hw); if (ret_val) - goto out; + return ret_val; } else { /* * PHY will be set to 10H, 10F, 100H or 100F @@ -1489,7 +1709,7 @@ s32 e1000_setup_copper_link_generic(struct e1000_hw *hw) ret_val = hw->phy.ops.force_speed_duplex(hw); if (ret_val) { DEBUGOUT("Error Forcing Speed and Duplex\n"); - goto out; + return ret_val; } } @@ -1497,22 +1717,19 @@ s32 e1000_setup_copper_link_generic(struct e1000_hw *hw) * Check link status. Wait up to 100 microseconds for link to become * valid. */ - ret_val = e1000_phy_has_link_generic(hw, - COPPER_LINK_UP_LIMIT, - 10, - &link); + ret_val = e1000_phy_has_link_generic(hw, COPPER_LINK_UP_LIMIT, 10, + &link); if (ret_val) - goto out; + return ret_val; if (link) { DEBUGOUT("Valid link established!!!\n"); - e1000_config_collision_dist_generic(hw); + hw->mac.ops.config_collision_dist(hw); ret_val = e1000_config_fc_after_link_up_generic(hw); } else { DEBUGOUT("Unable to establish link!!!\n"); } -out: return ret_val; } @@ -1535,13 +1752,13 @@ s32 e1000_phy_force_speed_duplex_igp(struct e1000_hw *hw) ret_val = phy->ops.read_reg(hw, PHY_CONTROL, &phy_data); if (ret_val) - goto out; + return ret_val; e1000_phy_force_speed_duplex_setup(hw, &phy_data); ret_val = phy->ops.write_reg(hw, PHY_CONTROL, phy_data); if (ret_val) - goto out; + return ret_val; /* * Clear Auto-Crossover to force MDI manually. IGP requires MDI @@ -1549,14 +1766,14 @@ s32 e1000_phy_force_speed_duplex_igp(struct e1000_hw *hw) */ ret_val = phy->ops.read_reg(hw, IGP01E1000_PHY_PORT_CTRL, &phy_data); if (ret_val) - goto out; + return ret_val; phy_data &= ~IGP01E1000_PSCR_AUTO_MDIX; phy_data &= ~IGP01E1000_PSCR_FORCE_MDI_MDIX; ret_val = phy->ops.write_reg(hw, IGP01E1000_PHY_PORT_CTRL, phy_data); if (ret_val) - goto out; + return ret_val; DEBUGOUT1("IGP PSCR: %X\n", phy_data); @@ -1565,26 +1782,19 @@ s32 e1000_phy_force_speed_duplex_igp(struct e1000_hw *hw) if (phy->autoneg_wait_to_complete) { DEBUGOUT("Waiting for forced speed/duplex link on IGP phy.\n"); - ret_val = e1000_phy_has_link_generic(hw, - PHY_FORCE_LIMIT, - 100000, - &link); + ret_val = e1000_phy_has_link_generic(hw, PHY_FORCE_LIMIT, + 100000, &link); if (ret_val) - goto out; + return ret_val; if (!link) DEBUGOUT("Link taking longer than expected.\n"); /* Try once more */ - ret_val = e1000_phy_has_link_generic(hw, - PHY_FORCE_LIMIT, - 100000, - &link); - if (ret_val) - goto out; + ret_val = e1000_phy_has_link_generic(hw, PHY_FORCE_LIMIT, + 100000, &link); } -out: return ret_val; } @@ -1613,43 +1823,55 @@ s32 e1000_phy_force_speed_duplex_m88(struct e1000_hw *hw) */ ret_val = phy->ops.read_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data); if (ret_val) - goto out; + return ret_val; phy_data &= ~M88E1000_PSCR_AUTO_X_MODE; ret_val = phy->ops.write_reg(hw, M88E1000_PHY_SPEC_CTRL, phy_data); if (ret_val) - goto out; + return ret_val; DEBUGOUT1("M88E1000 PSCR: %X\n", phy_data); ret_val = phy->ops.read_reg(hw, PHY_CONTROL, &phy_data); if (ret_val) - goto out; + return ret_val; e1000_phy_force_speed_duplex_setup(hw, &phy_data); ret_val = phy->ops.write_reg(hw, PHY_CONTROL, phy_data); if (ret_val) - goto out; + return ret_val; /* Reset the phy to commit changes. */ ret_val = hw->phy.ops.commit(hw); if (ret_val) - goto out; + return ret_val; if (phy->autoneg_wait_to_complete) { DEBUGOUT("Waiting for forced speed/duplex link on M88 phy.\n"); ret_val = e1000_phy_has_link_generic(hw, PHY_FORCE_LIMIT, - 100000, &link); + 100000, &link); if (ret_val) - goto out; + return ret_val; if (!link) { - if (hw->phy.type != e1000_phy_m88 || - hw->phy.id == I347AT4_E_PHY_ID || - hw->phy.id == M88E1340M_E_PHY_ID || - hw->phy.id == M88E1112_E_PHY_ID) { + bool reset_dsp = TRUE; + + switch (hw->phy.id) { + case I347AT4_E_PHY_ID: + case M88E1340M_E_PHY_ID: + case M88E1112_E_PHY_ID: + case I210_I_PHY_ID: + reset_dsp = FALSE; + break; + default: + if (hw->phy.type != e1000_phy_m88) + reset_dsp = FALSE; + break; + } + + if (!reset_dsp) { DEBUGOUT("Link taking longer than expected.\n"); } else { /* @@ -1660,29 +1882,32 @@ s32 e1000_phy_force_speed_duplex_m88(struct e1000_hw *hw) M88E1000_PHY_PAGE_SELECT, 0x001d); if (ret_val) - goto out; + return ret_val; ret_val = e1000_phy_reset_dsp_generic(hw); if (ret_val) - goto out; + return ret_val; } } /* Try once more */ ret_val = e1000_phy_has_link_generic(hw, PHY_FORCE_LIMIT, - 100000, &link); + 100000, &link); if (ret_val) - goto out; + return ret_val; } - if (hw->phy.type != e1000_phy_m88 || - hw->phy.id == I347AT4_E_PHY_ID || - hw->phy.id == M88E1340M_E_PHY_ID || - hw->phy.id == M88E1112_E_PHY_ID) - goto out; + if (hw->phy.type != e1000_phy_m88) + return E1000_SUCCESS; + if (hw->phy.id == I347AT4_E_PHY_ID || + hw->phy.id == M88E1340M_E_PHY_ID || + hw->phy.id == M88E1112_E_PHY_ID) + return E1000_SUCCESS; + if (hw->phy.id == I210_I_PHY_ID) + return E1000_SUCCESS; ret_val = phy->ops.read_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL, &phy_data); if (ret_val) - goto out; + return ret_val; /* * Resetting the phy means we need to re-force TX_CLK in the @@ -1692,7 +1917,7 @@ s32 e1000_phy_force_speed_duplex_m88(struct e1000_hw *hw) phy_data |= M88E1000_EPSCR_TX_CLK_25; ret_val = phy->ops.write_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL, phy_data); if (ret_val) - goto out; + return ret_val; /* * In addition, we must re-enable CRS on Tx for both half and full @@ -1700,12 +1925,11 @@ s32 e1000_phy_force_speed_duplex_m88(struct e1000_hw *hw) */ ret_val = phy->ops.read_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data); if (ret_val) - goto out; + return ret_val; phy_data |= M88E1000_PSCR_ASSERT_CRS_ON_TX; ret_val = phy->ops.write_reg(hw, M88E1000_PHY_SPEC_CTRL, phy_data); -out: return ret_val; } @@ -1728,25 +1952,25 @@ s32 e1000_phy_force_speed_duplex_ife(struct e1000_hw *hw) ret_val = phy->ops.read_reg(hw, PHY_CONTROL, &data); if (ret_val) - goto out; + return ret_val; e1000_phy_force_speed_duplex_setup(hw, &data); ret_val = phy->ops.write_reg(hw, PHY_CONTROL, data); if (ret_val) - goto out; + return ret_val; /* Disable MDI-X support for 10/100 */ ret_val = phy->ops.read_reg(hw, IFE_PHY_MDIX_CONTROL, &data); if (ret_val) - goto out; + return ret_val; data &= ~IFE_PMC_AUTO_MDIX; data &= ~IFE_PMC_FORCE_MDIX; ret_val = phy->ops.write_reg(hw, IFE_PHY_MDIX_CONTROL, data); if (ret_val) - goto out; + return ret_val; DEBUGOUT1("IFE PMC: %X\n", data); @@ -1755,27 +1979,22 @@ s32 e1000_phy_force_speed_duplex_ife(struct e1000_hw *hw) if (phy->autoneg_wait_to_complete) { DEBUGOUT("Waiting for forced speed/duplex link on IFE phy.\n"); - ret_val = e1000_phy_has_link_generic(hw, - PHY_FORCE_LIMIT, - 100000, - &link); + ret_val = e1000_phy_has_link_generic(hw, PHY_FORCE_LIMIT, + 100000, &link); if (ret_val) - goto out; + return ret_val; if (!link) DEBUGOUT("Link taking longer than expected.\n"); /* Try once more */ - ret_val = e1000_phy_has_link_generic(hw, - PHY_FORCE_LIMIT, - 100000, - &link); + ret_val = e1000_phy_has_link_generic(hw, PHY_FORCE_LIMIT, + 100000, &link); if (ret_val) - goto out; + return ret_val; } -out: - return ret_val; + return E1000_SUCCESS; } /** @@ -1835,7 +2054,7 @@ void e1000_phy_force_speed_duplex_setup(struct e1000_hw *hw, u16 *phy_ctrl) DEBUGOUT("Forcing 10mb\n"); } - e1000_config_collision_dist_generic(hw); + hw->mac.ops.config_collision_dist(hw); E1000_WRITE_REG(hw, E1000_CTRL, ctrl); } @@ -1857,24 +2076,24 @@ void e1000_phy_force_speed_duplex_setup(struct e1000_hw *hw, u16 *phy_ctrl) s32 e1000_set_d3_lplu_state_generic(struct e1000_hw *hw, bool active) { struct e1000_phy_info *phy = &hw->phy; - s32 ret_val = E1000_SUCCESS; + s32 ret_val; u16 data; DEBUGFUNC("e1000_set_d3_lplu_state_generic"); - if (!(hw->phy.ops.read_reg)) - goto out; + if (!hw->phy.ops.read_reg) + return E1000_SUCCESS; ret_val = phy->ops.read_reg(hw, IGP02E1000_PHY_POWER_MGMT, &data); if (ret_val) - goto out; + return ret_val; if (!active) { data &= ~IGP02E1000_PM_D3_LPLU; ret_val = phy->ops.write_reg(hw, IGP02E1000_PHY_POWER_MGMT, - data); + data); if (ret_val) - goto out; + return ret_val; /* * LPLU and SmartSpeed are mutually exclusive. LPLU is used * during Dx states where the power conservation is most @@ -1883,52 +2102,51 @@ s32 e1000_set_d3_lplu_state_generic(struct e1000_hw *hw, bool active) */ if (phy->smart_speed == e1000_smart_speed_on) { ret_val = phy->ops.read_reg(hw, - IGP01E1000_PHY_PORT_CONFIG, - &data); + IGP01E1000_PHY_PORT_CONFIG, + &data); if (ret_val) - goto out; + return ret_val; data |= IGP01E1000_PSCFR_SMART_SPEED; ret_val = phy->ops.write_reg(hw, - IGP01E1000_PHY_PORT_CONFIG, - data); + IGP01E1000_PHY_PORT_CONFIG, + data); if (ret_val) - goto out; + return ret_val; } else if (phy->smart_speed == e1000_smart_speed_off) { ret_val = phy->ops.read_reg(hw, - IGP01E1000_PHY_PORT_CONFIG, - &data); + IGP01E1000_PHY_PORT_CONFIG, + &data); if (ret_val) - goto out; + return ret_val; data &= ~IGP01E1000_PSCFR_SMART_SPEED; ret_val = phy->ops.write_reg(hw, - IGP01E1000_PHY_PORT_CONFIG, - data); + IGP01E1000_PHY_PORT_CONFIG, + data); if (ret_val) - goto out; + return ret_val; } } else if ((phy->autoneg_advertised == E1000_ALL_SPEED_DUPLEX) || - (phy->autoneg_advertised == E1000_ALL_NOT_GIG) || - (phy->autoneg_advertised == E1000_ALL_10_SPEED)) { + (phy->autoneg_advertised == E1000_ALL_NOT_GIG) || + (phy->autoneg_advertised == E1000_ALL_10_SPEED)) { data |= IGP02E1000_PM_D3_LPLU; ret_val = phy->ops.write_reg(hw, IGP02E1000_PHY_POWER_MGMT, - data); + data); if (ret_val) - goto out; + return ret_val; /* When LPLU is enabled, we should disable SmartSpeed */ ret_val = phy->ops.read_reg(hw, IGP01E1000_PHY_PORT_CONFIG, - &data); + &data); if (ret_val) - goto out; + return ret_val; data &= ~IGP01E1000_PSCFR_SMART_SPEED; ret_val = phy->ops.write_reg(hw, IGP01E1000_PHY_PORT_CONFIG, - data); + data); } -out: return ret_val; } @@ -1949,32 +2167,31 @@ s32 e1000_check_downshift_generic(struct e1000_hw *hw) DEBUGFUNC("e1000_check_downshift_generic"); switch (phy->type) { + case e1000_phy_i210: case e1000_phy_m88: case e1000_phy_gg82563: case e1000_phy_bm: case e1000_phy_82578: - offset = M88E1000_PHY_SPEC_STATUS; - mask = M88E1000_PSSR_DOWNSHIFT; + offset = M88E1000_PHY_SPEC_STATUS; + mask = M88E1000_PSSR_DOWNSHIFT; break; case e1000_phy_igp: case e1000_phy_igp_2: case e1000_phy_igp_3: - offset = IGP01E1000_PHY_LINK_HEALTH; - mask = IGP01E1000_PLHR_SS_DOWNGRADE; + offset = IGP01E1000_PHY_LINK_HEALTH; + mask = IGP01E1000_PLHR_SS_DOWNGRADE; break; default: /* speed downshift not supported */ phy->speed_downgraded = FALSE; - ret_val = E1000_SUCCESS; - goto out; + return E1000_SUCCESS; } ret_val = phy->ops.read_reg(hw, offset, &phy_data); if (!ret_val) - phy->speed_downgraded = (phy_data & mask) ? TRUE : FALSE; + phy->speed_downgraded = !!(phy_data & mask); -out: return ret_val; } @@ -1998,8 +2215,8 @@ s32 e1000_check_polarity_m88(struct e1000_hw *hw) if (!ret_val) phy->cable_polarity = (data & M88E1000_PSSR_REV_POLARITY) - ? e1000_rev_polarity_reversed - : e1000_rev_polarity_normal; + ? e1000_rev_polarity_reversed + : e1000_rev_polarity_normal; return ret_val; } @@ -2027,29 +2244,28 @@ s32 e1000_check_polarity_igp(struct e1000_hw *hw) */ ret_val = phy->ops.read_reg(hw, IGP01E1000_PHY_PORT_STATUS, &data); if (ret_val) - goto out; + return ret_val; if ((data & IGP01E1000_PSSR_SPEED_MASK) == IGP01E1000_PSSR_SPEED_1000MBPS) { - offset = IGP01E1000_PHY_PCS_INIT_REG; - mask = IGP01E1000_PHY_POLARITY_MASK; + offset = IGP01E1000_PHY_PCS_INIT_REG; + mask = IGP01E1000_PHY_POLARITY_MASK; } else { /* * This really only applies to 10Mbps since * there is no polarity for 100Mbps (always 0). */ - offset = IGP01E1000_PHY_PORT_STATUS; - mask = IGP01E1000_PSSR_POLARITY_REVERSED; + offset = IGP01E1000_PHY_PORT_STATUS; + mask = IGP01E1000_PSSR_POLARITY_REVERSED; } ret_val = phy->ops.read_reg(hw, offset, &data); if (!ret_val) phy->cable_polarity = (data & mask) - ? e1000_rev_polarity_reversed - : e1000_rev_polarity_normal; + ? e1000_rev_polarity_reversed + : e1000_rev_polarity_normal; -out: return ret_val; } @@ -2082,8 +2298,8 @@ s32 e1000_check_polarity_ife(struct e1000_hw *hw) if (!ret_val) phy->cable_polarity = (phy_data & mask) - ? e1000_rev_polarity_reversed - : e1000_rev_polarity_normal; + ? e1000_rev_polarity_reversed + : e1000_rev_polarity_normal; return ret_val; } @@ -2102,7 +2318,7 @@ s32 e1000_wait_autoneg_generic(struct e1000_hw *hw) DEBUGFUNC("e1000_wait_autoneg_generic"); - if (!(hw->phy.ops.read_reg)) + if (!hw->phy.ops.read_reg) return E1000_SUCCESS; /* Break after autoneg completes or PHY_AUTO_NEG_LIMIT expires. */ @@ -2135,14 +2351,14 @@ s32 e1000_wait_autoneg_generic(struct e1000_hw *hw) * Polls the PHY status register for link, 'iterations' number of times. **/ s32 e1000_phy_has_link_generic(struct e1000_hw *hw, u32 iterations, - u32 usec_interval, bool *success) + u32 usec_interval, bool *success) { s32 ret_val = E1000_SUCCESS; u16 i, phy_status; DEBUGFUNC("e1000_phy_has_link_generic"); - if (!(hw->phy.ops.read_reg)) + if (!hw->phy.ops.read_reg) return E1000_SUCCESS; for (i = 0; i < iterations; i++) { @@ -2170,7 +2386,7 @@ s32 e1000_phy_has_link_generic(struct e1000_hw *hw, u32 iterations, usec_delay(usec_interval); } - *success = (i < iterations) ? TRUE : FALSE; + *success = (i < iterations); return ret_val; } @@ -2200,22 +2416,20 @@ s32 e1000_get_cable_length_m88(struct e1000_hw *hw) ret_val = phy->ops.read_reg(hw, M88E1000_PHY_SPEC_STATUS, &phy_data); if (ret_val) - goto out; + return ret_val; index = (phy_data & M88E1000_PSSR_CABLE_LENGTH) >> - M88E1000_PSSR_CABLE_LENGTH_SHIFT; - if (index >= M88E1000_CABLE_LENGTH_TABLE_SIZE - 1) { - ret_val = -E1000_ERR_PHY; - goto out; - } + M88E1000_PSSR_CABLE_LENGTH_SHIFT; + + if (index >= M88E1000_CABLE_LENGTH_TABLE_SIZE - 1) + return -E1000_ERR_PHY; phy->min_cable_length = e1000_m88_cable_length_table[index]; phy->max_cable_length = e1000_m88_cable_length_table[index + 1]; phy->cable_length = (phy->min_cable_length + phy->max_cable_length) / 2; -out: - return ret_val; + return E1000_SUCCESS; } s32 e1000_get_cable_length_m88_gen2(struct e1000_hw *hw) @@ -2227,64 +2441,85 @@ s32 e1000_get_cable_length_m88_gen2(struct e1000_hw *hw) DEBUGFUNC("e1000_get_cable_length_m88_gen2"); switch (hw->phy.id) { + case I210_I_PHY_ID: + /* Get cable length from PHY Cable Diagnostics Control Reg */ + ret_val = phy->ops.read_reg(hw, (0x7 << GS40G_PAGE_SHIFT) + + (I347AT4_PCDL + phy->addr), + &phy_data); + if (ret_val) + return ret_val; + + /* Check if the unit of cable length is meters or cm */ + ret_val = phy->ops.read_reg(hw, (0x7 << GS40G_PAGE_SHIFT) + + I347AT4_PCDC, &phy_data2); + if (ret_val) + return ret_val; + + is_cm = !(phy_data2 & I347AT4_PCDC_CABLE_LENGTH_UNIT); + + /* Populate the phy structure with cable length in meters */ + phy->min_cable_length = phy_data / (is_cm ? 100 : 1); + phy->max_cable_length = phy_data / (is_cm ? 100 : 1); + phy->cable_length = phy_data / (is_cm ? 100 : 1); + break; case M88E1340M_E_PHY_ID: case I347AT4_E_PHY_ID: /* Remember the original page select and set it to 7 */ ret_val = phy->ops.read_reg(hw, I347AT4_PAGE_SELECT, &default_page); if (ret_val) - goto out; + return ret_val; ret_val = phy->ops.write_reg(hw, I347AT4_PAGE_SELECT, 0x07); if (ret_val) - goto out; + return ret_val; /* Get cable length from PHY Cable Diagnostics Control Reg */ ret_val = phy->ops.read_reg(hw, (I347AT4_PCDL + phy->addr), &phy_data); if (ret_val) - goto out; + return ret_val; /* Check if the unit of cable length is meters or cm */ ret_val = phy->ops.read_reg(hw, I347AT4_PCDC, &phy_data2); if (ret_val) - goto out; + return ret_val; - is_cm = !(phy_data & I347AT4_PCDC_CABLE_LENGTH_UNIT); + is_cm = !(phy_data2 & I347AT4_PCDC_CABLE_LENGTH_UNIT); /* Populate the phy structure with cable length in meters */ phy->min_cable_length = phy_data / (is_cm ? 100 : 1); phy->max_cable_length = phy_data / (is_cm ? 100 : 1); phy->cable_length = phy_data / (is_cm ? 100 : 1); - /* Reset the page selec to its original value */ + /* Reset the page select to its original value */ ret_val = phy->ops.write_reg(hw, I347AT4_PAGE_SELECT, default_page); if (ret_val) - goto out; + return ret_val; break; + case M88E1112_E_PHY_ID: /* Remember the original page select and set it to 5 */ ret_val = phy->ops.read_reg(hw, I347AT4_PAGE_SELECT, &default_page); if (ret_val) - goto out; + return ret_val; ret_val = phy->ops.write_reg(hw, I347AT4_PAGE_SELECT, 0x05); if (ret_val) - goto out; + return ret_val; ret_val = phy->ops.read_reg(hw, M88E1112_VCT_DSP_DISTANCE, &phy_data); if (ret_val) - goto out; + return ret_val; index = (phy_data & M88E1000_PSSR_CABLE_LENGTH) >> M88E1000_PSSR_CABLE_LENGTH_SHIFT; - if (index >= M88E1000_CABLE_LENGTH_TABLE_SIZE - 1) { - ret_val = -E1000_ERR_PHY; - goto out; - } + + if (index >= M88E1000_CABLE_LENGTH_TABLE_SIZE - 1) + return -E1000_ERR_PHY; phy->min_cable_length = e1000_m88_cable_length_table[index]; phy->max_cable_length = e1000_m88_cable_length_table[index + 1]; @@ -2296,15 +2531,13 @@ s32 e1000_get_cable_length_m88_gen2(struct e1000_hw *hw) ret_val = phy->ops.write_reg(hw, I347AT4_PAGE_SELECT, default_page); if (ret_val) - goto out; + return ret_val; break; default: - ret_val = -E1000_ERR_PHY; - goto out; + return -E1000_ERR_PHY; } -out: return ret_val; } @@ -2322,15 +2555,15 @@ out: s32 e1000_get_cable_length_igp_2(struct e1000_hw *hw) { struct e1000_phy_info *phy = &hw->phy; - s32 ret_val = E1000_SUCCESS; + s32 ret_val; u16 phy_data, i, agc_value = 0; u16 cur_agc_index, max_agc_index = 0; u16 min_agc_index = IGP02E1000_CABLE_LENGTH_TABLE_SIZE - 1; static const u16 agc_reg_array[IGP02E1000_PHY_CHANNEL_NUM] = { - IGP02E1000_PHY_AGC_A, - IGP02E1000_PHY_AGC_B, - IGP02E1000_PHY_AGC_C, - IGP02E1000_PHY_AGC_D + IGP02E1000_PHY_AGC_A, + IGP02E1000_PHY_AGC_B, + IGP02E1000_PHY_AGC_C, + IGP02E1000_PHY_AGC_D }; DEBUGFUNC("e1000_get_cable_length_igp_2"); @@ -2339,7 +2572,7 @@ s32 e1000_get_cable_length_igp_2(struct e1000_hw *hw) for (i = 0; i < IGP02E1000_PHY_CHANNEL_NUM; i++) { ret_val = phy->ops.read_reg(hw, agc_reg_array[i], &phy_data); if (ret_val) - goto out; + return ret_val; /* * Getting bits 15:9, which represent the combination of @@ -2348,14 +2581,12 @@ s32 e1000_get_cable_length_igp_2(struct e1000_hw *hw) * approximate cable length. */ cur_agc_index = (phy_data >> IGP02E1000_AGC_LENGTH_SHIFT) & - IGP02E1000_AGC_LENGTH_MASK; + IGP02E1000_AGC_LENGTH_MASK; /* Array index bound check. */ if ((cur_agc_index >= IGP02E1000_CABLE_LENGTH_TABLE_SIZE) || - (cur_agc_index == 0)) { - ret_val = -E1000_ERR_PHY; - goto out; - } + (cur_agc_index == 0)) + return -E1000_ERR_PHY; /* Remove min & max AGC values from calculation. */ if (e1000_igp_2_cable_length_table[min_agc_index] > @@ -2369,18 +2600,17 @@ s32 e1000_get_cable_length_igp_2(struct e1000_hw *hw) } agc_value -= (e1000_igp_2_cable_length_table[min_agc_index] + - e1000_igp_2_cable_length_table[max_agc_index]); + e1000_igp_2_cable_length_table[max_agc_index]); agc_value /= (IGP02E1000_PHY_CHANNEL_NUM - 2); /* Calculate cable length with the error range of +/- 10 meters. */ phy->min_cable_length = ((agc_value - IGP02E1000_AGC_RANGE) > 0) ? - (agc_value - IGP02E1000_AGC_RANGE) : 0; + (agc_value - IGP02E1000_AGC_RANGE) : 0; phy->max_cable_length = agc_value + IGP02E1000_AGC_RANGE; phy->cable_length = (phy->min_cable_length + phy->max_cable_length) / 2; -out: - return ret_val; + return E1000_SUCCESS; } /** @@ -2404,53 +2634,51 @@ s32 e1000_get_phy_info_m88(struct e1000_hw *hw) if (phy->media_type != e1000_media_type_copper) { DEBUGOUT("Phy info is only valid for copper media\n"); - ret_val = -E1000_ERR_CONFIG; - goto out; + return -E1000_ERR_CONFIG; } ret_val = e1000_phy_has_link_generic(hw, 1, 0, &link); if (ret_val) - goto out; + return ret_val; if (!link) { DEBUGOUT("Phy info is only valid if link is up\n"); - ret_val = -E1000_ERR_CONFIG; - goto out; + return -E1000_ERR_CONFIG; } ret_val = phy->ops.read_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data); if (ret_val) - goto out; + return ret_val; - phy->polarity_correction = (phy_data & M88E1000_PSCR_POLARITY_REVERSAL) - ? TRUE : FALSE; + phy->polarity_correction = !!(phy_data & + M88E1000_PSCR_POLARITY_REVERSAL); ret_val = e1000_check_polarity_m88(hw); if (ret_val) - goto out; + return ret_val; ret_val = phy->ops.read_reg(hw, M88E1000_PHY_SPEC_STATUS, &phy_data); if (ret_val) - goto out; + return ret_val; - phy->is_mdix = (phy_data & M88E1000_PSSR_MDIX) ? TRUE : FALSE; + phy->is_mdix = !!(phy_data & M88E1000_PSSR_MDIX); if ((phy_data & M88E1000_PSSR_SPEED) == M88E1000_PSSR_1000MBS) { ret_val = hw->phy.ops.get_cable_length(hw); if (ret_val) - goto out; + return ret_val; ret_val = phy->ops.read_reg(hw, PHY_1000T_STATUS, &phy_data); if (ret_val) - goto out; + return ret_val; phy->local_rx = (phy_data & SR_1000T_LOCAL_RX_STATUS) - ? e1000_1000t_rx_status_ok - : e1000_1000t_rx_status_not_ok; + ? e1000_1000t_rx_status_ok + : e1000_1000t_rx_status_not_ok; phy->remote_rx = (phy_data & SR_1000T_REMOTE_RX_STATUS) - ? e1000_1000t_rx_status_ok - : e1000_1000t_rx_status_not_ok; + ? e1000_1000t_rx_status_ok + : e1000_1000t_rx_status_not_ok; } else { /* Set values to "undefined" */ phy->cable_length = E1000_CABLE_LENGTH_UNDEFINED; @@ -2458,7 +2686,6 @@ s32 e1000_get_phy_info_m88(struct e1000_hw *hw) phy->remote_rx = e1000_1000t_rx_status_undefined; } -out: return ret_val; } @@ -2482,50 +2709,48 @@ s32 e1000_get_phy_info_igp(struct e1000_hw *hw) ret_val = e1000_phy_has_link_generic(hw, 1, 0, &link); if (ret_val) - goto out; + return ret_val; if (!link) { DEBUGOUT("Phy info is only valid if link is up\n"); - ret_val = -E1000_ERR_CONFIG; - goto out; + return -E1000_ERR_CONFIG; } phy->polarity_correction = TRUE; ret_val = e1000_check_polarity_igp(hw); if (ret_val) - goto out; + return ret_val; ret_val = phy->ops.read_reg(hw, IGP01E1000_PHY_PORT_STATUS, &data); if (ret_val) - goto out; + return ret_val; - phy->is_mdix = (data & IGP01E1000_PSSR_MDIX) ? TRUE : FALSE; + phy->is_mdix = !!(data & IGP01E1000_PSSR_MDIX); if ((data & IGP01E1000_PSSR_SPEED_MASK) == IGP01E1000_PSSR_SPEED_1000MBPS) { ret_val = phy->ops.get_cable_length(hw); if (ret_val) - goto out; + return ret_val; ret_val = phy->ops.read_reg(hw, PHY_1000T_STATUS, &data); if (ret_val) - goto out; + return ret_val; phy->local_rx = (data & SR_1000T_LOCAL_RX_STATUS) - ? e1000_1000t_rx_status_ok - : e1000_1000t_rx_status_not_ok; + ? e1000_1000t_rx_status_ok + : e1000_1000t_rx_status_not_ok; phy->remote_rx = (data & SR_1000T_REMOTE_RX_STATUS) - ? e1000_1000t_rx_status_ok - : e1000_1000t_rx_status_not_ok; + ? e1000_1000t_rx_status_ok + : e1000_1000t_rx_status_not_ok; } else { phy->cable_length = E1000_CABLE_LENGTH_UNDEFINED; phy->local_rx = e1000_1000t_rx_status_undefined; phy->remote_rx = e1000_1000t_rx_status_undefined; } -out: return ret_val; } @@ -2546,44 +2771,41 @@ s32 e1000_get_phy_info_ife(struct e1000_hw *hw) ret_val = e1000_phy_has_link_generic(hw, 1, 0, &link); if (ret_val) - goto out; + return ret_val; if (!link) { DEBUGOUT("Phy info is only valid if link is up\n"); - ret_val = -E1000_ERR_CONFIG; - goto out; + return -E1000_ERR_CONFIG; } ret_val = phy->ops.read_reg(hw, IFE_PHY_SPECIAL_CONTROL, &data); if (ret_val) - goto out; - phy->polarity_correction = (data & IFE_PSC_AUTO_POLARITY_DISABLE) - ? FALSE : TRUE; + return ret_val; + phy->polarity_correction = !(data & IFE_PSC_AUTO_POLARITY_DISABLE); if (phy->polarity_correction) { ret_val = e1000_check_polarity_ife(hw); if (ret_val) - goto out; + return ret_val; } else { /* Polarity is forced */ phy->cable_polarity = (data & IFE_PSC_FORCE_POLARITY) - ? e1000_rev_polarity_reversed - : e1000_rev_polarity_normal; + ? e1000_rev_polarity_reversed + : e1000_rev_polarity_normal; } ret_val = phy->ops.read_reg(hw, IFE_PHY_MDIX_CONTROL, &data); if (ret_val) - goto out; + return ret_val; - phy->is_mdix = (data & IFE_PMC_MDIX_STATUS) ? TRUE : FALSE; + phy->is_mdix = !!(data & IFE_PMC_MDIX_STATUS); /* The following parameters are undefined for 10/100 operation. */ phy->cable_length = E1000_CABLE_LENGTH_UNDEFINED; phy->local_rx = e1000_1000t_rx_status_undefined; phy->remote_rx = e1000_1000t_rx_status_undefined; -out: - return ret_val; + return E1000_SUCCESS; } /** @@ -2595,26 +2817,25 @@ out: **/ s32 e1000_phy_sw_reset_generic(struct e1000_hw *hw) { - s32 ret_val = E1000_SUCCESS; + s32 ret_val; u16 phy_ctrl; DEBUGFUNC("e1000_phy_sw_reset_generic"); - if (!(hw->phy.ops.read_reg)) - goto out; + if (!hw->phy.ops.read_reg) + return E1000_SUCCESS; ret_val = hw->phy.ops.read_reg(hw, PHY_CONTROL, &phy_ctrl); if (ret_val) - goto out; + return ret_val; phy_ctrl |= MII_CR_RESET; ret_val = hw->phy.ops.write_reg(hw, PHY_CONTROL, phy_ctrl); if (ret_val) - goto out; + return ret_val; usec_delay(1); -out: return ret_val; } @@ -2630,20 +2851,20 @@ out: s32 e1000_phy_hw_reset_generic(struct e1000_hw *hw) { struct e1000_phy_info *phy = &hw->phy; - s32 ret_val = E1000_SUCCESS; + s32 ret_val; u32 ctrl; DEBUGFUNC("e1000_phy_hw_reset_generic"); - ret_val = phy->ops.check_reset_block(hw); - if (ret_val) { - ret_val = E1000_SUCCESS; - goto out; + if (phy->ops.check_reset_block) { + ret_val = phy->ops.check_reset_block(hw); + if (ret_val) + return E1000_SUCCESS; } ret_val = phy->ops.acquire(hw); if (ret_val) - goto out; + return ret_val; ctrl = E1000_READ_REG(hw, E1000_CTRL); E1000_WRITE_REG(hw, E1000_CTRL, ctrl | E1000_CTRL_PHY_RST); @@ -2658,10 +2879,7 @@ s32 e1000_phy_hw_reset_generic(struct e1000_hw *hw) phy->ops.release(hw); - ret_val = phy->ops.get_cfg_done(hw); - -out: - return ret_val; + return phy->ops.get_cfg_done(hw); } /** @@ -2815,6 +3033,9 @@ enum e1000_phy_type e1000_get_phy_type_from_id(u32 phy_id) case I82580_I_PHY_ID: phy_type = e1000_phy_82580; break; + case I210_I_PHY_ID: + phy_type = e1000_phy_i210; + break; default: phy_type = e1000_phy_unknown; break; @@ -2832,7 +3053,6 @@ enum e1000_phy_type e1000_get_phy_type_from_id(u32 phy_id) **/ s32 e1000_determine_phy_address(struct e1000_hw *hw) { - s32 ret_val = -E1000_ERR_PHY_TYPE; u32 phy_addr = 0; u32 i; enum e1000_phy_type phy_type = e1000_phy_unknown; @@ -2851,17 +3071,15 @@ s32 e1000_determine_phy_address(struct e1000_hw *hw) * If phy_type is valid, break - we found our * PHY address */ - if (phy_type != e1000_phy_unknown) { - ret_val = E1000_SUCCESS; - goto out; - } + if (phy_type != e1000_phy_unknown) + return E1000_SUCCESS; + msec_delay(1); i++; } while (i < 10); } -out: - return ret_val; + return -E1000_ERR_PHY_TYPE; } /** @@ -2903,8 +3121,8 @@ s32 e1000_write_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 data) /* Page 800 works differently than the rest so it has its own func */ if (page == BM_WUC_PAGE) { ret_val = e1000_access_phy_wakeup_reg_bm(hw, offset, &data, - FALSE); - goto out; + FALSE, FALSE); + goto release; } hw->phy.addr = e1000_get_phy_addr_for_bm_page(page, offset); @@ -2927,15 +3145,15 @@ s32 e1000_write_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 data) /* Page is shifted left, PHY expects (page x 32) */ ret_val = e1000_write_phy_reg_mdic(hw, page_select, - (page << page_shift)); + (page << page_shift)); if (ret_val) - goto out; + goto release; } ret_val = e1000_write_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, - data); + data); -out: +release: hw->phy.ops.release(hw); return ret_val; } @@ -2964,8 +3182,8 @@ s32 e1000_read_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 *data) /* Page 800 works differently than the rest so it has its own func */ if (page == BM_WUC_PAGE) { ret_val = e1000_access_phy_wakeup_reg_bm(hw, offset, data, - TRUE); - goto out; + TRUE, FALSE); + goto release; } hw->phy.addr = e1000_get_phy_addr_for_bm_page(page, offset); @@ -2988,14 +3206,14 @@ s32 e1000_read_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 *data) /* Page is shifted left, PHY expects (page x 32) */ ret_val = e1000_write_phy_reg_mdic(hw, page_select, - (page << page_shift)); + (page << page_shift)); if (ret_val) - goto out; + goto release; } ret_val = e1000_read_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, - data); -out: + data); +release: hw->phy.ops.release(hw); return ret_val; } @@ -3015,7 +3233,7 @@ s32 e1000_read_phy_reg_bm2(struct e1000_hw *hw, u32 offset, u16 *data) s32 ret_val; u16 page = (u16)(offset >> IGP_PAGE_SHIFT); - DEBUGFUNC("e1000_write_phy_reg_bm2"); + DEBUGFUNC("e1000_read_phy_reg_bm2"); ret_val = hw->phy.ops.acquire(hw); if (ret_val) @@ -3024,8 +3242,8 @@ s32 e1000_read_phy_reg_bm2(struct e1000_hw *hw, u32 offset, u16 *data) /* Page 800 works differently than the rest so it has its own func */ if (page == BM_WUC_PAGE) { ret_val = e1000_access_phy_wakeup_reg_bm(hw, offset, data, - TRUE); - goto out; + TRUE, FALSE); + goto release; } hw->phy.addr = 1; @@ -3034,15 +3252,15 @@ s32 e1000_read_phy_reg_bm2(struct e1000_hw *hw, u32 offset, u16 *data) /* Page is shifted left, PHY expects (page x 32) */ ret_val = e1000_write_phy_reg_mdic(hw, BM_PHY_PAGE_SELECT, - page); + page); if (ret_val) - goto out; + goto release; } ret_val = e1000_read_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, - data); -out: + data); +release: hw->phy.ops.release(hw); return ret_val; } @@ -3070,8 +3288,8 @@ s32 e1000_write_phy_reg_bm2(struct e1000_hw *hw, u32 offset, u16 data) /* Page 800 works differently than the rest so it has its own func */ if (page == BM_WUC_PAGE) { ret_val = e1000_access_phy_wakeup_reg_bm(hw, offset, &data, - FALSE); - goto out; + FALSE, FALSE); + goto release; } hw->phy.addr = 1; @@ -3079,41 +3297,140 @@ s32 e1000_write_phy_reg_bm2(struct e1000_hw *hw, u32 offset, u16 data) if (offset > MAX_PHY_MULTI_PAGE_REG) { /* Page is shifted left, PHY expects (page x 32) */ ret_val = e1000_write_phy_reg_mdic(hw, BM_PHY_PAGE_SELECT, - page); + page); if (ret_val) - goto out; + goto release; } ret_val = e1000_write_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, - data); + data); -out: +release: hw->phy.ops.release(hw); return ret_val; } /** - * e1000_access_phy_wakeup_reg_bm - Read BM PHY wakeup register + * e1000_enable_phy_wakeup_reg_access_bm - enable access to BM wakeup registers + * @hw: pointer to the HW structure + * @phy_reg: pointer to store original contents of BM_WUC_ENABLE_REG + * + * Assumes semaphore already acquired and phy_reg points to a valid memory + * address to store contents of the BM_WUC_ENABLE_REG register. + **/ +s32 e1000_enable_phy_wakeup_reg_access_bm(struct e1000_hw *hw, u16 *phy_reg) +{ + s32 ret_val; + u16 temp; + + DEBUGFUNC("e1000_enable_phy_wakeup_reg_access_bm"); + + if (!phy_reg) + return -E1000_ERR_PARAM; + + /* All page select, port ctrl and wakeup registers use phy address 1 */ + hw->phy.addr = 1; + + /* Select Port Control Registers page */ + ret_val = e1000_set_page_igp(hw, (BM_PORT_CTRL_PAGE << IGP_PAGE_SHIFT)); + if (ret_val) { + DEBUGOUT("Could not set Port Control page\n"); + return ret_val; + } + + ret_val = e1000_read_phy_reg_mdic(hw, BM_WUC_ENABLE_REG, phy_reg); + if (ret_val) { + DEBUGOUT2("Could not read PHY register %d.%d\n", + BM_PORT_CTRL_PAGE, BM_WUC_ENABLE_REG); + return ret_val; + } + + /* + * Enable both PHY wakeup mode and Wakeup register page writes. + * Prevent a power state change by disabling ME and Host PHY wakeup. + */ + temp = *phy_reg; + temp |= BM_WUC_ENABLE_BIT; + temp &= ~(BM_WUC_ME_WU_BIT | BM_WUC_HOST_WU_BIT); + + ret_val = e1000_write_phy_reg_mdic(hw, BM_WUC_ENABLE_REG, temp); + if (ret_val) { + DEBUGOUT2("Could not write PHY register %d.%d\n", + BM_PORT_CTRL_PAGE, BM_WUC_ENABLE_REG); + return ret_val; + } + + /* + * Select Host Wakeup Registers page - caller now able to write + * registers on the Wakeup registers page + */ + return e1000_set_page_igp(hw, (BM_WUC_PAGE << IGP_PAGE_SHIFT)); +} + +/** + * e1000_disable_phy_wakeup_reg_access_bm - disable access to BM wakeup regs + * @hw: pointer to the HW structure + * @phy_reg: pointer to original contents of BM_WUC_ENABLE_REG + * + * Restore BM_WUC_ENABLE_REG to its original value. + * + * Assumes semaphore already acquired and *phy_reg is the contents of the + * BM_WUC_ENABLE_REG before register(s) on BM_WUC_PAGE were accessed by + * caller. + **/ +s32 e1000_disable_phy_wakeup_reg_access_bm(struct e1000_hw *hw, u16 *phy_reg) +{ + s32 ret_val = E1000_SUCCESS; + + DEBUGFUNC("e1000_disable_phy_wakeup_reg_access_bm"); + + if (!phy_reg) + return -E1000_ERR_PARAM; + + /* Select Port Control Registers page */ + ret_val = e1000_set_page_igp(hw, (BM_PORT_CTRL_PAGE << IGP_PAGE_SHIFT)); + if (ret_val) { + DEBUGOUT("Could not set Port Control page\n"); + return ret_val; + } + + /* Restore 769.17 to its original value */ + ret_val = e1000_write_phy_reg_mdic(hw, BM_WUC_ENABLE_REG, *phy_reg); + if (ret_val) + DEBUGOUT2("Could not restore PHY register %d.%d\n", + BM_PORT_CTRL_PAGE, BM_WUC_ENABLE_REG); + + return ret_val; +} + +/** + * e1000_access_phy_wakeup_reg_bm - Read/write BM PHY wakeup register * @hw: pointer to the HW structure * @offset: register offset to be read or written * @data: pointer to the data to read or write * @read: determines if operation is read or write + * @page_set: BM_WUC_PAGE already set and access enabled * - * Acquires semaphore, if necessary, then reads the PHY register at offset - * and storing the retrieved information in data. Release any acquired - * semaphores before exiting. Note that procedure to read the wakeup - * registers are different. It works as such: - * 1) Set page 769, register 17, bit 2 = 1 + * Read the PHY register at offset and store the retrieved information in + * data, or write data to PHY register at offset. Note the procedure to + * access the PHY wakeup registers is different than reading the other PHY + * registers. It works as such: + * 1) Set 769.17.2 (page 769, register 17, bit 2) = 1 * 2) Set page to 800 for host (801 if we were manageability) * 3) Write the address using the address opcode (0x11) * 4) Read or write the data using the data opcode (0x12) - * 5) Restore 769_17.2 to its original value + * 5) Restore 769.17.2 to its original value * - * Assumes semaphore already acquired. + * Steps 1 and 2 are done by e1000_enable_phy_wakeup_reg_access_bm() and + * step 5 is done by e1000_disable_phy_wakeup_reg_access_bm(). + * + * Assumes semaphore is already acquired. When page_set==TRUE, assumes + * the PHY page is set to BM_WUC_PAGE (i.e. a function in the call stack + * is responsible for calls to e1000_[enable|disable]_phy_wakeup_reg_bm()). **/ static s32 e1000_access_phy_wakeup_reg_bm(struct e1000_hw *hw, u32 offset, - u16 *data, bool read) + u16 *data, bool read, bool page_set) { s32 ret_val; u16 reg = BM_PHY_REG_NUM(offset); @@ -3121,81 +3438,48 @@ static s32 e1000_access_phy_wakeup_reg_bm(struct e1000_hw *hw, u32 offset, DEBUGFUNC("e1000_access_phy_wakeup_reg_bm"); - /* Gig must be disabled for MDIO accesses to page 800 */ + /* Gig must be disabled for MDIO accesses to Host Wakeup reg page */ if ((hw->mac.type == e1000_pchlan) && (!(E1000_READ_REG(hw, E1000_PHY_CTRL) & E1000_PHY_CTRL_GBE_DISABLE))) - DEBUGOUT("Attempting to access page 800 while gig enabled.\n"); + DEBUGOUT1("Attempting to access page %d while gig enabled.\n", + page); - /* All operations in this function are phy address 1 */ - hw->phy.addr = 1; - - /* Set page 769 */ - e1000_write_phy_reg_mdic(hw, IGP01E1000_PHY_PAGE_SELECT, - (BM_WUC_ENABLE_PAGE << IGP_PAGE_SHIFT)); - - ret_val = e1000_read_phy_reg_mdic(hw, BM_WUC_ENABLE_REG, &phy_reg); - if (ret_val) { - DEBUGOUT("Could not read PHY page 769\n"); - goto out; + if (!page_set) { + /* Enable access to PHY wakeup registers */ + ret_val = e1000_enable_phy_wakeup_reg_access_bm(hw, &phy_reg); + if (ret_val) { + DEBUGOUT("Could not enable PHY wakeup reg access\n"); + return ret_val; + } } - /* First clear bit 4 to avoid a power state change */ - phy_reg &= ~(BM_WUC_HOST_WU_BIT); - ret_val = e1000_write_phy_reg_mdic(hw, BM_WUC_ENABLE_REG, phy_reg); - if (ret_val) { - DEBUGOUT("Could not clear PHY page 769 bit 4\n"); - goto out; - } + DEBUGOUT2("Accessing PHY page %d reg 0x%x\n", page, reg); - /* Write bit 2 = 1, and clear bit 4 to 769_17 */ - ret_val = e1000_write_phy_reg_mdic(hw, BM_WUC_ENABLE_REG, - phy_reg | BM_WUC_ENABLE_BIT); - if (ret_val) { - DEBUGOUT("Could not write PHY page 769 bit 2\n"); - goto out; - } - - /* Select page 800 */ - ret_val = e1000_write_phy_reg_mdic(hw, IGP01E1000_PHY_PAGE_SELECT, - (BM_WUC_PAGE << IGP_PAGE_SHIFT)); - - /* Write the page 800 offset value using opcode 0x11 */ + /* Write the Wakeup register page offset value using opcode 0x11 */ ret_val = e1000_write_phy_reg_mdic(hw, BM_WUC_ADDRESS_OPCODE, reg); if (ret_val) { - DEBUGOUT("Could not write address opcode to page 800\n"); - goto out; + DEBUGOUT1("Could not write address opcode to page %d\n", page); + return ret_val; } if (read) { - /* Read the page 800 value using opcode 0x12 */ + /* Read the Wakeup register page value using opcode 0x12 */ ret_val = e1000_read_phy_reg_mdic(hw, BM_WUC_DATA_OPCODE, - data); + data); } else { - /* Write the page 800 value using opcode 0x12 */ + /* Write the Wakeup register page value using opcode 0x12 */ ret_val = e1000_write_phy_reg_mdic(hw, BM_WUC_DATA_OPCODE, - *data); + *data); } if (ret_val) { - DEBUGOUT("Could not access data value from page 800\n"); - goto out; + DEBUGOUT2("Could not access PHY reg %d.%d\n", page, reg); + return ret_val; } - /* - * Restore 769_17.2 to its original value - * Set page 769 - */ - e1000_write_phy_reg_mdic(hw, IGP01E1000_PHY_PAGE_SELECT, - (BM_WUC_ENABLE_PAGE << IGP_PAGE_SHIFT)); + if (!page_set) + ret_val = e1000_disable_phy_wakeup_reg_access_bm(hw, &phy_reg); - /* Clear 769_17.2 */ - ret_val = e1000_write_phy_reg_mdic(hw, BM_WUC_ENABLE_REG, phy_reg); - if (ret_val) { - DEBUGOUT("Could not clear PHY page 769 bit 2\n"); - goto out; - } - -out: return ret_val; } @@ -3210,10 +3494,16 @@ out: void e1000_power_up_phy_copper(struct e1000_hw *hw) { u16 mii_reg = 0; + u16 power_reg = 0; /* The PHY will retain its settings across a power down/up cycle */ hw->phy.ops.read_reg(hw, PHY_CONTROL, &mii_reg); mii_reg &= ~MII_CR_POWER_DOWN; + if (hw->phy.type == e1000_phy_i210) { + hw->phy.ops.read_reg(hw, GS40G_COPPER_SPEC, &power_reg); + power_reg &= ~GS40G_CS_POWER_DOWN; + hw->phy.ops.write_reg(hw, GS40G_COPPER_SPEC, power_reg); + } hw->phy.ops.write_reg(hw, PHY_CONTROL, mii_reg); } @@ -3228,10 +3518,17 @@ void e1000_power_up_phy_copper(struct e1000_hw *hw) void e1000_power_down_phy_copper(struct e1000_hw *hw) { u16 mii_reg = 0; + u16 power_reg = 0; /* The PHY will retain its settings across a power down/up cycle */ hw->phy.ops.read_reg(hw, PHY_CONTROL, &mii_reg); mii_reg |= MII_CR_POWER_DOWN; + /* i210 Phy requires an additional bit for power up/down */ + if (hw->phy.type == e1000_phy_i210) { + hw->phy.ops.read_reg(hw, GS40G_COPPER_SPEC, &power_reg); + power_reg |= GS40G_CS_POWER_DOWN; + hw->phy.ops.write_reg(hw, GS40G_COPPER_SPEC, power_reg); + } hw->phy.ops.write_reg(hw, PHY_CONTROL, mii_reg); msec_delay(1); } @@ -3248,11 +3545,12 @@ void e1000_power_down_phy_copper(struct e1000_hw *hw) * semaphore before exiting. **/ static s32 __e1000_read_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 *data, - bool locked) + bool locked, bool page_set) { s32 ret_val; u16 page = BM_PHY_REG_PAGE(offset); u16 reg = BM_PHY_REG_NUM(offset); + u32 phy_addr = hw->phy.addr = e1000_get_phy_addr_for_hv_page(page); DEBUGFUNC("__e1000_read_phy_reg_hv"); @@ -3264,39 +3562,38 @@ static s32 __e1000_read_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 *data, /* Page 800 works differently than the rest so it has its own func */ if (page == BM_WUC_PAGE) { - ret_val = e1000_access_phy_wakeup_reg_bm(hw, offset, - data, TRUE); + ret_val = e1000_access_phy_wakeup_reg_bm(hw, offset, data, + TRUE, page_set); goto out; } if (page > 0 && page < HV_INTC_FC_PAGE_START) { ret_val = e1000_access_phy_debug_regs_hv(hw, offset, - data, TRUE); + data, TRUE); goto out; } - hw->phy.addr = e1000_get_phy_addr_for_hv_page(page); + if (!page_set) { + if (page == HV_INTC_FC_PAGE_START) + page = 0; - if (page == HV_INTC_FC_PAGE_START) - page = 0; + if (reg > MAX_PHY_MULTI_PAGE_REG) { + /* Page is shifted left, PHY expects (page x 32) */ + ret_val = e1000_set_page_igp(hw, + (page << IGP_PAGE_SHIFT)); - if (reg > MAX_PHY_MULTI_PAGE_REG) { - u32 phy_addr = hw->phy.addr; + hw->phy.addr = phy_addr; - hw->phy.addr = 1; - - /* Page is shifted left, PHY expects (page x 32) */ - ret_val = e1000_write_phy_reg_mdic(hw, - IGP01E1000_PHY_PAGE_SELECT, - (page << IGP_PAGE_SHIFT)); - hw->phy.addr = phy_addr; - - if (ret_val) - goto out; + if (ret_val) + goto out; + } } + DEBUGOUT3("reading PHY page %d (or 0x%x shifted) reg 0x%x\n", page, + page << IGP_PAGE_SHIFT, reg); + ret_val = e1000_read_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & reg, - data); + data); out: if (!locked) hw->phy.ops.release(hw); @@ -3316,7 +3613,7 @@ out: **/ s32 e1000_read_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 *data) { - return __e1000_read_phy_reg_hv(hw, offset, data, FALSE); + return __e1000_read_phy_reg_hv(hw, offset, data, FALSE, FALSE); } /** @@ -3330,7 +3627,21 @@ s32 e1000_read_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 *data) **/ s32 e1000_read_phy_reg_hv_locked(struct e1000_hw *hw, u32 offset, u16 *data) { - return __e1000_read_phy_reg_hv(hw, offset, data, TRUE); + return __e1000_read_phy_reg_hv(hw, offset, data, TRUE, FALSE); +} + +/** + * e1000_read_phy_reg_page_hv - Read HV PHY register + * @hw: pointer to the HW structure + * @offset: register offset to write to + * @data: data to write at register offset + * + * Reads the PHY register at offset and stores the retrieved information + * in data. Assumes semaphore already acquired and page already set. + **/ +s32 e1000_read_phy_reg_page_hv(struct e1000_hw *hw, u32 offset, u16 *data) +{ + return __e1000_read_phy_reg_hv(hw, offset, data, TRUE, true); } /** @@ -3344,11 +3655,12 @@ s32 e1000_read_phy_reg_hv_locked(struct e1000_hw *hw, u32 offset, u16 *data) * at the offset. Release any acquired semaphores before exiting. **/ static s32 __e1000_write_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 data, - bool locked) + bool locked, bool page_set) { s32 ret_val; u16 page = BM_PHY_REG_PAGE(offset); u16 reg = BM_PHY_REG_NUM(offset); + u32 phy_addr = hw->phy.addr = e1000_get_phy_addr_for_hv_page(page); DEBUGFUNC("__e1000_write_phy_reg_hv"); @@ -3360,55 +3672,55 @@ static s32 __e1000_write_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 data, /* Page 800 works differently than the rest so it has its own func */ if (page == BM_WUC_PAGE) { - ret_val = e1000_access_phy_wakeup_reg_bm(hw, offset, - &data, FALSE); + ret_val = e1000_access_phy_wakeup_reg_bm(hw, offset, &data, + FALSE, page_set); goto out; } if (page > 0 && page < HV_INTC_FC_PAGE_START) { ret_val = e1000_access_phy_debug_regs_hv(hw, offset, - &data, FALSE); + &data, FALSE); goto out; } - hw->phy.addr = e1000_get_phy_addr_for_hv_page(page); + if (!page_set) { + if (page == HV_INTC_FC_PAGE_START) + page = 0; - if (page == HV_INTC_FC_PAGE_START) - page = 0; + /* + * Workaround MDIO accesses being disabled after entering IEEE + * Power Down (when bit 11 of the PHY Control register is set) + */ + if ((hw->phy.type == e1000_phy_82578) && + (hw->phy.revision >= 1) && + (hw->phy.addr == 2) && + !(MAX_PHY_REG_ADDRESS & reg) && + (data & (1 << 11))) { + u16 data2 = 0x7EFF; + ret_val = e1000_access_phy_debug_regs_hv(hw, + (1 << 6) | 0x3, + &data2, FALSE); + if (ret_val) + goto out; + } - /* - * Workaround MDIO accesses being disabled after entering IEEE Power - * Down (whenever bit 11 of the PHY Control register is set) - */ - if ((hw->phy.type == e1000_phy_82578) && - (hw->phy.revision >= 1) && - (hw->phy.addr == 2) && - ((MAX_PHY_REG_ADDRESS & reg) == 0) && - (data & (1 << 11))) { - u16 data2 = 0x7EFF; - ret_val = e1000_access_phy_debug_regs_hv(hw, (1 << 6) | 0x3, - &data2, FALSE); - if (ret_val) - goto out; + if (reg > MAX_PHY_MULTI_PAGE_REG) { + /* Page is shifted left, PHY expects (page x 32) */ + ret_val = e1000_set_page_igp(hw, + (page << IGP_PAGE_SHIFT)); + + hw->phy.addr = phy_addr; + + if (ret_val) + goto out; + } } - if (reg > MAX_PHY_MULTI_PAGE_REG) { - u32 phy_addr = hw->phy.addr; - - hw->phy.addr = 1; - - /* Page is shifted left, PHY expects (page x 32) */ - ret_val = e1000_write_phy_reg_mdic(hw, - IGP01E1000_PHY_PAGE_SELECT, - (page << IGP_PAGE_SHIFT)); - hw->phy.addr = phy_addr; - - if (ret_val) - goto out; - } + DEBUGOUT3("writing PHY page %d (or 0x%x shifted) reg 0x%x\n", page, + page << IGP_PAGE_SHIFT, reg); ret_val = e1000_write_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & reg, - data); + data); out: if (!locked) @@ -3428,7 +3740,7 @@ out: **/ s32 e1000_write_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 data) { - return __e1000_write_phy_reg_hv(hw, offset, data, FALSE); + return __e1000_write_phy_reg_hv(hw, offset, data, FALSE, FALSE); } /** @@ -3442,7 +3754,21 @@ s32 e1000_write_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 data) **/ s32 e1000_write_phy_reg_hv_locked(struct e1000_hw *hw, u32 offset, u16 data) { - return __e1000_write_phy_reg_hv(hw, offset, data, TRUE); + return __e1000_write_phy_reg_hv(hw, offset, data, TRUE, FALSE); +} + +/** + * e1000_write_phy_reg_page_hv - Write HV PHY register + * @hw: pointer to the HW structure + * @offset: register offset to write to + * @data: data to write at register offset + * + * Writes the data to PHY register at the offset. Assumes semaphore + * already acquired and page already set. + **/ +s32 e1000_write_phy_reg_page_hv(struct e1000_hw *hw, u32 offset, u16 data) +{ + return __e1000_write_phy_reg_hv(hw, offset, data, TRUE, true); } /** @@ -3464,14 +3790,15 @@ static u32 e1000_get_phy_addr_for_hv_page(u32 page) * @hw: pointer to the HW structure * @offset: register offset to be read or written * @data: pointer to the data to be read or written - * @read: determines if operation is read or written + * @read: determines if operation is read or write * * Reads the PHY register at offset and stores the retreived information * in data. Assumes semaphore already acquired. Note that the procedure - * to read these regs uses the address port and data port to read/write. + * to access these regs uses the address port and data port to read/write. + * These accesses done with PHY address 2 and without using pages. **/ static s32 e1000_access_phy_debug_regs_hv(struct e1000_hw *hw, u32 offset, - u16 *data, bool read) + u16 *data, bool read) { s32 ret_val; u32 addr_reg = 0; @@ -3481,7 +3808,7 @@ static s32 e1000_access_phy_debug_regs_hv(struct e1000_hw *hw, u32 offset, /* This takes care of the difference with desktop vs mobile phy */ addr_reg = (hw->phy.type == e1000_phy_82578) ? - I82578_ADDR_REG : I82577_ADDR_REG; + I82578_ADDR_REG : I82577_ADDR_REG; data_reg = addr_reg + 1; /* All operations in this function are phy address 2 */ @@ -3490,8 +3817,8 @@ static s32 e1000_access_phy_debug_regs_hv(struct e1000_hw *hw, u32 offset, /* masking with 0x3F to remove the page from offset */ ret_val = e1000_write_phy_reg_mdic(hw, addr_reg, (u16)offset & 0x3F); if (ret_val) { - DEBUGOUT("Could not write PHY the HV address register\n"); - goto out; + DEBUGOUT("Could not write the Address Offset port register\n"); + return ret_val; } /* Read or write the data value next */ @@ -3500,12 +3827,9 @@ static s32 e1000_access_phy_debug_regs_hv(struct e1000_hw *hw, u32 offset, else ret_val = e1000_write_phy_reg_mdic(hw, data_reg, *data); - if (ret_val) { - DEBUGOUT("Could not read data value from HV data register\n"); - goto out; - } + if (ret_val) + DEBUGOUT("Could not access the Data port register\n"); -out: return ret_val; } @@ -3528,41 +3852,36 @@ s32 e1000_link_stall_workaround_hv(struct e1000_hw *hw) DEBUGFUNC("e1000_link_stall_workaround_hv"); if (hw->phy.type != e1000_phy_82578) - goto out; + return E1000_SUCCESS; /* Do not apply workaround if in PHY loopback bit 14 set */ hw->phy.ops.read_reg(hw, PHY_CONTROL, &data); if (data & PHY_CONTROL_LB) - goto out; + return E1000_SUCCESS; /* check if link is up and at 1Gbps */ ret_val = hw->phy.ops.read_reg(hw, BM_CS_STATUS, &data); if (ret_val) - goto out; + return ret_val; - data &= BM_CS_STATUS_LINK_UP | - BM_CS_STATUS_RESOLVED | - BM_CS_STATUS_SPEED_MASK; + data &= BM_CS_STATUS_LINK_UP | BM_CS_STATUS_RESOLVED | + BM_CS_STATUS_SPEED_MASK; - if (data != (BM_CS_STATUS_LINK_UP | - BM_CS_STATUS_RESOLVED | - BM_CS_STATUS_SPEED_1000)) - goto out; + if (data != (BM_CS_STATUS_LINK_UP | BM_CS_STATUS_RESOLVED | + BM_CS_STATUS_SPEED_1000)) + return E1000_SUCCESS; msec_delay(200); /* flush the packets in the fifo buffer */ ret_val = hw->phy.ops.write_reg(hw, HV_MUX_DATA_CTRL, - HV_MUX_DATA_CTRL_GEN_TO_MAC | - HV_MUX_DATA_CTRL_FORCE_SPEED); + HV_MUX_DATA_CTRL_GEN_TO_MAC | + HV_MUX_DATA_CTRL_FORCE_SPEED); if (ret_val) - goto out; + return ret_val; - ret_val = hw->phy.ops.write_reg(hw, HV_MUX_DATA_CTRL, - HV_MUX_DATA_CTRL_GEN_TO_MAC); - -out: - return ret_val; + return hw->phy.ops.write_reg(hw, HV_MUX_DATA_CTRL, + HV_MUX_DATA_CTRL_GEN_TO_MAC); } /** @@ -3585,8 +3904,8 @@ s32 e1000_check_polarity_82577(struct e1000_hw *hw) if (!ret_val) phy->cable_polarity = (data & I82577_PHY_STATUS2_REV_POLARITY) - ? e1000_rev_polarity_reversed - : e1000_rev_polarity_normal; + ? e1000_rev_polarity_reversed + : e1000_rev_polarity_normal; return ret_val; } @@ -3608,39 +3927,32 @@ s32 e1000_phy_force_speed_duplex_82577(struct e1000_hw *hw) ret_val = phy->ops.read_reg(hw, PHY_CONTROL, &phy_data); if (ret_val) - goto out; + return ret_val; e1000_phy_force_speed_duplex_setup(hw, &phy_data); ret_val = phy->ops.write_reg(hw, PHY_CONTROL, phy_data); if (ret_val) - goto out; + return ret_val; usec_delay(1); if (phy->autoneg_wait_to_complete) { DEBUGOUT("Waiting for forced speed/duplex link on 82577 phy\n"); - ret_val = e1000_phy_has_link_generic(hw, - PHY_FORCE_LIMIT, - 100000, - &link); + ret_val = e1000_phy_has_link_generic(hw, PHY_FORCE_LIMIT, + 100000, &link); if (ret_val) - goto out; + return ret_val; if (!link) DEBUGOUT("Link taking longer than expected.\n"); /* Try once more */ - ret_val = e1000_phy_has_link_generic(hw, - PHY_FORCE_LIMIT, - 100000, - &link); - if (ret_val) - goto out; + ret_val = e1000_phy_has_link_generic(hw, PHY_FORCE_LIMIT, + 100000, &link); } -out: return ret_val; } @@ -3664,51 +3976,49 @@ s32 e1000_get_phy_info_82577(struct e1000_hw *hw) ret_val = e1000_phy_has_link_generic(hw, 1, 0, &link); if (ret_val) - goto out; + return ret_val; if (!link) { DEBUGOUT("Phy info is only valid if link is up\n"); - ret_val = -E1000_ERR_CONFIG; - goto out; + return -E1000_ERR_CONFIG; } phy->polarity_correction = TRUE; ret_val = e1000_check_polarity_82577(hw); if (ret_val) - goto out; + return ret_val; ret_val = phy->ops.read_reg(hw, I82577_PHY_STATUS_2, &data); if (ret_val) - goto out; + return ret_val; - phy->is_mdix = (data & I82577_PHY_STATUS2_MDIX) ? TRUE : FALSE; + phy->is_mdix = !!(data & I82577_PHY_STATUS2_MDIX); if ((data & I82577_PHY_STATUS2_SPEED_MASK) == I82577_PHY_STATUS2_SPEED_1000MBPS) { ret_val = hw->phy.ops.get_cable_length(hw); if (ret_val) - goto out; + return ret_val; ret_val = phy->ops.read_reg(hw, PHY_1000T_STATUS, &data); if (ret_val) - goto out; + return ret_val; phy->local_rx = (data & SR_1000T_LOCAL_RX_STATUS) - ? e1000_1000t_rx_status_ok - : e1000_1000t_rx_status_not_ok; + ? e1000_1000t_rx_status_ok + : e1000_1000t_rx_status_not_ok; phy->remote_rx = (data & SR_1000T_REMOTE_RX_STATUS) - ? e1000_1000t_rx_status_ok - : e1000_1000t_rx_status_not_ok; + ? e1000_1000t_rx_status_ok + : e1000_1000t_rx_status_not_ok; } else { phy->cable_length = E1000_CABLE_LENGTH_UNDEFINED; phy->local_rx = e1000_1000t_rx_status_undefined; phy->remote_rx = e1000_1000t_rx_status_undefined; } -out: - return ret_val; + return E1000_SUCCESS; } /** @@ -3728,16 +4038,78 @@ s32 e1000_get_cable_length_82577(struct e1000_hw *hw) ret_val = phy->ops.read_reg(hw, I82577_PHY_DIAG_STATUS, &phy_data); if (ret_val) - goto out; + return ret_val; length = (phy_data & I82577_DSTATUS_CABLE_LENGTH) >> - I82577_DSTATUS_CABLE_LENGTH_SHIFT; + I82577_DSTATUS_CABLE_LENGTH_SHIFT; if (length == E1000_CABLE_LENGTH_UNDEFINED) ret_val = -E1000_ERR_PHY; phy->cable_length = length; -out: + return E1000_SUCCESS; +} + +/** + * e1000_write_phy_reg_gs40g - Write GS40G PHY register + * @hw: pointer to the HW structure + * @offset: register offset to write to + * @data: data to write at register offset + * + * Acquires semaphore, if necessary, then writes the data to PHY register + * at the offset. Release any acquired semaphores before exiting. + **/ +s32 e1000_write_phy_reg_gs40g(struct e1000_hw *hw, u32 offset, u16 data) +{ + s32 ret_val; + u16 page = offset >> GS40G_PAGE_SHIFT; + + DEBUGFUNC("e1000_write_phy_reg_gs40g"); + + offset = offset & GS40G_OFFSET_MASK; + ret_val = hw->phy.ops.acquire(hw); + if (ret_val) + return ret_val; + + ret_val = e1000_write_phy_reg_mdic(hw, GS40G_PAGE_SELECT, page); + if (ret_val) + goto release; + ret_val = e1000_write_phy_reg_mdic(hw, offset, data); + +release: + hw->phy.ops.release(hw); + return ret_val; +} + +/** + * e1000_read_phy_reg_gs40g - Read GS40G PHY register + * @hw: pointer to the HW structure + * @offset: lower half is register offset to read to + * upper half is page to use. + * @data: data to read at register offset + * + * Acquires semaphore, if necessary, then reads the data in the PHY register + * at the offset. Release any acquired semaphores before exiting. + **/ +s32 e1000_read_phy_reg_gs40g(struct e1000_hw *hw, u32 offset, u16 *data) +{ + s32 ret_val; + u16 page = offset >> GS40G_PAGE_SHIFT; + + DEBUGFUNC("e1000_read_phy_reg_gs40g"); + + offset = offset & GS40G_OFFSET_MASK; + ret_val = hw->phy.ops.acquire(hw); + if (ret_val) + return ret_val; + + ret_val = e1000_write_phy_reg_mdic(hw, GS40G_PAGE_SELECT, page); + if (ret_val) + goto release; + ret_val = e1000_read_phy_reg_mdic(hw, offset, data); + +release: + hw->phy.ops.release(hw); return ret_val; } diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_phy.h b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_phy.h index 24ba69b938..edcbcabe44 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_phy.h +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_phy.h @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2010, Intel Corporation + Copyright (c) 2001-2012, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -30,7 +30,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: src/sys/dev/e1000/e1000_phy.h,v 1.4.2.3.2.1 2010/12/21 17:09:25 kensmith Exp $*/ +/*$FreeBSD$*/ #ifndef _E1000_PHY_H_ #define _E1000_PHY_H_ @@ -40,6 +40,11 @@ s32 e1000_null_read_reg(struct e1000_hw *hw, u32 offset, u16 *data); void e1000_null_phy_generic(struct e1000_hw *hw); s32 e1000_null_lplu_state(struct e1000_hw *hw, bool active); s32 e1000_null_write_reg(struct e1000_hw *hw, u32 offset, u16 data); +s32 e1000_null_set_page(struct e1000_hw *hw, u16 data); +s32 e1000_read_i2c_byte_null(struct e1000_hw *hw, u8 byte_offset, + u8 dev_addr, u8 *data); +s32 e1000_write_i2c_byte_null(struct e1000_hw *hw, u8 byte_offset, + u8 dev_addr, u8 data); s32 e1000_check_downshift_generic(struct e1000_hw *hw); s32 e1000_check_polarity_m88(struct e1000_hw *hw); s32 e1000_check_polarity_igp(struct e1000_hw *hw); @@ -67,6 +72,7 @@ s32 e1000_phy_hw_reset_generic(struct e1000_hw *hw); s32 e1000_phy_reset_dsp_generic(struct e1000_hw *hw); s32 e1000_read_kmrn_reg_generic(struct e1000_hw *hw, u32 offset, u16 *data); s32 e1000_read_kmrn_reg_locked(struct e1000_hw *hw, u32 offset, u16 *data); +s32 e1000_set_page_igp(struct e1000_hw *hw, u16 page); s32 e1000_read_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 *data); s32 e1000_read_phy_reg_igp_locked(struct e1000_hw *hw, u32 offset, u16 *data); s32 e1000_read_phy_reg_m88(struct e1000_hw *hw, u32 offset, u16 *data); @@ -80,12 +86,14 @@ s32 e1000_write_phy_reg_igp_locked(struct e1000_hw *hw, u32 offset, u16 data); s32 e1000_write_phy_reg_m88(struct e1000_hw *hw, u32 offset, u16 data); s32 e1000_phy_reset_dsp(struct e1000_hw *hw); s32 e1000_phy_has_link_generic(struct e1000_hw *hw, u32 iterations, - u32 usec_interval, bool *success); + u32 usec_interval, bool *success); s32 e1000_phy_init_script_igp3(struct e1000_hw *hw); enum e1000_phy_type e1000_get_phy_type_from_id(u32 phy_id); s32 e1000_determine_phy_address(struct e1000_hw *hw); s32 e1000_write_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 data); s32 e1000_read_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 *data); +s32 e1000_enable_phy_wakeup_reg_access_bm(struct e1000_hw *hw, u16 *phy_reg); +s32 e1000_disable_phy_wakeup_reg_access_bm(struct e1000_hw *hw, u16 *phy_reg); s32 e1000_read_phy_reg_bm2(struct e1000_hw *hw, u32 offset, u16 *data); s32 e1000_write_phy_reg_bm2(struct e1000_hw *hw, u32 offset, u16 data); void e1000_power_up_phy_copper(struct e1000_hw *hw); @@ -94,45 +102,62 @@ s32 e1000_read_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 *data); s32 e1000_write_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 data); s32 e1000_read_phy_reg_i2c(struct e1000_hw *hw, u32 offset, u16 *data); s32 e1000_write_phy_reg_i2c(struct e1000_hw *hw, u32 offset, u16 data); +s32 e1000_read_sfp_data_byte(struct e1000_hw *hw, u16 offset, u8 *data); +s32 e1000_write_sfp_data_byte(struct e1000_hw *hw, u16 offset, u8 data); s32 e1000_read_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 *data); s32 e1000_read_phy_reg_hv_locked(struct e1000_hw *hw, u32 offset, u16 *data); +s32 e1000_read_phy_reg_page_hv(struct e1000_hw *hw, u32 offset, u16 *data); s32 e1000_write_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 data); s32 e1000_write_phy_reg_hv_locked(struct e1000_hw *hw, u32 offset, u16 data); +s32 e1000_write_phy_reg_page_hv(struct e1000_hw *hw, u32 offset, u16 data); s32 e1000_link_stall_workaround_hv(struct e1000_hw *hw); s32 e1000_copper_link_setup_82577(struct e1000_hw *hw); s32 e1000_check_polarity_82577(struct e1000_hw *hw); s32 e1000_get_phy_info_82577(struct e1000_hw *hw); s32 e1000_phy_force_speed_duplex_82577(struct e1000_hw *hw); s32 e1000_get_cable_length_82577(struct e1000_hw *hw); +s32 e1000_write_phy_reg_gs40g(struct e1000_hw *hw, u32 offset, u16 data); +s32 e1000_read_phy_reg_gs40g(struct e1000_hw *hw, u32 offset, u16 *data); -#define E1000_MAX_PHY_ADDR 4 +#define E1000_MAX_PHY_ADDR 8 /* IGP01E1000 Specific Registers */ -#define IGP01E1000_PHY_PORT_CONFIG 0x10 /* Port Config */ -#define IGP01E1000_PHY_PORT_STATUS 0x11 /* Status */ -#define IGP01E1000_PHY_PORT_CTRL 0x12 /* Control */ -#define IGP01E1000_PHY_LINK_HEALTH 0x13 /* PHY Link Health */ -#define IGP01E1000_GMII_FIFO 0x14 /* GMII FIFO */ -#define IGP01E1000_PHY_CHANNEL_QUALITY 0x15 /* PHY Channel Quality */ -#define IGP02E1000_PHY_POWER_MGMT 0x19 /* Power Management */ -#define IGP01E1000_PHY_PAGE_SELECT 0x1F /* Page Select */ -#define BM_PHY_PAGE_SELECT 22 /* Page Select for BM */ -#define IGP_PAGE_SHIFT 5 -#define PHY_REG_MASK 0x1F +#define IGP01E1000_PHY_PORT_CONFIG 0x10 /* Port Config */ +#define IGP01E1000_PHY_PORT_STATUS 0x11 /* Status */ +#define IGP01E1000_PHY_PORT_CTRL 0x12 /* Control */ +#define IGP01E1000_PHY_LINK_HEALTH 0x13 /* PHY Link Health */ +#define IGP01E1000_GMII_FIFO 0x14 /* GMII FIFO */ +#define IGP01E1000_PHY_CHANNEL_QUALITY 0x15 /* PHY Channel Quality */ +#define IGP02E1000_PHY_POWER_MGMT 0x19 /* Power Management */ +#define IGP01E1000_PHY_PAGE_SELECT 0x1F /* Page Select */ +#define BM_PHY_PAGE_SELECT 22 /* Page Select for BM */ +#define IGP_PAGE_SHIFT 5 +#define PHY_REG_MASK 0x1F + +/* GS40G - I210 PHY defines */ +#define GS40G_PAGE_SELECT 0x16 +#define GS40G_PAGE_SHIFT 16 +#define GS40G_OFFSET_MASK 0xFFFF +#define GS40G_PAGE_2 0x20000 +#define GS40G_MAC_REG2 0x15 +#define GS40G_MAC_LB 0x4140 +#define GS40G_MAC_SPEED_1G 0X0006 +#define GS40G_COPPER_SPEC 0x0010 +#define GS40G_CS_POWER_DOWN 0x0002 /* BM/HV Specific Registers */ -#define BM_PORT_CTRL_PAGE 769 -#define BM_PORT_GEN_CFG_REG PHY_REG(BM_PORT_CTRL_PAGE, 17) -#define BM_PCIE_PAGE 770 -#define BM_WUC_PAGE 800 -#define BM_WUC_ADDRESS_OPCODE 0x11 -#define BM_WUC_DATA_OPCODE 0x12 -#define BM_WUC_ENABLE_PAGE BM_PORT_CTRL_PAGE -#define BM_WUC_ENABLE_REG 17 -#define BM_WUC_ENABLE_BIT (1 << 2) -#define BM_WUC_HOST_WU_BIT (1 << 4) +#define BM_PORT_CTRL_PAGE 769 +#define BM_PCIE_PAGE 770 +#define BM_WUC_PAGE 800 +#define BM_WUC_ADDRESS_OPCODE 0x11 +#define BM_WUC_DATA_OPCODE 0x12 +#define BM_WUC_ENABLE_PAGE BM_PORT_CTRL_PAGE +#define BM_WUC_ENABLE_REG 17 +#define BM_WUC_ENABLE_BIT (1 << 2) +#define BM_WUC_HOST_WU_BIT (1 << 4) +#define BM_WUC_ME_WU_BIT (1 << 5) -#define PHY_UPPER_SHIFT 21 +#define PHY_UPPER_SHIFT 21 #define BM_PHY_REG(page, reg) \ (((reg) & MAX_PHY_REG_ADDRESS) |\ (((page) & 0xFFFF) << PHY_PAGE_SHIFT) |\ @@ -144,132 +169,157 @@ s32 e1000_get_cable_length_82577(struct e1000_hw *hw); (((offset) >> (PHY_UPPER_SHIFT - PHY_PAGE_SHIFT)) &\ ~MAX_PHY_REG_ADDRESS))) -#define HV_INTC_FC_PAGE_START 768 -#define I82578_ADDR_REG 29 -#define I82577_ADDR_REG 16 -#define I82577_CFG_REG 22 -#define I82577_CFG_ASSERT_CRS_ON_TX (1 << 15) -#define I82577_CFG_ENABLE_DOWNSHIFT (3 << 10) /* auto downshift 100/10 */ -#define I82577_CTRL_REG 23 +#define HV_INTC_FC_PAGE_START 768 +#define I82578_ADDR_REG 29 +#define I82577_ADDR_REG 16 +#define I82577_CFG_REG 22 +#define I82577_CFG_ASSERT_CRS_ON_TX (1 << 15) +#define I82577_CFG_ENABLE_DOWNSHIFT (3 << 10) /* auto downshift 100/10 */ +#define I82577_CTRL_REG 23 /* 82577 specific PHY registers */ -#define I82577_PHY_CTRL_2 18 -#define I82577_PHY_LBK_CTRL 19 -#define I82577_PHY_STATUS_2 26 -#define I82577_PHY_DIAG_STATUS 31 +#define I82577_PHY_CTRL_2 18 +#define I82577_PHY_LBK_CTRL 19 +#define I82577_PHY_STATUS_2 26 +#define I82577_PHY_DIAG_STATUS 31 /* I82577 PHY Status 2 */ -#define I82577_PHY_STATUS2_REV_POLARITY 0x0400 -#define I82577_PHY_STATUS2_MDIX 0x0800 -#define I82577_PHY_STATUS2_SPEED_MASK 0x0300 -#define I82577_PHY_STATUS2_SPEED_1000MBPS 0x0200 -#define I82577_PHY_STATUS2_SPEED_100MBPS 0x0100 +#define I82577_PHY_STATUS2_REV_POLARITY 0x0400 +#define I82577_PHY_STATUS2_MDIX 0x0800 +#define I82577_PHY_STATUS2_SPEED_MASK 0x0300 +#define I82577_PHY_STATUS2_SPEED_1000MBPS 0x0200 +#define I82577_PHY_STATUS2_SPEED_100MBPS 0x0100 /* I82577 PHY Control 2 */ -#define I82577_PHY_CTRL2_AUTO_MDIX 0x0400 -#define I82577_PHY_CTRL2_FORCE_MDI_MDIX 0x0200 +#define I82577_PHY_CTRL2_MANUAL_MDIX 0x0200 +#define I82577_PHY_CTRL2_AUTO_MDI_MDIX 0x0400 +#define I82577_PHY_CTRL2_MDIX_CFG_MASK 0x0600 /* I82577 PHY Diagnostics Status */ -#define I82577_DSTATUS_CABLE_LENGTH 0x03FC -#define I82577_DSTATUS_CABLE_LENGTH_SHIFT 2 +#define I82577_DSTATUS_CABLE_LENGTH 0x03FC +#define I82577_DSTATUS_CABLE_LENGTH_SHIFT 2 /* 82580 PHY Power Management */ -#define E1000_82580_PHY_POWER_MGMT 0xE14 -#define E1000_82580_PM_SPD 0x0001 /* Smart Power Down */ -#define E1000_82580_PM_D0_LPLU 0x0002 /* For D0a states */ -#define E1000_82580_PM_D3_LPLU 0x0004 /* For all other states */ +#define E1000_82580_PHY_POWER_MGMT 0xE14 +#define E1000_82580_PM_SPD 0x0001 /* Smart Power Down */ +#define E1000_82580_PM_D0_LPLU 0x0002 /* For D0a states */ +#define E1000_82580_PM_D3_LPLU 0x0004 /* For all other states */ /* BM PHY Copper Specific Control 1 */ -#define BM_CS_CTRL1 16 -#define BM_CS_CTRL1_ENERGY_DETECT 0x0300 /* Enable Energy Detect */ +#define BM_CS_CTRL1 16 +#define BM_CS_CTRL1_ENERGY_DETECT 0x0300 /* Enable Energy Detect */ /* BM PHY Copper Specific Status */ -#define BM_CS_STATUS 17 -#define BM_CS_STATUS_ENERGY_DETECT 0x0010 /* Energy Detect Status */ -#define BM_CS_STATUS_LINK_UP 0x0400 -#define BM_CS_STATUS_RESOLVED 0x0800 -#define BM_CS_STATUS_SPEED_MASK 0xC000 -#define BM_CS_STATUS_SPEED_1000 0x8000 +#define BM_CS_STATUS 17 +#define BM_CS_STATUS_ENERGY_DETECT 0x0010 /* Energy Detect Status */ +#define BM_CS_STATUS_LINK_UP 0x0400 +#define BM_CS_STATUS_RESOLVED 0x0800 +#define BM_CS_STATUS_SPEED_MASK 0xC000 +#define BM_CS_STATUS_SPEED_1000 0x8000 /* 82577 Mobile Phy Status Register */ -#define HV_M_STATUS 26 -#define HV_M_STATUS_AUTONEG_COMPLETE 0x1000 -#define HV_M_STATUS_SPEED_MASK 0x0300 -#define HV_M_STATUS_SPEED_1000 0x0200 -#define HV_M_STATUS_LINK_UP 0x0040 +#define HV_M_STATUS 26 +#define HV_M_STATUS_AUTONEG_COMPLETE 0x1000 +#define HV_M_STATUS_SPEED_MASK 0x0300 +#define HV_M_STATUS_SPEED_1000 0x0200 +#define HV_M_STATUS_LINK_UP 0x0040 -#define IGP01E1000_PHY_PCS_INIT_REG 0x00B4 -#define IGP01E1000_PHY_POLARITY_MASK 0x0078 +#define IGP01E1000_PHY_PCS_INIT_REG 0x00B4 +#define IGP01E1000_PHY_POLARITY_MASK 0x0078 -#define IGP01E1000_PSCR_AUTO_MDIX 0x1000 -#define IGP01E1000_PSCR_FORCE_MDI_MDIX 0x2000 /* 0=MDI, 1=MDIX */ +#define IGP01E1000_PSCR_AUTO_MDIX 0x1000 +#define IGP01E1000_PSCR_FORCE_MDI_MDIX 0x2000 /* 0=MDI, 1=MDIX */ -#define IGP01E1000_PSCFR_SMART_SPEED 0x0080 +#define IGP01E1000_PSCFR_SMART_SPEED 0x0080 /* Enable flexible speed on link-up */ -#define IGP01E1000_GMII_FLEX_SPD 0x0010 -#define IGP01E1000_GMII_SPD 0x0020 /* Enable SPD */ +#define IGP01E1000_GMII_FLEX_SPD 0x0010 +#define IGP01E1000_GMII_SPD 0x0020 /* Enable SPD */ -#define IGP02E1000_PM_SPD 0x0001 /* Smart Power Down */ -#define IGP02E1000_PM_D0_LPLU 0x0002 /* For D0a states */ -#define IGP02E1000_PM_D3_LPLU 0x0004 /* For all other states */ +#define IGP02E1000_PM_SPD 0x0001 /* Smart Power Down */ +#define IGP02E1000_PM_D0_LPLU 0x0002 /* For D0a states */ +#define IGP02E1000_PM_D3_LPLU 0x0004 /* For all other states */ -#define IGP01E1000_PLHR_SS_DOWNGRADE 0x8000 +#define IGP01E1000_PLHR_SS_DOWNGRADE 0x8000 -#define IGP01E1000_PSSR_POLARITY_REVERSED 0x0002 -#define IGP01E1000_PSSR_MDIX 0x0800 -#define IGP01E1000_PSSR_SPEED_MASK 0xC000 -#define IGP01E1000_PSSR_SPEED_1000MBPS 0xC000 +#define IGP01E1000_PSSR_POLARITY_REVERSED 0x0002 +#define IGP01E1000_PSSR_MDIX 0x0800 +#define IGP01E1000_PSSR_SPEED_MASK 0xC000 +#define IGP01E1000_PSSR_SPEED_1000MBPS 0xC000 -#define IGP02E1000_PHY_CHANNEL_NUM 4 -#define IGP02E1000_PHY_AGC_A 0x11B1 -#define IGP02E1000_PHY_AGC_B 0x12B1 -#define IGP02E1000_PHY_AGC_C 0x14B1 -#define IGP02E1000_PHY_AGC_D 0x18B1 +#define IGP02E1000_PHY_CHANNEL_NUM 4 +#define IGP02E1000_PHY_AGC_A 0x11B1 +#define IGP02E1000_PHY_AGC_B 0x12B1 +#define IGP02E1000_PHY_AGC_C 0x14B1 +#define IGP02E1000_PHY_AGC_D 0x18B1 -#define IGP02E1000_AGC_LENGTH_SHIFT 9 /* Course - 15:13, Fine - 12:9 */ -#define IGP02E1000_AGC_LENGTH_MASK 0x7F -#define IGP02E1000_AGC_RANGE 15 +#define IGP02E1000_AGC_LENGTH_SHIFT 9 /* Course - 15:13, Fine - 12:9 */ +#define IGP02E1000_AGC_LENGTH_MASK 0x7F +#define IGP02E1000_AGC_RANGE 15 -#define IGP03E1000_PHY_MISC_CTRL 0x1B -#define IGP03E1000_PHY_MISC_DUPLEX_MANUAL_SET 0x1000 /* Manually Set Duplex */ +#define IGP03E1000_PHY_MISC_CTRL 0x1B +#define IGP03E1000_PHY_MISC_DUPLEX_MANUAL_SET 0x1000 /* Manually Set Duplex */ -#define E1000_CABLE_LENGTH_UNDEFINED 0xFF +#define E1000_CABLE_LENGTH_UNDEFINED 0xFF -#define E1000_KMRNCTRLSTA_OFFSET 0x001F0000 -#define E1000_KMRNCTRLSTA_OFFSET_SHIFT 16 -#define E1000_KMRNCTRLSTA_REN 0x00200000 -#define E1000_KMRNCTRLSTA_CTRL_OFFSET 0x1 /* Kumeran Control */ -#define E1000_KMRNCTRLSTA_DIAG_OFFSET 0x3 /* Kumeran Diagnostic */ -#define E1000_KMRNCTRLSTA_TIMEOUTS 0x4 /* Kumeran Timeouts */ -#define E1000_KMRNCTRLSTA_INBAND_PARAM 0x9 /* Kumeran InBand Parameters */ -#define E1000_KMRNCTRLSTA_IBIST_DISABLE 0x0200 /* Kumeran IBIST Disable */ -#define E1000_KMRNCTRLSTA_DIAG_NELPBK 0x1000 /* Nearend Loopback mode */ -#define E1000_KMRNCTRLSTA_K1_CONFIG 0x7 -#define E1000_KMRNCTRLSTA_K1_ENABLE 0x0002 -#define E1000_KMRNCTRLSTA_HD_CTRL 0x10 /* Kumeran HD Control */ +#define E1000_KMRNCTRLSTA_OFFSET 0x001F0000 +#define E1000_KMRNCTRLSTA_OFFSET_SHIFT 16 +#define E1000_KMRNCTRLSTA_REN 0x00200000 +#define E1000_KMRNCTRLSTA_CTRL_OFFSET 0x1 /* Kumeran Control */ +#define E1000_KMRNCTRLSTA_DIAG_OFFSET 0x3 /* Kumeran Diagnostic */ +#define E1000_KMRNCTRLSTA_TIMEOUTS 0x4 /* Kumeran Timeouts */ +#define E1000_KMRNCTRLSTA_INBAND_PARAM 0x9 /* Kumeran InBand Parameters */ +#define E1000_KMRNCTRLSTA_IBIST_DISABLE 0x0200 /* Kumeran IBIST Disable */ +#define E1000_KMRNCTRLSTA_DIAG_NELPBK 0x1000 /* Nearend Loopback mode */ +#define E1000_KMRNCTRLSTA_K1_CONFIG 0x7 +#define E1000_KMRNCTRLSTA_K1_ENABLE 0x0002 +#define E1000_KMRNCTRLSTA_HD_CTRL 0x10 /* Kumeran HD Control */ -#define IFE_PHY_EXTENDED_STATUS_CONTROL 0x10 -#define IFE_PHY_SPECIAL_CONTROL 0x11 /* 100BaseTx PHY Special Control */ -#define IFE_PHY_SPECIAL_CONTROL_LED 0x1B /* PHY Special and LED Control */ -#define IFE_PHY_MDIX_CONTROL 0x1C /* MDI/MDI-X Control */ +#define IFE_PHY_EXTENDED_STATUS_CONTROL 0x10 +#define IFE_PHY_SPECIAL_CONTROL 0x11 /* 100BaseTx PHY Special Control */ +#define IFE_PHY_SPECIAL_CONTROL_LED 0x1B /* PHY Special and LED Control */ +#define IFE_PHY_MDIX_CONTROL 0x1C /* MDI/MDI-X Control */ /* IFE PHY Extended Status Control */ -#define IFE_PESC_POLARITY_REVERSED 0x0100 +#define IFE_PESC_POLARITY_REVERSED 0x0100 /* IFE PHY Special Control */ -#define IFE_PSC_AUTO_POLARITY_DISABLE 0x0010 -#define IFE_PSC_FORCE_POLARITY 0x0020 -#define IFE_PSC_DISABLE_DYNAMIC_POWER_DOWN 0x0100 +#define IFE_PSC_AUTO_POLARITY_DISABLE 0x0010 +#define IFE_PSC_FORCE_POLARITY 0x0020 +#define IFE_PSC_DISABLE_DYNAMIC_POWER_DOWN 0x0100 /* IFE PHY Special Control and LED Control */ -#define IFE_PSCL_PROBE_MODE 0x0020 -#define IFE_PSCL_PROBE_LEDS_OFF 0x0006 /* Force LEDs 0 and 2 off */ -#define IFE_PSCL_PROBE_LEDS_ON 0x0007 /* Force LEDs 0 and 2 on */ +#define IFE_PSCL_PROBE_MODE 0x0020 +#define IFE_PSCL_PROBE_LEDS_OFF 0x0006 /* Force LEDs 0 and 2 off */ +#define IFE_PSCL_PROBE_LEDS_ON 0x0007 /* Force LEDs 0 and 2 on */ /* IFE PHY MDIX Control */ -#define IFE_PMC_MDIX_STATUS 0x0020 /* 1=MDI-X, 0=MDI */ -#define IFE_PMC_FORCE_MDIX 0x0040 /* 1=force MDI-X, 0=force MDI */ -#define IFE_PMC_AUTO_MDIX 0x0080 /* 1=enable auto MDI/MDI-X, 0=disable */ +#define IFE_PMC_MDIX_STATUS 0x0020 /* 1=MDI-X, 0=MDI */ +#define IFE_PMC_FORCE_MDIX 0x0040 /* 1=force MDI-X, 0=force MDI */ +#define IFE_PMC_AUTO_MDIX 0x0080 /* 1=enable auto, 0=disable */ + +/* SFP modules ID memory locations */ +#define E1000_SFF_IDENTIFIER_OFFSET 0x00 +#define E1000_SFF_IDENTIFIER_SFF 0x02 +#define E1000_SFF_IDENTIFIER_SFP 0x03 + +#define E1000_SFF_ETH_FLAGS_OFFSET 0x06 +/* Flags for SFP modules compatible with ETH up to 1Gb */ +struct sfp_e1000_flags { + u8 e1000_base_sx:1; + u8 e1000_base_lx:1; + u8 e1000_base_cx:1; + u8 e1000_base_t:1; + u8 e100_base_lx:1; + u8 e100_base_fx:1; + u8 e10_base_bx10:1; + u8 e10_base_px:1; +}; + +/* Vendor OUIs: format of OUI is 0x[byte0][byte1][byte2][00] */ +#define E1000_SFF_VENDOR_OUI_TYCO 0x00407600 +#define E1000_SFF_VENDOR_OUI_FTL 0x00906500 +#define E1000_SFF_VENDOR_OUI_AVAGO 0x00176A00 +#define E1000_SFF_VENDOR_OUI_INTEL 0x001B2100 #endif diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_regs.h b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_regs.h index 892d1cccea..8c4e4afd13 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_regs.h +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_regs.h @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2010, Intel Corporation + Copyright (c) 2001-2012, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -30,109 +30,176 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: src/sys/dev/e1000/e1000_regs.h,v 1.4.2.4.2.1 2010/12/21 17:09:25 kensmith Exp $*/ +/*$FreeBSD$*/ #ifndef _E1000_REGS_H_ #define _E1000_REGS_H_ -#define E1000_CTRL 0x00000 /* Device Control - RW */ -#define E1000_CTRL_DUP 0x00004 /* Device Control Duplicate (Shadow) - RW */ -#define E1000_STATUS 0x00008 /* Device Status - RO */ -#define E1000_EECD 0x00010 /* EEPROM/Flash Control - RW */ -#define E1000_EERD 0x00014 /* EEPROM Read - RW */ -#define E1000_CTRL_EXT 0x00018 /* Extended Device Control - RW */ -#define E1000_FLA 0x0001C /* Flash Access - RW */ -#define E1000_MDIC 0x00020 /* MDI Control - RW */ -#define E1000_MDICNFG 0x00E04 /* MDI Config - RW */ -#define E1000_REGISTER_SET_SIZE 0x20000 /* CSR Size */ -#define E1000_EEPROM_INIT_CTRL_WORD_2 0x0F /* EEPROM Init Ctrl Word 2 */ -#define E1000_BARCTRL 0x5BBC /* BAR ctrl reg */ -#define E1000_BARCTRL_FLSIZE 0x0700 /* BAR ctrl Flsize */ -#define E1000_BARCTRL_CSRSIZE 0x2000 /* BAR ctrl CSR size */ -#define E1000_SCTL 0x00024 /* SerDes Control - RW */ -#define E1000_FCAL 0x00028 /* Flow Control Address Low - RW */ -#define E1000_FCAH 0x0002C /* Flow Control Address High -RW */ -#define E1000_FEXT 0x0002C /* Future Extended - RW */ -#define E1000_FEXTNVM4 0x00024 /* Future Extended NVM 4 - RW */ -#define E1000_FEXTNVM 0x00028 /* Future Extended NVM - RW */ -#define E1000_FCT 0x00030 /* Flow Control Type - RW */ -#define E1000_CONNSW 0x00034 /* Copper/Fiber switch control - RW */ -#define E1000_VET 0x00038 /* VLAN Ether Type - RW */ -#define E1000_ICR 0x000C0 /* Interrupt Cause Read - R/clr */ -#define E1000_ITR 0x000C4 /* Interrupt Throttling Rate - RW */ -#define E1000_ICS 0x000C8 /* Interrupt Cause Set - WO */ -#define E1000_IMS 0x000D0 /* Interrupt Mask Set - RW */ -#define E1000_IMC 0x000D8 /* Interrupt Mask Clear - WO */ -#define E1000_IAM 0x000E0 /* Interrupt Acknowledge Auto Mask */ -#define E1000_IVAR 0x000E4 /* Interrupt Vector Allocation Register - RW */ -#define E1000_SVCR 0x000F0 -#define E1000_SVT 0x000F4 -#define E1000_RCTL 0x00100 /* Rx Control - RW */ -#define E1000_FCTTV 0x00170 /* Flow Control Transmit Timer Value - RW */ -#define E1000_TXCW 0x00178 /* Tx Configuration Word - RW */ -#define E1000_RXCW 0x00180 /* Rx Configuration Word - RO */ -#define E1000_PBA_ECC 0x01100 /* PBA ECC Register */ -#define E1000_EICR 0x01580 /* Ext. Interrupt Cause Read - R/clr */ -#define E1000_EITR(_n) (0x01680 + (0x4 * (_n))) -#define E1000_EICS 0x01520 /* Ext. Interrupt Cause Set - W0 */ -#define E1000_EIMS 0x01524 /* Ext. Interrupt Mask Set/Read - RW */ -#define E1000_EIMC 0x01528 /* Ext. Interrupt Mask Clear - WO */ -#define E1000_EIAC 0x0152C /* Ext. Interrupt Auto Clear - RW */ -#define E1000_EIAM 0x01530 /* Ext. Interrupt Ack Auto Clear Mask - RW */ -#define E1000_GPIE 0x01514 /* General Purpose Interrupt Enable - RW */ -#define E1000_IVAR0 0x01700 /* Interrupt Vector Allocation (array) - RW */ -#define E1000_IVAR_MISC 0x01740 /* IVAR for "other" causes - RW */ -#define E1000_TCTL 0x00400 /* Tx Control - RW */ -#define E1000_TCTL_EXT 0x00404 /* Extended Tx Control - RW */ -#define E1000_TIPG 0x00410 /* Tx Inter-packet gap -RW */ -#define E1000_TBT 0x00448 /* Tx Burst Timer - RW */ -#define E1000_AIT 0x00458 /* Adaptive Interframe Spacing Throttle - RW */ -#define E1000_LEDCTL 0x00E00 /* LED Control - RW */ -#define E1000_EXTCNF_CTRL 0x00F00 /* Extended Configuration Control */ -#define E1000_EXTCNF_SIZE 0x00F08 /* Extended Configuration Size */ -#define E1000_PHY_CTRL 0x00F10 /* PHY Control Register in CSR */ -#define E1000_POEMB E1000_PHY_CTRL /* PHY OEM Bits */ -#define E1000_PBA 0x01000 /* Packet Buffer Allocation - RW */ -#define E1000_PBS 0x01008 /* Packet Buffer Size */ -#define E1000_EEMNGCTL 0x01010 /* MNG EEprom Control */ -#define E1000_EEARBC 0x01024 /* EEPROM Auto Read Bus Control */ -#define E1000_FLASHT 0x01028 /* FLASH Timer Register */ -#define E1000_EEWR 0x0102C /* EEPROM Write Register - RW */ -#define E1000_FLSWCTL 0x01030 /* FLASH control register */ -#define E1000_FLSWDATA 0x01034 /* FLASH data register */ -#define E1000_FLSWCNT 0x01038 /* FLASH Access Counter */ -#define E1000_FLOP 0x0103C /* FLASH Opcode Register */ -#define E1000_I2CCMD 0x01028 /* SFPI2C Command Register - RW */ -#define E1000_I2CPARAMS 0x0102C /* SFPI2C Parameters Register - RW */ -#define E1000_WDSTP 0x01040 /* Watchdog Setup - RW */ -#define E1000_SWDSTS 0x01044 /* SW Device Status - RW */ -#define E1000_FRTIMER 0x01048 /* Free Running Timer - RW */ -#define E1000_TCPTIMER 0x0104C /* TCP Timer - RW */ -#define E1000_VPDDIAG 0x01060 /* VPD Diagnostic - RO */ -#define E1000_ICR_V2 0x01500 /* Interrupt Cause - new location - RC */ -#define E1000_ICS_V2 0x01504 /* Interrupt Cause Set - new location - WO */ -#define E1000_IMS_V2 0x01508 /* Interrupt Mask Set/Read - new location - RW */ -#define E1000_IMC_V2 0x0150C /* Interrupt Mask Clear - new location - WO */ -#define E1000_IAM_V2 0x01510 /* Interrupt Ack Auto Mask - new location - RW */ -#define E1000_ERT 0x02008 /* Early Rx Threshold - RW */ -#define E1000_FCRTL 0x02160 /* Flow Control Receive Threshold Low - RW */ -#define E1000_FCRTH 0x02168 /* Flow Control Receive Threshold High - RW */ -#define E1000_PSRCTL 0x02170 /* Packet Split Receive Control - RW */ -#define E1000_RDFPCQ(_n) (0x02430 + (0x4 * (_n))) -#define E1000_PBRTH 0x02458 /* PB Rx Arbitration Threshold - RW */ -#define E1000_FCRTV 0x02460 /* Flow Control Refresh Timer Value - RW */ +#define E1000_CTRL 0x00000 /* Device Control - RW */ +#define E1000_CTRL_DUP 0x00004 /* Device Control Duplicate (Shadow) - RW */ +#define E1000_STATUS 0x00008 /* Device Status - RO */ +#define E1000_EECD 0x00010 /* EEPROM/Flash Control - RW */ +#define E1000_EERD 0x00014 /* EEPROM Read - RW */ +#define E1000_CTRL_EXT 0x00018 /* Extended Device Control - RW */ +#define E1000_FLA 0x0001C /* Flash Access - RW */ +#define E1000_MDIC 0x00020 /* MDI Control - RW */ +#define E1000_MDICNFG 0x00E04 /* MDI Config - RW */ +#define E1000_REGISTER_SET_SIZE 0x20000 /* CSR Size */ +#define E1000_EEPROM_INIT_CTRL_WORD_2 0x0F /* EEPROM Init Ctrl Word 2 */ +#define E1000_EEPROM_PCIE_CTRL_WORD_2 0x28 /* EEPROM PCIe Ctrl Word 2 */ +#define E1000_BARCTRL 0x5BBC /* BAR ctrl reg */ +#define E1000_BARCTRL_FLSIZE 0x0700 /* BAR ctrl Flsize */ +#define E1000_BARCTRL_CSRSIZE 0x2000 /* BAR ctrl CSR size */ +#define E1000_I350_BARCTRL 0x5BFC /* BAR ctrl reg */ +#define E1000_I350_DTXMXPKTSZ 0x355C /* Maximum sent packet size reg*/ +#define E1000_SCTL 0x00024 /* SerDes Control - RW */ +#define E1000_FCAL 0x00028 /* Flow Control Address Low - RW */ +#define E1000_FCAH 0x0002C /* Flow Control Address High -RW */ +#define E1000_FEXT 0x0002C /* Future Extended - RW */ +#define E1000_FEXTNVM4 0x00024 /* Future Extended NVM 4 - RW */ +#define E1000_FEXTNVM 0x00028 /* Future Extended NVM - RW */ +#define E1000_FCT 0x00030 /* Flow Control Type - RW */ +#define E1000_CONNSW 0x00034 /* Copper/Fiber switch control - RW */ +#define E1000_VET 0x00038 /* VLAN Ether Type - RW */ +#define E1000_ICR 0x000C0 /* Interrupt Cause Read - R/clr */ +#define E1000_ITR 0x000C4 /* Interrupt Throttling Rate - RW */ +#define E1000_ICS 0x000C8 /* Interrupt Cause Set - WO */ +#define E1000_IMS 0x000D0 /* Interrupt Mask Set - RW */ +#define E1000_IMC 0x000D8 /* Interrupt Mask Clear - WO */ +#define E1000_IAM 0x000E0 /* Interrupt Acknowledge Auto Mask */ +#define E1000_IVAR 0x000E4 /* Interrupt Vector Allocation Register - RW */ +#define E1000_SVCR 0x000F0 +#define E1000_SVT 0x000F4 +#define E1000_RCTL 0x00100 /* Rx Control - RW */ +#define E1000_FCTTV 0x00170 /* Flow Control Transmit Timer Value - RW */ +#define E1000_TXCW 0x00178 /* Tx Configuration Word - RW */ +#define E1000_RXCW 0x00180 /* Rx Configuration Word - RO */ +#define E1000_PBA_ECC 0x01100 /* PBA ECC Register */ +#define E1000_EICR 0x01580 /* Ext. Interrupt Cause Read - R/clr */ +#define E1000_EITR(_n) (0x01680 + (0x4 * (_n))) +#define E1000_EICS 0x01520 /* Ext. Interrupt Cause Set - W0 */ +#define E1000_EIMS 0x01524 /* Ext. Interrupt Mask Set/Read - RW */ +#define E1000_EIMC 0x01528 /* Ext. Interrupt Mask Clear - WO */ +#define E1000_EIAC 0x0152C /* Ext. Interrupt Auto Clear - RW */ +#define E1000_EIAM 0x01530 /* Ext. Interrupt Ack Auto Clear Mask - RW */ +#define E1000_GPIE 0x01514 /* General Purpose Interrupt Enable - RW */ +#define E1000_IVAR0 0x01700 /* Interrupt Vector Allocation (array) - RW */ +#define E1000_IVAR_MISC 0x01740 /* IVAR for "other" causes - RW */ +#define E1000_TCTL 0x00400 /* Tx Control - RW */ +#define E1000_TCTL_EXT 0x00404 /* Extended Tx Control - RW */ +#define E1000_TIPG 0x00410 /* Tx Inter-packet gap -RW */ +#define E1000_TBT 0x00448 /* Tx Burst Timer - RW */ +#define E1000_AIT 0x00458 /* Adaptive Interframe Spacing Throttle - RW */ +#define E1000_LEDCTL 0x00E00 /* LED Control - RW */ +#define E1000_EXTCNF_CTRL 0x00F00 /* Extended Configuration Control */ +#define E1000_EXTCNF_SIZE 0x00F08 /* Extended Configuration Size */ +#define E1000_PHY_CTRL 0x00F10 /* PHY Control Register in CSR */ +#define E1000_POEMB E1000_PHY_CTRL /* PHY OEM Bits */ +#define E1000_PBA 0x01000 /* Packet Buffer Allocation - RW */ +#define E1000_PBS 0x01008 /* Packet Buffer Size */ +#define E1000_EEMNGCTL 0x01010 /* MNG EEprom Control */ +#define E1000_EEARBC 0x01024 /* EEPROM Auto Read Bus Control */ +#define E1000_FLASHT 0x01028 /* FLASH Timer Register */ +#define E1000_EEWR 0x0102C /* EEPROM Write Register - RW */ +#define E1000_FLSWCTL 0x01030 /* FLASH control register */ +#define E1000_FLSWDATA 0x01034 /* FLASH data register */ +#define E1000_FLSWCNT 0x01038 /* FLASH Access Counter */ +#define E1000_FLOP 0x0103C /* FLASH Opcode Register */ +#define E1000_I2CCMD 0x01028 /* SFPI2C Command Register - RW */ +#define E1000_I2CPARAMS 0x0102C /* SFPI2C Parameters Register - RW */ +#define E1000_I2CBB_EN 0x00000100 /* I2C - Bit Bang Enable */ +#define E1000_I2C_CLK_OUT 0x00000200 /* I2C- Clock */ +#define E1000_I2C_DATA_OUT 0x00000400 /* I2C- Data Out */ +#define E1000_I2C_DATA_OE_N 0x00000800 /* I2C- Data Output Enable */ +#define E1000_I2C_DATA_IN 0x00001000 /* I2C- Data In */ +#define E1000_I2C_CLK_OE_N 0x00002000 /* I2C- Clock Output Enable */ +#define E1000_I2C_CLK_IN 0x00004000 /* I2C- Clock In */ +#define E1000_I2C_CLK_STRETCH_DIS 0x00008000 /* I2C- Dis Clk Stretching */ +#define E1000_WDSTP 0x01040 /* Watchdog Setup - RW */ +#define E1000_SWDSTS 0x01044 /* SW Device Status - RW */ +#define E1000_FRTIMER 0x01048 /* Free Running Timer - RW */ +#define E1000_TCPTIMER 0x0104C /* TCP Timer - RW */ +#define E1000_VPDDIAG 0x01060 /* VPD Diagnostic - RO */ +#define E1000_ICR_V2 0x01500 /* Intr Cause - new location - RC */ +#define E1000_ICS_V2 0x01504 /* Intr Cause Set - new location - WO */ +#define E1000_IMS_V2 0x01508 /* Intr Mask Set/Read - new location - RW */ +#define E1000_IMC_V2 0x0150C /* Intr Mask Clear - new location - WO */ +#define E1000_IAM_V2 0x01510 /* Intr Ack Auto Mask - new location - RW */ +#define E1000_ERT 0x02008 /* Early Rx Threshold - RW */ +#define E1000_FCRTL 0x02160 /* Flow Control Receive Threshold Low - RW */ +#define E1000_FCRTH 0x02168 /* Flow Control Receive Threshold High - RW */ +#define E1000_PSRCTL 0x02170 /* Packet Split Receive Control - RW */ +#define E1000_RDFPCQ(_n) (0x02430 + (0x4 * (_n))) +#define E1000_PBRTH 0x02458 /* PB Rx Arbitration Threshold - RW */ +#define E1000_FCRTV 0x02460 /* Flow Control Refresh Timer Value - RW */ /* Split and Replication Rx Control - RW */ -#define E1000_RDPUMB 0x025CC /* DMA Rx Descriptor uC Mailbox - RW */ -#define E1000_RDPUAD 0x025D0 /* DMA Rx Descriptor uC Addr Command - RW */ -#define E1000_RDPUWD 0x025D4 /* DMA Rx Descriptor uC Data Write - RW */ -#define E1000_RDPURD 0x025D8 /* DMA Rx Descriptor uC Data Read - RW */ -#define E1000_RDPUCTL 0x025DC /* DMA Rx Descriptor uC Control - RW */ -#define E1000_PBDIAG 0x02458 /* Packet Buffer Diagnostic - RW */ -#define E1000_RXPBS 0x02404 /* Rx Packet Buffer Size - RW */ -#define E1000_IRPBS 0x02404 /* Same as RXPBS, renamed for newer adapters - RW */ -#define E1000_PBRWAC 0x024E8 /* Rx packet buffer wrap around counter - RO */ -#define E1000_RDTR 0x02820 /* Rx Delay Timer - RW */ -#define E1000_RADV 0x0282C /* Rx Interrupt Absolute Delay Timer - RW */ +#define E1000_RDPUMB 0x025CC /* DMA Rx Descriptor uC Mailbox - RW */ +#define E1000_RDPUAD 0x025D0 /* DMA Rx Descriptor uC Addr Command - RW */ +#define E1000_RDPUWD 0x025D4 /* DMA Rx Descriptor uC Data Write - RW */ +#define E1000_RDPURD 0x025D8 /* DMA Rx Descriptor uC Data Read - RW */ +#define E1000_RDPUCTL 0x025DC /* DMA Rx Descriptor uC Control - RW */ +#define E1000_PBDIAG 0x02458 /* Packet Buffer Diagnostic - RW */ +#define E1000_RXPBS 0x02404 /* Rx Packet Buffer Size - RW */ +#define E1000_IRPBS 0x02404 /* Same as RXPBS, renamed for newer Si - RW */ +#define E1000_PBRWAC 0x024E8 /* Rx packet buffer wrap around counter - RO */ +#define E1000_RDTR 0x02820 /* Rx Delay Timer - RW */ +#define E1000_RADV 0x0282C /* Rx Interrupt Absolute Delay Timer - RW */ +#define E1000_SRWR 0x12018 /* Shadow Ram Write Register - RW */ +#define E1000_I210_FLMNGCTL 0x12038 +#define E1000_I210_FLMNGDATA 0x1203C +#define E1000_I210_FLMNGCNT 0x12040 + +#define E1000_I210_FLSWCTL 0x12048 +#define E1000_I210_FLSWDATA 0x1204C +#define E1000_I210_FLSWCNT 0x12050 + +#define E1000_I210_FLA 0x1201C + +#define E1000_INVM_DATA_REG(_n) (0x12120 + 4*(_n)) +#define E1000_INVM_SIZE 64 /* Number of INVM Data Registers */ + +/* QAV Tx mode control register */ +#define E1000_I210_TQAVCTRL 0x3570 + +/* QAV Tx mode control register bitfields masks */ +/* QAV enable */ +#define E1000_TQAVCTRL_MODE (1 << 0) +/* Fetching arbitration type */ +#define E1000_TQAVCTRL_FETCH_ARB (1 << 4) +/* Fetching timer enable */ +#define E1000_TQAVCTRL_FETCH_TIMER_ENABLE (1 << 5) +/* Launch arbitration type */ +#define E1000_TQAVCTRL_LAUNCH_ARB (1 << 8) +/* Launch timer enable */ +#define E1000_TQAVCTRL_LAUNCH_TIMER_ENABLE (1 << 9) +/* SP waits for SR enable */ +#define E1000_TQAVCTRL_SP_WAIT_SR (1 << 10) +/* Fetching timer correction */ +#define E1000_TQAVCTRL_FETCH_TIMER_DELTA_OFFSET 16 +#define E1000_TQAVCTRL_FETCH_TIMER_DELTA \ + (0xFFFF << E1000_TQAVCTRL_FETCH_TIMER_DELTA_OFFSET) + +/* High credit registers where _n can be 0 or 1. */ +#define E1000_I210_TQAVHC(_n) (0x300C + 0x40 * (_n)) + +/* Queues fetch arbitration priority control register */ +#define E1000_I210_TQAVARBCTRL 0x3574 +/* Queues priority masks where _n and _p can be 0-3. */ +#define E1000_TQAVARBCTRL_QUEUE_PRI(_n, _p) ((_p) << (2 * _n)) +/* QAV Tx mode control registers where _n can be 0 or 1. */ +#define E1000_I210_TQAVCC(_n) (0x3004 + 0x40 * (_n)) + +/* QAV Tx mode control register bitfields masks */ +#define E1000_TQAVCC_IDLE_SLOPE 0xFFFF /* Idle slope */ +#define E1000_TQAVCC_KEEP_CREDITS (1 << 30) /* Keep credits opt enable */ +#define E1000_TQAVCC_QUEUE_MODE (1 << 31) /* SP vs. SR Tx mode */ + +/* Good transmitted packets counter registers */ +#define E1000_PQGPTC(_n) (0x010014 + (0x100 * (_n))) + +/* Queues packet buffer size masks where _n can be 0-3 and _s 0-63 [kB] */ +#define E1000_I210_TXPBS_SIZE(_n, _s) ((_s) << (6 * _n)) + /* * Convenience macros * @@ -141,442 +208,472 @@ * Example usage: * E1000_RDBAL_REG(current_rx_queue) */ -#define E1000_RDBAL(_n) ((_n) < 4 ? (0x02800 + ((_n) * 0x100)) : \ - (0x0C000 + ((_n) * 0x40))) -#define E1000_RDBAH(_n) ((_n) < 4 ? (0x02804 + ((_n) * 0x100)) : \ - (0x0C004 + ((_n) * 0x40))) -#define E1000_RDLEN(_n) ((_n) < 4 ? (0x02808 + ((_n) * 0x100)) : \ - (0x0C008 + ((_n) * 0x40))) -#define E1000_SRRCTL(_n) ((_n) < 4 ? (0x0280C + ((_n) * 0x100)) : \ - (0x0C00C + ((_n) * 0x40))) -#define E1000_RDH(_n) ((_n) < 4 ? (0x02810 + ((_n) * 0x100)) : \ - (0x0C010 + ((_n) * 0x40))) -#define E1000_RXCTL(_n) ((_n) < 4 ? (0x02814 + ((_n) * 0x100)) : \ - (0x0C014 + ((_n) * 0x40))) -#define E1000_DCA_RXCTRL(_n) E1000_RXCTL(_n) -#define E1000_RDT(_n) ((_n) < 4 ? (0x02818 + ((_n) * 0x100)) : \ - (0x0C018 + ((_n) * 0x40))) -#define E1000_RXDCTL(_n) ((_n) < 4 ? (0x02828 + ((_n) * 0x100)) : \ - (0x0C028 + ((_n) * 0x40))) -#define E1000_RQDPC(_n) ((_n) < 4 ? (0x02830 + ((_n) * 0x100)) : \ - (0x0C030 + ((_n) * 0x40))) -#define E1000_TDBAL(_n) ((_n) < 4 ? (0x03800 + ((_n) * 0x100)) : \ - (0x0E000 + ((_n) * 0x40))) -#define E1000_TDBAH(_n) ((_n) < 4 ? (0x03804 + ((_n) * 0x100)) : \ - (0x0E004 + ((_n) * 0x40))) -#define E1000_TDLEN(_n) ((_n) < 4 ? (0x03808 + ((_n) * 0x100)) : \ - (0x0E008 + ((_n) * 0x40))) -#define E1000_TDH(_n) ((_n) < 4 ? (0x03810 + ((_n) * 0x100)) : \ - (0x0E010 + ((_n) * 0x40))) -#define E1000_TXCTL(_n) ((_n) < 4 ? (0x03814 + ((_n) * 0x100)) : \ - (0x0E014 + ((_n) * 0x40))) +#define E1000_RDBAL(_n) ((_n) < 4 ? (0x02800 + ((_n) * 0x100)) : \ + (0x0C000 + ((_n) * 0x40))) +#define E1000_RDBAH(_n) ((_n) < 4 ? (0x02804 + ((_n) * 0x100)) : \ + (0x0C004 + ((_n) * 0x40))) +#define E1000_RDLEN(_n) ((_n) < 4 ? (0x02808 + ((_n) * 0x100)) : \ + (0x0C008 + ((_n) * 0x40))) +#define E1000_SRRCTL(_n) ((_n) < 4 ? (0x0280C + ((_n) * 0x100)) : \ + (0x0C00C + ((_n) * 0x40))) +#define E1000_RDH(_n) ((_n) < 4 ? (0x02810 + ((_n) * 0x100)) : \ + (0x0C010 + ((_n) * 0x40))) +#define E1000_RXCTL(_n) ((_n) < 4 ? (0x02814 + ((_n) * 0x100)) : \ + (0x0C014 + ((_n) * 0x40))) +#define E1000_DCA_RXCTRL(_n) E1000_RXCTL(_n) +#define E1000_RDT(_n) ((_n) < 4 ? (0x02818 + ((_n) * 0x100)) : \ + (0x0C018 + ((_n) * 0x40))) +#define E1000_RXDCTL(_n) ((_n) < 4 ? (0x02828 + ((_n) * 0x100)) : \ + (0x0C028 + ((_n) * 0x40))) +#define E1000_RQDPC(_n) ((_n) < 4 ? (0x02830 + ((_n) * 0x100)) : \ + (0x0C030 + ((_n) * 0x40))) +#define E1000_TDBAL(_n) ((_n) < 4 ? (0x03800 + ((_n) * 0x100)) : \ + (0x0E000 + ((_n) * 0x40))) +#define E1000_TDBAH(_n) ((_n) < 4 ? (0x03804 + ((_n) * 0x100)) : \ + (0x0E004 + ((_n) * 0x40))) +#define E1000_TDLEN(_n) ((_n) < 4 ? (0x03808 + ((_n) * 0x100)) : \ + (0x0E008 + ((_n) * 0x40))) +#define E1000_TDH(_n) ((_n) < 4 ? (0x03810 + ((_n) * 0x100)) : \ + (0x0E010 + ((_n) * 0x40))) +#define E1000_TXCTL(_n) ((_n) < 4 ? (0x03814 + ((_n) * 0x100)) : \ + (0x0E014 + ((_n) * 0x40))) #define E1000_DCA_TXCTRL(_n) E1000_TXCTL(_n) -#define E1000_TDT(_n) ((_n) < 4 ? (0x03818 + ((_n) * 0x100)) : \ - (0x0E018 + ((_n) * 0x40))) -#define E1000_TXDCTL(_n) ((_n) < 4 ? (0x03828 + ((_n) * 0x100)) : \ - (0x0E028 + ((_n) * 0x40))) -#define E1000_TDWBAL(_n) ((_n) < 4 ? (0x03838 + ((_n) * 0x100)) : \ - (0x0E038 + ((_n) * 0x40))) -#define E1000_TDWBAH(_n) ((_n) < 4 ? (0x0383C + ((_n) * 0x100)) : \ - (0x0E03C + ((_n) * 0x40))) -#define E1000_TARC(_n) (0x03840 + ((_n) * 0x100)) -#define E1000_RSRPD 0x02C00 /* Rx Small Packet Detect - RW */ -#define E1000_RAID 0x02C08 /* Receive Ack Interrupt Delay - RW */ -#define E1000_TXDMAC 0x03000 /* Tx DMA Control - RW */ -#define E1000_KABGTXD 0x03004 /* AFE Band Gap Transmit Ref Data */ -#define E1000_PSRTYPE(_i) (0x05480 + ((_i) * 4)) -#define E1000_RAL(_i) (((_i) <= 15) ? (0x05400 + ((_i) * 8)) : \ - (0x054E0 + ((_i - 16) * 8))) -#define E1000_RAH(_i) (((_i) <= 15) ? (0x05404 + ((_i) * 8)) : \ - (0x054E4 + ((_i - 16) * 8))) -#define E1000_SHRAL(_i) (0x05438 + ((_i) * 8)) -#define E1000_SHRAH(_i) (0x0543C + ((_i) * 8)) -#define E1000_IP4AT_REG(_i) (0x05840 + ((_i) * 8)) -#define E1000_IP6AT_REG(_i) (0x05880 + ((_i) * 4)) -#define E1000_WUPM_REG(_i) (0x05A00 + ((_i) * 4)) -#define E1000_FFMT_REG(_i) (0x09000 + ((_i) * 8)) -#define E1000_FFVT_REG(_i) (0x09800 + ((_i) * 8)) -#define E1000_FFLT_REG(_i) (0x05F00 + ((_i) * 8)) -#define E1000_PBSLAC 0x03100 /* Packet Buffer Slave Access Control */ -#define E1000_PBSLAD(_n) (0x03110 + (0x4 * (_n))) /* Packet Buffer DWORD (_n) */ -#define E1000_TXPBS 0x03404 /* Tx Packet Buffer Size - RW */ -#define E1000_ITPBS 0x03404 /* Same as TXPBS, renamed for newer adpaters - RW */ -#define E1000_TDFH 0x03410 /* Tx Data FIFO Head - RW */ -#define E1000_TDFT 0x03418 /* Tx Data FIFO Tail - RW */ -#define E1000_TDFHS 0x03420 /* Tx Data FIFO Head Saved - RW */ -#define E1000_TDFTS 0x03428 /* Tx Data FIFO Tail Saved - RW */ -#define E1000_TDFPC 0x03430 /* Tx Data FIFO Packet Count - RW */ -#define E1000_TDPUMB 0x0357C /* DMA Tx Descriptor uC Mail Box - RW */ -#define E1000_TDPUAD 0x03580 /* DMA Tx Descriptor uC Addr Command - RW */ -#define E1000_TDPUWD 0x03584 /* DMA Tx Descriptor uC Data Write - RW */ -#define E1000_TDPURD 0x03588 /* DMA Tx Descriptor uC Data Read - RW */ -#define E1000_TDPUCTL 0x0358C /* DMA Tx Descriptor uC Control - RW */ -#define E1000_DTXCTL 0x03590 /* DMA Tx Control - RW */ -#define E1000_DTXTCPFLGL 0x0359C /* DMA Tx Control flag low - RW */ -#define E1000_DTXTCPFLGH 0x035A0 /* DMA Tx Control flag high - RW */ -#define E1000_DTXMXSZRQ 0x03540 /* DMA Tx Max Total Allow Size Requests - RW */ -#define E1000_TIDV 0x03820 /* Tx Interrupt Delay Value - RW */ -#define E1000_TADV 0x0382C /* Tx Interrupt Absolute Delay Val - RW */ -#define E1000_TSPMT 0x03830 /* TCP Segmentation PAD & Min Threshold - RW */ -#define E1000_CRCERRS 0x04000 /* CRC Error Count - R/clr */ -#define E1000_ALGNERRC 0x04004 /* Alignment Error Count - R/clr */ -#define E1000_SYMERRS 0x04008 /* Symbol Error Count - R/clr */ -#define E1000_RXERRC 0x0400C /* Receive Error Count - R/clr */ -#define E1000_MPC 0x04010 /* Missed Packet Count - R/clr */ -#define E1000_SCC 0x04014 /* Single Collision Count - R/clr */ -#define E1000_ECOL 0x04018 /* Excessive Collision Count - R/clr */ -#define E1000_MCC 0x0401C /* Multiple Collision Count - R/clr */ -#define E1000_LATECOL 0x04020 /* Late Collision Count - R/clr */ -#define E1000_COLC 0x04028 /* Collision Count - R/clr */ -#define E1000_DC 0x04030 /* Defer Count - R/clr */ -#define E1000_TNCRS 0x04034 /* Tx-No CRS - R/clr */ -#define E1000_SEC 0x04038 /* Sequence Error Count - R/clr */ -#define E1000_CEXTERR 0x0403C /* Carrier Extension Error Count - R/clr */ -#define E1000_RLEC 0x04040 /* Receive Length Error Count - R/clr */ -#define E1000_XONRXC 0x04048 /* XON Rx Count - R/clr */ -#define E1000_XONTXC 0x0404C /* XON Tx Count - R/clr */ -#define E1000_XOFFRXC 0x04050 /* XOFF Rx Count - R/clr */ -#define E1000_XOFFTXC 0x04054 /* XOFF Tx Count - R/clr */ -#define E1000_FCRUC 0x04058 /* Flow Control Rx Unsupported Count- R/clr */ -#define E1000_PRC64 0x0405C /* Packets Rx (64 bytes) - R/clr */ -#define E1000_PRC127 0x04060 /* Packets Rx (65-127 bytes) - R/clr */ -#define E1000_PRC255 0x04064 /* Packets Rx (128-255 bytes) - R/clr */ -#define E1000_PRC511 0x04068 /* Packets Rx (255-511 bytes) - R/clr */ -#define E1000_PRC1023 0x0406C /* Packets Rx (512-1023 bytes) - R/clr */ -#define E1000_PRC1522 0x04070 /* Packets Rx (1024-1522 bytes) - R/clr */ -#define E1000_GPRC 0x04074 /* Good Packets Rx Count - R/clr */ -#define E1000_BPRC 0x04078 /* Broadcast Packets Rx Count - R/clr */ -#define E1000_MPRC 0x0407C /* Multicast Packets Rx Count - R/clr */ -#define E1000_GPTC 0x04080 /* Good Packets Tx Count - R/clr */ -#define E1000_GORCL 0x04088 /* Good Octets Rx Count Low - R/clr */ -#define E1000_GORCH 0x0408C /* Good Octets Rx Count High - R/clr */ -#define E1000_GOTCL 0x04090 /* Good Octets Tx Count Low - R/clr */ -#define E1000_GOTCH 0x04094 /* Good Octets Tx Count High - R/clr */ -#define E1000_RNBC 0x040A0 /* Rx No Buffers Count - R/clr */ -#define E1000_RUC 0x040A4 /* Rx Undersize Count - R/clr */ -#define E1000_RFC 0x040A8 /* Rx Fragment Count - R/clr */ -#define E1000_ROC 0x040AC /* Rx Oversize Count - R/clr */ -#define E1000_RJC 0x040B0 /* Rx Jabber Count - R/clr */ -#define E1000_MGTPRC 0x040B4 /* Management Packets Rx Count - R/clr */ -#define E1000_MGTPDC 0x040B8 /* Management Packets Dropped Count - R/clr */ -#define E1000_MGTPTC 0x040BC /* Management Packets Tx Count - R/clr */ -#define E1000_TORL 0x040C0 /* Total Octets Rx Low - R/clr */ -#define E1000_TORH 0x040C4 /* Total Octets Rx High - R/clr */ -#define E1000_TOTL 0x040C8 /* Total Octets Tx Low - R/clr */ -#define E1000_TOTH 0x040CC /* Total Octets Tx High - R/clr */ -#define E1000_TPR 0x040D0 /* Total Packets Rx - R/clr */ -#define E1000_TPT 0x040D4 /* Total Packets Tx - R/clr */ -#define E1000_PTC64 0x040D8 /* Packets Tx (64 bytes) - R/clr */ -#define E1000_PTC127 0x040DC /* Packets Tx (65-127 bytes) - R/clr */ -#define E1000_PTC255 0x040E0 /* Packets Tx (128-255 bytes) - R/clr */ -#define E1000_PTC511 0x040E4 /* Packets Tx (256-511 bytes) - R/clr */ -#define E1000_PTC1023 0x040E8 /* Packets Tx (512-1023 bytes) - R/clr */ -#define E1000_PTC1522 0x040EC /* Packets Tx (1024-1522 Bytes) - R/clr */ -#define E1000_MPTC 0x040F0 /* Multicast Packets Tx Count - R/clr */ -#define E1000_BPTC 0x040F4 /* Broadcast Packets Tx Count - R/clr */ -#define E1000_TSCTC 0x040F8 /* TCP Segmentation Context Tx - R/clr */ -#define E1000_TSCTFC 0x040FC /* TCP Segmentation Context Tx Fail - R/clr */ -#define E1000_IAC 0x04100 /* Interrupt Assertion Count */ -#define E1000_ICRXPTC 0x04104 /* Interrupt Cause Rx Pkt Timer Expire Count */ -#define E1000_ICRXATC 0x04108 /* Interrupt Cause Rx Abs Timer Expire Count */ -#define E1000_ICTXPTC 0x0410C /* Interrupt Cause Tx Pkt Timer Expire Count */ -#define E1000_ICTXATC 0x04110 /* Interrupt Cause Tx Abs Timer Expire Count */ -#define E1000_ICTXQEC 0x04118 /* Interrupt Cause Tx Queue Empty Count */ -#define E1000_ICTXQMTC 0x0411C /* Interrupt Cause Tx Queue Min Thresh Count */ -#define E1000_ICRXDMTC 0x04120 /* Interrupt Cause Rx Desc Min Thresh Count */ -#define E1000_ICRXOC 0x04124 /* Interrupt Cause Receiver Overrun Count */ -#define E1000_CRC_OFFSET 0x05F50 /* CRC Offset register */ +#define E1000_TDT(_n) ((_n) < 4 ? (0x03818 + ((_n) * 0x100)) : \ + (0x0E018 + ((_n) * 0x40))) +#define E1000_TXDCTL(_n) ((_n) < 4 ? (0x03828 + ((_n) * 0x100)) : \ + (0x0E028 + ((_n) * 0x40))) +#define E1000_TDWBAL(_n) ((_n) < 4 ? (0x03838 + ((_n) * 0x100)) : \ + (0x0E038 + ((_n) * 0x40))) +#define E1000_TDWBAH(_n) ((_n) < 4 ? (0x0383C + ((_n) * 0x100)) : \ + (0x0E03C + ((_n) * 0x40))) +#define E1000_TARC(_n) (0x03840 + ((_n) * 0x100)) +#define E1000_RSRPD 0x02C00 /* Rx Small Packet Detect - RW */ +#define E1000_RAID 0x02C08 /* Receive Ack Interrupt Delay - RW */ +#define E1000_TXDMAC 0x03000 /* Tx DMA Control - RW */ +#define E1000_KABGTXD 0x03004 /* AFE Band Gap Transmit Ref Data */ +#define E1000_PSRTYPE(_i) (0x05480 + ((_i) * 4)) +#define E1000_RAL(_i) (((_i) <= 15) ? (0x05400 + ((_i) * 8)) : \ + (0x054E0 + ((_i - 16) * 8))) +#define E1000_RAH(_i) (((_i) <= 15) ? (0x05404 + ((_i) * 8)) : \ + (0x054E4 + ((_i - 16) * 8))) +#define E1000_SHRAL(_i) (0x05438 + ((_i) * 8)) +#define E1000_SHRAH(_i) (0x0543C + ((_i) * 8)) +#define E1000_IP4AT_REG(_i) (0x05840 + ((_i) * 8)) +#define E1000_IP6AT_REG(_i) (0x05880 + ((_i) * 4)) +#define E1000_WUPM_REG(_i) (0x05A00 + ((_i) * 4)) +#define E1000_FFMT_REG(_i) (0x09000 + ((_i) * 8)) +#define E1000_FFVT_REG(_i) (0x09800 + ((_i) * 8)) +#define E1000_FFLT_REG(_i) (0x05F00 + ((_i) * 8)) +#define E1000_PBSLAC 0x03100 /* Pkt Buffer Slave Access Control */ +#define E1000_PBSLAD(_n) (0x03110 + (0x4 * (_n))) /* Pkt Buffer DWORD */ +#define E1000_TXPBS 0x03404 /* Tx Packet Buffer Size - RW */ +/* Same as TXPBS, renamed for newer Si - RW */ +#define E1000_ITPBS 0x03404 +#define E1000_TDFH 0x03410 /* Tx Data FIFO Head - RW */ +#define E1000_TDFT 0x03418 /* Tx Data FIFO Tail - RW */ +#define E1000_TDFHS 0x03420 /* Tx Data FIFO Head Saved - RW */ +#define E1000_TDFTS 0x03428 /* Tx Data FIFO Tail Saved - RW */ +#define E1000_TDFPC 0x03430 /* Tx Data FIFO Packet Count - RW */ +#define E1000_TDPUMB 0x0357C /* DMA Tx Desc uC Mail Box - RW */ +#define E1000_TDPUAD 0x03580 /* DMA Tx Desc uC Addr Command - RW */ +#define E1000_TDPUWD 0x03584 /* DMA Tx Desc uC Data Write - RW */ +#define E1000_TDPURD 0x03588 /* DMA Tx Desc uC Data Read - RW */ +#define E1000_TDPUCTL 0x0358C /* DMA Tx Desc uC Control - RW */ +#define E1000_DTXCTL 0x03590 /* DMA Tx Control - RW */ +#define E1000_DTXTCPFLGL 0x0359C /* DMA Tx Control flag low - RW */ +#define E1000_DTXTCPFLGH 0x035A0 /* DMA Tx Control flag high - RW */ +/* DMA Tx Max Total Allow Size Reqs - RW */ +#define E1000_DTXMXSZRQ 0x03540 +#define E1000_TIDV 0x03820 /* Tx Interrupt Delay Value - RW */ +#define E1000_TADV 0x0382C /* Tx Interrupt Absolute Delay Val - RW */ +#define E1000_TSPMT 0x03830 /* TCP Segmentation PAD & Min Threshold - RW */ +#define E1000_CRCERRS 0x04000 /* CRC Error Count - R/clr */ +#define E1000_ALGNERRC 0x04004 /* Alignment Error Count - R/clr */ +#define E1000_SYMERRS 0x04008 /* Symbol Error Count - R/clr */ +#define E1000_RXERRC 0x0400C /* Receive Error Count - R/clr */ +#define E1000_MPC 0x04010 /* Missed Packet Count - R/clr */ +#define E1000_SCC 0x04014 /* Single Collision Count - R/clr */ +#define E1000_ECOL 0x04018 /* Excessive Collision Count - R/clr */ +#define E1000_MCC 0x0401C /* Multiple Collision Count - R/clr */ +#define E1000_LATECOL 0x04020 /* Late Collision Count - R/clr */ +#define E1000_COLC 0x04028 /* Collision Count - R/clr */ +#define E1000_DC 0x04030 /* Defer Count - R/clr */ +#define E1000_TNCRS 0x04034 /* Tx-No CRS - R/clr */ +#define E1000_SEC 0x04038 /* Sequence Error Count - R/clr */ +#define E1000_CEXTERR 0x0403C /* Carrier Extension Error Count - R/clr */ +#define E1000_RLEC 0x04040 /* Receive Length Error Count - R/clr */ +#define E1000_XONRXC 0x04048 /* XON Rx Count - R/clr */ +#define E1000_XONTXC 0x0404C /* XON Tx Count - R/clr */ +#define E1000_XOFFRXC 0x04050 /* XOFF Rx Count - R/clr */ +#define E1000_XOFFTXC 0x04054 /* XOFF Tx Count - R/clr */ +#define E1000_FCRUC 0x04058 /* Flow Control Rx Unsupported Count- R/clr */ +#define E1000_PRC64 0x0405C /* Packets Rx (64 bytes) - R/clr */ +#define E1000_PRC127 0x04060 /* Packets Rx (65-127 bytes) - R/clr */ +#define E1000_PRC255 0x04064 /* Packets Rx (128-255 bytes) - R/clr */ +#define E1000_PRC511 0x04068 /* Packets Rx (255-511 bytes) - R/clr */ +#define E1000_PRC1023 0x0406C /* Packets Rx (512-1023 bytes) - R/clr */ +#define E1000_PRC1522 0x04070 /* Packets Rx (1024-1522 bytes) - R/clr */ +#define E1000_GPRC 0x04074 /* Good Packets Rx Count - R/clr */ +#define E1000_BPRC 0x04078 /* Broadcast Packets Rx Count - R/clr */ +#define E1000_MPRC 0x0407C /* Multicast Packets Rx Count - R/clr */ +#define E1000_GPTC 0x04080 /* Good Packets Tx Count - R/clr */ +#define E1000_GORCL 0x04088 /* Good Octets Rx Count Low - R/clr */ +#define E1000_GORCH 0x0408C /* Good Octets Rx Count High - R/clr */ +#define E1000_GOTCL 0x04090 /* Good Octets Tx Count Low - R/clr */ +#define E1000_GOTCH 0x04094 /* Good Octets Tx Count High - R/clr */ +#define E1000_RNBC 0x040A0 /* Rx No Buffers Count - R/clr */ +#define E1000_RUC 0x040A4 /* Rx Undersize Count - R/clr */ +#define E1000_RFC 0x040A8 /* Rx Fragment Count - R/clr */ +#define E1000_ROC 0x040AC /* Rx Oversize Count - R/clr */ +#define E1000_RJC 0x040B0 /* Rx Jabber Count - R/clr */ +#define E1000_MGTPRC 0x040B4 /* Management Packets Rx Count - R/clr */ +#define E1000_MGTPDC 0x040B8 /* Management Packets Dropped Count - R/clr */ +#define E1000_MGTPTC 0x040BC /* Management Packets Tx Count - R/clr */ +#define E1000_TORL 0x040C0 /* Total Octets Rx Low - R/clr */ +#define E1000_TORH 0x040C4 /* Total Octets Rx High - R/clr */ +#define E1000_TOTL 0x040C8 /* Total Octets Tx Low - R/clr */ +#define E1000_TOTH 0x040CC /* Total Octets Tx High - R/clr */ +#define E1000_TPR 0x040D0 /* Total Packets Rx - R/clr */ +#define E1000_TPT 0x040D4 /* Total Packets Tx - R/clr */ +#define E1000_PTC64 0x040D8 /* Packets Tx (64 bytes) - R/clr */ +#define E1000_PTC127 0x040DC /* Packets Tx (65-127 bytes) - R/clr */ +#define E1000_PTC255 0x040E0 /* Packets Tx (128-255 bytes) - R/clr */ +#define E1000_PTC511 0x040E4 /* Packets Tx (256-511 bytes) - R/clr */ +#define E1000_PTC1023 0x040E8 /* Packets Tx (512-1023 bytes) - R/clr */ +#define E1000_PTC1522 0x040EC /* Packets Tx (1024-1522 Bytes) - R/clr */ +#define E1000_MPTC 0x040F0 /* Multicast Packets Tx Count - R/clr */ +#define E1000_BPTC 0x040F4 /* Broadcast Packets Tx Count - R/clr */ +#define E1000_TSCTC 0x040F8 /* TCP Segmentation Context Tx - R/clr */ +#define E1000_TSCTFC 0x040FC /* TCP Segmentation Context Tx Fail - R/clr */ +#define E1000_IAC 0x04100 /* Interrupt Assertion Count */ +#define E1000_ICRXPTC 0x04104 /* Interrupt Cause Rx Pkt Timer Expire Count */ +#define E1000_ICRXATC 0x04108 /* Interrupt Cause Rx Abs Timer Expire Count */ +#define E1000_ICTXPTC 0x0410C /* Interrupt Cause Tx Pkt Timer Expire Count */ +#define E1000_ICTXATC 0x04110 /* Interrupt Cause Tx Abs Timer Expire Count */ +#define E1000_ICTXQEC 0x04118 /* Interrupt Cause Tx Queue Empty Count */ +#define E1000_ICTXQMTC 0x0411C /* Interrupt Cause Tx Queue Min Thresh Count */ +#define E1000_ICRXDMTC 0x04120 /* Interrupt Cause Rx Desc Min Thresh Count */ +#define E1000_ICRXOC 0x04124 /* Interrupt Cause Receiver Overrun Count */ +#define E1000_CRC_OFFSET 0x05F50 /* CRC Offset register */ -#define E1000_VFGPRC 0x00F10 -#define E1000_VFGORC 0x00F18 -#define E1000_VFMPRC 0x00F3C -#define E1000_VFGPTC 0x00F14 -#define E1000_VFGOTC 0x00F34 -#define E1000_VFGOTLBC 0x00F50 -#define E1000_VFGPTLBC 0x00F44 -#define E1000_VFGORLBC 0x00F48 -#define E1000_VFGPRLBC 0x00F40 +#define E1000_VFGPRC 0x00F10 +#define E1000_VFGORC 0x00F18 +#define E1000_VFMPRC 0x00F3C +#define E1000_VFGPTC 0x00F14 +#define E1000_VFGOTC 0x00F34 +#define E1000_VFGOTLBC 0x00F50 +#define E1000_VFGPTLBC 0x00F44 +#define E1000_VFGORLBC 0x00F48 +#define E1000_VFGPRLBC 0x00F40 /* Virtualization statistical counters */ -#define E1000_PFVFGPRC(_n) (0x010010 + (0x100 * (_n))) -#define E1000_PFVFGPTC(_n) (0x010014 + (0x100 * (_n))) -#define E1000_PFVFGORC(_n) (0x010018 + (0x100 * (_n))) -#define E1000_PFVFGOTC(_n) (0x010034 + (0x100 * (_n))) -#define E1000_PFVFMPRC(_n) (0x010038 + (0x100 * (_n))) -#define E1000_PFVFGPRLBC(_n) (0x010040 + (0x100 * (_n))) -#define E1000_PFVFGPTLBC(_n) (0x010044 + (0x100 * (_n))) -#define E1000_PFVFGORLBC(_n) (0x010048 + (0x100 * (_n))) -#define E1000_PFVFGOTLBC(_n) (0x010050 + (0x100 * (_n))) +#define E1000_PFVFGPRC(_n) (0x010010 + (0x100 * (_n))) +#define E1000_PFVFGPTC(_n) (0x010014 + (0x100 * (_n))) +#define E1000_PFVFGORC(_n) (0x010018 + (0x100 * (_n))) +#define E1000_PFVFGOTC(_n) (0x010034 + (0x100 * (_n))) +#define E1000_PFVFMPRC(_n) (0x010038 + (0x100 * (_n))) +#define E1000_PFVFGPRLBC(_n) (0x010040 + (0x100 * (_n))) +#define E1000_PFVFGPTLBC(_n) (0x010044 + (0x100 * (_n))) +#define E1000_PFVFGORLBC(_n) (0x010048 + (0x100 * (_n))) +#define E1000_PFVFGOTLBC(_n) (0x010050 + (0x100 * (_n))) -#define E1000_LSECTXUT 0x04300 /* LinkSec Tx Untagged Packet Count - OutPktsUntagged */ -#define E1000_LSECTXPKTE 0x04304 /* LinkSec Encrypted Tx Packets Count - OutPktsEncrypted */ -#define E1000_LSECTXPKTP 0x04308 /* LinkSec Protected Tx Packet Count - OutPktsProtected */ -#define E1000_LSECTXOCTE 0x0430C /* LinkSec Encrypted Tx Octets Count - OutOctetsEncrypted */ -#define E1000_LSECTXOCTP 0x04310 /* LinkSec Protected Tx Octets Count - OutOctetsProtected */ -#define E1000_LSECRXUT 0x04314 /* LinkSec Untagged non-Strict Rx Packet Count - InPktsUntagged/InPktsNoTag */ -#define E1000_LSECRXOCTD 0x0431C /* LinkSec Rx Octets Decrypted Count - InOctetsDecrypted */ -#define E1000_LSECRXOCTV 0x04320 /* LinkSec Rx Octets Validated - InOctetsValidated */ -#define E1000_LSECRXBAD 0x04324 /* LinkSec Rx Bad Tag - InPktsBadTag */ -#define E1000_LSECRXNOSCI 0x04328 /* LinkSec Rx Packet No SCI Count - InPktsNoSci */ -#define E1000_LSECRXUNSCI 0x0432C /* LinkSec Rx Packet Unknown SCI Count - InPktsUnknownSci */ -#define E1000_LSECRXUNCH 0x04330 /* LinkSec Rx Unchecked Packets Count - InPktsUnchecked */ -#define E1000_LSECRXDELAY 0x04340 /* LinkSec Rx Delayed Packet Count - InPktsDelayed */ -#define E1000_LSECRXLATE 0x04350 /* LinkSec Rx Late Packets Count - InPktsLate */ -#define E1000_LSECRXOK(_n) (0x04360 + (0x04 * (_n))) /* LinkSec Rx Packet OK Count - InPktsOk */ -#define E1000_LSECRXINV(_n) (0x04380 + (0x04 * (_n))) /* LinkSec Rx Invalid Count - InPktsInvalid */ -#define E1000_LSECRXNV(_n) (0x043A0 + (0x04 * (_n))) /* LinkSec Rx Not Valid Count - InPktsNotValid */ -#define E1000_LSECRXUNSA 0x043C0 /* LinkSec Rx Unused SA Count - InPktsUnusedSa */ -#define E1000_LSECRXNUSA 0x043D0 /* LinkSec Rx Not Using SA Count - InPktsNotUsingSa */ -#define E1000_LSECTXCAP 0x0B000 /* LinkSec Tx Capabilities Register - RO */ -#define E1000_LSECRXCAP 0x0B300 /* LinkSec Rx Capabilities Register - RO */ -#define E1000_LSECTXCTRL 0x0B004 /* LinkSec Tx Control - RW */ -#define E1000_LSECRXCTRL 0x0B304 /* LinkSec Rx Control - RW */ -#define E1000_LSECTXSCL 0x0B008 /* LinkSec Tx SCI Low - RW */ -#define E1000_LSECTXSCH 0x0B00C /* LinkSec Tx SCI High - RW */ -#define E1000_LSECTXSA 0x0B010 /* LinkSec Tx SA0 - RW */ -#define E1000_LSECTXPN0 0x0B018 /* LinkSec Tx SA PN 0 - RW */ -#define E1000_LSECTXPN1 0x0B01C /* LinkSec Tx SA PN 1 - RW */ -#define E1000_LSECRXSCL 0x0B3D0 /* LinkSec Rx SCI Low - RW */ -#define E1000_LSECRXSCH 0x0B3E0 /* LinkSec Rx SCI High - RW */ -#define E1000_LSECTXKEY0(_n) (0x0B020 + (0x04 * (_n))) /* LinkSec Tx 128-bit Key 0 - WO */ -#define E1000_LSECTXKEY1(_n) (0x0B030 + (0x04 * (_n))) /* LinkSec Tx 128-bit Key 1 - WO */ -#define E1000_LSECRXSA(_n) (0x0B310 + (0x04 * (_n))) /* LinkSec Rx SAs - RW */ -#define E1000_LSECRXPN(_n) (0x0B330 + (0x04 * (_n))) /* LinkSec Rx SAs - RW */ +/* LinkSec */ +#define E1000_LSECTXUT 0x04300 /* Tx Untagged Pkt Cnt */ +#define E1000_LSECTXPKTE 0x04304 /* Encrypted Tx Pkts Cnt */ +#define E1000_LSECTXPKTP 0x04308 /* Protected Tx Pkt Cnt */ +#define E1000_LSECTXOCTE 0x0430C /* Encrypted Tx Octets Cnt */ +#define E1000_LSECTXOCTP 0x04310 /* Protected Tx Octets Cnt */ +#define E1000_LSECRXUT 0x04314 /* Untagged non-Strict Rx Pkt Cnt */ +#define E1000_LSECRXOCTD 0x0431C /* Rx Octets Decrypted Count */ +#define E1000_LSECRXOCTV 0x04320 /* Rx Octets Validated */ +#define E1000_LSECRXBAD 0x04324 /* Rx Bad Tag */ +#define E1000_LSECRXNOSCI 0x04328 /* Rx Packet No SCI Count */ +#define E1000_LSECRXUNSCI 0x0432C /* Rx Packet Unknown SCI Count */ +#define E1000_LSECRXUNCH 0x04330 /* Rx Unchecked Packets Count */ +#define E1000_LSECRXDELAY 0x04340 /* Rx Delayed Packet Count */ +#define E1000_LSECRXLATE 0x04350 /* Rx Late Packets Count */ +#define E1000_LSECRXOK(_n) (0x04360 + (0x04 * (_n))) /* Rx Pkt OK Cnt */ +#define E1000_LSECRXINV(_n) (0x04380 + (0x04 * (_n))) /* Rx Invalid Cnt */ +#define E1000_LSECRXNV(_n) (0x043A0 + (0x04 * (_n))) /* Rx Not Valid Cnt */ +#define E1000_LSECRXUNSA 0x043C0 /* Rx Unused SA Count */ +#define E1000_LSECRXNUSA 0x043D0 /* Rx Not Using SA Count */ +#define E1000_LSECTXCAP 0x0B000 /* Tx Capabilities Register - RO */ +#define E1000_LSECRXCAP 0x0B300 /* Rx Capabilities Register - RO */ +#define E1000_LSECTXCTRL 0x0B004 /* Tx Control - RW */ +#define E1000_LSECRXCTRL 0x0B304 /* Rx Control - RW */ +#define E1000_LSECTXSCL 0x0B008 /* Tx SCI Low - RW */ +#define E1000_LSECTXSCH 0x0B00C /* Tx SCI High - RW */ +#define E1000_LSECTXSA 0x0B010 /* Tx SA0 - RW */ +#define E1000_LSECTXPN0 0x0B018 /* Tx SA PN 0 - RW */ +#define E1000_LSECTXPN1 0x0B01C /* Tx SA PN 1 - RW */ +#define E1000_LSECRXSCL 0x0B3D0 /* Rx SCI Low - RW */ +#define E1000_LSECRXSCH 0x0B3E0 /* Rx SCI High - RW */ +/* LinkSec Tx 128-bit Key 0 - WO */ +#define E1000_LSECTXKEY0(_n) (0x0B020 + (0x04 * (_n))) +/* LinkSec Tx 128-bit Key 1 - WO */ +#define E1000_LSECTXKEY1(_n) (0x0B030 + (0x04 * (_n))) +#define E1000_LSECRXSA(_n) (0x0B310 + (0x04 * (_n))) /* Rx SAs - RW */ +#define E1000_LSECRXPN(_n) (0x0B330 + (0x04 * (_n))) /* Rx SAs - RW */ /* * LinkSec Rx Keys - where _n is the SA no. and _m the 4 dwords of the 128 bit * key - RW. */ -#define E1000_LSECRXKEY(_n, _m) (0x0B350 + (0x10 * (_n)) + (0x04 * (_m))) +#define E1000_LSECRXKEY(_n, _m) (0x0B350 + (0x10 * (_n)) + (0x04 * (_m))) -#define E1000_SSVPC 0x041A0 /* Switch Security Violation Packet Count */ -#define E1000_IPSCTRL 0xB430 /* IpSec Control Register */ -#define E1000_IPSRXCMD 0x0B408 /* IPSec Rx Command Register - RW */ -#define E1000_IPSRXIDX 0x0B400 /* IPSec Rx Index - RW */ -#define E1000_IPSRXIPADDR(_n) (0x0B420+ (0x04 * (_n))) /* IPSec Rx IPv4/v6 Address - RW */ -#define E1000_IPSRXKEY(_n) (0x0B410 + (0x04 * (_n))) /* IPSec Rx 128-bit Key - RW */ -#define E1000_IPSRXSALT 0x0B404 /* IPSec Rx Salt - RW */ -#define E1000_IPSRXSPI 0x0B40C /* IPSec Rx SPI - RW */ -#define E1000_IPSTXKEY(_n) (0x0B460 + (0x04 * (_n))) /* IPSec Tx 128-bit Key - RW */ -#define E1000_IPSTXSALT 0x0B454 /* IPSec Tx Salt - RW */ -#define E1000_IPSTXIDX 0x0B450 /* IPSec Tx SA IDX - RW */ -#define E1000_PCS_CFG0 0x04200 /* PCS Configuration 0 - RW */ -#define E1000_PCS_LCTL 0x04208 /* PCS Link Control - RW */ -#define E1000_PCS_LSTAT 0x0420C /* PCS Link Status - RO */ -#define E1000_CBTMPC 0x0402C /* Circuit Breaker Tx Packet Count */ -#define E1000_HTDPMC 0x0403C /* Host Transmit Discarded Packets */ -#define E1000_CBRDPC 0x04044 /* Circuit Breaker Rx Dropped Count */ -#define E1000_CBRMPC 0x040FC /* Circuit Breaker Rx Packet Count */ -#define E1000_RPTHC 0x04104 /* Rx Packets To Host */ -#define E1000_HGPTC 0x04118 /* Host Good Packets Tx Count */ -#define E1000_HTCBDPC 0x04124 /* Host Tx Circuit Breaker Dropped Count */ -#define E1000_HGORCL 0x04128 /* Host Good Octets Received Count Low */ -#define E1000_HGORCH 0x0412C /* Host Good Octets Received Count High */ -#define E1000_HGOTCL 0x04130 /* Host Good Octets Transmit Count Low */ -#define E1000_HGOTCH 0x04134 /* Host Good Octets Transmit Count High */ -#define E1000_LENERRS 0x04138 /* Length Errors Count */ -#define E1000_SCVPC 0x04228 /* SerDes/SGMII Code Violation Pkt Count */ -#define E1000_HRMPC 0x0A018 /* Header Redirection Missed Packet Count */ -#define E1000_PCS_ANADV 0x04218 /* AN advertisement - RW */ -#define E1000_PCS_LPAB 0x0421C /* Link Partner Ability - RW */ -#define E1000_PCS_NPTX 0x04220 /* AN Next Page Transmit - RW */ -#define E1000_PCS_LPABNP 0x04224 /* Link Partner Ability Next Page - RW */ -#define E1000_1GSTAT_RCV 0x04228 /* 1GSTAT Code Violation Packet Count - RW */ -#define E1000_RXCSUM 0x05000 /* Rx Checksum Control - RW */ -#define E1000_RLPML 0x05004 /* Rx Long Packet Max Length */ -#define E1000_RFCTL 0x05008 /* Receive Filter Control*/ -#define E1000_MTA 0x05200 /* Multicast Table Array - RW Array */ -#define E1000_RA 0x05400 /* Receive Address - RW Array */ -#define E1000_RA2 0x054E0 /* 2nd half of receive address array - RW Array */ -#define E1000_VFTA 0x05600 /* VLAN Filter Table Array - RW Array */ -#define E1000_VT_CTL 0x0581C /* VMDq Control - RW */ -#define E1000_VFQA0 0x0B000 /* VLAN Filter Queue Array 0 - RW Array */ -#define E1000_VFQA1 0x0B200 /* VLAN Filter Queue Array 1 - RW Array */ -#define E1000_WUC 0x05800 /* Wakeup Control - RW */ -#define E1000_WUFC 0x05808 /* Wakeup Filter Control - RW */ -#define E1000_WUS 0x05810 /* Wakeup Status - RO */ -#define E1000_MANC 0x05820 /* Management Control - RW */ -#define E1000_IPAV 0x05838 /* IP Address Valid - RW */ -#define E1000_IP4AT 0x05840 /* IPv4 Address Table - RW Array */ -#define E1000_IP6AT 0x05880 /* IPv6 Address Table - RW Array */ -#define E1000_WUPL 0x05900 /* Wakeup Packet Length - RW */ -#define E1000_WUPM 0x05A00 /* Wakeup Packet Memory - RO A */ -#define E1000_PBACL 0x05B68 /* MSIx PBA Clear - Read/Write 1's to clear */ -#define E1000_FFLT 0x05F00 /* Flexible Filter Length Table - RW Array */ -#define E1000_HOST_IF 0x08800 /* Host Interface */ -#define E1000_FFMT 0x09000 /* Flexible Filter Mask Table - RW Array */ -#define E1000_FFVT 0x09800 /* Flexible Filter Value Table - RW Array */ -#define E1000_FHFT(_n) (0x09000 + (_n * 0x100)) /* Flexible Host Filter Table */ -#define E1000_FHFT_EXT(_n) (0x09A00 + (_n * 0x100)) /* Ext Flexible Host Filter Table */ +#define E1000_SSVPC 0x041A0 /* Switch Security Violation Pkt Cnt */ +#define E1000_IPSCTRL 0xB430 /* IpSec Control Register */ +#define E1000_IPSRXCMD 0x0B408 /* IPSec Rx Command Register - RW */ +#define E1000_IPSRXIDX 0x0B400 /* IPSec Rx Index - RW */ +/* IPSec Rx IPv4/v6 Address - RW */ +#define E1000_IPSRXIPADDR(_n) (0x0B420 + (0x04 * (_n))) +/* IPSec Rx 128-bit Key - RW */ +#define E1000_IPSRXKEY(_n) (0x0B410 + (0x04 * (_n))) +#define E1000_IPSRXSALT 0x0B404 /* IPSec Rx Salt - RW */ +#define E1000_IPSRXSPI 0x0B40C /* IPSec Rx SPI - RW */ +/* IPSec Tx 128-bit Key - RW */ +#define E1000_IPSTXKEY(_n) (0x0B460 + (0x04 * (_n))) +#define E1000_IPSTXSALT 0x0B454 /* IPSec Tx Salt - RW */ +#define E1000_IPSTXIDX 0x0B450 /* IPSec Tx SA IDX - RW */ +#define E1000_PCS_CFG0 0x04200 /* PCS Configuration 0 - RW */ +#define E1000_PCS_LCTL 0x04208 /* PCS Link Control - RW */ +#define E1000_PCS_LSTAT 0x0420C /* PCS Link Status - RO */ +#define E1000_CBTMPC 0x0402C /* Circuit Breaker Tx Packet Count */ +#define E1000_HTDPMC 0x0403C /* Host Transmit Discarded Packets */ +#define E1000_CBRDPC 0x04044 /* Circuit Breaker Rx Dropped Count */ +#define E1000_CBRMPC 0x040FC /* Circuit Breaker Rx Packet Count */ +#define E1000_RPTHC 0x04104 /* Rx Packets To Host */ +#define E1000_HGPTC 0x04118 /* Host Good Packets Tx Count */ +#define E1000_HTCBDPC 0x04124 /* Host Tx Circuit Breaker Dropped Count */ +#define E1000_HGORCL 0x04128 /* Host Good Octets Received Count Low */ +#define E1000_HGORCH 0x0412C /* Host Good Octets Received Count High */ +#define E1000_HGOTCL 0x04130 /* Host Good Octets Transmit Count Low */ +#define E1000_HGOTCH 0x04134 /* Host Good Octets Transmit Count High */ +#define E1000_LENERRS 0x04138 /* Length Errors Count */ +#define E1000_SCVPC 0x04228 /* SerDes/SGMII Code Violation Pkt Count */ +#define E1000_HRMPC 0x0A018 /* Header Redirection Missed Packet Count */ +#define E1000_PCS_ANADV 0x04218 /* AN advertisement - RW */ +#define E1000_PCS_LPAB 0x0421C /* Link Partner Ability - RW */ +#define E1000_PCS_NPTX 0x04220 /* AN Next Page Transmit - RW */ +#define E1000_PCS_LPABNP 0x04224 /* Link Partner Ability Next Pg - RW */ +#define E1000_1GSTAT_RCV 0x04228 /* 1GSTAT Code Violation Pkt Cnt - RW */ +#define E1000_RXCSUM 0x05000 /* Rx Checksum Control - RW */ +#define E1000_RLPML 0x05004 /* Rx Long Packet Max Length */ +#define E1000_RFCTL 0x05008 /* Receive Filter Control*/ +#define E1000_MTA 0x05200 /* Multicast Table Array - RW Array */ +#define E1000_RA 0x05400 /* Receive Address - RW Array */ +#define E1000_RA2 0x054E0 /* 2nd half of Rx address array - RW Array */ +#define E1000_VFTA 0x05600 /* VLAN Filter Table Array - RW Array */ +#define E1000_VT_CTL 0x0581C /* VMDq Control - RW */ +#define E1000_CIAA 0x05B88 /* Config Indirect Access Address - RW */ +#define E1000_CIAD 0x05B8C /* Config Indirect Access Data - RW */ +#define E1000_VFQA0 0x0B000 /* VLAN Filter Queue Array 0 - RW Array */ +#define E1000_VFQA1 0x0B200 /* VLAN Filter Queue Array 1 - RW Array */ +#define E1000_WUC 0x05800 /* Wakeup Control - RW */ +#define E1000_WUFC 0x05808 /* Wakeup Filter Control - RW */ +#define E1000_WUS 0x05810 /* Wakeup Status - RO */ +#define E1000_MANC 0x05820 /* Management Control - RW */ +#define E1000_IPAV 0x05838 /* IP Address Valid - RW */ +#define E1000_IP4AT 0x05840 /* IPv4 Address Table - RW Array */ +#define E1000_IP6AT 0x05880 /* IPv6 Address Table - RW Array */ +#define E1000_WUPL 0x05900 /* Wakeup Packet Length - RW */ +#define E1000_WUPM 0x05A00 /* Wakeup Packet Memory - RO A */ +#define E1000_PBACL 0x05B68 /* MSIx PBA Clear - Read/Write 1's to clear */ +#define E1000_FFLT 0x05F00 /* Flexible Filter Length Table - RW Array */ +#define E1000_HOST_IF 0x08800 /* Host Interface */ +#define E1000_FFMT 0x09000 /* Flexible Filter Mask Table - RW Array */ +#define E1000_FFVT 0x09800 /* Flexible Filter Value Table - RW Array */ +#define E1000_HIBBA 0x8F40 /* Host Interface Buffer Base Address */ +/* Flexible Host Filter Table */ +#define E1000_FHFT(_n) (0x09000 + ((_n) * 0x100)) +/* Ext Flexible Host Filter Table */ +#define E1000_FHFT_EXT(_n) (0x09A00 + ((_n) * 0x100)) -#define E1000_KMRNCTRLSTA 0x00034 /* MAC-PHY interface - RW */ -#define E1000_MDPHYA 0x0003C /* PHY address - RW */ -#define E1000_MANC2H 0x05860 /* Management Control To Host - RW */ -#define E1000_MDEF(_n) (0x05890 + (4 * (_n))) /* Mngmt Decision Filters */ -#define E1000_SW_FW_SYNC 0x05B5C /* Software-Firmware Synchronization - RW */ -#define E1000_CCMCTL 0x05B48 /* CCM Control Register */ -#define E1000_GIOCTL 0x05B44 /* GIO Analog Control Register */ -#define E1000_SCCTL 0x05B4C /* PCIc PLL Configuration Register */ -#define E1000_GCR 0x05B00 /* PCI-Ex Control */ -#define E1000_GCR2 0x05B64 /* PCI-Ex Control #2 */ -#define E1000_GSCL_1 0x05B10 /* PCI-Ex Statistic Control #1 */ -#define E1000_GSCL_2 0x05B14 /* PCI-Ex Statistic Control #2 */ -#define E1000_GSCL_3 0x05B18 /* PCI-Ex Statistic Control #3 */ -#define E1000_GSCL_4 0x05B1C /* PCI-Ex Statistic Control #4 */ -#define E1000_FACTPS 0x05B30 /* Function Active and Power State to MNG */ -#define E1000_SWSM 0x05B50 /* SW Semaphore */ -#define E1000_FWSM 0x05B54 /* FW Semaphore */ -#define E1000_SWSM2 0x05B58 /* Driver-only SW semaphore (not used by BOOT agents) */ -#define E1000_DCA_ID 0x05B70 /* DCA Requester ID Information - RO */ -#define E1000_DCA_CTRL 0x05B74 /* DCA Control - RW */ -#define E1000_UFUSE 0x05B78 /* UFUSE - RO */ -#define E1000_FFLT_DBG 0x05F04 /* Debug Register */ -#define E1000_HICR 0x08F00 /* Host Interface Control */ -#define E1000_FWSTS 0x08F0C /* FW Status */ +#define E1000_KMRNCTRLSTA 0x00034 /* MAC-PHY interface - RW */ +#define E1000_MDPHYA 0x0003C /* PHY address - RW */ +#define E1000_MANC2H 0x05860 /* Management Control To Host - RW */ +/* Management Decision Filters */ +#define E1000_MDEF(_n) (0x05890 + (4 * (_n))) +#define E1000_SW_FW_SYNC 0x05B5C /* SW-FW Synchronization - RW */ +#define E1000_CCMCTL 0x05B48 /* CCM Control Register */ +#define E1000_GIOCTL 0x05B44 /* GIO Analog Control Register */ +#define E1000_SCCTL 0x05B4C /* PCIc PLL Configuration Register */ +#define E1000_GCR 0x05B00 /* PCI-Ex Control */ +#define E1000_GCR2 0x05B64 /* PCI-Ex Control #2 */ +#define E1000_GSCL_1 0x05B10 /* PCI-Ex Statistic Control #1 */ +#define E1000_GSCL_2 0x05B14 /* PCI-Ex Statistic Control #2 */ +#define E1000_GSCL_3 0x05B18 /* PCI-Ex Statistic Control #3 */ +#define E1000_GSCL_4 0x05B1C /* PCI-Ex Statistic Control #4 */ +#define E1000_FACTPS 0x05B30 /* Function Active and Power State to MNG */ +#define E1000_SWSM 0x05B50 /* SW Semaphore */ +#define E1000_FWSM 0x05B54 /* FW Semaphore */ +/* Driver-only SW semaphore (not used by BOOT agents) */ +#define E1000_SWSM2 0x05B58 +#define E1000_DCA_ID 0x05B70 /* DCA Requester ID Information - RO */ +#define E1000_DCA_CTRL 0x05B74 /* DCA Control - RW */ +#define E1000_UFUSE 0x05B78 /* UFUSE - RO */ +#define E1000_FFLT_DBG 0x05F04 /* Debug Register */ +#define E1000_HICR 0x08F00 /* Host Interface Control */ +#define E1000_FWSTS 0x08F0C /* FW Status */ /* RSS registers */ -#define E1000_CPUVEC 0x02C10 /* CPU Vector Register - RW */ -#define E1000_MRQC 0x05818 /* Multiple Receive Control - RW */ -#define E1000_IMIR(_i) (0x05A80 + ((_i) * 4)) /* Immediate Interrupt */ -#define E1000_IMIREXT(_i) (0x05AA0 + ((_i) * 4)) /* Immediate Interrupt Ext*/ -#define E1000_IMIRVP 0x05AC0 /* Immediate Interrupt Rx VLAN Priority - RW */ -#define E1000_MSIXBM(_i) (0x01600 + ((_i) * 4)) /* MSI-X Allocation Register - * (_i) - RW */ -#define E1000_MSIXTADD(_i) (0x0C000 + ((_i) * 0x10)) /* MSI-X Table entry addr - * low reg - RW */ -#define E1000_MSIXTUADD(_i) (0x0C004 + ((_i) * 0x10)) /* MSI-X Table entry addr - * upper reg - RW */ -#define E1000_MSIXTMSG(_i) (0x0C008 + ((_i) * 0x10)) /* MSI-X Table entry - * message reg - RW */ -#define E1000_MSIXVCTRL(_i) (0x0C00C + ((_i) * 0x10)) /* MSI-X Table entry - * vector ctrl reg - RW */ -#define E1000_MSIXPBA 0x0E000 /* MSI-X Pending bit array */ -#define E1000_RETA(_i) (0x05C00 + ((_i) * 4)) /* Redirection Table - RW */ -#define E1000_RSSRK(_i) (0x05C80 + ((_i) * 4)) /* RSS Random Key - RW */ -#define E1000_RSSIM 0x05864 /* RSS Interrupt Mask */ -#define E1000_RSSIR 0x05868 /* RSS Interrupt Request */ +#define E1000_CPUVEC 0x02C10 /* CPU Vector Register - RW */ +#define E1000_MRQC 0x05818 /* Multiple Receive Control - RW */ +#define E1000_IMIR(_i) (0x05A80 + ((_i) * 4)) /* Immediate Interrupt */ +#define E1000_IMIREXT(_i) (0x05AA0 + ((_i) * 4)) /* Immediate INTR Ext*/ +#define E1000_IMIRVP 0x05AC0 /* Immediate INT Rx VLAN Priority -RW */ +#define E1000_MSIXBM(_i) (0x01600 + ((_i) * 4)) /* MSI-X Alloc Reg -RW */ +/* MSI-X Table entry addr low reg - RW */ +#define E1000_MSIXTADD(_i) (0x0C000 + ((_i) * 0x10)) +/* MSI-X Table entry addr upper reg - RW */ +#define E1000_MSIXTUADD(_i) (0x0C004 + ((_i) * 0x10)) +/* MSI-X Table entry message reg - RW */ +#define E1000_MSIXTMSG(_i) (0x0C008 + ((_i) * 0x10)) +/* MSI-X Table entry vector ctrl reg - RW */ +#define E1000_MSIXVCTRL(_i) (0x0C00C + ((_i) * 0x10)) +#define E1000_MSIXPBA 0x0E000 /* MSI-X Pending bit array */ +#define E1000_RETA(_i) (0x05C00 + ((_i) * 4)) /* Redirection Table - RW */ +#define E1000_RSSRK(_i) (0x05C80 + ((_i) * 4)) /* RSS Random Key - RW */ +#define E1000_RSSIM 0x05864 /* RSS Interrupt Mask */ +#define E1000_RSSIR 0x05868 /* RSS Interrupt Request */ /* VT Registers */ -#define E1000_SWPBS 0x03004 /* Switch Packet Buffer Size - RW */ -#define E1000_MBVFICR 0x00C80 /* Mailbox VF Cause - RWC */ -#define E1000_MBVFIMR 0x00C84 /* Mailbox VF int Mask - RW */ -#define E1000_VFLRE 0x00C88 /* VF Register Events - RWC */ -#define E1000_VFRE 0x00C8C /* VF Receive Enables */ -#define E1000_VFTE 0x00C90 /* VF Transmit Enables */ -#define E1000_QDE 0x02408 /* Queue Drop Enable - RW */ -#define E1000_DTXSWC 0x03500 /* DMA Tx Switch Control - RW */ -#define E1000_WVBR 0x03554 /* VM Wrong Behavior - RWS */ -#define E1000_RPLOLR 0x05AF0 /* Replication Offload - RW */ -#define E1000_UTA 0x0A000 /* Unicast Table Array - RW */ -#define E1000_IOVTCL 0x05BBC /* IOV Control Register */ -#define E1000_VMRCTL 0X05D80 /* Virtual Mirror Rule Control */ -#define E1000_VMRVLAN 0x05D90 /* Virtual Mirror Rule VLAN */ -#define E1000_VMRVM 0x05DA0 /* Virtual Mirror Rule VM */ -#define E1000_MDFB 0x03558 /* Malicious Driver free block */ -#define E1000_LVMMC 0x03548 /* Last VM Misbehavior cause */ -#define E1000_TXSWC 0x05ACC /* Tx Switch Control */ -#define E1000_SCCRL 0x05DB0 /* Storm Control Control */ -#define E1000_BSCTRH 0x05DB8 /* Broadcast Storm Control Threshold */ -#define E1000_MSCTRH 0x05DBC /* Multicast Storm Control Threshold */ +#define E1000_SWPBS 0x03004 /* Switch Packet Buffer Size - RW */ +#define E1000_MBVFICR 0x00C80 /* Mailbox VF Cause - RWC */ +#define E1000_MBVFIMR 0x00C84 /* Mailbox VF int Mask - RW */ +#define E1000_VFLRE 0x00C88 /* VF Register Events - RWC */ +#define E1000_VFRE 0x00C8C /* VF Receive Enables */ +#define E1000_VFTE 0x00C90 /* VF Transmit Enables */ +#define E1000_QDE 0x02408 /* Queue Drop Enable - RW */ +#define E1000_DTXSWC 0x03500 /* DMA Tx Switch Control - RW */ +#define E1000_WVBR 0x03554 /* VM Wrong Behavior - RWS */ +#define E1000_RPLOLR 0x05AF0 /* Replication Offload - RW */ +#define E1000_UTA 0x0A000 /* Unicast Table Array - RW */ +#define E1000_IOVTCL 0x05BBC /* IOV Control Register */ +#define E1000_VMRCTL 0X05D80 /* Virtual Mirror Rule Control */ +#define E1000_VMRVLAN 0x05D90 /* Virtual Mirror Rule VLAN */ +#define E1000_VMRVM 0x05DA0 /* Virtual Mirror Rule VM */ +#define E1000_MDFB 0x03558 /* Malicious Driver free block */ +#define E1000_LVMMC 0x03548 /* Last VM Misbehavior cause */ +#define E1000_TXSWC 0x05ACC /* Tx Switch Control */ +#define E1000_SCCRL 0x05DB0 /* Storm Control Control */ +#define E1000_BSCTRH 0x05DB8 /* Broadcast Storm Control Threshold */ +#define E1000_MSCTRH 0x05DBC /* Multicast Storm Control Threshold */ /* These act per VF so an array friendly macro is used */ -#define E1000_V2PMAILBOX(_n) (0x00C40 + (4 * (_n))) -#define E1000_P2VMAILBOX(_n) (0x00C00 + (4 * (_n))) -#define E1000_VMBMEM(_n) (0x00800 + (64 * (_n))) -#define E1000_VFVMBMEM(_n) (0x00800 + (_n)) -#define E1000_VMOLR(_n) (0x05AD0 + (4 * (_n))) -#define E1000_VLVF(_n) (0x05D00 + (4 * (_n))) /* VLAN Virtual Machine - * Filter - RW */ -#define E1000_VMVIR(_n) (0x03700 + (4 * (_n))) -#define E1000_DVMOLR(_n) (0x0C038 + (0x40 * (_n))) /* DMA VM offload */ -/* Time Sync */ -#define E1000_TSYNCRXCTL 0x0B620 /* Rx Time Sync Control register - RW */ -#define E1000_TSYNCTXCTL 0x0B614 /* Tx Time Sync Control register - RW */ -#define E1000_TSYNCRXCFG 0x05F50 /* Time Sync Rx Configuration - RW */ -#define E1000_RXSTMPL 0x0B624 /* Rx timestamp Low - RO */ -#define E1000_RXSTMPH 0x0B628 /* Rx timestamp High - RO */ -#define E1000_RXSATRL 0x0B62C /* Rx timestamp attribute low - RO */ -#define E1000_RXSATRH 0x0B630 /* Rx timestamp attribute high - RO */ -#define E1000_TXSTMPL 0x0B618 /* Tx timestamp value Low - RO */ -#define E1000_TXSTMPH 0x0B61C /* Tx timestamp value High - RO */ -#define E1000_SYSTIML 0x0B600 /* System time register Low - RO */ -#define E1000_SYSTIMH 0x0B604 /* System time register High - RO */ -#define E1000_TIMINCA 0x0B608 /* Increment attributes register - RW */ -#define E1000_TSAUXC 0x0B640 /* Timesync Auxiliary Control register */ -#define E1000_SYSTIMR 0x0B6F8 /* System time register Residue */ -#define E1000_RXMTRL 0x0B634 /* Time sync Rx EtherType and Msg Type - RW */ -#define E1000_RXUDP 0x0B638 /* Time Sync Rx UDP Port - RW */ +#define E1000_V2PMAILBOX(_n) (0x00C40 + (4 * (_n))) +#define E1000_P2VMAILBOX(_n) (0x00C00 + (4 * (_n))) +#define E1000_VMBMEM(_n) (0x00800 + (64 * (_n))) +#define E1000_VFVMBMEM(_n) (0x00800 + (_n)) +#define E1000_VMOLR(_n) (0x05AD0 + (4 * (_n))) +/* VLAN Virtual Machine Filter - RW */ +#define E1000_VLVF(_n) (0x05D00 + (4 * (_n))) +#define E1000_VMVIR(_n) (0x03700 + (4 * (_n))) +#define E1000_DVMOLR(_n) (0x0C038 + (0x40 * (_n))) /* DMA VM offload */ +#define E1000_VTCTRL(_n) (0x10000 + (0x100 * (_n))) /* VT Control */ +#define E1000_TSYNCRXCTL 0x0B620 /* Rx Time Sync Control register - RW */ +#define E1000_TSYNCTXCTL 0x0B614 /* Tx Time Sync Control register - RW */ +#define E1000_TSYNCRXCFG 0x05F50 /* Time Sync Rx Configuration - RW */ +#define E1000_RXSTMPL 0x0B624 /* Rx timestamp Low - RO */ +#define E1000_RXSTMPH 0x0B628 /* Rx timestamp High - RO */ +#define E1000_RXSATRL 0x0B62C /* Rx timestamp attribute low - RO */ +#define E1000_RXSATRH 0x0B630 /* Rx timestamp attribute high - RO */ +#define E1000_TXSTMPL 0x0B618 /* Tx timestamp value Low - RO */ +#define E1000_TXSTMPH 0x0B61C /* Tx timestamp value High - RO */ +#define E1000_SYSTIML 0x0B600 /* System time register Low - RO */ +#define E1000_SYSTIMH 0x0B604 /* System time register High - RO */ +#define E1000_TIMINCA 0x0B608 /* Increment attributes register - RW */ +#define E1000_TSAUXC 0x0B640 /* Timesync Auxiliary Control register */ +#define E1000_SYSTIMR 0x0B6F8 /* System time register Residue */ +#define E1000_RXMTRL 0x0B634 /* Time sync Rx EtherType and Msg Type - RW */ +#define E1000_RXUDP 0x0B638 /* Time Sync Rx UDP Port - RW */ /* Filtering Registers */ -#define E1000_SAQF(_n) (0x05980 + (4 * (_n))) /* Source Address Queue Fltr */ -#define E1000_DAQF(_n) (0x059A0 + (4 * (_n))) /* Dest Address Queue Fltr */ -#define E1000_SPQF(_n) (0x059C0 + (4 * (_n))) /* Source Port Queue Fltr */ -#define E1000_FTQF(_n) (0x059E0 + (4 * (_n))) /* 5-tuple Queue Fltr */ -#define E1000_TTQF(_n) (0x059E0 + (4 * (_n))) /* 2-tuple Queue Fltr */ -#define E1000_SYNQF(_n) (0x055FC + (4 * (_n))) /* SYN Packet Queue Fltr */ -#define E1000_ETQF(_n) (0x05CB0 + (4 * (_n))) /* EType Queue Fltr */ +#define E1000_SAQF(_n) (0x05980 + (4 * (_n))) /* Source Address Queue Fltr */ +#define E1000_DAQF(_n) (0x059A0 + (4 * (_n))) /* Dest Address Queue Fltr */ +#define E1000_SPQF(_n) (0x059C0 + (4 * (_n))) /* Source Port Queue Fltr */ +#define E1000_FTQF(_n) (0x059E0 + (4 * (_n))) /* 5-tuple Queue Fltr */ +#define E1000_TTQF(_n) (0x059E0 + (4 * (_n))) /* 2-tuple Queue Fltr */ +#define E1000_SYNQF(_n) (0x055FC + (4 * (_n))) /* SYN Packet Queue Fltr */ +#define E1000_ETQF(_n) (0x05CB0 + (4 * (_n))) /* EType Queue Fltr */ -#define E1000_RTTDCS 0x3600 /* Reedtown Tx Desc plane control and status */ -#define E1000_RTTPCS 0x3474 /* Reedtown Tx Packet Plane control and status */ -#define E1000_RTRPCS 0x2474 /* Rx packet plane control and status */ -#define E1000_RTRUP2TC 0x05AC4 /* Rx User Priority to Traffic Class */ -#define E1000_RTTUP2TC 0x0418 /* Transmit User Priority to Traffic Class */ -#define E1000_RTTDTCRC(_n) (0x3610 + ((_n) * 4)) /* Tx Desc plane TC Rate-scheduler config */ -#define E1000_RTTPTCRC(_n) (0x3480 + ((_n) * 4)) /* Tx Packet plane TC Rate-Scheduler Config */ -#define E1000_RTRPTCRC(_n) (0x2480 + ((_n) * 4)) /* Rx Packet plane TC Rate-Scheduler Config */ -#define E1000_RTTDTCRS(_n) (0x3630 + ((_n) * 4)) /* Tx Desc Plane TC Rate-Scheduler Status */ -#define E1000_RTTDTCRM(_n) (0x3650 + ((_n) * 4)) /* Tx Desc Plane TC Rate-Scheduler MMW */ -#define E1000_RTTPTCRS(_n) (0x34A0 + ((_n) * 4)) /* Tx Packet plane TC Rate-Scheduler Status */ -#define E1000_RTTPTCRM(_n) (0x34C0 + ((_n) * 4)) /* Tx Packet plane TC Rate-scheduler MMW */ -#define E1000_RTRPTCRS(_n) (0x24A0 + ((_n) * 4)) /* Rx Packet plane TC Rate-Scheduler Status */ -#define E1000_RTRPTCRM(_n) (0x24C0 + ((_n) * 4)) /* Rx Packet plane TC Rate-Scheduler MMW */ -#define E1000_RTTDVMRM(_n) (0x3670 + ((_n) * 4)) /* Tx Desc plane VM Rate-Scheduler MMW*/ -#define E1000_RTTBCNRM(_n) (0x3690 + ((_n) * 4)) /* Tx BCN Rate-Scheduler MMW */ -#define E1000_RTTDQSEL 0x3604 /* Tx Desc Plane Queue Select */ -#define E1000_RTTDVMRC 0x3608 /* Tx Desc Plane VM Rate-Scheduler Config */ -#define E1000_RTTDVMRS 0x360C /* Tx Desc Plane VM Rate-Scheduler Status */ -#define E1000_RTTBCNRC 0x36B0 /* Tx BCN Rate-Scheduler Config */ -#define E1000_RTTBCNRS 0x36B4 /* Tx BCN Rate-Scheduler Status */ -#define E1000_RTTBCNCR 0xB200 /* Tx BCN Control Register */ -#define E1000_RTTBCNTG 0x35A4 /* Tx BCN Tagging */ -#define E1000_RTTBCNCP 0xB208 /* Tx BCN Congestion point */ -#define E1000_RTRBCNCR 0xB20C /* Rx BCN Control Register */ -#define E1000_RTTBCNRD 0x36B8 /* Tx BCN Rate Drift */ -#define E1000_PFCTOP 0x1080 /* Priority Flow Control Type and Opcode */ -#define E1000_RTTBCNIDX 0xB204 /* Tx BCN Congestion Point */ -#define E1000_RTTBCNACH 0x0B214 /* Tx BCN Control High */ -#define E1000_RTTBCNACL 0x0B210 /* Tx BCN Control Low */ +#define E1000_RTTDCS 0x3600 /* Reedtown Tx Desc plane control and status */ +#define E1000_RTTPCS 0x3474 /* Reedtown Tx Packet Plane control and status */ +#define E1000_RTRPCS 0x2474 /* Rx packet plane control and status */ +#define E1000_RTRUP2TC 0x05AC4 /* Rx User Priority to Traffic Class */ +#define E1000_RTTUP2TC 0x0418 /* Transmit User Priority to Traffic Class */ +/* Tx Desc plane TC Rate-scheduler config */ +#define E1000_RTTDTCRC(_n) (0x3610 + ((_n) * 4)) +/* Tx Packet plane TC Rate-Scheduler Config */ +#define E1000_RTTPTCRC(_n) (0x3480 + ((_n) * 4)) +/* Rx Packet plane TC Rate-Scheduler Config */ +#define E1000_RTRPTCRC(_n) (0x2480 + ((_n) * 4)) +/* Tx Desc Plane TC Rate-Scheduler Status */ +#define E1000_RTTDTCRS(_n) (0x3630 + ((_n) * 4)) +/* Tx Desc Plane TC Rate-Scheduler MMW */ +#define E1000_RTTDTCRM(_n) (0x3650 + ((_n) * 4)) +/* Tx Packet plane TC Rate-Scheduler Status */ +#define E1000_RTTPTCRS(_n) (0x34A0 + ((_n) * 4)) +/* Tx Packet plane TC Rate-scheduler MMW */ +#define E1000_RTTPTCRM(_n) (0x34C0 + ((_n) * 4)) +/* Rx Packet plane TC Rate-Scheduler Status */ +#define E1000_RTRPTCRS(_n) (0x24A0 + ((_n) * 4)) +/* Rx Packet plane TC Rate-Scheduler MMW */ +#define E1000_RTRPTCRM(_n) (0x24C0 + ((_n) * 4)) +/* Tx Desc plane VM Rate-Scheduler MMW*/ +#define E1000_RTTDVMRM(_n) (0x3670 + ((_n) * 4)) +/* Tx BCN Rate-Scheduler MMW */ +#define E1000_RTTBCNRM(_n) (0x3690 + ((_n) * 4)) +#define E1000_RTTDQSEL 0x3604 /* Tx Desc Plane Queue Select */ +#define E1000_RTTDVMRC 0x3608 /* Tx Desc Plane VM Rate-Scheduler Config */ +#define E1000_RTTDVMRS 0x360C /* Tx Desc Plane VM Rate-Scheduler Status */ +#define E1000_RTTBCNRC 0x36B0 /* Tx BCN Rate-Scheduler Config */ +#define E1000_RTTBCNRS 0x36B4 /* Tx BCN Rate-Scheduler Status */ +#define E1000_RTTBCNCR 0xB200 /* Tx BCN Control Register */ +#define E1000_RTTBCNTG 0x35A4 /* Tx BCN Tagging */ +#define E1000_RTTBCNCP 0xB208 /* Tx BCN Congestion point */ +#define E1000_RTRBCNCR 0xB20C /* Rx BCN Control Register */ +#define E1000_RTTBCNRD 0x36B8 /* Tx BCN Rate Drift */ +#define E1000_PFCTOP 0x1080 /* Priority Flow Control Type and Opcode */ +#define E1000_RTTBCNIDX 0xB204 /* Tx BCN Congestion Point */ +#define E1000_RTTBCNACH 0x0B214 /* Tx BCN Control High */ +#define E1000_RTTBCNACL 0x0B210 /* Tx BCN Control Low */ /* DMA Coalescing registers */ -#define E1000_DMACR 0x02508 /* Control Register */ -#define E1000_DMCTXTH 0x03550 /* Transmit Threshold */ -#define E1000_DMCTLX 0x02514 /* Time to Lx Request */ -#define E1000_DMCRTRH 0x05DD0 /* Receive Packet Rate Threshold */ -#define E1000_DMCCNT 0x05DD4 /* Current Rx Count */ -#define E1000_FCRTC 0x02170 /* Flow Control Rx high watermark */ -#define E1000_PCIEMISC 0x05BB8 /* PCIE misc config register */ +#define E1000_DMACR 0x02508 /* Control Register */ +#define E1000_DMCTXTH 0x03550 /* Transmit Threshold */ +#define E1000_DMCTLX 0x02514 /* Time to Lx Request */ +#define E1000_DMCRTRH 0x05DD0 /* Receive Packet Rate Threshold */ +#define E1000_DMCCNT 0x05DD4 /* Current Rx Count */ +#define E1000_FCRTC 0x02170 /* Flow Control Rx high watermark */ +#define E1000_PCIEMISC 0x05BB8 /* PCIE misc config register */ /* PCIe Parity Status Register */ -#define E1000_PCIEERRSTS 0x05BA8 +#define E1000_PCIEERRSTS 0x05BA8 -#define E1000_PROXYS 0x5F64 /* Proxying Status */ -#define E1000_PROXYFC 0x5F60 /* Proxying Filter Control */ +#define E1000_PROXYS 0x5F64 /* Proxying Status */ +#define E1000_PROXYFC 0x5F60 /* Proxying Filter Control */ /* Thermal sensor configuration and status registers */ -#define E1000_THMJT 0x08100 /* Junction Temperature */ -#define E1000_THLOWTC 0x08104 /* Low Threshold Control */ -#define E1000_THMIDTC 0x08108 /* Mid Threshold Control */ -#define E1000_THHIGHTC 0x0810C /* High Threshold Control */ -#define E1000_THSTAT 0x08110 /* Thermal Sensor Status */ +#define E1000_THMJT 0x08100 /* Junction Temperature */ +#define E1000_THLOWTC 0x08104 /* Low Threshold Control */ +#define E1000_THMIDTC 0x08108 /* Mid Threshold Control */ +#define E1000_THHIGHTC 0x0810C /* High Threshold Control */ +#define E1000_THSTAT 0x08110 /* Thermal Sensor Status */ -/*Energy Efficient Ethernet "EEE" registers */ -#define E1000_IPCNFG 0x0E38 /* Internal PHY Configuration */ -#define E1000_LTRC 0x01A0 /* Latency Tolerance Reporting Control */ -#define E1000_EEER 0x0E30 /* Energy Efficient Ethernet "EEE"*/ -#define E1000_EEE_SU 0x0E34 /* EEE Setup */ -#define E1000_TLPIC 0x4148 /* EEE Tx LPI Count - TLPIC */ -#define E1000_RLPIC 0x414C /* EEE Rx LPI Count - RLPIC */ +/* Energy Efficient Ethernet "EEE" registers */ +#define E1000_IPCNFG 0x0E38 /* Internal PHY Configuration */ +#define E1000_LTRC 0x01A0 /* Latency Tolerance Reporting Control */ +#define E1000_EEER 0x0E30 /* Energy Efficient Ethernet "EEE"*/ +#define E1000_EEE_SU 0x0E34 /* EEE Setup */ +#define E1000_TLPIC 0x4148 /* EEE Tx LPI Count - TLPIC */ +#define E1000_RLPIC 0x414C /* EEE Rx LPI Count - RLPIC */ /* OS2BMC Registers */ -#define E1000_B2OSPC 0x08FE0 /* BMC2OS packets sent by BMC */ -#define E1000_B2OGPRC 0x04158 /* BMC2OS packets received by host */ -#define E1000_O2BGPTC 0x08FE4 /* OS2BMC packets received by BMC */ -#define E1000_O2BSPC 0x0415C /* OS2BMC packets transmitted by host */ +#define E1000_B2OSPC 0x08FE0 /* BMC2OS packets sent by BMC */ +#define E1000_B2OGPRC 0x04158 /* BMC2OS packets received by host */ +#define E1000_O2BGPTC 0x08FE4 /* OS2BMC packets received by BMC */ +#define E1000_O2BSPC 0x0415C /* OS2BMC packets transmitted by host */ + +#define E1000_LTRMINV 0x5BB0 /* LTR Minimum Value */ +#define E1000_LTRMAXV 0x5BB4 /* LTR Maximum Value */ +#define E1000_DOBFFCTL 0x3F24 /* DMA OBFF Control Register */ + #endif diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_vf.c b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_vf.c index be93eecc62..d1286ad2a5 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_vf.c +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_vf.c @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2010, Intel Corporation + Copyright (c) 2001-2011, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -30,27 +30,27 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: src/sys/dev/e1000/e1000_vf.c,v 1.1.2.2.2.1 2010/12/21 17:09:25 kensmith Exp $*/ +/*$FreeBSD$*/ #include "e1000_api.h" -static s32 e1000_init_phy_params_vf(struct e1000_hw *hw); -static s32 e1000_init_nvm_params_vf(struct e1000_hw *hw); -static void e1000_release_vf(struct e1000_hw *hw); -static s32 e1000_acquire_vf(struct e1000_hw *hw); -static s32 e1000_setup_link_vf(struct e1000_hw *hw); -static s32 e1000_get_bus_info_pcie_vf(struct e1000_hw *hw); -static s32 e1000_init_mac_params_vf(struct e1000_hw *hw); -static s32 e1000_check_for_link_vf(struct e1000_hw *hw); -static s32 e1000_get_link_up_info_vf(struct e1000_hw *hw, u16 *speed, - u16 *duplex); -static s32 e1000_init_hw_vf(struct e1000_hw *hw); -static s32 e1000_reset_hw_vf(struct e1000_hw *hw); -static void e1000_update_mc_addr_list_vf(struct e1000_hw *hw, u8 *, u32); -static void e1000_rar_set_vf(struct e1000_hw *, u8 *, u32); -static s32 e1000_read_mac_addr_vf(struct e1000_hw *); +static s32 e1000_init_phy_params_vf(struct e1000_hw *hw); +static s32 e1000_init_nvm_params_vf(struct e1000_hw *hw); +static void e1000_release_vf(struct e1000_hw *hw); +static s32 e1000_acquire_vf(struct e1000_hw *hw); +static s32 e1000_setup_link_vf(struct e1000_hw *hw); +static s32 e1000_get_bus_info_pcie_vf(struct e1000_hw *hw); +static s32 e1000_init_mac_params_vf(struct e1000_hw *hw); +static s32 e1000_check_for_link_vf(struct e1000_hw *hw); +static s32 e1000_get_link_up_info_vf(struct e1000_hw *hw, u16 *speed, + u16 *duplex); +static s32 e1000_init_hw_vf(struct e1000_hw *hw); +static s32 e1000_reset_hw_vf(struct e1000_hw *hw); +static void e1000_update_mc_addr_list_vf(struct e1000_hw *hw, u8 *, u32); +static void e1000_rar_set_vf(struct e1000_hw *, u8 *, u32); +static s32 e1000_read_mac_addr_vf(struct e1000_hw *); /** * e1000_init_phy_params_vf - Inits PHY params @@ -219,7 +219,7 @@ static s32 e1000_get_bus_info_pcie_vf(struct e1000_hw *hw) * the status register's data which is often stale and inaccurate. **/ static s32 e1000_get_link_up_info_vf(struct e1000_hw *hw, u16 *speed, - u16 *duplex) + u16 *duplex) { s32 status; @@ -288,7 +288,7 @@ static s32 e1000_reset_hw_vf(struct e1000_hw *hw) ret_val = mbx->ops.read_posted(hw, msgbuf, 3, 0); if (!ret_val) { if (msgbuf[0] == (E1000_VF_RESET | - E1000_VT_MSGTYPE_ACK)) + E1000_VT_MSGTYPE_ACK)) memcpy(hw->mac.perm_addr, addr, 6); else ret_val = -E1000_ERR_MAC_INIT; @@ -369,11 +369,22 @@ static u32 e1000_hash_mc_addr_vf(struct e1000_hw *hw, u8 *mc_addr) bit_shift++; hash_value = hash_mask & (((mc_addr[4] >> (8 - bit_shift)) | - (((u16) mc_addr[5]) << bit_shift))); + (((u16) mc_addr[5]) << bit_shift))); return hash_value; } +static void e1000_write_msg_read_ack(struct e1000_hw *hw, + u32 *msg, u16 size) +{ + struct e1000_mbx_info *mbx = &hw->mbx; + u32 retmsg[E1000_VFMAILBOX_SIZE]; + s32 retval = mbx->ops.write_posted(hw, msg, size, 0); + + if (!retval) + mbx->ops.read_posted(hw, retmsg, E1000_VFMAILBOX_SIZE, 0); +} + /** * e1000_update_mc_addr_list_vf - Update Multicast addresses * @hw: pointer to the HW structure @@ -384,9 +395,8 @@ static u32 e1000_hash_mc_addr_vf(struct e1000_hw *hw, u8 *mc_addr) * The caller must have a packed mc_addr_list of multicast addresses. **/ void e1000_update_mc_addr_list_vf(struct e1000_hw *hw, - u8 *mc_addr_list, u32 mc_addr_count) + u8 *mc_addr_list, u32 mc_addr_count) { - struct e1000_mbx_info *mbx = &hw->mbx; u32 msgbuf[E1000_VFMAILBOX_SIZE]; u16 *hash_list = (u16 *)&msgbuf[1]; u32 hash_value; @@ -420,7 +430,7 @@ void e1000_update_mc_addr_list_vf(struct e1000_hw *hw, mc_addr_list += ETH_ADDR_LEN; } - mbx->ops.write_posted(hw, msgbuf, E1000_VFMAILBOX_SIZE, 0); + e1000_write_msg_read_ack(hw, msgbuf, E1000_VFMAILBOX_SIZE); } /** @@ -431,7 +441,6 @@ void e1000_update_mc_addr_list_vf(struct e1000_hw *hw, **/ void e1000_vfta_set_vf(struct e1000_hw *hw, u16 vid, bool set) { - struct e1000_mbx_info *mbx = &hw->mbx; u32 msgbuf[2]; msgbuf[0] = E1000_VF_SET_VLAN; @@ -440,7 +449,7 @@ void e1000_vfta_set_vf(struct e1000_hw *hw, u16 vid, bool set) if (set) msgbuf[0] |= E1000_VF_SET_VLAN_ADD; - mbx->ops.write_posted(hw, msgbuf, 2, 0); + e1000_write_msg_read_ack(hw, msgbuf, 2); } /** e1000_rlpml_set_vf - Set the maximum receive packet length @@ -449,13 +458,12 @@ void e1000_vfta_set_vf(struct e1000_hw *hw, u16 vid, bool set) **/ void e1000_rlpml_set_vf(struct e1000_hw *hw, u16 max_size) { - struct e1000_mbx_info *mbx = &hw->mbx; u32 msgbuf[2]; msgbuf[0] = E1000_VF_SET_LPE; msgbuf[1] = max_size; - mbx->ops.write_posted(hw, msgbuf, 2, 0); + e1000_write_msg_read_ack(hw, msgbuf, 2); } /** diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_vf.h b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_vf.h index 591c09c848..0ee73aec62 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_vf.h +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_vf.h @@ -30,7 +30,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: src/sys/dev/e1000/e1000_vf.h,v 1.1.2.2.2.1 2010/12/21 17:09:25 kensmith Exp $*/ +/*$FreeBSD$*/ #ifndef _E1000_VF_H_ #define _E1000_VF_H_ diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/if_em.c b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/if_em.c index 625022c7c5..b58abd330f 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/if_em.c +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/if_em.c @@ -30,22 +30,21 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: src/sys/dev/e1000/if_em.c,v 1.21.2.18.2.3 2011/01/25 23:20:22 jfv Exp $*/ +/*$FreeBSD$*/ #ifdef HAVE_KERNEL_OPTION_HEADERS #include "opt_device_polling.h" #include "opt_inet.h" +#include "opt_inet6.h" #endif #include #include - #ifndef __HAIKU__ #if __FreeBSD_version >= 800000 #include #endif #endif - #include #include #include @@ -81,11 +80,9 @@ #include #include - #ifndef __HAIKU__ #include #endif - #include #include @@ -101,7 +98,7 @@ int em_display_debug_stats = 0; /********************************************************************* * Driver version: *********************************************************************/ -char em_driver_version[] = "7.2.3"; +char em_driver_version[] = "7.3.2"; /********************************************************************* * PCI Device ID Table @@ -200,13 +197,14 @@ static int em_detach(device_t); static int em_shutdown(device_t); static int em_suspend(device_t); static int em_resume(device_t); -static void em_start(struct ifnet *); -static void em_start_locked(struct ifnet *, struct tx_ring *); #ifdef EM_MULTIQUEUE static int em_mq_start(struct ifnet *, struct mbuf *); static int em_mq_start_locked(struct ifnet *, struct tx_ring *, struct mbuf *); static void em_qflush(struct ifnet *); +#else +static void em_start(struct ifnet *); +static void em_start_locked(struct ifnet *, struct tx_ring *); #endif static int em_ioctl(struct ifnet *, u_long, caddr_t); static void em_init(void *); @@ -241,7 +239,7 @@ static void em_enable_intr(struct adapter *); static void em_disable_intr(struct adapter *); static void em_update_stats_counters(struct adapter *); static void em_add_hw_stats(struct adapter *adapter); -static bool em_txeof(struct tx_ring *); +static void em_txeof(struct tx_ring *); static bool em_rxeof(struct rx_ring *, int, int *); #ifndef __NO_STRICT_ALIGNMENT static int em_fixup_rx(struct rx_ring *); @@ -294,6 +292,8 @@ static void em_handle_link(void *context, int pending); static void em_set_sysctl_value(struct adapter *, const char *, const char *, int *, int); +static int em_set_flowcntl(SYSCTL_HANDLER_ARGS); +static int em_sysctl_eee(SYSCTL_HANDLER_ARGS); static __inline void em_rx_discard(struct rx_ring *, int); @@ -338,7 +338,7 @@ MODULE_DEPEND(em, ether, 1, 1, 1); #define CSUM_TSO 0 #endif -SYSCTL_NODE(_hw, OID_AUTO, em, CTLFLAG_RD, 0, "EM driver parameters"); +static SYSCTL_NODE(_hw, OID_AUTO, em, CTLFLAG_RD, 0, "EM driver parameters"); static int em_tx_int_delay_dflt = EM_TICKS_TO_USECS(EM_TIDV); static int em_rx_int_delay_dflt = EM_TICKS_TO_USECS(EM_RDTR); @@ -390,16 +390,11 @@ static int em_rx_process_limit = 100; TUNABLE_INT("hw.em.rx_process_limit", &em_rx_process_limit); SYSCTL_INT(_hw_em, OID_AUTO, rx_process_limit, CTLFLAG_RDTUN, &em_rx_process_limit, 0, - "Maximum number of received packets to process at a time, -1 means unlimited"); - -/* Flow control setting - default to FULL */ -static int em_fc_setting = e1000_fc_full; -TUNABLE_INT("hw.em.fc_setting", &em_fc_setting); -SYSCTL_INT(_hw_em, OID_AUTO, fc_setting, CTLFLAG_RDTUN, &em_fc_setting, 0, - "Flow control"); + "Maximum number of received packets to process " + "at a time, -1 means unlimited"); /* Energy efficient ethernet - default to OFF */ -static int eee_setting = 0; +static int eee_setting = 1; TUNABLE_INT("hw.em.eee_setting", &eee_setting); SYSCTL_INT(_hw_em, OID_AUTO, eee_setting, CTLFLAG_RDTUN, &eee_setting, 0, "Enable Energy Efficient Ethernet"); @@ -407,6 +402,10 @@ SYSCTL_INT(_hw_em, OID_AUTO, eee_setting, CTLFLAG_RDTUN, &eee_setting, 0, /* Global used in WOL setup with multiport cards */ static int global_quad_port_a = 0; +#ifdef DEV_NETMAP /* see ixgbe.c for details */ +#include +#endif /* DEV_NETMAP */ + /********************************************************************* * Device identification routine * @@ -477,6 +476,13 @@ em_attach(device_t dev) INIT_DEBUGOUT("em_attach: begin"); +#ifndef __HAIKU__ + if (resource_disabled("em", device_get_unit(dev))) { + device_printf(dev, "Disabled by device hint\n"); + return (ENXIO); + } +#endif + adapter = device_get_softc(dev); adapter->dev = adapter->osdep.dev = dev; hw = &adapter->hw; @@ -493,6 +499,11 @@ em_attach(device_t dev) OID_AUTO, "debug", CTLTYPE_INT|CTLFLAG_RW, adapter, 0, em_sysctl_debug_info, "I", "Debug Information"); + SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), + OID_AUTO, "fc", CTLTYPE_INT|CTLFLAG_RW, adapter, 0, + em_set_flowcntl, "I", "Flow Control"); + callout_init_mtx(&adapter->timer, &adapter->core_mtx, 0); /* Determine hardware and mac info */ @@ -564,11 +575,6 @@ em_attach(device_t dev) "max number of rx packets to process", &adapter->rx_process_limit, em_rx_process_limit); - /* Sysctl for setting the interface flow control */ - em_set_sysctl_value(adapter, "flow_control", - "configure flow control", - &adapter->fc_setting, em_fc_setting); - /* * Validate number of transmit and receive descriptors. It * must not exceed hardware maximum, and must be multiple @@ -637,9 +643,12 @@ em_attach(device_t dev) " due to SOL/IDER session.\n"); /* Sysctl for setting Energy Efficient Ethernet */ - em_set_sysctl_value(adapter, "eee_control", - "enable Energy Efficient Ethernet", - &hw->dev_spec.ich8lan.eee_disable, eee_setting); + hw->dev_spec.ich8lan.eee_disable = eee_setting; + SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), + OID_AUTO, "eee_control", CTLTYPE_INT|CTLFLAG_RW, + adapter, 0, em_sysctl_eee, "I", + "Disable Energy Efficient Ethernet"); /* ** Start from a known state, this is @@ -718,12 +727,16 @@ em_attach(device_t dev) em_get_hw_control(adapter); /* Tell the stack that the interface is not active */ - adapter->ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); + adapter->ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + adapter->ifp->if_drv_flags |= IFF_DRV_OACTIVE; #ifndef __HAIKU__ adapter->led_dev = led_create(em_led_func, adapter, device_get_nameunit(dev)); #endif +#ifdef DEV_NETMAP + em_netmap_attach(adapter); +#endif /* DEV_NETMAP */ INIT_DEBUGOUT("em_attach: end"); @@ -771,7 +784,6 @@ em_detach(device_t dev) if (ifp->if_capenable & IFCAP_POLLING) ether_poll_deregister(ifp); #endif - #ifndef __HAIKU__ if (adapter->led_dev != NULL) led_destroy(adapter->led_dev); @@ -797,6 +809,10 @@ em_detach(device_t dev) ether_ifdetach(adapter->ifp); callout_drain(&adapter->timer); +#ifdef DEV_NETMAP + netmap_detach(ifp); +#endif /* DEV_NETMAP */ + em_free_pci_resources(adapter); bus_generic_detach(dev); if_free(ifp); @@ -845,29 +861,45 @@ static int em_resume(device_t dev) { struct adapter *adapter = device_get_softc(dev); + struct tx_ring *txr = adapter->tx_rings; struct ifnet *ifp = adapter->ifp; EM_CORE_LOCK(adapter); + if (adapter->hw.mac.type == e1000_pch2lan) + e1000_resume_workarounds_pchlan(&adapter->hw); em_init_locked(adapter); em_init_manageability(adapter); + + if ((ifp->if_flags & IFF_UP) && + (ifp->if_drv_flags & IFF_DRV_RUNNING) && adapter->link_active) { + int i; + for (i = 0; i < adapter->num_queues; i++, txr++) { + EM_TX_LOCK(txr); +#ifdef EM_MULTIQUEUE + if (!drbr_empty(ifp, txr->br)) + em_mq_start_locked(ifp, txr, NULL); +#else + if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) + em_start_locked(ifp, txr); +#endif + EM_TX_UNLOCK(txr); + } + } EM_CORE_UNLOCK(adapter); - em_start(ifp); return bus_generic_resume(dev); } -/********************************************************************* - * Transmit entry point - * - * em_start is called by the stack to initiate a transmit. - * The driver will remain in this routine as long as there are - * packets to transmit and transmit resources are available. - * In case resources are not available stack is notified and - * the packet is requeued. - **********************************************************************/ - #ifdef EM_MULTIQUEUE +/********************************************************************* + * Multiqueue Transmit routines + * + * em_mq_start is called by the stack to initiate a transmit. + * however, if busy the driver can queue the request rather + * than do an immediate send. It is this that is an advantage + * in this driver, rather than also having multiple tx queues. + **********************************************************************/ static int em_mq_start_locked(struct ifnet *ifp, struct tx_ring *txr, struct mbuf *m) { @@ -882,10 +914,6 @@ em_mq_start_locked(struct ifnet *ifp, struct tx_ring *txr, struct mbuf *m) return (err); } - /* Call cleanup if number of TX descriptors low */ - if (txr->tx_avail <= EM_TX_CLEANUP_THRESHOLD) - em_txeof(txr); - enq = 0; if (m == NULL) { next = drbr_dequeue(ifp, txr->br); @@ -908,10 +936,6 @@ em_mq_start_locked(struct ifnet *ifp, struct tx_ring *txr, struct mbuf *m) ETHER_BPF_MTAP(ifp, next); if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) break; - if (txr->tx_avail < EM_MAX_SCATTER) { - ifp->if_drv_flags |= IFF_DRV_OACTIVE; - break; - } next = drbr_dequeue(ifp, txr->br); } @@ -920,6 +944,11 @@ em_mq_start_locked(struct ifnet *ifp, struct tx_ring *txr, struct mbuf *m) txr->queue_status = EM_QUEUE_WORKING; txr->watchdog_time = ticks; } + + if (txr->tx_avail < EM_MAX_SCATTER) + em_txeof(txr); + if (txr->tx_avail < EM_MAX_SCATTER) + ifp->if_drv_flags |= IFF_DRV_OACTIVE; return (err); } @@ -948,11 +977,12 @@ em_mq_start(struct ifnet *ifp, struct mbuf *m) static void em_qflush(struct ifnet *ifp) { + int i; struct adapter *adapter = ifp->if_softc; struct tx_ring *txr = adapter->tx_rings; struct mbuf *m; - for (int i = 0; i < adapter->num_queues; i++, txr++) { + for (i = 0; i < adapter->num_queues; i++, txr++) { EM_TX_LOCK(txr); while ((m = buf_ring_dequeue_sc(txr->br)) != NULL) m_freem(m); @@ -960,8 +990,7 @@ em_qflush(struct ifnet *ifp) } if_qflush(ifp); } - -#endif /* EM_MULTIQUEUE */ +#else /* !EM_MULTIQUEUE */ static void em_start_locked(struct ifnet *ifp, struct tx_ring *txr) @@ -996,7 +1025,6 @@ em_start_locked(struct ifnet *ifp, struct tx_ring *txr) if (em_xmit(txr, &m_head)) { if (m_head == NULL) break; - ifp->if_drv_flags |= IFF_DRV_OACTIVE; IFQ_DRV_PREPEND(&ifp->if_snd, m_head); break; } @@ -1025,6 +1053,7 @@ em_start(struct ifnet *ifp) } return; } +#endif /* EM_MULTIQUEUE */ /********************************************************************* * Ioctl entry point @@ -1039,11 +1068,12 @@ static int em_ioctl(struct ifnet *ifp, u_long command, caddr_t data) { struct adapter *adapter = ifp->if_softc; - struct ifreq *ifr = (struct ifreq *)data; -#ifdef INET - struct ifaddr *ifa = (struct ifaddr *)data; + struct ifreq *ifr = (struct ifreq *)data; +#if defined(INET) || defined(INET6) + struct ifaddr *ifa = (struct ifaddr *)data; #endif - int error = 0; + bool avoid_reset = FALSE; + int error = 0; if (adapter->in_detach) return (error); @@ -1051,23 +1081,26 @@ em_ioctl(struct ifnet *ifp, u_long command, caddr_t data) switch (command) { case SIOCSIFADDR: #ifdef INET - if (ifa->ifa_addr->sa_family == AF_INET) { - /* - * XXX - * Since resetting hardware takes a very long time - * and results in link renegotiation we only - * initialize the hardware only when it is absolutely - * required. - */ - ifp->if_flags |= IFF_UP; - if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) { - EM_CORE_LOCK(adapter); - em_init_locked(adapter); - EM_CORE_UNLOCK(adapter); - } - arp_ifinit(ifp, ifa); - } else + if (ifa->ifa_addr->sa_family == AF_INET) + avoid_reset = TRUE; #endif +#ifdef INET6 + if (ifa->ifa_addr->sa_family == AF_INET6) + avoid_reset = TRUE; +#endif + /* + ** Calling init results in link renegotiation, + ** so we avoid doing it when possible. + */ + if (avoid_reset) { + ifp->if_flags |= IFF_UP; + if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) + em_init(adapter); +#ifdef INET + if (!(ifp->if_flags & IFF_NOARP)) + arp_ifinit(ifp, ifa); +#endif + } else error = ether_ioctl(ifp, command, data); break; case SIOCSIFMTU: @@ -1084,6 +1117,7 @@ em_ioctl(struct ifnet *ifp, u_long command, caddr_t data) case e1000_ich10lan: case e1000_pch2lan: case e1000_82574: + case e1000_82583: case e1000_80003es2lan: /* 9K Jumbo Frame size */ max_frame_size = 9234; break; @@ -1091,7 +1125,6 @@ em_ioctl(struct ifnet *ifp, u_long command, caddr_t data) max_frame_size = 4096; break; /* Adapters that do not support jumbo frames */ - case e1000_82583: case e1000_ich8lan: max_frame_size = ETHER_MAX_LEN; break; @@ -1146,11 +1179,6 @@ em_ioctl(struct ifnet *ifp, u_long command, caddr_t data) } break; case SIOCSIFMEDIA: - /* - ** As the speed/duplex settings are being - ** changed, we need to reset the PHY. - */ - adapter->hw.phy.reset_disable = FALSE; /* Check SOL/IDER usage */ EM_CORE_LOCK(adapter); if (e1000_check_reset_block(&adapter->hw)) { @@ -1209,6 +1237,10 @@ em_ioctl(struct ifnet *ifp, u_long command, caddr_t data) ifp->if_capenable ^= IFCAP_VLAN_HWFILTER; reinit = 1; } + if (mask & IFCAP_VLAN_HWTSO) { + ifp->if_capenable ^= IFCAP_VLAN_HWTSO; + reinit = 1; + } if ((mask & IFCAP_WOL) && (ifp->if_capabilities & IFCAP_WOL) != 0) { if (mask & IFCAP_WOL_MCAST) @@ -1247,7 +1279,6 @@ em_init_locked(struct adapter *adapter) { struct ifnet *ifp = adapter->ifp; device_t dev = adapter->dev; - u32 pba; INIT_DEBUGOUT("em_init: begin"); @@ -1256,46 +1287,6 @@ em_init_locked(struct adapter *adapter) em_disable_intr(adapter); callout_stop(&adapter->timer); - /* - * Packet Buffer Allocation (PBA) - * Writing PBA sets the receive portion of the buffer - * the remainder is used for the transmit buffer. - */ - switch (adapter->hw.mac.type) { - /* Total Packet Buffer on these is 48K */ - case e1000_82571: - case e1000_82572: - case e1000_80003es2lan: - pba = E1000_PBA_32K; /* 32K for Rx, 16K for Tx */ - break; - case e1000_82573: /* 82573: Total Packet Buffer is 32K */ - pba = E1000_PBA_12K; /* 12K for Rx, 20K for Tx */ - break; - case e1000_82574: - case e1000_82583: - pba = E1000_PBA_20K; /* 20K for Rx, 20K for Tx */ - break; - case e1000_ich8lan: - pba = E1000_PBA_8K; - break; - case e1000_ich9lan: - case e1000_ich10lan: - pba = E1000_PBA_10K; - break; - case e1000_pchlan: - case e1000_pch2lan: - pba = E1000_PBA_26K; - break; - default: - if (adapter->max_frame_size > 8192) - pba = E1000_PBA_40K; /* 40K for Rx, 24K for Tx */ - else - pba = E1000_PBA_48K; /* 48K for Rx, 16K for Tx */ - } - - INIT_DEBUGOUT1("em_init: pba=%dK",pba); - E1000_WRITE_REG(&adapter->hw, E1000_PBA, pba); - /* Get the latest mac address, User can use a LAA */ bcopy(IF_LLADDR(adapter->ifp), adapter->hw.mac.addr, ETHER_ADDR_LEN); @@ -1374,6 +1365,7 @@ em_init_locked(struct adapter *adapter) /* Don't lose promiscuous settings */ em_set_promisc(adapter); + /* Set the interface as ACTIVE */ ifp->if_drv_flags |= IFF_DRV_RUNNING; ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; @@ -1404,9 +1396,6 @@ em_init_locked(struct adapter *adapter) /* AMT based hardware can now take control from firmware */ if (adapter->has_manage && adapter->has_amt) em_get_hw_control(adapter); - - /* Don't reset the phy next time init gets called */ - adapter->hw.phy.reset_disable = TRUE; } static void @@ -1461,7 +1450,8 @@ em_poll(struct ifnet *ifp, enum poll_cmd cmd, int count) if (!drbr_empty(ifp, txr->br)) em_mq_start_locked(ifp, txr, NULL); #else - em_start_locked(ifp, txr); + if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) + em_start_locked(ifp, txr); #endif EM_TX_UNLOCK(txr); @@ -1534,10 +1524,11 @@ em_handle_que(void *context, int pending) if (!drbr_empty(ifp, txr->br)) em_mq_start_locked(ifp, txr, NULL); #else - em_start_locked(ifp, txr); + if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) + em_start_locked(ifp, txr); #endif EM_TX_UNLOCK(txr); - if (more || (ifp->if_drv_flags & IFF_DRV_OACTIVE)) { + if (more) { taskqueue_enqueue(adapter->tq, &adapter->que_task); return; } @@ -1558,17 +1549,21 @@ em_msix_tx(void *arg) { struct tx_ring *txr = arg; struct adapter *adapter = txr->adapter; - bool more; + struct ifnet *ifp = adapter->ifp; ++txr->tx_irq; EM_TX_LOCK(txr); - more = em_txeof(txr); + em_txeof(txr); +#ifdef EM_MULTIQUEUE + if (!drbr_empty(ifp, txr->br)) + em_mq_start_locked(ifp, txr, NULL); +#else + if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) + em_start_locked(ifp, txr); +#endif + /* Reenable this interrupt */ + E1000_WRITE_REG(&adapter->hw, E1000_IMS, txr->ims); EM_TX_UNLOCK(txr); - if (more) - taskqueue_enqueue(txr->tq, &txr->tx_task); - else - /* Reenable this interrupt */ - E1000_WRITE_REG(&adapter->hw, E1000_IMS, txr->ims); return; } @@ -1646,7 +1641,8 @@ em_handle_tx(void *context, int pending) if (!drbr_empty(ifp, txr->br)) em_mq_start_locked(ifp, txr, NULL); #else - em_start_locked(ifp, txr); + if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) + em_start_locked(ifp, txr); #endif E1000_WRITE_REG(&adapter->hw, E1000_IMS, txr->ims); EM_TX_UNLOCK(txr); @@ -1656,6 +1652,7 @@ static void em_handle_link(void *context, int pending) { struct adapter *adapter = context; + struct tx_ring *txr = adapter->tx_rings; struct ifnet *ifp = adapter->ifp; if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) @@ -1667,6 +1664,20 @@ em_handle_link(void *context, int pending) callout_reset(&adapter->timer, hz, em_local_timer, adapter); E1000_WRITE_REG(&adapter->hw, E1000_IMS, EM_MSIX_LINK | E1000_IMS_LSC); + if (adapter->link_active) { + int i; + for (i = 0; i < adapter->num_queues; i++, txr++) { + EM_TX_LOCK(txr); +#ifdef EM_MULTIQUEUE + if (!drbr_empty(ifp, txr->br)) + em_mq_start_locked(ifp, txr, NULL); +#else + if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) + em_start_locked(ifp, txr); +#endif + EM_TX_UNLOCK(txr); + } + } EM_CORE_UNLOCK(adapter); } @@ -1996,6 +2007,14 @@ retry: em_transmit_checksum_setup(txr, m_head, ip_off, ip, &txd_upper, &txd_lower); + if (m_head->m_flags & M_VLANTAG) { + /* Set the vlan id. */ + txd_upper |= + (htole16(m_head->m_pkthdr.ether_vtag) << 16); + /* Tell hardware to add tag */ + txd_lower |= htole32(E1000_TXD_CMD_VLE); + } + i = txr->next_avail_desc; /* Set up our transmit descriptors */ @@ -2053,15 +2072,13 @@ retry: if (tso_desc) /* TSO used an extra for sentinel */ txr->tx_avail -= txd_used; - if (m_head->m_flags & M_VLANTAG) { - /* Set the vlan id. */ - ctxd->upper.fields.special = - htole16(m_head->m_pkthdr.ether_vtag); - /* Tell hardware to add tag */ - ctxd->lower.data |= htole32(E1000_TXD_CMD_VLE); - } - tx_buffer->m_head = m_head; + /* + ** Here we swap the map so the last descriptor, + ** which gets the completion interrupt has the + ** real map, and the first descriptor gets the + ** unused map from this descriptor. + */ tx_buffer_mapped->map = tx_buffer->map; tx_buffer->map = map; bus_dmamap_sync(txr->txtag, map, BUS_DMASYNC_PREWRITE); @@ -2209,12 +2226,12 @@ em_set_multi(struct adapter *adapter) static void em_local_timer(void *arg) { + int i; struct adapter *adapter = arg; struct ifnet *ifp = adapter->ifp; struct tx_ring *txr = adapter->tx_rings; struct rx_ring *rxr = adapter->rx_rings; u32 trigger; - int i = 0; EM_CORE_LOCK_ASSERT(adapter); @@ -2232,22 +2249,21 @@ em_local_timer(void *arg) else trigger = E1000_ICS_RXDMT0; - /* - ** Don't do TX watchdog check if we've been paused - */ - if (adapter->pause_frames) { - adapter->pause_frames = 0; - goto out; - } /* ** Check on the state of the TX queue(s), this ** can be done without the lock because its RO ** and the HUNG state will be static if set. */ - for (i = 0; i < adapter->num_queues; i++, txr++) - if (txr->queue_status == EM_QUEUE_HUNG) + for (i = 0; i < adapter->num_queues; i++, txr++) { + if ((txr->queue_status == EM_QUEUE_HUNG) && + (adapter->pause_frames == 0)) goto hung; -out: + /* Schedule a TX tasklet if needed */ + if (txr->tx_avail <= EM_MAX_SCATTER) + taskqueue_enqueue(txr->tq, &txr->tx_task); + } + + adapter->pause_frames = 0; callout_reset(&adapter->timer, hz, em_local_timer, adapter); #ifndef DEVICE_POLLING /* Trigger an RX interrupt to guarantee mbuf refresh */ @@ -2266,6 +2282,7 @@ hung: txr->me, txr->tx_avail, txr->next_to_clean); ifp->if_drv_flags &= ~IFF_DRV_RUNNING; adapter->watchdog_events++; + adapter->pause_frames = 0; em_init_locked(adapter); } @@ -2328,7 +2345,7 @@ em_update_link_status(struct adapter *adapter) ifp->if_baudrate = adapter->link_speed * 1000000; if_link_state_change(ifp, LINK_STATE_UP); } else if (!link_check && (adapter->link_active == 1)) { - int i = 0; + int i; ifp->if_baudrate = adapter->link_speed = 0; adapter->link_duplex = 0; if (bootverbose) @@ -2353,10 +2370,10 @@ em_update_link_status(struct adapter *adapter) static void em_stop(void *arg) { + int i; struct adapter *adapter = arg; struct ifnet *ifp = adapter->ifp; struct tx_ring *txr = adapter->tx_rings; - int i = 0; EM_CORE_LOCK_ASSERT(adapter); @@ -2366,7 +2383,8 @@ em_stop(void *arg) callout_stop(&adapter->timer); /* Tell the stack that the interface is no longer active */ - ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + ifp->if_drv_flags |= IFF_DRV_OACTIVE; /* Unarm watchdog timer. */ for (i = 0; i < adapter->num_queues; i++, txr++) { @@ -2462,6 +2480,7 @@ int em_allocate_legacy(struct adapter *adapter) { device_t dev = adapter->dev; + struct tx_ring *txr = adapter->tx_rings; int error, rid = 0; /* Manually turn off all interrupts */ @@ -2483,11 +2502,17 @@ em_allocate_legacy(struct adapter *adapter) * deferred processing contexts. */ TASK_INIT(&adapter->que_task, 0, em_handle_que, adapter); - TASK_INIT(&adapter->link_task, 0, em_handle_link, adapter); adapter->tq = taskqueue_create_fast("em_taskq", M_NOWAIT, taskqueue_thread_enqueue, &adapter->tq); - taskqueue_start_threads(&adapter->tq, 1, PI_NET, "%s taskq", + taskqueue_start_threads(&adapter->tq, 1, PI_NET, "%s que", device_get_nameunit(adapter->dev)); + /* Use a TX only tasklet for local timer */ + TASK_INIT(&txr->tx_task, 0, em_handle_tx, txr); + txr->tq = taskqueue_create_fast("em_txq", M_NOWAIT, + taskqueue_thread_enqueue, &txr->tq); + taskqueue_start_threads(&txr->tq, 1, PI_NET, "%s txq", + device_get_nameunit(adapter->dev)); + TASK_INIT(&adapter->link_task, 0, em_handle_link, adapter); if ((error = bus_setup_intr(dev, adapter->res, INTR_TYPE_NET, em_irq_fast, NULL, adapter, &adapter->tag)) != 0) { device_printf(dev, "Failed to register fast interrupt " @@ -2504,16 +2529,18 @@ em_allocate_legacy(struct adapter *adapter) * * Setup the MSIX Interrupt handlers * This is not really Multiqueue, rather - * its just multiple interrupt vectors. + * its just seperate interrupt vectors + * for TX, RX, and Link. * **********************************************************************/ int em_allocate_msix(struct adapter *adapter) { + int i; device_t dev = adapter->dev; struct tx_ring *txr = adapter->tx_rings; struct rx_ring *rxr = adapter->rx_rings; - int error, rid, vector = 0, i = 0; + int error, rid, vector = 0; /* Make sure all interrupts are disabled */ @@ -2624,11 +2651,11 @@ em_allocate_msix(struct adapter *adapter) static void em_free_pci_resources(struct adapter *adapter) { + int i; device_t dev = adapter->dev; struct tx_ring *txr; struct rx_ring *rxr; int rid; - int i = 0; /* @@ -2697,7 +2724,6 @@ em_setup_msix(struct adapter *adapter) device_t dev = adapter->dev; int val = 0; - /* ** Setup MSI/X for Hartwell: tests have shown ** use of two queues to be unstable, and to @@ -2717,16 +2743,18 @@ em_setup_msix(struct adapter *adapter) goto msi; } val = pci_msix_count(dev); - if (val < 3) { + /* We only need 3 vectors */ + if (val > 3) + val = 3; + if ((val != 3) && (val != 5)) { bus_release_resource(dev, SYS_RES_MEMORY, PCIR_BAR(EM_MSIX_BAR), adapter->msix_mem); adapter->msix_mem = NULL; device_printf(adapter->dev, - "MSIX: insufficient vectors, using MSI\n"); + "MSIX: incorrect vectors, using MSI\n"); goto msi; } - val = 3; - adapter->num_queues = 1; + if (pci_alloc_msix(dev, &val) == 0) { device_printf(adapter->dev, "Using MSIX interrupts " @@ -2761,6 +2789,7 @@ em_reset(struct adapter *adapter) struct ifnet *ifp = adapter->ifp; struct e1000_hw *hw = &adapter->hw; u16 rx_buffer_size; + u32 pba; INIT_DEBUGOUT("em_reset: begin"); @@ -2775,6 +2804,48 @@ em_reset(struct adapter *adapter) e1000_write_phy_reg(hw, IGP02E1000_PHY_POWER_MGMT, phy_tmp); } + /* + * Packet Buffer Allocation (PBA) + * Writing PBA sets the receive portion of the buffer + * the remainder is used for the transmit buffer. + */ + switch (hw->mac.type) { + /* Total Packet Buffer on these is 48K */ + case e1000_82571: + case e1000_82572: + case e1000_80003es2lan: + pba = E1000_PBA_32K; /* 32K for Rx, 16K for Tx */ + break; + case e1000_82573: /* 82573: Total Packet Buffer is 32K */ + pba = E1000_PBA_12K; /* 12K for Rx, 20K for Tx */ + break; + case e1000_82574: + case e1000_82583: + pba = E1000_PBA_20K; /* 20K for Rx, 20K for Tx */ + break; + case e1000_ich8lan: + pba = E1000_PBA_8K; + break; + case e1000_ich9lan: + case e1000_ich10lan: + /* Boost Receive side for jumbo frames */ + if (adapter->max_frame_size > 4096) + pba = E1000_PBA_14K; + else + pba = E1000_PBA_10K; + break; + case e1000_pchlan: + case e1000_pch2lan: + pba = E1000_PBA_26K; + break; + default: + if (adapter->max_frame_size > 8192) + pba = E1000_PBA_40K; /* 40K for Rx, 24K for Tx */ + else + pba = E1000_PBA_48K; /* 48K for Rx, 16K for Tx */ + } + E1000_WRITE_REG(&adapter->hw, E1000_PBA, pba); + /* * These parameters control the automatic generation (Tx) and * response (Rx) to Ethernet PAUSE frames. @@ -2790,11 +2861,15 @@ em_reset(struct adapter *adapter) * - The pause time is fairly large at 1000 x 512ns = 512 usec. */ rx_buffer_size = ((E1000_READ_REG(hw, E1000_PBA) & 0xffff) << 10 ); - hw->fc.high_water = rx_buffer_size - roundup2(adapter->max_frame_size, 1024); hw->fc.low_water = hw->fc.high_water - 1500; + if (adapter->fc) /* locally set flow control value? */ + hw->fc.requested_mode = adapter->fc; + else + hw->fc.requested_mode = e1000_fc_full; + if (hw->mac.type == e1000_80003es2lan) hw->fc.pause_time = 0xFFFF; else @@ -2802,15 +2877,22 @@ em_reset(struct adapter *adapter) hw->fc.send_xon = TRUE; - /* Set Flow control, use the tunable location if sane */ - hw->fc.requested_mode = adapter->fc_setting; - - /* Workaround: no TX flow ctrl for PCH */ - if (hw->mac.type == e1000_pchlan) + /* Device specific overrides/settings */ + switch (hw->mac.type) { + case e1000_pchlan: + /* Workaround: no TX flow ctrl for PCH */ hw->fc.requested_mode = e1000_fc_rx_pause; - - /* Override - settings for PCH2LAN, ya its magic :) */ - if (hw->mac.type == e1000_pch2lan) { + hw->fc.pause_time = 0xFFFF; /* override */ + if (ifp->if_mtu > ETHERMTU) { + hw->fc.high_water = 0x3500; + hw->fc.low_water = 0x1500; + } else { + hw->fc.high_water = 0x5000; + hw->fc.low_water = 0x3000; + } + hw->fc.refresh_time = 0x1000; + break; + case e1000_pch2lan: hw->fc.high_water = 0x5C20; hw->fc.low_water = 0x5048; hw->fc.pause_time = 0x0650; @@ -2820,13 +2902,26 @@ em_reset(struct adapter *adapter) E1000_WRITE_REG(hw, E1000_PBA, 12); else E1000_WRITE_REG(hw, E1000_PBA, 26); + break; + case e1000_ich9lan: + case e1000_ich10lan: + if (ifp->if_mtu > ETHERMTU) { + hw->fc.high_water = 0x2800; + hw->fc.low_water = hw->fc.high_water - 8; + break; + } + /* else fall thru */ + default: + if (hw->mac.type == e1000_80003es2lan) + hw->fc.pause_time = 0xFFFF; + break; } /* Issue a global reset */ e1000_reset_hw(hw); E1000_WRITE_REG(hw, E1000_WUC, 0); em_disable_aspm(adapter); - + /* and a re-init */ if (e1000_init_hw(hw) < 0) { device_printf(dev, "Hardware Initialization Failed\n"); return; @@ -2856,43 +2951,40 @@ em_setup_interface(device_t dev, struct adapter *adapter) return (-1); } if_initname(ifp, device_get_name(dev), device_get_unit(dev)); - ifp->if_mtu = ETHERMTU; ifp->if_init = em_init; ifp->if_softc = adapter; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_ioctl = em_ioctl; +#ifdef EM_MULTIQUEUE + /* Multiqueue stack interface */ + ifp->if_transmit = em_mq_start; + ifp->if_qflush = em_qflush; +#else ifp->if_start = em_start; IFQ_SET_MAXLEN(&ifp->if_snd, adapter->num_tx_desc - 1); ifp->if_snd.ifq_drv_maxlen = adapter->num_tx_desc - 1; IFQ_SET_READY(&ifp->if_snd); +#endif ether_ifattach(ifp, adapter->hw.mac.addr); ifp->if_capabilities = ifp->if_capenable = 0; -#ifdef EM_MULTIQUEUE - /* Multiqueue tx functions */ - ifp->if_transmit = em_mq_start; - ifp->if_qflush = em_qflush; -#endif ifp->if_capabilities |= IFCAP_HWCSUM | IFCAP_VLAN_HWCSUM; - ifp->if_capenable |= IFCAP_HWCSUM | IFCAP_VLAN_HWCSUM; - - /* Enable TSO by default, can disable with ifconfig */ ifp->if_capabilities |= IFCAP_TSO4; - ifp->if_capenable |= IFCAP_TSO4; - /* * Tell the upper layer(s) we * support full VLAN capability */ ifp->if_data.ifi_hdrlen = sizeof(struct ether_vlan_header); - ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU; - ifp->if_capenable |= IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU; + ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING + | IFCAP_VLAN_HWTSO + | IFCAP_VLAN_MTU; + ifp->if_capenable = ifp->if_capabilities; /* - ** Dont turn this on by default, if vlans are + ** Don't turn this on by default, if vlans are ** created on another pseudo device (eg. lagg) ** then vlan events are not passed thru, breaking ** operation, but with HW FILTER off it works. If @@ -3040,12 +3132,12 @@ em_dma_free(struct adapter *adapter, struct em_dma_alloc *dma) static int em_allocate_queues(struct adapter *adapter) { + int i; device_t dev = adapter->dev; struct tx_ring *txr = NULL; struct rx_ring *rxr = NULL; int rsize, tsize, error = E1000_SUCCESS; int txconf = 0, rxconf = 0; - int i = 0; /* Allocate the TX ring struct memory */ @@ -3100,15 +3192,13 @@ em_allocate_queues(struct adapter *adapter) error = ENOMEM; goto err_tx_desc; } - -#ifndef __HAIKU__ +#ifndef __HAIKU__ #if __FreeBSD_version >= 800000 /* Allocate a buf ring */ txr->br = buf_ring_alloc(4096, M_DEVBUF, M_WAITOK, &txr->tx_mtx); #endif #endif - } /* @@ -3155,13 +3245,11 @@ err_tx_desc: em_dma_free(adapter, &txr->txdma); free(adapter->rx_rings, M_DEVBUF); rx_fail: - -#ifndef __HAIKU__ +#ifndef __HAIKU__ #if __FreeBSD_version >= 800000 buf_ring_free(txr->br, M_DEVBUF); #endif #endif - free(adapter->tx_rings, M_DEVBUF); fail: return (error); @@ -3238,9 +3326,17 @@ em_setup_transmit_ring(struct tx_ring *txr) struct adapter *adapter = txr->adapter; struct em_buffer *txbuf; int i; +#ifdef DEV_NETMAP + struct netmap_adapter *na = NA(adapter->ifp); + struct netmap_slot *slot; +#endif /* DEV_NETMAP */ /* Clear the old descriptor contents */ EM_TX_LOCK(txr); +#ifdef DEV_NETMAP + slot = netmap_reset(na, NR_TX, txr->me, 0); +#endif /* DEV_NETMAP */ + bzero((void *)txr->tx_base, (sizeof(struct e1000_tx_desc)) * adapter->num_tx_desc); /* Reset indices */ @@ -3257,6 +3353,19 @@ em_setup_transmit_ring(struct tx_ring *txr) m_freem(txbuf->m_head); txbuf->m_head = NULL; } +#ifdef DEV_NETMAP + if (slot) { + int si = netmap_idx_n2k(&na->tx_rings[txr->me], i); + uint64_t paddr; + void *addr; + + addr = PNMB(slot + si, &paddr); + txr->tx_base[i].buffer_addr = htole64(paddr); + /* reload the map for netmap mode */ + netmap_load_map(txr->txtag, txbuf->map, addr); + } +#endif /* DEV_NETMAP */ + /* clear the watch index */ txbuf->next_eop = -1; } @@ -3285,8 +3394,8 @@ em_setup_transmit_ring(struct tx_ring *txr) static void em_setup_transmit_structures(struct adapter *adapter) { + int i; struct tx_ring *txr = adapter->tx_rings; - int i = 0; for (i = 0; i < adapter->num_queues; i++, txr++) em_setup_transmit_ring(txr); @@ -3302,10 +3411,10 @@ em_setup_transmit_structures(struct adapter *adapter) static void em_initialize_transmit_unit(struct adapter *adapter) { + int i; struct tx_ring *txr = adapter->tx_rings; struct e1000_hw *hw = &adapter->hw; u32 tctl, tarc, tipg = 0; - int i = 0; INIT_DEBUGOUT("em_initialize_transmit_unit: begin"); @@ -3331,11 +3440,6 @@ em_initialize_transmit_unit(struct adapter *adapter) /* Set the default values for the Tx Inter Packet Gap timer */ switch (adapter->hw.mac.type) { - case e1000_82542: - tipg = DEFAULT_82542_TIPG_IPGT; - tipg |= DEFAULT_82542_TIPG_IPGR1 << E1000_TIPG_IPGR1_SHIFT; - tipg |= DEFAULT_82542_TIPG_IPGR2 << E1000_TIPG_IPGR2_SHIFT; - break; case e1000_80003es2lan: tipg = DEFAULT_82543_TIPG_IPGR1; tipg |= DEFAULT_80003ES2LAN_TIPG_IPGR2 << @@ -3400,8 +3504,8 @@ em_initialize_transmit_unit(struct adapter *adapter) static void em_free_transmit_structures(struct adapter *adapter) { + int i; struct tx_ring *txr = adapter->tx_rings; - int i = 0; for (i = 0; i < adapter->num_queues; i++, txr++) { EM_TX_LOCK(txr); @@ -3422,9 +3526,9 @@ em_free_transmit_structures(struct adapter *adapter) static void em_free_transmit_buffers(struct tx_ring *txr) { + int i; struct adapter *adapter = txr->adapter; struct em_buffer *txbuf; - int i = 0; INIT_DEBUGOUT("free_transmit_ring: begin"); @@ -3453,14 +3557,12 @@ em_free_transmit_buffers(struct tx_ring *txr) txbuf->map = NULL; } } - -#ifndef __HAIKU__ +#ifndef __HAIKU__ #if __FreeBSD_version >= 800000 if (txr->br != NULL) buf_ring_free(txr->br, M_DEVBUF); #endif -#endif - +#endif if (txr->tx_buffers != NULL) { free(txr->tx_buffers, M_DEVBUF); txr->tx_buffers = NULL; @@ -3705,7 +3807,7 @@ em_tso_setup(struct tx_ring *txr, struct mbuf *mp, int ip_off, * tx_buffer is put back on the free queue. * **********************************************************************/ -static bool +static void em_txeof(struct tx_ring *txr) { struct adapter *adapter = txr->adapter; @@ -3715,11 +3817,24 @@ em_txeof(struct tx_ring *txr) struct ifnet *ifp = adapter->ifp; EM_TX_LOCK_ASSERT(txr); +#ifdef DEV_NETMAP + if (ifp->if_capenable & IFCAP_NETMAP) { + struct netmap_adapter *na = NA(ifp); + + selwakeuppri(&na->tx_rings[txr->me].si, PI_NET); + EM_TX_UNLOCK(txr); + EM_CORE_LOCK(adapter); + selwakeuppri(&na->tx_si, PI_NET); + EM_CORE_UNLOCK(adapter); + EM_TX_LOCK(txr); + return; + } +#endif /* DEV_NETMAP */ /* No work, make sure watchdog is off */ if (txr->tx_avail == adapter->num_tx_desc) { txr->queue_status = EM_QUEUE_IDLE; - return (FALSE); + return; } processed = 0; @@ -3798,17 +3913,17 @@ em_txeof(struct tx_ring *txr) /* * If we have a minimum free, clear IFF_DRV_OACTIVE * to tell the stack that it is OK to send packets. + * Notice that all writes of OACTIVE happen under the + * TX lock which, with a single queue, guarantees + * sanity. */ - if (txr->tx_avail > EM_MAX_SCATTER) - ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; + if (txr->tx_avail >= EM_MAX_SCATTER) + ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; /* Disable watchdog if all clean */ if (txr->tx_avail == adapter->num_tx_desc) { txr->queue_status = EM_QUEUE_IDLE; - return (FALSE); } - - return (TRUE); } @@ -3902,11 +4017,11 @@ update: static int em_allocate_receive_buffers(struct rx_ring *rxr) { + int i; struct adapter *adapter = rxr->adapter; device_t dev = adapter->dev; struct em_buffer *rxbuf; int error; - int i = 0; rxr->rx_buffers = malloc(sizeof(struct em_buffer) * adapter->num_rx_desc, M_DEVBUF, M_NOWAIT | M_ZERO); @@ -3961,29 +4076,56 @@ fail: static int em_setup_receive_ring(struct rx_ring *rxr) { + int i, j; struct adapter *adapter = rxr->adapter; struct em_buffer *rxbuf; bus_dma_segment_t seg[1]; - int i, j, nsegs, error = 0; + int rsize, nsegs, error = 0; +#ifdef DEV_NETMAP + struct netmap_adapter *na = NA(adapter->ifp); + struct netmap_slot *slot; +#endif /* Clear the ring contents */ EM_RX_LOCK(rxr); + rsize = roundup2(adapter->num_rx_desc * + sizeof(struct e1000_rx_desc), EM_DBA_ALIGN); + bzero((void *)rxr->rx_base, rsize); +#ifdef DEV_NETMAP + slot = netmap_reset(na, NR_RX, 0, 0); +#endif - /* Invalidate all descriptors */ + /* + ** Free current RX buffer structs and their mbufs + */ for (i = 0; i < adapter->num_rx_desc; i++) { - struct e1000_rx_desc* cur; - cur = &rxr->rx_base[i]; - cur->status = 0; + rxbuf = &rxr->rx_buffers[i]; + if (rxbuf->m_head != NULL) { + bus_dmamap_sync(rxr->rxtag, rxbuf->map, + BUS_DMASYNC_POSTREAD); + bus_dmamap_unload(rxr->rxtag, rxbuf->map); + m_freem(rxbuf->m_head); + rxbuf->m_head = NULL; /* mark as freed */ + } } /* Now replenish the mbufs */ - i = j = rxr->next_to_refresh; - if (++j == adapter->num_rx_desc) - j = 0; + for (j = 0; j != adapter->num_rx_desc; ++j) { + rxbuf = &rxr->rx_buffers[j]; +#ifdef DEV_NETMAP + if (slot) { + int si = netmap_idx_n2k(&na->rx_rings[rxr->me], j); + uint64_t paddr; + void *addr; - while (j != rxr->next_to_check) { - rxbuf = &rxr->rx_buffers[i]; + addr = PNMB(slot + si, &paddr); + netmap_load_map(rxr->rxtag, rxbuf->map, addr); + /* Update descriptor */ + rxr->rx_base[j].buffer_addr = htole64(paddr); + continue; + } +#endif /* DEV_NETMAP */ rxbuf->m_head = m_getjcl(M_DONTWAIT, MT_DATA, M_PKTHDR, adapter->rx_mbuf_sz); if (rxbuf->m_head == NULL) { @@ -4007,16 +4149,14 @@ em_setup_receive_ring(struct rx_ring *rxr) rxbuf->map, BUS_DMASYNC_PREREAD); /* Update descriptor */ - rxr->rx_base[i].buffer_addr = htole64(seg[0].ds_addr); - i = j; - if (++j == adapter->num_rx_desc) - j = 0; + rxr->rx_base[j].buffer_addr = htole64(seg[0].ds_addr); } - -fail: - rxr->next_to_refresh = i; + rxr->next_to_check = 0; + rxr->next_to_refresh = 0; bus_dmamap_sync(rxr->rxdma.dma_tag, rxr->rxdma.dma_map, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); + +fail: EM_RX_UNLOCK(rxr); return (error); } @@ -4029,8 +4169,9 @@ fail: static int em_setup_receive_structures(struct adapter *adapter) { + int i, n; struct rx_ring *rxr = adapter->rx_rings; - int q, i, n; + int q; for (q = 0; q < adapter->num_queues; q++, rxr++) if (em_setup_receive_ring(rxr)) @@ -4043,10 +4184,9 @@ fail: * the rings that completed, the failing case will have * cleaned up for itself. 'q' failed, so its the terminus. */ - for (i = 0, n = 0; i < q; ++i) { + for (i = 0; i < q; ++i) { rxr = &adapter->rx_rings[i]; - n = rxr->next_to_check; - while(n != rxr->next_to_refresh) { + for (n = 0; n < adapter->num_rx_desc; n++) { struct em_buffer *rxbuf; rxbuf = &rxr->rx_buffers[n]; if (rxbuf->m_head != NULL) { @@ -4056,8 +4196,6 @@ fail: m_freem(rxbuf->m_head); rxbuf->m_head = NULL; } - if (++n == adapter->num_rx_desc) - n = 0; } rxr->next_to_check = 0; rxr->next_to_refresh = 0; @@ -4074,8 +4212,8 @@ fail: static void em_free_receive_structures(struct adapter *adapter) { + int i; struct rx_ring *rxr = adapter->rx_rings; - int i = 0; for (i = 0; i < adapter->num_queues; i++, rxr++) { em_free_receive_buffers(rxr); @@ -4098,13 +4236,12 @@ em_free_receive_buffers(struct rx_ring *rxr) { struct adapter *adapter = rxr->adapter; struct em_buffer *rxbuf = NULL; - int i = 0; INIT_DEBUGOUT("free_receive_buffers: begin"); if (rxr->rx_buffers != NULL) { - int i = rxr->next_to_check; - while(i != rxr->next_to_refresh) { + int i; + for (i = 0; i < adapter->num_rx_desc; i++) { rxbuf = &rxr->rx_buffers[i]; if (rxbuf->map != NULL) { bus_dmamap_sync(rxr->rxtag, rxbuf->map, @@ -4116,8 +4253,6 @@ em_free_receive_buffers(struct rx_ring *rxr) m_freem(rxbuf->m_head); rxbuf->m_head = NULL; } - if (++i == adapter->num_rx_desc) - i = 0; } free(rxr->rx_buffers, M_DEVBUF); rxr->rx_buffers = NULL; @@ -4145,12 +4280,12 @@ em_free_receive_buffers(struct rx_ring *rxr) static void em_initialize_receive_unit(struct adapter *adapter) { + int i; struct rx_ring *rxr = adapter->rx_rings; struct ifnet *ifp = adapter->ifp; struct e1000_hw *hw = &adapter->hw; u64 bus_addr; u32 rctl, rxcsum; - int i = 0; INIT_DEBUGOUT("em_initialize_receive_units: begin"); @@ -4159,7 +4294,9 @@ em_initialize_receive_unit(struct adapter *adapter) * up the descriptor ring */ rctl = E1000_READ_REG(hw, E1000_RCTL); - E1000_WRITE_REG(hw, E1000_RCTL, rctl & ~E1000_RCTL_EN); + /* Do not disable if ever enabled on this hardware */ + if ((hw->mac.type != e1000_82574) && (hw->mac.type != e1000_82583)) + E1000_WRITE_REG(hw, E1000_RCTL, rctl & ~E1000_RCTL_EN); E1000_WRITE_REG(&adapter->hw, E1000_RADV, adapter->rx_abs_int_delay.value); @@ -4173,14 +4310,14 @@ em_initialize_receive_unit(struct adapter *adapter) ** When using MSIX interrupts we need to throttle ** using the EITR register (82574 only) */ - if (hw->mac.type == e1000_82574) + if (hw->mac.type == e1000_82574) { + int i; for (i = 0; i < 4; i++) E1000_WRITE_REG(hw, E1000_EITR_82574(i), DEFAULT_ITR); - - /* Disable accelerated ackknowledge */ - if (adapter->hw.mac.type == e1000_82574) + /* Disable accelerated acknowledge */ E1000_WRITE_REG(hw, E1000_RFCTL, E1000_RFCTL_ACK_DIS); + } if (ifp->if_capenable & IFCAP_RXCSUM) { rxcsum = E1000_READ_REG(hw, E1000_RXCSUM); @@ -4206,18 +4343,32 @@ em_initialize_receive_unit(struct adapter *adapter) E1000_WRITE_REG(hw, E1000_RDBAH(i), (u32)(bus_addr >> 32)); E1000_WRITE_REG(hw, E1000_RDBAL(i), (u32)bus_addr); /* Setup the Head and Tail Descriptor Pointers */ - E1000_WRITE_REG(hw, E1000_RDH(i), rxr->next_to_check); - E1000_WRITE_REG(hw, E1000_RDT(i), rxr->next_to_refresh); + E1000_WRITE_REG(hw, E1000_RDH(i), 0); +#ifdef DEV_NETMAP + /* + * an init() while a netmap client is active must + * preserve the rx buffers passed to userspace. + * In this driver it means we adjust RDT to + * something different from na->num_rx_desc - 1. + */ + if (ifp->if_capenable & IFCAP_NETMAP) { + struct netmap_adapter *na = NA(adapter->ifp); + struct netmap_kring *kring = &na->rx_rings[i]; + int t = na->num_rx_desc - 1 - kring->nr_hwavail; + + E1000_WRITE_REG(hw, E1000_RDT(i), t); + } else +#endif /* DEV_NETMAP */ + E1000_WRITE_REG(hw, E1000_RDT(i), adapter->num_rx_desc - 1); } - /* Set early receive threshold on appropriate hw */ + /* Set PTHRESH for improved jumbo performance */ if (((adapter->hw.mac.type == e1000_ich9lan) || (adapter->hw.mac.type == e1000_pch2lan) || (adapter->hw.mac.type == e1000_ich10lan)) && (ifp->if_mtu > ETHERMTU)) { u32 rxdctl = E1000_READ_REG(hw, E1000_RXDCTL(0)); E1000_WRITE_REG(hw, E1000_RXDCTL(0), rxdctl | 3); - E1000_WRITE_REG(hw, E1000_ERT, 0x100 | (1 << 13)); } if (adapter->hw.mac.type == e1000_pch2lan) { @@ -4284,6 +4435,20 @@ em_rxeof(struct rx_ring *rxr, int count, int *done) EM_RX_LOCK(rxr); +#ifdef DEV_NETMAP + if (ifp->if_capenable & IFCAP_NETMAP) { + struct netmap_adapter *na = NA(ifp); + + na->rx_rings[rxr->me].nr_kflags |= NKR_PENDINTR; + selwakeuppri(&na->rx_rings[rxr->me].si, PI_NET); + EM_RX_UNLOCK(rxr); + EM_CORE_LOCK(adapter); + selwakeuppri(&na->rx_si, PI_NET); + EM_CORE_UNLOCK(adapter); + return (0); + } +#endif /* DEV_NETMAP */ + for (i = rxr->next_to_check, processed = 0; count != 0;) { if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) @@ -4347,14 +4512,9 @@ em_rxeof(struct rx_ring *rxr, int count, int *done) #endif if (status & E1000_RXD_STAT_VP) { sendmp->m_pkthdr.ether_vtag = - (le16toh(cur->special) & - E1000_RXD_SPC_VLAN_MASK); + le16toh(cur->special); sendmp->m_flags |= M_VLANTAG; } -#ifdef EM_MULTIQUEUE - sendmp->m_pkthdr.flowid = rxr->msix; - sendmp->m_flags |= M_FLOWID; -#endif #ifndef __NO_STRICT_ALIGNMENT skip: #endif @@ -4566,9 +4726,9 @@ em_unregister_vlan(void *arg, struct ifnet *ifp, u16 vtag) static void em_setup_vlan_hw_support(struct adapter *adapter) { + int i; struct e1000_hw *hw = &adapter->hw; u32 reg; - int i = 0; /* ** We get here thru init_locked, meaning @@ -4830,7 +4990,7 @@ em_enable_wakeup(device_t dev) (adapter->hw.mac.type == e1000_pchlan) || (adapter->hw.mac.type == e1000_ich9lan) || (adapter->hw.mac.type == e1000_ich10lan)) - e1000_disable_gig_wol_ich8lan(&adapter->hw); + e1000_suspend_workarounds_ich8lan(&adapter->hw); /* Keep the laser running on Fiber adapters */ if (adapter->hw.phy.media_type == e1000_media_type_fiber || @@ -4884,10 +5044,10 @@ em_enable_wakeup(device_t dev) static int em_enable_phy_wakeup(struct adapter *adapter) { + int i; struct e1000_hw *hw = &adapter->hw; u32 mreg, ret = 0; u16 preg; - int i = 0; /* copy MAC RARs to PHY RARs */ e1000_copy_rx_addrs_to_phy_ich8lan(hw); @@ -5121,11 +5281,10 @@ em_sysctl_reg_handler(SYSCTL_HANDLER_ARGS) struct adapter *adapter; u_int val; -#ifndef __HAIKU__ +#ifndef __HAIKU__ adapter = oidp->oid_arg1; val = E1000_READ_REG(&adapter->hw, oidp->oid_arg2); #endif - return (sysctl_handle_int(oidp, &val, 0, req)); } @@ -5135,6 +5294,7 @@ em_sysctl_reg_handler(SYSCTL_HANDLER_ARGS) static void em_add_hw_stats(struct adapter *adapter) { + int i; device_t dev = adapter->dev; struct tx_ring *txr = adapter->tx_rings; @@ -5147,7 +5307,6 @@ em_add_hw_stats(struct adapter *adapter) struct sysctl_oid *stat_node, *queue_node, *int_node; struct sysctl_oid_list *stat_list, *queue_list, *int_list; - int i = 0; #define QUEUE_NAME_LEN 32 char namebuf[QUEUE_NAME_LEN]; @@ -5432,7 +5591,7 @@ em_add_hw_stats(struct adapter *adapter) static int em_sysctl_nvm_info(SYSCTL_HANDLER_ARGS) { - struct adapter *adapter; + struct adapter *adapter = (struct adapter *)arg1; int error; int result; @@ -5447,10 +5606,8 @@ em_sysctl_nvm_info(SYSCTL_HANDLER_ARGS) * first 32 16-bit words of the EEPROM to * the screen. */ - if (result == 1) { - adapter = (struct adapter *)arg1; + if (result == 1) em_print_nvm_info(adapter); - } return (error); } @@ -5540,6 +5697,70 @@ em_set_sysctl_value(struct adapter *adapter, const char *name, OID_AUTO, name, CTLTYPE_INT|CTLFLAG_RW, limit, value, description); } + +/* +** Set flow control using sysctl: +** Flow control values: +** 0 - off +** 1 - rx pause +** 2 - tx pause +** 3 - full +*/ +static int +em_set_flowcntl(SYSCTL_HANDLER_ARGS) +{ + int error; + static int input = 3; /* default is full */ + struct adapter *adapter = (struct adapter *) arg1; + + error = sysctl_handle_int(oidp, &input, 0, req); + + if ((error) || (req->newptr == NULL)) + return (error); + + if (input == adapter->fc) /* no change? */ + return (error); + + switch (input) { + case e1000_fc_rx_pause: + case e1000_fc_tx_pause: + case e1000_fc_full: + case e1000_fc_none: + adapter->hw.fc.requested_mode = input; + adapter->fc = input; + break; + default: + /* Do nothing */ + return (error); + } + + adapter->hw.fc.current_mode = adapter->hw.fc.requested_mode; + e1000_force_mac_fc(&adapter->hw); + return (error); +} + +/* +** Manage Energy Efficient Ethernet: +** Control values: +** 0/1 - enabled/disabled +*/ +static int +em_sysctl_eee(SYSCTL_HANDLER_ARGS) +{ + struct adapter *adapter = (struct adapter *) arg1; + int error, value; + + value = adapter->hw.dev_spec.ich8lan.eee_disable; + error = sysctl_handle_int(oidp, &value, 0, req); + if (error || req->newptr == NULL) + return (error); + EM_CORE_LOCK(adapter); + adapter->hw.dev_spec.ich8lan.eee_disable = (value != 0); + em_init_locked(adapter); + EM_CORE_UNLOCK(adapter); + return (0); +} + static int em_sysctl_debug_info(SYSCTL_HANDLER_ARGS) { @@ -5576,10 +5797,11 @@ em_print_debug_info(struct adapter *adapter) printf("Interface is RUNNING "); else printf("Interface is NOT RUNNING\n"); + if (adapter->ifp->if_drv_flags & IFF_DRV_OACTIVE) - printf("and ACTIVE\n"); - else printf("and INACTIVE\n"); + else + printf("and ACTIVE\n"); device_printf(dev, "hw tdh = %d, hw tdt = %d\n", E1000_READ_REG(&adapter->hw, E1000_TDH(0)), diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/if_em.h b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/if_em.h index 6b959af966..fc83147089 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/if_em.h +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/if_em.h @@ -30,7 +30,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: src/sys/dev/e1000/if_em.h,v 1.5.2.5.2.1 2010/12/21 17:09:25 kensmith Exp $*/ +/*$FreeBSD$*/ #ifndef _EM_H_DEFINED_ @@ -212,9 +212,12 @@ #define EM_BAR_MEM_TYPE_64BIT 0x00000004 #define EM_MSIX_BAR 3 /* On 82575 */ -#if !defined(SYSCTL_ADD_UQUAD) +/* More backward compatibility */ +#ifndef __HAIKU__ +#if __FreeBSD_version < 900000 #define SYSCTL_ADD_UQUAD SYSCTL_ADD_QUAD #endif +#endif /* Defines for printing debug information */ #define DEBUG_INIT 0 @@ -418,11 +421,11 @@ struct adapter { u32 shadow_vfta[EM_VFTA_SIZE]; /* Info about the interface */ - u8 link_active; + u16 link_active; + u16 fc; u16 link_speed; u16 link_duplex; u32 smartspeed; - u32 fc_setting; struct em_int_delay_info tx_int_delay; struct em_int_delay_info tx_abs_int_delay; diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/if_igb.c b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/if_igb.c index 1c49a091cf..26d0903586 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/if_igb.c +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/if_igb.c @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2011, Intel Corporation + Copyright (c) 2001-2012, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -30,7 +30,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: src/sys/dev/e1000/if_igb.c,v 1.21.2.18.2.1 2010/12/21 17:09:25 kensmith Exp $*/ +/*$FreeBSD$*/ #ifdef HAVE_KERNEL_OPTION_HEADERS @@ -100,7 +100,7 @@ int igb_display_debug_stats = 0; /********************************************************************* * Driver version: *********************************************************************/ -char igb_driver_version[] = "version - 2.2.5"; +char igb_driver_version[] = "version - 2.3.4"; /********************************************************************* @@ -150,6 +150,14 @@ static igb_vendor_info_t igb_vendor_info_array[] = { 0x8086, E1000_DEV_ID_I350_SERDES, PCI_ANY_ID, PCI_ANY_ID, 0}, { 0x8086, E1000_DEV_ID_I350_SGMII, PCI_ANY_ID, PCI_ANY_ID, 0}, { 0x8086, E1000_DEV_ID_I350_VF, PCI_ANY_ID, PCI_ANY_ID, 0}, + { 0x8086, E1000_DEV_ID_I210_COPPER, PCI_ANY_ID, PCI_ANY_ID, 0}, + { 0x8086, E1000_DEV_ID_I210_COPPER_IT, PCI_ANY_ID, PCI_ANY_ID, 0}, + { 0x8086, E1000_DEV_ID_I210_COPPER_OEM1, + PCI_ANY_ID, PCI_ANY_ID, 0}, + { 0x8086, E1000_DEV_ID_I210_FIBER, PCI_ANY_ID, PCI_ANY_ID, 0}, + { 0x8086, E1000_DEV_ID_I210_SERDES, PCI_ANY_ID, PCI_ANY_ID, 0}, + { 0x8086, E1000_DEV_ID_I210_SGMII, PCI_ANY_ID, PCI_ANY_ID, 0}, + { 0x8086, E1000_DEV_ID_I211_COPPER, PCI_ANY_ID, PCI_ANY_ID, 0}, /* required last entry */ { 0, 0, 0, 0, 0} }; @@ -225,8 +233,9 @@ static __inline void igb_rx_input(struct rx_ring *, static bool igb_rxeof(struct igb_queue *, int, int *); static void igb_rx_checksum(u32, struct mbuf *, u32); -static int igb_tx_ctx_setup(struct tx_ring *, struct mbuf *); -static bool igb_tso_setup(struct tx_ring *, struct mbuf *, u32 *); +static bool igb_tx_ctx_setup(struct tx_ring *, struct mbuf *); +static bool igb_tso_setup(struct tx_ring *, struct mbuf *, int, + struct ip *, struct tcphdr *); static void igb_set_promisc(struct adapter *); static void igb_disable_promisc(struct adapter *); static void igb_set_multi(struct adapter *); @@ -262,11 +271,13 @@ static void igb_msix_que(void *); static void igb_msix_link(void *); static void igb_handle_que(void *context, int pending); static void igb_handle_link(void *context, int pending); +static void igb_handle_link_locked(struct adapter *); static void igb_set_sysctl_value(struct adapter *, const char *, const char *, int *, int); static int igb_set_flowcntl(SYSCTL_HANDLER_ARGS); static int igb_sysctl_dmac(SYSCTL_HANDLER_ARGS); +static int igb_sysctl_eee(SYSCTL_HANDLER_ARGS); #ifdef DEVICE_POLLING static poll_handler_t igb_poll; @@ -300,7 +311,7 @@ MODULE_DEPEND(igb, ether, 1, 1, 1); * Tunable default values. *********************************************************************/ -SYSCTL_NODE(_hw, OID_AUTO, igb, CTLFLAG_RD, 0, "IGB driver parameters"); +static SYSCTL_NODE(_hw, OID_AUTO, igb, CTLFLAG_RD, 0, "IGB driver parameters"); /* Descriptor defaults */ static int igb_rxd = IGB_DEFAULT_RXD; @@ -348,7 +359,7 @@ SYSCTL_INT(_hw_igb, OID_AUTO, max_interrupt_rate, CTLFLAG_RDTUN, ** into the header and thus use no cluster. Its ** a very workload dependent type feature. */ -static bool igb_header_split = FALSE; +static int igb_header_split = FALSE; TUNABLE_INT("hw.igb.hdr_split", &igb_header_split); SYSCTL_INT(_hw_igb, OID_AUTO, header_split, CTLFLAG_RDTUN, &igb_header_split, 0, "Enable receive mbuf header split"); @@ -362,6 +373,13 @@ TUNABLE_INT("hw.igb.num_queues", &igb_num_queues); SYSCTL_INT(_hw_igb, OID_AUTO, num_queues, CTLFLAG_RDTUN, &igb_num_queues, 0, "Number of queues to configure, 0 indicates autoconfigure"); +/* +** Global variable to store last used CPU when binding queues +** to CPUs in igb_allocate_msix. Starts at CPU_FIRST and increments when a +** queue is bound to a cpu. +*/ +static int igb_last_bind_cpu = -1; + /* How many packets rxeof tries to clean at a time */ static int igb_rx_process_limit = 100; TUNABLE_INT("hw.igb.rx_process_limit", &igb_rx_process_limit); @@ -369,6 +387,9 @@ SYSCTL_INT(_hw_igb, OID_AUTO, rx_process_limit, CTLFLAG_RDTUN, &igb_rx_process_limit, 0, "Maximum number of received packets to process at a time, -1 means unlimited"); +#ifdef DEV_NETMAP /* see ixgbe.c for details */ +#include +#endif /* DEV_NETMAP */ /********************************************************************* * Device identification routine * @@ -566,11 +587,13 @@ igb_attach(device_t dev) SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, "dmac", CTLTYPE_INT|CTLFLAG_RW, adapter, 0, igb_sysctl_dmac, "I", "DMA Coalesce"); - igb_set_sysctl_value(adapter, "eee_disabled", - "enable Energy Efficient Ethernet", - &adapter->hw.dev_spec._82575.eee_disable, - TRUE); - e1000_set_eee_i350(&adapter->hw); + SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), + OID_AUTO, "eee_disabled", CTLTYPE_INT|CTLFLAG_RW, + adapter, 0, igb_sysctl_eee, "I", + "Disable Energy Efficient Ethernet"); + if (adapter->hw.phy.media_type == e1000_media_type_copper) + e1000_set_eee_i350(&adapter->hw); } /* @@ -581,7 +604,9 @@ igb_attach(device_t dev) e1000_reset_hw(&adapter->hw); /* Make sure we have a good EEPROM before we read from it */ - if (e1000_validate_nvm_checksum(&adapter->hw) < 0) { + if (((adapter->hw.mac.type != e1000_i210) && + (adapter->hw.mac.type != e1000_i211)) && + (e1000_validate_nvm_checksum(&adapter->hw) < 0)) { /* ** Some PCI-E parts fail the first check due to ** the link being in sleep state, call it again, @@ -611,16 +636,6 @@ igb_attach(device_t dev) goto err_late; } - /* - ** Configure Interrupts - */ - if ((adapter->msix > 1) && (igb_enable_msix)) - error = igb_allocate_msix(adapter); - else /* MSI or Legacy */ - error = igb_allocate_legacy(adapter); - if (error) - goto err_late; - /* Setup OS specific network interface */ if (igb_setup_interface(dev, adapter) != 0) goto err_late; @@ -659,11 +674,25 @@ igb_attach(device_t dev) igb_add_hw_stats(adapter); /* Tell the stack that the interface is not active */ - adapter->ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); + adapter->ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + adapter->ifp->if_drv_flags |= IFF_DRV_OACTIVE; adapter->led_dev = led_create(igb_led_func, adapter, device_get_nameunit(dev)); + /* + ** Configure Interrupts + */ + if ((adapter->msix > 1) && (igb_enable_msix)) + error = igb_allocate_msix(adapter); + else /* MSI or Legacy */ + error = igb_allocate_legacy(adapter); + if (error) + goto err_late; + +#ifdef DEV_NETMAP + igb_netmap_attach(adapter); +#endif /* DEV_NETMAP */ INIT_DEBUGOUT("igb_attach: end"); return (0); @@ -673,10 +702,10 @@ err_late: igb_free_transmit_structures(adapter); igb_free_receive_structures(adapter); igb_release_hw_control(adapter); - if (adapter->ifp != NULL) - if_free(adapter->ifp); err_pci: igb_free_pci_resources(adapter); + if (adapter->ifp != NULL) + if_free(adapter->ifp); free(adapter->mta, M_DEVBUF); IGB_CORE_LOCK_DESTROY(adapter); @@ -742,6 +771,9 @@ igb_detach(device_t dev) callout_drain(&adapter->timer); +#ifdef DEV_NETMAP + netmap_detach(adapter->ifp); +#endif /* DEV_NETMAP */ igb_free_pci_resources(adapter); bus_generic_detach(dev); if_free(ifp); @@ -798,29 +830,29 @@ static int igb_resume(device_t dev) { struct adapter *adapter = device_get_softc(dev); + struct tx_ring *txr = adapter->tx_rings; struct ifnet *ifp = adapter->ifp; -#if __FreeBSD_version >= 800000 - struct tx_ring *txr = adapter->tx_rings; -#endif IGB_CORE_LOCK(adapter); igb_init_locked(adapter); igb_init_manageability(adapter); if ((ifp->if_flags & IFF_UP) && - (ifp->if_drv_flags & IFF_DRV_RUNNING)) { -#if __FreeBSD_version < 800000 - igb_start(ifp); -#else + (ifp->if_drv_flags & IFF_DRV_RUNNING) && adapter->link_active) { for (int i = 0; i < adapter->num_queues; i++, txr++) { IGB_TX_LOCK(txr); - if (!drbr_empty(ifp, txr->br)) +#if __FreeBSD_version >= 800000 + /* Process the stack queue only if not depleted */ + if (((txr->queue_status & IGB_QUEUE_DEPLETED) == 0) && + !drbr_empty(ifp, txr->br)) igb_mq_start_locked(ifp, txr, NULL); +#else + if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) + igb_start_locked(txr, ifp); +#endif IGB_TX_UNLOCK(txr); } -#endif } - IGB_CORE_UNLOCK(adapter); return bus_generic_resume(dev); @@ -828,6 +860,7 @@ igb_resume(device_t dev) #if __FreeBSD_version < 800000 + /********************************************************************* * Transmit entry point * @@ -858,7 +891,7 @@ igb_start_locked(struct tx_ring *txr, struct ifnet *ifp) while (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) { if (txr->tx_avail <= IGB_MAX_SCATTER) { - ifp->if_drv_flags |= IFF_DRV_OACTIVE; + txr->queue_status |= IGB_QUEUE_DEPLETED; break; } IFQ_DRV_DEQUEUE(&ifp->if_snd, m_head); @@ -869,10 +902,10 @@ igb_start_locked(struct tx_ring *txr, struct ifnet *ifp) * NULL on failure. In that event, we can't requeue. */ if (igb_xmit(txr, &m_head)) { - if (m_head == NULL) - break; - ifp->if_drv_flags |= IFF_DRV_OACTIVE; - IFQ_DRV_PREPEND(&ifp->if_snd, m_head); + if (m_head != NULL) + IFQ_DRV_PREPEND(&ifp->if_snd, m_head); + if (txr->tx_avail <= IGB_MAX_SCATTER) + txr->queue_status |= IGB_QUEUE_DEPLETED; break; } @@ -881,7 +914,7 @@ igb_start_locked(struct tx_ring *txr, struct ifnet *ifp) /* Set watchdog on */ txr->watchdog_time = ticks; - txr->queue_status = IGB_QUEUE_WORKING; + txr->queue_status |= IGB_QUEUE_WORKING; } } @@ -905,6 +938,7 @@ igb_start(struct ifnet *ifp) } #else /* __FreeBSD_version >= 800000 */ + /* ** Multiqueue Transmit driver ** @@ -915,16 +949,18 @@ igb_mq_start(struct ifnet *ifp, struct mbuf *m) struct adapter *adapter = ifp->if_softc; struct igb_queue *que; struct tx_ring *txr; - int i = 0, err = 0; + int i, err = 0; /* Which queue to use */ if ((m->m_flags & M_FLOWID) != 0) i = m->m_pkthdr.flowid % adapter->num_queues; + else + i = curcpu % adapter->num_queues; txr = &adapter->tx_rings[i]; que = &adapter->queues[i]; - - if (IGB_TX_TRYLOCK(txr)) { + if (((txr->queue_status & IGB_QUEUE_DEPLETED) == 0) && + IGB_TX_TRYLOCK(txr)) { err = igb_mq_start_locked(ifp, txr, m); IGB_TX_UNLOCK(txr); } else { @@ -944,8 +980,9 @@ igb_mq_start_locked(struct ifnet *ifp, struct tx_ring *txr, struct mbuf *m) IGB_TX_LOCK_ASSERT(txr); - if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != - IFF_DRV_RUNNING || adapter->link_active == 0) { + if (((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) || + (txr->queue_status == IGB_QUEUE_DEPLETED) || + adapter->link_active == 0) { if (m != NULL) err = drbr_enqueue(ifp, txr->br, m); return (err); @@ -973,19 +1010,17 @@ igb_mq_start_locked(struct ifnet *ifp, struct tx_ring *txr, struct mbuf *m) ETHER_BPF_MTAP(ifp, next); if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) break; - if (txr->tx_avail <= IGB_TX_CLEANUP_THRESHOLD) - igb_txeof(txr); - if (txr->tx_avail <= IGB_MAX_SCATTER) { - ifp->if_drv_flags |= IFF_DRV_OACTIVE; - break; - } next = drbr_dequeue(ifp, txr->br); } if (enq > 0) { /* Set the watchdog */ - txr->queue_status = IGB_QUEUE_WORKING; + txr->queue_status |= IGB_QUEUE_WORKING; txr->watchdog_time = ticks; } + if (txr->tx_avail <= IGB_TX_CLEANUP_THRESHOLD) + igb_txeof(txr); + if (txr->tx_avail <= IGB_MAX_SCATTER) + txr->queue_status |= IGB_QUEUE_DEPLETED; return (err); } @@ -1023,7 +1058,7 @@ igb_qflush(struct ifnet *ifp) } if_qflush(ifp); } -#endif /* __FreeBSD_version < 800000 */ +#endif /* __FreeBSD_version >= 800000 */ /********************************************************************* * Ioctl entry point @@ -1129,11 +1164,6 @@ igb_ioctl(struct ifnet *ifp, u_long command, caddr_t data) } break; case SIOCSIFMEDIA: - /* - ** As the speed/duplex settings are being - ** changed, we need toreset the PHY. - */ - adapter->hw.phy.reset_disable = FALSE; /* Check SOL/IDER usage */ IGB_CORE_LOCK(adapter); if (e1000_check_reset_block(&adapter->hw)) { @@ -1324,10 +1354,8 @@ igb_init_locked(struct adapter *adapter) } /* Set Energy Efficient Ethernet */ - e1000_set_eee_i350(&adapter->hw); - - /* Don't reset the phy next time init gets called */ - adapter->hw.phy.reset_disable = TRUE; + if (adapter->hw.phy.media_type == e1000_media_type_copper) + e1000_set_eee_i350(&adapter->hw); } static void @@ -1352,19 +1380,22 @@ igb_handle_que(void *context, int pending) if (ifp->if_drv_flags & IFF_DRV_RUNNING) { bool more; - more = igb_rxeof(que, -1, NULL); + more = igb_rxeof(que, adapter->rx_process_limit, NULL); IGB_TX_LOCK(txr); - if (igb_txeof(txr)) - more = TRUE; + igb_txeof(txr); #if __FreeBSD_version >= 800000 - if (!drbr_empty(ifp, txr->br)) + /* Process the stack queue only if not depleted */ + if (((txr->queue_status & IGB_QUEUE_DEPLETED) == 0) && + !drbr_empty(ifp, txr->br)) igb_mq_start_locked(ifp, txr, NULL); #else - igb_start_locked(txr, ifp); + if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) + igb_start_locked(txr, ifp); #endif IGB_TX_UNLOCK(txr); - if (more || (ifp->if_drv_flags & IFF_DRV_OACTIVE)) { + /* Do we need another? */ + if (more) { taskqueue_enqueue(que->tq, &que->que_task); return; } @@ -1387,8 +1418,35 @@ igb_handle_link(void *context, int pending) { struct adapter *adapter = context; + IGB_CORE_LOCK(adapter); + igb_handle_link_locked(adapter); + IGB_CORE_UNLOCK(adapter); +} + +static void +igb_handle_link_locked(struct adapter *adapter) +{ + struct tx_ring *txr = adapter->tx_rings; + struct ifnet *ifp = adapter->ifp; + + IGB_CORE_LOCK_ASSERT(adapter); adapter->hw.mac.get_link_status = 1; igb_update_link_status(adapter); + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) && adapter->link_active) { + for (int i = 0; i < adapter->num_queues; i++, txr++) { + IGB_TX_LOCK(txr); +#if __FreeBSD_version >= 800000 + /* Process the stack queue only if not depleted */ + if (((txr->queue_status & IGB_QUEUE_DEPLETED) == 0) && + !drbr_empty(ifp, txr->br)) + igb_mq_start_locked(ifp, txr, NULL); +#else + if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) + igb_start_locked(txr, ifp); +#endif + IGB_TX_UNLOCK(txr); + } + } } /********************************************************************* @@ -1468,7 +1526,7 @@ igb_poll(struct ifnet *ifp, enum poll_cmd cmd, int count) reg_icr = E1000_READ_REG(&adapter->hw, E1000_ICR); /* Link status change */ if (reg_icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC)) - igb_handle_link(adapter, 0); + igb_handle_link_locked(adapter); if (reg_icr & E1000_ICR_RXO) adapter->rx_overruns++; @@ -1485,7 +1543,8 @@ igb_poll(struct ifnet *ifp, enum poll_cmd cmd, int count) if (!drbr_empty(ifp, txr->br)) igb_mq_start_locked(ifp, txr, NULL); #else - igb_start_locked(txr, ifp); + if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) + igb_start_locked(txr, ifp); #endif IGB_TX_UNLOCK(txr); return POLL_RETURN_COUNT(rx_done); @@ -1494,7 +1553,7 @@ igb_poll(struct ifnet *ifp, enum poll_cmd cmd, int count) /********************************************************************* * - * MSIX TX Interrupt Service routine + * MSIX Que Interrupt Service routine * **********************************************************************/ static void @@ -1502,16 +1561,26 @@ igb_msix_que(void *arg) { struct igb_queue *que = arg; struct adapter *adapter = que->adapter; + struct ifnet *ifp = adapter->ifp; struct tx_ring *txr = que->txr; struct rx_ring *rxr = que->rxr; u32 newitr = 0; - bool more_tx, more_rx; + bool more_rx; E1000_WRITE_REG(&adapter->hw, E1000_EIMC, que->eims); ++que->irqs; IGB_TX_LOCK(txr); - more_tx = igb_txeof(txr); + igb_txeof(txr); +#if __FreeBSD_version >= 800000 + /* Process the stack queue only if not depleted */ + if (((txr->queue_status & IGB_QUEUE_DEPLETED) == 0) && + !drbr_empty(ifp, txr->br)) + igb_mq_start_locked(ifp, txr, NULL); +#else + if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) + igb_start_locked(txr, ifp); +#endif IGB_TX_UNLOCK(txr); more_rx = igb_rxeof(que, adapter->rx_process_limit, NULL); @@ -1569,8 +1638,7 @@ igb_msix_que(void *arg) no_calc: /* Schedule a clean task if needed*/ - if (more_tx || more_rx || - (adapter->ifp->if_drv_flags & IFF_DRV_OACTIVE)) + if (more_rx) taskqueue_enqueue(que->tq, &que->que_task); else /* Reenable this interrupt */ @@ -1718,10 +1786,8 @@ igb_media_change(struct ifnet *ifp) /********************************************************************* * * This routine maps the mbufs to Advanced TX descriptors. - * used by the 82575 adapter. * **********************************************************************/ - static int igb_xmit(struct tx_ring *txr, struct mbuf **m_headp) { @@ -1730,22 +1796,123 @@ igb_xmit(struct tx_ring *txr, struct mbuf **m_headp) bus_dmamap_t map; struct igb_tx_buffer *tx_buffer, *tx_buffer_mapped; union e1000_adv_tx_desc *txd = NULL; - struct mbuf *m_head; - u32 olinfo_status = 0, cmd_type_len = 0; - int nsegs, i, j, error, first, last = 0; - u32 hdrlen = 0; - - m_head = *m_headp; - + struct mbuf *m_head = *m_headp; + struct ether_vlan_header *eh = NULL; + struct ip *ip = NULL; + struct tcphdr *th = NULL; + u32 hdrlen, cmd_type_len, olinfo_status = 0; + int ehdrlen, poff; + int nsegs, i, first, last = 0; + int error, do_tso, remap = 1; /* Set basic descriptor constants */ - cmd_type_len |= E1000_ADVTXD_DTYP_DATA; + cmd_type_len = E1000_ADVTXD_DTYP_DATA; cmd_type_len |= E1000_ADVTXD_DCMD_IFCS | E1000_ADVTXD_DCMD_DEXT; if (m_head->m_flags & M_VLANTAG) cmd_type_len |= E1000_ADVTXD_DCMD_VLE; +retry: + m_head = *m_headp; + do_tso = ((m_head->m_pkthdr.csum_flags & CSUM_TSO) != 0); + hdrlen = ehdrlen = poff = 0; + /* - * Map the packet for DMA. + * Intel recommends entire IP/TCP header length reside in a single + * buffer. If multiple descriptors are used to describe the IP and + * TCP header, each descriptor should describe one or more + * complete headers; descriptors referencing only parts of headers + * are not supported. If all layer headers are not coalesced into + * a single buffer, each buffer should not cross a 4KB boundary, + * or be larger than the maximum read request size. + * Controller also requires modifing IP/TCP header to make TSO work + * so we firstly get a writable mbuf chain then coalesce ethernet/ + * IP/TCP header into a single buffer to meet the requirement of + * controller. This also simplifies IP/TCP/UDP checksum offloading + * which also has similiar restrictions. + */ + if (do_tso || m_head->m_pkthdr.csum_flags & CSUM_OFFLOAD) { + if (do_tso || (m_head->m_next != NULL && + m_head->m_pkthdr.csum_flags & CSUM_OFFLOAD)) { + if (M_WRITABLE(*m_headp) == 0) { + m_head = m_dup(*m_headp, M_DONTWAIT); + m_freem(*m_headp); + if (m_head == NULL) { + *m_headp = NULL; + return (ENOBUFS); + } + *m_headp = m_head; + } + } + /* + * Assume IPv4, we don't have TSO/checksum offload support + * for IPv6 yet. + */ + ehdrlen = sizeof(struct ether_header); + m_head = m_pullup(m_head, ehdrlen); + if (m_head == NULL) { + *m_headp = NULL; + return (ENOBUFS); + } + eh = mtod(m_head, struct ether_vlan_header *); + if (eh->evl_encap_proto == htons(ETHERTYPE_VLAN)) { + ehdrlen = sizeof(struct ether_vlan_header); + m_head = m_pullup(m_head, ehdrlen); + if (m_head == NULL) { + *m_headp = NULL; + return (ENOBUFS); + } + } + m_head = m_pullup(m_head, ehdrlen + sizeof(struct ip)); + if (m_head == NULL) { + *m_headp = NULL; + return (ENOBUFS); + } + ip = (struct ip *)(mtod(m_head, char *) + ehdrlen); + poff = ehdrlen + (ip->ip_hl << 2); + if (do_tso) { + m_head = m_pullup(m_head, poff + sizeof(struct tcphdr)); + if (m_head == NULL) { + *m_headp = NULL; + return (ENOBUFS); + } + /* + * The pseudo TCP checksum does not include TCP payload + * length so driver should recompute the checksum here + * what hardware expect to see. This is adherence of + * Microsoft's Large Send specification. + */ + th = (struct tcphdr *)(mtod(m_head, char *) + poff); + th->th_sum = in_pseudo(ip->ip_src.s_addr, + ip->ip_dst.s_addr, htons(IPPROTO_TCP)); + /* Keep track of the full header length */ + hdrlen = poff + (th->th_off << 2); + } else if (m_head->m_pkthdr.csum_flags & CSUM_TCP) { + m_head = m_pullup(m_head, poff + sizeof(struct tcphdr)); + if (m_head == NULL) { + *m_headp = NULL; + return (ENOBUFS); + } + th = (struct tcphdr *)(mtod(m_head, char *) + poff); + m_head = m_pullup(m_head, poff + (th->th_off << 2)); + if (m_head == NULL) { + *m_headp = NULL; + return (ENOBUFS); + } + ip = (struct ip *)(mtod(m_head, char *) + ehdrlen); + th = (struct tcphdr *)(mtod(m_head, char *) + poff); + } else if (m_head->m_pkthdr.csum_flags & CSUM_UDP) { + m_head = m_pullup(m_head, poff + sizeof(struct udphdr)); + if (m_head == NULL) { + *m_headp = NULL; + return (ENOBUFS); + } + ip = (struct ip *)(mtod(m_head, char *) + ehdrlen); + } + *m_headp = m_head; + } + + /* + * Map the packet for DMA * * Capture the first descriptor index, * this descriptor will have the index @@ -1760,7 +1927,16 @@ igb_xmit(struct tx_ring *txr, struct mbuf **m_headp) error = bus_dmamap_load_mbuf_sg(txr->txtag, map, *m_headp, segs, &nsegs, BUS_DMA_NOWAIT); - if (error == EFBIG) { + /* + * There are two types of errors we can (try) to handle: + * - EFBIG means the mbuf chain was too long and bus_dma ran + * out of segments. Defragment the mbuf chain and try again. + * - ENOMEM means bus_dma could not obtain enough bounce buffers + * at this point in time. Defer sending and try again later. + * All other errors, in particular EINVAL, are fatal and prevent the + * mbuf chain from ever going through. Drop it and report error. + */ + if (error == EFBIG && remap) { struct mbuf *m; m = m_defrag(*m_headp, M_DONTWAIT); @@ -1772,19 +1948,9 @@ igb_xmit(struct tx_ring *txr, struct mbuf **m_headp) } *m_headp = m; - /* Try it again */ - error = bus_dmamap_load_mbuf_sg(txr->txtag, map, - *m_headp, segs, &nsegs, BUS_DMA_NOWAIT); - - if (error == ENOMEM) { - adapter->no_tx_dma_setup++; - return (error); - } else if (error != 0) { - adapter->no_tx_dma_setup++; - m_freem(*m_headp); - *m_headp = NULL; - return (error); - } + /* Try it again, but only once */ + remap = 0; + goto retry; } else if (error == ENOMEM) { adapter->no_tx_dma_setup++; return (error); @@ -1795,29 +1961,35 @@ igb_xmit(struct tx_ring *txr, struct mbuf **m_headp) return (error); } - /* Check again to be sure we have enough descriptors */ - if (nsegs > (txr->tx_avail - 2)) { + /* + ** Make sure we don't overrun the ring, + ** we need nsegs descriptors and one for + ** the context descriptor used for the + ** offloads. + */ + if ((nsegs + 1) > (txr->tx_avail - 2)) { txr->no_desc_avail++; bus_dmamap_unload(txr->txtag, map); return (ENOBUFS); } m_head = *m_headp; - /* - * Set up the context descriptor: - * used when any hardware offload is done. - * This includes CSUM, VLAN, and TSO. It - * will use the first descriptor. + /* Do hardware assists: + * Set up the context descriptor, used + * when any hardware offload is done. + * This includes CSUM, VLAN, and TSO. + * It will use the first descriptor. */ - if (m_head->m_pkthdr.csum_flags & CSUM_TSO) { - if (igb_tso_setup(txr, m_head, &hdrlen)) { + + if (m_head->m_pkthdr.csum_flags & CSUM_TSO) { + if (igb_tso_setup(txr, m_head, ehdrlen, ip, th)) { cmd_type_len |= E1000_ADVTXD_DCMD_TSE; olinfo_status |= E1000_TXD_POPTS_IXSM << 8; olinfo_status |= E1000_TXD_POPTS_TXSM << 8; } else - return (ENXIO); + return (ENXIO); } else if (igb_tx_ctx_setup(txr, m_head)) - olinfo_status |= E1000_TXD_POPTS_TXSM << 8; + olinfo_status |= E1000_TXD_POPTS_TXSM << 8; /* Calculate payload length */ olinfo_status |= ((m_head->m_pkthdr.len - hdrlen) @@ -1829,7 +2001,7 @@ igb_xmit(struct tx_ring *txr, struct mbuf **m_headp) /* Set up our transmit descriptors */ i = txr->next_avail_desc; - for (j = 0; j < nsegs; j++) { + for (int j = 0; j < nsegs; j++) { bus_size_t seg_len; bus_addr_t seg_addr; @@ -1850,8 +2022,14 @@ igb_xmit(struct tx_ring *txr, struct mbuf **m_headp) txr->next_avail_desc = i; txr->tx_avail -= nsegs; - tx_buffer->m_head = m_head; + + /* + ** Here we swap the map so the last descriptor, + ** which gets the completion interrupt has the + ** real map, and the first descriptor gets the + ** unused map from this descriptor. + */ tx_buffer_mapped->map = tx_buffer->map; tx_buffer->map = map; bus_dmamap_sync(txr->txtag, map, BUS_DMASYNC_PREWRITE); @@ -1869,6 +2047,7 @@ igb_xmit(struct tx_ring *txr, struct mbuf **m_headp) */ tx_buffer = &txr->tx_buffers[first]; tx_buffer->next_eop = last; + /* Update the watchdog time early and often */ txr->watchdog_time = ticks; /* @@ -1881,9 +2060,7 @@ igb_xmit(struct tx_ring *txr, struct mbuf **m_headp) ++txr->tx_packets; return (0); - } - static void igb_set_promisc(struct adapter *adapter) { @@ -1990,7 +2167,10 @@ igb_local_timer(void *arg) { struct adapter *adapter = arg; device_t dev = adapter->dev; + struct ifnet *ifp = adapter->ifp; struct tx_ring *txr = adapter->tx_rings; + struct igb_queue *que = adapter->queues; + int hung = 0, busy = 0; IGB_CORE_LOCK_ASSERT(adapter); @@ -1998,22 +2178,29 @@ igb_local_timer(void *arg) igb_update_link_status(adapter); igb_update_stats_counters(adapter); - /* - ** If flow control has paused us since last checking - ** it invalidates the watchdog timing, so dont run it. - */ - if (adapter->pause_frames) { - adapter->pause_frames = 0; - goto out; - } - /* - ** Watchdog: check for time since any descriptor was cleaned + ** Check the TX queues status + ** - central locked handling of OACTIVE + ** - watchdog only if all queues show hung */ - for (int i = 0; i < adapter->num_queues; i++, txr++) - if (txr->queue_status == IGB_QUEUE_HUNG) - goto timeout; -out: + for (int i = 0; i < adapter->num_queues; i++, que++, txr++) { + if ((txr->queue_status & IGB_QUEUE_HUNG) && + (adapter->pause_frames == 0)) + ++hung; + if (txr->queue_status & IGB_QUEUE_DEPLETED) + ++busy; + if ((txr->queue_status & IGB_QUEUE_IDLE) == 0) + taskqueue_enqueue(que->tq, &que->que_task); + } + if (hung == adapter->num_queues) + goto timeout; + if (busy == adapter->num_queues) + ifp->if_drv_flags |= IFF_DRV_OACTIVE; + else if ((ifp->if_drv_flags & IFF_DRV_OACTIVE) && + (busy < adapter->num_queues)) + ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; + + adapter->pause_frames = 0; callout_reset(&adapter->timer, hz, igb_local_timer, adapter); #ifndef DEVICE_POLLING /* Schedule all queue interrupts - deadlock protection */ @@ -2106,7 +2293,7 @@ igb_update_link_status(struct adapter *adapter) adapter->link_active = 0; /* This can sleep */ if_link_state_change(ifp, LINK_STATE_DOWN); - /* Turn off watchdogs */ + /* Reset queue state */ for (int i = 0; i < adapter->num_queues; i++, txr++) txr->queue_status = IGB_QUEUE_IDLE; } @@ -2135,9 +2322,10 @@ igb_stop(void *arg) callout_stop(&adapter->timer); /* Tell the stack that the interface is no longer active */ - ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + ifp->if_drv_flags |= IFF_DRV_OACTIVE; - /* Unarm watchdog timer. */ + /* Disarm watchdog timer. */ for (int i = 0; i < adapter->num_queues; i++, txr++) { IGB_TX_LOCK(txr); txr->queue_status = IGB_QUEUE_IDLE; @@ -2292,6 +2480,9 @@ igb_allocate_msix(struct adapter *adapter) struct igb_queue *que = adapter->queues; int error, rid, vector = 0; + /* Be sure to start with all interrupts disabled */ + E1000_WRITE_REG(&adapter->hw, E1000_IMC, ~0); + E1000_WRITE_FLUSH(&adapter->hw); for (int i = 0; i < adapter->num_queues; i++, vector++, que++) { rid = vector +1; @@ -2323,8 +2514,16 @@ igb_allocate_msix(struct adapter *adapter) ** Bind the msix vector, and thus the ** rings to the corresponding cpu. */ - if (adapter->num_queues > 1) - bus_bind_intr(dev, que->res, i); + if (adapter->num_queues > 1) { + if (igb_last_bind_cpu < 0) + igb_last_bind_cpu = CPU_FIRST(); + bus_bind_intr(dev, que->res, igb_last_bind_cpu); + device_printf(dev, + "Bound queue %d to cpu %d\n", + i,igb_last_bind_cpu); + igb_last_bind_cpu = CPU_NEXT(igb_last_bind_cpu); + igb_last_bind_cpu = igb_last_bind_cpu % mp_ncpus; + } #if __FreeBSD_version >= 800000 TASK_INIT(&que->txr->txq_task, 0, igb_deferred_mq_start, que->txr); @@ -2379,6 +2578,8 @@ igb_configure_queues(struct adapter *adapter) switch (adapter->hw.mac.type) { case e1000_82580: case e1000_i350: + case e1000_i210: + case e1000_i211: case e1000_vfadapt: case e1000_vfadapt_i350: /* RX entries */ @@ -2577,7 +2778,7 @@ static int igb_setup_msix(struct adapter *adapter) { device_t dev = adapter->dev; - int rid, want, queues, msgs; + int rid, want, queues, msgs, maxqueues; /* tuneable override */ if (igb_enable_msix == 0) @@ -2608,16 +2809,29 @@ igb_setup_msix(struct adapter *adapter) /* Manual override */ if (igb_num_queues != 0) queues = igb_num_queues; - if (queues > 8) /* max queues */ - queues = 8; - /* Can have max of 4 queues on 82575 */ - if ((adapter->hw.mac.type == e1000_82575) && (queues > 4)) - queues = 4; - - /* Limit the VF devices to one queue */ - if (adapter->vf_ifp) - queues = 1; + /* Sanity check based on HW */ + switch (adapter->hw.mac.type) { + case e1000_82575: + maxqueues = 4; + break; + case e1000_82576: + case e1000_82580: + case e1000_i350: + maxqueues = 8; + break; + case e1000_i210: + maxqueues = 4; + break; + case e1000_i211: + maxqueues = 2; + break; + default: /* VF interfaces */ + maxqueues = 1; + break; + } + if (queues > maxqueues) + queues = maxqueues; /* ** One vector (RX/TX pair) per queue @@ -2631,7 +2845,7 @@ igb_setup_msix(struct adapter *adapter) "MSIX Configuration Problem, " "%d vectors configured, but %d queues wanted!\n", msgs, want); - return (ENXIO); + return (0); } if ((msgs) && pci_alloc_msix(dev, &msgs) == 0) { device_printf(adapter->dev, @@ -2641,9 +2855,11 @@ igb_setup_msix(struct adapter *adapter) } msi: msgs = pci_msi_count(dev); - if (msgs == 1 && pci_alloc_msi(dev, &msgs) == 0) - device_printf(adapter->dev,"Using MSI interrupt\n"); - return (msgs); + if (msgs == 1 && pci_alloc_msi(dev, &msgs) == 0) { + device_printf(adapter->dev," Using MSI interrupt\n"); + return (msgs); + } + return (0); } /********************************************************************* @@ -2686,7 +2902,9 @@ igb_reset(struct adapter *adapter) pba = E1000_READ_REG(hw, E1000_RXPBS); pba = e1000_rxpbs_adjust_82580(pba); break; - pba = E1000_PBA_35K; + case e1000_i210: + case e1000_i211: + pba = E1000_PBA_34K; default: break; } @@ -2741,12 +2959,10 @@ igb_reset(struct adapter *adapter) fc->pause_time = IGB_FC_PAUSE_TIME; fc->send_xon = TRUE; - if (fc->requested_mode) - fc->current_mode = fc->requested_mode; + if (adapter->fc) + fc->requested_mode = adapter->fc; else - fc->current_mode = e1000_fc_full; - - adapter->fc = fc->current_mode; + fc->requested_mode = e1000_fc_default; /* Issue a global reset */ e1000_reset_hw(hw); @@ -2756,7 +2972,9 @@ igb_reset(struct adapter *adapter) device_printf(dev, "Hardware Initialization Failed\n"); /* Setup DMA Coalescing */ - if (hw->mac.type == e1000_i350) { + if ((hw->mac.type > e1000_82580) && + (hw->mac.type != e1000_i211)) { + u32 dmac; u32 reg = ~E1000_DMACR_DMAC_EN; if (adapter->dmac == 0) { /* Disabling it */ @@ -2764,26 +2982,36 @@ igb_reset(struct adapter *adapter) goto reset_out; } - hwm = (pba - 4) << 10; - reg = (((pba-6) << E1000_DMACR_DMACTHR_SHIFT) - & E1000_DMACR_DMACTHR_MASK); + /* Set starting thresholds */ + E1000_WRITE_REG(hw, E1000_DMCTXTH, 0); + E1000_WRITE_REG(hw, E1000_DMCRTRH, 0); + hwm = 64 * pba - adapter->max_frame_size / 16; + if (hwm < 64 * (pba - 6)) + hwm = 64 * (pba - 6); + reg = E1000_READ_REG(hw, E1000_FCRTC); + reg &= ~E1000_FCRTC_RTH_COAL_MASK; + reg |= ((hwm << E1000_FCRTC_RTH_COAL_SHIFT) + & E1000_FCRTC_RTH_COAL_MASK); + E1000_WRITE_REG(hw, E1000_FCRTC, reg); + + + dmac = pba - adapter->max_frame_size / 512; + if (dmac < pba - 10) + dmac = pba - 10; + reg = E1000_READ_REG(hw, E1000_DMACR); + reg &= ~E1000_DMACR_DMACTHR_MASK; + reg = ((dmac << E1000_DMACR_DMACTHR_SHIFT) + & E1000_DMACR_DMACTHR_MASK); /* transition to L0x or L1 if available..*/ reg |= (E1000_DMACR_DMAC_EN | E1000_DMACR_DMAC_LX_MASK); - /* timer = value in adapter->dmac in 32usec intervals */ reg |= (adapter->dmac >> 5); E1000_WRITE_REG(hw, E1000_DMACR, reg); - /* No lower threshold */ - E1000_WRITE_REG(hw, E1000_DMCRTRH, 0); - - /* set hwm to PBA - 2 * max frame size */ - E1000_WRITE_REG(hw, E1000_FCRTC, hwm); - /* Set the interval before transition */ reg = E1000_READ_REG(hw, E1000_DMCTLX); - reg |= 0x800000FF; /* 255 usec */ + reg |= 0x80000004; E1000_WRITE_REG(hw, E1000_DMCTLX, reg); /* free space in tx packet buffer to wake from DMA coal */ @@ -2792,9 +3020,15 @@ igb_reset(struct adapter *adapter) /* make low power state decision controlled by DMA coal */ reg = E1000_READ_REG(hw, E1000_PCIEMISC); - E1000_WRITE_REG(hw, E1000_PCIEMISC, - reg | E1000_PCIEMISC_LX_DECISION); + reg &= ~E1000_PCIEMISC_LX_DECISION; + E1000_WRITE_REG(hw, E1000_PCIEMISC, reg); device_printf(dev, "DMA Coalescing enabled\n"); + + } else if (hw->mac.type == e1000_82580) { + u32 reg = E1000_READ_REG(hw, E1000_PCIEMISC); + E1000_WRITE_REG(hw, E1000_DMACR, 0); + E1000_WRITE_REG(hw, E1000_PCIEMISC, + reg & ~E1000_PCIEMISC_LX_DECISION); } reset_out: @@ -2822,7 +3056,6 @@ igb_setup_interface(device_t dev, struct adapter *adapter) return (-1); } if_initname(ifp, device_get_name(dev), device_get_unit(dev)); - ifp->if_mtu = ETHERMTU; ifp->if_init = igb_init; ifp->if_softc = adapter; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; @@ -2832,10 +3065,10 @@ igb_setup_interface(device_t dev, struct adapter *adapter) ifp->if_qflush = igb_qflush; #else ifp->if_start = igb_start; -#endif IFQ_SET_MAXLEN(&ifp->if_snd, adapter->num_tx_desc - 1); ifp->if_snd.ifq_drv_maxlen = adapter->num_tx_desc - 1; IFQ_SET_READY(&ifp->if_snd); +#endif ether_ifattach(ifp, adapter->hw.mac.addr); @@ -3212,9 +3445,16 @@ igb_setup_transmit_ring(struct tx_ring *txr) struct adapter *adapter = txr->adapter; struct igb_tx_buffer *txbuf; int i; +#ifdef DEV_NETMAP + struct netmap_adapter *na = NA(adapter->ifp); + struct netmap_slot *slot; +#endif /* DEV_NETMAP */ /* Clear the old descriptor contents */ IGB_TX_LOCK(txr); +#ifdef DEV_NETMAP + slot = netmap_reset(na, NR_TX, txr->me, 0); +#endif /* DEV_NETMAP */ bzero((void *)txr->tx_base, (sizeof(union e1000_adv_tx_desc)) * adapter->num_tx_desc); /* Reset indices */ @@ -3231,6 +3471,13 @@ igb_setup_transmit_ring(struct tx_ring *txr) m_freem(txbuf->m_head); txbuf->m_head = NULL; } +#ifdef DEV_NETMAP + if (slot) { + int si = netmap_idx_n2k(&na->tx_rings[txr->me], i); + /* no need to set the address */ + netmap_load_map(txr->txtag, txbuf->map, NMB(slot + si)); + } +#endif /* DEV_NETMAP */ /* clear the watch index */ txbuf->next_eop = -1; } @@ -3396,8 +3643,9 @@ igb_free_transmit_buffers(struct tx_ring *txr) * Setup work for hardware segmentation offload (TSO) * **********************************************************************/ -static boolean_t -igb_tso_setup(struct tx_ring *txr, struct mbuf *mp, u32 *hdrlen) +static bool +igb_tso_setup(struct tx_ring *txr, struct mbuf *mp, int ehdrlen, + struct ip *ip, struct tcphdr *th) { struct adapter *adapter = txr->adapter; struct e1000_adv_tx_context_desc *TXD; @@ -3405,45 +3653,15 @@ igb_tso_setup(struct tx_ring *txr, struct mbuf *mp, u32 *hdrlen) u32 vlan_macip_lens = 0, type_tucmd_mlhl = 0; u32 mss_l4len_idx = 0; u16 vtag = 0; - int ctxd, ehdrlen, ip_hlen, tcp_hlen; - struct ether_vlan_header *eh; - struct ip *ip; - struct tcphdr *th; + int ctxd, ip_hlen, tcp_hlen; - - /* - * Determine where frame payload starts. - * Jump over vlan headers if already present - */ - eh = mtod(mp, struct ether_vlan_header *); - if (eh->evl_encap_proto == htons(ETHERTYPE_VLAN)) - ehdrlen = ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN; - else - ehdrlen = ETHER_HDR_LEN; - - /* Ensure we have at least the IP+TCP header in the first mbuf. */ - if (mp->m_len < ehdrlen + sizeof(struct ip) + sizeof(struct tcphdr)) - return FALSE; - - /* Only supports IPV4 for now */ ctxd = txr->next_avail_desc; tx_buffer = &txr->tx_buffers[ctxd]; TXD = (struct e1000_adv_tx_context_desc *) &txr->tx_base[ctxd]; - ip = (struct ip *)(mp->m_data + ehdrlen); - if (ip->ip_p != IPPROTO_TCP) - return FALSE; /* 0 */ ip->ip_sum = 0; ip_hlen = ip->ip_hl << 2; - th = (struct tcphdr *)((caddr_t)ip + ip_hlen); - th->th_sum = in_pseudo(ip->ip_src.s_addr, - ip->ip_dst.s_addr, htons(IPPROTO_TCP)); tcp_hlen = th->th_off << 2; - /* - * Calculate header length, this is used - * in the transmit desc in igb_xmit - */ - *hdrlen = ehdrlen + ip_hlen + tcp_hlen; /* VLAN MACLEN IPLEN */ if (mp->m_flags & M_VLANTAG) { @@ -3626,6 +3844,19 @@ igb_txeof(struct tx_ring *txr) IGB_TX_LOCK_ASSERT(txr); +#ifdef DEV_NETMAP + if (ifp->if_capenable & IFCAP_NETMAP) { + struct netmap_adapter *na = NA(ifp); + + selwakeuppri(&na->tx_rings[txr->me].si, PI_NET); + IGB_TX_UNLOCK(txr); + IGB_CORE_LOCK(adapter); + selwakeuppri(&na->tx_si, PI_NET); + IGB_CORE_UNLOCK(adapter); + IGB_TX_LOCK(txr); + return FALSE; + } +#endif /* DEV_NETMAP */ if (txr->tx_avail == adapter->num_tx_desc) { txr->queue_status = IGB_QUEUE_IDLE; return FALSE; @@ -3705,20 +3936,20 @@ igb_txeof(struct tx_ring *txr) ** for too long indicates a hang. */ if ((!processed) && ((ticks - txr->watchdog_time) > IGB_WATCHDOG)) - txr->queue_status = IGB_QUEUE_HUNG; - + txr->queue_status |= IGB_QUEUE_HUNG; /* - * If we have a minimum free, clear IFF_DRV_OACTIVE - * to tell the stack that it is OK to send packets. + * If we have a minimum free, + * clear depleted state bit */ - if (txr->tx_avail > IGB_TX_CLEANUP_THRESHOLD) { - ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; - /* All clean, turn off the watchdog */ - if (txr->tx_avail == adapter->num_tx_desc) { - txr->queue_status = IGB_QUEUE_IDLE; - return (FALSE); - } + if (txr->tx_avail >= IGB_QUEUE_THRESHOLD) + txr->queue_status &= ~IGB_QUEUE_DEPLETED; + + /* All clean, turn off the watchdog */ + if (txr->tx_avail == adapter->num_tx_desc) { + txr->queue_status = IGB_QUEUE_IDLE; + return (FALSE); } + return (TRUE); } @@ -3949,6 +4180,10 @@ igb_setup_receive_ring(struct rx_ring *rxr) bus_dma_segment_t pseg[1], hseg[1]; struct lro_ctrl *lro = &rxr->lro; int rsize, nsegs, error = 0; +#ifdef DEV_NETMAP + struct netmap_adapter *na = NA(rxr->adapter->ifp); + struct netmap_slot *slot; +#endif /* DEV_NETMAP */ adapter = rxr->adapter; dev = adapter->dev; @@ -3956,6 +4191,9 @@ igb_setup_receive_ring(struct rx_ring *rxr) /* Clear the ring contents */ IGB_RX_LOCK(rxr); +#ifdef DEV_NETMAP + slot = netmap_reset(na, NR_RX, rxr->me, 0); +#endif /* DEV_NETMAP */ rsize = roundup2(adapter->num_rx_desc * sizeof(union e1000_adv_rx_desc), IGB_DBA_ALIGN); bzero((void *)rxr->rx_base, rsize); @@ -3974,6 +4212,20 @@ igb_setup_receive_ring(struct rx_ring *rxr) struct mbuf *mh, *mp; rxbuf = &rxr->rx_buffers[j]; +#ifdef DEV_NETMAP + if (slot) { + /* slot sj is mapped to the i-th NIC-ring entry */ + int sj = netmap_idx_n2k(&na->rx_rings[rxr->me], j); + uint64_t paddr; + void *addr; + + addr = PNMB(slot + sj, &paddr); + netmap_load_map(rxr->ptag, rxbuf->pmap, addr); + /* Update descriptor */ + rxr->rx_base[j].read.pkt_addr = htole64(paddr); + continue; + } +#endif /* DEV_NETMAP */ if (rxr->hdr_split == FALSE) goto skip_head; @@ -4258,6 +4510,26 @@ igb_initialize_receive_units(struct adapter *adapter) for (int i = 0; i < adapter->num_queues; i++) { rxr = &adapter->rx_rings[i]; E1000_WRITE_REG(hw, E1000_RDH(i), rxr->next_to_check); +#ifdef DEV_NETMAP + /* + * an init() while a netmap client is active must + * preserve the rx buffers passed to userspace. + * In this driver it means we adjust RDT to + * somthing different from next_to_refresh + * (which is not used in netmap mode). + */ + if (ifp->if_capenable & IFCAP_NETMAP) { + struct netmap_adapter *na = NA(adapter->ifp); + struct netmap_kring *kring = &na->rx_rings[i]; + int t = rxr->next_to_refresh - kring->nr_hwavail; + + if (t >= adapter->num_rx_desc) + t -= adapter->num_rx_desc; + else if (t < 0) + t += adapter->num_rx_desc; + E1000_WRITE_REG(hw, E1000_RDT(i), t); + } else +#endif /* DEV_NETMAP */ E1000_WRITE_REG(hw, E1000_RDT(i), rxr->next_to_refresh); } return; @@ -4436,6 +4708,20 @@ igb_rxeof(struct igb_queue *que, int count, int *done) bus_dmamap_sync(rxr->rxdma.dma_tag, rxr->rxdma.dma_map, BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); +#ifdef DEV_NETMAP + if (ifp->if_capenable & IFCAP_NETMAP) { + struct netmap_adapter *na = NA(ifp); + + na->rx_rings[rxr->me].nr_kflags |= NKR_PENDINTR; + selwakeuppri(&na->rx_rings[rxr->me].si, PI_NET); + IGB_RX_UNLOCK(rxr); + IGB_CORE_LOCK(adapter); + selwakeuppri(&na->rx_si, PI_NET); + IGB_CORE_UNLOCK(adapter); + return (0); + } +#endif /* DEV_NETMAP */ + /* Main clean loop */ for (i = rxr->next_to_check; count != 0;) { struct mbuf *sendmp, *mh, *mp; @@ -4762,8 +5048,8 @@ igb_setup_vlan_hw_support(struct adapter *adapter) e1000_vfta_set_vf(hw, adapter->shadow_vfta[i], TRUE); else - E1000_WRITE_REG_ARRAY(hw, E1000_VFTA, - i, adapter->shadow_vfta[i]); + e1000_write_vfta(hw, + i, adapter->shadow_vfta[i]); } } @@ -5629,23 +5915,26 @@ igb_set_sysctl_value(struct adapter *adapter, const char *name, static int igb_set_flowcntl(SYSCTL_HANDLER_ARGS) { - int error; - struct adapter *adapter = (struct adapter *) arg1; + int error; + static int input = 3; /* default is full */ + struct adapter *adapter = (struct adapter *) arg1; - error = sysctl_handle_int(oidp, &adapter->fc, 0, req); + error = sysctl_handle_int(oidp, &input, 0, req); if ((error) || (req->newptr == NULL)) return (error); - switch (adapter->fc) { + switch (input) { case e1000_fc_rx_pause: case e1000_fc_tx_pause: case e1000_fc_full: - adapter->hw.fc.requested_mode = adapter->fc; - break; case e1000_fc_none: + adapter->hw.fc.requested_mode = input; + adapter->fc = input; + break; default: - adapter->hw.fc.requested_mode = e1000_fc_none; + /* Do nothing */ + return (error); } adapter->hw.fc.current_mode = adapter->hw.fc.requested_mode; @@ -5701,3 +5990,25 @@ igb_sysctl_dmac(SYSCTL_HANDLER_ARGS) igb_init(adapter); return (error); } + +/* +** Manage Energy Efficient Ethernet: +** Control values: +** 0/1 - enabled/disabled +*/ +static int +igb_sysctl_eee(SYSCTL_HANDLER_ARGS) +{ + struct adapter *adapter = (struct adapter *) arg1; + int error, value; + + value = adapter->hw.dev_spec._82575.eee_disable; + error = sysctl_handle_int(oidp, &value, 0, req); + if (error || req->newptr == NULL) + return (error); + IGB_CORE_LOCK(adapter); + adapter->hw.dev_spec._82575.eee_disable = (value != 0); + igb_init_locked(adapter); + IGB_CORE_UNLOCK(adapter); + return (0); +} diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/if_igb.h b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/if_igb.h index 7d7e21a6c0..2be0b08736 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/if_igb.h +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/if_igb.h @@ -30,7 +30,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: src/sys/dev/e1000/if_igb.h,v 1.4.2.6.2.1 2010/12/21 17:09:25 kensmith Exp $*/ +/*$FreeBSD$*/ #ifndef _IGB_H_DEFINED_ #define _IGB_H_DEFINED_ @@ -52,7 +52,7 @@ #define IGB_MAX_TXD 4096 /* - * IGB_RXD: Maximum number of Transmit Descriptors + * IGB_RXD: Maximum number of Receive Descriptors * * This value is the number of receive descriptors allocated by the driver. * Increasing this value allows the driver to buffer more incoming packets. @@ -188,9 +188,13 @@ #define IGB_TX_BUFFER_SIZE ((uint32_t) 1514) #define IGB_FC_PAUSE_TIME 0x0680 #define IGB_EEPROM_APME 0x400; -#define IGB_QUEUE_IDLE 0 -#define IGB_QUEUE_WORKING 1 -#define IGB_QUEUE_HUNG 2 +/* Queue minimum free for use */ +#define IGB_QUEUE_THRESHOLD (adapter->num_tx_desc / 8) +/* Queue bit defines */ +#define IGB_QUEUE_IDLE 1 +#define IGB_QUEUE_WORKING 2 +#define IGB_QUEUE_HUNG 4 +#define IGB_QUEUE_DEPLETED 8 /* * TDBA/RDBA should be aligned on 16 byte boundary. But TDLEN/RDLEN should be diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/if_lem.c b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/if_lem.c index 7056a0d53b..ce863d3300 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/if_lem.c +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/if_lem.c @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2010, Intel Corporation + Copyright (c) 2001-2011, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -30,11 +30,12 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: src/sys/dev/e1000/if_lem.c,v 1.3.2.10.2.1 2010/12/21 17:09:25 kensmith Exp $*/ +/*$FreeBSD$*/ #ifdef HAVE_KERNEL_OPTION_HEADERS #include "opt_device_polling.h" #include "opt_inet.h" +#include "opt_inet6.h" #endif #include @@ -74,11 +75,9 @@ #include #include - #ifndef __HAIKU__ #include #endif - #include #include @@ -88,7 +87,7 @@ /********************************************************************* * Legacy Em Driver version: *********************************************************************/ -char lem_driver_version[] = "1.0.3"; +char lem_driver_version[] = "1.0.4"; /********************************************************************* * PCI Device ID Table @@ -286,7 +285,6 @@ static driver_t lem_driver = { devclass_t lem_devclass; DRIVER_MODULE(lem, pci, lem_driver, lem_devclass, 0, 0); #endif - MODULE_DEPEND(lem, pci, 1, 1, 1); MODULE_DEPEND(lem, ether, 1, 1, 1); @@ -330,6 +328,10 @@ TUNABLE_INT("hw.em.fc_setting", &lem_fc_setting); /* Global used in WOL setup with multiport cards */ static int global_quad_port_a = 0; +#ifdef DEV_NETMAP /* see ixgbe.c for details */ +#include +#endif /* DEV_NETMAP */ + /********************************************************************* * Device identification routine * @@ -400,6 +402,13 @@ lem_attach(device_t dev) INIT_DEBUGOUT("lem_attach: begin"); +#ifndef __HAIKU__ + if (resource_disabled("lem", device_get_unit(dev))) { + device_printf(dev, "Disabled by device hint\n"); + return (ENXIO); + } +#endif + adapter = device_get_softc(dev); adapter->dev = adapter->osdep.dev = dev; EM_CORE_LOCK_INIT(adapter, device_get_nameunit(dev)); @@ -463,7 +472,7 @@ lem_attach(device_t dev) /* Sysctl for setting the interface flow control */ lem_set_flow_cntrl(adapter, "flow_control", - "max number of rx packets to process", + "flow control setting", &adapter->fc_setting, lem_fc_setting); /* @@ -662,6 +671,9 @@ lem_attach(device_t dev) device_get_nameunit(dev)); #endif +#ifdef DEV_NETMAP + lem_netmap_attach(adapter); +#endif /* DEV_NETMAP */ INIT_DEBUGOUT("lem_attach: end"); return (0); @@ -742,6 +754,9 @@ lem_detach(device_t dev) callout_drain(&adapter->timer); callout_drain(&adapter->tx_fifo_timer); +#ifdef DEV_NETMAP + netmap_detach(ifp); +#endif /* DEV_NETMAP */ lem_free_pci_resources(adapter); bus_generic_detach(dev); if_free(ifp); @@ -898,11 +913,12 @@ static int lem_ioctl(struct ifnet *ifp, u_long command, caddr_t data) { struct adapter *adapter = ifp->if_softc; - struct ifreq *ifr = (struct ifreq *)data; -#ifdef INET - struct ifaddr *ifa = (struct ifaddr *)data; + struct ifreq *ifr = (struct ifreq *)data; +#if defined(INET) || defined(INET6) + struct ifaddr *ifa = (struct ifaddr *)data; #endif - int error = 0; + bool avoid_reset = FALSE; + int error = 0; if (adapter->in_detach) return (error); @@ -910,23 +926,26 @@ lem_ioctl(struct ifnet *ifp, u_long command, caddr_t data) switch (command) { case SIOCSIFADDR: #ifdef INET - if (ifa->ifa_addr->sa_family == AF_INET) { - /* - * XXX - * Since resetting hardware takes a very long time - * and results in link renegotiation we only - * initialize the hardware only when it is absolutely - * required. - */ - ifp->if_flags |= IFF_UP; - if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) { - EM_CORE_LOCK(adapter); - lem_init_locked(adapter); - EM_CORE_UNLOCK(adapter); - } - arp_ifinit(ifp, ifa); - } else + if (ifa->ifa_addr->sa_family == AF_INET) + avoid_reset = TRUE; #endif +#ifdef INET6 + if (ifa->ifa_addr->sa_family == AF_INET6) + avoid_reset = TRUE; +#endif + /* + ** Calling init results in link renegotiation, + ** so we avoid doing it when possible. + */ + if (avoid_reset) { + ifp->if_flags |= IFF_UP; + if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) + lem_init(adapter); +#ifdef INET + if (!(ifp->if_flags & IFF_NOARP)) + arp_ifinit(ifp, ifa); +#endif + } else error = ether_ioctl(ifp, command, data); break; case SIOCSIFMTU: @@ -1225,9 +1244,6 @@ lem_init_locked(struct adapter *adapter) /* AMT based hardware can now take control from firmware */ if (adapter->has_manage && adapter->has_amt) lem_get_hw_control(adapter); - - /* Don't reset the phy next time init gets called */ - adapter->hw.phy.reset_disable = TRUE; } static void @@ -1526,11 +1542,6 @@ lem_media_change(struct ifnet *ifp) device_printf(adapter->dev, "Unsupported media type\n"); } - /* As the speed/duplex settings my have changed we need to - * reset the PHY. - */ - adapter->hw.phy.reset_disable = FALSE; - lem_init_locked(adapter); EM_CORE_UNLOCK(adapter); @@ -2360,7 +2371,6 @@ lem_setup_interface(device_t dev, struct adapter *adapter) return (-1); } if_initname(ifp, device_get_name(dev), device_get_unit(dev)); - ifp->if_mtu = ETHERMTU; ifp->if_init = lem_init; ifp->if_softc = adapter; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; @@ -2598,10 +2608,10 @@ lem_dma_free(struct adapter *adapter, struct em_dma_alloc *dma) static int lem_allocate_transmit_structures(struct adapter *adapter) { + int i; device_t dev = adapter->dev; struct em_buffer *tx_buffer; int error; - int i = 0; /* * Create DMA tags for tx descriptors @@ -2655,8 +2665,13 @@ fail: static void lem_setup_transmit_structures(struct adapter *adapter) { + int i; struct em_buffer *tx_buffer; - int i = 0; +#ifdef DEV_NETMAP + /* we are already locked */ + struct netmap_adapter *na = NA(adapter->ifp); + struct netmap_slot *slot = netmap_reset(na, NR_TX, 0, 0); +#endif /* DEV_NETMAP */ /* Clear the old ring contents */ bzero(adapter->tx_desc_base, @@ -2670,6 +2685,19 @@ lem_setup_transmit_structures(struct adapter *adapter) bus_dmamap_unload(adapter->txtag, tx_buffer->map); m_freem(tx_buffer->m_head); tx_buffer->m_head = NULL; +#ifdef DEV_NETMAP + if (slot) { + /* the i-th NIC entry goes to slot si */ + int si = netmap_idx_n2k(&na->tx_rings[0], i); + uint64_t paddr; + void *addr; + + addr = PNMB(slot + si, &paddr); + adapter->tx_desc_base[si].buffer_addr = htole64(paddr); + /* reload the map for netmap mode */ + netmap_load_map(adapter->txtag, tx_buffer->map, addr); + } +#endif /* DEV_NETMAP */ tx_buffer->next_eop = -1; } @@ -2762,11 +2790,11 @@ static void lem_free_transmit_structures(struct adapter *adapter) { struct em_buffer *tx_buffer; - int i = 0; INIT_DEBUGOUT("free_transmit_structures: begin"); if (adapter->tx_buffer_area != NULL) { + int i; for (i = 0; i < adapter->num_tx_desc; i++) { tx_buffer = &adapter->tx_buffer_area[i]; if (tx_buffer->m_head != NULL) { @@ -2794,8 +2822,7 @@ lem_free_transmit_structures(struct adapter *adapter) bus_dma_tag_destroy(adapter->txtag); adapter->txtag = NULL; } - -#ifndef __HAIKU__ +#ifndef __HAIKU__ #if __FreeBSD_version >= 800000 if (adapter->br != NULL) buf_ring_free(adapter->br, M_DEVBUF); @@ -2975,6 +3002,12 @@ lem_txeof(struct adapter *adapter) EM_TX_LOCK_ASSERT(adapter); +#ifdef DEV_NETMAP + if (ifp->if_capenable & IFCAP_NETMAP) { + selwakeuppri(&NA(ifp)->tx_rings[0].si, PI_NET); + return; + } +#endif /* DEV_NETMAP */ if (adapter->num_tx_desc_avail == adapter->num_tx_desc) return; @@ -3205,6 +3238,11 @@ lem_setup_receive_structures(struct adapter *adapter) { struct em_buffer *rx_buffer; int i, error; +#ifdef DEV_NETMAP + /* we are already under lock */ + struct netmap_adapter *na = NA(adapter->ifp); + struct netmap_slot *slot = netmap_reset(na, NR_RX, 0, 0); +#endif /* Reset descriptor ring */ bzero(adapter->rx_desc_base, @@ -3224,6 +3262,20 @@ lem_setup_receive_structures(struct adapter *adapter) /* Allocate new ones. */ for (i = 0; i < adapter->num_rx_desc; i++) { +#ifdef DEV_NETMAP + if (slot) { + /* the i-th NIC entry goes to slot si */ + int si = netmap_idx_n2k(&na->rx_rings[0], i); + uint64_t paddr; + void *addr; + + addr = PNMB(slot + si, &paddr); + netmap_load_map(adapter->rxtag, rx_buffer->map, addr); + /* Update descriptor */ + adapter->rx_desc_base[i].buffer_addr = htole64(paddr); + continue; + } +#endif /* DEV_NETMAP */ error = lem_get_buf(adapter, i); if (error) return (error); @@ -3248,10 +3300,10 @@ lem_setup_receive_structures(struct adapter *adapter) static void lem_initialize_receive_unit(struct adapter *adapter) { + int i; struct ifnet *ifp = adapter->ifp; u64 bus_addr; u32 rctl, rxcsum; - int i = 0; INIT_DEBUGOUT("lem_initialize_receive_unit: begin"); @@ -3349,6 +3401,18 @@ lem_initialize_receive_unit(struct adapter *adapter) * Tail Descriptor Pointers */ E1000_WRITE_REG(&adapter->hw, E1000_RDH(0), 0); +#ifdef DEV_NETMAP + /* preserve buffers already made available to clients */ + if (ifp->if_capenable & IFCAP_NETMAP) { + struct netmap_adapter *na = NA(adapter->ifp); + struct netmap_kring *kring = &na->rx_rings[0]; + int t = na->num_rx_desc - 1 - kring->nr_hwavail; + + if (t >= na->num_rx_desc) + t -= na->num_rx_desc; + E1000_WRITE_REG(&adapter->hw, E1000_RDT(0), t); + } else +#endif /* DEV_NETMAP */ E1000_WRITE_REG(&adapter->hw, E1000_RDT(0), adapter->num_rx_desc - 1); return; @@ -3432,6 +3496,16 @@ lem_rxeof(struct adapter *adapter, int count, int *done) bus_dmamap_sync(adapter->rxdma.dma_tag, adapter->rxdma.dma_map, BUS_DMASYNC_POSTREAD); +#ifdef DEV_NETMAP + if (ifp->if_capenable & IFCAP_NETMAP) { + struct netmap_adapter *na = NA(ifp); + na->rx_rings[0].nr_kflags |= NKR_PENDINTR; + selwakeuppri(&na->rx_rings[0].si, PI_NET); + EM_RX_UNLOCK(adapter); + return (0); + } +#endif /* DEV_NETMAP */ + if (!((current_desc->status) & E1000_RXD_STAT_DD)) { if (done != NULL) *done = rx_sent; @@ -3535,8 +3609,7 @@ lem_rxeof(struct adapter *adapter, int count, int *done) #endif if (status & E1000_RXD_STAT_VP) { adapter->fmp->m_pkthdr.ether_vtag = - (le16toh(current_desc->special) & - E1000_RXD_SPC_VLAN_MASK); + le16toh(current_desc->special); adapter->fmp->m_flags |= M_VLANTAG; } #ifndef __NO_STRICT_ALIGNMENT @@ -3742,9 +3815,9 @@ lem_unregister_vlan(void *arg, struct ifnet *ifp, u16 vtag) static void lem_setup_vlan_hw_support(struct adapter *adapter) { + int i; struct e1000_hw *hw = &adapter->hw; u32 reg; - int i = 0; /* ** We get here thru init_locked, meaning @@ -4024,10 +4097,10 @@ lem_enable_wakeup(device_t dev) static int lem_enable_phy_wakeup(struct adapter *adapter) { + int i; struct e1000_hw *hw = &adapter->hw; u32 mreg, ret = 0; u16 preg; - int i = 0; /* copy MAC RARs to PHY RARs */ for (i = 0; i < adapter->hw.mac.rar_entry_count; i++) { @@ -4277,11 +4350,10 @@ lem_sysctl_reg_handler(SYSCTL_HANDLER_ARGS) struct adapter *adapter; u_int val; -#ifndef __HAIKU__ +#ifndef __HAIKU__ adapter = oidp->oid_arg1; val = E1000_READ_REG(&adapter->hw, oidp->oid_arg2); -#endif - +#endif return (sysctl_handle_int(oidp, &val, 0, req)); } diff --git a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/if_lem.h b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/if_lem.h index 316aae7b26..787efb9cb2 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/if_lem.h +++ b/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/if_lem.h @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2010, Intel Corporation + Copyright (c) 2001-2011, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -30,7 +30,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: src/sys/dev/e1000/if_lem.h,v 1.2.2.5.2.1 2010/12/21 17:09:25 kensmith Exp $*/ +/*$FreeBSD$*/ #ifndef _LEM_H_DEFINED_ @@ -217,9 +217,11 @@ #define EM_BAR_MEM_TYPE_64BIT 0x00000004 #define EM_MSIX_BAR 3 /* On 82575 */ -#if !defined(SYSCTL_ADD_UQUAD) +#ifndef __HAIKU__ +#if __FreeBSD_version < 900000 #define SYSCTL_ADD_UQUAD SYSCTL_ADD_QUAD #endif +#endif /* Defines for printing debug information */ #define DEBUG_INIT 0 diff --git a/src/add-ons/kernel/drivers/network/ipro1000/if_compat.h b/src/add-ons/kernel/drivers/network/ipro1000/if_compat.h index f4cd7a0f9f..4d73dca6e6 100644 --- a/src/add-ons/kernel/drivers/network/ipro1000/if_compat.h +++ b/src/add-ons/kernel/drivers/network/ipro1000/if_compat.h @@ -122,12 +122,6 @@ struct ifmedia uint32 ifm_media; }; -struct ifmediareq -{ - uint32 ifm_status; - uint32 ifm_active; -}; - struct if_queue { volatile struct mbuf * ifq_head; diff --git a/src/add-ons/kernel/drivers/network/jmicron2x0/dev/jme/if_jme.c b/src/add-ons/kernel/drivers/network/jmicron2x0/dev/jme/if_jme.c index 3a4fbb0fbf..7f0f9174f8 100644 --- a/src/add-ons/kernel/drivers/network/jmicron2x0/dev/jme/if_jme.c +++ b/src/add-ons/kernel/drivers/network/jmicron2x0/dev/jme/if_jme.c @@ -26,7 +26,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/jme/if_jme.c,v 1.11.2.8.2.1 2010/12/21 17:09:25 kensmith Exp $"); +__FBSDID("$FreeBSD$"); #include #include @@ -1661,7 +1661,7 @@ jme_resume(device_t dev) sc = device_get_softc(dev); JME_LOCK(sc); - if (pci_find_cap(sc->jme_dev, PCIY_PMG, &pmc) != 0) { + if (pci_find_cap(sc->jme_dev, PCIY_PMG, &pmc) == 0) { pmstat = pci_read_config(sc->jme_dev, pmc + PCIR_POWER_STATUS, 2); /* Disable PME clear PME status. */ diff --git a/src/add-ons/kernel/drivers/network/jmicron2x0/dev/jme/if_jmereg.h b/src/add-ons/kernel/drivers/network/jmicron2x0/dev/jme/if_jmereg.h index 375f5c4c5a..f7dfb129e8 100644 --- a/src/add-ons/kernel/drivers/network/jmicron2x0/dev/jme/if_jmereg.h +++ b/src/add-ons/kernel/drivers/network/jmicron2x0/dev/jme/if_jmereg.h @@ -24,7 +24,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/dev/jme/if_jmereg.h,v 1.6.2.2.2.1 2010/12/21 17:09:25 kensmith Exp $ + * $FreeBSD$ */ #ifndef _IF_JMEREG_H diff --git a/src/add-ons/kernel/drivers/network/jmicron2x0/dev/jme/if_jmevar.h b/src/add-ons/kernel/drivers/network/jmicron2x0/dev/jme/if_jmevar.h index 2e83a7055b..eb4eddc803 100644 --- a/src/add-ons/kernel/drivers/network/jmicron2x0/dev/jme/if_jmevar.h +++ b/src/add-ons/kernel/drivers/network/jmicron2x0/dev/jme/if_jmevar.h @@ -24,7 +24,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/dev/jme/if_jmevar.h,v 1.3.2.1.6.1 2010/12/21 17:09:25 kensmith Exp $ + * $FreeBSD$ */ #ifndef _IF_JMEVAR_H diff --git a/src/add-ons/kernel/drivers/network/jmicron2x0/dev/mii/jmphy.c b/src/add-ons/kernel/drivers/network/jmicron2x0/dev/mii/jmphy.c index 12ef39ddca..14fdf7e787 100644 --- a/src/add-ons/kernel/drivers/network/jmicron2x0/dev/mii/jmphy.c +++ b/src/add-ons/kernel/drivers/network/jmicron2x0/dev/mii/jmphy.c @@ -26,7 +26,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/mii/jmphy.c,v 1.1.6.5.2.1 2010/12/21 17:09:25 kensmith Exp $"); +__FBSDID("$FreeBSD$"); /* * Driver for the JMicron JMP211 10/100/1000, JMP202 10/100 PHY. @@ -62,7 +62,7 @@ static device_method_t jmphy_methods[] = { DEVMETHOD(device_attach, jmphy_attach), DEVMETHOD(device_detach, mii_phy_detach), DEVMETHOD(device_shutdown, bus_generic_shutdown), - { NULL, NULL } + DEVMETHOD_END }; static devclass_t jmphy_devclass; diff --git a/src/add-ons/kernel/drivers/network/jmicron2x0/dev/mii/jmphyreg.h b/src/add-ons/kernel/drivers/network/jmicron2x0/dev/mii/jmphyreg.h index a676d3b4ae..ec668ad1cc 100644 --- a/src/add-ons/kernel/drivers/network/jmicron2x0/dev/mii/jmphyreg.h +++ b/src/add-ons/kernel/drivers/network/jmicron2x0/dev/mii/jmphyreg.h @@ -24,7 +24,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/dev/mii/jmphyreg.h,v 1.1.6.1.6.1 2010/12/21 17:09:25 kensmith Exp $ + * $FreeBSD$ */ #ifndef _DEV_MII_JMPHYREG_H_ diff --git a/src/add-ons/kernel/drivers/network/marvell_yukon/dev/mii/e1000phy.c b/src/add-ons/kernel/drivers/network/marvell_yukon/dev/mii/e1000phy.c index e657592b6d..91ae44d2e9 100644 --- a/src/add-ons/kernel/drivers/network/marvell_yukon/dev/mii/e1000phy.c +++ b/src/add-ons/kernel/drivers/network/marvell_yukon/dev/mii/e1000phy.c @@ -71,7 +71,7 @@ static device_method_t e1000phy_methods[] = { DEVMETHOD(device_attach, e1000phy_attach), DEVMETHOD(device_detach, mii_phy_detach), DEVMETHOD(device_shutdown, bus_generic_shutdown), - { 0, 0 } + DEVMETHOD_END }; static devclass_t e1000phy_devclass; diff --git a/src/add-ons/kernel/drivers/network/marvell_yukon/dev/mii/ukphy.c b/src/add-ons/kernel/drivers/network/marvell_yukon/dev/mii/ukphy.c index 4ecfce29d3..9d52eb580c 100644 --- a/src/add-ons/kernel/drivers/network/marvell_yukon/dev/mii/ukphy.c +++ b/src/add-ons/kernel/drivers/network/marvell_yukon/dev/mii/ukphy.c @@ -55,7 +55,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/mii/ukphy.c,v 1.20.10.6.2.1 2010/12/21 17:09:25 kensmith Exp $"); +__FBSDID("$FreeBSD$"); /* * driver for generic unknown PHYs @@ -86,7 +86,7 @@ static device_method_t ukphy_methods[] = { DEVMETHOD(device_attach, ukphy_attach), DEVMETHOD(device_detach, mii_phy_detach), DEVMETHOD(device_shutdown, bus_generic_shutdown), - { 0, 0 } + DEVMETHOD_END }; static devclass_t ukphy_devclass; diff --git a/src/add-ons/kernel/drivers/network/marvell_yukon/dev/mii/ukphy_subr.c b/src/add-ons/kernel/drivers/network/marvell_yukon/dev/mii/ukphy_subr.c index 73007e197b..5f2f6341ba 100644 --- a/src/add-ons/kernel/drivers/network/marvell_yukon/dev/mii/ukphy_subr.c +++ b/src/add-ons/kernel/drivers/network/marvell_yukon/dev/mii/ukphy_subr.c @@ -31,7 +31,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/mii/ukphy_subr.c,v 1.10.2.4.2.1 2010/12/21 17:09:25 kensmith Exp $"); +__FBSDID("$FreeBSD$"); /* * Subroutines shared by the ukphy driver and other PHY drivers. diff --git a/src/add-ons/kernel/drivers/network/marvell_yukon/dev/msk/if_msk.c b/src/add-ons/kernel/drivers/network/marvell_yukon/dev/msk/if_msk.c index 377a1589b2..a675456142 100644 --- a/src/add-ons/kernel/drivers/network/marvell_yukon/dev/msk/if_msk.c +++ b/src/add-ons/kernel/drivers/network/marvell_yukon/dev/msk/if_msk.c @@ -334,11 +334,7 @@ static device_method_t mskc_methods[] = { DEVMETHOD(device_resume, mskc_resume), DEVMETHOD(device_shutdown, mskc_shutdown), - /* bus interface */ - DEVMETHOD(bus_print_child, bus_generic_print_child), - DEVMETHOD(bus_driver_added, bus_generic_driver_added), - - { NULL, NULL } + DEVMETHOD_END }; static driver_t mskc_driver = { @@ -356,16 +352,12 @@ static device_method_t msk_methods[] = { DEVMETHOD(device_detach, msk_detach), DEVMETHOD(device_shutdown, bus_generic_shutdown), - /* bus interface */ - DEVMETHOD(bus_print_child, bus_generic_print_child), - DEVMETHOD(bus_driver_added, bus_generic_driver_added), - /* MII interface */ DEVMETHOD(miibus_readreg, msk_miibus_readreg), DEVMETHOD(miibus_writereg, msk_miibus_writereg), DEVMETHOD(miibus_statchg, msk_miibus_statchg), - { NULL, NULL } + DEVMETHOD_END }; static driver_t msk_driver = { @@ -700,7 +692,7 @@ msk_init_rx_ring(struct msk_if_softc *sc_if) { struct msk_ring_data *rd; struct msk_rxdesc *rxd; - int i, prod; + int i, nbuf, prod; MSK_IF_LOCK_ASSERT(sc_if); @@ -710,11 +702,18 @@ msk_init_rx_ring(struct msk_if_softc *sc_if) rd = &sc_if->msk_rdata; bzero(rd->msk_rx_ring, sizeof(struct msk_rx_desc) * MSK_RX_RING_CNT); - prod = sc_if->msk_cdata.msk_rx_prod; - i = 0; + for (i = prod = 0; i < MSK_RX_RING_CNT; i++) { + rxd = &sc_if->msk_cdata.msk_rxdesc[prod]; + rxd->rx_m = NULL; + rxd->rx_le = &rd->msk_rx_ring[prod]; + MSK_INC(prod, MSK_RX_RING_CNT); + } + nbuf = MSK_RX_BUF_CNT; + prod = 0; /* Have controller know how to compute Rx checksum. */ if ((sc_if->msk_flags & MSK_FLAG_DESCV2) == 0 && (sc_if->msk_ifp->if_capenable & IFCAP_RXCSUM) != 0) { +#ifdef MSK_64BIT_DMA rxd = &sc_if->msk_cdata.msk_rxdesc[prod]; rxd->rx_m = NULL; rxd->rx_le = &rd->msk_rx_ring[prod]; @@ -723,15 +722,21 @@ msk_init_rx_ring(struct msk_if_softc *sc_if) rxd->rx_le->msk_control = htole32(OP_TCPSTART | HW_OWNER); MSK_INC(prod, MSK_RX_RING_CNT); MSK_INC(sc_if->msk_cdata.msk_rx_cons, MSK_RX_RING_CNT); - i++; - } - for (; i < MSK_RX_RING_CNT; i++) { +#endif rxd = &sc_if->msk_cdata.msk_rxdesc[prod]; rxd->rx_m = NULL; rxd->rx_le = &rd->msk_rx_ring[prod]; + rxd->rx_le->msk_addr = htole32(ETHER_HDR_LEN << 16 | + ETHER_HDR_LEN); + rxd->rx_le->msk_control = htole32(OP_TCPSTART | HW_OWNER); + MSK_INC(prod, MSK_RX_RING_CNT); + MSK_INC(sc_if->msk_cdata.msk_rx_cons, MSK_RX_RING_CNT); + nbuf--; + } + for (i = 0; i < nbuf; i++) { if (msk_newbuf(sc_if, prod) != 0) return (ENOBUFS); - MSK_INC(prod, MSK_RX_RING_CNT); + MSK_RX_INC(prod, MSK_RX_RING_CNT); } bus_dmamap_sync(sc_if->msk_cdata.msk_rx_ring_tag, @@ -739,10 +744,11 @@ msk_init_rx_ring(struct msk_if_softc *sc_if) BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); /* Update prefetch unit. */ - sc_if->msk_cdata.msk_rx_prod = MSK_RX_RING_CNT - 1; + sc_if->msk_cdata.msk_rx_prod = prod; CSR_WRITE_2(sc_if->msk_softc, Y2_PREF_Q_ADDR(sc_if->msk_rxq, PREF_UNIT_PUT_IDX_REG), - sc_if->msk_cdata.msk_rx_prod); + (sc_if->msk_cdata.msk_rx_prod + MSK_RX_RING_CNT - 1) % + MSK_RX_RING_CNT); if (msk_rx_fill(sc_if, 0) != 0) return (ENOBUFS); return (0); @@ -753,7 +759,7 @@ msk_init_jumbo_rx_ring(struct msk_if_softc *sc_if) { struct msk_ring_data *rd; struct msk_rxdesc *rxd; - int i, prod; + int i, nbuf, prod; MSK_IF_LOCK_ASSERT(sc_if); @@ -764,11 +770,18 @@ msk_init_jumbo_rx_ring(struct msk_if_softc *sc_if) rd = &sc_if->msk_rdata; bzero(rd->msk_jumbo_rx_ring, sizeof(struct msk_rx_desc) * MSK_JUMBO_RX_RING_CNT); - prod = sc_if->msk_cdata.msk_rx_prod; - i = 0; + for (i = prod = 0; i < MSK_JUMBO_RX_RING_CNT; i++) { + rxd = &sc_if->msk_cdata.msk_jumbo_rxdesc[prod]; + rxd->rx_m = NULL; + rxd->rx_le = &rd->msk_jumbo_rx_ring[prod]; + MSK_INC(prod, MSK_JUMBO_RX_RING_CNT); + } + nbuf = MSK_RX_BUF_CNT; + prod = 0; /* Have controller know how to compute Rx checksum. */ if ((sc_if->msk_flags & MSK_FLAG_DESCV2) == 0 && (sc_if->msk_ifp->if_capenable & IFCAP_RXCSUM) != 0) { +#ifdef MSK_64BIT_DMA rxd = &sc_if->msk_cdata.msk_jumbo_rxdesc[prod]; rxd->rx_m = NULL; rxd->rx_le = &rd->msk_jumbo_rx_ring[prod]; @@ -777,25 +790,33 @@ msk_init_jumbo_rx_ring(struct msk_if_softc *sc_if) rxd->rx_le->msk_control = htole32(OP_TCPSTART | HW_OWNER); MSK_INC(prod, MSK_JUMBO_RX_RING_CNT); MSK_INC(sc_if->msk_cdata.msk_rx_cons, MSK_JUMBO_RX_RING_CNT); - i++; - } - for (; i < MSK_JUMBO_RX_RING_CNT; i++) { +#endif rxd = &sc_if->msk_cdata.msk_jumbo_rxdesc[prod]; rxd->rx_m = NULL; rxd->rx_le = &rd->msk_jumbo_rx_ring[prod]; + rxd->rx_le->msk_addr = htole32(ETHER_HDR_LEN << 16 | + ETHER_HDR_LEN); + rxd->rx_le->msk_control = htole32(OP_TCPSTART | HW_OWNER); + MSK_INC(prod, MSK_JUMBO_RX_RING_CNT); + MSK_INC(sc_if->msk_cdata.msk_rx_cons, MSK_JUMBO_RX_RING_CNT); + nbuf--; + } + for (i = 0; i < nbuf; i++) { if (msk_jumbo_newbuf(sc_if, prod) != 0) return (ENOBUFS); - MSK_INC(prod, MSK_JUMBO_RX_RING_CNT); + MSK_RX_INC(prod, MSK_JUMBO_RX_RING_CNT); } bus_dmamap_sync(sc_if->msk_cdata.msk_jumbo_rx_ring_tag, sc_if->msk_cdata.msk_jumbo_rx_ring_map, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); - sc_if->msk_cdata.msk_rx_prod = MSK_JUMBO_RX_RING_CNT - 1; + /* Update prefetch unit. */ + sc_if->msk_cdata.msk_rx_prod = prod; CSR_WRITE_2(sc_if->msk_softc, Y2_PREF_Q_ADDR(sc_if->msk_rxq, PREF_UNIT_PUT_IDX_REG), - sc_if->msk_cdata.msk_rx_prod); + (sc_if->msk_cdata.msk_rx_prod + MSK_JUMBO_RX_RING_CNT - 1) % + MSK_JUMBO_RX_RING_CNT); if (msk_rx_fill(sc_if, 1) != 0) return (ENOBUFS); return (0); @@ -813,6 +834,7 @@ msk_init_tx_ring(struct msk_if_softc *sc_if) sc_if->msk_cdata.msk_tx_prod = 0; sc_if->msk_cdata.msk_tx_cons = 0; sc_if->msk_cdata.msk_tx_cnt = 0; + sc_if->msk_cdata.msk_tx_high_addr = 0; rd = &sc_if->msk_rdata; bzero(rd->msk_tx_ring, sizeof(struct msk_tx_desc) * MSK_TX_RING_CNT); @@ -834,6 +856,12 @@ msk_discard_rxbuf(struct msk_if_softc *sc_if, int idx) struct msk_rxdesc *rxd; struct mbuf *m; +#ifdef MSK_64BIT_DMA + rxd = &sc_if->msk_cdata.msk_rxdesc[idx]; + rx_le = rxd->rx_le; + rx_le->msk_control = htole32(OP_ADDR64 | HW_OWNER); + MSK_INC(idx, MSK_RX_RING_CNT); +#endif rxd = &sc_if->msk_cdata.msk_rxdesc[idx]; m = rxd->rx_m; rx_le = rxd->rx_le; @@ -847,6 +875,12 @@ msk_discard_jumbo_rxbuf(struct msk_if_softc *sc_if, int idx) struct msk_rxdesc *rxd; struct mbuf *m; +#ifdef MSK_64BIT_DMA + rxd = &sc_if->msk_cdata.msk_jumbo_rxdesc[idx]; + rx_le = rxd->rx_le; + rx_le->msk_control = htole32(OP_ADDR64 | HW_OWNER); + MSK_INC(idx, MSK_JUMBO_RX_RING_CNT); +#endif rxd = &sc_if->msk_cdata.msk_jumbo_rxdesc[idx]; m = rxd->rx_m; rx_le = rxd->rx_le; @@ -884,10 +918,18 @@ msk_newbuf(struct msk_if_softc *sc_if, int idx) KASSERT(nsegs == 1, ("%s: %d segments returned!", __func__, nsegs)); rxd = &sc_if->msk_cdata.msk_rxdesc[idx]; +#ifdef MSK_64BIT_DMA + rx_le = rxd->rx_le; + rx_le->msk_addr = htole32(MSK_ADDR_HI(segs[0].ds_addr)); + rx_le->msk_control = htole32(OP_ADDR64 | HW_OWNER); + MSK_INC(idx, MSK_RX_RING_CNT); + rxd = &sc_if->msk_cdata.msk_rxdesc[idx]; +#endif if (rxd->rx_m != NULL) { bus_dmamap_sync(sc_if->msk_cdata.msk_rx_tag, rxd->rx_dmamap, BUS_DMASYNC_POSTREAD); bus_dmamap_unload(sc_if->msk_cdata.msk_rx_tag, rxd->rx_dmamap); + rxd->rx_m = NULL; } map = rxd->rx_dmamap; rxd->rx_dmamap = sc_if->msk_cdata.msk_rx_sparemap; @@ -937,11 +979,19 @@ msk_jumbo_newbuf(struct msk_if_softc *sc_if, int idx) KASSERT(nsegs == 1, ("%s: %d segments returned!", __func__, nsegs)); rxd = &sc_if->msk_cdata.msk_jumbo_rxdesc[idx]; +#ifdef MSK_64BIT_DMA + rx_le = rxd->rx_le; + rx_le->msk_addr = htole32(MSK_ADDR_HI(segs[0].ds_addr)); + rx_le->msk_control = htole32(OP_ADDR64 | HW_OWNER); + MSK_INC(idx, MSK_JUMBO_RX_RING_CNT); + rxd = &sc_if->msk_cdata.msk_jumbo_rxdesc[idx]; +#endif if (rxd->rx_m != NULL) { bus_dmamap_sync(sc_if->msk_cdata.msk_jumbo_rx_tag, rxd->rx_dmamap, BUS_DMASYNC_POSTREAD); bus_dmamap_unload(sc_if->msk_cdata.msk_jumbo_rx_tag, rxd->rx_dmamap); + rxd->rx_m = NULL; } map = rxd->rx_dmamap; rxd->rx_dmamap = sc_if->msk_cdata.msk_jumbo_rx_sparemap; @@ -995,9 +1045,9 @@ msk_mediastatus(struct ifnet *ifp, struct ifmediareq *ifmr) mii = device_get_softc(sc_if->msk_miibus); mii_pollstat(mii); - MSK_IF_UNLOCK(sc_if); ifmr->ifm_active = mii->mii_media_active; ifmr->ifm_status = mii->mii_media_status; + MSK_IF_UNLOCK(sc_if); } static int @@ -1472,7 +1522,7 @@ mskc_reset(struct msk_softc *sc) /* Clear status list. */ bzero(sc->msk_stat_ring, - sizeof(struct msk_stat_desc) * MSK_STAT_RING_CNT); + sizeof(struct msk_stat_desc) * sc->msk_stat_count); sc->msk_stat_cons = 0; bus_dmamap_sync(sc->msk_stat_tag, sc->msk_stat_map, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); @@ -1483,7 +1533,7 @@ mskc_reset(struct msk_softc *sc) CSR_WRITE_4(sc, STAT_LIST_ADDR_LO, MSK_ADDR_LO(addr)); CSR_WRITE_4(sc, STAT_LIST_ADDR_HI, MSK_ADDR_HI(addr)); /* Set the status list last index. */ - CSR_WRITE_2(sc, STAT_LAST_IDX, MSK_STAT_RING_CNT - 1); + CSR_WRITE_2(sc, STAT_LAST_IDX, sc->msk_stat_count - 1); if (sc->msk_hw_id == CHIP_ID_YUKON_EC && sc->msk_hw_rev == CHIP_REV_YU_EC_A1) { /* WA for dev. #4.3 */ @@ -2083,17 +2133,33 @@ static int msk_status_dma_alloc(struct msk_softc *sc) { struct msk_dmamap_arg ctx; - int error; + bus_size_t stat_sz; + int count, error; + /* + * It seems controller requires number of status LE entries + * is power of 2 and the maximum number of status LE entries + * is 4096. For dual-port controllers, the number of status + * LE entries should be large enough to hold both port's + * status updates. + */ + count = 3 * MSK_RX_RING_CNT + MSK_TX_RING_CNT; +#ifdef __HAIKU__ + // TODO check this! + #define imin min +#endif + count = imin(4096, roundup2(count, 1024)); + sc->msk_stat_count = count; + stat_sz = count * sizeof(struct msk_stat_desc); error = bus_dma_tag_create( bus_get_dma_tag(sc->msk_dev), /* parent */ MSK_STAT_ALIGN, 0, /* alignment, boundary */ BUS_SPACE_MAXADDR, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ NULL, NULL, /* filter, filterarg */ - MSK_STAT_RING_SZ, /* maxsize */ + stat_sz, /* maxsize */ 1, /* nsegments */ - MSK_STAT_RING_SZ, /* maxsegsize */ + stat_sz, /* maxsegsize */ 0, /* flags */ NULL, NULL, /* lockfunc, lockarg */ &sc->msk_stat_tag); @@ -2114,9 +2180,8 @@ msk_status_dma_alloc(struct msk_softc *sc) } ctx.msk_busaddr = 0; - error = bus_dmamap_load(sc->msk_stat_tag, - sc->msk_stat_map, sc->msk_stat_ring, MSK_STAT_RING_SZ, - msk_dmamap_cb, &ctx, 0); + error = bus_dmamap_load(sc->msk_stat_tag, sc->msk_stat_map, + sc->msk_stat_ring, stat_sz, msk_dmamap_cb, &ctx, BUS_DMA_NOWAIT); if (error != 0) { device_printf(sc->msk_dev, "failed to load DMA'able memory for status ring\n"); @@ -2157,27 +2222,10 @@ msk_txrx_dma_alloc(struct msk_if_softc *sc_if) int error, i; /* Create parent DMA tag. */ - /* - * XXX - * It seems that Yukon II supports full 64bits DMA operations. But - * it needs two descriptors(list elements) for 64bits DMA operations. - * Since we don't know what DMA address mappings(32bits or 64bits) - * would be used in advance for each mbufs, we limits its DMA space - * to be in range of 32bits address space. Otherwise, we should check - * what DMA address is used and chain another descriptor for the - * 64bits DMA operation. This also means descriptor ring size is - * variable. Limiting DMA address to be in 32bit address space greatly - * simplifies descriptor handling and possibly would increase - * performance a bit due to efficient handling of descriptors. - * Apart from harassing checksum offloading mechanisms, it seems - * it's really bad idea to use a separate descriptor for 64bit - * DMA operation to save small descriptor memory. Anyway, I've - * never seen these exotic scheme on ethernet interface hardware. - */ error = bus_dma_tag_create( bus_get_dma_tag(sc_if->msk_if_dev), /* parent */ 1, 0, /* alignment, boundary */ - BUS_SPACE_MAXADDR_32BIT, /* lowaddr */ + BUS_SPACE_MAXADDR, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ NULL, NULL, /* filter, filterarg */ BUS_SPACE_MAXSIZE_32BIT, /* maxsize */ @@ -2283,7 +2331,7 @@ msk_txrx_dma_alloc(struct msk_if_softc *sc_if) ctx.msk_busaddr = 0; error = bus_dmamap_load(sc_if->msk_cdata.msk_tx_ring_tag, sc_if->msk_cdata.msk_tx_ring_map, sc_if->msk_rdata.msk_tx_ring, - MSK_TX_RING_SZ, msk_dmamap_cb, &ctx, 0); + MSK_TX_RING_SZ, msk_dmamap_cb, &ctx, BUS_DMA_NOWAIT); if (error != 0) { device_printf(sc_if->msk_if_dev, "failed to load DMA'able memory for Tx ring\n"); @@ -2304,7 +2352,7 @@ msk_txrx_dma_alloc(struct msk_if_softc *sc_if) ctx.msk_busaddr = 0; error = bus_dmamap_load(sc_if->msk_cdata.msk_rx_ring_tag, sc_if->msk_cdata.msk_rx_ring_map, sc_if->msk_rdata.msk_rx_ring, - MSK_RX_RING_SZ, msk_dmamap_cb, &ctx, 0); + MSK_RX_RING_SZ, msk_dmamap_cb, &ctx, BUS_DMA_NOWAIT); if (error != 0) { device_printf(sc_if->msk_if_dev, "failed to load DMA'able memory for Rx ring\n"); @@ -2421,7 +2469,7 @@ msk_rx_dma_jalloc(struct msk_if_softc *sc_if) error = bus_dmamap_load(sc_if->msk_cdata.msk_jumbo_rx_ring_tag, sc_if->msk_cdata.msk_jumbo_rx_ring_map, sc_if->msk_rdata.msk_jumbo_rx_ring, MSK_JUMBO_RX_RING_SZ, - msk_dmamap_cb, &ctx, 0); + msk_dmamap_cb, &ctx, BUS_DMA_NOWAIT); if (error != 0) { device_printf(sc_if->msk_if_dev, "failed to load DMA'able memory for jumbo Rx ring\n"); @@ -2781,6 +2829,18 @@ msk_encap(struct msk_if_softc *sc_if, struct mbuf **m_head) } } +#ifdef MSK_64BIT_DMA + if (MSK_ADDR_HI(txsegs[0].ds_addr) != + sc_if->msk_cdata.msk_tx_high_addr) { + sc_if->msk_cdata.msk_tx_high_addr = + MSK_ADDR_HI(txsegs[0].ds_addr); + tx_le = &sc_if->msk_rdata.msk_tx_ring[prod]; + tx_le->msk_addr = htole32(MSK_ADDR_HI(txsegs[0].ds_addr)); + tx_le->msk_control = htole32(OP_ADDR64 | HW_OWNER); + sc_if->msk_cdata.msk_tx_cnt++; + MSK_INC(prod, MSK_TX_RING_CNT); + } +#endif si = prod; tx_le = &sc_if->msk_rdata.msk_tx_ring[prod]; tx_le->msk_addr = htole32(MSK_ADDR_LO(txsegs[0].ds_addr)); @@ -2795,6 +2855,20 @@ msk_encap(struct msk_if_softc *sc_if, struct mbuf **m_head) for (i = 1; i < nseg; i++) { tx_le = &sc_if->msk_rdata.msk_tx_ring[prod]; +#ifdef MSK_64BIT_DMA + if (MSK_ADDR_HI(txsegs[i].ds_addr) != + sc_if->msk_cdata.msk_tx_high_addr) { + sc_if->msk_cdata.msk_tx_high_addr = + MSK_ADDR_HI(txsegs[i].ds_addr); + tx_le = &sc_if->msk_rdata.msk_tx_ring[prod]; + tx_le->msk_addr = + htole32(MSK_ADDR_HI(txsegs[i].ds_addr)); + tx_le->msk_control = htole32(OP_ADDR64 | HW_OWNER); + sc_if->msk_cdata.msk_tx_cnt++; + MSK_INC(prod, MSK_TX_RING_CNT); + tx_le = &sc_if->msk_rdata.msk_tx_ring[prod]; + } +#endif tx_le->msk_addr = htole32(MSK_ADDR_LO(txsegs[i].ds_addr)); tx_le->msk_control = htole32(txsegs[i].ds_len | control | OP_BUFFER | HW_OWNER); @@ -3147,7 +3221,12 @@ msk_rxeof(struct msk_if_softc *sc_if, uint32_t status, uint32_t control, msk_discard_rxbuf(sc_if, cons); break; } +#ifdef MSK_64BIT_DMA + rxd = &sc_if->msk_cdata.msk_rxdesc[(cons + 1) % + MSK_RX_RING_CNT]; +#else rxd = &sc_if->msk_cdata.msk_rxdesc[cons]; +#endif m = rxd->rx_m; if (msk_newbuf(sc_if, cons) != 0) { ifp->if_iqdrops++; @@ -3175,8 +3254,8 @@ msk_rxeof(struct msk_if_softc *sc_if, uint32_t status, uint32_t control, MSK_IF_LOCK(sc_if); } while (0); - MSK_INC(sc_if->msk_cdata.msk_rx_cons, MSK_RX_RING_CNT); - MSK_INC(sc_if->msk_cdata.msk_rx_prod, MSK_RX_RING_CNT); + MSK_RX_INC(sc_if->msk_cdata.msk_rx_cons, MSK_RX_RING_CNT); + MSK_RX_INC(sc_if->msk_cdata.msk_rx_prod, MSK_RX_RING_CNT); } static void @@ -3207,7 +3286,12 @@ msk_jumbo_rxeof(struct msk_if_softc *sc_if, uint32_t status, uint32_t control, msk_discard_jumbo_rxbuf(sc_if, cons); break; } +#ifdef MSK_64BIT_DMA + jrxd = &sc_if->msk_cdata.msk_jumbo_rxdesc[(cons + 1) % + MSK_JUMBO_RX_RING_CNT]; +#else jrxd = &sc_if->msk_cdata.msk_jumbo_rxdesc[cons]; +#endif m = jrxd->rx_m; if (msk_jumbo_newbuf(sc_if, cons) != 0) { ifp->if_iqdrops++; @@ -3235,8 +3319,8 @@ msk_jumbo_rxeof(struct msk_if_softc *sc_if, uint32_t status, uint32_t control, MSK_IF_LOCK(sc_if); } while (0); - MSK_INC(sc_if->msk_cdata.msk_rx_cons, MSK_JUMBO_RX_RING_CNT); - MSK_INC(sc_if->msk_cdata.msk_rx_prod, MSK_JUMBO_RX_RING_CNT); + MSK_RX_INC(sc_if->msk_cdata.msk_rx_cons, MSK_JUMBO_RX_RING_CNT); + MSK_RX_INC(sc_if->msk_cdata.msk_rx_prod, MSK_JUMBO_RX_RING_CNT); } static void @@ -3581,7 +3665,7 @@ msk_handle_events(struct msk_softc *sc) control & STLE_OP_MASK); break; } - MSK_INC(cons, MSK_STAT_RING_CNT); + MSK_INC(cons, sc->msk_stat_count); if (rxprog > sc->msk_process_limit) break; } diff --git a/src/add-ons/kernel/drivers/network/marvell_yukon/dev/msk/if_mskreg.h b/src/add-ons/kernel/drivers/network/marvell_yukon/dev/msk/if_mskreg.h index 75ef99ba9d..3037797bb1 100644 --- a/src/add-ons/kernel/drivers/network/marvell_yukon/dev/msk/if_mskreg.h +++ b/src/add-ons/kernel/drivers/network/marvell_yukon/dev/msk/if_mskreg.h @@ -2315,35 +2315,48 @@ struct msk_stat_desc { #define BMU_UDP_CHECK (0x57<<16) /* Descr with UDP ext (YUKON only) */ #define BMU_BBC 0xffff /* Bit 15.. 0: Buffer Byte Counter */ +/* + * Controller requires an additional LE op code for 64bit DMA operation. + * Driver uses fixed number of RX buffers such that this limitation + * reduces number of available RX buffers with 64bit DMA so double + * number of RX buffers on platforms that support 64bit DMA. For TX + * side, controller requires an additional OP_ADDR64 op code if a TX + * buffer uses different high address value than previously used one. + * Driver monitors high DMA address change in TX and inserts an + * OP_ADDR64 op code if the high DMA address is changed. Driver + * allocates 50% more total TX buffers on platforms that support 64bit + * DMA. + */ +#if (BUS_SPACE_MAXADDR > 0xFFFFFFFF) +#define MSK_64BIT_DMA +#define MSK_TX_RING_CNT 384 +#define MSK_RX_RING_CNT 512 +#else +#undef MSK_64BIT_DMA #define MSK_TX_RING_CNT 256 #define MSK_RX_RING_CNT 256 +#endif #define MSK_RX_BUF_ALIGN 8 #define MSK_JUMBO_RX_RING_CNT MSK_RX_RING_CNT -#define MSK_STAT_RING_CNT ((1 + 3) * (MSK_TX_RING_CNT + MSK_RX_RING_CNT)) #define MSK_MAXTXSEGS 32 #define MSK_TSO_MAXSGSIZE 4096 #define MSK_TSO_MAXSIZE (65535 + sizeof(struct ether_vlan_header)) /* - * It seems that the hardware requires extra decriptors(LEs) to offload - * TCP/UDP checksum, VLAN hardware tag inserstion and TSO. + * It seems that the hardware requires extra descriptors(LEs) to offload + * TCP/UDP checksum, VLAN hardware tag insertion and TSO. * * 1 descriptor for TCP/UDP checksum offload. * 1 descriptor VLAN hardware tag insertion. * 1 descriptor for TSO(TCP Segmentation Offload) - * 1 descriptor for 64bits DMA : Not applicatable due to the use of - * BUS_SPACE_MAXADDR_32BIT in parent DMA tag creation. + * 1 descriptor for each 64bits DMA transfers */ +#ifdef MSK_64BIT_DMA +#define MSK_RESERVED_TX_DESC_CNT (MSK_MAXTXSEGS + 3) +#else #define MSK_RESERVED_TX_DESC_CNT 3 +#endif -/* - * Jumbo buffer stuff. Note that we must allocate more jumbo - * buffers than there are descriptors in the receive ring. This - * is because we don't know how long it will take for a packet - * to be released after we hand it off to the upper protocol - * layers. To be safe, we allocate 1.5 times the number of - * receive descriptors. - */ #define MSK_JUMBO_FRAMELEN 9022 #define MSK_JUMBO_MTU (MSK_JUMBO_FRAMELEN-ETHER_HDR_LEN-ETHER_CRC_LEN) #define MSK_MAX_FRAMELEN \ @@ -2380,6 +2393,7 @@ struct msk_chain_data { bus_dmamap_t msk_jumbo_rx_sparemap; uint16_t msk_tso_mtu; uint32_t msk_last_csum; + uint32_t msk_tx_high_addr; int msk_tx_prod; int msk_tx_cons; int msk_tx_cnt; @@ -2411,10 +2425,17 @@ struct msk_ring_data { (sizeof(struct msk_rx_desc) * MSK_RX_RING_CNT) #define MSK_JUMBO_RX_RING_SZ \ (sizeof(struct msk_rx_desc) * MSK_JUMBO_RX_RING_CNT) -#define MSK_STAT_RING_SZ \ - (sizeof(struct msk_stat_desc) * MSK_STAT_RING_CNT) #define MSK_INC(x, y) (x) = (x + 1) % y +#ifdef MSK_64BIT_DMA +#define MSK_RX_INC(x, y) (x) = (x + 2) % y +#define MSK_RX_BUF_CNT (MSK_RX_RING_CNT / 2) +#define MSK_JUMBO_RX_BUF_CNT (MSK_JUMBO_RX_RING_CNT / 2) +#else +#define MSK_RX_INC(x, y) (x) = (x + 1) % y +#define MSK_RX_BUF_CNT MSK_RX_RING_CNT +#define MSK_JUMBO_RX_BUF_CNT MSK_JUMBO_RX_RING_CNT +#endif #define MSK_PCI_BUS 0 #define MSK_PCIX_BUS 1 @@ -2519,6 +2540,7 @@ struct msk_softc { int msk_int_holdoff; int msk_process_limit; int msk_stat_cons; + int msk_stat_count; struct mtx msk_mtx; #ifdef __HAIKU__ uint32_t haiku_interrupt_status; diff --git a/src/add-ons/kernel/drivers/network/nforce/dev/mii/ciphy.c b/src/add-ons/kernel/drivers/network/nforce/dev/mii/ciphy.c index 2133c76ca0..87d0d814e9 100644 --- a/src/add-ons/kernel/drivers/network/nforce/dev/mii/ciphy.c +++ b/src/add-ons/kernel/drivers/network/nforce/dev/mii/ciphy.c @@ -67,7 +67,7 @@ static device_method_t ciphy_methods[] = { DEVMETHOD(device_attach, ciphy_attach), DEVMETHOD(device_detach, mii_phy_detach), DEVMETHOD(device_shutdown, bus_generic_shutdown), - { 0, 0 } + DEVMETHOD_END }; static devclass_t ciphy_devclass; diff --git a/src/add-ons/kernel/drivers/network/nforce/dev/mii/ukphy.c b/src/add-ons/kernel/drivers/network/nforce/dev/mii/ukphy.c index 4ecfce29d3..9d52eb580c 100644 --- a/src/add-ons/kernel/drivers/network/nforce/dev/mii/ukphy.c +++ b/src/add-ons/kernel/drivers/network/nforce/dev/mii/ukphy.c @@ -55,7 +55,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/mii/ukphy.c,v 1.20.10.6.2.1 2010/12/21 17:09:25 kensmith Exp $"); +__FBSDID("$FreeBSD$"); /* * driver for generic unknown PHYs @@ -86,7 +86,7 @@ static device_method_t ukphy_methods[] = { DEVMETHOD(device_attach, ukphy_attach), DEVMETHOD(device_detach, mii_phy_detach), DEVMETHOD(device_shutdown, bus_generic_shutdown), - { 0, 0 } + DEVMETHOD_END }; static devclass_t ukphy_devclass; diff --git a/src/add-ons/kernel/drivers/network/nforce/dev/mii/ukphy_subr.c b/src/add-ons/kernel/drivers/network/nforce/dev/mii/ukphy_subr.c index 73007e197b..5f2f6341ba 100644 --- a/src/add-ons/kernel/drivers/network/nforce/dev/mii/ukphy_subr.c +++ b/src/add-ons/kernel/drivers/network/nforce/dev/mii/ukphy_subr.c @@ -31,7 +31,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/mii/ukphy_subr.c,v 1.10.2.4.2.1 2010/12/21 17:09:25 kensmith Exp $"); +__FBSDID("$FreeBSD$"); /* * Subroutines shared by the ukphy driver and other PHY drivers. diff --git a/src/add-ons/kernel/drivers/network/nforce/dev/nfe/if_nfe.c b/src/add-ons/kernel/drivers/network/nforce/dev/nfe/if_nfe.c index 28a3c0149f..f4c5bed419 100644 --- a/src/add-ons/kernel/drivers/network/nforce/dev/nfe/if_nfe.c +++ b/src/add-ons/kernel/drivers/network/nforce/dev/nfe/if_nfe.c @@ -165,16 +165,12 @@ static device_method_t nfe_methods[] = { DEVMETHOD(device_resume, nfe_resume), DEVMETHOD(device_shutdown, nfe_shutdown), - /* bus interface */ - DEVMETHOD(bus_print_child, bus_generic_print_child), - DEVMETHOD(bus_driver_added, bus_generic_driver_added), - /* MII interface */ DEVMETHOD(miibus_readreg, nfe_miibus_readreg), DEVMETHOD(miibus_writereg, nfe_miibus_writereg), DEVMETHOD(miibus_statchg, nfe_miibus_statchg), - { NULL, NULL } + DEVMETHOD_END }; static driver_t nfe_driver = { @@ -2952,10 +2948,10 @@ nfe_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr) NFE_LOCK(sc); mii = device_get_softc(sc->nfe_miibus); mii_pollstat(mii); - NFE_UNLOCK(sc); ifmr->ifm_active = mii->mii_media_active; ifmr->ifm_status = mii->mii_media_status; + NFE_UNLOCK(sc); } diff --git a/src/add-ons/kernel/drivers/network/pcnet/dev/le/am7990.c b/src/add-ons/kernel/drivers/network/pcnet/dev/le/am7990.c index a3fe239889..56a07d5330 100644 --- a/src/add-ons/kernel/drivers/network/pcnet/dev/le/am7990.c +++ b/src/add-ons/kernel/drivers/network/pcnet/dev/le/am7990.c @@ -72,7 +72,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/le/am7990.c,v 1.1.2.3 2006/06/18 15:43:18 marius Exp $"); +__FBSDID("$FreeBSD$"); #include #include @@ -385,7 +385,7 @@ am7990_tint(struct lance_softc *sc) sc->sc_first_td = bix; - ifp->if_timer = sc->sc_no_td > 0 ? 5 : 0; + sc->sc_wdog_timer = sc->sc_no_td > 0 ? 5 : 0; } /* @@ -421,10 +421,9 @@ am7990_intr(void *arg) * Clear interrupt source flags and turn off interrupts. If we * don't clear these flags before processing their sources we * could completely miss some interrupt events as the NIC can - * change these flags while we're in this handler. We turn off - * interrupts so we don't get another RX interrupt while still - * processing the previous one in ifp->if_input() with the - * driver lock dropped. + * change these flags while we're in this handler. We toggle + * the interrupt enable bit in order to keep receiving them + * (some chips work without this, some don't). */ (*sc->sc_wrcsr)(sc, LE_CSR0, isr & ~(LE_C0_INEA | LE_C0_TDMD | LE_C0_STOP | LE_C0_STRT | LE_C0_INIT)); @@ -575,7 +574,7 @@ am7990_start_locked(struct lance_softc *sc) sc->sc_last_td = bix; if (enq > 0) - ifp->if_timer = 5; + sc->sc_wdog_timer = 5; } #ifdef LEDEBUG diff --git a/src/add-ons/kernel/drivers/network/pcnet/dev/le/am79900.c b/src/add-ons/kernel/drivers/network/pcnet/dev/le/am79900.c index 4c0ff2fdc6..a86590ba5f 100644 --- a/src/add-ons/kernel/drivers/network/pcnet/dev/le/am79900.c +++ b/src/add-ons/kernel/drivers/network/pcnet/dev/le/am79900.c @@ -110,7 +110,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/le/am79900.c,v 1.1.2.3 2006/06/18 15:43:18 marius Exp $"); +__FBSDID("$FreeBSD$"); #include #include @@ -172,8 +172,6 @@ am79900_config(struct am79900_softc *sc, const char* name, int unit) if (mem > sc->lsc.sc_memsize) panic("%s: memsize", __func__); - sc->lsc.sc_flags |= LE_DEBUG; - lance_attach(&sc->lsc); return (0); @@ -425,7 +423,7 @@ am79900_tint(struct lance_softc *sc) sc->sc_first_td = bix; - ifp->if_timer = sc->sc_no_td > 0 ? 5 : 0; + sc->sc_wdog_timer = sc->sc_no_td > 0 ? 5 : 0; } /* @@ -447,9 +445,9 @@ am79900_intr(void *arg) return; } -#if 0 +#ifndef __HAIKU__ isr = (*sc->sc_rdcsr)(sc, LE_CSR0); -#endif +#else { HAIKU_INTR_REGISTER_STATE; HAIKU_INTR_REGISTER_ENTER(); @@ -457,7 +455,7 @@ am79900_intr(void *arg) sc->sc_lastisr = 0; HAIKU_INTR_REGISTER_LEAVE(); } - +#endif #if defined(LEDEBUG) && LEDEBUG > 1 if (sc->sc_flags & LE_DEBUG) if_printf(ifp, "%s: entering with isr=%04x\n", __func__, isr); @@ -471,10 +469,9 @@ am79900_intr(void *arg) * Clear interrupt source flags and turn off interrupts. If we * don't clear these flags before processing their sources we * could completely miss some interrupt events as the NIC can - * change these flags while we're in this handler. We turn off - * interrupts so we don't get another RX interrupt while still - * processing the previous one in ifp->if_input() with the - * driver lock dropped. + * change these flags while we're in this handler. We toggle + * the interrupt enable bit in order to keep receiving them + * (some chips work without this, some don't). */ (*sc->sc_wrcsr)(sc, LE_CSR0, isr & ~(LE_C0_INEA | LE_C0_TDMD | LE_C0_STOP | LE_C0_STRT | LE_C0_INIT)); @@ -626,7 +623,7 @@ am79900_start_locked(struct lance_softc *sc) sc->sc_last_td = bix; if (enq > 0) - ifp->if_timer = 5; + sc->sc_wdog_timer = 5; } #ifdef LEDEBUG diff --git a/src/add-ons/kernel/drivers/network/pcnet/dev/le/am79900reg.h b/src/add-ons/kernel/drivers/network/pcnet/dev/le/am79900reg.h index 0212bbd6dd..33610645d3 100644 --- a/src/add-ons/kernel/drivers/network/pcnet/dev/le/am79900reg.h +++ b/src/add-ons/kernel/drivers/network/pcnet/dev/le/am79900reg.h @@ -70,7 +70,7 @@ * @(#)if_lereg.h 8.1 (Berkeley) 6/10/93 */ -/* $FreeBSD: src/sys/dev/le/am79900reg.h,v 1.1.2.1 2006/02/13 11:30:40 marius Exp $ */ +/* $FreeBSD$ */ #ifndef _DEV_LE_AM79900REG_H_ #define _DEV_LE_AM79900REG_H_ diff --git a/src/add-ons/kernel/drivers/network/pcnet/dev/le/am79900var.h b/src/add-ons/kernel/drivers/network/pcnet/dev/le/am79900var.h index 39e6acb0b2..79ab3309e1 100644 --- a/src/add-ons/kernel/drivers/network/pcnet/dev/le/am79900var.h +++ b/src/add-ons/kernel/drivers/network/pcnet/dev/le/am79900var.h @@ -16,13 +16,6 @@ * 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. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the NetBSD - * Foundation, Inc. and its contributors. - * 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED @@ -37,7 +30,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ -/* $FreeBSD: src/sys/dev/le/am79900var.h,v 1.1.2.1 2006/02/13 11:30:40 marius Exp $ */ +/* $FreeBSD$ */ #ifndef _DEV_LE_AM79900VAR_H_ #define _DEV_LE_AM79900VAR_H_ diff --git a/src/add-ons/kernel/drivers/network/pcnet/dev/le/am7990reg.h b/src/add-ons/kernel/drivers/network/pcnet/dev/le/am7990reg.h index 60af47c614..d3f8e0d3d9 100644 --- a/src/add-ons/kernel/drivers/network/pcnet/dev/le/am7990reg.h +++ b/src/add-ons/kernel/drivers/network/pcnet/dev/le/am7990reg.h @@ -70,7 +70,7 @@ * @(#)if_lereg.h 8.1 (Berkeley) 6/10/93 */ -/* $FreeBSD: src/sys/dev/le/am7990reg.h,v 1.1.2.1 2006/02/13 11:30:40 marius Exp $ */ +/* $FreeBSD$ */ #ifndef _DEV_LE_AM7990REG_H_ #define _DEV_LE_AM7990REG_H_ diff --git a/src/add-ons/kernel/drivers/network/pcnet/dev/le/am7990var.h b/src/add-ons/kernel/drivers/network/pcnet/dev/le/am7990var.h index 014c031628..24cbfe05af 100644 --- a/src/add-ons/kernel/drivers/network/pcnet/dev/le/am7990var.h +++ b/src/add-ons/kernel/drivers/network/pcnet/dev/le/am7990var.h @@ -16,13 +16,6 @@ * 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. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the NetBSD - * Foundation, Inc. and its contributors. - * 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED @@ -37,7 +30,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ -/* $FreeBSD: src/sys/dev/le/am7990var.h,v 1.1.2.1 2006/02/13 11:30:40 marius Exp $ */ +/* $FreeBSD$ */ #ifndef _DEV_LE_AM7990VAR_H_ #define _DEV_LE_AM7990VAR_H_ diff --git a/src/add-ons/kernel/drivers/network/pcnet/dev/le/glue.c b/src/add-ons/kernel/drivers/network/pcnet/dev/le/glue.c index e9ffe1faef..50cac121c5 100644 --- a/src/add-ons/kernel/drivers/network/pcnet/dev/le/glue.c +++ b/src/add-ons/kernel/drivers/network/pcnet/dev/le/glue.c @@ -1,5 +1,6 @@ #include #include +#include #include #include @@ -24,12 +25,8 @@ NO_HAIKU_REENABLE_INTERRUPTS(); struct le_pci_softc { struct am79900_softc sc_am79900; /* glue to MI code */ - int sc_rrid; struct resource *sc_rres; - bus_space_tag_t sc_regt; - bus_space_handle_t sc_regh; - int sc_irid; struct resource *sc_ires; void *sc_ih; @@ -41,28 +38,29 @@ struct le_pci_softc { int HAIKU_CHECK_DISABLE_INTERRUPTS(device_t dev) { struct le_pci_softc *lesc = (struct le_pci_softc *)device_get_softc(dev); HAIKU_INTR_REGISTER_STATE; - uint16_t value; + uint16_t isr; HAIKU_INTR_REGISTER_ENTER(); /* get current flags */ - bus_space_write_2(lesc->sc_regt, lesc->sc_regh, PCNET_PCI_RAP, LE_CSR0); - bus_space_barrier(lesc->sc_regt, lesc->sc_regh, PCNET_PCI_RAP, 2, - BUS_SPACE_BARRIER_WRITE); - value = bus_space_read_2(lesc->sc_regt, lesc->sc_regh, PCNET_PCI_RDP); + bus_write_2(lesc->sc_rres, PCNET_PCI_RAP, LE_CSR0); + bus_barrier(lesc->sc_rres, PCNET_PCI_RAP, 2, BUS_SPACE_BARRIER_WRITE); + isr = (bus_read_2(lesc->sc_rres, PCNET_PCI_RDP)); /* is there a pending interrupt? */ - if (value & LE_C0_INTR) { - /* set the new flags, disable interrupts */ - bus_space_write_2(lesc->sc_regt, lesc->sc_regh, PCNET_PCI_RAP, LE_CSR0); - bus_space_barrier(lesc->sc_regt, lesc->sc_regh, PCNET_PCI_RAP, 2, - BUS_SPACE_BARRIER_WRITE); - bus_space_write_2(lesc->sc_regt, lesc->sc_regh, PCNET_PCI_RDP, - value & ~LE_C0_INEA); - lesc->sc_am79900.lsc.sc_lastisr |= value; + if ((isr & LE_C0_INTR) == 0) { + HAIKU_INTR_REGISTER_LEAVE(); + return 0; } + /* set the new flags, disable interrupts */ + bus_write_2(lesc->sc_rres, PCNET_PCI_RAP, LE_CSR0); + bus_barrier(lesc->sc_rres, PCNET_PCI_RAP, 2, BUS_SPACE_BARRIER_WRITE); + bus_write_2(lesc->sc_rres, PCNET_PCI_RDP, isr & ~(LE_C0_INEA)); + + lesc->sc_am79900.lsc.sc_lastisr |= isr; + HAIKU_INTR_REGISTER_LEAVE(); - return value & LE_C0_INTR; + return 1; } diff --git a/src/add-ons/kernel/drivers/network/pcnet/dev/le/if_le_ledma.c b/src/add-ons/kernel/drivers/network/pcnet/dev/le/if_le_ledma.c index e7cbc9a6f1..7b09366ec7 100644 --- a/src/add-ons/kernel/drivers/network/pcnet/dev/le/if_le_ledma.c +++ b/src/add-ons/kernel/drivers/network/pcnet/dev/le/if_le_ledma.c @@ -16,13 +16,6 @@ * 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. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the NetBSD - * Foundation, Inc. and its contributors. - * 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED @@ -38,7 +31,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/le/if_le_ledma.c,v 1.1.2.2 2006/06/18 15:43:18 marius Exp $"); +__FBSDID("$FreeBSD$"); #include #include @@ -78,12 +71,8 @@ __FBSDID("$FreeBSD: src/sys/dev/le/if_le_ledma.c,v 1.1.2.2 2006/06/18 15:43:18 m struct le_dma_softc { struct am7990_softc sc_am7990; /* glue to MI code */ - int sc_rrid; struct resource *sc_rres; - bus_space_tag_t sc_regt; - bus_space_handle_t sc_regh; - int sc_irid; struct resource *sc_ires; void *sc_ih; @@ -92,7 +81,6 @@ struct le_dma_softc { bus_addr_t sc_laddr; /* LANCE DMA address */ struct lsi64854_softc *sc_dma; /* pointer to DMA engine */ - int sc_dodrain; }; static device_probe_t le_dma_probe; @@ -116,6 +104,7 @@ static device_method_t le_dma_methods[] = { DEFINE_CLASS_0(le, le_dma_driver, le_dma_methods, sizeof(struct le_dma_softc)); DRIVER_MODULE(le, dma, le_dma_driver, le_devclass, 0, 0); +MODULE_DEPEND(le, dma, 1, 1, 1); MODULE_DEPEND(le, ether, 1, 1, 1); /* @@ -143,10 +132,9 @@ le_dma_wrcsr(struct lance_softc *sc, uint16_t port, uint16_t val) { struct le_dma_softc *lesc = (struct le_dma_softc *)sc; - bus_space_write_2(lesc->sc_regt, lesc->sc_regh, LEREG1_RAP, port); - bus_space_barrier(lesc->sc_regt, lesc->sc_regh, LEREG1_RAP, 2, - BUS_SPACE_BARRIER_WRITE); - bus_space_write_2(lesc->sc_regt, lesc->sc_regh, LEREG1_RDP, val); + bus_write_2(lesc->sc_rres, LEREG1_RAP, port); + bus_barrier(lesc->sc_rres, LEREG1_RAP, 2, BUS_SPACE_BARRIER_WRITE); + bus_write_2(lesc->sc_rres, LEREG1_RDP, val); } static uint16_t @@ -154,10 +142,9 @@ le_dma_rdcsr(struct lance_softc *sc, uint16_t port) { struct le_dma_softc *lesc = (struct le_dma_softc *)sc; - bus_space_write_2(lesc->sc_regt, lesc->sc_regh, LEREG1_RAP, port); - bus_space_barrier(lesc->sc_regt, lesc->sc_regh, LEREG1_RAP, 2, - BUS_SPACE_BARRIER_WRITE); - return (bus_space_read_2(lesc->sc_regt, lesc->sc_regh, LEREG1_RDP)); + bus_write_2(lesc->sc_rres, LEREG1_RAP, port); + bus_barrier(lesc->sc_rres, LEREG1_RAP, 2, BUS_SPACE_BARRIER_WRITE); + return (bus_read_2(lesc->sc_rres, LEREG1_RDP)); } static void @@ -239,7 +226,7 @@ le_dma_hwreset(struct lance_softc *sc) DMA_RESET(dma); /* Write bits 24-31 of Lance address. */ - bus_space_write_4(dma->sc_regt, dma->sc_regh, L64854_REG_ENBAR, + bus_write_4(dma->sc_res, L64854_REG_ENBAR, lesc->sc_laddr & 0xff000000); DMA_ENINTR(dma); @@ -260,46 +247,7 @@ le_dma_hwintr(struct lance_softc *sc) struct le_dma_softc *lesc = (struct le_dma_softc *)sc; struct lsi64854_softc *dma = lesc->sc_dma; -#if 0 return (DMA_INTR(dma)); -#else - /* - * Inlined version of lsi64854_enet_intr() from rev. 1.8 of - * sys/sparc64/sbus/lsi64854.c in order to not break the API - * of the LSI64854 driver in RELENG_6. - */ - uint32_t csr; - int i, rv; - - csr = L64854_GCSR(dma); - - /* If the DMA logic shows an interrupt, claim it */ - rv = ((csr & E_INT_PEND) != 0) ? 1 : 0; - - if (csr & (E_ERR_PEND|E_SLAVE_ERR)) { - device_printf(dma->sc_dev, "error: csr=%b\n", csr, - EDMACSR_BITS); - csr &= ~L64854_EN_DMA; /* Stop DMA */ - /* Invalidate the queue; SLAVE_ERR bit is write-to-clear */ - csr |= E_INVALIDATE|E_SLAVE_ERR; - L64854_SCSR(dma, csr); - /* Will be drained with the LE_C0_IDON interrupt. */ - lesc->sc_dodrain = 1; - return (-1); - } - - /* XXX - is this necessary with E_DSBL_WR_INVAL on? */ - if (lesc->sc_dodrain) { - i = 10; - csr |= E_DRAIN; - L64854_SCSR(dma, csr); - while (i-- > 0 && (L64854_GCSR(dma) & E_DRAINING)) - DELAY(1); - lesc->sc_dodrain = 0; - } - - return (rv); -#endif } static void @@ -359,7 +307,7 @@ le_dma_attach(device_t dev) struct le_dma_softc *lesc; struct lsi64854_softc *dma; struct lance_softc *sc; - int error; + int error, i; lesc = device_get_softc(dev); sc = &lesc->sc_am7990.lsc; @@ -374,25 +322,30 @@ le_dma_attach(device_t dev) lesc->sc_dma = dma; lesc->sc_dma->sc_client = lesc; - lesc->sc_rrid = 0; + i = 0; lesc->sc_rres = bus_alloc_resource_any(dev, SYS_RES_MEMORY, - &lesc->sc_rrid, RF_ACTIVE); + &i, RF_ACTIVE); if (lesc->sc_rres == NULL) { device_printf(dev, "cannot allocate registers\n"); error = ENXIO; goto fail_mtx; } - lesc->sc_regt = rman_get_bustag(lesc->sc_rres); - lesc->sc_regh = rman_get_bushandle(lesc->sc_rres); - lesc->sc_irid = 0; + i = 0; if ((lesc->sc_ires = bus_alloc_resource_any(dev, SYS_RES_IRQ, - &lesc->sc_irid, RF_SHAREABLE | RF_ACTIVE)) == NULL) { + &i, RF_SHAREABLE | RF_ACTIVE)) == NULL) { device_printf(dev, "cannot allocate interrupt\n"); error = ENXIO; goto fail_rres; } + /* Attach the DMA engine. */ + error = lsi64854_attach(dma); + if (error != 0) { + device_printf(dev, "lsi64854_attach failed\n"); + goto fail_ires; + } + sc->sc_memsize = LEDMA_MEMSIZE; error = bus_dma_tag_create( dma->sc_parent_dmat, /* parent */ @@ -404,12 +357,12 @@ le_dma_attach(device_t dev) sc->sc_memsize, /* maxsize */ 1, /* nsegments */ sc->sc_memsize, /* maxsegsize */ - BUS_DMA_WAITOK, /* flags */ + 0, /* flags */ NULL, NULL, /* lockfunc, lockarg */ &lesc->sc_dmat); if (error != 0) { device_printf(dev, "cannot allocate buffer DMA tag\n"); - goto fail_ires; + goto fail_lsi; } error = bus_dmamem_alloc(lesc->sc_dmat, (void **)&sc->sc_mem, @@ -423,7 +376,7 @@ le_dma_attach(device_t dev) error = bus_dmamap_load(lesc->sc_dmat, lesc->sc_dmam, sc->sc_mem, sc->sc_memsize, le_dma_dma_callback, lesc, 0); if (error != 0 || lesc->sc_laddr == 0) { - device_printf(dev, "cannot load DMA buffer map\n"); + device_printf(dev, "cannot load DMA buffer map\n"); goto fail_dmem; } @@ -459,7 +412,7 @@ le_dma_attach(device_t dev) } error = bus_setup_intr(dev, lesc->sc_ires, INTR_TYPE_NET | INTR_MPSAFE, - am7990_intr, sc, &lesc->sc_ih); + NULL, am7990_intr, sc, &lesc->sc_ih); if (error != 0) { device_printf(dev, "cannot set up interrupt\n"); goto fail_am7990; @@ -475,10 +428,14 @@ le_dma_attach(device_t dev) bus_dmamem_free(lesc->sc_dmat, sc->sc_mem, lesc->sc_dmam); fail_dtag: bus_dma_tag_destroy(lesc->sc_dmat); + fail_lsi: + lsi64854_detach(dma); fail_ires: - bus_release_resource(dev, SYS_RES_IRQ, lesc->sc_irid, lesc->sc_ires); + bus_release_resource(dev, SYS_RES_IRQ, rman_get_rid(lesc->sc_ires), + lesc->sc_ires); fail_rres: - bus_release_resource(dev, SYS_RES_MEMORY, lesc->sc_rrid, lesc->sc_rres); + bus_release_resource(dev, SYS_RES_MEMORY, rman_get_rid(lesc->sc_rres), + lesc->sc_rres); fail_mtx: LE_LOCK_DESTROY(sc); return (error); @@ -489,6 +446,7 @@ le_dma_detach(device_t dev) { struct le_dma_softc *lesc; struct lance_softc *sc; + int error; lesc = device_get_softc(dev); sc = &lesc->sc_am7990.lsc; @@ -498,8 +456,13 @@ le_dma_detach(device_t dev) bus_dmamap_unload(lesc->sc_dmat, lesc->sc_dmam); bus_dmamem_free(lesc->sc_dmat, sc->sc_mem, lesc->sc_dmam); bus_dma_tag_destroy(lesc->sc_dmat); - bus_release_resource(dev, SYS_RES_IRQ, lesc->sc_irid, lesc->sc_ires); - bus_release_resource(dev, SYS_RES_MEMORY, lesc->sc_rrid, lesc->sc_rres); + error = lsi64854_detach(lesc->sc_dma); + if (error != 0) + return (error); + bus_release_resource(dev, SYS_RES_IRQ, rman_get_rid(lesc->sc_ires), + lesc->sc_ires); + bus_release_resource(dev, SYS_RES_MEMORY, rman_get_rid(lesc->sc_rres), + lesc->sc_rres); LE_LOCK_DESTROY(sc); return (0); diff --git a/src/add-ons/kernel/drivers/network/pcnet/dev/le/if_le_pci.c b/src/add-ons/kernel/drivers/network/pcnet/dev/le/if_le_pci.c index 672e12a601..b989fe0065 100644 --- a/src/add-ons/kernel/drivers/network/pcnet/dev/le/if_le_pci.c +++ b/src/add-ons/kernel/drivers/network/pcnet/dev/le/if_le_pci.c @@ -72,7 +72,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/le/if_le_pci.c,v 1.1.2.2 2006/06/18 15:43:18 marius Exp $"); +__FBSDID("$FreeBSD$"); #include #include @@ -111,12 +111,8 @@ __FBSDID("$FreeBSD: src/sys/dev/le/if_le_pci.c,v 1.1.2.2 2006/06/18 15:43:18 mar struct le_pci_softc { struct am79900_softc sc_am79900; /* glue to MI code */ - int sc_rrid; struct resource *sc_rres; - bus_space_tag_t sc_regt; - bus_space_handle_t sc_regh; - int sc_irid; struct resource *sc_ires; void *sc_ih; @@ -174,10 +170,9 @@ le_pci_wrbcr(struct lance_softc *sc, uint16_t port, uint16_t val) { struct le_pci_softc *lesc = (struct le_pci_softc *)sc; - bus_space_write_2(lesc->sc_regt, lesc->sc_regh, PCNET_PCI_RAP, port); - bus_space_barrier(lesc->sc_regt, lesc->sc_regh, PCNET_PCI_RAP, 2, - BUS_SPACE_BARRIER_WRITE); - bus_space_write_2(lesc->sc_regt, lesc->sc_regh, PCNET_PCI_BDP, val); + bus_write_2(lesc->sc_rres, PCNET_PCI_RAP, port); + bus_barrier(lesc->sc_rres, PCNET_PCI_RAP, 2, BUS_SPACE_BARRIER_WRITE); + bus_write_2(lesc->sc_rres, PCNET_PCI_BDP, val); } static uint16_t @@ -185,45 +180,51 @@ le_pci_rdbcr(struct lance_softc *sc, uint16_t port) { struct le_pci_softc *lesc = (struct le_pci_softc *)sc; - bus_space_write_2(lesc->sc_regt, lesc->sc_regh, PCNET_PCI_RAP, port); - bus_space_barrier(lesc->sc_regt, lesc->sc_regh, PCNET_PCI_RAP, 2, - BUS_SPACE_BARRIER_WRITE); - return (bus_space_read_2(lesc->sc_regt, lesc->sc_regh, PCNET_PCI_BDP)); + bus_write_2(lesc->sc_rres, PCNET_PCI_RAP, port); + bus_barrier(lesc->sc_rres, PCNET_PCI_RAP, 2, BUS_SPACE_BARRIER_WRITE); + return (bus_read_2(lesc->sc_rres, PCNET_PCI_BDP)); } static void le_pci_wrcsr(struct lance_softc *sc, uint16_t port, uint16_t val) { struct le_pci_softc *lesc = (struct le_pci_softc *)sc; - HAIKU_INTR_REGISTER_STATE; +#ifdef __HAIKU__ + HAIKU_INTR_REGISTER_STATE; if (port == LE_CSR0) HAIKU_INTR_REGISTER_ENTER(); - bus_space_write_2(lesc->sc_regt, lesc->sc_regh, PCNET_PCI_RAP, port); - bus_space_barrier(lesc->sc_regt, lesc->sc_regh, PCNET_PCI_RAP, 2, - BUS_SPACE_BARRIER_WRITE); - bus_space_write_2(lesc->sc_regt, lesc->sc_regh, PCNET_PCI_RDP, val); +#endif + bus_write_2(lesc->sc_rres, PCNET_PCI_RAP, port); + bus_barrier(lesc->sc_rres, PCNET_PCI_RAP, 2, BUS_SPACE_BARRIER_WRITE); + bus_write_2(lesc->sc_rres, PCNET_PCI_RDP, val); +#ifdef __HAIKU__ if (port == LE_CSR0) HAIKU_INTR_REGISTER_LEAVE(); +#endif } static uint16_t le_pci_rdcsr(struct lance_softc *sc, uint16_t port) { struct le_pci_softc *lesc = (struct le_pci_softc *)sc; + +#ifdef __HAIKU__ HAIKU_INTR_REGISTER_STATE; uint16_t value; - if (port == LE_CSR0) HAIKU_INTR_REGISTER_ENTER(); - bus_space_write_2(lesc->sc_regt, lesc->sc_regh, PCNET_PCI_RAP, port); - bus_space_barrier(lesc->sc_regt, lesc->sc_regh, PCNET_PCI_RAP, 2, - BUS_SPACE_BARRIER_WRITE); - value = bus_space_read_2(lesc->sc_regt, lesc->sc_regh, PCNET_PCI_RDP); +#endif + bus_write_2(lesc->sc_rres, PCNET_PCI_RAP, port); + bus_barrier(lesc->sc_rres, PCNET_PCI_RAP, 2, BUS_SPACE_BARRIER_WRITE); +#ifndef __HAIKU__ + return (bus_read_2(lesc->sc_rres, PCNET_PCI_RDP)); +#else + value = bus_read_2(lesc->sc_rres, PCNET_PCI_RDP); if (port == LE_CSR0) HAIKU_INTR_REGISTER_LEAVE(); - return value; +#endif } static int @@ -309,11 +310,11 @@ le_pci_probe(device_t dev) switch (pci_get_device(dev)) { case AMD_PCNET_PCI: device_set_desc(dev, "AMD PCnet-PCI"); - /* Let lnc(4) and pcn(4) win. */ + /* Let pcn(4) win. */ return (BUS_PROBE_LOW_PRIORITY); case AMD_PCNET_HOME: device_set_desc(dev, "AMD PCnet-Home"); - /* Let lnc(4) and pcn(4) win. */ + /* Let pcn(4) win. */ return (BUS_PROBE_LOW_PRIORITY); default: return (ENXIO); @@ -333,29 +334,26 @@ le_pci_attach(device_t dev) LE_LOCK_INIT(sc, device_get_nameunit(dev)); pci_enable_busmaster(dev); - pci_enable_io(dev, PCIM_CMD_PORTEN); - lesc->sc_rrid = PCIR_BAR(0); + i = PCIR_BAR(0); lesc->sc_rres = bus_alloc_resource_any(dev, SYS_RES_IOPORT, - &lesc->sc_rrid, RF_ACTIVE); + &i, RF_ACTIVE); if (lesc->sc_rres == NULL) { device_printf(dev, "cannot allocate registers\n"); error = ENXIO; goto fail_mtx; } - lesc->sc_regt = rman_get_bustag(lesc->sc_rres); - lesc->sc_regh = rman_get_bushandle(lesc->sc_rres); - lesc->sc_irid = 0; + i = 0; if ((lesc->sc_ires = bus_alloc_resource_any(dev, SYS_RES_IRQ, - &lesc->sc_irid, RF_SHAREABLE | RF_ACTIVE)) == NULL) { + &i, RF_SHAREABLE | RF_ACTIVE)) == NULL) { device_printf(dev, "cannot allocate interrupt\n"); error = ENXIO; goto fail_rres; } error = bus_dma_tag_create( - NULL, /* parent */ + bus_get_dma_tag(dev), /* parent */ 1, 0, /* alignment, boundary */ BUS_SPACE_MAXADDR_32BIT, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ @@ -363,7 +361,7 @@ le_pci_attach(device_t dev) BUS_SPACE_MAXSIZE_32BIT, /* maxsize */ 0, /* nsegments */ BUS_SPACE_MAXSIZE_32BIT, /* maxsegsize */ - BUS_DMA_WAITOK, /* flags */ + 0, /* flags */ NULL, NULL, /* lockfunc, lockarg */ &lesc->sc_pdmat); if (error != 0) { @@ -386,7 +384,7 @@ le_pci_attach(device_t dev) sc->sc_memsize, /* maxsize */ 1, /* nsegments */ sc->sc_memsize, /* maxsegsize */ - BUS_DMA_WAITOK, /* flags */ + 0, /* flags */ NULL, NULL, /* lockfunc, lockarg */ &lesc->sc_dmat); if (error != 0) { @@ -405,7 +403,7 @@ le_pci_attach(device_t dev) error = bus_dmamap_load(lesc->sc_dmat, lesc->sc_dmam, sc->sc_mem, sc->sc_memsize, le_pci_dma_callback, sc, 0); if (error != 0 || sc->sc_addr == 0) { - device_printf(dev, "cannot load DMA buffer map\n"); + device_printf(dev, "cannot load DMA buffer map\n"); goto fail_dmem; } @@ -430,9 +428,8 @@ le_pci_attach(device_t dev) /* * Extract the physical MAC address from the ROM. */ - for (i = 0; i < sizeof(sc->sc_enaddr); i++) - sc->sc_enaddr[i] = - bus_space_read_1(lesc->sc_regt, lesc->sc_regh, i); + bus_read_region_1(lesc->sc_rres, 0, sc->sc_enaddr, + sizeof(sc->sc_enaddr)); sc->sc_copytodesc = lance_copytobuf_contig; sc->sc_copyfromdesc = lance_copyfrombuf_contig; @@ -474,9 +471,11 @@ le_pci_attach(device_t dev) fail_pdtag: bus_dma_tag_destroy(lesc->sc_pdmat); fail_ires: - bus_release_resource(dev, SYS_RES_IRQ, lesc->sc_irid, lesc->sc_ires); + bus_release_resource(dev, SYS_RES_IRQ, + rman_get_rid(lesc->sc_ires), lesc->sc_ires); fail_rres: - bus_release_resource(dev, SYS_RES_IOPORT, lesc->sc_rrid, lesc->sc_rres); + bus_release_resource(dev, SYS_RES_IOPORT, + rman_get_rid(lesc->sc_rres), lesc->sc_rres); fail_mtx: LE_LOCK_DESTROY(sc); return (error); @@ -497,8 +496,10 @@ le_pci_detach(device_t dev) bus_dmamem_free(lesc->sc_dmat, sc->sc_mem, lesc->sc_dmam); bus_dma_tag_destroy(lesc->sc_dmat); bus_dma_tag_destroy(lesc->sc_pdmat); - bus_release_resource(dev, SYS_RES_IRQ, lesc->sc_irid, lesc->sc_ires); - bus_release_resource(dev, SYS_RES_IOPORT, lesc->sc_rrid, lesc->sc_rres); + bus_release_resource(dev, SYS_RES_IRQ, + rman_get_rid(lesc->sc_ires), lesc->sc_ires); + bus_release_resource(dev, SYS_RES_IOPORT, + rman_get_rid(lesc->sc_rres), lesc->sc_rres); LE_LOCK_DESTROY(sc); return (0); diff --git a/src/add-ons/kernel/drivers/network/pcnet/dev/le/lance.c b/src/add-ons/kernel/drivers/network/pcnet/dev/le/lance.c index 285196bfe0..8700aa2cd4 100644 --- a/src/add-ons/kernel/drivers/network/pcnet/dev/le/lance.c +++ b/src/add-ons/kernel/drivers/network/pcnet/dev/le/lance.c @@ -72,12 +72,13 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/le/lance.c,v 1.1.2.2 2006/06/18 15:43:18 marius Exp $"); +__FBSDID("$FreeBSD$"); #include #include #include #include +#include #include #include #include @@ -101,7 +102,7 @@ devclass_t le_devclass; static void lance_start(struct ifnet *); static void lance_stop(struct lance_softc *); static void lance_init(void *); -static void lance_watchdog(struct ifnet *); +static void lance_watchdog(void *s); static int lance_mediachange(struct ifnet *); static void lance_mediastatus(struct ifnet *, struct ifmediareq *); static int lance_ioctl(struct ifnet *, u_long, caddr_t); @@ -119,20 +120,21 @@ lance_config(struct lance_softc *sc, const char* name, int unit) if (ifp == NULL) return (ENOSPC); + callout_init_mtx(&sc->sc_wdog_ch, &sc->sc_mtx, 0); + /* Initialize ifnet structure. */ ifp->if_softc = sc; if_initname(ifp, name, unit); ifp->if_start = lance_start; ifp->if_ioctl = lance_ioctl; - ifp->if_watchdog = lance_watchdog; ifp->if_init = lance_init; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; #ifdef LANCE_REVC_BUG ifp->if_flags &= ~IFF_MULTICAST; #endif ifp->if_baudrate = IF_Mbps(10); - IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN); - ifp->if_snd.ifq_drv_maxlen = IFQ_MAXLEN; + IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen); + ifp->if_snd.ifq_drv_maxlen = ifqmaxlen; IFQ_SET_READY(&ifp->if_snd); /* Initialize ifmedia structures. */ @@ -213,6 +215,7 @@ lance_detach(struct lance_softc *sc) LE_LOCK(sc); lance_stop(sc); LE_UNLOCK(sc); + callout_drain(&sc->sc_wdog_ch); ether_ifdetach(ifp); if_free(ifp); } @@ -257,7 +260,8 @@ lance_stop(struct lance_softc *sc) * Mark the interface down and cancel the watchdog timer. */ ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); - ifp->if_timer = 0; + callout_stop(&sc->sc_wdog_ch); + sc->sc_wdog_timer = 0; (*sc->sc_wrcsr)(sc, LE_CSR0, LE_C0_STOP); } @@ -295,6 +299,10 @@ lance_init_locked(struct lance_softc *sc) /* Set the correct byte swapping mode, etc. */ (*sc->sc_wrcsr)(sc, LE_CSR3, sc->sc_conf3); + /* Set the current media. This may require the chip to be stopped. */ + if (sc->sc_mediachange) + (void)(*sc->sc_mediachange)(sc); + /* * Update our private copy of the Ethernet address. * We NEED the copy so we can ensure its alignment! @@ -318,16 +326,13 @@ lance_init_locked(struct lance_softc *sc) if ((*sc->sc_rdcsr)(sc, LE_CSR0) & LE_C0_IDON) break; - /* Set the current media. */ - if (sc->sc_mediachange) - (void)(*sc->sc_mediachange)(sc); - if ((*sc->sc_rdcsr)(sc, LE_CSR0) & LE_C0_IDON) { /* Start the LANCE. */ (*sc->sc_wrcsr)(sc, LE_CSR0, LE_C0_INEA | LE_C0_STRT); ifp->if_drv_flags |= IFF_DRV_RUNNING; ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; - ifp->if_timer = 0; + sc->sc_wdog_timer = 0; + callout_reset(&sc->sc_wdog_ch, hz, lance_watchdog, sc); (*sc->sc_start_locked)(sc); } else if_printf(ifp, "controller failed to initialize\n"); @@ -434,28 +439,42 @@ lance_get(struct lance_softc *sc, int boff, int totlen) } static void -lance_watchdog(struct ifnet *ifp) +lance_watchdog(void *xsc) { - struct lance_softc *sc = ifp->if_softc; + struct lance_softc *sc = (struct lance_softc *)xsc; + struct ifnet *ifp = sc->sc_ifp; + + LE_LOCK_ASSERT(sc, MA_OWNED); + + if (sc->sc_wdog_timer == 0 || --sc->sc_wdog_timer != 0) { + callout_reset(&sc->sc_wdog_ch, hz, lance_watchdog, sc); + return; + } - LE_LOCK(sc); if_printf(ifp, "device timeout\n"); ++ifp->if_oerrors; lance_init_locked(sc); - LE_UNLOCK(sc); } static int lance_mediachange(struct ifnet *ifp) { struct lance_softc *sc = ifp->if_softc; - int error; if (sc->sc_mediachange) { + /* + * For setting the port in LE_CSR15 the PCnet chips must + * be powered down or stopped and unlike documented may + * not take effect without an initialization. So don't + * invoke (*sc_mediachange) directly here but go through + * lance_init_locked(). + */ LE_LOCK(sc); - error = (*sc->sc_mediachange)(sc); + lance_stop(sc); + lance_init_locked(sc); + if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) + (*sc->sc_start_locked)(sc); LE_UNLOCK(sc); - return (error); } return (0); } @@ -586,7 +605,7 @@ lance_setladrf(struct lance_softc *sc, uint16_t *af) } af[0] = af[1] = af[2] = af[3] = 0x0000; - IF_ADDR_LOCK(ifp); + if_maddr_rlock(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; @@ -600,7 +619,7 @@ lance_setladrf(struct lance_softc *sc, uint16_t *af) /* Set the corresponding bit in the filter. */ af[crc >> 4] |= LE_HTOLE16(1 << (crc & 0xf)); } - IF_ADDR_UNLOCK(ifp); + if_maddr_runlock(ifp); } /* diff --git a/src/add-ons/kernel/drivers/network/pcnet/dev/le/lancereg.h b/src/add-ons/kernel/drivers/network/pcnet/dev/le/lancereg.h index e5165e9631..3e0ce060dc 100644 --- a/src/add-ons/kernel/drivers/network/pcnet/dev/le/lancereg.h +++ b/src/add-ons/kernel/drivers/network/pcnet/dev/le/lancereg.h @@ -120,7 +120,7 @@ * valid on the LANCE. */ -/* $FreeBSD: src/sys/dev/le/lancereg.h,v 1.1.2.2 2006/06/18 15:43:18 marius Exp $ */ +/* $FreeBSD$ */ #ifndef _DEV_LE_LANCEREG_H_ #define _DEV_LE_LANCEREG_H_ diff --git a/src/add-ons/kernel/drivers/network/pcnet/dev/le/lancevar.h b/src/add-ons/kernel/drivers/network/pcnet/dev/le/lancevar.h index c7fb69976e..1491ea762a 100644 --- a/src/add-ons/kernel/drivers/network/pcnet/dev/le/lancevar.h +++ b/src/add-ons/kernel/drivers/network/pcnet/dev/le/lancevar.h @@ -16,13 +16,6 @@ * 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. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the NetBSD - * Foundation, Inc. and its contributors. - * 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED @@ -37,7 +30,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ -/* $FreeBSD: src/sys/dev/le/lancevar.h,v 1.1.2.2 2006/06/18 15:43:18 marius Exp $ */ +/* $FreeBSD$ */ #ifndef _DEV_LE_LANCEVAR_H_ #define _DEV_LE_LANCEVAR_H_ @@ -48,6 +41,8 @@ struct lance_softc { struct ifnet *sc_ifp; struct ifmedia sc_media; struct mtx sc_mtx; + struct callout sc_wdog_ch; + int sc_wdog_timer; /* * Memory functions: @@ -120,7 +115,9 @@ struct lance_softc { #define LE_DEBUG (1 << 3) #define LE_PROMISC (1 << 4) +#ifdef __HAIKU__ uint16_t sc_lastisr; +#endif }; #define LE_LOCK_INIT(_sc, _name) \ diff --git a/src/add-ons/kernel/drivers/network/rdc/Jamfile b/src/add-ons/kernel/drivers/network/rdc/Jamfile new file mode 100644 index 0000000000..1e4efab397 --- /dev/null +++ b/src/add-ons/kernel/drivers/network/rdc/Jamfile @@ -0,0 +1,3 @@ +SubDir HAIKU_TOP src add-ons kernel drivers network rdc ; + +SubInclude HAIKU_TOP src add-ons kernel drivers network rdc dev ; diff --git a/src/add-ons/kernel/drivers/network/rdc/dev/Jamfile b/src/add-ons/kernel/drivers/network/rdc/dev/Jamfile new file mode 100644 index 0000000000..66483d3554 --- /dev/null +++ b/src/add-ons/kernel/drivers/network/rdc/dev/Jamfile @@ -0,0 +1,5 @@ +SubDir HAIKU_TOP src add-ons kernel drivers network rdc dev ; + +SubInclude HAIKU_TOP src add-ons kernel drivers network rdc dev mii ; +SubInclude HAIKU_TOP src add-ons kernel drivers network rdc dev vte ; + diff --git a/src/add-ons/kernel/drivers/network/rdc/dev/mii/Jamfile b/src/add-ons/kernel/drivers/network/rdc/dev/mii/Jamfile new file mode 100644 index 0000000000..c9ee04f23e --- /dev/null +++ b/src/add-ons/kernel/drivers/network/rdc/dev/mii/Jamfile @@ -0,0 +1,18 @@ +SubDir HAIKU_TOP src add-ons kernel drivers network rdc dev mii ; + +UseHeaders [ FDirName $(SUBDIR) .. .. ] : true ; +UseHeaders [ FDirName $(HAIKU_TOP) src libs compat freebsd_network compat ] : true ; + +UsePrivateHeaders net ; +UsePrivateKernelHeaders ; + +SubDirCcFlags [ FDefines _KERNEL=1 FBSD_DRIVER=1 ] ; + +KernelStaticLibrary rdc_mii.a + : + rdcphy.c + ; + +ObjectHdrs [ FGristFiles rdcphy$(SUFOBJ) ] + : [ FDirName $(TARGET_COMMON_DEBUG_OBJECT_DIR) libs compat freebsd_network ] ; +Includes [ FGristFiles rdcphy.c ] : miidevs.h ; diff --git a/src/add-ons/kernel/drivers/network/rdc/dev/mii/rdcphy.c b/src/add-ons/kernel/drivers/network/rdc/dev/mii/rdcphy.c new file mode 100644 index 0000000000..6f7f98d5f9 --- /dev/null +++ b/src/add-ons/kernel/drivers/network/rdc/dev/mii/rdcphy.c @@ -0,0 +1,240 @@ +/*- + * Copyright (c) 2010, Pyun YongHyeon + * 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 unmodified, 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. + */ + +#include +__FBSDID("$FreeBSD$"); + +/* + * Driver for the RDC Semiconductor R6040 10/100 PHY. + */ + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include "miidevs.h" + +#include + +#include "miibus_if.h" + +static device_probe_t rdcphy_probe; +static device_attach_t rdcphy_attach; + +struct rdcphy_softc { + struct mii_softc mii_sc; + int mii_link_tick; +#define RDCPHY_MANNEG_TICK 3 +}; + +static device_method_t rdcphy_methods[] = { + /* device interface */ + DEVMETHOD(device_probe, rdcphy_probe), + DEVMETHOD(device_attach, rdcphy_attach), + DEVMETHOD(device_detach, mii_phy_detach), + DEVMETHOD(device_shutdown, bus_generic_shutdown), + DEVMETHOD_END +}; + +static devclass_t rdcphy_devclass; + +static driver_t rdcphy_driver = { + "rdcphy", + rdcphy_methods, + sizeof(struct rdcphy_softc) +}; + +DRIVER_MODULE(rdcphy, miibus, rdcphy_driver, rdcphy_devclass, 0, 0); + +static int rdcphy_service(struct mii_softc *, struct mii_data *, int); +static void rdcphy_status(struct mii_softc *); + +static const struct mii_phydesc rdcphys[] = { + MII_PHY_DESC(RDC, R6040), + MII_PHY_END +}; + +static const struct mii_phy_funcs rdcphy_funcs = { + rdcphy_service, + rdcphy_status, + mii_phy_reset +}; + +static int +rdcphy_probe(device_t dev) +{ + + return (mii_phy_dev_probe(dev, rdcphys, BUS_PROBE_DEFAULT)); +} + +static int +rdcphy_attach(device_t dev) +{ + + mii_phy_dev_attach(dev, MIIF_NOMANPAUSE, &rdcphy_funcs, 1); + return (0); +} + +static int +rdcphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd) +{ + struct rdcphy_softc *rsc; + struct ifmedia_entry *ife; + + rsc = (struct rdcphy_softc *)sc; + ife = mii->mii_media.ifm_cur; + + switch (cmd) { + case MII_POLLSTAT: + break; + + case MII_MEDIACHG: + /* + * If the interface is not up, don't do anything. + */ + if ((mii->mii_ifp->if_flags & IFF_UP) == 0) + break; + + mii_phy_setmedia(sc); + switch (IFM_SUBTYPE(ife->ifm_media)) { + case IFM_100_TX: + case IFM_10_T: + /* + * Report fake lost link event to parent + * driver. This will stop MAC of parent + * driver and make it possible to reconfigure + * MAC after completion of link establishment. + * Note, the parent MAC seems to require + * restarting MAC when underlying any PHY + * configuration was changed even if the + * resolved speed/duplex was not changed at + * all. + */ + mii->mii_media_status = 0; + mii->mii_media_active = IFM_ETHER | IFM_NONE; + rsc->mii_link_tick = RDCPHY_MANNEG_TICK; + /* Immediately report link down. */ + mii_phy_update(sc, MII_MEDIACHG); + return (0); + default: + break; + } + break; + + case MII_TICK: + if (mii_phy_tick(sc) == EJUSTRETURN) + return (0); + if (IFM_SUBTYPE(ife->ifm_media) != IFM_AUTO) { + /* + * It seems the PHY hardware does not correctly + * report link status changes when manual link + * configuration is in progress. It is also + * possible for the PHY to complete establishing + * a link within one second such that mii(4) + * did not notice the link change. To workaround + * the issue, emulate lost link event and wait + * for 3 seconds when manual link configuration + * is in progress. 3 seconds would be long + * enough to absorb transient link flips. + */ + if (rsc->mii_link_tick > 0) { + rsc->mii_link_tick--; + return (0); + } + } + break; + } + + /* Update the media status. */ + PHY_STATUS(sc); + + /* Callback if something changed. */ + mii_phy_update(sc, cmd); + return (0); +} + +static void +rdcphy_status(struct mii_softc *sc) +{ + struct mii_data *mii; + struct ifmedia_entry *ife; + int bmsr, bmcr, physts; + + mii = sc->mii_pdata; + ife = mii->mii_media.ifm_cur; + + mii->mii_media_status = IFM_AVALID; + mii->mii_media_active = IFM_ETHER; + + bmsr = PHY_READ(sc, MII_BMSR) | PHY_READ(sc, MII_BMSR); + physts = PHY_READ(sc, MII_RDCPHY_STATUS); + + if ((physts & STATUS_LINK_UP) != 0) + mii->mii_media_status |= IFM_ACTIVE; + + bmcr = PHY_READ(sc, MII_BMCR); + if ((bmcr & BMCR_ISO) != 0) { + mii->mii_media_active |= IFM_NONE; + mii->mii_media_status = 0; + return; + } + + if ((bmcr & BMCR_LOOP) != 0) + mii->mii_media_active |= IFM_LOOP; + + if ((bmcr & BMCR_AUTOEN) != 0) { + if ((bmsr & BMSR_ACOMP) == 0) { + /* Erg, still trying, I guess... */ + mii->mii_media_active |= IFM_NONE; + return; + } + } + + switch (physts & STATUS_SPEED_MASK) { + case STATUS_SPEED_100: + mii->mii_media_active |= IFM_100_TX; + break; + case STATUS_SPEED_10: + mii->mii_media_active |= IFM_10_T; + break; + default: + mii->mii_media_active |= IFM_NONE; + return; + } + if ((physts & STATUS_FULL_DUPLEX) != 0) + mii->mii_media_active |= IFM_FDX | mii_phy_flowstatus(sc); + else + mii->mii_media_active |= IFM_HDX; +} diff --git a/src/add-ons/kernel/drivers/network/rdc/dev/mii/rdcphyreg.h b/src/add-ons/kernel/drivers/network/rdc/dev/mii/rdcphyreg.h new file mode 100644 index 0000000000..44b14a467b --- /dev/null +++ b/src/add-ons/kernel/drivers/network/rdc/dev/mii/rdcphyreg.h @@ -0,0 +1,73 @@ +/*- + * Copyright (c) 2010, Pyun YongHyeon + * 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 unmodified, 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$ + */ + +#ifndef _DEV_MII_RDCPHYREG_H_ +#define _DEV_MII_RDCPHYREG_H_ + +#define MII_RDCPHY_DEBUG 0x11 +#define DEBUG_JABBER_DIS 0x0040 +#define DEBUG_LOOP_BACK_10MBPS 0x0400 + +#define MII_RDCPHY_CTRL 0x14 +#define CTRL_SQE_ENB 0x0100 +#define CTRL_NEG_POLARITY 0x0400 +#define CTRL_AUTO_POLARITY 0x0800 +#define CTRL_MDIXSEL_RX 0x2000 +#define CTRL_MDIXSEL_TX 0x4000 +#define CTRL_AUTO_MDIX_DIS 0x8000 + +#define MII_RDCPHY_CTRL2 0x15 +#define CTRL2_LED_DUPLEX 0x0000 +#define CTRL2_LED_DUPLEX_COL 0x0008 +#define CTRL2_LED_ACT 0x0010 +#define CTRL2_LED_SPEED_ACT 0x0018 +#define CTRL2_LED_BLK_100MBPS_DIS 0x0020 +#define CTRL2_LED_BLK_10MBPS_DIS 0x0040 +#define CTRL2_LED_BLK_LINK_ACT_DIS 0x0080 +#define CTRL2_SDT_THRESH_MASK 0x3E00 +#define CTRL2_TIMING_ERR_SEL 0x4000 +#define CTRL2_LED_BLK_80MS 0x8000 +#define CTRL2_LED_BLK_160MS 0x0000 +#define CTRL2_LED_MASK 0x0018 + +#define MII_RDCPHY_STATUS 0x16 +#define STATUS_AUTO_MDIX_RX 0x0200 +#define STATUS_AUTO_MDIX_TX 0x0400 +#define STATUS_NEG_POLARITY 0x0800 +#define STATUS_FULL_DUPLEX 0x1000 +#define STATUS_SPEED_10 0x0000 +#define STATUS_SPEED_100 0x2000 +#define STATUS_SPEED_MASK 0x6000 +#define STATUS_LINK_UP 0x8000 + +/* Analog test register 2 */ +#define MII_RDCPHY_TEST2 0x1A +#define TEST2_PWR_DOWN 0x0200 + +#endif /* _DEV_MII_RDCPHYREG_H_ */ diff --git a/src/add-ons/kernel/drivers/network/rdc/dev/vte/Jamfile b/src/add-ons/kernel/drivers/network/rdc/dev/vte/Jamfile new file mode 100644 index 0000000000..eb073c2c78 --- /dev/null +++ b/src/add-ons/kernel/drivers/network/rdc/dev/vte/Jamfile @@ -0,0 +1,15 @@ +SubDir HAIKU_TOP src add-ons kernel drivers network rdc dev vte ; + +UseHeaders [ FDirName $(SUBDIR) .. .. ] : true ; +UseHeaders [ FDirName $(HAIKU_TOP) src libs compat freebsd_network compat ] : true ; + +UsePrivateHeaders net system ; +UsePrivateKernelHeaders ; + +SubDirCcFlags [ FDefines _KERNEL=1 FBSD_DRIVER=1 ] ; + +KernelAddon rdc : + if_vte.c + glue.c + : libfreebsd_network.a rdc_mii.a + ; diff --git a/src/add-ons/kernel/drivers/network/rdc/dev/vte/glue.c b/src/add-ons/kernel/drivers/network/rdc/dev/vte/glue.c new file mode 100644 index 0000000000..bc725a5d0c --- /dev/null +++ b/src/add-ons/kernel/drivers/network/rdc/dev/vte/glue.c @@ -0,0 +1,35 @@ +/* + * Copyright 2007-2008, Axel Dörfler, axeld@pinc-software.de. + * Distributed under the terms of the MIT License. + */ + +#include +#include +#include +#include +#include + +#include + +#include +#include + + +HAIKU_FBSD_DRIVER_GLUE(rdc, vte, pci); +HAIKU_DRIVER_REQUIREMENTS(FBSD_TASKQUEUES | FBSD_SWI_TASKQUEUE); +NO_HAIKU_CHECK_DISABLE_INTERRUPTS(); +NO_HAIKU_REENABLE_INTERRUPTS(); + +extern driver_t *DRIVER_MODULE_NAME(rdcphy, miibus); + +driver_t * +__haiku_select_miibus_driver(device_t dev) +{ + driver_t *drivers[] = { + DRIVER_MODULE_NAME(rdcphy, miibus), + NULL + }; + + return __haiku_probe_miibus(dev, drivers); +} + diff --git a/src/add-ons/kernel/drivers/network/rdc/dev/vte/if_vte.c b/src/add-ons/kernel/drivers/network/rdc/dev/vte/if_vte.c new file mode 100644 index 0000000000..7865ff23b9 --- /dev/null +++ b/src/add-ons/kernel/drivers/network/rdc/dev/vte/if_vte.c @@ -0,0 +1,2048 @@ +/*- + * Copyright (c) 2010, Pyun YongHyeon + * 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 unmodified, 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. + */ + +/* Driver for DM&P Electronics, Inc, Vortex86 RDC R6040 FastEthernet. */ + +#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 +#include + +#include +#include + +#include +#include + +#include +#include + +#include + +#include +#include + +/* "device miibus" required. See GENERIC if you get errors here. */ +#include "miibus_if.h" + +MODULE_DEPEND(vte, pci, 1, 1, 1); +MODULE_DEPEND(vte, ether, 1, 1, 1); +MODULE_DEPEND(vte, miibus, 1, 1, 1); + +/* Tunables. */ +static int tx_deep_copy = 1; +TUNABLE_INT("hw.vte.tx_deep_copy", &tx_deep_copy); + +/* + * Devices supported by this driver. + */ +static const struct vte_ident vte_ident_table[] = { + { VENDORID_RDC, DEVICEID_RDC_R6040, "RDC R6040 FastEthernet"}, + { 0, 0, NULL} +}; + +static int vte_attach(device_t); +static int vte_detach(device_t); +static int vte_dma_alloc(struct vte_softc *); +static void vte_dma_free(struct vte_softc *); +static void vte_dmamap_cb(void *, bus_dma_segment_t *, int, int); +static struct vte_txdesc * + vte_encap(struct vte_softc *, struct mbuf **); +static const struct vte_ident * + vte_find_ident(device_t); +#ifndef __NO_STRICT_ALIGNMENT +static struct mbuf * + vte_fixup_rx(struct ifnet *, struct mbuf *); +#endif +static void vte_get_macaddr(struct vte_softc *); +static void vte_init(void *); +static void vte_init_locked(struct vte_softc *); +static int vte_init_rx_ring(struct vte_softc *); +static int vte_init_tx_ring(struct vte_softc *); +static void vte_intr(void *); +static int vte_ioctl(struct ifnet *, u_long, caddr_t); +static void vte_mac_config(struct vte_softc *); +static int vte_miibus_readreg(device_t, int, int); +static void vte_miibus_statchg(device_t); +static int vte_miibus_writereg(device_t, int, int, int); +static int vte_mediachange(struct ifnet *); +static int vte_mediachange_locked(struct ifnet *); +static void vte_mediastatus(struct ifnet *, struct ifmediareq *); +static int vte_newbuf(struct vte_softc *, struct vte_rxdesc *); +static int vte_probe(device_t); +static void vte_reset(struct vte_softc *); +static int vte_resume(device_t); +static void vte_rxeof(struct vte_softc *); +static void vte_rxfilter(struct vte_softc *); +static int vte_shutdown(device_t); +static void vte_start(struct ifnet *); +static void vte_start_locked(struct vte_softc *); +static void vte_start_mac(struct vte_softc *); +static void vte_stats_clear(struct vte_softc *); +static void vte_stats_update(struct vte_softc *); +static void vte_stop(struct vte_softc *); +static void vte_stop_mac(struct vte_softc *); +static int vte_suspend(device_t); +static void vte_sysctl_node(struct vte_softc *); +static void vte_tick(void *); +static void vte_txeof(struct vte_softc *); +static void vte_watchdog(struct vte_softc *); +static int sysctl_int_range(SYSCTL_HANDLER_ARGS, int, int); +static int sysctl_hw_vte_int_mod(SYSCTL_HANDLER_ARGS); + +static device_method_t vte_methods[] = { + /* Device interface. */ + DEVMETHOD(device_probe, vte_probe), + DEVMETHOD(device_attach, vte_attach), + DEVMETHOD(device_detach, vte_detach), + DEVMETHOD(device_shutdown, vte_shutdown), + DEVMETHOD(device_suspend, vte_suspend), + DEVMETHOD(device_resume, vte_resume), + + /* MII interface. */ + DEVMETHOD(miibus_readreg, vte_miibus_readreg), + DEVMETHOD(miibus_writereg, vte_miibus_writereg), + DEVMETHOD(miibus_statchg, vte_miibus_statchg), + + DEVMETHOD_END +}; + +static driver_t vte_driver = { + "vte", + vte_methods, + sizeof(struct vte_softc) +}; + +static devclass_t vte_devclass; + +DRIVER_MODULE(vte, pci, vte_driver, vte_devclass, 0, 0); +DRIVER_MODULE(miibus, vte, miibus_driver, miibus_devclass, 0, 0); + +static int +vte_miibus_readreg(device_t dev, int phy, int reg) +{ + struct vte_softc *sc; + int i; + + sc = device_get_softc(dev); + + CSR_WRITE_2(sc, VTE_MMDIO, MMDIO_READ | + (phy << MMDIO_PHY_ADDR_SHIFT) | (reg << MMDIO_REG_ADDR_SHIFT)); + for (i = VTE_PHY_TIMEOUT; i > 0; i--) { + DELAY(5); + if ((CSR_READ_2(sc, VTE_MMDIO) & MMDIO_READ) == 0) + break; + } + + if (i == 0) { + device_printf(sc->vte_dev, "phy read timeout : %d\n", reg); + return (0); + } + + return (CSR_READ_2(sc, VTE_MMRD)); +} + +static int +vte_miibus_writereg(device_t dev, int phy, int reg, int val) +{ + struct vte_softc *sc; + int i; + + sc = device_get_softc(dev); + + CSR_WRITE_2(sc, VTE_MMWD, val); + CSR_WRITE_2(sc, VTE_MMDIO, MMDIO_WRITE | + (phy << MMDIO_PHY_ADDR_SHIFT) | (reg << MMDIO_REG_ADDR_SHIFT)); + for (i = VTE_PHY_TIMEOUT; i > 0; i--) { + DELAY(5); + if ((CSR_READ_2(sc, VTE_MMDIO) & MMDIO_WRITE) == 0) + break; + } + + if (i == 0) + device_printf(sc->vte_dev, "phy write timeout : %d\n", reg); + + return (0); +} + +static void +vte_miibus_statchg(device_t dev) +{ + struct vte_softc *sc; + struct mii_data *mii; + struct ifnet *ifp; + uint16_t val; + + sc = device_get_softc(dev); + + mii = device_get_softc(sc->vte_miibus); + ifp = sc->vte_ifp; + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) + return; + + sc->vte_flags &= ~VTE_FLAG_LINK; + if ((mii->mii_media_status & (IFM_ACTIVE | IFM_AVALID)) == + (IFM_ACTIVE | IFM_AVALID)) { + switch (IFM_SUBTYPE(mii->mii_media_active)) { + case IFM_10_T: + case IFM_100_TX: + sc->vte_flags |= VTE_FLAG_LINK; + break; + default: + break; + } + } + + /* Stop RX/TX MACs. */ + vte_stop_mac(sc); + /* Program MACs with resolved duplex and flow control. */ + if ((sc->vte_flags & VTE_FLAG_LINK) != 0) { + /* + * Timer waiting time : (63 + TIMER * 64) MII clock. + * MII clock : 25MHz(100Mbps) or 2.5MHz(10Mbps). + */ + if (IFM_SUBTYPE(mii->mii_media_active) == IFM_100_TX) + val = 18 << VTE_IM_TIMER_SHIFT; + else + val = 1 << VTE_IM_TIMER_SHIFT; + val |= sc->vte_int_rx_mod << VTE_IM_BUNDLE_SHIFT; + /* 48.6us for 100Mbps, 50.8us for 10Mbps */ + CSR_WRITE_2(sc, VTE_MRICR, val); + + if (IFM_SUBTYPE(mii->mii_media_active) == IFM_100_TX) + val = 18 << VTE_IM_TIMER_SHIFT; + else + val = 1 << VTE_IM_TIMER_SHIFT; + val |= sc->vte_int_tx_mod << VTE_IM_BUNDLE_SHIFT; + /* 48.6us for 100Mbps, 50.8us for 10Mbps */ + CSR_WRITE_2(sc, VTE_MTICR, val); + + vte_mac_config(sc); + vte_start_mac(sc); + } +} + +static void +vte_mediastatus(struct ifnet *ifp, struct ifmediareq *ifmr) +{ + struct vte_softc *sc; + struct mii_data *mii; + + sc = ifp->if_softc; + VTE_LOCK(sc); + if ((ifp->if_flags & IFF_UP) == 0) { + VTE_UNLOCK(sc); + return; + } + mii = device_get_softc(sc->vte_miibus); + + mii_pollstat(mii); + ifmr->ifm_status = mii->mii_media_status; + ifmr->ifm_active = mii->mii_media_active; + VTE_UNLOCK(sc); +} + +static int +vte_mediachange(struct ifnet *ifp) +{ + struct vte_softc *sc; + int error; + + sc = ifp->if_softc; + VTE_LOCK(sc); + error = vte_mediachange_locked(ifp); + VTE_UNLOCK(sc); + return (error); +} + +static int +vte_mediachange_locked(struct ifnet *ifp) +{ + struct vte_softc *sc; + struct mii_data *mii; + struct mii_softc *miisc; + int error; + + sc = ifp->if_softc; + mii = device_get_softc(sc->vte_miibus); + LIST_FOREACH(miisc, &mii->mii_phys, mii_list) + PHY_RESET(miisc); + error = mii_mediachg(mii); + + return (error); +} + +static const struct vte_ident * +vte_find_ident(device_t dev) +{ + const struct vte_ident *ident; + uint16_t vendor, devid; + + vendor = pci_get_vendor(dev); + devid = pci_get_device(dev); + for (ident = vte_ident_table; ident->name != NULL; ident++) { + if (vendor == ident->vendorid && devid == ident->deviceid) + return (ident); + } + + return (NULL); +} + +static int +vte_probe(device_t dev) +{ + const struct vte_ident *ident; + + ident = vte_find_ident(dev); + if (ident != NULL) { + device_set_desc(dev, ident->name); + return (BUS_PROBE_DEFAULT); + } + + return (ENXIO); +} + +static void +vte_get_macaddr(struct vte_softc *sc) +{ + uint16_t mid; + + /* + * It seems there is no way to reload station address and + * it is supposed to be set by BIOS. + */ + mid = CSR_READ_2(sc, VTE_MID0L); + sc->vte_eaddr[0] = (mid >> 0) & 0xFF; + sc->vte_eaddr[1] = (mid >> 8) & 0xFF; + mid = CSR_READ_2(sc, VTE_MID0M); + sc->vte_eaddr[2] = (mid >> 0) & 0xFF; + sc->vte_eaddr[3] = (mid >> 8) & 0xFF; + mid = CSR_READ_2(sc, VTE_MID0H); + sc->vte_eaddr[4] = (mid >> 0) & 0xFF; + sc->vte_eaddr[5] = (mid >> 8) & 0xFF; +} + +static int +vte_attach(device_t dev) +{ + struct vte_softc *sc; + struct ifnet *ifp; + uint16_t macid; + int error, rid; + + error = 0; + sc = device_get_softc(dev); + sc->vte_dev = dev; + + mtx_init(&sc->vte_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK, + MTX_DEF); + callout_init_mtx(&sc->vte_tick_ch, &sc->vte_mtx, 0); + sc->vte_ident = vte_find_ident(dev); + + /* Map the device. */ + pci_enable_busmaster(dev); + sc->vte_res_id = PCIR_BAR(1); + sc->vte_res_type = SYS_RES_MEMORY; + sc->vte_res = bus_alloc_resource_any(dev, sc->vte_res_type, + &sc->vte_res_id, RF_ACTIVE); + if (sc->vte_res == NULL) { + sc->vte_res_id = PCIR_BAR(0); + sc->vte_res_type = SYS_RES_IOPORT; + sc->vte_res = bus_alloc_resource_any(dev, sc->vte_res_type, + &sc->vte_res_id, RF_ACTIVE); + if (sc->vte_res == NULL) { + device_printf(dev, "cannot map memory/ports.\n"); + mtx_destroy(&sc->vte_mtx); + return (ENXIO); + } + } + if (bootverbose) { + device_printf(dev, "using %s space register mapping\n", + sc->vte_res_type == SYS_RES_MEMORY ? "memory" : "I/O"); + device_printf(dev, "MAC Identifier : 0x%04x\n", + CSR_READ_2(sc, VTE_MACID)); + macid = CSR_READ_2(sc, VTE_MACID_REV); + device_printf(dev, "MAC Id. 0x%02x, Rev. 0x%02x\n", + (macid & VTE_MACID_MASK) >> VTE_MACID_SHIFT, + (macid & VTE_MACID_REV_MASK) >> VTE_MACID_REV_SHIFT); + } + + rid = 0; + sc->vte_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, + RF_SHAREABLE | RF_ACTIVE); + if (sc->vte_irq == NULL) { + device_printf(dev, "cannot allocate IRQ resources.\n"); + error = ENXIO; + goto fail; + } + + /* Reset the ethernet controller. */ + vte_reset(sc); + + if ((error = vte_dma_alloc(sc) != 0)) + goto fail; + + /* Create device sysctl node. */ + vte_sysctl_node(sc); + + /* Load station address. */ + vte_get_macaddr(sc); + + ifp = sc->vte_ifp = if_alloc(IFT_ETHER); + if (ifp == NULL) { + device_printf(dev, "cannot allocate ifnet structure.\n"); + error = ENXIO; + goto fail; + } + + ifp->if_softc = sc; + if_initname(ifp, device_get_name(dev), device_get_unit(dev)); + ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; + ifp->if_ioctl = vte_ioctl; + ifp->if_start = vte_start; + ifp->if_init = vte_init; + ifp->if_snd.ifq_drv_maxlen = VTE_TX_RING_CNT - 1; + IFQ_SET_MAXLEN(&ifp->if_snd, ifp->if_snd.ifq_drv_maxlen); + IFQ_SET_READY(&ifp->if_snd); + + /* + * Set up MII bus. + * BIOS would have initialized VTE_MPSCCR to catch PHY + * status changes so driver may be able to extract + * configured PHY address. Since it's common to see BIOS + * fails to initialize the register(including the sample + * board I have), let mii(4) probe it. This is more + * reliable than relying on BIOS's initialization. + * + * Advertising flow control capability to mii(4) was + * intentionally disabled due to severe problems in TX + * pause frame generation. See vte_rxeof() for more + * details. + */ + error = mii_attach(dev, &sc->vte_miibus, ifp, vte_mediachange, + vte_mediastatus, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0); + if (error != 0) { + device_printf(dev, "attaching PHYs failed\n"); + goto fail; + } + + ether_ifattach(ifp, sc->vte_eaddr); + + /* VLAN capability setup. */ + ifp->if_capabilities |= IFCAP_VLAN_MTU; + ifp->if_capenable = ifp->if_capabilities; + /* Tell the upper layer we support VLAN over-sized frames. */ + ifp->if_hdrlen = sizeof(struct ether_vlan_header); + + error = bus_setup_intr(dev, sc->vte_irq, INTR_TYPE_NET | INTR_MPSAFE, + NULL, vte_intr, sc, &sc->vte_intrhand); + if (error != 0) { + device_printf(dev, "could not set up interrupt handler.\n"); + ether_ifdetach(ifp); + goto fail; + } + +fail: + if (error != 0) + vte_detach(dev); + + return (error); +} + +static int +vte_detach(device_t dev) +{ + struct vte_softc *sc; + struct ifnet *ifp; + + sc = device_get_softc(dev); + + ifp = sc->vte_ifp; + if (device_is_attached(dev)) { + VTE_LOCK(sc); + vte_stop(sc); + VTE_UNLOCK(sc); + callout_drain(&sc->vte_tick_ch); + ether_ifdetach(ifp); + } + + if (sc->vte_miibus != NULL) { + device_delete_child(dev, sc->vte_miibus); + sc->vte_miibus = NULL; + } + bus_generic_detach(dev); + + if (sc->vte_intrhand != NULL) { + bus_teardown_intr(dev, sc->vte_irq, sc->vte_intrhand); + sc->vte_intrhand = NULL; + } + if (sc->vte_irq != NULL) { + bus_release_resource(dev, SYS_RES_IRQ, 0, sc->vte_irq); + sc->vte_irq = NULL; + } + if (sc->vte_res != NULL) { + bus_release_resource(dev, sc->vte_res_type, sc->vte_res_id, + sc->vte_res); + sc->vte_res = NULL; + } + if (ifp != NULL) { + if_free(ifp); + sc->vte_ifp = NULL; + } + vte_dma_free(sc); + mtx_destroy(&sc->vte_mtx); + + return (0); +} + +#define VTE_SYSCTL_STAT_ADD32(c, h, n, p, d) \ + SYSCTL_ADD_UINT(c, h, OID_AUTO, n, CTLFLAG_RD, p, 0, d) + +static void +vte_sysctl_node(struct vte_softc *sc) +{ + struct sysctl_ctx_list *ctx; + struct sysctl_oid_list *child, *parent; + struct sysctl_oid *tree; + struct vte_hw_stats *stats; + int error; + + stats = &sc->vte_stats; + ctx = device_get_sysctl_ctx(sc->vte_dev); + child = SYSCTL_CHILDREN(device_get_sysctl_tree(sc->vte_dev)); + + SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "int_rx_mod", + CTLTYPE_INT | CTLFLAG_RW, &sc->vte_int_rx_mod, 0, + sysctl_hw_vte_int_mod, "I", "vte RX interrupt moderation"); + SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "int_tx_mod", + CTLTYPE_INT | CTLFLAG_RW, &sc->vte_int_tx_mod, 0, + sysctl_hw_vte_int_mod, "I", "vte TX interrupt moderation"); + /* Pull in device tunables. */ + sc->vte_int_rx_mod = VTE_IM_RX_BUNDLE_DEFAULT; + error = resource_int_value(device_get_name(sc->vte_dev), + device_get_unit(sc->vte_dev), "int_rx_mod", &sc->vte_int_rx_mod); + if (error == 0) { + if (sc->vte_int_rx_mod < VTE_IM_BUNDLE_MIN || + sc->vte_int_rx_mod > VTE_IM_BUNDLE_MAX) { + device_printf(sc->vte_dev, "int_rx_mod value out of " + "range; using default: %d\n", + VTE_IM_RX_BUNDLE_DEFAULT); + sc->vte_int_rx_mod = VTE_IM_RX_BUNDLE_DEFAULT; + } + } + + sc->vte_int_tx_mod = VTE_IM_TX_BUNDLE_DEFAULT; + error = resource_int_value(device_get_name(sc->vte_dev), + device_get_unit(sc->vte_dev), "int_tx_mod", &sc->vte_int_tx_mod); + if (error == 0) { + if (sc->vte_int_tx_mod < VTE_IM_BUNDLE_MIN || + sc->vte_int_tx_mod > VTE_IM_BUNDLE_MAX) { + device_printf(sc->vte_dev, "int_tx_mod value out of " + "range; using default: %d\n", + VTE_IM_TX_BUNDLE_DEFAULT); + sc->vte_int_tx_mod = VTE_IM_TX_BUNDLE_DEFAULT; + } + } + + tree = SYSCTL_ADD_NODE(ctx, child, OID_AUTO, "stats", CTLFLAG_RD, + NULL, "VTE statistics"); + parent = SYSCTL_CHILDREN(tree); + + /* RX statistics. */ + tree = SYSCTL_ADD_NODE(ctx, parent, OID_AUTO, "rx", CTLFLAG_RD, + NULL, "RX MAC statistics"); + child = SYSCTL_CHILDREN(tree); + VTE_SYSCTL_STAT_ADD32(ctx, child, "good_frames", + &stats->rx_frames, "Good frames"); + VTE_SYSCTL_STAT_ADD32(ctx, child, "good_bcast_frames", + &stats->rx_bcast_frames, "Good broadcast frames"); + VTE_SYSCTL_STAT_ADD32(ctx, child, "good_mcast_frames", + &stats->rx_mcast_frames, "Good multicast frames"); + VTE_SYSCTL_STAT_ADD32(ctx, child, "runt", + &stats->rx_runts, "Too short frames"); + VTE_SYSCTL_STAT_ADD32(ctx, child, "crc_errs", + &stats->rx_crcerrs, "CRC errors"); + VTE_SYSCTL_STAT_ADD32(ctx, child, "long_frames", + &stats->rx_long_frames, + "Frames that have longer length than maximum packet length"); + VTE_SYSCTL_STAT_ADD32(ctx, child, "fifo_full", + &stats->rx_fifo_full, "FIFO full"); + VTE_SYSCTL_STAT_ADD32(ctx, child, "desc_unavail", + &stats->rx_desc_unavail, "Descriptor unavailable frames"); + VTE_SYSCTL_STAT_ADD32(ctx, child, "pause_frames", + &stats->rx_pause_frames, "Pause control frames"); + + /* TX statistics. */ + tree = SYSCTL_ADD_NODE(ctx, parent, OID_AUTO, "tx", CTLFLAG_RD, + NULL, "TX MAC statistics"); + child = SYSCTL_CHILDREN(tree); + VTE_SYSCTL_STAT_ADD32(ctx, child, "good_frames", + &stats->tx_frames, "Good frames"); + VTE_SYSCTL_STAT_ADD32(ctx, child, "underruns", + &stats->tx_underruns, "FIFO underruns"); + VTE_SYSCTL_STAT_ADD32(ctx, child, "late_colls", + &stats->tx_late_colls, "Late collisions"); + VTE_SYSCTL_STAT_ADD32(ctx, child, "pause_frames", + &stats->tx_pause_frames, "Pause control frames"); +} + +#undef VTE_SYSCTL_STAT_ADD32 + +struct vte_dmamap_arg { + bus_addr_t vte_busaddr; +}; + +static void +vte_dmamap_cb(void *arg, bus_dma_segment_t *segs, int nsegs, int error) +{ + struct vte_dmamap_arg *ctx; + + if (error != 0) + return; + + KASSERT(nsegs == 1, ("%s: %d segments returned!", __func__, nsegs)); + + ctx = (struct vte_dmamap_arg *)arg; + ctx->vte_busaddr = segs[0].ds_addr; +} + +static int +vte_dma_alloc(struct vte_softc *sc) +{ + struct vte_txdesc *txd; + struct vte_rxdesc *rxd; + struct vte_dmamap_arg ctx; + int error, i; + + /* Create parent DMA tag. */ + error = bus_dma_tag_create( + bus_get_dma_tag(sc->vte_dev), /* parent */ + 1, 0, /* alignment, boundary */ + BUS_SPACE_MAXADDR_32BIT, /* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, NULL, /* filter, filterarg */ + BUS_SPACE_MAXSIZE_32BIT, /* maxsize */ + 0, /* nsegments */ + BUS_SPACE_MAXSIZE_32BIT, /* maxsegsize */ + 0, /* flags */ + NULL, NULL, /* lockfunc, lockarg */ + &sc->vte_cdata.vte_parent_tag); + if (error != 0) { + device_printf(sc->vte_dev, + "could not create parent DMA tag.\n"); + goto fail; + } + + /* Create DMA tag for TX descriptor ring. */ + error = bus_dma_tag_create( + sc->vte_cdata.vte_parent_tag, /* parent */ + VTE_TX_RING_ALIGN, 0, /* alignment, boundary */ + BUS_SPACE_MAXADDR, /* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, NULL, /* filter, filterarg */ + VTE_TX_RING_SZ, /* maxsize */ + 1, /* nsegments */ + VTE_TX_RING_SZ, /* maxsegsize */ + 0, /* flags */ + NULL, NULL, /* lockfunc, lockarg */ + &sc->vte_cdata.vte_tx_ring_tag); + if (error != 0) { + device_printf(sc->vte_dev, + "could not create TX ring DMA tag.\n"); + goto fail; + } + + /* Create DMA tag for RX free descriptor ring. */ + error = bus_dma_tag_create( + sc->vte_cdata.vte_parent_tag, /* parent */ + VTE_RX_RING_ALIGN, 0, /* alignment, boundary */ + BUS_SPACE_MAXADDR, /* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, NULL, /* filter, filterarg */ + VTE_RX_RING_SZ, /* maxsize */ + 1, /* nsegments */ + VTE_RX_RING_SZ, /* maxsegsize */ + 0, /* flags */ + NULL, NULL, /* lockfunc, lockarg */ + &sc->vte_cdata.vte_rx_ring_tag); + if (error != 0) { + device_printf(sc->vte_dev, + "could not create RX ring DMA tag.\n"); + goto fail; + } + + /* Allocate DMA'able memory and load the DMA map for TX ring. */ + error = bus_dmamem_alloc(sc->vte_cdata.vte_tx_ring_tag, + (void **)&sc->vte_cdata.vte_tx_ring, + BUS_DMA_WAITOK | BUS_DMA_ZERO | BUS_DMA_COHERENT, + &sc->vte_cdata.vte_tx_ring_map); + if (error != 0) { + device_printf(sc->vte_dev, + "could not allocate DMA'able memory for TX ring.\n"); + goto fail; + } + ctx.vte_busaddr = 0; + error = bus_dmamap_load(sc->vte_cdata.vte_tx_ring_tag, + sc->vte_cdata.vte_tx_ring_map, sc->vte_cdata.vte_tx_ring, + VTE_TX_RING_SZ, vte_dmamap_cb, &ctx, 0); + if (error != 0 || ctx.vte_busaddr == 0) { + device_printf(sc->vte_dev, + "could not load DMA'able memory for TX ring.\n"); + goto fail; + } + sc->vte_cdata.vte_tx_ring_paddr = ctx.vte_busaddr; + + /* Allocate DMA'able memory and load the DMA map for RX ring. */ + error = bus_dmamem_alloc(sc->vte_cdata.vte_rx_ring_tag, + (void **)&sc->vte_cdata.vte_rx_ring, + BUS_DMA_WAITOK | BUS_DMA_ZERO | BUS_DMA_COHERENT, + &sc->vte_cdata.vte_rx_ring_map); + if (error != 0) { + device_printf(sc->vte_dev, + "could not allocate DMA'able memory for RX ring.\n"); + goto fail; + } + ctx.vte_busaddr = 0; + error = bus_dmamap_load(sc->vte_cdata.vte_rx_ring_tag, + sc->vte_cdata.vte_rx_ring_map, sc->vte_cdata.vte_rx_ring, + VTE_RX_RING_SZ, vte_dmamap_cb, &ctx, 0); + if (error != 0 || ctx.vte_busaddr == 0) { + device_printf(sc->vte_dev, + "could not load DMA'able memory for RX ring.\n"); + goto fail; + } + sc->vte_cdata.vte_rx_ring_paddr = ctx.vte_busaddr; + + /* Create TX buffer parent tag. */ + error = bus_dma_tag_create( + bus_get_dma_tag(sc->vte_dev), /* parent */ + 1, 0, /* alignment, boundary */ + BUS_SPACE_MAXADDR_32BIT, /* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, NULL, /* filter, filterarg */ + BUS_SPACE_MAXSIZE_32BIT, /* maxsize */ + 0, /* nsegments */ + BUS_SPACE_MAXSIZE_32BIT, /* maxsegsize */ + 0, /* flags */ + NULL, NULL, /* lockfunc, lockarg */ + &sc->vte_cdata.vte_buffer_tag); + if (error != 0) { + device_printf(sc->vte_dev, + "could not create parent buffer DMA tag.\n"); + goto fail; + } + + /* Create DMA tag for TX buffers. */ + error = bus_dma_tag_create( + sc->vte_cdata.vte_buffer_tag, /* parent */ + 1, 0, /* alignment, boundary */ + BUS_SPACE_MAXADDR, /* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, NULL, /* filter, filterarg */ + MCLBYTES, /* maxsize */ + 1, /* nsegments */ + MCLBYTES, /* maxsegsize */ + 0, /* flags */ + NULL, NULL, /* lockfunc, lockarg */ + &sc->vte_cdata.vte_tx_tag); + if (error != 0) { + device_printf(sc->vte_dev, "could not create TX DMA tag.\n"); + goto fail; + } + + /* Create DMA tag for RX buffers. */ + error = bus_dma_tag_create( + sc->vte_cdata.vte_buffer_tag, /* parent */ + VTE_RX_BUF_ALIGN, 0, /* alignment, boundary */ + BUS_SPACE_MAXADDR, /* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, NULL, /* filter, filterarg */ + MCLBYTES, /* maxsize */ + 1, /* nsegments */ + MCLBYTES, /* maxsegsize */ + 0, /* flags */ + NULL, NULL, /* lockfunc, lockarg */ + &sc->vte_cdata.vte_rx_tag); + if (error != 0) { + device_printf(sc->vte_dev, "could not create RX DMA tag.\n"); + goto fail; + } + /* Create DMA maps for TX buffers. */ + for (i = 0; i < VTE_TX_RING_CNT; i++) { + txd = &sc->vte_cdata.vte_txdesc[i]; + txd->tx_m = NULL; + txd->tx_dmamap = NULL; + error = bus_dmamap_create(sc->vte_cdata.vte_tx_tag, 0, + &txd->tx_dmamap); + if (error != 0) { + device_printf(sc->vte_dev, + "could not create TX dmamap.\n"); + goto fail; + } + } + /* Create DMA maps for RX buffers. */ + if ((error = bus_dmamap_create(sc->vte_cdata.vte_rx_tag, 0, + &sc->vte_cdata.vte_rx_sparemap)) != 0) { + device_printf(sc->vte_dev, + "could not create spare RX dmamap.\n"); + goto fail; + } + for (i = 0; i < VTE_RX_RING_CNT; i++) { + rxd = &sc->vte_cdata.vte_rxdesc[i]; + rxd->rx_m = NULL; + rxd->rx_dmamap = NULL; + error = bus_dmamap_create(sc->vte_cdata.vte_rx_tag, 0, + &rxd->rx_dmamap); + if (error != 0) { + device_printf(sc->vte_dev, + "could not create RX dmamap.\n"); + goto fail; + } + } + +fail: + return (error); +} + +static void +vte_dma_free(struct vte_softc *sc) +{ + struct vte_txdesc *txd; + struct vte_rxdesc *rxd; + int i; + + /* TX buffers. */ + if (sc->vte_cdata.vte_tx_tag != NULL) { + for (i = 0; i < VTE_TX_RING_CNT; i++) { + txd = &sc->vte_cdata.vte_txdesc[i]; + if (txd->tx_dmamap != NULL) { + bus_dmamap_destroy(sc->vte_cdata.vte_tx_tag, + txd->tx_dmamap); + txd->tx_dmamap = NULL; + } + } + bus_dma_tag_destroy(sc->vte_cdata.vte_tx_tag); + sc->vte_cdata.vte_tx_tag = NULL; + } + /* RX buffers */ + if (sc->vte_cdata.vte_rx_tag != NULL) { + for (i = 0; i < VTE_RX_RING_CNT; i++) { + rxd = &sc->vte_cdata.vte_rxdesc[i]; + if (rxd->rx_dmamap != NULL) { + bus_dmamap_destroy(sc->vte_cdata.vte_rx_tag, + rxd->rx_dmamap); + rxd->rx_dmamap = NULL; + } + } + if (sc->vte_cdata.vte_rx_sparemap != NULL) { + bus_dmamap_destroy(sc->vte_cdata.vte_rx_tag, + sc->vte_cdata.vte_rx_sparemap); + sc->vte_cdata.vte_rx_sparemap = NULL; + } + bus_dma_tag_destroy(sc->vte_cdata.vte_rx_tag); + sc->vte_cdata.vte_rx_tag = NULL; + } + /* TX descriptor ring. */ + if (sc->vte_cdata.vte_tx_ring_tag != NULL) { + if (sc->vte_cdata.vte_tx_ring_map != NULL) + bus_dmamap_unload(sc->vte_cdata.vte_tx_ring_tag, + sc->vte_cdata.vte_tx_ring_map); + if (sc->vte_cdata.vte_tx_ring_map != NULL && + sc->vte_cdata.vte_tx_ring != NULL) + bus_dmamem_free(sc->vte_cdata.vte_tx_ring_tag, + sc->vte_cdata.vte_tx_ring, + sc->vte_cdata.vte_tx_ring_map); + sc->vte_cdata.vte_tx_ring = NULL; + sc->vte_cdata.vte_tx_ring_map = NULL; + bus_dma_tag_destroy(sc->vte_cdata.vte_tx_ring_tag); + sc->vte_cdata.vte_tx_ring_tag = NULL; + } + /* RX ring. */ + if (sc->vte_cdata.vte_rx_ring_tag != NULL) { + if (sc->vte_cdata.vte_rx_ring_map != NULL) + bus_dmamap_unload(sc->vte_cdata.vte_rx_ring_tag, + sc->vte_cdata.vte_rx_ring_map); + if (sc->vte_cdata.vte_rx_ring_map != NULL && + sc->vte_cdata.vte_rx_ring != NULL) + bus_dmamem_free(sc->vte_cdata.vte_rx_ring_tag, + sc->vte_cdata.vte_rx_ring, + sc->vte_cdata.vte_rx_ring_map); + sc->vte_cdata.vte_rx_ring = NULL; + sc->vte_cdata.vte_rx_ring_map = NULL; + bus_dma_tag_destroy(sc->vte_cdata.vte_rx_ring_tag); + sc->vte_cdata.vte_rx_ring_tag = NULL; + } + if (sc->vte_cdata.vte_buffer_tag != NULL) { + bus_dma_tag_destroy(sc->vte_cdata.vte_buffer_tag); + sc->vte_cdata.vte_buffer_tag = NULL; + } + if (sc->vte_cdata.vte_parent_tag != NULL) { + bus_dma_tag_destroy(sc->vte_cdata.vte_parent_tag); + sc->vte_cdata.vte_parent_tag = NULL; + } +} + +static int +vte_shutdown(device_t dev) +{ + + return (vte_suspend(dev)); +} + +static int +vte_suspend(device_t dev) +{ + struct vte_softc *sc; + struct ifnet *ifp; + + sc = device_get_softc(dev); + + VTE_LOCK(sc); + ifp = sc->vte_ifp; + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) + vte_stop(sc); + VTE_UNLOCK(sc); + + return (0); +} + +static int +vte_resume(device_t dev) +{ + struct vte_softc *sc; + struct ifnet *ifp; + + sc = device_get_softc(dev); + + VTE_LOCK(sc); + ifp = sc->vte_ifp; + if ((ifp->if_flags & IFF_UP) != 0) { + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + vte_init_locked(sc); + } + VTE_UNLOCK(sc); + + return (0); +} + +static struct vte_txdesc * +vte_encap(struct vte_softc *sc, struct mbuf **m_head) +{ + struct vte_txdesc *txd; + struct mbuf *m, *n; + bus_dma_segment_t txsegs[1]; + int copy, error, nsegs, padlen; + + VTE_LOCK_ASSERT(sc); + + M_ASSERTPKTHDR((*m_head)); + + txd = &sc->vte_cdata.vte_txdesc[sc->vte_cdata.vte_tx_prod]; + m = *m_head; + /* + * Controller doesn't auto-pad, so we have to make sure pad + * short frames out to the minimum frame length. + */ + if (m->m_pkthdr.len < VTE_MIN_FRAMELEN) + padlen = VTE_MIN_FRAMELEN - m->m_pkthdr.len; + else + padlen = 0; + + /* + * Controller does not support multi-fragmented TX buffers. + * Controller spends most of its TX processing time in + * de-fragmenting TX buffers. Either faster CPU or more + * advanced controller DMA engine is required to speed up + * TX path processing. + * To mitigate the de-fragmenting issue, perform deep copy + * from fragmented mbuf chains to a pre-allocated mbuf + * cluster with extra cost of kernel memory. For frames + * that is composed of single TX buffer, the deep copy is + * bypassed. + */ + if (tx_deep_copy != 0) { + copy = 0; + if (m->m_next != NULL) + copy++; + if (padlen > 0 && (M_WRITABLE(m) == 0 || + padlen > M_TRAILINGSPACE(m))) + copy++; + if (copy != 0) { + /* Avoid expensive m_defrag(9) and do deep copy. */ + n = sc->vte_cdata.vte_txmbufs[sc->vte_cdata.vte_tx_prod]; + m_copydata(m, 0, m->m_pkthdr.len, mtod(n, char *)); + n->m_pkthdr.len = m->m_pkthdr.len; + n->m_len = m->m_pkthdr.len; + m = n; + txd->tx_flags |= VTE_TXMBUF; + } + + if (padlen > 0) { + /* Zero out the bytes in the pad area. */ + bzero(mtod(m, char *) + m->m_pkthdr.len, padlen); + m->m_pkthdr.len += padlen; + m->m_len = m->m_pkthdr.len; + } + } else { + if (M_WRITABLE(m) == 0) { + if (m->m_next != NULL || padlen > 0) { + /* Get a writable copy. */ + m = m_dup(*m_head, M_DONTWAIT); + /* Release original mbuf chains. */ + m_freem(*m_head); + if (m == NULL) { + *m_head = NULL; + return (NULL); + } + *m_head = m; + } + } + + if (m->m_next != NULL) { + m = m_defrag(*m_head, M_DONTWAIT); + if (m == NULL) { + m_freem(*m_head); + *m_head = NULL; + return (NULL); + } + *m_head = m; + } + + if (padlen > 0) { + if (M_TRAILINGSPACE(m) < padlen) { + m = m_defrag(*m_head, M_DONTWAIT); + if (m == NULL) { + m_freem(*m_head); + *m_head = NULL; + return (NULL); + } + *m_head = m; + } + /* Zero out the bytes in the pad area. */ + bzero(mtod(m, char *) + m->m_pkthdr.len, padlen); + m->m_pkthdr.len += padlen; + m->m_len = m->m_pkthdr.len; + } + } + + error = bus_dmamap_load_mbuf_sg(sc->vte_cdata.vte_tx_tag, + txd->tx_dmamap, m, txsegs, &nsegs, 0); + if (error != 0) { + txd->tx_flags &= ~VTE_TXMBUF; + return (NULL); + } + KASSERT(nsegs == 1, ("%s: %d segments returned!", __func__, nsegs)); + bus_dmamap_sync(sc->vte_cdata.vte_tx_tag, txd->tx_dmamap, + BUS_DMASYNC_PREWRITE); + + txd->tx_desc->dtlen = htole16(VTE_TX_LEN(txsegs[0].ds_len)); + txd->tx_desc->dtbp = htole32(txsegs[0].ds_addr); + sc->vte_cdata.vte_tx_cnt++; + /* Update producer index. */ + VTE_DESC_INC(sc->vte_cdata.vte_tx_prod, VTE_TX_RING_CNT); + + /* Finally hand over ownership to controller. */ + txd->tx_desc->dtst = htole16(VTE_DTST_TX_OWN); + txd->tx_m = m; + + return (txd); +} + +static void +vte_start(struct ifnet *ifp) +{ + struct vte_softc *sc; + + sc = ifp->if_softc; + VTE_LOCK(sc); + vte_start_locked(sc); + VTE_UNLOCK(sc); +} + +static void +vte_start_locked(struct vte_softc *sc) +{ + struct ifnet *ifp; + struct vte_txdesc *txd; + struct mbuf *m_head; + int enq; + + ifp = sc->vte_ifp; + + if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != + IFF_DRV_RUNNING || (sc->vte_flags & VTE_FLAG_LINK) == 0) + return; + + for (enq = 0; !IFQ_DRV_IS_EMPTY(&ifp->if_snd); ) { + /* Reserve one free TX descriptor. */ + if (sc->vte_cdata.vte_tx_cnt >= VTE_TX_RING_CNT - 1) { + ifp->if_drv_flags |= IFF_DRV_OACTIVE; + break; + } + IFQ_DRV_DEQUEUE(&ifp->if_snd, m_head); + if (m_head == NULL) + break; + /* + * Pack the data into the transmit ring. If we + * don't have room, set the OACTIVE flag and wait + * for the NIC to drain the ring. + */ + if ((txd = vte_encap(sc, &m_head)) == NULL) { + if (m_head != NULL) + IFQ_DRV_PREPEND(&ifp->if_snd, m_head); + break; + } + + enq++; + /* + * If there's a BPF listener, bounce a copy of this frame + * to him. + */ + ETHER_BPF_MTAP(ifp, m_head); + /* Free consumed TX frame. */ + if ((txd->tx_flags & VTE_TXMBUF) != 0) + m_freem(m_head); + } + + if (enq > 0) { + bus_dmamap_sync(sc->vte_cdata.vte_tx_ring_tag, + sc->vte_cdata.vte_tx_ring_map, BUS_DMASYNC_PREREAD | + BUS_DMASYNC_PREWRITE); + CSR_WRITE_2(sc, VTE_TX_POLL, TX_POLL_START); + sc->vte_watchdog_timer = VTE_TX_TIMEOUT; + } +} + +static void +vte_watchdog(struct vte_softc *sc) +{ + struct ifnet *ifp; + + VTE_LOCK_ASSERT(sc); + + if (sc->vte_watchdog_timer == 0 || --sc->vte_watchdog_timer) + return; + + ifp = sc->vte_ifp; + if_printf(sc->vte_ifp, "watchdog timeout -- resetting\n"); + ifp->if_oerrors++; + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + vte_init_locked(sc); + if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) + vte_start_locked(sc); +} + +static int +vte_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) +{ + struct vte_softc *sc; + struct ifreq *ifr; + struct mii_data *mii; + int error; + + sc = ifp->if_softc; + ifr = (struct ifreq *)data; + error = 0; + switch (cmd) { + case SIOCSIFFLAGS: + VTE_LOCK(sc); + if ((ifp->if_flags & IFF_UP) != 0) { + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0 && + ((ifp->if_flags ^ sc->vte_if_flags) & + (IFF_PROMISC | IFF_ALLMULTI)) != 0) + vte_rxfilter(sc); + else + vte_init_locked(sc); + } else if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) + vte_stop(sc); + sc->vte_if_flags = ifp->if_flags; + VTE_UNLOCK(sc); + break; + case SIOCADDMULTI: + case SIOCDELMULTI: + VTE_LOCK(sc); + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) + vte_rxfilter(sc); + VTE_UNLOCK(sc); + break; + case SIOCSIFMEDIA: + case SIOCGIFMEDIA: + mii = device_get_softc(sc->vte_miibus); + error = ifmedia_ioctl(ifp, ifr, &mii->mii_media, cmd); + break; + default: + error = ether_ioctl(ifp, cmd, data); + break; + } + + return (error); +} + +static void +vte_mac_config(struct vte_softc *sc) +{ + struct mii_data *mii; + uint16_t mcr; + + VTE_LOCK_ASSERT(sc); + + mii = device_get_softc(sc->vte_miibus); + mcr = CSR_READ_2(sc, VTE_MCR0); + mcr &= ~(MCR0_FC_ENB | MCR0_FULL_DUPLEX); + if ((IFM_OPTIONS(mii->mii_media_active) & IFM_FDX) != 0) { + mcr |= MCR0_FULL_DUPLEX; +#ifdef notyet + if ((IFM_OPTIONS(mii->mii_media_active) & IFM_ETH_TXPAUSE) != 0) + mcr |= MCR0_FC_ENB; + /* + * The data sheet is not clear whether the controller + * honors received pause frames or not. The is no + * separate control bit for RX pause frame so just + * enable MCR0_FC_ENB bit. + */ + if ((IFM_OPTIONS(mii->mii_media_active) & IFM_ETH_RXPAUSE) != 0) + mcr |= MCR0_FC_ENB; +#endif + } + CSR_WRITE_2(sc, VTE_MCR0, mcr); +} + +static void +vte_stats_clear(struct vte_softc *sc) +{ + + /* Reading counter registers clears its contents. */ + CSR_READ_2(sc, VTE_CNT_RX_DONE); + CSR_READ_2(sc, VTE_CNT_MECNT0); + CSR_READ_2(sc, VTE_CNT_MECNT1); + CSR_READ_2(sc, VTE_CNT_MECNT2); + CSR_READ_2(sc, VTE_CNT_MECNT3); + CSR_READ_2(sc, VTE_CNT_TX_DONE); + CSR_READ_2(sc, VTE_CNT_MECNT4); + CSR_READ_2(sc, VTE_CNT_PAUSE); +} + +static void +vte_stats_update(struct vte_softc *sc) +{ + struct vte_hw_stats *stat; + struct ifnet *ifp; + uint16_t value; + + VTE_LOCK_ASSERT(sc); + + ifp = sc->vte_ifp; + stat = &sc->vte_stats; + + CSR_READ_2(sc, VTE_MECISR); + /* RX stats. */ + stat->rx_frames += CSR_READ_2(sc, VTE_CNT_RX_DONE); + value = CSR_READ_2(sc, VTE_CNT_MECNT0); + stat->rx_bcast_frames += (value >> 8); + stat->rx_mcast_frames += (value & 0xFF); + value = CSR_READ_2(sc, VTE_CNT_MECNT1); + stat->rx_runts += (value >> 8); + stat->rx_crcerrs += (value & 0xFF); + value = CSR_READ_2(sc, VTE_CNT_MECNT2); + stat->rx_long_frames += (value & 0xFF); + value = CSR_READ_2(sc, VTE_CNT_MECNT3); + stat->rx_fifo_full += (value >> 8); + stat->rx_desc_unavail += (value & 0xFF); + + /* TX stats. */ + stat->tx_frames += CSR_READ_2(sc, VTE_CNT_TX_DONE); + value = CSR_READ_2(sc, VTE_CNT_MECNT4); + stat->tx_underruns += (value >> 8); + stat->tx_late_colls += (value & 0xFF); + + value = CSR_READ_2(sc, VTE_CNT_PAUSE); + stat->tx_pause_frames += (value >> 8); + stat->rx_pause_frames += (value & 0xFF); + + /* Update ifp counters. */ + ifp->if_opackets = stat->tx_frames; + ifp->if_collisions = stat->tx_late_colls; + ifp->if_oerrors = stat->tx_late_colls + stat->tx_underruns; + ifp->if_ipackets = stat->rx_frames; + ifp->if_ierrors = stat->rx_crcerrs + stat->rx_runts + + stat->rx_long_frames + stat->rx_fifo_full; +} + +static void +vte_intr(void *arg) +{ + struct vte_softc *sc; + struct ifnet *ifp; + uint16_t status; + int n; + + sc = (struct vte_softc *)arg; + VTE_LOCK(sc); + + ifp = sc->vte_ifp; + /* Reading VTE_MISR acknowledges interrupts. */ + status = CSR_READ_2(sc, VTE_MISR); + if ((status & VTE_INTRS) == 0) { + /* Not ours. */ + VTE_UNLOCK(sc); + return; + } + + /* Disable interrupts. */ + CSR_WRITE_2(sc, VTE_MIER, 0); + for (n = 8; (status & VTE_INTRS) != 0;) { + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) + break; + if ((status & (MISR_RX_DONE | MISR_RX_DESC_UNAVAIL | + MISR_RX_FIFO_FULL)) != 0) + vte_rxeof(sc); + if ((status & MISR_TX_DONE) != 0) + vte_txeof(sc); + if ((status & MISR_EVENT_CNT_OFLOW) != 0) + vte_stats_update(sc); + if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) + vte_start_locked(sc); + if (--n > 0) + status = CSR_READ_2(sc, VTE_MISR); + else + break; + } + + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) { + /* Re-enable interrupts. */ + CSR_WRITE_2(sc, VTE_MIER, VTE_INTRS); + } + VTE_UNLOCK(sc); +} + +static void +vte_txeof(struct vte_softc *sc) +{ + struct ifnet *ifp; + struct vte_txdesc *txd; + uint16_t status; + int cons, prog; + + VTE_LOCK_ASSERT(sc); + + ifp = sc->vte_ifp; + + if (sc->vte_cdata.vte_tx_cnt == 0) + return; + bus_dmamap_sync(sc->vte_cdata.vte_tx_ring_tag, + sc->vte_cdata.vte_tx_ring_map, BUS_DMASYNC_POSTREAD | + BUS_DMASYNC_POSTWRITE); + cons = sc->vte_cdata.vte_tx_cons; + /* + * Go through our TX list and free mbufs for those + * frames which have been transmitted. + */ + for (prog = 0; sc->vte_cdata.vte_tx_cnt > 0; prog++) { + txd = &sc->vte_cdata.vte_txdesc[cons]; + status = le16toh(txd->tx_desc->dtst); + if ((status & VTE_DTST_TX_OWN) != 0) + break; + sc->vte_cdata.vte_tx_cnt--; + /* Reclaim transmitted mbufs. */ + bus_dmamap_sync(sc->vte_cdata.vte_tx_tag, txd->tx_dmamap, + BUS_DMASYNC_POSTWRITE); + bus_dmamap_unload(sc->vte_cdata.vte_tx_tag, txd->tx_dmamap); + if ((txd->tx_flags & VTE_TXMBUF) == 0) + m_freem(txd->tx_m); + txd->tx_flags &= ~VTE_TXMBUF; + txd->tx_m = NULL; + prog++; + VTE_DESC_INC(cons, VTE_TX_RING_CNT); + } + + if (prog > 0) { + ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; + sc->vte_cdata.vte_tx_cons = cons; + /* + * Unarm watchdog timer only when there is no pending + * frames in TX queue. + */ + if (sc->vte_cdata.vte_tx_cnt == 0) + sc->vte_watchdog_timer = 0; + } +} + +static int +vte_newbuf(struct vte_softc *sc, struct vte_rxdesc *rxd) +{ + struct mbuf *m; + bus_dma_segment_t segs[1]; + bus_dmamap_t map; + int nsegs; + + m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); + if (m == NULL) + return (ENOBUFS); + m->m_len = m->m_pkthdr.len = MCLBYTES; + m_adj(m, sizeof(uint32_t)); + + if (bus_dmamap_load_mbuf_sg(sc->vte_cdata.vte_rx_tag, + sc->vte_cdata.vte_rx_sparemap, m, segs, &nsegs, 0) != 0) { + m_freem(m); + return (ENOBUFS); + } + KASSERT(nsegs == 1, ("%s: %d segments returned!", __func__, nsegs)); + + if (rxd->rx_m != NULL) { + bus_dmamap_sync(sc->vte_cdata.vte_rx_tag, rxd->rx_dmamap, + BUS_DMASYNC_POSTREAD); + bus_dmamap_unload(sc->vte_cdata.vte_rx_tag, rxd->rx_dmamap); + } + map = rxd->rx_dmamap; + rxd->rx_dmamap = sc->vte_cdata.vte_rx_sparemap; + sc->vte_cdata.vte_rx_sparemap = map; + bus_dmamap_sync(sc->vte_cdata.vte_rx_tag, rxd->rx_dmamap, + BUS_DMASYNC_PREREAD); + rxd->rx_m = m; + rxd->rx_desc->drbp = htole32(segs[0].ds_addr); + rxd->rx_desc->drlen = htole16(VTE_RX_LEN(segs[0].ds_len)); + rxd->rx_desc->drst = htole16(VTE_DRST_RX_OWN); + + return (0); +} + +/* + * It's not supposed to see this controller on strict-alignment + * architectures but make it work for completeness. + */ +#ifndef __NO_STRICT_ALIGNMENT +static struct mbuf * +vte_fixup_rx(struct ifnet *ifp, struct mbuf *m) +{ + uint16_t *src, *dst; + int i; + + src = mtod(m, uint16_t *); + dst = src - 1; + + for (i = 0; i < (m->m_len / sizeof(uint16_t) + 1); i++) + *dst++ = *src++; + m->m_data -= ETHER_ALIGN; + return (m); +} +#endif + +static void +vte_rxeof(struct vte_softc *sc) +{ + struct ifnet *ifp; + struct vte_rxdesc *rxd; + struct mbuf *m; + uint16_t status, total_len; + int cons, prog; + + bus_dmamap_sync(sc->vte_cdata.vte_rx_ring_tag, + sc->vte_cdata.vte_rx_ring_map, BUS_DMASYNC_POSTREAD | + BUS_DMASYNC_POSTWRITE); + cons = sc->vte_cdata.vte_rx_cons; + ifp = sc->vte_ifp; + for (prog = 0; (ifp->if_drv_flags & IFF_DRV_RUNNING) != 0; prog++, + VTE_DESC_INC(cons, VTE_RX_RING_CNT)) { + rxd = &sc->vte_cdata.vte_rxdesc[cons]; + status = le16toh(rxd->rx_desc->drst); + if ((status & VTE_DRST_RX_OWN) != 0) + break; + total_len = VTE_RX_LEN(le16toh(rxd->rx_desc->drlen)); + m = rxd->rx_m; + if ((status & VTE_DRST_RX_OK) == 0) { + /* Discard errored frame. */ + rxd->rx_desc->drlen = + htole16(MCLBYTES - sizeof(uint32_t)); + rxd->rx_desc->drst = htole16(VTE_DRST_RX_OWN); + continue; + } + if (vte_newbuf(sc, rxd) != 0) { + ifp->if_iqdrops++; + rxd->rx_desc->drlen = + htole16(MCLBYTES - sizeof(uint32_t)); + rxd->rx_desc->drst = htole16(VTE_DRST_RX_OWN); + continue; + } + + /* + * It seems there is no way to strip FCS bytes. + */ + m->m_pkthdr.len = m->m_len = total_len - ETHER_CRC_LEN; + m->m_pkthdr.rcvif = ifp; +#ifndef __NO_STRICT_ALIGNMENT + vte_fixup_rx(ifp, m); +#endif + VTE_UNLOCK(sc); + (*ifp->if_input)(ifp, m); + VTE_LOCK(sc); + } + + if (prog > 0) { + /* Update the consumer index. */ + sc->vte_cdata.vte_rx_cons = cons; + /* + * Sync updated RX descriptors such that controller see + * modified RX buffer addresses. + */ + bus_dmamap_sync(sc->vte_cdata.vte_rx_ring_tag, + sc->vte_cdata.vte_rx_ring_map, + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); +#ifdef notyet + /* + * Update residue counter. Controller does not + * keep track of number of available RX descriptors + * such that driver should have to update VTE_MRDCR + * to make controller know how many free RX + * descriptors were added to controller. This is + * a similar mechanism used in VIA velocity + * controllers and it indicates controller just + * polls OWN bit of current RX descriptor pointer. + * A couple of severe issues were seen on sample + * board where the controller continuously emits TX + * pause frames once RX pause threshold crossed. + * Once triggered it never recovered form that + * state, I couldn't find a way to make it back to + * work at least. This issue effectively + * disconnected the system from network. Also, the + * controller used 00:00:00:00:00:00 as source + * station address of TX pause frame. Probably this + * is one of reason why vendor recommends not to + * enable flow control on R6040 controller. + */ + CSR_WRITE_2(sc, VTE_MRDCR, prog | + (((VTE_RX_RING_CNT * 2) / 10) << + VTE_MRDCR_RX_PAUSE_THRESH_SHIFT)); +#endif + } +} + +static void +vte_tick(void *arg) +{ + struct vte_softc *sc; + struct mii_data *mii; + + sc = (struct vte_softc *)arg; + + VTE_LOCK_ASSERT(sc); + + mii = device_get_softc(sc->vte_miibus); + mii_tick(mii); + vte_stats_update(sc); + vte_txeof(sc); + vte_watchdog(sc); + callout_reset(&sc->vte_tick_ch, hz, vte_tick, sc); +} + +static void +vte_reset(struct vte_softc *sc) +{ + uint16_t mcr; + int i; + + mcr = CSR_READ_2(sc, VTE_MCR1); + CSR_WRITE_2(sc, VTE_MCR1, mcr | MCR1_MAC_RESET); + for (i = VTE_RESET_TIMEOUT; i > 0; i--) { + DELAY(10); + if ((CSR_READ_2(sc, VTE_MCR1) & MCR1_MAC_RESET) == 0) + break; + } + if (i == 0) + device_printf(sc->vte_dev, "reset timeout(0x%04x)!\n", mcr); + /* + * Follow the guide of vendor recommended way to reset MAC. + * Vendor confirms relying on MCR1_MAC_RESET of VTE_MCR1 is + * not reliable so manually reset internal state machine. + */ + CSR_WRITE_2(sc, VTE_MACSM, 0x0002); + CSR_WRITE_2(sc, VTE_MACSM, 0); + DELAY(5000); +} + +static void +vte_init(void *xsc) +{ + struct vte_softc *sc; + + sc = (struct vte_softc *)xsc; + VTE_LOCK(sc); + vte_init_locked(sc); + VTE_UNLOCK(sc); +} + +static void +vte_init_locked(struct vte_softc *sc) +{ + struct ifnet *ifp; + bus_addr_t paddr; + uint8_t *eaddr; + + VTE_LOCK_ASSERT(sc); + + ifp = sc->vte_ifp; + + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) + return; + /* + * Cancel any pending I/O. + */ + vte_stop(sc); + /* + * Reset the chip to a known state. + */ + vte_reset(sc); + + /* Initialize RX descriptors. */ + if (vte_init_rx_ring(sc) != 0) { + device_printf(sc->vte_dev, "no memory for RX buffers.\n"); + vte_stop(sc); + return; + } + if (vte_init_tx_ring(sc) != 0) { + device_printf(sc->vte_dev, "no memory for TX buffers.\n"); + vte_stop(sc); + return; + } + + /* + * Reprogram the station address. Controller supports up + * to 4 different station addresses so driver programs the + * first station address as its own ethernet address and + * configure the remaining three addresses as perfect + * multicast addresses. + */ + eaddr = IF_LLADDR(sc->vte_ifp); + CSR_WRITE_2(sc, VTE_MID0L, eaddr[1] << 8 | eaddr[0]); + CSR_WRITE_2(sc, VTE_MID0M, eaddr[3] << 8 | eaddr[2]); + CSR_WRITE_2(sc, VTE_MID0H, eaddr[5] << 8 | eaddr[4]); + + /* Set TX descriptor base addresses. */ + paddr = sc->vte_cdata.vte_tx_ring_paddr; + CSR_WRITE_2(sc, VTE_MTDSA1, paddr >> 16); + CSR_WRITE_2(sc, VTE_MTDSA0, paddr & 0xFFFF); + /* Set RX descriptor base addresses. */ + paddr = sc->vte_cdata.vte_rx_ring_paddr; + CSR_WRITE_2(sc, VTE_MRDSA1, paddr >> 16); + CSR_WRITE_2(sc, VTE_MRDSA0, paddr & 0xFFFF); + /* + * Initialize RX descriptor residue counter and set RX + * pause threshold to 20% of available RX descriptors. + * See comments on vte_rxeof() for details on flow control + * issues. + */ + CSR_WRITE_2(sc, VTE_MRDCR, (VTE_RX_RING_CNT & VTE_MRDCR_RESIDUE_MASK) | + (((VTE_RX_RING_CNT * 2) / 10) << VTE_MRDCR_RX_PAUSE_THRESH_SHIFT)); + + /* + * Always use maximum frame size that controller can + * support. Otherwise received frames that has longer + * frame length than vte(4) MTU would be silently dropped + * in controller. This would break path-MTU discovery as + * sender wouldn't get any responses from receiver. The + * RX buffer size should be multiple of 4. + * Note, jumbo frames are silently ignored by controller + * and even MAC counters do not detect them. + */ + CSR_WRITE_2(sc, VTE_MRBSR, VTE_RX_BUF_SIZE_MAX); + + /* Configure FIFO. */ + CSR_WRITE_2(sc, VTE_MBCR, MBCR_FIFO_XFER_LENGTH_16 | + MBCR_TX_FIFO_THRESH_64 | MBCR_RX_FIFO_THRESH_16 | + MBCR_SDRAM_BUS_REQ_TIMER_DEFAULT); + + /* + * Configure TX/RX MACs. Actual resolved duplex and flow + * control configuration is done after detecting a valid + * link. Note, we don't generate early interrupt here + * as well since FreeBSD does not have interrupt latency + * problems like Windows. + */ + CSR_WRITE_2(sc, VTE_MCR0, MCR0_ACCPT_LONG_PKT); + /* + * We manually keep track of PHY status changes to + * configure resolved duplex and flow control since only + * duplex configuration can be automatically reflected to + * MCR0. + */ + CSR_WRITE_2(sc, VTE_MCR1, MCR1_PKT_LENGTH_1537 | + MCR1_EXCESS_COL_RETRY_16); + + /* Initialize RX filter. */ + vte_rxfilter(sc); + + /* Disable TX/RX interrupt moderation control. */ + CSR_WRITE_2(sc, VTE_MRICR, 0); + CSR_WRITE_2(sc, VTE_MTICR, 0); + + /* Enable MAC event counter interrupts. */ + CSR_WRITE_2(sc, VTE_MECIER, VTE_MECIER_INTRS); + /* Clear MAC statistics. */ + vte_stats_clear(sc); + + /* Acknowledge all pending interrupts and clear it. */ + CSR_WRITE_2(sc, VTE_MIER, VTE_INTRS); + CSR_WRITE_2(sc, VTE_MISR, 0); + + sc->vte_flags &= ~VTE_FLAG_LINK; + /* Switch to the current media. */ + vte_mediachange_locked(ifp); + + callout_reset(&sc->vte_tick_ch, hz, vte_tick, sc); + + ifp->if_drv_flags |= IFF_DRV_RUNNING; + ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; +} + +static void +vte_stop(struct vte_softc *sc) +{ + struct ifnet *ifp; + struct vte_txdesc *txd; + struct vte_rxdesc *rxd; + int i; + + VTE_LOCK_ASSERT(sc); + /* + * Mark the interface down and cancel the watchdog timer. + */ + ifp = sc->vte_ifp; + ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); + sc->vte_flags &= ~VTE_FLAG_LINK; + callout_stop(&sc->vte_tick_ch); + sc->vte_watchdog_timer = 0; + vte_stats_update(sc); + /* Disable interrupts. */ + CSR_WRITE_2(sc, VTE_MIER, 0); + CSR_WRITE_2(sc, VTE_MECIER, 0); + /* Stop RX/TX MACs. */ + vte_stop_mac(sc); + /* Clear interrupts. */ + CSR_READ_2(sc, VTE_MISR); + /* + * Free TX/RX mbufs still in the queues. + */ + for (i = 0; i < VTE_RX_RING_CNT; i++) { + rxd = &sc->vte_cdata.vte_rxdesc[i]; + if (rxd->rx_m != NULL) { + bus_dmamap_sync(sc->vte_cdata.vte_rx_tag, + rxd->rx_dmamap, BUS_DMASYNC_POSTREAD); + bus_dmamap_unload(sc->vte_cdata.vte_rx_tag, + rxd->rx_dmamap); + m_freem(rxd->rx_m); + rxd->rx_m = NULL; + } + } + for (i = 0; i < VTE_TX_RING_CNT; i++) { + txd = &sc->vte_cdata.vte_txdesc[i]; + if (txd->tx_m != NULL) { + bus_dmamap_sync(sc->vte_cdata.vte_tx_tag, + txd->tx_dmamap, BUS_DMASYNC_POSTWRITE); + bus_dmamap_unload(sc->vte_cdata.vte_tx_tag, + txd->tx_dmamap); + if ((txd->tx_flags & VTE_TXMBUF) == 0) + m_freem(txd->tx_m); + txd->tx_m = NULL; + txd->tx_flags &= ~VTE_TXMBUF; + } + } + /* Free TX mbuf pools used for deep copy. */ + for (i = 0; i < VTE_TX_RING_CNT; i++) { + if (sc->vte_cdata.vte_txmbufs[i] != NULL) { + m_freem(sc->vte_cdata.vte_txmbufs[i]); + sc->vte_cdata.vte_txmbufs[i] = NULL; + } + } +} + +static void +vte_start_mac(struct vte_softc *sc) +{ + uint16_t mcr; + int i; + + VTE_LOCK_ASSERT(sc); + + /* Enable RX/TX MACs. */ + mcr = CSR_READ_2(sc, VTE_MCR0); + if ((mcr & (MCR0_RX_ENB | MCR0_TX_ENB)) != + (MCR0_RX_ENB | MCR0_TX_ENB)) { + mcr |= MCR0_RX_ENB | MCR0_TX_ENB; + CSR_WRITE_2(sc, VTE_MCR0, mcr); + for (i = VTE_TIMEOUT; i > 0; i--) { + mcr = CSR_READ_2(sc, VTE_MCR0); + if ((mcr & (MCR0_RX_ENB | MCR0_TX_ENB)) == + (MCR0_RX_ENB | MCR0_TX_ENB)) + break; + DELAY(10); + } + if (i == 0) + device_printf(sc->vte_dev, + "could not enable RX/TX MAC(0x%04x)!\n", mcr); + } +} + +static void +vte_stop_mac(struct vte_softc *sc) +{ + uint16_t mcr; + int i; + + VTE_LOCK_ASSERT(sc); + + /* Disable RX/TX MACs. */ + mcr = CSR_READ_2(sc, VTE_MCR0); + if ((mcr & (MCR0_RX_ENB | MCR0_TX_ENB)) != 0) { + mcr &= ~(MCR0_RX_ENB | MCR0_TX_ENB); + CSR_WRITE_2(sc, VTE_MCR0, mcr); + for (i = VTE_TIMEOUT; i > 0; i--) { + mcr = CSR_READ_2(sc, VTE_MCR0); + if ((mcr & (MCR0_RX_ENB | MCR0_TX_ENB)) == 0) + break; + DELAY(10); + } + if (i == 0) + device_printf(sc->vte_dev, + "could not disable RX/TX MAC(0x%04x)!\n", mcr); + } +} + +static int +vte_init_tx_ring(struct vte_softc *sc) +{ + struct vte_tx_desc *desc; + struct vte_txdesc *txd; + bus_addr_t addr; + int i; + + VTE_LOCK_ASSERT(sc); + + sc->vte_cdata.vte_tx_prod = 0; + sc->vte_cdata.vte_tx_cons = 0; + sc->vte_cdata.vte_tx_cnt = 0; + + /* Pre-allocate TX mbufs for deep copy. */ + if (tx_deep_copy != 0) { + for (i = 0; i < VTE_TX_RING_CNT; i++) { + sc->vte_cdata.vte_txmbufs[i] = m_getcl(M_DONTWAIT, + MT_DATA, M_PKTHDR); + if (sc->vte_cdata.vte_txmbufs[i] == NULL) + return (ENOBUFS); + sc->vte_cdata.vte_txmbufs[i]->m_pkthdr.len = MCLBYTES; + sc->vte_cdata.vte_txmbufs[i]->m_len = MCLBYTES; + } + } + desc = sc->vte_cdata.vte_tx_ring; + bzero(desc, VTE_TX_RING_SZ); + for (i = 0; i < VTE_TX_RING_CNT; i++) { + txd = &sc->vte_cdata.vte_txdesc[i]; + txd->tx_m = NULL; + if (i != VTE_TX_RING_CNT - 1) + addr = sc->vte_cdata.vte_tx_ring_paddr + + sizeof(struct vte_tx_desc) * (i + 1); + else + addr = sc->vte_cdata.vte_tx_ring_paddr + + sizeof(struct vte_tx_desc) * 0; + desc = &sc->vte_cdata.vte_tx_ring[i]; + desc->dtnp = htole32(addr); + txd->tx_desc = desc; + } + + bus_dmamap_sync(sc->vte_cdata.vte_tx_ring_tag, + sc->vte_cdata.vte_tx_ring_map, BUS_DMASYNC_PREREAD | + BUS_DMASYNC_PREWRITE); + return (0); +} + +static int +vte_init_rx_ring(struct vte_softc *sc) +{ + struct vte_rx_desc *desc; + struct vte_rxdesc *rxd; + bus_addr_t addr; + int i; + + VTE_LOCK_ASSERT(sc); + + sc->vte_cdata.vte_rx_cons = 0; + desc = sc->vte_cdata.vte_rx_ring; + bzero(desc, VTE_RX_RING_SZ); + for (i = 0; i < VTE_RX_RING_CNT; i++) { + rxd = &sc->vte_cdata.vte_rxdesc[i]; + rxd->rx_m = NULL; + if (i != VTE_RX_RING_CNT - 1) + addr = sc->vte_cdata.vte_rx_ring_paddr + + sizeof(struct vte_rx_desc) * (i + 1); + else + addr = sc->vte_cdata.vte_rx_ring_paddr + + sizeof(struct vte_rx_desc) * 0; + desc = &sc->vte_cdata.vte_rx_ring[i]; + desc->drnp = htole32(addr); + rxd->rx_desc = desc; + if (vte_newbuf(sc, rxd) != 0) + return (ENOBUFS); + } + + bus_dmamap_sync(sc->vte_cdata.vte_rx_ring_tag, + sc->vte_cdata.vte_rx_ring_map, BUS_DMASYNC_PREREAD | + BUS_DMASYNC_PREWRITE); + + return (0); +} + +static void +vte_rxfilter(struct vte_softc *sc) +{ + struct ifnet *ifp; + struct ifmultiaddr *ifma; + uint8_t *eaddr; + uint32_t crc; + uint16_t rxfilt_perf[VTE_RXFILT_PERFECT_CNT][3]; + uint16_t mchash[4], mcr; + int i, nperf; + + VTE_LOCK_ASSERT(sc); + + ifp = sc->vte_ifp; + + bzero(mchash, sizeof(mchash)); + for (i = 0; i < VTE_RXFILT_PERFECT_CNT; i++) { + rxfilt_perf[i][0] = 0xFFFF; + rxfilt_perf[i][1] = 0xFFFF; + rxfilt_perf[i][2] = 0xFFFF; + } + + mcr = CSR_READ_2(sc, VTE_MCR0); + mcr &= ~(MCR0_PROMISC | MCR0_MULTICAST); + mcr |= MCR0_BROADCAST_DIS; + if ((ifp->if_flags & IFF_BROADCAST) != 0) + mcr &= ~MCR0_BROADCAST_DIS; + if ((ifp->if_flags & (IFF_PROMISC | IFF_ALLMULTI)) != 0) { + if ((ifp->if_flags & IFF_PROMISC) != 0) + mcr |= MCR0_PROMISC; + if ((ifp->if_flags & IFF_ALLMULTI) != 0) + mcr |= MCR0_MULTICAST; + mchash[0] = 0xFFFF; + mchash[1] = 0xFFFF; + mchash[2] = 0xFFFF; + mchash[3] = 0xFFFF; + goto chipit; + } + + nperf = 0; + if_maddr_rlock(ifp); + TAILQ_FOREACH(ifma, &sc->vte_ifp->if_multiaddrs, ifma_link) { + if (ifma->ifma_addr->sa_family != AF_LINK) + continue; + /* + * Program the first 3 multicast groups into + * the perfect filter. For all others, use the + * hash table. + */ + if (nperf < VTE_RXFILT_PERFECT_CNT) { + eaddr = LLADDR((struct sockaddr_dl *)ifma->ifma_addr); + rxfilt_perf[nperf][0] = eaddr[1] << 8 | eaddr[0]; + rxfilt_perf[nperf][1] = eaddr[3] << 8 | eaddr[2]; + rxfilt_perf[nperf][2] = eaddr[5] << 8 | eaddr[4]; + nperf++; + continue; + } + crc = ether_crc32_be(LLADDR((struct sockaddr_dl *) + ifma->ifma_addr), ETHER_ADDR_LEN); + mchash[crc >> 30] |= 1 << ((crc >> 26) & 0x0F); + } + if_maddr_runlock(ifp); + if (mchash[0] != 0 || mchash[1] != 0 || mchash[2] != 0 || + mchash[3] != 0) + mcr |= MCR0_MULTICAST; + +chipit: + /* Program multicast hash table. */ + CSR_WRITE_2(sc, VTE_MAR0, mchash[0]); + CSR_WRITE_2(sc, VTE_MAR1, mchash[1]); + CSR_WRITE_2(sc, VTE_MAR2, mchash[2]); + CSR_WRITE_2(sc, VTE_MAR3, mchash[3]); + /* Program perfect filter table. */ + for (i = 0; i < VTE_RXFILT_PERFECT_CNT; i++) { + CSR_WRITE_2(sc, VTE_RXFILTER_PEEFECT_BASE + 8 * i + 0, + rxfilt_perf[i][0]); + CSR_WRITE_2(sc, VTE_RXFILTER_PEEFECT_BASE + 8 * i + 2, + rxfilt_perf[i][1]); + CSR_WRITE_2(sc, VTE_RXFILTER_PEEFECT_BASE + 8 * i + 4, + rxfilt_perf[i][2]); + } + CSR_WRITE_2(sc, VTE_MCR0, mcr); + CSR_READ_2(sc, VTE_MCR0); +} + +static int +sysctl_int_range(SYSCTL_HANDLER_ARGS, int low, int high) +{ + int error, value; + + if (arg1 == NULL) + return (EINVAL); + value = *(int *)arg1; + error = sysctl_handle_int(oidp, &value, 0, req); + if (error || req->newptr == NULL) + return (error); + if (value < low || value > high) + return (EINVAL); + *(int *)arg1 = value; + + return (0); +} + +static int +sysctl_hw_vte_int_mod(SYSCTL_HANDLER_ARGS) +{ + + return (sysctl_int_range(oidp, arg1, arg2, req, + VTE_IM_BUNDLE_MIN, VTE_IM_BUNDLE_MAX)); +} diff --git a/src/add-ons/kernel/drivers/network/rdc/dev/vte/if_vtereg.h b/src/add-ons/kernel/drivers/network/rdc/dev/vte/if_vtereg.h new file mode 100644 index 0000000000..536617b88c --- /dev/null +++ b/src/add-ons/kernel/drivers/network/rdc/dev/vte/if_vtereg.h @@ -0,0 +1,346 @@ +/*- + * Copyright (c) 2010, Pyun YongHyeon + * 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 unmodified, 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$ + */ + +#ifndef _IF_VTEREG_H +#define _IF_VTEREG_H + +/* + * RDC Semiconductor PCI vendor ID + */ +#define VENDORID_RDC 0x17F3 + +/* + * Vortex86 RDC R6040 FastEthernet device ID + */ +#define DEVICEID_RDC_R6040 0x6040 /* PMX-1000 */ + +/* MAC control register 0 */ +#define VTE_MCR0 0x00 +#define MCR0_ACCPT_ERR 0x0001 +#define MCR0_RX_ENB 0x0002 +#define MCR0_ACCPT_RUNT 0x0004 +#define MCR0_ACCPT_LONG_PKT 0x0008 +#define MCR0_ACCPT_DRIBBLE 0x0010 +#define MCR0_PROMISC 0x0020 +#define MCR0_BROADCAST_DIS 0x0040 +#define MCR0_RX_EARLY_INTR 0x0080 +#define MCR0_MULTICAST 0x0100 +#define MCR0_FC_ENB 0x0200 +#define MCR0_TX_ENB 0x1000 +#define MCR0_TX_EARLY_INTR 0x4000 +#define MCR0_FULL_DUPLEX 0x8000 + +/* MAC control register 1 */ +#define VTE_MCR1 0x04 +#define MCR1_MAC_RESET 0x0001 +#define MCR1_MAC_LOOPBACK 0x0002 +#define MCR1_EXCESS_COL_RETRANS_DIS 0x0004 +#define MCR1_AUTO_CHG_DUPLEX 0x0008 +#define MCR1_PKT_LENGTH_1518 0x0010 +#define MCR1_PKT_LENGTH_1522 0x0020 +#define MCR1_PKT_LENGTH_1534 0x0030 +#define MCR1_PKT_LENGTH_1537 0x0000 +#define MCR1_EARLY_INTR_THRESH_1129 0x0000 +#define MCR1_EARLY_INTR_THRESH_1257 0x0040 +#define MCR1_EARLY_INTR_THRESH_1385 0x0080 +#define MCR1_EARLY_INTR_THRESH_1513 0x00C0 +#define MCR1_EXCESS_COL_RETRY_16 0x0000 +#define MCR1_EXCESS_COL_RETRY_32 0x0100 +#define MCR1_FC_ACTIVE 0x0200 +#define MCR1_RX_DESC_HASH_IDX 0x4000 +#define MCR1_RX_UNICAST_HASH 0x8000 + +#define MCR1_PKT_LENGTH_MASK 0x0030 +#define MCR1_EARLY_INTR_THRESH_MASK 0x00C0 + +/* MAC bus control register */ +#define VTE_MBCR 0x08 +#define MBCR_FIFO_XFER_LENGTH_4 0x0000 +#define MBCR_FIFO_XFER_LENGTH_8 0x0001 +#define MBCR_FIFO_XFER_LENGTH_16 0x0002 +#define MBCR_FIFO_XFER_LENGTH_32 0x0003 +#define MBCR_TX_FIFO_THRESH_16 0x0000 +#define MBCR_TX_FIFO_THRESH_32 0x0004 +#define MBCR_TX_FIFO_THRESH_64 0x0008 +#define MBCR_TX_FIFO_THRESH_96 0x000C +#define MBCR_RX_FIFO_THRESH_8 0x0000 +#define MBCR_RX_FIFO_THRESH_16 0x0010 +#define MBCR_RX_FIFO_THRESH_32 0x0020 +#define MBCR_RX_FIFO_THRESH_64 0x0030 +#define MBCR_SDRAM_BUS_REQ_TIMER_MASK 0x1F00 +#define MBCR_SDRAM_BUS_REQ_TIMER_SHIFT 8 +#define MBCR_SDRAM_BUS_REQ_TIMER_DEFAULT 0x1F00 + +/* MAC TX interrupt control register */ +#define VTE_MTICR 0x0C +#define MTICR_TX_TIMER_MASK 0x001F +#define MTICR_TX_BUNDLE_MASK 0x0F00 +#define VTE_IM_TX_TIMER_DEFAULT 0x7F +#define VTE_IM_TX_BUNDLE_DEFAULT 15 + +#define VTE_IM_TIMER_MIN 0 +#define VTE_IM_TIMER_MAX 82 +#define VTE_IM_TIMER_MASK 0x001F +#define VTE_IM_TIMER_SHIFT 0 +#define VTE_IM_BUNDLE_MIN 1 +#define VTE_IM_BUNDLE_MAX 15 +#define VTE_IM_BUNDLE_SHIFT 8 + +/* MAC RX interrupt control register */ +#define VTE_MRICR 0x10 +#define MRICR_RX_TIMER_MASK 0x001F +#define MRICR_RX_BUNDLE_MASK 0x0F00 +#define VTE_IM_RX_TIMER_DEFAULT 0x7F +#define VTE_IM_RX_BUNDLE_DEFAULT 15 + +/* MAC TX poll command register */ +#define VTE_TX_POLL 0x14 +#define TX_POLL_START 0x0001 + +/* MAC RX buffer size register */ +#define VTE_MRBSR 0x18 +#define VTE_MRBSR_SIZE_MASK 0x03FF + +/* MAC RX descriptor control register */ +#define VTE_MRDCR 0x1A +#define VTE_MRDCR_RESIDUE_MASK 0x00FF +#define VTE_MRDCR_RX_PAUSE_THRESH_MASK 0xFF00 +#define VTE_MRDCR_RX_PAUSE_THRESH_SHIFT 8 + +/* MAC Last status register */ +#define VTE_MLSR 0x1C +#define MLSR_MULTICAST 0x0001 +#define MLSR_BROADCAST 0x0002 +#define MLSR_CRC_ERR 0x0004 +#define MLSR_RUNT 0x0008 +#define MLSR_LONG_PKT 0x0010 +#define MLSR_TRUNC 0x0020 +#define MLSR_DRIBBLE 0x0040 +#define MLSR_PHY_ERR 0x0080 +#define MLSR_TX_FIFO_UNDERRUN 0x0200 +#define MLSR_RX_DESC_UNAVAIL 0x0400 +#define MLSR_TX_EXCESS_COL 0x2000 +#define MLSR_TX_LATE_COL 0x4000 +#define MLSR_RX_FIFO_OVERRUN 0x8000 + +/* MAC MDIO control register */ +#define VTE_MMDIO 0x20 +#define MMDIO_REG_ADDR_MASK 0x001F +#define MMDIO_PHY_ADDR_MASK 0x1F00 +#define MMDIO_READ 0x2000 +#define MMDIO_WRITE 0x4000 +#define MMDIO_REG_ADDR_SHIFT 0 +#define MMDIO_PHY_ADDR_SHIFT 8 + +/* MAC MDIO read data register */ +#define VTE_MMRD 0x24 +#define MMRD_DATA_MASK 0xFFFF + +/* MAC MDIO write data register */ +#define VTE_MMWD 0x28 +#define MMWD_DATA_MASK 0xFFFF + +/* MAC TX descriptor start address 0 */ +#define VTE_MTDSA0 0x2C + +/* MAC TX descriptor start address 1 */ +#define VTE_MTDSA1 0x30 + +/* MAC RX descriptor start address 0 */ +#define VTE_MRDSA0 0x34 + +/* MAC RX descriptor start address 1 */ +#define VTE_MRDSA1 0x38 + +/* MAC Interrupt status register */ +#define VTE_MISR 0x3C +#define MISR_RX_DONE 0x0001 +#define MISR_RX_DESC_UNAVAIL 0x0002 +#define MISR_RX_FIFO_FULL 0x0004 +#define MISR_RX_EARLY_INTR 0x0008 +#define MISR_TX_DONE 0x0010 +#define MISR_TX_EARLY_INTR 0x0080 +#define MISR_EVENT_CNT_OFLOW 0x0100 +#define MISR_PHY_MEDIA_CHG 0x0200 + +/* MAC Interrupt enable register */ +#define VTE_MIER 0x40 + +#define VTE_INTRS \ + (MISR_RX_DONE | MISR_RX_DESC_UNAVAIL | MISR_RX_FIFO_FULL | \ + MISR_TX_DONE | MISR_EVENT_CNT_OFLOW) + +/* MAC Event counter interrupt status register */ +#define VTE_MECISR 0x44 +#define MECISR_EC_RX_DONE 0x0001 +#define MECISR_EC_MULTICAST 0x0002 +#define MECISR_EC_BROADCAST 0x0004 +#define MECISR_EC_CRC_ERR 0x0008 +#define MECISR_EC_RUNT 0x0010 +#define MESCIR_EC_LONG_PKT 0x0020 +#define MESCIR_EC_RX_DESC_UNAVAIL 0x0080 +#define MESCIR_EC_RX_FIFO_FULL 0x0100 +#define MESCIR_EC_TX_DONE 0x0200 +#define MESCIR_EC_LATE_COL 0x0400 +#define MESCIR_EC_TX_UNDERRUN 0x0800 + +/* MAC Event counter interrupt enable register */ +#define VTE_MECIER 0x48 +#define VTE_MECIER_INTRS \ + (MECISR_EC_RX_DONE | MECISR_EC_MULTICAST | MECISR_EC_BROADCAST | \ + MECISR_EC_CRC_ERR | MECISR_EC_RUNT | MESCIR_EC_LONG_PKT | \ + MESCIR_EC_RX_DESC_UNAVAIL | MESCIR_EC_RX_FIFO_FULL | \ + MESCIR_EC_TX_DONE | MESCIR_EC_LATE_COL | MESCIR_EC_TX_UNDERRUN) + +#define VTE_CNT_RX_DONE 0x50 + +#define VTE_CNT_MECNT0 0x52 + +#define VTE_CNT_MECNT1 0x54 + +#define VTE_CNT_MECNT2 0x56 + +#define VTE_CNT_MECNT3 0x58 + +#define VTE_CNT_TX_DONE 0x5A + +#define VTE_CNT_MECNT4 0x5C + +#define VTE_CNT_PAUSE 0x5E + +/* MAC Hash table register */ +#define VTE_MAR0 0x60 +#define VTE_MAR1 0x62 +#define VTE_MAR2 0x64 +#define VTE_MAR3 0x66 + +/* MAC station address and multicast address register */ +#define VTE_MID0L 0x68 +#define VTE_MID0M 0x6A +#define VTE_MID0H 0x6C +#define VTE_MID1L 0x70 +#define VTE_MID1M 0x72 +#define VTE_MID1H 0x74 +#define VTE_MID2L 0x78 +#define VTE_MID2M 0x7A +#define VTE_MID2H 0x7C +#define VTE_MID3L 0x80 +#define VTE_MID3M 0x82 +#define VTE_MID3H 0x84 + +#define VTE_RXFILTER_PEEFECT_BASE VTE_MID1L +#define VTE_RXFILT_PERFECT_CNT 3 + +/* MAC PHY status change configuration register */ +#define VTE_MPSCCR 0x88 +#define MPSCCR_TIMER_DIVIDER_MASK 0x0007 +#define MPSCCR_PHY_ADDR_MASK 0x1F00 +#define MPSCCR_PHY_STS_CHG_ENB 0x8000 +#define MPSCCR_PHY_ADDR_SHIFT 8 + +/* MAC PHY status register2 */ +#define VTE_MPSR 0x8A +#define MPSR_LINK_UP 0x0001 +#define MPSR_SPEED_100 0x0002 +#define MPSR_FULL_DUPLEX 0x0004 + +/* MAC Status machine(undocumented). */ +#define VTE_MACSM 0xAC + +/* MDC Speed control register */ +#define VTE_MDCSC 0xB6 +#define MDCSC_DEFAULT 0x0030 + +/* MAC Identifier and revision register */ +#define VTE_MACID_REV 0xBC +#define VTE_MACID_REV_MASK 0x00FF +#define VTE_MACID_MASK 0xFF00 +#define VTE_MACID_REV_SHIFT 0 +#define VTE_MACID_SHIFT 8 + +/* MAC Identifier register */ +#define VTE_MACID 0xBE + +/* + * RX descriptor + * - Added one more uint16_t member to align it 4 on bytes boundary. + * This does not affect operation of controller since it includes + * next pointer address. + */ +struct vte_rx_desc { + uint16_t drst; + uint16_t drlen; + uint32_t drbp; + uint32_t drnp; + uint16_t hidx; + uint16_t rsvd2; + uint16_t rsvd3; + uint16_t __pad; /* Not actual descriptor member. */ +}; + +#define VTE_DRST_MID_MASK 0x0003 +#define VTE_DRST_MID_HIT 0x0004 +#define VTE_DRST_MULTICAST_HIT 0x0008 +#define VTE_DRST_MULTICAST 0x0010 +#define VTE_DRST_BROADCAST 0x0020 +#define VTE_DRST_CRC_ERR 0x0040 +#define VTE_DRST_RUNT 0x0080 +#define VTE_DRST_LONG 0x0100 +#define VTE_DRST_TRUNC 0x0200 +#define VTE_DRST_DRIBBLE 0x0400 +#define VTE_DRST_PHY_ERR 0x0800 +#define VTE_DRST_RX_OK 0x4000 +#define VTE_DRST_RX_OWN 0x8000 + +#define VTE_RX_LEN(x) ((x) & 0x7FF) + +#define VTE_RX_HIDX(x) ((x) & 0x3F) + +/* + * TX descriptor + * - Added one more uint32_t member to align it on 16 bytes boundary. + */ +struct vte_tx_desc { + uint16_t dtst; + uint16_t dtlen; + uint32_t dtbp; + uint32_t dtnp; + uint32_t __pad; /* Not actual descriptor member. */ +}; + +#define VTE_DTST_EXCESS_COL 0x0010 +#define VTE_DTST_LATE_COL 0x0020 +#define VTE_DTST_UNDERRUN 0x0040 +#define VTE_DTST_NO_CRC 0x2000 +#define VTE_DTST_TX_OK 0x4000 +#define VTE_DTST_TX_OWN 0x8000 + +#define VTE_TX_LEN(x) ((x) & 0x7FF) + +#endif /* _IF_VTEREG_H */ diff --git a/src/add-ons/kernel/drivers/network/rdc/dev/vte/if_vtevar.h b/src/add-ons/kernel/drivers/network/rdc/dev/vte/if_vtevar.h new file mode 100644 index 0000000000..a8e79d09c6 --- /dev/null +++ b/src/add-ons/kernel/drivers/network/rdc/dev/vte/if_vtevar.h @@ -0,0 +1,163 @@ +/*- + * Copyright (c) 2010, Pyun YongHyeon + * 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 unmodified, 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$ + */ + +#ifndef _IF_VTEVAR_H +#define _IF_VTEVAR_H + +#define VTE_TX_RING_CNT 64 +#define VTE_TX_RING_ALIGN 16 +/* + * The TX/RX descriptor format has no limitation for number of + * descriptors in TX/RX ring. However, the maximum number of + * descriptors that could be set as RX descriptor ring residue + * counter is 255. This effectively limits number of RX + * descriptors available to be less than or equal to 255. + */ +#define VTE_RX_RING_CNT 128 +#define VTE_RX_RING_ALIGN 16 +#define VTE_RX_BUF_ALIGN 4 + +#define VTE_DESC_INC(x, y) ((x) = ((x) + 1) % (y)) + +#define VTE_TX_RING_SZ \ + (sizeof(struct vte_tx_desc) * VTE_TX_RING_CNT) +#define VTE_RX_RING_SZ \ + (sizeof(struct vte_rx_desc) * VTE_RX_RING_CNT) + +#define VTE_RX_BUF_SIZE_MAX (MCLBYTES - sizeof(uint32_t)) + +#define VTE_MIN_FRAMELEN (ETHER_MIN_LEN - ETHER_CRC_LEN) + +struct vte_rxdesc { + struct mbuf *rx_m; + bus_dmamap_t rx_dmamap; + struct vte_rx_desc *rx_desc; +}; + +struct vte_txdesc { + struct mbuf *tx_m; + bus_dmamap_t tx_dmamap; + struct vte_tx_desc *tx_desc; + int tx_flags; +#define VTE_TXMBUF 0x0001 +}; + +struct vte_chain_data { + bus_dma_tag_t vte_parent_tag; + bus_dma_tag_t vte_buffer_tag; + bus_dma_tag_t vte_tx_tag; + struct vte_txdesc vte_txdesc[VTE_TX_RING_CNT]; + struct mbuf *vte_txmbufs[VTE_TX_RING_CNT]; + bus_dma_tag_t vte_rx_tag; + struct vte_rxdesc vte_rxdesc[VTE_RX_RING_CNT]; + bus_dma_tag_t vte_tx_ring_tag; + bus_dmamap_t vte_tx_ring_map; + bus_dma_tag_t vte_rx_ring_tag; + bus_dmamap_t vte_rx_ring_map; + bus_dmamap_t vte_rx_sparemap; + struct vte_tx_desc *vte_tx_ring; + bus_addr_t vte_tx_ring_paddr; + struct vte_rx_desc *vte_rx_ring; + bus_addr_t vte_rx_ring_paddr; + + int vte_tx_prod; + int vte_tx_cons; + int vte_tx_cnt; + int vte_rx_cons; +}; + +struct vte_hw_stats { + /* RX stats. */ + uint32_t rx_frames; + uint32_t rx_bcast_frames; + uint32_t rx_mcast_frames; + uint32_t rx_runts; + uint32_t rx_crcerrs; + uint32_t rx_long_frames; + uint32_t rx_fifo_full; + uint32_t rx_desc_unavail; + uint32_t rx_pause_frames; + + /* TX stats. */ + uint32_t tx_frames; + uint32_t tx_underruns; + uint32_t tx_late_colls; + uint32_t tx_pause_frames; +}; + +struct vte_ident { + uint16_t vendorid; + uint16_t deviceid; + const char *name; +}; + +/* + * Software state per device. + */ +struct vte_softc { + struct ifnet *vte_ifp; + device_t vte_dev; + device_t vte_miibus; + struct resource *vte_res; + int vte_res_id; + int vte_res_type; + struct resource *vte_irq; + void *vte_intrhand; + const struct vte_ident *vte_ident; + uint8_t vte_eaddr[ETHER_ADDR_LEN]; + int vte_flags; +#define VTE_FLAG_LINK 0x8000 + + struct callout vte_tick_ch; + struct vte_hw_stats vte_stats; + struct vte_chain_data vte_cdata; + int vte_if_flags; + int vte_watchdog_timer; + int vte_int_rx_mod; + int vte_int_tx_mod; + + struct mtx vte_mtx; +}; + +/* Register access macros. */ +#define CSR_WRITE_2(_sc, reg, val) \ + bus_write_2((_sc)->vte_res, (reg), (val)) +#define CSR_READ_2(_sc, reg) \ + bus_read_2((_sc)->vte_res, (reg)) + +#define VTE_LOCK(_sc) mtx_lock(&(_sc)->vte_mtx) +#define VTE_UNLOCK(_sc) mtx_unlock(&(_sc)->vte_mtx) +#define VTE_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->vte_mtx, MA_OWNED) + +#define VTE_TX_TIMEOUT 5 +#define VTE_RESET_TIMEOUT 100 +#define VTE_TIMEOUT 1000 +#define VTE_PHY_TIMEOUT 1000 + +#endif /* _IF_VTEVAR_H */ diff --git a/src/add-ons/kernel/drivers/network/rtl8139/pci/if_rl.c b/src/add-ons/kernel/drivers/network/rtl8139/pci/if_rl.c index ab60d68229..8cd6a91bc3 100644 --- a/src/add-ons/kernel/drivers/network/rtl8139/pci/if_rl.c +++ b/src/add-ons/kernel/drivers/network/rtl8139/pci/if_rl.c @@ -31,7 +31,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/pci/if_rl.c,v 1.189.2.8.2.1 2010/12/21 17:09:25 kensmith Exp $"); +__FBSDID("$FreeBSD$"); /* * RealTek 8129/8139 PCI NIC driver @@ -239,16 +239,12 @@ static device_method_t rl_methods[] = { DEVMETHOD(device_resume, rl_resume), DEVMETHOD(device_shutdown, rl_shutdown), - /* bus interface */ - DEVMETHOD(bus_print_child, bus_generic_print_child), - DEVMETHOD(bus_driver_added, bus_generic_driver_added), - /* MII interface */ DEVMETHOD(miibus_readreg, rl_miibus_readreg), DEVMETHOD(miibus_writereg, rl_miibus_writereg), DEVMETHOD(miibus_statchg, rl_miibus_statchg), - { 0, 0 } + DEVMETHOD_END }; static driver_t rl_driver = { @@ -721,6 +717,13 @@ rl_attach(device_t dev) goto fail; } + sc->rl_cfg0 = RL_8139_CFG0; + sc->rl_cfg1 = RL_8139_CFG1; + sc->rl_cfg2 = 0; + sc->rl_cfg3 = RL_8139_CFG3; + sc->rl_cfg4 = RL_8139_CFG4; + sc->rl_cfg5 = RL_8139_CFG5; + /* * Reset the adapter. Only take the lock here as it's needed in * order to call rl_reset(). @@ -822,6 +825,7 @@ rl_attach(device_t dev) } } ifp->if_capenable = ifp->if_capabilities; + ifp->if_capenable &= ~(IFCAP_WOL_UCAST | IFCAP_WOL_MCAST); #ifdef DEVICE_POLLING ifp->if_capabilities |= IFCAP_POLLING; #endif @@ -1758,7 +1762,7 @@ rl_init_locked(struct rl_softc *sc) sc->rl_flags &= ~RL_FLAG_LINK; mii_mediachg(mii); - CSR_WRITE_1(sc, RL_CFG1, RL_CFG1_DRVLOAD|RL_CFG1_FULLDUPLEX); + CSR_WRITE_1(sc, sc->rl_cfg1, RL_CFG1_DRVLOAD|RL_CFG1_FULLDUPLEX); ifp->if_drv_flags |= IFF_DRV_RUNNING; ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; @@ -1797,9 +1801,9 @@ rl_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr) RL_LOCK(sc); mii_pollstat(mii); - RL_UNLOCK(sc); ifmr->ifm_active = mii->mii_media_active; ifmr->ifm_status = mii->mii_media_status; + RL_UNLOCK(sc); } static int @@ -2059,22 +2063,19 @@ rl_setwol(struct rl_softc *sc) CSR_WRITE_1(sc, RL_EECMD, RL_EE_MODE); /* Enable PME. */ - v = CSR_READ_1(sc, RL_CFG1); + v = CSR_READ_1(sc, sc->rl_cfg1); v &= ~RL_CFG1_PME; if ((ifp->if_capenable & IFCAP_WOL) != 0) v |= RL_CFG1_PME; - CSR_WRITE_1(sc, RL_CFG1, v); + CSR_WRITE_1(sc, sc->rl_cfg1, v); - v = CSR_READ_1(sc, RL_CFG3); + v = CSR_READ_1(sc, sc->rl_cfg3); v &= ~(RL_CFG3_WOL_LINK | RL_CFG3_WOL_MAGIC); if ((ifp->if_capenable & IFCAP_WOL_MAGIC) != 0) v |= RL_CFG3_WOL_MAGIC; - CSR_WRITE_1(sc, RL_CFG3, v); + CSR_WRITE_1(sc, sc->rl_cfg3, v); - /* Config register write done. */ - CSR_WRITE_1(sc, RL_EECMD, RL_EEMODE_OFF); - - v = CSR_READ_1(sc, RL_CFG5); + v = CSR_READ_1(sc, sc->rl_cfg5); v &= ~(RL_CFG5_WOL_BCAST | RL_CFG5_WOL_MCAST | RL_CFG5_WOL_UCAST); v &= ~RL_CFG5_WOL_LANWAKE; if ((ifp->if_capenable & IFCAP_WOL_UCAST) != 0) @@ -2083,7 +2084,11 @@ rl_setwol(struct rl_softc *sc) v |= RL_CFG5_WOL_MCAST | RL_CFG5_WOL_BCAST; if ((ifp->if_capenable & IFCAP_WOL) != 0) v |= RL_CFG5_WOL_LANWAKE; - CSR_WRITE_1(sc, RL_CFG5, v); + CSR_WRITE_1(sc, sc->rl_cfg5, v); + + /* Config register write done. */ + CSR_WRITE_1(sc, RL_EECMD, RL_EEMODE_OFF); + /* Request PME if WOL is requested. */ pmstat = pci_read_config(sc->rl_dev, pmc + PCIR_POWER_STATUS, 2); pmstat &= ~(PCIM_PSTAT_PME | PCIM_PSTAT_PMEENABLE); @@ -2105,15 +2110,15 @@ rl_clrwol(struct rl_softc *sc) /* Enable config register write. */ CSR_WRITE_1(sc, RL_EECMD, RL_EE_MODE); - v = CSR_READ_1(sc, RL_CFG3); + v = CSR_READ_1(sc, sc->rl_cfg3); v &= ~(RL_CFG3_WOL_LINK | RL_CFG3_WOL_MAGIC); - CSR_WRITE_1(sc, RL_CFG3, v); + CSR_WRITE_1(sc, sc->rl_cfg3, v); /* Config register write done. */ CSR_WRITE_1(sc, RL_EECMD, RL_EEMODE_OFF); - v = CSR_READ_1(sc, RL_CFG5); + v = CSR_READ_1(sc, sc->rl_cfg5); v &= ~(RL_CFG5_WOL_BCAST | RL_CFG5_WOL_MCAST | RL_CFG5_WOL_UCAST); v &= ~RL_CFG5_WOL_LANWAKE; - CSR_WRITE_1(sc, RL_CFG5, v); + CSR_WRITE_1(sc, sc->rl_cfg5, v); } diff --git a/src/add-ons/kernel/drivers/network/rtl8139/pci/if_rlreg.h b/src/add-ons/kernel/drivers/network/rtl8139/pci/if_rlreg.h index d8732c1b0e..7822ce3654 100644 --- a/src/add-ons/kernel/drivers/network/rtl8139/pci/if_rlreg.h +++ b/src/add-ons/kernel/drivers/network/rtl8139/pci/if_rlreg.h @@ -29,7 +29,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/sys/pci/if_rlreg.h,v 1.97.2.8.2.1 2010/12/21 17:09:25 kensmith Exp $ + * $FreeBSD$ */ /* @@ -74,6 +74,14 @@ #define RL_TIMERCNT 0x0048 /* timer count register */ #define RL_MISSEDPKT 0x004C /* missed packet counter */ #define RL_EECMD 0x0050 /* EEPROM command register */ + +/* RTL8139/RTL8139C+ only */ +#define RL_8139_CFG0 0x0051 /* config register #0 */ +#define RL_8139_CFG1 0x0052 /* config register #1 */ +#define RL_8139_CFG3 0x0059 /* config register #3 */ +#define RL_8139_CFG4 0x005A /* config register #4 */ +#define RL_8139_CFG5 0x00D8 /* config register #5 */ + #define RL_CFG0 0x0051 /* config register #0 */ #define RL_CFG1 0x0052 /* config register #1 */ #define RL_CFG2 0x0053 /* config register #2 */ @@ -143,6 +151,7 @@ */ #define RL_TXCFG_CLRABRT 0x00000001 /* retransmit aborted pkt */ #define RL_TXCFG_MAXDMA 0x00000700 /* max DMA burst size */ +#define RL_TXCFG_QUEUE_EMPTY 0x00000800 /* 8168E-VL or higher */ #define RL_TXCFG_CRCAPPEND 0x00010000 /* CRC append (0 = yes) */ #define RL_TXCFG_LOOPBKTST 0x00060000 /* loopback test */ #define RL_TXCFG_IFG2 0x00080000 /* 8169 only */ @@ -178,6 +187,10 @@ #define RL_HWREV_8168C_SPIN2 0x3C400000 #define RL_HWREV_8168CP 0x3C800000 #define RL_HWREV_8105E 0x40800000 +#define RL_HWREV_8105E_SPIN1 0x40C00000 +#define RL_HWREV_8402 0x44000000 +#define RL_HWREV_8168F 0x48000000 +#define RL_HWREV_8411 0x48800000 #define RL_HWREV_8139 0x60000000 #define RL_HWREV_8139A 0x70000000 #define RL_HWREV_8139AG 0x70800000 @@ -866,7 +879,14 @@ struct rl_softc { const struct rl_hwrev *rl_hwrev; int rl_eecmd_read; int rl_eewidth; + int rl_expcap; int rl_txthresh; + bus_size_t rl_cfg0; + bus_size_t rl_cfg1; + bus_size_t rl_cfg2; + bus_size_t rl_cfg3; + bus_size_t rl_cfg4; + bus_size_t rl_cfg5; struct rl_chain_data rl_cdata; struct rl_list_data rl_ldata; struct callout rl_stat_callout; @@ -892,22 +912,25 @@ struct rl_softc { int rl_int_rx_act; int rl_int_rx_mod; uint32_t rl_flags; -#define RL_FLAG_MSI 0x0001 -#define RL_FLAG_AUTOPAD 0x0002 -#define RL_FLAG_PHYWAKE_PM 0x0004 -#define RL_FLAG_PHYWAKE 0x0008 -#define RL_FLAG_JUMBOV2 0x0010 -#define RL_FLAG_PAR 0x0020 -#define RL_FLAG_DESCV2 0x0040 -#define RL_FLAG_MACSTAT 0x0080 -#define RL_FLAG_FASTETHER 0x0100 -#define RL_FLAG_CMDSTOP 0x0200 -#define RL_FLAG_MACRESET 0x0400 -#define RL_FLAG_MSIX 0x0800 -#define RL_FLAG_WOLRXENB 0x1000 -#define RL_FLAG_MACSLEEP 0x2000 -#define RL_FLAG_PCIE 0x4000 -#define RL_FLAG_LINK 0x8000 +#define RL_FLAG_MSI 0x00000001 +#define RL_FLAG_AUTOPAD 0x00000002 +#define RL_FLAG_PHYWAKE_PM 0x00000004 +#define RL_FLAG_PHYWAKE 0x00000008 +#define RL_FLAG_JUMBOV2 0x00000010 +#define RL_FLAG_PAR 0x00000020 +#define RL_FLAG_DESCV2 0x00000040 +#define RL_FLAG_MACSTAT 0x00000080 +#define RL_FLAG_FASTETHER 0x00000100 +#define RL_FLAG_CMDSTOP 0x00000200 +#define RL_FLAG_MACRESET 0x00000400 +#define RL_FLAG_MSIX 0x00000800 +#define RL_FLAG_WOLRXENB 0x00001000 +#define RL_FLAG_MACSLEEP 0x00002000 +#define RL_FLAG_WAIT_TXPOLL 0x00004000 +#define RL_FLAG_CMDSTOP_WAIT_TXQ 0x00008000 +#define RL_FLAG_WOL_MANLINK 0x00010000 +#define RL_FLAG_PCIE 0x40000000 +#define RL_FLAG_LINK 0x80000000 }; #define RL_LOCK(_sc) mtx_lock(&(_sc)->rl_mtx) diff --git a/src/add-ons/kernel/drivers/network/rtl81xx/dev/mii/rgephy.c b/src/add-ons/kernel/drivers/network/rtl81xx/dev/mii/rgephy.c index 6d54542723..aadc6fd967 100644 --- a/src/add-ons/kernel/drivers/network/rtl81xx/dev/mii/rgephy.c +++ b/src/add-ons/kernel/drivers/network/rtl81xx/dev/mii/rgephy.c @@ -68,7 +68,7 @@ static device_method_t rgephy_methods[] = { DEVMETHOD(device_attach, rgephy_attach), DEVMETHOD(device_detach, mii_phy_detach), DEVMETHOD(device_shutdown, bus_generic_shutdown), - { 0, 0 } + DEVMETHOD_END }; static devclass_t rgephy_devclass; @@ -110,10 +110,15 @@ static int rgephy_attach(device_t dev) { struct mii_softc *sc; + struct mii_attach_args *ma; + u_int flags; sc = device_get_softc(dev); - - mii_phy_dev_attach(dev, 0, &rgephy_funcs, 0); + ma = device_get_ivars(dev); + flags = 0; + if (strcmp(ma->mii_data->mii_ifp->if_dname, "re") == 0) + flags |= MIIF_PHYPRIV0; + mii_phy_dev_attach(dev, flags, &rgephy_funcs, 0); /* RTL8169S do not report auto-sense; add manually. */ sc->mii_capabilities = (PHY_READ(sc, MII_BMSR) | BMSR_ANEG) & @@ -243,7 +248,8 @@ setit: * Check to see if we have link. If we do, we don't * need to restart the autonegotiation process. */ - if (sc->mii_mpd_rev >= 2) { + if ((sc->mii_flags & MIIF_PHYPRIV0) == 0 && + sc->mii_mpd_rev >= 2) { /* RTL8211B(L) */ reg = PHY_READ(sc, RGEPHY_MII_SSR); if (reg & RGEPHY_SSR_LINK) { @@ -298,7 +304,7 @@ rgephy_status(struct mii_softc *sc) mii->mii_media_status = IFM_AVALID; mii->mii_media_active = IFM_ETHER; - if (sc->mii_mpd_rev >= 2) { + if ((sc->mii_flags & MIIF_PHYPRIV0) == 0 && sc->mii_mpd_rev >= 2) { ssr = PHY_READ(sc, RGEPHY_MII_SSR); if (ssr & RGEPHY_SSR_LINK) mii->mii_media_status |= IFM_ACTIVE; @@ -328,7 +334,7 @@ rgephy_status(struct mii_softc *sc) } } - if (sc->mii_mpd_rev >= 2) { + if ((sc->mii_flags & MIIF_PHYPRIV0) == 0 && sc->mii_mpd_rev >= 2) { ssr = PHY_READ(sc, RGEPHY_MII_SSR); switch (ssr & RGEPHY_SSR_SPD_MASK) { case RGEPHY_SSR_S1000: @@ -484,7 +490,7 @@ rgephy_reset(struct mii_softc *sc) { uint16_t ssr; - if (sc->mii_mpd_rev == 3) { + if ((sc->mii_flags & MIIF_PHYPRIV0) == 0 && sc->mii_mpd_rev == 3) { /* RTL8211C(L) */ ssr = PHY_READ(sc, RGEPHY_MII_SSR); if ((ssr & RGEPHY_SSR_ALDPS) != 0) { diff --git a/src/add-ons/kernel/drivers/network/rtl81xx/dev/re/if_re.c b/src/add-ons/kernel/drivers/network/rtl81xx/dev/re/if_re.c index 3c45cc97d9..a056ea7705 100644 --- a/src/add-ons/kernel/drivers/network/rtl81xx/dev/re/if_re.c +++ b/src/add-ons/kernel/drivers/network/rtl81xx/dev/re/if_re.c @@ -171,7 +171,7 @@ TUNABLE_INT("hw.re.prefer_iomap", &prefer_iomap); /* * Various supported device vendors/types and their names. */ -static struct rl_type re_devs[] = { +static const struct rl_type const re_devs[] = { { DLINK_VENDORID, DLINK_DEVICEID_528T, 0, "D-Link DGE-528(T) Gigabit Ethernet Adapter" }, { DLINK_VENDORID, DLINK_DEVICEID_530T_REVC, 0, @@ -181,7 +181,7 @@ static struct rl_type re_devs[] = { { RT_VENDORID, RT_DEVICEID_8101E, 0, "RealTek 810xE PCIe 10/100baseTX" }, { RT_VENDORID, RT_DEVICEID_8168, 0, - "RealTek 8168/8111 B/C/CP/D/DP/E PCIe Gigabit Ethernet" }, + "RealTek 8168/8111 B/C/CP/D/DP/E/F PCIe Gigabit Ethernet" }, { RT_VENDORID, RT_DEVICEID_8169, 0, "RealTek 8169/8169S/8169SB(L)/8110S/8110SB(L) Gigabit Ethernet" }, { RT_VENDORID, RT_DEVICEID_8169SC, 0, @@ -194,8 +194,8 @@ static struct rl_type re_devs[] = { "US Robotics 997902 (RTL8169S) Gigabit Ethernet" } }; -static struct rl_hwrev re_hwrevs[] = { - { RL_HWREV_8139, RL_8139, "", RL_MTU }, +static const struct rl_hwrev const re_hwrevs[] = { + { RL_HWREV_8139, RL_8139, "", RL_MTU }, { RL_HWREV_8139A, RL_8139, "A", RL_MTU }, { RL_HWREV_8139AG, RL_8139, "A-G", RL_MTU }, { RL_HWREV_8139B, RL_8139, "B", RL_MTU }, @@ -220,7 +220,9 @@ static struct rl_hwrev re_hwrevs[] = { { RL_HWREV_8102EL_SPIN1, RL_8169, "8102EL", RL_MTU }, { RL_HWREV_8103E, RL_8169, "8103E", RL_MTU }, { RL_HWREV_8401E, RL_8169, "8401E", RL_MTU }, + { RL_HWREV_8402, RL_8169, "8402", RL_MTU }, { RL_HWREV_8105E, RL_8169, "8105E", RL_MTU }, + { RL_HWREV_8105E_SPIN1, RL_8169, "8105E", RL_MTU }, { RL_HWREV_8168B_SPIN2, RL_8169, "8168", RL_JUMBO_MTU }, { RL_HWREV_8168B_SPIN3, RL_8169, "8168", RL_JUMBO_MTU }, { RL_HWREV_8168C, RL_8169, "8168C/8111C", RL_JUMBO_MTU_6K }, @@ -230,6 +232,8 @@ static struct rl_hwrev re_hwrevs[] = { { RL_HWREV_8168DP, RL_8169, "8168DP/8111DP", RL_JUMBO_MTU_9K }, { RL_HWREV_8168E, RL_8169, "8168E/8111E", RL_JUMBO_MTU_9K}, { RL_HWREV_8168E_VL, RL_8169, "8168E/8111E-VL", RL_JUMBO_MTU_6K}, + { RL_HWREV_8168F, RL_8169, "8168F/8111F", RL_JUMBO_MTU_9K}, + { RL_HWREV_8411, RL_8169, "8411", RL_JUMBO_MTU_9K}, { 0, 0, NULL, 0 } }; @@ -290,6 +294,11 @@ static void re_set_rxmode (struct rl_softc *); static void re_reset (struct rl_softc *); static void re_setwol (struct rl_softc *); static void re_clrwol (struct rl_softc *); +static void re_set_linkspeed (struct rl_softc *); + +#ifdef DEV_NETMAP /* see ixgbe.c for details */ +#include +#endif /* !DEV_NETMAP */ #ifdef RE_DIAG static int re_diag (struct rl_softc *); @@ -309,16 +318,12 @@ static device_method_t re_methods[] = { DEVMETHOD(device_resume, re_resume), DEVMETHOD(device_shutdown, re_shutdown), - /* bus interface */ - DEVMETHOD(bus_print_child, bus_generic_print_child), - DEVMETHOD(bus_driver_added, bus_generic_driver_added), - /* MII interface */ DEVMETHOD(miibus_readreg, re_miibus_readreg), DEVMETHOD(miibus_writereg, re_miibus_writereg), DEVMETHOD(miibus_statchg, re_miibus_statchg), - { 0, 0 } + DEVMETHOD_END }; static driver_t re_driver = { @@ -868,7 +873,7 @@ re_diag(struct rl_softc *sc) device_printf(sc->rl_dev, "expected TX data: %6D/%6D/0x%x\n", dst, ":", src, ":", ETHERTYPE_IP); device_printf(sc->rl_dev, "received RX data: %6D/%6D/0x%x\n", - eh->ether_dhost, ":", eh->ether_shost, ":", + eh->ether_dhost, ":", eh->ether_shost, ":", ntohs(eh->ether_type)); device_printf(sc->rl_dev, "You may have a defective 32-bit " "NIC plugged into a 64-bit PCI slot.\n"); @@ -903,7 +908,7 @@ done: static int re_probe(device_t dev) { - struct rl_type *t; + const struct rl_type *t; uint16_t devid, vendor; uint16_t revid, sdevid; int i; @@ -1183,7 +1188,8 @@ re_attach(device_t dev) u_int16_t as[ETHER_ADDR_LEN / 2]; struct rl_softc *sc; struct ifnet *ifp; - struct rl_hwrev *hw_rev; + const struct rl_hwrev *hw_rev; + u_int32_t cap, ctl; int hwrev; u_int16_t devid, re_did = 0; int error = 0, i, phy, rid; @@ -1239,8 +1245,10 @@ re_attach(device_t dev) msic = pci_msi_count(dev); msixc = pci_msix_count(dev); - if (pci_find_cap(dev, PCIY_EXPRESS, ®) == 0) + if (pci_find_cap(dev, PCIY_EXPRESS, ®) == 0) { sc->rl_flags |= RL_FLAG_PCIE; + sc->rl_expcap = reg; + } if (bootverbose) { device_printf(dev, "MSI count : %d\n", msic); device_printf(dev, "MSI-X count : %d\n", msixc); @@ -1332,6 +1340,23 @@ re_attach(device_t dev) CSR_WRITE_1(sc, RL_EECMD, RL_EEMODE_OFF); } + /* Disable ASPM L0S/L1. */ + if (sc->rl_expcap != 0) { + cap = pci_read_config(dev, sc->rl_expcap + + PCIR_EXPRESS_LINK_CAP, 2); + if ((cap & PCIM_LINK_CAP_ASPM) != 0) { + ctl = pci_read_config(dev, sc->rl_expcap + + PCIR_EXPRESS_LINK_CTL, 2); + if ((ctl & 0x0003) != 0) { + ctl &= ~0x0003; + pci_write_config(dev, sc->rl_expcap + + PCIR_EXPRESS_LINK_CTL, ctl, 2); + device_printf(dev, "ASPM disabled\n"); + } + } else + device_printf(dev, "no ASPM capability\n"); + } + hw_rev = re_hwrevs; hwrev = CSR_READ_4(sc, RL_TXCFG); switch (hwrev & 0x70000000) { @@ -1382,10 +1407,17 @@ re_attach(device_t dev) break; case RL_HWREV_8401E: case RL_HWREV_8105E: + case RL_HWREV_8105E_SPIN1: sc->rl_flags |= RL_FLAG_PHYWAKE | RL_FLAG_PHYWAKE_PM | RL_FLAG_PAR | RL_FLAG_DESCV2 | RL_FLAG_MACSTAT | RL_FLAG_FASTETHER | RL_FLAG_CMDSTOP | RL_FLAG_AUTOPAD; break; + case RL_HWREV_8402: + sc->rl_flags |= RL_FLAG_PHYWAKE | RL_FLAG_PHYWAKE_PM | + RL_FLAG_PAR | RL_FLAG_DESCV2 | RL_FLAG_MACSTAT | + RL_FLAG_FASTETHER | RL_FLAG_CMDSTOP | RL_FLAG_AUTOPAD | + RL_FLAG_CMDSTOP_WAIT_TXQ; + break; case RL_HWREV_8168B_SPIN1: case RL_HWREV_8168B_SPIN2: sc->rl_flags |= RL_FLAG_WOLRXENB; @@ -1401,21 +1433,34 @@ re_attach(device_t dev) sc->rl_flags |= RL_FLAG_MACSLEEP; /* FALLTHROUGH */ case RL_HWREV_8168CP: - case RL_HWREV_8168D: - case RL_HWREV_8168DP: sc->rl_flags |= RL_FLAG_PHYWAKE | RL_FLAG_PAR | RL_FLAG_DESCV2 | RL_FLAG_MACSTAT | RL_FLAG_CMDSTOP | - RL_FLAG_AUTOPAD | RL_FLAG_JUMBOV2; + RL_FLAG_AUTOPAD | RL_FLAG_JUMBOV2 | RL_FLAG_WOL_MANLINK; + break; + case RL_HWREV_8168D: + sc->rl_flags |= RL_FLAG_PHYWAKE | RL_FLAG_PHYWAKE_PM | + RL_FLAG_PAR | RL_FLAG_DESCV2 | RL_FLAG_MACSTAT | + RL_FLAG_CMDSTOP | RL_FLAG_AUTOPAD | RL_FLAG_JUMBOV2 | + RL_FLAG_WOL_MANLINK; + break; + case RL_HWREV_8168DP: + sc->rl_flags |= RL_FLAG_PHYWAKE | RL_FLAG_PAR | + RL_FLAG_DESCV2 | RL_FLAG_MACSTAT | RL_FLAG_AUTOPAD | + RL_FLAG_JUMBOV2 | RL_FLAG_WAIT_TXPOLL | RL_FLAG_WOL_MANLINK; break; case RL_HWREV_8168E: sc->rl_flags |= RL_FLAG_PHYWAKE | RL_FLAG_PHYWAKE_PM | RL_FLAG_PAR | RL_FLAG_DESCV2 | RL_FLAG_MACSTAT | - RL_FLAG_CMDSTOP | RL_FLAG_AUTOPAD | RL_FLAG_JUMBOV2; + RL_FLAG_CMDSTOP | RL_FLAG_AUTOPAD | RL_FLAG_JUMBOV2 | + RL_FLAG_WOL_MANLINK; break; case RL_HWREV_8168E_VL: + case RL_HWREV_8168F: + case RL_HWREV_8411: sc->rl_flags |= RL_FLAG_PHYWAKE | RL_FLAG_PAR | RL_FLAG_DESCV2 | RL_FLAG_MACSTAT | RL_FLAG_CMDSTOP | - RL_FLAG_AUTOPAD | RL_FLAG_JUMBOV2; + RL_FLAG_AUTOPAD | RL_FLAG_JUMBOV2 | + RL_FLAG_CMDSTOP_WAIT_TXQ | RL_FLAG_WOL_MANLINK; break; case RL_HWREV_8169_8110SB: case RL_HWREV_8169_8110SBL: @@ -1432,6 +1477,22 @@ re_attach(device_t dev) break; } + if (sc->rl_hwrev->rl_rev == RL_HWREV_8139CPLUS) { + sc->rl_cfg0 = RL_8139_CFG0; + sc->rl_cfg1 = RL_8139_CFG1; + sc->rl_cfg2 = 0; + sc->rl_cfg3 = RL_8139_CFG3; + sc->rl_cfg4 = RL_8139_CFG4; + sc->rl_cfg5 = RL_8139_CFG5; + } else { + sc->rl_cfg0 = RL_CFG0; + sc->rl_cfg1 = RL_CFG1; + sc->rl_cfg2 = RL_CFG2; + sc->rl_cfg3 = RL_CFG3; + sc->rl_cfg4 = RL_CFG4; + sc->rl_cfg5 = RL_CFG5; + } + /* Reset the adapter. */ RL_LOCK(sc); re_reset(sc); @@ -1439,12 +1500,12 @@ re_attach(device_t dev) /* Enable PME. */ CSR_WRITE_1(sc, RL_EECMD, RL_EE_MODE); - cfg = CSR_READ_1(sc, RL_CFG1); + cfg = CSR_READ_1(sc, sc->rl_cfg1); cfg |= RL_CFG1_PME; - CSR_WRITE_1(sc, RL_CFG1, cfg); - cfg = CSR_READ_1(sc, RL_CFG5); + CSR_WRITE_1(sc, sc->rl_cfg1, cfg); + cfg = CSR_READ_1(sc, sc->rl_cfg5); cfg &= RL_CFG5_PME_STS; - CSR_WRITE_1(sc, RL_CFG5, cfg); + CSR_WRITE_1(sc, sc->rl_cfg5, cfg); CSR_WRITE_1(sc, RL_EECMD, RL_EEMODE_OFF); if ((sc->rl_flags & RL_FLAG_PAR) != 0) { @@ -1466,7 +1527,7 @@ re_attach(device_t dev) re_read_eeprom(sc, (caddr_t)as, RL_EE_EADDR, 3); for (i = 0; i < ETHER_ADDR_LEN / 2; i++) as[i] = le16toh(as[i]); - bcopy(as, eaddr, sizeof(eaddr)); + bcopy(as, eaddr, ETHER_ADDR_LEN); } if (sc->rl_type == RL_8169) { @@ -1516,19 +1577,6 @@ re_attach(device_t dev) re_gmii_writereg(dev, 1, 0x0e, 0); } -#define RE_PHYAD_INTERNAL 0 - - /* Do MII setup. */ - phy = RE_PHYAD_INTERNAL; - if (sc->rl_type == RL_8169) - phy = 1; - error = mii_attach(dev, &sc->rl_miibus, ifp, re_ifmedia_upd, - re_ifmedia_sts, BMSR_DEFCAPMASK, phy, MII_OFFSET_ANY, MIIF_DOPAUSE); - if (error != 0) { - device_printf(dev, "attaching PHYs failed\n"); - goto fail; - } - ifp->if_softc = sc; if_initname(ifp, device_get_name(dev), device_get_unit(dev)); ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; @@ -1553,6 +1601,19 @@ re_attach(device_t dev) TASK_INIT(&sc->rl_inttask, 0, re_int_task, sc); +#define RE_PHYAD_INTERNAL 0 + + /* Do MII setup. */ + phy = RE_PHYAD_INTERNAL; + if (sc->rl_type == RL_8169) + phy = 1; + error = mii_attach(dev, &sc->rl_miibus, ifp, re_ifmedia_upd, + re_ifmedia_sts, BMSR_DEFCAPMASK, phy, MII_OFFSET_ANY, MIIF_DOPAUSE); + if (error != 0) { + device_printf(dev, "attaching PHYs failed\n"); + goto fail; + } + /* * Call MI attach routine. */ @@ -1566,6 +1627,7 @@ re_attach(device_t dev) if (pci_find_cap(sc->rl_dev, PCIY_PMG, ®) == 0) ifp->if_capabilities |= IFCAP_WOL; ifp->if_capenable = ifp->if_capabilities; + ifp->if_capenable &= ~(IFCAP_WOL_UCAST | IFCAP_WOL_MCAST); /* * Don't enable TSO by default. It is known to generate * corrupted TCP segments(bad TCP options) under certain @@ -1583,6 +1645,9 @@ re_attach(device_t dev) */ ifp->if_data.ifi_hdrlen = sizeof(struct ether_vlan_header); +#ifdef DEV_NETMAP + re_netmap_attach(sc); +#endif /* DEV_NETMAP */ #ifdef RE_DIAG /* * Perform hardware diagnostic on the original RTL8169. @@ -1778,6 +1843,9 @@ re_detach(device_t dev) bus_dma_tag_destroy(sc->rl_ldata.rl_stag); } +#ifdef DEV_NETMAP + netmap_detach(ifp); +#endif /* DEV_NETMAP */ if (sc->rl_parent_tag) bus_dma_tag_destroy(sc->rl_parent_tag); @@ -1952,6 +2020,9 @@ re_tx_list_init(struct rl_softc *sc) sc->rl_ldata.rl_tx_desc_cnt * sizeof(struct rl_desc)); for (i = 0; i < sc->rl_ldata.rl_tx_desc_cnt; i++) sc->rl_ldata.rl_tx_desc[i].tx_m = NULL; +#ifdef DEV_NETMAP + re_netmap_tx_init(sc); +#endif /* DEV_NETMAP */ /* Set EOR. */ desc = &sc->rl_ldata.rl_tx_list[sc->rl_ldata.rl_tx_desc_cnt - 1]; desc->rl_cmdstat |= htole32(RL_TDESC_CMD_EOR); @@ -1979,6 +2050,9 @@ re_rx_list_init(struct rl_softc *sc) if ((error = re_newbuf(sc, i)) != 0) return (error); } +#ifdef DEV_NETMAP + re_netmap_rx_init(sc); +#endif /* DEV_NETMAP */ /* Flush the RX descriptors */ @@ -2035,6 +2109,13 @@ re_rxeof(struct rl_softc *sc, int *rx_npktsp) RL_LOCK_ASSERT(sc); ifp = sc->rl_ifp; +#ifdef DEV_NETMAP + if (ifp->if_capenable & IFCAP_NETMAP) { + NA(ifp)->rx_rings->nr_kflags |= NKR_PENDINTR; + selwakeuppri(&NA(ifp)->rx_rings->si, PI_NET); + return 0; + } +#endif /* DEV_NETMAP */ if (ifp->if_mtu > RL_MTU && (sc->rl_flags & RL_FLAG_JUMBOV2) != 0) jumbo = 1; else @@ -2276,6 +2357,12 @@ re_txeof(struct rl_softc *sc) return; ifp = sc->rl_ifp; +#ifdef DEV_NETMAP + if (ifp->if_capenable & IFCAP_NETMAP) { + selwakeuppri(&NA(ifp)->tx_rings[0].si, PI_NET); + return; + } +#endif /* DEV_NETMAP */ /* Invalidate the TX descriptor list */ bus_dmamap_sync(sc->rl_ldata.rl_tx_list_tag, sc->rl_ldata.rl_tx_list_map, @@ -2794,6 +2881,21 @@ re_start_locked(struct ifnet *ifp) sc = ifp->if_softc; +#ifdef DEV_NETMAP + /* XXX is this necessary ? */ + if (ifp->if_capenable & IFCAP_NETMAP) { + struct netmap_kring *kring = &NA(ifp)->tx_rings[0]; + if (sc->rl_ldata.rl_tx_prodidx != kring->nr_hwcur) { + /* kick the tx unit */ + CSR_WRITE_1(sc, sc->rl_txstart, RL_TXSTART_START); +#ifdef RE_TX_MODERATION + CSR_WRITE_4(sc, RL_TIMERCNT, 1); +#endif + sc->rl_watchdog_timer = 5; + } + return; + } +#endif /* DEV_NETMAP */ if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != IFF_DRV_RUNNING || (sc->rl_flags & RL_FLAG_LINK) == 0) return; @@ -2866,32 +2968,32 @@ re_set_jumbo(struct rl_softc *sc, int jumbo) CSR_WRITE_1(sc, RL_EECMD, RL_EEMODE_WRITECFG); if (jumbo != 0) { - CSR_WRITE_1(sc, RL_CFG3, CSR_READ_1(sc, RL_CFG3) | + CSR_WRITE_1(sc, sc->rl_cfg3, CSR_READ_1(sc, sc->rl_cfg3) | RL_CFG3_JUMBO_EN0); switch (sc->rl_hwrev->rl_rev) { case RL_HWREV_8168DP: break; case RL_HWREV_8168E: - CSR_WRITE_1(sc, RL_CFG4, CSR_READ_1(sc, RL_CFG4) | - 0x01); + CSR_WRITE_1(sc, sc->rl_cfg4, + CSR_READ_1(sc, sc->rl_cfg4) | 0x01); break; default: - CSR_WRITE_1(sc, RL_CFG4, CSR_READ_1(sc, RL_CFG4) | - RL_CFG4_JUMBO_EN1); + CSR_WRITE_1(sc, sc->rl_cfg4, + CSR_READ_1(sc, sc->rl_cfg4) | RL_CFG4_JUMBO_EN1); } } else { - CSR_WRITE_1(sc, RL_CFG3, CSR_READ_1(sc, RL_CFG3) & + CSR_WRITE_1(sc, sc->rl_cfg3, CSR_READ_1(sc, sc->rl_cfg3) & ~RL_CFG3_JUMBO_EN0); switch (sc->rl_hwrev->rl_rev) { case RL_HWREV_8168DP: break; case RL_HWREV_8168E: - CSR_WRITE_1(sc, RL_CFG4, CSR_READ_1(sc, RL_CFG4) & - ~0x01); + CSR_WRITE_1(sc, sc->rl_cfg4, + CSR_READ_1(sc, sc->rl_cfg4) & ~0x01); break; default: - CSR_WRITE_1(sc, RL_CFG4, CSR_READ_1(sc, RL_CFG4) & - ~RL_CFG4_JUMBO_EN1); + CSR_WRITE_1(sc, sc->rl_cfg4, + CSR_READ_1(sc, sc->rl_cfg4) & ~RL_CFG4_JUMBO_EN1); } } CSR_WRITE_1(sc, RL_EECMD, RL_EEMODE_OFF); @@ -3004,7 +3106,7 @@ re_init_locked(struct rl_softc *sc) if (sc->rl_hwrev->rl_rev == RL_HWREV_8169_8110SC || sc->rl_hwrev->rl_rev == RL_HWREV_8169_8110SCE) { reg = 0x000fff00; - if ((CSR_READ_1(sc, RL_CFG2) & RL_CFG2_PCI66MHZ) != 0) + if ((CSR_READ_1(sc, sc->rl_cfg2) & RL_CFG2_PCI66MHZ) != 0) reg |= 0x000000ff; if (sc->rl_hwrev->rl_rev == RL_HWREV_8169_8110SCE) reg |= 0x00f00000; @@ -3169,14 +3271,15 @@ re_init_locked(struct rl_softc *sc) if (sc->rl_testmode) return; - mii_mediachg(mii); - - CSR_WRITE_1(sc, RL_CFG1, CSR_READ_1(sc, RL_CFG1) | RL_CFG1_DRVLOAD); + CSR_WRITE_1(sc, sc->rl_cfg1, CSR_READ_1(sc, sc->rl_cfg1) | + RL_CFG1_DRVLOAD); ifp->if_drv_flags |= IFF_DRV_RUNNING; ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; sc->rl_flags &= ~RL_FLAG_LINK; + mii_mediachg(mii); + sc->rl_watchdog_timer = 0; callout_reset(&sc->rl_stat_callout, hz, re_tick, sc); } @@ -3214,9 +3317,9 @@ re_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr) RL_LOCK(sc); mii_pollstat(mii); - RL_UNLOCK(sc); ifmr->ifm_active = mii->mii_media_active; ifmr->ifm_status = mii->mii_media_status; + RL_UNLOCK(sc); } static int @@ -3308,6 +3411,7 @@ re_ioctl(struct ifnet *ifp, u_long command, caddr_t data) } } #endif /* DEVICE_POLLING */ + RL_LOCK(sc); if ((mask & IFCAP_TXCSUM) != 0 && (ifp->if_capabilities & IFCAP_TXCSUM) != 0) { ifp->if_capenable ^= IFCAP_TXCSUM; @@ -3328,7 +3432,7 @@ re_ioctl(struct ifnet *ifp, u_long command, caddr_t data) reinit = 1; } if ((mask & IFCAP_TSO4) != 0 && - (ifp->if_capabilities & IFCAP_TSO) != 0) { + (ifp->if_capabilities & IFCAP_TSO4) != 0) { ifp->if_capenable ^= IFCAP_TSO4; if ((IFCAP_TSO4 & ifp->if_capenable) != 0) ifp->if_hwassist |= CSUM_TSO; @@ -3366,8 +3470,9 @@ re_ioctl(struct ifnet *ifp, u_long command, caddr_t data) } if (reinit && ifp->if_drv_flags & IFF_DRV_RUNNING) { ifp->if_drv_flags &= ~IFF_DRV_RUNNING; - re_init(sc); + re_init_locked(sc); } + RL_UNLOCK(sc); VLAN_CAPABILITIES(ifp); } break; @@ -3429,10 +3534,42 @@ re_stop(struct rl_softc *sc) callout_stop(&sc->rl_stat_callout); ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); - if ((sc->rl_flags & RL_FLAG_CMDSTOP) != 0) + /* + * Disable accepting frames to put RX MAC into idle state. + * Otherwise it's possible to get frames while stop command + * execution is in progress and controller can DMA the frame + * to already freed RX buffer during that period. + */ + CSR_WRITE_4(sc, RL_RXCFG, CSR_READ_4(sc, RL_RXCFG) & + ~(RL_RXCFG_RX_ALLPHYS | RL_RXCFG_RX_INDIV | RL_RXCFG_RX_MULTI | + RL_RXCFG_RX_BROAD)); + + if ((sc->rl_flags & RL_FLAG_WAIT_TXPOLL) != 0) { + for (i = RL_TIMEOUT; i > 0; i--) { + if ((CSR_READ_1(sc, sc->rl_txstart) & + RL_TXSTART_START) == 0) + break; + DELAY(20); + } + if (i == 0) + device_printf(sc->rl_dev, + "stopping TX poll timed out!\n"); + CSR_WRITE_1(sc, RL_COMMAND, 0x00); + } else if ((sc->rl_flags & RL_FLAG_CMDSTOP) != 0) { CSR_WRITE_1(sc, RL_COMMAND, RL_CMD_STOPREQ | RL_CMD_TX_ENB | RL_CMD_RX_ENB); - else + if ((sc->rl_flags & RL_FLAG_CMDSTOP_WAIT_TXQ) != 0) { + for (i = RL_TIMEOUT; i > 0; i--) { + if ((CSR_READ_4(sc, RL_TXCFG) & + RL_TXCFG_QUEUE_EMPTY) != 0) + break; + DELAY(100); + } + if (i == 0) + device_printf(sc->rl_dev, + "stopping TXQ timed out!\n"); + } + } else CSR_WRITE_1(sc, RL_COMMAND, 0x00); DELAY(1000); CSR_WRITE_2(sc, RL_IMR, 0x0000); @@ -3444,7 +3581,6 @@ re_stop(struct rl_softc *sc) } /* Free the TX list buffers. */ - for (i = 0; i < sc->rl_ldata.rl_tx_desc_cnt; i++) { txd = &sc->rl_ldata.rl_tx_desc[i]; if (txd->tx_m != NULL) { @@ -3458,11 +3594,10 @@ re_stop(struct rl_softc *sc) } /* Free the RX list buffers. */ - for (i = 0; i < sc->rl_ldata.rl_rx_desc_cnt; i++) { rxd = &sc->rl_ldata.rl_rx_desc[i]; if (rxd->rx_m != NULL) { - bus_dmamap_sync(sc->rl_ldata.rl_tx_mtag, + bus_dmamap_sync(sc->rl_ldata.rl_rx_mtag, rxd->rx_dmamap, BUS_DMASYNC_POSTREAD); bus_dmamap_unload(sc->rl_ldata.rl_rx_mtag, rxd->rx_dmamap); @@ -3470,6 +3605,20 @@ re_stop(struct rl_softc *sc) rxd->rx_m = NULL; } } + + if ((sc->rl_flags & RL_FLAG_JUMBOV2) != 0) { + for (i = 0; i < sc->rl_ldata.rl_rx_desc_cnt; i++) { + rxd = &sc->rl_ldata.rl_jrx_desc[i]; + if (rxd->rx_m != NULL) { + bus_dmamap_sync(sc->rl_ldata.rl_jrx_mtag, + rxd->rx_dmamap, BUS_DMASYNC_POSTREAD); + bus_dmamap_unload(sc->rl_ldata.rl_jrx_mtag, + rxd->rx_dmamap); + m_freem(rxd->rx_m); + rxd->rx_m = NULL; + } + } + } } /* @@ -3557,6 +3706,74 @@ re_shutdown(device_t dev) return (0); } +static void +re_set_linkspeed(struct rl_softc *sc) +{ + struct mii_softc *miisc; + struct mii_data *mii; + int aneg, i, phyno; + + RL_LOCK_ASSERT(sc); + + mii = device_get_softc(sc->rl_miibus); + mii_pollstat(mii); + aneg = 0; + if ((mii->mii_media_status & (IFM_ACTIVE | IFM_AVALID)) == + (IFM_ACTIVE | IFM_AVALID)) { + switch IFM_SUBTYPE(mii->mii_media_active) { + case IFM_10_T: + case IFM_100_TX: + return; + case IFM_1000_T: + aneg++; + break; + default: + break; + } + } + miisc = LIST_FIRST(&mii->mii_phys); + phyno = miisc->mii_phy; + LIST_FOREACH(miisc, &mii->mii_phys, mii_list) + PHY_RESET(miisc); + re_miibus_writereg(sc->rl_dev, phyno, MII_100T2CR, 0); + re_miibus_writereg(sc->rl_dev, phyno, + MII_ANAR, ANAR_TX_FD | ANAR_TX | ANAR_10_FD | ANAR_10 | ANAR_CSMA); + re_miibus_writereg(sc->rl_dev, phyno, + MII_BMCR, BMCR_AUTOEN | BMCR_STARTNEG); + DELAY(1000); + if (aneg != 0) { + /* + * Poll link state until re(4) get a 10/100Mbps link. + */ + for (i = 0; i < MII_ANEGTICKS_GIGE; i++) { + mii_pollstat(mii); + if ((mii->mii_media_status & (IFM_ACTIVE | IFM_AVALID)) + == (IFM_ACTIVE | IFM_AVALID)) { + switch (IFM_SUBTYPE(mii->mii_media_active)) { + case IFM_10_T: + case IFM_100_TX: + return; + default: + break; + } + } + RL_UNLOCK(sc); + pause("relnk", hz); + RL_LOCK(sc); + } + if (i == MII_ANEGTICKS_GIGE) + device_printf(sc->rl_dev, + "establishing a link failed, WOL may not work!"); + } + /* + * No link, force MAC to have 100Mbps, full-duplex link. + * MAC does not require reprogramming on resolved speed/duplex, + * so this is just for completeness. + */ + mii->mii_media_status = IFM_AVALID | IFM_ACTIVE; + mii->mii_media_active = IFM_ETHER | IFM_100_TX | IFM_FDX; +} + static void re_setwol(struct rl_softc *sc) { @@ -3577,40 +3794,44 @@ re_setwol(struct rl_softc *sc) CSR_WRITE_1(sc, RL_GPIO, CSR_READ_1(sc, RL_GPIO) & ~0x01); } - if ((ifp->if_capenable & IFCAP_WOL) != 0 && - (sc->rl_flags & RL_FLAG_WOLRXENB) != 0) - CSR_WRITE_1(sc, RL_COMMAND, RL_CMD_RX_ENB); + if ((ifp->if_capenable & IFCAP_WOL) != 0) { + re_set_rxmode(sc); + if ((sc->rl_flags & RL_FLAG_WOL_MANLINK) != 0) + re_set_linkspeed(sc); + if ((sc->rl_flags & RL_FLAG_WOLRXENB) != 0) + CSR_WRITE_1(sc, RL_COMMAND, RL_CMD_RX_ENB); + } /* Enable config register write. */ CSR_WRITE_1(sc, RL_EECMD, RL_EE_MODE); /* Enable PME. */ - v = CSR_READ_1(sc, RL_CFG1); + v = CSR_READ_1(sc, sc->rl_cfg1); v &= ~RL_CFG1_PME; if ((ifp->if_capenable & IFCAP_WOL) != 0) v |= RL_CFG1_PME; - CSR_WRITE_1(sc, RL_CFG1, v); + CSR_WRITE_1(sc, sc->rl_cfg1, v); - v = CSR_READ_1(sc, RL_CFG3); + v = CSR_READ_1(sc, sc->rl_cfg3); v &= ~(RL_CFG3_WOL_LINK | RL_CFG3_WOL_MAGIC); if ((ifp->if_capenable & IFCAP_WOL_MAGIC) != 0) v |= RL_CFG3_WOL_MAGIC; - CSR_WRITE_1(sc, RL_CFG3, v); + CSR_WRITE_1(sc, sc->rl_cfg3, v); - /* Config register write done. */ - CSR_WRITE_1(sc, RL_EECMD, RL_EEMODE_OFF); - - v = CSR_READ_1(sc, RL_CFG5); - v &= ~(RL_CFG5_WOL_BCAST | RL_CFG5_WOL_MCAST | RL_CFG5_WOL_UCAST); - v &= ~RL_CFG5_WOL_LANWAKE; + v = CSR_READ_1(sc, sc->rl_cfg5); + v &= ~(RL_CFG5_WOL_BCAST | RL_CFG5_WOL_MCAST | RL_CFG5_WOL_UCAST | + RL_CFG5_WOL_LANWAKE); if ((ifp->if_capenable & IFCAP_WOL_UCAST) != 0) v |= RL_CFG5_WOL_UCAST; if ((ifp->if_capenable & IFCAP_WOL_MCAST) != 0) v |= RL_CFG5_WOL_MCAST | RL_CFG5_WOL_BCAST; if ((ifp->if_capenable & IFCAP_WOL) != 0) v |= RL_CFG5_WOL_LANWAKE; - CSR_WRITE_1(sc, RL_CFG5, v); + CSR_WRITE_1(sc, sc->rl_cfg5, v); - if ((ifp->if_capenable & IFCAP_WOL) != 0 && + /* Config register write done. */ + CSR_WRITE_1(sc, RL_EECMD, RL_EEMODE_OFF); + + if ((ifp->if_capenable & IFCAP_WOL) == 0 && (sc->rl_flags & RL_FLAG_PHYWAKE_PM) != 0) CSR_WRITE_1(sc, RL_PMCH, CSR_READ_1(sc, RL_PMCH) & ~0x80); /* @@ -3641,17 +3862,17 @@ re_clrwol(struct rl_softc *sc) /* Enable config register write. */ CSR_WRITE_1(sc, RL_EECMD, RL_EE_MODE); - v = CSR_READ_1(sc, RL_CFG3); + v = CSR_READ_1(sc, sc->rl_cfg3); v &= ~(RL_CFG3_WOL_LINK | RL_CFG3_WOL_MAGIC); - CSR_WRITE_1(sc, RL_CFG3, v); + CSR_WRITE_1(sc, sc->rl_cfg3, v); /* Config register write done. */ CSR_WRITE_1(sc, RL_EECMD, RL_EEMODE_OFF); - v = CSR_READ_1(sc, RL_CFG5); + v = CSR_READ_1(sc, sc->rl_cfg5); v &= ~(RL_CFG5_WOL_BCAST | RL_CFG5_WOL_MCAST | RL_CFG5_WOL_UCAST); v &= ~RL_CFG5_WOL_LANWAKE; - CSR_WRITE_1(sc, RL_CFG5, v); + CSR_WRITE_1(sc, sc->rl_cfg5, v); } static void diff --git a/src/add-ons/kernel/drivers/network/rtl81xx/pci/if_rlreg.h b/src/add-ons/kernel/drivers/network/rtl81xx/pci/if_rlreg.h index 6e7c0c1d54..7822ce3654 100644 --- a/src/add-ons/kernel/drivers/network/rtl81xx/pci/if_rlreg.h +++ b/src/add-ons/kernel/drivers/network/rtl81xx/pci/if_rlreg.h @@ -74,6 +74,14 @@ #define RL_TIMERCNT 0x0048 /* timer count register */ #define RL_MISSEDPKT 0x004C /* missed packet counter */ #define RL_EECMD 0x0050 /* EEPROM command register */ + +/* RTL8139/RTL8139C+ only */ +#define RL_8139_CFG0 0x0051 /* config register #0 */ +#define RL_8139_CFG1 0x0052 /* config register #1 */ +#define RL_8139_CFG3 0x0059 /* config register #3 */ +#define RL_8139_CFG4 0x005A /* config register #4 */ +#define RL_8139_CFG5 0x00D8 /* config register #5 */ + #define RL_CFG0 0x0051 /* config register #0 */ #define RL_CFG1 0x0052 /* config register #1 */ #define RL_CFG2 0x0053 /* config register #2 */ @@ -143,6 +151,7 @@ */ #define RL_TXCFG_CLRABRT 0x00000001 /* retransmit aborted pkt */ #define RL_TXCFG_MAXDMA 0x00000700 /* max DMA burst size */ +#define RL_TXCFG_QUEUE_EMPTY 0x00000800 /* 8168E-VL or higher */ #define RL_TXCFG_CRCAPPEND 0x00010000 /* CRC append (0 = yes) */ #define RL_TXCFG_LOOPBKTST 0x00060000 /* loopback test */ #define RL_TXCFG_IFG2 0x00080000 /* 8169 only */ @@ -178,6 +187,10 @@ #define RL_HWREV_8168C_SPIN2 0x3C400000 #define RL_HWREV_8168CP 0x3C800000 #define RL_HWREV_8105E 0x40800000 +#define RL_HWREV_8105E_SPIN1 0x40C00000 +#define RL_HWREV_8402 0x44000000 +#define RL_HWREV_8168F 0x48000000 +#define RL_HWREV_8411 0x48800000 #define RL_HWREV_8139 0x60000000 #define RL_HWREV_8139A 0x70000000 #define RL_HWREV_8139AG 0x70800000 @@ -866,7 +879,14 @@ struct rl_softc { const struct rl_hwrev *rl_hwrev; int rl_eecmd_read; int rl_eewidth; + int rl_expcap; int rl_txthresh; + bus_size_t rl_cfg0; + bus_size_t rl_cfg1; + bus_size_t rl_cfg2; + bus_size_t rl_cfg3; + bus_size_t rl_cfg4; + bus_size_t rl_cfg5; struct rl_chain_data rl_cdata; struct rl_list_data rl_ldata; struct callout rl_stat_callout; @@ -892,22 +912,25 @@ struct rl_softc { int rl_int_rx_act; int rl_int_rx_mod; uint32_t rl_flags; -#define RL_FLAG_MSI 0x0001 -#define RL_FLAG_AUTOPAD 0x0002 -#define RL_FLAG_PHYWAKE_PM 0x0004 -#define RL_FLAG_PHYWAKE 0x0008 -#define RL_FLAG_JUMBOV2 0x0010 -#define RL_FLAG_PAR 0x0020 -#define RL_FLAG_DESCV2 0x0040 -#define RL_FLAG_MACSTAT 0x0080 -#define RL_FLAG_FASTETHER 0x0100 -#define RL_FLAG_CMDSTOP 0x0200 -#define RL_FLAG_MACRESET 0x0400 -#define RL_FLAG_MSIX 0x0800 -#define RL_FLAG_WOLRXENB 0x1000 -#define RL_FLAG_MACSLEEP 0x2000 -#define RL_FLAG_PCIE 0x4000 -#define RL_FLAG_LINK 0x8000 +#define RL_FLAG_MSI 0x00000001 +#define RL_FLAG_AUTOPAD 0x00000002 +#define RL_FLAG_PHYWAKE_PM 0x00000004 +#define RL_FLAG_PHYWAKE 0x00000008 +#define RL_FLAG_JUMBOV2 0x00000010 +#define RL_FLAG_PAR 0x00000020 +#define RL_FLAG_DESCV2 0x00000040 +#define RL_FLAG_MACSTAT 0x00000080 +#define RL_FLAG_FASTETHER 0x00000100 +#define RL_FLAG_CMDSTOP 0x00000200 +#define RL_FLAG_MACRESET 0x00000400 +#define RL_FLAG_MSIX 0x00000800 +#define RL_FLAG_WOLRXENB 0x00001000 +#define RL_FLAG_MACSLEEP 0x00002000 +#define RL_FLAG_WAIT_TXPOLL 0x00004000 +#define RL_FLAG_CMDSTOP_WAIT_TXQ 0x00008000 +#define RL_FLAG_WOL_MANLINK 0x00010000 +#define RL_FLAG_PCIE 0x40000000 +#define RL_FLAG_LINK 0x80000000 }; #define RL_LOCK(_sc) mtx_lock(&(_sc)->rl_mtx) diff --git a/src/add-ons/kernel/drivers/network/syskonnect/dev/mii/e1000phy.c b/src/add-ons/kernel/drivers/network/syskonnect/dev/mii/e1000phy.c index 8818ee43ee..91ae44d2e9 100644 --- a/src/add-ons/kernel/drivers/network/syskonnect/dev/mii/e1000phy.c +++ b/src/add-ons/kernel/drivers/network/syskonnect/dev/mii/e1000phy.c @@ -30,7 +30,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/mii/e1000phy.c,v 1.18 2006/12/11 11:09:48 yongari Exp $"); +__FBSDID("$FreeBSD$"); /* * driver for the Marvell 88E1000 series external 1000/100/10-BT PHY. @@ -71,7 +71,7 @@ static device_method_t e1000phy_methods[] = { DEVMETHOD(device_attach, e1000phy_attach), DEVMETHOD(device_detach, mii_phy_detach), DEVMETHOD(device_shutdown, bus_generic_shutdown), - { 0, 0 } + DEVMETHOD_END }; static devclass_t e1000phy_devclass; diff --git a/src/add-ons/kernel/drivers/network/syskonnect/dev/mii/e1000phyreg.h b/src/add-ons/kernel/drivers/network/syskonnect/dev/mii/e1000phyreg.h index 08f9e5f1d4..e5d5cf961a 100644 --- a/src/add-ons/kernel/drivers/network/syskonnect/dev/mii/e1000phyreg.h +++ b/src/add-ons/kernel/drivers/network/syskonnect/dev/mii/e1000phyreg.h @@ -1,4 +1,4 @@ -/* $FreeBSD: src/sys/dev/mii/e1000phyreg.h,v 1.4 2006/12/11 10:43:32 yongari Exp $ */ +/* $FreeBSD$ */ /*- * Principal Author: Parag Patel * Copyright (c) 2001 diff --git a/src/add-ons/kernel/drivers/network/syskonnect/dev/mii/ukphy.c b/src/add-ons/kernel/drivers/network/syskonnect/dev/mii/ukphy.c index 4ecfce29d3..9d52eb580c 100644 --- a/src/add-ons/kernel/drivers/network/syskonnect/dev/mii/ukphy.c +++ b/src/add-ons/kernel/drivers/network/syskonnect/dev/mii/ukphy.c @@ -55,7 +55,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/mii/ukphy.c,v 1.20.10.6.2.1 2010/12/21 17:09:25 kensmith Exp $"); +__FBSDID("$FreeBSD$"); /* * driver for generic unknown PHYs @@ -86,7 +86,7 @@ static device_method_t ukphy_methods[] = { DEVMETHOD(device_attach, ukphy_attach), DEVMETHOD(device_detach, mii_phy_detach), DEVMETHOD(device_shutdown, bus_generic_shutdown), - { 0, 0 } + DEVMETHOD_END }; static devclass_t ukphy_devclass; diff --git a/src/add-ons/kernel/drivers/network/syskonnect/dev/mii/ukphy_subr.c b/src/add-ons/kernel/drivers/network/syskonnect/dev/mii/ukphy_subr.c index 73007e197b..5f2f6341ba 100644 --- a/src/add-ons/kernel/drivers/network/syskonnect/dev/mii/ukphy_subr.c +++ b/src/add-ons/kernel/drivers/network/syskonnect/dev/mii/ukphy_subr.c @@ -31,7 +31,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/mii/ukphy_subr.c,v 1.10.2.4.2.1 2010/12/21 17:09:25 kensmith Exp $"); +__FBSDID("$FreeBSD$"); /* * Subroutines shared by the ukphy driver and other PHY drivers. diff --git a/src/add-ons/kernel/drivers/network/syskonnect/dev/mii/xmphy.c b/src/add-ons/kernel/drivers/network/syskonnect/dev/mii/xmphy.c index 886bb7e873..328d34ad9a 100644 --- a/src/add-ons/kernel/drivers/network/syskonnect/dev/mii/xmphy.c +++ b/src/add-ons/kernel/drivers/network/syskonnect/dev/mii/xmphy.c @@ -31,7 +31,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/mii/xmphy.c,v 1.21 2006/12/02 19:36:25 marius Exp $"); +__FBSDID("$FreeBSD$"); /* * driver for the XaQti XMAC II's internal PHY. This is sort of @@ -66,7 +66,7 @@ static device_method_t xmphy_methods[] = { DEVMETHOD(device_attach, xmphy_attach), DEVMETHOD(device_detach, mii_phy_detach), DEVMETHOD(device_shutdown, bus_generic_shutdown), - { 0, 0 } + DEVMETHOD_END }; static devclass_t xmphy_devclass; diff --git a/src/add-ons/kernel/drivers/network/syskonnect/dev/mii/xmphyreg.h b/src/add-ons/kernel/drivers/network/syskonnect/dev/mii/xmphyreg.h index ad1e6fc4b7..92b9f78b46 100644 --- a/src/add-ons/kernel/drivers/network/syskonnect/dev/mii/xmphyreg.h +++ b/src/add-ons/kernel/drivers/network/syskonnect/dev/mii/xmphyreg.h @@ -29,7 +29,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/sys/dev/mii/xmphyreg.h,v 1.4 2005/01/06 01:42:56 imp Exp $ + * $FreeBSD$ */ #ifndef _DEV_MII_XMPHYREG_H_ diff --git a/src/add-ons/kernel/drivers/network/syskonnect/dev/sk/if_sk.c b/src/add-ons/kernel/drivers/network/syskonnect/dev/sk/if_sk.c index a0afc0ff58..4b24465928 100644 --- a/src/add-ons/kernel/drivers/network/syskonnect/dev/sk/if_sk.c +++ b/src/add-ons/kernel/drivers/network/syskonnect/dev/sk/if_sk.c @@ -48,7 +48,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/sk/if_sk.c,v 1.138 2007/11/22 02:44:59 yongari Exp $"); +__FBSDID("$FreeBSD$"); /* * SysKonnect SK-NET gigabit ethernet driver for FreeBSD. Supports @@ -140,7 +140,7 @@ MODULE_DEPEND(sk, miibus, 1, 1, 1); #ifndef lint static const char rcsid[] = - "$FreeBSD: src/sys/dev/sk/if_sk.c,v 1.138 2007/11/22 02:44:59 yongari Exp $"; + "$FreeBSD$"; #endif static struct sk_type sk_devs[] = { @@ -234,10 +234,10 @@ static int sk_init_rx_ring(struct sk_if_softc *); static int sk_init_jumbo_rx_ring(struct sk_if_softc *); static void sk_init_tx_ring(struct sk_if_softc *); static u_int32_t sk_win_read_4(struct sk_softc *, int); -u_int16_t sk_win_read_2(struct sk_softc *, int); +static u_int16_t sk_win_read_2(struct sk_softc *, int); static u_int8_t sk_win_read_1(struct sk_softc *, int); static void sk_win_write_4(struct sk_softc *, int, u_int32_t); -void sk_win_write_2(struct sk_softc *, int, u_int32_t); +static void sk_win_write_2(struct sk_softc *, int, u_int32_t); static void sk_win_write_1(struct sk_softc *, int, u_int32_t); static int sk_miibus_readreg(device_t, int, int); @@ -300,11 +300,7 @@ static device_method_t skc_methods[] = { DEVMETHOD(device_resume, skc_resume), DEVMETHOD(device_shutdown, skc_shutdown), - /* bus interface */ - DEVMETHOD(bus_print_child, bus_generic_print_child), - DEVMETHOD(bus_driver_added, bus_generic_driver_added), - - { 0, 0 } + DEVMETHOD_END }; static driver_t skc_driver = { @@ -322,16 +318,12 @@ static device_method_t sk_methods[] = { DEVMETHOD(device_detach, sk_detach), DEVMETHOD(device_shutdown, bus_generic_shutdown), - /* bus interface */ - DEVMETHOD(bus_print_child, bus_generic_print_child), - DEVMETHOD(bus_driver_added, bus_generic_driver_added), - /* MII interface */ DEVMETHOD(miibus_readreg, sk_miibus_readreg), DEVMETHOD(miibus_writereg, sk_miibus_writereg), DEVMETHOD(miibus_statchg, sk_miibus_statchg), - { 0, 0 } + DEVMETHOD_END }; static driver_t sk_driver = { @@ -389,7 +381,7 @@ sk_win_read_4(sc, reg) #endif } -u_int16_t +static u_int16_t sk_win_read_2(sc, reg) struct sk_softc *sc; int reg; @@ -430,7 +422,7 @@ sk_win_write_4(sc, reg, val) return; } -void +static void sk_win_write_2(sc, reg, val) struct sk_softc *sc; int reg; @@ -1213,7 +1205,6 @@ skc_probe(dev) { struct sk_type *t = sk_devs; - while(t->sk_name != NULL) { if ((pci_get_vendor(dev) == t->sk_vid) && (pci_get_device(dev) == t->sk_did)) { @@ -1819,7 +1810,8 @@ skc_attach(dev) goto fail; } - error = bus_setup_intr(dev, sc->sk_res[1], INTR_TYPE_NET|INTR_MPSAFE/*|INTR_FAST*/, + /* Hook interrupt last to avoid having to lock softc */ + error = bus_setup_intr(dev, sc->sk_res[1], INTR_TYPE_NET|INTR_MPSAFE, NULL, sk_intr, sc, &sc->sk_intrhand); if (error) { @@ -3127,9 +3119,7 @@ sk_intr(xsc) #ifndef __HAIKU__ status = CSR_READ_4(sc, SK_ISSR); if (status == 0 || status == 0xffffffff || sc->sk_suspended) - { goto done_locked; - } #endif sc_if0 = sc->sk_if[SK_PORT_A]; @@ -3148,9 +3138,7 @@ sk_intr(xsc) while (true) { if (status == 0 || status == 0xffffffff || sc->sk_suspended) - { goto done_locked; - } #endif /* Handle receive interrupts first. */ @@ -3206,8 +3194,8 @@ sk_intr(xsc) sc_if1->sk_phytype == SK_PHYTYPE_BCOM) sk_intr_bcom(sc_if1); } -#ifdef __HAIKU__ status = CSR_READ_4(sc, SK_ISSR); +#ifdef __HAIKU__ if (((status & sc->sk_intrmask) == 0) || status == 0xffffffff || sc->sk_suspended) { break; diff --git a/src/add-ons/kernel/drivers/network/syskonnect/dev/sk/if_skreg.h b/src/add-ons/kernel/drivers/network/syskonnect/dev/sk/if_skreg.h index b518baaede..d164ffcdc0 100644 --- a/src/add-ons/kernel/drivers/network/syskonnect/dev/sk/if_skreg.h +++ b/src/add-ons/kernel/drivers/network/syskonnect/dev/sk/if_skreg.h @@ -1,6 +1,6 @@ /* $OpenBSD: if_skreg.h,v 1.10 2003/08/12 05:23:06 nate Exp $ */ -/*-f +/*- * Copyright (c) 1997, 1998, 1999, 2000 * Bill Paul . All rights reserved. * @@ -31,7 +31,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/sys/dev/sk/if_skreg.h,v 1.41 2007/04/02 04:43:41 yongari Exp $ + * $FreeBSD$ */ /*- @@ -379,8 +379,8 @@ #define SK_IMCTL_STOP 0x02 #define SK_IMCTL_START 0x04 -#define SK_IMTIMER_TICKS_GENESIS 177 /* FBSD ticks are 1/100, Haiku 3? secs 53 */ -#define SK_IMTIMER_TICKS_YUKON 260 /* FBSD ticks are 1/100, Haiku 3? secs 78 */ +#define SK_IMTIMER_TICKS_GENESIS 53 +#define SK_IMTIMER_TICKS_YUKON 78 #define SK_IM_USECS(x, t) ((x) * (t)) #define SK_IM_MIN 10 diff --git a/src/add-ons/kernel/drivers/network/syskonnect/dev/sk/xmaciireg.h b/src/add-ons/kernel/drivers/network/syskonnect/dev/sk/xmaciireg.h index 85a59980bc..604073b72a 100644 --- a/src/add-ons/kernel/drivers/network/syskonnect/dev/sk/xmaciireg.h +++ b/src/add-ons/kernel/drivers/network/syskonnect/dev/sk/xmaciireg.h @@ -29,7 +29,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/sys/dev/sk/xmaciireg.h,v 1.5 2006/04/27 05:59:09 yongari Exp $ + * $FreeBSD$ */ /* diff --git a/src/add-ons/kernel/drivers/network/syskonnect/dev/sk/yukonreg.h b/src/add-ons/kernel/drivers/network/syskonnect/dev/sk/yukonreg.h index c66487472e..efe71a0d34 100644 --- a/src/add-ons/kernel/drivers/network/syskonnect/dev/sk/yukonreg.h +++ b/src/add-ons/kernel/drivers/network/syskonnect/dev/sk/yukonreg.h @@ -14,7 +14,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $FreeBSD: src/sys/dev/sk/yukonreg.h,v 1.3 2006/04/27 05:59:09 yongari Exp $ + * $FreeBSD$ */ /* General Purpose Status Register (GPSR) */ diff --git a/src/add-ons/kernel/drivers/network/via_rhine/dev/mii/ciphy.c b/src/add-ons/kernel/drivers/network/via_rhine/dev/mii/ciphy.c index 2133c76ca0..87d0d814e9 100644 --- a/src/add-ons/kernel/drivers/network/via_rhine/dev/mii/ciphy.c +++ b/src/add-ons/kernel/drivers/network/via_rhine/dev/mii/ciphy.c @@ -67,7 +67,7 @@ static device_method_t ciphy_methods[] = { DEVMETHOD(device_attach, ciphy_attach), DEVMETHOD(device_detach, mii_phy_detach), DEVMETHOD(device_shutdown, bus_generic_shutdown), - { 0, 0 } + DEVMETHOD_END }; static devclass_t ciphy_devclass; diff --git a/src/add-ons/kernel/drivers/network/via_rhine/dev/mii/ukphy.c b/src/add-ons/kernel/drivers/network/via_rhine/dev/mii/ukphy.c index 4ecfce29d3..9d52eb580c 100644 --- a/src/add-ons/kernel/drivers/network/via_rhine/dev/mii/ukphy.c +++ b/src/add-ons/kernel/drivers/network/via_rhine/dev/mii/ukphy.c @@ -55,7 +55,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/mii/ukphy.c,v 1.20.10.6.2.1 2010/12/21 17:09:25 kensmith Exp $"); +__FBSDID("$FreeBSD$"); /* * driver for generic unknown PHYs @@ -86,7 +86,7 @@ static device_method_t ukphy_methods[] = { DEVMETHOD(device_attach, ukphy_attach), DEVMETHOD(device_detach, mii_phy_detach), DEVMETHOD(device_shutdown, bus_generic_shutdown), - { 0, 0 } + DEVMETHOD_END }; static devclass_t ukphy_devclass; diff --git a/src/add-ons/kernel/drivers/network/via_rhine/dev/mii/ukphy_subr.c b/src/add-ons/kernel/drivers/network/via_rhine/dev/mii/ukphy_subr.c index 73007e197b..5f2f6341ba 100644 --- a/src/add-ons/kernel/drivers/network/via_rhine/dev/mii/ukphy_subr.c +++ b/src/add-ons/kernel/drivers/network/via_rhine/dev/mii/ukphy_subr.c @@ -31,7 +31,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/mii/ukphy_subr.c,v 1.10.2.4.2.1 2010/12/21 17:09:25 kensmith Exp $"); +__FBSDID("$FreeBSD$"); /* * Subroutines shared by the ukphy driver and other PHY drivers. diff --git a/src/add-ons/kernel/drivers/network/via_rhine/dev/vr/if_vr.c b/src/add-ons/kernel/drivers/network/via_rhine/dev/vr/if_vr.c index ed1c351587..737084972a 100644 --- a/src/add-ons/kernel/drivers/network/via_rhine/dev/vr/if_vr.c +++ b/src/add-ons/kernel/drivers/network/via_rhine/dev/vr/if_vr.c @@ -114,12 +114,12 @@ MODULE_DEPEND(vr, miibus, 1, 1, 1); #define VR_Q_CSUM (1<<1) #define VR_Q_CAM (1<<2) -static struct vr_type { +static const struct vr_type { u_int16_t vr_vid; u_int16_t vr_did; int vr_quirks; - char *vr_name; -} vr_devs[] = { + const char *vr_name; +} const vr_devs[] = { { VIA_VENDORID, VIA_DEVICEID_RHINE, VR_Q_NEEDALIGN, "VIA VT3043 Rhine I 10/100BaseTX" }, @@ -195,11 +195,11 @@ static void vr_setwol(struct vr_softc *); static void vr_clrwol(struct vr_softc *); static int vr_sysctl_stats(SYSCTL_HANDLER_ARGS); -static struct vr_tx_threshold_table { +static const struct vr_tx_threshold_table { int tx_cfg; int bcr_cfg; int value; -} vr_tx_threshold_tables[] = { +} const vr_tx_threshold_tables[] = { { VR_TXTHRESH_64BYTES, VR_BCR1_TXTHRESH64BYTES, 64 }, { VR_TXTHRESH_128BYTES, VR_BCR1_TXTHRESH128BYTES, 128 }, { VR_TXTHRESH_256BYTES, VR_BCR1_TXTHRESH256BYTES, 256 }, @@ -217,16 +217,12 @@ static device_method_t vr_methods[] = { DEVMETHOD(device_suspend, vr_suspend), DEVMETHOD(device_resume, vr_resume), - /* bus interface */ - DEVMETHOD(bus_print_child, bus_generic_print_child), - DEVMETHOD(bus_driver_added, bus_generic_driver_added), - /* MII interface */ DEVMETHOD(miibus_readreg, vr_miibus_readreg), DEVMETHOD(miibus_writereg, vr_miibus_writereg), DEVMETHOD(miibus_statchg, vr_miibus_statchg), - { NULL, NULL } + DEVMETHOD_END }; static driver_t vr_driver = { @@ -334,20 +330,20 @@ vr_miibus_statchg(device_t dev) (ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) return; - sc->vr_link = 0; + sc->vr_flags &= ~(VR_F_LINK | VR_F_TXPAUSE); if ((mii->mii_media_status & (IFM_ACTIVE | IFM_AVALID)) == (IFM_ACTIVE | IFM_AVALID)) { switch (IFM_SUBTYPE(mii->mii_media_active)) { case IFM_10_T: case IFM_100_TX: - sc->vr_link = 1; + sc->vr_flags |= VR_F_LINK; break; default: break; } } - if (sc->vr_link != 0) { + if ((sc->vr_flags & VR_F_LINK) != 0) { cr0 = CSR_READ_1(sc, VR_CR0); cr1 = CSR_READ_1(sc, VR_CR1); mfdx = (cr1 & VR_CR1_FULLDUPLEX) != 0; @@ -371,7 +367,6 @@ vr_miibus_statchg(device_t dev) CSR_WRITE_1(sc, VR_CR1, cr1); } fc = 0; -#ifdef notyet /* Configure flow-control. */ if (sc->vr_revid >= REV_ID_VT6105_A0) { fc = CSR_READ_1(sc, VR_FLOWCR1); @@ -380,8 +375,10 @@ vr_miibus_statchg(device_t dev) IFM_ETH_RXPAUSE) != 0) fc |= VR_FLOWCR1_RXPAUSE; if ((IFM_OPTIONS(mii->mii_media_active) & - IFM_ETH_TXPAUSE) != 0) + IFM_ETH_TXPAUSE) != 0) { fc |= VR_FLOWCR1_TXPAUSE; + sc->vr_flags |= VR_F_TXPAUSE; + } CSR_WRITE_1(sc, VR_FLOWCR1, fc); } else if (sc->vr_revid >= REV_ID_VT6102_A) { /* No Tx puase capability available for Rhine II. */ @@ -392,7 +389,6 @@ vr_miibus_statchg(device_t dev) fc |= VR_MISCCR0_RXPAUSE; CSR_WRITE_1(sc, VR_MISC_CR0, fc); } -#endif vr_rx_start(sc); vr_tx_start(sc); } else { @@ -582,10 +578,10 @@ vr_reset(const struct vr_softc *sc) * Probe for a VIA Rhine chip. Check the PCI vendor and device * IDs against our list and return a match or NULL */ -static struct vr_type * +static const struct vr_type * vr_match(device_t dev) { - struct vr_type *t = vr_devs; + const struct vr_type *t = vr_devs; for (t = vr_devs; t->vr_name != NULL; t++) if ((pci_get_vendor(dev) == t->vr_vid) && @@ -601,7 +597,7 @@ vr_match(device_t dev) static int vr_probe(device_t dev) { - struct vr_type *t; + const struct vr_type *t; t = vr_match(dev); if (t != NULL) { @@ -620,7 +616,7 @@ vr_attach(device_t dev) { struct vr_softc *sc; struct ifnet *ifp; - struct vr_type *t; + const struct vr_type *t; uint8_t eaddr[ETHER_ADDR_LEN]; int error, rid; int i, phy, pmc; @@ -795,7 +791,8 @@ vr_attach(device_t dev) else phy = CSR_READ_1(sc, VR_PHYADDR) & VR_PHYADDR_MASK; error = mii_attach(dev, &sc->vr_miibus, ifp, vr_ifmedia_upd, - vr_ifmedia_sts, BMSR_DEFCAPMASK, phy, MII_OFFSET_ANY, 0); + vr_ifmedia_sts, BMSR_DEFCAPMASK, phy, MII_OFFSET_ANY, + sc->vr_revid >= REV_ID_VT6102_A ? MIIF_DOPAUSE : 0); if (error != 0) { device_printf(dev, "attaching PHYs failed\n"); goto fail; @@ -850,7 +847,7 @@ vr_detach(device_t dev) /* These should only be active if attach succeeded. */ if (device_is_attached(dev)) { VR_LOCK(sc); - sc->vr_detach = 1; + sc->vr_flags |= VR_F_DETACHED; vr_stop(sc); VR_UNLOCK(sc); callout_drain(&sc->vr_stat_callout); @@ -1425,6 +1422,17 @@ vr_rxeof(struct vr_softc *sc) } if (prog > 0) { + /* + * Let controller know how many number of RX buffers + * are posted but avoid expensive register access if + * TX pause capability was not negotiated with link + * partner. + */ + if ((sc->vr_flags & VR_F_TXPAUSE) != 0) { + if (prog >= VR_RX_RING_CNT) + prog = VR_RX_RING_CNT - 1; + CSR_WRITE_1(sc, VR_FLOWCR0, prog); + } sc->vr_cdata.vr_rx_cons = cons; bus_dmamap_sync(sc->vr_cdata.vr_rx_ring_tag, sc->vr_cdata.vr_rx_ring_map, @@ -1571,7 +1579,7 @@ vr_tick(void *xsc) mii = device_get_softc(sc->vr_miibus); mii_tick(mii); - if (sc->vr_link == 0) + if ((sc->vr_flags & VR_F_LINK) == 0) vr_miibus_statchg(sc->vr_dev); vr_watchdog(sc); callout_reset(&sc->vr_stat_callout, hz, vr_tick, sc); @@ -1681,7 +1689,7 @@ vr_intr(void *arg) VR_LOCK(sc); - if (sc->vr_suspended != 0) + if ((sc->vr_flags & VR_F_SUSPENDED) != 0) goto done_locked; status = CSR_READ_2(sc, VR_ISR); @@ -1962,7 +1970,7 @@ vr_start_locked(struct ifnet *ifp) VR_LOCK_ASSERT(sc); if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != - IFF_DRV_RUNNING || sc->vr_link == 0) + IFF_DRV_RUNNING || (sc->vr_flags & VR_F_LINK) == 0) return; for (enq = 0; !IFQ_DRV_IS_EMPTY(&ifp->if_snd) && @@ -2100,14 +2108,32 @@ vr_init_locked(struct vr_softc *sc) /* Set flow-control parameters for Rhine III. */ if (sc->vr_revid >= REV_ID_VT6105_A0) { - /* Rx buffer count available for incoming packet. */ - CSR_WRITE_1(sc, VR_FLOWCR0, VR_RX_RING_CNT); /* - * Tx pause low threshold : 16 free receive buffers - * Tx pause XON high threshold : 48 free receive buffers + * Configure Rx buffer count available for incoming + * packet. + * Even though data sheet says almost nothing about + * this register, this register should be updated + * whenever driver adds new RX buffers to controller. + * Otherwise, XON frame is not sent to link partner + * even if controller has enough RX buffers and you + * would be isolated from network. + * The controller is not smart enough to know number + * of available RX buffers so driver have to let + * controller know how many RX buffers are posted. + * In other words, this register works like a residue + * counter for RX buffers and should be initialized + * to the number of total RX buffers - 1 before + * enabling RX MAC. Note, this register is 8bits so + * it effectively limits the maximum number of RX + * buffer to be configured by controller is 255. + */ + CSR_WRITE_1(sc, VR_FLOWCR0, VR_RX_RING_CNT - 1); + /* + * Tx pause low threshold : 8 free receive buffers + * Tx pause XON high threshold : 24 free receive buffers */ CSR_WRITE_1(sc, VR_FLOWCR1, - VR_FLOWCR1_TXLO16 | VR_FLOWCR1_TXHI48 | VR_FLOWCR1_XONXOFF); + VR_FLOWCR1_TXLO8 | VR_FLOWCR1_TXHI24 | VR_FLOWCR1_XONXOFF); /* Set Tx pause timer. */ CSR_WRITE_2(sc, VR_PAUSETIMER, 0xffff); } @@ -2132,12 +2158,12 @@ vr_init_locked(struct vr_softc *sc) if (sc->vr_revid > REV_ID_VT6102_A) CSR_WRITE_2(sc, VR_MII_IMR, 0); - sc->vr_link = 0; - mii_mediachg(mii); - ifp->if_drv_flags |= IFF_DRV_RUNNING; ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; + sc->vr_flags &= ~(VR_F_LINK | VR_F_TXPAUSE); + mii_mediachg(mii); + callout_reset(&sc->vr_stat_callout, hz, vr_tick, sc); } @@ -2157,6 +2183,7 @@ vr_ifmedia_upd(struct ifnet *ifp) mii = device_get_softc(sc->vr_miibus); LIST_FOREACH(miisc, &mii->mii_phys, mii_list) PHY_RESET(miisc); + sc->vr_flags &= ~(VR_F_LINK | VR_F_TXPAUSE); error = mii_mediachg(mii); VR_UNLOCK(sc); @@ -2180,9 +2207,9 @@ vr_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr) return; } mii_pollstat(mii); - VR_UNLOCK(sc); ifmr->ifm_active = mii->mii_media_active; ifmr->ifm_status = mii->mii_media_status; + VR_UNLOCK(sc); } static int @@ -2206,7 +2233,7 @@ vr_ioctl(struct ifnet *ifp, u_long command, caddr_t data) (IFF_PROMISC | IFF_ALLMULTI)) vr_set_filter(sc); } else { - if (sc->vr_detach == 0) + if ((sc->vr_flags & VR_F_DETACHED) == 0) vr_init_locked(sc); } } else { @@ -2294,7 +2321,7 @@ vr_watchdog(struct vr_softc *sc) if (sc->vr_cdata.vr_tx_cnt == 0) return; - if (sc->vr_link == 0) { + if ((sc->vr_flags & VR_F_LINK) == 0) { if (bootverbose) if_printf(sc->vr_ifp, "watchdog timeout " "(missed link)\n"); @@ -2472,7 +2499,7 @@ vr_suspend(device_t dev) VR_LOCK(sc); vr_stop(sc); vr_setwol(sc); - sc->vr_suspended = 1; + sc->vr_flags |= VR_F_SUSPENDED; VR_UNLOCK(sc); return (0); @@ -2493,7 +2520,7 @@ vr_resume(device_t dev) if (ifp->if_flags & IFF_UP) vr_init_locked(sc); - sc->vr_suspended = 0; + sc->vr_flags &= ~VR_F_SUSPENDED; VR_UNLOCK(sc); return (0); diff --git a/src/add-ons/kernel/drivers/network/via_rhine/dev/vr/if_vrreg.h b/src/add-ons/kernel/drivers/network/via_rhine/dev/vr/if_vrreg.h index 5e2b6b8403..2445babd7a 100644 --- a/src/add-ons/kernel/drivers/network/via_rhine/dev/vr/if_vrreg.h +++ b/src/add-ons/kernel/drivers/network/via_rhine/dev/vr/if_vrreg.h @@ -720,20 +720,21 @@ struct vr_softc { void *vr_intrhand; device_t vr_miibus; uint8_t vr_revid; /* Rhine chip revision */ - uint8_t vr_flags; /* See VR_F_* below */ -#define VR_F_RESTART 0x01 /* Restart unit on next tick */ + int vr_flags; /* See VR_F_* below */ +#define VR_F_RESTART 0x0001 /* Restart unit on next tick */ +#define VR_F_TXPAUSE 0x0010 +#define VR_F_SUSPENDED 0x2000 +#define VR_F_DETACHED 0x4000 +#define VR_F_LINK 0x8000 int vr_if_flags; struct vr_chain_data vr_cdata; struct vr_ring_data vr_rdata; struct vr_statistics vr_stat; struct callout vr_stat_callout; struct mtx vr_mtx; - int vr_suspended; /* if 1, sleeping/detaching */ int vr_quirks; - int vr_link; int vr_watchdog_timer; int vr_txthresh; - int vr_detach; #ifdef DEVICE_POLLING int rxcycles; #endif diff --git a/src/add-ons/kernel/drivers/network/vt612x/dev/mii/ciphy.c b/src/add-ons/kernel/drivers/network/vt612x/dev/mii/ciphy.c index 2133c76ca0..87d0d814e9 100644 --- a/src/add-ons/kernel/drivers/network/vt612x/dev/mii/ciphy.c +++ b/src/add-ons/kernel/drivers/network/vt612x/dev/mii/ciphy.c @@ -67,7 +67,7 @@ static device_method_t ciphy_methods[] = { DEVMETHOD(device_attach, ciphy_attach), DEVMETHOD(device_detach, mii_phy_detach), DEVMETHOD(device_shutdown, bus_generic_shutdown), - { 0, 0 } + DEVMETHOD_END }; static devclass_t ciphy_devclass; diff --git a/src/add-ons/kernel/drivers/network/vt612x/dev/mii/ukphy.c b/src/add-ons/kernel/drivers/network/vt612x/dev/mii/ukphy.c index 4ecfce29d3..9d52eb580c 100644 --- a/src/add-ons/kernel/drivers/network/vt612x/dev/mii/ukphy.c +++ b/src/add-ons/kernel/drivers/network/vt612x/dev/mii/ukphy.c @@ -55,7 +55,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/mii/ukphy.c,v 1.20.10.6.2.1 2010/12/21 17:09:25 kensmith Exp $"); +__FBSDID("$FreeBSD$"); /* * driver for generic unknown PHYs @@ -86,7 +86,7 @@ static device_method_t ukphy_methods[] = { DEVMETHOD(device_attach, ukphy_attach), DEVMETHOD(device_detach, mii_phy_detach), DEVMETHOD(device_shutdown, bus_generic_shutdown), - { 0, 0 } + DEVMETHOD_END }; static devclass_t ukphy_devclass; diff --git a/src/add-ons/kernel/drivers/network/vt612x/dev/mii/ukphy_subr.c b/src/add-ons/kernel/drivers/network/vt612x/dev/mii/ukphy_subr.c index 73007e197b..5f2f6341ba 100644 --- a/src/add-ons/kernel/drivers/network/vt612x/dev/mii/ukphy_subr.c +++ b/src/add-ons/kernel/drivers/network/vt612x/dev/mii/ukphy_subr.c @@ -31,7 +31,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/mii/ukphy_subr.c,v 1.10.2.4.2.1 2010/12/21 17:09:25 kensmith Exp $"); +__FBSDID("$FreeBSD$"); /* * Subroutines shared by the ukphy driver and other PHY drivers. diff --git a/src/add-ons/kernel/drivers/network/vt612x/dev/vge/if_vge.c b/src/add-ons/kernel/drivers/network/vt612x/dev/vge/if_vge.c index 3ffee38a6e..a49af277f5 100644 --- a/src/add-ons/kernel/drivers/network/vt612x/dev/vge/if_vge.c +++ b/src/add-ons/kernel/drivers/network/vt612x/dev/vge/if_vge.c @@ -31,7 +31,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/vge/if_vge.c,v 1.37.2.12.2.1 2010/12/21 17:09:25 kensmith Exp $"); +__FBSDID("$FreeBSD$"); /* * VIA Networking Technologies VT612x PCI gigabit ethernet NIC driver. @@ -173,6 +173,7 @@ static __inline void static void vge_freebufs(struct vge_softc *); static void vge_ifmedia_sts(struct ifnet *, struct ifmediareq *); static int vge_ifmedia_upd(struct ifnet *); +static int vge_ifmedia_upd_locked(struct vge_softc *); static void vge_init(void *); static void vge_init_locked(struct vge_softc *); static void vge_intr(void *); @@ -180,7 +181,6 @@ static void vge_intr_holdoff(struct vge_softc *); static int vge_ioctl(struct ifnet *, u_long, caddr_t); static void vge_link_statchg(void *); static int vge_miibus_readreg(device_t, int, int); -static void vge_miibus_statchg(device_t); static int vge_miibus_writereg(device_t, int, int, int); static void vge_miipoll_start(struct vge_softc *); static void vge_miipoll_stop(struct vge_softc *); @@ -190,6 +190,7 @@ static void vge_reset(struct vge_softc *); static int vge_rx_list_init(struct vge_softc *); static int vge_rxeof(struct vge_softc *, int); static void vge_rxfilter(struct vge_softc *); +static void vge_setmedia(struct vge_softc *); static void vge_setvlan(struct vge_softc *); static void vge_setwol(struct vge_softc *); static void vge_start(struct ifnet *); @@ -211,16 +212,11 @@ static device_method_t vge_methods[] = { DEVMETHOD(device_resume, vge_resume), DEVMETHOD(device_shutdown, vge_shutdown), - /* bus interface */ - DEVMETHOD(bus_print_child, bus_generic_print_child), - DEVMETHOD(bus_driver_added, bus_generic_driver_added), - /* MII interface */ DEVMETHOD(miibus_readreg, vge_miibus_readreg), DEVMETHOD(miibus_writereg, vge_miibus_writereg), - DEVMETHOD(miibus_statchg, vge_miibus_statchg), - { 0, 0 } + DEVMETHOD_END }; static driver_t vge_driver = { @@ -1099,10 +1095,11 @@ vge_attach(device_t dev) goto fail; } + vge_miipoll_start(sc); /* Do MII setup */ error = mii_attach(dev, &sc->vge_miibus, ifp, vge_ifmedia_upd, vge_ifmedia_sts, BMSR_DEFCAPMASK, sc->vge_phyaddr, MII_OFFSET_ANY, - 0); + MIIF_DOPAUSE); if (error != 0) { device_printf(dev, "attaching PHYs failed\n"); goto fail; @@ -1660,30 +1657,41 @@ vge_link_statchg(void *xsc) { struct vge_softc *sc; struct ifnet *ifp; - struct mii_data *mii; + uint8_t physts; sc = xsc; ifp = sc->vge_ifp; VGE_LOCK_ASSERT(sc); - mii = device_get_softc(sc->vge_miibus); - mii_pollstat(mii); - if ((sc->vge_flags & VGE_FLAG_LINK) != 0) { - if (!(mii->mii_media_status & IFM_ACTIVE)) { + physts = CSR_READ_1(sc, VGE_PHYSTS0); + if ((physts & VGE_PHYSTS_RESETSTS) == 0) { + if ((physts & VGE_PHYSTS_LINK) == 0) { sc->vge_flags &= ~VGE_FLAG_LINK; if_link_state_change(sc->vge_ifp, LINK_STATE_DOWN); - } - } else { - if (mii->mii_media_status & IFM_ACTIVE && - IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE) { + } else { sc->vge_flags |= VGE_FLAG_LINK; if_link_state_change(sc->vge_ifp, LINK_STATE_UP); + CSR_WRITE_1(sc, VGE_CRC2, VGE_CR2_FDX_TXFLOWCTL_ENABLE | + VGE_CR2_FDX_RXFLOWCTL_ENABLE); + if ((physts & VGE_PHYSTS_FDX) != 0) { + if ((physts & VGE_PHYSTS_TXFLOWCAP) != 0) + CSR_WRITE_1(sc, VGE_CRS2, + VGE_CR2_FDX_TXFLOWCTL_ENABLE); + if ((physts & VGE_PHYSTS_RXFLOWCAP) != 0) + CSR_WRITE_1(sc, VGE_CRS2, + VGE_CR2_FDX_RXFLOWCTL_ENABLE); + } if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) vge_start_locked(ifp); } } + /* + * Restart MII auto-polling because link state change interrupt + * will disable it. + */ + vge_miipoll_start(sc); } #ifdef DEVICE_POLLING @@ -2028,6 +2036,7 @@ vge_init_locked(struct vge_softc *sc) */ vge_stop(sc); vge_reset(sc); + vge_miipoll_start(sc); /* * Initialize the RX and TX descriptors and mbufs. @@ -2099,9 +2108,16 @@ vge_init_locked(struct vge_softc *sc) vge_rxfilter(sc); vge_setvlan(sc); - /* Enable flow control */ - - CSR_WRITE_1(sc, VGE_CRS2, 0x8B); + /* Initialize pause timer. */ + CSR_WRITE_2(sc, VGE_TX_PAUSE_TIMER, 0xFFFF); + /* + * Initialize flow control parameters. + * TX XON high threshold : 48 + * TX pause low threshold : 24 + * Disable hald-duplex flow control + */ + CSR_WRITE_1(sc, VGE_CRC2, 0xFF); + CSR_WRITE_1(sc, VGE_CRS2, VGE_CR2_XON_ENABLE | 0x0B); /* Enable jumbo frame reception (if desired) */ @@ -2129,7 +2145,7 @@ vge_init_locked(struct vge_softc *sc) CSR_WRITE_1(sc, VGE_CRS3, VGE_CR3_INT_GMSK); sc->vge_flags &= ~VGE_FLAG_LINK; - mii_mediachg(mii); + vge_ifmedia_upd_locked(sc); ifp->if_drv_flags |= IFF_DRV_RUNNING; ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; @@ -2143,18 +2159,32 @@ static int vge_ifmedia_upd(struct ifnet *ifp) { struct vge_softc *sc; - struct mii_data *mii; int error; sc = ifp->if_softc; VGE_LOCK(sc); - mii = device_get_softc(sc->vge_miibus); - error = mii_mediachg(mii); + error = vge_ifmedia_upd_locked(sc); VGE_UNLOCK(sc); return (error); } +static int +vge_ifmedia_upd_locked(struct vge_softc *sc) +{ + struct mii_data *mii; + struct mii_softc *miisc; + int error; + + mii = device_get_softc(sc->vge_miibus); + LIST_FOREACH(miisc, &mii->mii_phys, mii_list) + PHY_RESET(miisc); + vge_setmedia(sc); + error = mii_mediachg(mii); + + return (error); +} + /* * Report current media status. */ @@ -2173,19 +2203,17 @@ vge_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr) return; } mii_pollstat(mii); - VGE_UNLOCK(sc); ifmr->ifm_active = mii->mii_media_active; ifmr->ifm_status = mii->mii_media_status; + VGE_UNLOCK(sc); } static void -vge_miibus_statchg(device_t dev) +vge_setmedia(struct vge_softc *sc) { - struct vge_softc *sc; struct mii_data *mii; struct ifmedia_entry *ife; - sc = device_get_softc(dev); mii = device_get_softc(sc->vge_miibus); ife = mii->mii_media.ifm_cur; @@ -2219,7 +2247,7 @@ vge_miibus_statchg(device_t dev) } break; default: - device_printf(dev, "unknown media type: %x\n", + device_printf(sc->vge_dev, "unknown media type: %x\n", IFM_SUBTYPE(ife->ifm_media)); break; } @@ -2772,6 +2800,9 @@ vge_setlinkspeed(struct vge_softc *sc) break; } } + /* Clear forced MAC speed/duplex configuration. */ + CSR_CLRBIT_1(sc, VGE_DIAGCTL, VGE_DIAGCTL_MACFORCE); + CSR_CLRBIT_1(sc, VGE_DIAGCTL, VGE_DIAGCTL_FDXFORCE); vge_miibus_writereg(sc->vge_dev, sc->vge_phyaddr, MII_100T2CR, 0); vge_miibus_writereg(sc->vge_dev, sc->vge_phyaddr, MII_ANAR, ANAR_TX_FD | ANAR_TX | ANAR_10_FD | ANAR_10 | ANAR_CSMA); diff --git a/src/add-ons/kernel/drivers/network/vt612x/dev/vge/if_vgereg.h b/src/add-ons/kernel/drivers/network/vt612x/dev/vge/if_vgereg.h index a21f11e563..c8b3f1bb45 100644 --- a/src/add-ons/kernel/drivers/network/vt612x/dev/vge/if_vgereg.h +++ b/src/add-ons/kernel/drivers/network/vt612x/dev/vge/if_vgereg.h @@ -29,7 +29,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/sys/dev/vge/if_vgereg.h,v 1.2.22.6.4.1 2010/12/21 17:09:25 kensmith Exp $ + * $FreeBSD$ */ /* diff --git a/src/add-ons/kernel/drivers/network/vt612x/dev/vge/if_vgevar.h b/src/add-ons/kernel/drivers/network/vt612x/dev/vge/if_vgevar.h index d73370b50a..ca899cc5fc 100644 --- a/src/add-ons/kernel/drivers/network/vt612x/dev/vge/if_vgevar.h +++ b/src/add-ons/kernel/drivers/network/vt612x/dev/vge/if_vgevar.h @@ -29,7 +29,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/sys/dev/vge/if_vgevar.h,v 1.4.22.9.4.1 2010/12/21 17:09:25 kensmith Exp $ + * $FreeBSD$ */ #define VGE_JUMBO_MTU 9000 diff --git a/src/add-ons/kernel/drivers/network/wlan/aironetwifi/dev/an/if_an.c b/src/add-ons/kernel/drivers/network/wlan/aironetwifi/dev/an/if_an.c index 0898961e95..ef729932d2 100644 --- a/src/add-ons/kernel/drivers/network/wlan/aironetwifi/dev/an/if_an.c +++ b/src/add-ons/kernel/drivers/network/wlan/aironetwifi/dev/an/if_an.c @@ -796,7 +796,7 @@ an_attach(struct an_softc *sc, int flags) ADD(IFM_AUTO, IFM_IEEE80211_ADHOC); for (i = 0; i < nrate; i++) { r = sc->an_caps.an_rates[i]; - mword = ieee80211_rate2media(NULL, r, IEEE80211_T_DS); + mword = ieee80211_rate2media(NULL, r, IEEE80211_MODE_AUTO); if (mword == 0) continue; printf("%s%d%sMbps", (i != 0 ? " " : ""), @@ -3298,7 +3298,7 @@ an_media_status(struct ifnet *ifp, struct ifmediareq *imr) if (sc->an_config.an_opmode == AN_OPMODE_IBSS_ADHOC) imr->ifm_active |= IFM_IEEE80211_ADHOC; imr->ifm_active |= ieee80211_rate2media(NULL, - status.an_current_tx_rate, IEEE80211_T_DS); + status.an_current_tx_rate, IEEE80211_MODE_AUTO); imr->ifm_status = IFM_AVALID; if (status.an_opmode & AN_STATUS_OPMODE_ASSOCIATED) imr->ifm_status |= IFM_ACTIVE; diff --git a/src/add-ons/kernel/drivers/network/wlan/aironetwifi/dev/an/if_an_pci.c b/src/add-ons/kernel/drivers/network/wlan/aironetwifi/dev/an/if_an_pci.c index 2d0d2b5a66..fe3467d83e 100644 --- a/src/add-ons/kernel/drivers/network/wlan/aironetwifi/dev/an/if_an_pci.c +++ b/src/add-ons/kernel/drivers/network/wlan/aironetwifi/dev/an/if_an_pci.c @@ -195,7 +195,7 @@ an_attach_pci(dev) } /* Allocate DMA region */ - error = bus_dma_tag_create(NULL, /* parent */ + error = bus_dma_tag_create(bus_get_dma_tag(dev),/* parent */ 1, 0, /* alignment, bounds */ BUS_SPACE_MAXADDR_32BIT, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ diff --git a/src/add-ons/kernel/drivers/network/wlan/atheroswifi/dev/ath/ath_dfs/null/dfs_null.c b/src/add-ons/kernel/drivers/network/wlan/atheroswifi/dev/ath/ath_dfs/null/dfs_null.c index a3bae91458..75574b4e4a 100644 --- a/src/add-ons/kernel/drivers/network/wlan/atheroswifi/dev/ath/ath_dfs/null/dfs_null.c +++ b/src/add-ons/kernel/drivers/network/wlan/atheroswifi/dev/ath/ath_dfs/null/dfs_null.c @@ -128,7 +128,7 @@ ath_dfs_process_radar_event(struct ath_softc *sc, } /* - * Determine whether the the DFS check task needs to be queued. + * Determine whether the DFS check task needs to be queued. * * This is called in the RX task when the current batch of packets * have been received. It will return whether there are any radar diff --git a/src/add-ons/kernel/drivers/network/wlan/atheroswifi/dev/ath/ath_hal/ar5210/ar5210reg.h b/src/add-ons/kernel/drivers/network/wlan/atheroswifi/dev/ath/ath_hal/ar5210/ar5210reg.h index 894d9bbd85..738210743f 100644 --- a/src/add-ons/kernel/drivers/network/wlan/atheroswifi/dev/ath/ath_hal/ar5210/ar5210reg.h +++ b/src/add-ons/kernel/drivers/network/wlan/atheroswifi/dev/ath/ath_hal/ar5210/ar5210reg.h @@ -245,9 +245,20 @@ #define AR_SCR_SLDUR 0x0000ffff /* sleep duration */ #define AR_SCR_SLE 0x00030000 /* sleep enable */ #define AR_SCR_SLE_S 16 -#define AR_SCR_SLE_WAKE 0x00000000 /* force wake */ -#define AR_SCR_SLE_SLP 0x00010000 /* force sleep */ -#define AR_SCR_SLE_ALLOW 0x00020000 /* allow to control sleep */ +/* + * The previous values for the following three defines were: + * + * AR_SCR_SLE_WAKE 0x00000000 + * AR_SCR_SLE_SLP 0x00010000 + * AR_SCR_SLE_ALLOW 0x00020000 + * + * However, these have been pre-shifted with AR_SCR_SLE_S. The + * OS_REG_READ() macro would attempt to shift them again, effectively + * shifting out any of the set bits completely. + */ +#define AR_SCR_SLE_WAKE 0 /* force wake */ +#define AR_SCR_SLE_SLP 1 /* force sleep */ +#define AR_SCR_SLE_ALLOW 2 /* allow to control sleep */ #define AR_SCR_BITS "\20\20SLE_SLP\21SLE_ALLOW" #define AR_INTPEND_IP 0x00000001 /* interrupt pending */ diff --git a/src/add-ons/kernel/drivers/network/wlan/atheroswifi/dev/ath/ath_hal/ar5211/ar5211reg.h b/src/add-ons/kernel/drivers/network/wlan/atheroswifi/dev/ath/ath_hal/ar5211/ar5211reg.h index 647f20db45..93d4fc5d9b 100644 --- a/src/add-ons/kernel/drivers/network/wlan/atheroswifi/dev/ath/ath_hal/ar5211/ar5211reg.h +++ b/src/add-ons/kernel/drivers/network/wlan/atheroswifi/dev/ath/ath_hal/ar5211/ar5211reg.h @@ -618,9 +618,20 @@ #define AR_SCR_SLDUR_S 0 #define AR_SCR_SLE 0x00030000 /* sleep enable mask */ #define AR_SCR_SLE_S 16 /* sleep enable bits shift */ -#define AR_SCR_SLE_WAKE 0x00000000 /* force wake */ -#define AR_SCR_SLE_SLP 0x00010000 /* force sleep */ -#define AR_SCR_SLE_NORM 0x00020000 /* sleep logic normal operation */ +/* + * The previous values for the following three defines were: + * + * AR_SCR_SLE_WAKE 0x00000000 + * AR_SCR_SLE_SLP 0x00010000 + * AR_SCR_SLE_NORM 0x00020000 + * + * However, these have been pre-shifted with AR_SCR_SLE_S. The + * OS_REG_READ() macro would attempt to shift them again, effectively + * shifting out any of the set bits completely. + */ +#define AR_SCR_SLE_WAKE 0 /* force wake */ +#define AR_SCR_SLE_SLP 1 /* force sleep */ +#define AR_SCR_SLE_NORM 2 /* sleep logic normal operation */ #define AR_SCR_SLE_UNITS 0x00000008 /* SCR units/TU */ #define AR_SCR_BITS "\20\20SLE_SLP\21SLE" diff --git a/src/add-ons/kernel/drivers/network/wlan/atheroswifi/dev/ath/ath_hal/ar5212/ar5212_misc.c b/src/add-ons/kernel/drivers/network/wlan/atheroswifi/dev/ath/ath_hal/ar5212/ar5212_misc.c index 5bcde762a5..e1eab2c6cc 100644 --- a/src/add-ons/kernel/drivers/network/wlan/atheroswifi/dev/ath/ath_hal/ar5212/ar5212_misc.c +++ b/src/add-ons/kernel/drivers/network/wlan/atheroswifi/dev/ath/ath_hal/ar5212/ar5212_misc.c @@ -573,7 +573,7 @@ ar5212SetDecompMask(struct ath_hal *ah, uint16_t keyidx, int en) struct ath_hal_5212 *ahp = AH5212(ah); if (keyidx >= HAL_DECOMP_MASK_SIZE) - return HAL_EINVAL; + return AH_FALSE; OS_REG_WRITE(ah, AR_DCM_A, keyidx); OS_REG_WRITE(ah, AR_DCM_D, en ? AR_DCM_D_EN : 0); ahp->ah_decompMask[keyidx] = en; diff --git a/src/add-ons/kernel/drivers/network/wlan/atheroswifi/dev/ath/ath_hal/ar5416/ar5416_misc.c b/src/add-ons/kernel/drivers/network/wlan/atheroswifi/dev/ath/ath_hal/ar5416/ar5416_misc.c index 7e61c84930..68c4117436 100644 --- a/src/add-ons/kernel/drivers/network/wlan/atheroswifi/dev/ath/ath_hal/ar5416/ar5416_misc.c +++ b/src/add-ons/kernel/drivers/network/wlan/atheroswifi/dev/ath/ath_hal/ar5416/ar5416_misc.c @@ -155,7 +155,7 @@ ar5416SetAntennaSwitch(struct ath_hal *ah, HAL_ANT_SETTING settings) HAL_BOOL ar5416SetDecompMask(struct ath_hal *ah, uint16_t keyidx, int en) { - return HAL_OK; + return AH_TRUE; } /* Setup coverage class */ diff --git a/src/add-ons/kernel/drivers/network/wlan/atheroswifi/dev/ath/if_ath.c b/src/add-ons/kernel/drivers/network/wlan/atheroswifi/dev/ath/if_ath.c index 6ba6b1ae06..de6e49eaae 100644 --- a/src/add-ons/kernel/drivers/network/wlan/atheroswifi/dev/ath/if_ath.c +++ b/src/add-ons/kernel/drivers/network/wlan/atheroswifi/dev/ath/if_ath.c @@ -119,9 +119,9 @@ __FBSDID("$FreeBSD$"); CTASSERT(ATH_BCBUF <= 8); static struct ieee80211vap *ath_vap_create(struct ieee80211com *, - const char name[IFNAMSIZ], int unit, int opmode, - int flags, const uint8_t bssid[IEEE80211_ADDR_LEN], - const uint8_t mac[IEEE80211_ADDR_LEN]); + const char [IFNAMSIZ], int, enum ieee80211_opmode, int, + const uint8_t [IEEE80211_ADDR_LEN], + const uint8_t [IEEE80211_ADDR_LEN]); static void ath_vap_delete(struct ieee80211vap *); static void ath_init(void *); static void ath_stop_locked(struct ifnet *); @@ -849,16 +849,17 @@ assign_bslot(struct ath_softc *sc) } static struct ieee80211vap * -ath_vap_create(struct ieee80211com *ic, - const char name[IFNAMSIZ], int unit, int opmode, int flags, - const uint8_t bssid[IEEE80211_ADDR_LEN], - const uint8_t mac0[IEEE80211_ADDR_LEN]) +ath_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], int unit, + enum ieee80211_opmode opmode, int flags, + const uint8_t bssid[IEEE80211_ADDR_LEN], + const uint8_t mac0[IEEE80211_ADDR_LEN]) { struct ath_softc *sc = ic->ic_ifp->if_softc; struct ath_vap *avp; struct ieee80211vap *vap; uint8_t mac[IEEE80211_ADDR_LEN]; - int ic_opmode, needbeacon, error; + int needbeacon, error; + enum ieee80211_opmode ic_opmode; avp = (struct ath_vap *) malloc(sizeof(struct ath_vap), M_80211_VAP, M_WAITOK | M_ZERO); diff --git a/src/add-ons/kernel/drivers/network/wlan/atheroswifi/dev/ath/if_ath_sysctl.c b/src/add-ons/kernel/drivers/network/wlan/atheroswifi/dev/ath/if_ath_sysctl.c index ea6f949bdb..4c60275bb0 100644 --- a/src/add-ons/kernel/drivers/network/wlan/atheroswifi/dev/ath/if_ath_sysctl.c +++ b/src/add-ons/kernel/drivers/network/wlan/atheroswifi/dev/ath/if_ath_sysctl.c @@ -756,7 +756,7 @@ ath_sysctl_hal_attach(struct ath_softc *sc) sc->sc_ah->ah_config.ah_ar5416_biasadj = 0; SYSCTL_ADD_INT(ctx, child, OID_AUTO, "ar5416_biasadj", CTLFLAG_RW, &sc->sc_ah->ah_config.ah_ar5416_biasadj, 0, - "Enable 2ghz AR5416 direction sensitivity bias adjust"); + "Enable 2GHz AR5416 direction sensitivity bias adjust"); sc->sc_ah->ah_config.ah_dma_beacon_response_time = 2; SYSCTL_ADD_INT(ctx, child, OID_AUTO, "dma_brt", CTLFLAG_RW, diff --git a/src/add-ons/kernel/drivers/network/wlan/broadcom43xx/dev/bwi/bwiphy.c b/src/add-ons/kernel/drivers/network/wlan/broadcom43xx/dev/bwi/bwiphy.c index c41c0f8548..d817d26034 100644 --- a/src/add-ons/kernel/drivers/network/wlan/broadcom43xx/dev/bwi/bwiphy.c +++ b/src/add-ons/kernel/drivers/network/wlan/broadcom43xx/dev/bwi/bwiphy.c @@ -796,7 +796,7 @@ bwi_phy_config_11g(struct bwi_mac *mac) bwi_tbl_write_2(mac, BWI_PHYTBL_RSSI + i, i); /* Fill noise table */ - for (i = 0; i < sizeof(bwi_phy_noise_11g); ++i) { + for (i = 0; i < N(bwi_phy_noise_11g); ++i) { bwi_tbl_write_2(mac, BWI_PHYTBL_NOISE + i, bwi_phy_noise_11g[i]); } diff --git a/src/add-ons/kernel/drivers/network/wlan/broadcom43xx/dev/bwi/if_bwi.c b/src/add-ons/kernel/drivers/network/wlan/broadcom43xx/dev/bwi/if_bwi.c index f789ca0ba5..3e0f294e98 100644 --- a/src/add-ons/kernel/drivers/network/wlan/broadcom43xx/dev/bwi/if_bwi.c +++ b/src/add-ons/kernel/drivers/network/wlan/broadcom43xx/dev/bwi/if_bwi.c @@ -1,13 +1,13 @@ /* * Copyright (c) 2007 The DragonFly Project. All rights reserved. - * + * * This code is derived from software contributed to The DragonFly Project * by Sepherosa Ziehau - * + * * 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 @@ -17,7 +17,7 @@ * 3. Neither the name of The DragonFly Project 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 COPYRIGHT HOLDERS AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS @@ -30,7 +30,7 @@ * 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. - * + * * $DragonFly: src/sys/dev/netif/bwi/if_bwi.c,v 1.19 2008/02/15 11:15:38 sephe Exp $ */ @@ -52,7 +52,7 @@ __FBSDID("$FreeBSD$"); #include #include #include - + #include #include #include @@ -70,7 +70,7 @@ __FBSDID("$FreeBSD$"); #include #ifdef INET -#include +#include #include #endif @@ -96,9 +96,9 @@ struct bwi_myaddr_bssid { } __packed; static struct ieee80211vap *bwi_vap_create(struct ieee80211com *, - const char [IFNAMSIZ], int, int, int, - const uint8_t [IEEE80211_ADDR_LEN], - const uint8_t [IEEE80211_ADDR_LEN]); + const char [IFNAMSIZ], int, enum ieee80211_opmode, int, + const uint8_t [IEEE80211_ADDR_LEN], + const uint8_t [IEEE80211_ADDR_LEN]); static void bwi_vap_delete(struct ieee80211vap *); static void bwi_init(void *); static int bwi_ioctl(struct ifnet *, u_long, caddr_t); @@ -118,8 +118,7 @@ static void bwi_calibrate(void *); static int bwi_calc_rssi(struct bwi_softc *, const struct bwi_rxbuf_hdr *); static int bwi_calc_noise(struct bwi_softc *); -static __inline uint8_t bwi_ofdm_plcp2rate(const uint32_t *); -static __inline uint8_t bwi_ds_plcp2rate(const struct ieee80211_ds_plcp_hdr *); +static __inline uint8_t bwi_plcp2rate(uint32_t, enum ieee80211_phytype); static void bwi_rx_radiotap(struct bwi_softc *, struct mbuf *, struct bwi_rxbuf_hdr *, const void *, int, int, int); @@ -221,7 +220,7 @@ static const struct { } bwi_bbpid_map[] = { { 0x4301, 0x4301, 0x4301 }, { 0x4305, 0x4307, 0x4307 }, - { 0x4403, 0x4403, 0x4402 }, + { 0x4402, 0x4403, 0x4402 }, { 0x4610, 0x4615, 0x4610 }, { 0x4710, 0x4715, 0x4710 }, { 0x4720, 0x4725, 0x4309 } @@ -592,10 +591,10 @@ bwi_detach(struct bwi_softc *sc) } static struct ieee80211vap * -bwi_vap_create(struct ieee80211com *ic, - const char name[IFNAMSIZ], int unit, int opmode, int flags, - const uint8_t bssid[IEEE80211_ADDR_LEN], - const uint8_t mac[IEEE80211_ADDR_LEN]) +bwi_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], int unit, + enum ieee80211_opmode opmode, int flags, + const uint8_t bssid[IEEE80211_ADDR_LEN], + const uint8_t mac[IEEE80211_ADDR_LEN]) { struct bwi_vap *bvp; struct ieee80211vap *vap; @@ -1805,7 +1804,7 @@ bwi_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg) * the same AP, this will reinialize things * correctly... */ - if (ic->ic_opmode == IEEE80211_M_STA && + if (ic->ic_opmode == IEEE80211_M_STA && !(sc->sc_flags & BWI_F_STOP)) bwi_set_bssid(sc, bwi_zero_addr); } @@ -2635,7 +2634,7 @@ bwi_rxeof(struct bwi_softc *sc, int end_idx) struct ieee80211_frame_min *wh; struct ieee80211_node *ni; struct mbuf *m; - const void *plcp; + uint32_t plcp; uint16_t flags2; int buflen, wh_ofs, hdr_extra, rssi, noise, type, rate; @@ -2665,7 +2664,7 @@ bwi_rxeof(struct bwi_softc *sc, int end_idx) goto next; } - plcp = ((const uint8_t *)(hdr + 1) + hdr_extra); + bcopy((uint8_t *)(hdr + 1) + hdr_extra, &plcp, sizeof(plcp)); rssi = bwi_calc_rssi(sc, hdr); noise = bwi_calc_noise(sc); @@ -2674,13 +2673,13 @@ bwi_rxeof(struct bwi_softc *sc, int end_idx) m_adj(m, sizeof(*hdr) + wh_ofs); if (htole16(hdr->rxh_flags1) & BWI_RXH_F1_OFDM) - rate = bwi_ofdm_plcp2rate(plcp); + rate = bwi_plcp2rate(plcp, IEEE80211_T_OFDM); else - rate = bwi_ds_plcp2rate(plcp); + rate = bwi_plcp2rate(plcp, IEEE80211_T_CCK); /* RX radio tap */ if (ieee80211_radiotap_active(ic)) - bwi_rx_radiotap(sc, m, hdr, plcp, rate, rssi, noise); + bwi_rx_radiotap(sc, m, hdr, &plcp, rate, rssi, noise); m_adj(m, -IEEE80211_CRC_LEN); @@ -3808,20 +3807,10 @@ bwi_calc_noise(struct bwi_softc *sc) } static __inline uint8_t -bwi_ofdm_plcp2rate(const uint32_t *plcp0) +bwi_plcp2rate(const uint32_t plcp0, enum ieee80211_phytype type) { - uint32_t plcp; - uint8_t plcp_rate; - - plcp = le32toh(*plcp0); - plcp_rate = __SHIFTOUT(plcp, IEEE80211_OFDM_PLCP_RATE_MASK); - return ieee80211_plcp2rate(plcp_rate, IEEE80211_T_OFDM); -} - -static __inline uint8_t -bwi_ds_plcp2rate(const struct ieee80211_ds_plcp_hdr *hdr) -{ - return ieee80211_plcp2rate(hdr->i_signal, IEEE80211_T_DS); + uint32_t plcp = le32toh(plcp0) & IEEE80211_OFDM_PLCP_RATE_MASK; + return (ieee80211_plcp2rate(plcp, type)); } static void diff --git a/src/add-ons/kernel/drivers/network/wlan/broadcom43xx/dev/bwi/if_bwivar.h b/src/add-ons/kernel/drivers/network/wlan/broadcom43xx/dev/bwi/if_bwivar.h index bb35623a15..7a8a59bdf3 100644 --- a/src/add-ons/kernel/drivers/network/wlan/broadcom43xx/dev/bwi/if_bwivar.h +++ b/src/add-ons/kernel/drivers/network/wlan/broadcom43xx/dev/bwi/if_bwivar.h @@ -1,13 +1,13 @@ /* * Copyright (c) 2007 The DragonFly Project. All rights reserved. - * + * * This code is derived from software contributed to The DragonFly Project * by Sepherosa Ziehau - * + * * 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 @@ -17,7 +17,7 @@ * 3. Neither the name of The DragonFly Project 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 COPYRIGHT HOLDERS AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS @@ -30,7 +30,7 @@ * 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. - * + * * $DragonFly: src/sys/dev/netif/bwi/if_bwivar.h,v 1.14 2008/02/15 11:15:38 sephe Exp $ * $FreeBSD$ */ diff --git a/src/add-ons/kernel/drivers/network/wlan/iprowifi2100/dev/ipw/if_ipw.c b/src/add-ons/kernel/drivers/network/wlan/iprowifi2100/dev/ipw/if_ipw.c index 0a576ab064..24f0a1f36e 100644 --- a/src/add-ons/kernel/drivers/network/wlan/iprowifi2100/dev/ipw/if_ipw.c +++ b/src/add-ons/kernel/drivers/network/wlan/iprowifi2100/dev/ipw/if_ipw.c @@ -108,9 +108,9 @@ static const struct ipw_ident ipw_ident_table[] = { }; static struct ieee80211vap *ipw_vap_create(struct ieee80211com *, - const char name[IFNAMSIZ], int unit, int opmode, int flags, - const uint8_t bssid[IEEE80211_ADDR_LEN], - const uint8_t mac[IEEE80211_ADDR_LEN]); + const char [IFNAMSIZ], int, enum ieee80211_opmode, int, + const uint8_t [IEEE80211_ADDR_LEN], + const uint8_t [IEEE80211_ADDR_LEN]); static void ipw_vap_delete(struct ieee80211vap *); static int ipw_dma_alloc(struct ipw_softc *); static void ipw_release(struct ipw_softc *); @@ -428,10 +428,10 @@ ipw_detach(device_t dev) } static struct ieee80211vap * -ipw_vap_create(struct ieee80211com *ic, - const char name[IFNAMSIZ], int unit, int opmode, int flags, - const uint8_t bssid[IEEE80211_ADDR_LEN], - const uint8_t mac[IEEE80211_ADDR_LEN]) +ipw_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], int unit, + enum ieee80211_opmode opmode, int flags, + const uint8_t bssid[IEEE80211_ADDR_LEN], + const uint8_t mac[IEEE80211_ADDR_LEN]) { struct ifnet *ifp = ic->ic_ifp; struct ipw_softc *sc = ifp->if_softc; @@ -527,10 +527,22 @@ ipw_dma_alloc(struct ipw_softc *sc) bus_addr_t physaddr; int error, i; + /* + * Allocate parent DMA tag for subsequent allocations. + */ + error = bus_dma_tag_create(bus_get_dma_tag(sc->sc_dev), 1, 0, + BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, + BUS_SPACE_MAXSIZE_32BIT, BUS_SPACE_UNRESTRICTED, + BUS_SPACE_MAXSIZE_32BIT, 0, NULL, NULL, &sc->parent_dmat); + if (error != 0) { + device_printf(sc->sc_dev, "could not create parent DMA tag\n"); + goto fail; + } + /* * Allocate and map tx ring. */ - error = bus_dma_tag_create(NULL, 4, 0, BUS_SPACE_MAXADDR_32BIT, + error = bus_dma_tag_create(sc->parent_dmat, 4, 0, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, IPW_TBD_SZ, 1, IPW_TBD_SZ, 0, NULL, NULL, &sc->tbd_dmat); if (error != 0) { @@ -556,7 +568,7 @@ ipw_dma_alloc(struct ipw_softc *sc) /* * Allocate and map rx ring. */ - error = bus_dma_tag_create(NULL, 4, 0, BUS_SPACE_MAXADDR_32BIT, + error = bus_dma_tag_create(sc->parent_dmat, 4, 0, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, IPW_RBD_SZ, 1, IPW_RBD_SZ, 0, NULL, NULL, &sc->rbd_dmat); if (error != 0) { @@ -582,7 +594,7 @@ ipw_dma_alloc(struct ipw_softc *sc) /* * Allocate and map status ring. */ - error = bus_dma_tag_create(NULL, 4, 0, BUS_SPACE_MAXADDR_32BIT, + error = bus_dma_tag_create(sc->parent_dmat, 4, 0, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, IPW_STATUS_SZ, 1, IPW_STATUS_SZ, 0, NULL, NULL, &sc->status_dmat); if (error != 0) { @@ -611,7 +623,7 @@ ipw_dma_alloc(struct ipw_softc *sc) /* * Allocate command DMA map. */ - error = bus_dma_tag_create(NULL, 1, 0, BUS_SPACE_MAXADDR_32BIT, + error = bus_dma_tag_create(sc->parent_dmat, 1, 0, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, sizeof (struct ipw_cmd), 1, sizeof (struct ipw_cmd), 0, NULL, NULL, &sc->cmd_dmat); if (error != 0) { @@ -629,7 +641,7 @@ ipw_dma_alloc(struct ipw_softc *sc) /* * Allocate headers DMA maps. */ - error = bus_dma_tag_create(NULL, 1, 0, BUS_SPACE_MAXADDR_32BIT, + error = bus_dma_tag_create(sc->parent_dmat, 1, 0, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, sizeof (struct ipw_hdr), 1, sizeof (struct ipw_hdr), 0, NULL, NULL, &sc->hdr_dmat); if (error != 0) { @@ -652,7 +664,7 @@ ipw_dma_alloc(struct ipw_softc *sc) /* * Allocate tx buffers DMA maps. */ - error = bus_dma_tag_create(NULL, 1, 0, BUS_SPACE_MAXADDR_32BIT, + error = bus_dma_tag_create(sc->parent_dmat, 1, 0, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, MCLBYTES, IPW_MAX_NSEG, MCLBYTES, 0, NULL, NULL, &sc->txbuf_dmat); if (error != 0) { @@ -684,7 +696,7 @@ ipw_dma_alloc(struct ipw_softc *sc) /* * Pre-allocate rx buffers and DMA maps. */ - error = bus_dma_tag_create(NULL, 1, 0, BUS_SPACE_MAXADDR_32BIT, + error = bus_dma_tag_create(sc->parent_dmat, 1, 0, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, MCLBYTES, 1, MCLBYTES, 0, NULL, NULL, &sc->rxbuf_dmat); if (error != 0) { @@ -741,6 +753,10 @@ ipw_release(struct ipw_softc *sc) struct ipw_soft_buf *sbuf; int i; + if (sc->parent_dmat != NULL) { + bus_dma_tag_destroy(sc->parent_dmat); + } + if (sc->tbd_dmat != NULL) { if (sc->stbd_list != NULL) { bus_dmamap_unload(sc->tbd_dmat, sc->tbd_map); @@ -819,9 +835,9 @@ static int ipw_suspend(device_t dev) { struct ipw_softc *sc = device_get_softc(dev); + struct ieee80211com *ic = sc->sc_ifp->if_l2com; - ipw_stop(sc); - + ieee80211_suspend_all(ic); return 0; } @@ -829,13 +845,11 @@ static int ipw_resume(device_t dev) { struct ipw_softc *sc = device_get_softc(dev); - struct ifnet *ifp = sc->sc_ifp; + struct ieee80211com *ic = sc->sc_ifp->if_l2com; pci_write_config(dev, 0x41, 0, 1); - if (ifp->if_flags & IFF_UP) - ipw_init(sc); - + ieee80211_resume_all(ic); return 0; } diff --git a/src/add-ons/kernel/drivers/network/wlan/iprowifi2100/dev/ipw/if_ipwvar.h b/src/add-ons/kernel/drivers/network/wlan/iprowifi2100/dev/ipw/if_ipwvar.h index 6be3cbc1be..ea4f218018 100644 --- a/src/add-ons/kernel/drivers/network/wlan/iprowifi2100/dev/ipw/if_ipwvar.h +++ b/src/add-ons/kernel/drivers/network/wlan/iprowifi2100/dev/ipw/if_ipwvar.h @@ -117,6 +117,7 @@ struct ipw_softc { int sc_tx_timer; int sc_scan_timer; + bus_dma_tag_t parent_dmat; bus_dma_tag_t tbd_dmat; bus_dma_tag_t rbd_dmat; bus_dma_tag_t status_dmat; diff --git a/src/add-ons/kernel/drivers/network/wlan/iprowifi2200/dev/iwi/if_iwi.c b/src/add-ons/kernel/drivers/network/wlan/iprowifi2200/dev/iwi/if_iwi.c index a826750c2d..3346374936 100644 --- a/src/add-ons/kernel/drivers/network/wlan/iprowifi2200/dev/iwi/if_iwi.c +++ b/src/add-ons/kernel/drivers/network/wlan/iprowifi2200/dev/iwi/if_iwi.c @@ -129,7 +129,7 @@ static const struct iwi_ident iwi_ident_table[] = { }; static struct ieee80211vap *iwi_vap_create(struct ieee80211com *, - const char name[IFNAMSIZ], int unit, int opmode, int flags, + const char name[IFNAMSIZ], int unit, enum ieee80211_opmode opmode, int flags, const uint8_t bssid[IEEE80211_ADDR_LEN], const uint8_t mac[IEEE80211_ADDR_LEN]); static void iwi_vap_delete(struct ieee80211vap *); @@ -496,7 +496,7 @@ iwi_detach(device_t dev) static struct ieee80211vap * iwi_vap_create(struct ieee80211com *ic, - const char name[IFNAMSIZ], int unit, int opmode, int flags, + const char name[IFNAMSIZ], int unit, enum ieee80211_opmode opmode, int flags, const uint8_t bssid[IEEE80211_ADDR_LEN], const uint8_t mac[IEEE80211_ADDR_LEN]) { diff --git a/src/add-ons/kernel/drivers/network/wlan/iprowifi3945/dev/wpi/if_wpi.c b/src/add-ons/kernel/drivers/network/wlan/iprowifi3945/dev/wpi/if_wpi.c index 62f44d1362..d35ab79086 100644 --- a/src/add-ons/kernel/drivers/network/wlan/iprowifi3945/dev/wpi/if_wpi.c +++ b/src/add-ons/kernel/drivers/network/wlan/iprowifi3945/dev/wpi/if_wpi.c @@ -157,9 +157,9 @@ static const struct wpi_ident wpi_ident_table[] = { }; static struct ieee80211vap *wpi_vap_create(struct ieee80211com *, - const char name[IFNAMSIZ], int unit, int opmode, - int flags, const uint8_t bssid[IEEE80211_ADDR_LEN], - const uint8_t mac[IEEE80211_ADDR_LEN]); + const char [IFNAMSIZ], int, enum ieee80211_opmode, int, + const uint8_t [IEEE80211_ADDR_LEN], + const uint8_t [IEEE80211_ADDR_LEN]); static void wpi_vap_delete(struct ieee80211vap *); static int wpi_dma_contig_alloc(struct wpi_softc *, struct wpi_dma_info *, void **, bus_size_t, bus_size_t, int); @@ -760,10 +760,10 @@ wpi_detach(device_t dev) } static struct ieee80211vap * -wpi_vap_create(struct ieee80211com *ic, - const char name[IFNAMSIZ], int unit, int opmode, int flags, - const uint8_t bssid[IEEE80211_ADDR_LEN], - const uint8_t mac[IEEE80211_ADDR_LEN]) +wpi_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], int unit, + enum ieee80211_opmode opmode, int flags, + const uint8_t bssid[IEEE80211_ADDR_LEN], + const uint8_t mac[IEEE80211_ADDR_LEN]) { struct wpi_vap *wvp; struct ieee80211vap *vap; @@ -1218,8 +1218,9 @@ static int wpi_suspend(device_t dev) { struct wpi_softc *sc = device_get_softc(dev); + struct ieee80211com *ic = sc->sc_ifp->if_l2com; - wpi_stop(sc); + ieee80211_suspend_all(ic); return 0; } @@ -1227,15 +1228,11 @@ static int wpi_resume(device_t dev) { struct wpi_softc *sc = device_get_softc(dev); - struct ifnet *ifp = sc->sc_ifp; + struct ieee80211com *ic = sc->sc_ifp->if_l2com; pci_write_config(dev, 0x41, 0, 1); - if (ifp->if_flags & IFF_UP) { - wpi_init(ifp->if_softc); - if (ifp->if_drv_flags & IFF_DRV_RUNNING) - wpi_start(ifp); - } + ieee80211_resume_all(ic); return 0; } diff --git a/src/add-ons/kernel/drivers/network/wlan/iprowifi4965/dev/iwn/if_iwn.c b/src/add-ons/kernel/drivers/network/wlan/iprowifi4965/dev/iwn/if_iwn.c index 6c95ec0512..4ae4191617 100644 --- a/src/add-ons/kernel/drivers/network/wlan/iprowifi4965/dev/iwn/if_iwn.c +++ b/src/add-ons/kernel/drivers/network/wlan/iprowifi4965/dev/iwn/if_iwn.c @@ -79,34 +79,38 @@ struct iwn_ident { }; static const struct iwn_ident iwn_ident_table[] = { - { 0x8086, 0x0082, "Intel(R) Centrino(R) Advanced-N 6205" }, - { 0x8086, 0x0083, "Intel(R) Centrino(R) Wireless-N 1000" }, - { 0x8086, 0x0084, "Intel(R) Centrino(R) Wireless-N 1000" }, - { 0x8086, 0x0085, "Intel(R) Centrino(R) Advanced-N 6205" }, - { 0x8086, 0x0087, "Intel(R) Centrino(R) Advanced-N + WiMAX 6250" }, - { 0x8086, 0x0089, "Intel(R) Centrino(R) Advanced-N + WiMAX 6250" }, - { 0x8086, 0x008a, "Intel(R) Centrino(R) Wireless-N 1030" }, - { 0x8086, 0x008b, "Intel(R) Centrino(R) Wireless-N 1030" }, - { 0x8086, 0x0090, "Intel(R) Centrino(R) Advanced-N 6230" }, - { 0x8086, 0x0091, "Intel(R) Centrino(R) Advanced-N 6230" }, - { 0x8086, 0x088e, "Intel(R) Centrino(R) Advanced-N 6235" }, - { 0x8086, 0x0896, "Intel(R) Centrino(R) Wireless-N 130" }, - { 0x8086, 0x4229, "Intel(R) Wireless WiFi Link 4965" }, - { 0x8086, 0x422b, "Intel(R) Centrino(R) Ultimate-N 6300" }, - { 0x8086, 0x422c, "Intel(R) Centrino(R) Advanced-N 6200" }, - { 0x8086, 0x422d, "Intel(R) Wireless WiFi Link 4965" }, - { 0x8086, 0x4230, "Intel(R) Wireless WiFi Link 4965" }, - { 0x8086, 0x4232, "Intel(R) WiFi Link 5100" }, - { 0x8086, 0x4233, "Intel(R) Wireless WiFi Link 4965" }, - { 0x8086, 0x4235, "Intel(R) Ultimate N WiFi Link 5300" }, - { 0x8086, 0x4236, "Intel(R) Ultimate N WiFi Link 5300" }, - { 0x8086, 0x4237, "Intel(R) WiFi Link 5100" }, - { 0x8086, 0x4238, "Intel(R) Centrino(R) Ultimate-N 6300" }, - { 0x8086, 0x4239, "Intel(R) Centrino(R) Advanced-N 6200" }, - { 0x8086, 0x423a, "Intel(R) WiMAX/WiFi Link 5350" }, - { 0x8086, 0x423b, "Intel(R) WiMAX/WiFi Link 5350" }, - { 0x8086, 0x423c, "Intel(R) WiMAX/WiFi Link 5150" }, - { 0x8086, 0x423d, "Intel(R) WiMAX/WiFi Link 5150" }, + { 0x8086, 0x0082, "Intel Centrino Advanced-N 6205" }, + { 0x8086, 0x0083, "Intel Centrino Wireless-N 1000" }, + { 0x8086, 0x0084, "Intel Centrino Wireless-N 1000" }, + { 0x8086, 0x0085, "Intel Centrino Advanced-N 6205" }, + { 0x8086, 0x0087, "Intel Centrino Advanced-N + WiMAX 6250" }, + { 0x8086, 0x0089, "Intel Centrino Advanced-N + WiMAX 6250" }, + { 0x8086, 0x008a, "Intel Centrino Wireless-N 1030" }, + { 0x8086, 0x008b, "Intel Centrino Wireless-N 1030" }, + { 0x8086, 0x0090, "Intel Centrino Advanced-N 6230" }, + { 0x8086, 0x0091, "Intel Centrino Advanced-N 6230" }, + { 0x8086, 0x0885, "Intel Centrino Wireless-N + WiMAX 6150" }, + { 0x8086, 0x0886, "Intel Centrino Wireless-N + WiMAX 6150" }, + { 0x8086, 0x0896, "Intel Centrino Wireless-N 130" }, + { 0x8086, 0x0887, "Intel Centrino Wireless-N 130" }, + { 0x8086, 0x08ae, "Intel Centrino Wireless-N 100" }, + { 0x8086, 0x08af, "Intel Centrino Wireless-N 100" }, + { 0x8086, 0x4229, "Intel Wireless WiFi Link 4965" }, + { 0x8086, 0x422b, "Intel Centrino Ultimate-N 6300" }, + { 0x8086, 0x422c, "Intel Centrino Advanced-N 6200" }, + { 0x8086, 0x422d, "Intel Wireless WiFi Link 4965" }, + { 0x8086, 0x4230, "Intel Wireless WiFi Link 4965" }, + { 0x8086, 0x4232, "Intel WiFi Link 5100" }, + { 0x8086, 0x4233, "Intel Wireless WiFi Link 4965" }, + { 0x8086, 0x4235, "Intel Ultimate N WiFi Link 5300" }, + { 0x8086, 0x4236, "Intel Ultimate N WiFi Link 5300" }, + { 0x8086, 0x4237, "Intel WiFi Link 5100" }, + { 0x8086, 0x4238, "Intel Centrino Ultimate-N 6300" }, + { 0x8086, 0x4239, "Intel Centrino Advanced-N 6200" }, + { 0x8086, 0x423a, "Intel WiMAX/WiFi Link 5350" }, + { 0x8086, 0x423b, "Intel WiMAX/WiFi Link 5350" }, + { 0x8086, 0x423c, "Intel WiMAX/WiFi Link 5150" }, + { 0x8086, 0x423d, "Intel WiMAX/WiFi Link 5150" }, { 0, 0, NULL } }; @@ -117,9 +121,9 @@ static int iwn5000_attach(struct iwn_softc *, uint16_t); static void iwn_radiotap_attach(struct iwn_softc *); static void iwn_sysctlattach(struct iwn_softc *); static struct ieee80211vap *iwn_vap_create(struct ieee80211com *, - const char name[IFNAMSIZ], int unit, int opmode, - int flags, const uint8_t bssid[IEEE80211_ADDR_LEN], - const uint8_t mac[IEEE80211_ADDR_LEN]); + const char [IFNAMSIZ], int, enum ieee80211_opmode, int, + const uint8_t [IEEE80211_ADDR_LEN], + const uint8_t [IEEE80211_ADDR_LEN]); static void iwn_vap_delete(struct ieee80211vap *); static int iwn_detach(device_t); static int iwn_shutdown(device_t); @@ -846,8 +850,8 @@ iwn_sysctlattach(struct iwn_softc *sc) } static struct ieee80211vap * -iwn_vap_create(struct ieee80211com *ic, - const char name[IFNAMSIZ], int unit, int opmode, int flags, +iwn_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], int unit, + enum ieee80211_opmode opmode, int flags, const uint8_t bssid[IEEE80211_ADDR_LEN], const uint8_t mac[IEEE80211_ADDR_LEN]) { @@ -946,13 +950,9 @@ static int iwn_suspend(device_t dev) { struct iwn_softc *sc = device_get_softc(dev); - struct ifnet *ifp = sc->sc_ifp; - struct ieee80211com *ic = ifp->if_l2com; - struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps); + struct ieee80211com *ic = sc->sc_ifp->if_l2com; - iwn_stop(sc); - if (vap != NULL) - ieee80211_stop(vap); + ieee80211_suspend_all(ic); return 0; } @@ -960,20 +960,12 @@ static int iwn_resume(device_t dev) { struct iwn_softc *sc = device_get_softc(dev); - struct ifnet *ifp = sc->sc_ifp; - struct ieee80211com *ic = ifp->if_l2com; - struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps); + struct ieee80211com *ic = sc->sc_ifp->if_l2com; /* Clear device-specific "PCI retry timeout" register (41h). */ pci_write_config(dev, 0x41, 0, 1); - if (ifp->if_flags & IFF_UP) { - iwn_init(sc); - if (vap != NULL) - ieee80211_init(vap); - if (ifp->if_drv_flags & IFF_DRV_RUNNING) - iwn_start(ifp); - } + ieee80211_resume_all(ic); return 0; } @@ -2013,8 +2005,6 @@ iwn_setregdomain(struct ieee80211com *ic, struct ieee80211_regdomain *rd, return 0; } -#define nitems(_a) (sizeof((_a)) / sizeof((_a)[0])) - static void iwn_read_eeprom_enhinfo(struct iwn_softc *sc) { @@ -2129,7 +2119,7 @@ iwn_newassoc(struct ieee80211_node *ni, int isnew) plcp |= IWN_RFLAG_SGI; } else if (ni->ni_htcap & IEEE80211_HTCAP_SHORTGI20) plcp |= IWN_RFLAG_SGI; - if (i > 7) + if (RV(ni->ni_htrates.rs_rates[i]) > 7) plcp |= IWN_RFLAG_ANT(txant1 | txant2); else plcp |= IWN_RFLAG_ANT(txant1); @@ -2442,23 +2432,66 @@ static void iwn_rx_compressed_ba(struct iwn_softc *sc, struct iwn_rx_desc *desc, struct iwn_rx_data *data) { + struct iwn_ops *ops = &sc->ops; struct ifnet *ifp = sc->sc_ifp; struct iwn_node *wn; struct ieee80211_node *ni; struct iwn_compressed_ba *ba = (struct iwn_compressed_ba *)(desc + 1); struct iwn_tx_ring *txq; + struct iwn_tx_data *txdata; struct ieee80211_tx_ampdu *tap; + struct mbuf *m; uint64_t bitmap; + uint16_t ssn; uint8_t tid; - int ackfailcnt = 0, i, shift; + int ackfailcnt = 0, i, lastidx, qid, *res, shift; bus_dmamap_sync(sc->rxq.data_dmat, data->map, BUS_DMASYNC_POSTREAD); - txq = &sc->txq[le16toh(ba->qid)]; - tap = sc->qid2tap[le16toh(ba->qid)]; + qid = le16toh(ba->qid); + txq = &sc->txq[ba->qid]; + tap = sc->qid2tap[ba->qid]; tid = WME_AC_TO_TID(tap->txa_ac); - ni = tap->txa_ni; - wn = (void *)ni; + wn = (void *)tap->txa_ni; + + res = NULL; + ssn = 0; + if (!IEEE80211_AMPDU_RUNNING(tap)) { + res = tap->txa_private; + ssn = tap->txa_start & 0xfff; + } + + for (lastidx = le16toh(ba->ssn) & 0xff; txq->read != lastidx;) { + txdata = &txq->data[txq->read]; + + /* Unmap and free mbuf. */ + bus_dmamap_sync(txq->data_dmat, txdata->map, + BUS_DMASYNC_POSTWRITE); + bus_dmamap_unload(txq->data_dmat, txdata->map); + m = txdata->m, txdata->m = NULL; + ni = txdata->ni, txdata->ni = NULL; + + KASSERT(ni != NULL, ("no node")); + KASSERT(m != NULL, ("no mbuf")); + + if (m->m_flags & M_TXCB) + ieee80211_process_callback(ni, m, 1); + + m_freem(m); + ieee80211_free_node(ni); + + txq->queued--; + txq->read = (txq->read + 1) % IWN_TX_RING_COUNT; + } + + if (txq->queued == 0 && res != NULL) { + iwn_nic_lock(sc); + ops->ampdu_tx_stop(sc, qid, tid, ssn); + iwn_nic_unlock(sc); + sc->qid2tap[qid] = NULL; + free(res, M_DEVBUF); + return; + } if (wn->agg[tid].bitmap == 0) return; @@ -2470,6 +2503,7 @@ iwn_rx_compressed_ba(struct iwn_softc *sc, struct iwn_rx_desc *desc, if (wn->agg[tid].nframes > (64 - shift)) return; + ni = tap->txa_ni; bitmap = (le64toh(ba->bitmap) >> shift) & wn->agg[tid].bitmap; for (i = 0; bitmap; i++) { if ((bitmap & 1) == 0) { @@ -2769,19 +2803,20 @@ static void iwn_ampdu_tx_done(struct iwn_softc *sc, int qid, int idx, int nframes, void *stat) { + struct iwn_ops *ops = &sc->ops; struct ifnet *ifp = sc->sc_ifp; struct iwn_tx_ring *ring = &sc->txq[qid]; struct iwn_tx_data *data; struct mbuf *m; struct iwn_node *wn; struct ieee80211_node *ni; - struct ieee80211vap *vap; struct ieee80211_tx_ampdu *tap; uint64_t bitmap; uint32_t *status = stat; uint16_t *aggstatus = stat; + uint16_t ssn; uint8_t tid; - int bit, i, lastidx, seqno, shift, start; + int bit, i, lastidx, *res, seqno, shift, start; #ifdef NOT_YET if (nframes == 1) { @@ -2820,19 +2855,26 @@ iwn_ampdu_tx_done(struct iwn_softc *sc, int qid, int idx, int nframes, wn->agg[tid].startidx = start; wn->agg[tid].nframes = nframes; + res = NULL; + ssn = 0; + if (!IEEE80211_AMPDU_RUNNING(tap)) { + res = tap->txa_private; + ssn = tap->txa_start & 0xfff; + } + seqno = le32toh(*(status + nframes)) & 0xfff; for (lastidx = (seqno & 0xff); ring->read != lastidx;) { data = &ring->data[ring->read]; - KASSERT(data->ni != NULL, ("no node")); - /* Unmap and free mbuf. */ bus_dmamap_sync(ring->data_dmat, data->map, BUS_DMASYNC_POSTWRITE); bus_dmamap_unload(ring->data_dmat, data->map); m = data->m, data->m = NULL; ni = data->ni, data->ni = NULL; - vap = ni->ni_vap; + + KASSERT(ni != NULL, ("no node")); + KASSERT(m != NULL, ("no mbuf")); if (m->m_flags & M_TXCB) ieee80211_process_callback(ni, m, 1); @@ -2844,6 +2886,15 @@ iwn_ampdu_tx_done(struct iwn_softc *sc, int qid, int idx, int nframes, ring->read = (ring->read + 1) % IWN_TX_RING_COUNT; } + if (ring->queued == 0 && res != NULL) { + iwn_nic_lock(sc); + ops->ampdu_tx_stop(sc, qid, tid, ssn); + iwn_nic_unlock(sc); + sc->qid2tap[qid] = NULL; + free(res, M_DEVBUF); + return; + } + sc->sc_tx_timer = 0; if (ring->queued < IWN_TX_RING_LOMARK) { sc->qfullmsk &= ~(1 << ring->qid); @@ -3322,18 +3373,20 @@ iwn_tx_data(struct iwn_softc *sc, struct mbuf *m, struct ieee80211_node *ni) tid = 0; } ac = M_WME_GETAC(m); - - if (IEEE80211_QOS_HAS_SEQ(wh) && - IEEE80211_AMPDU_RUNNING(&ni->ni_tx_ampdu[ac])) { + if (m->m_flags & M_AMPDU_MPDU) { struct ieee80211_tx_ampdu *tap = &ni->ni_tx_ampdu[ac]; - ring = &sc->txq[*(int *)tap->txa_private]; + if (!IEEE80211_AMPDU_RUNNING(tap)) { + m_freem(m); + return EINVAL; + } + + ac = *(int *)tap->txa_private; *(uint16_t *)wh->i_seq = htole16(ni->ni_txseqs[tid] << IEEE80211_SEQ_SEQ_SHIFT); ni->ni_txseqs[tid]++; - } else { - ring = &sc->txq[ac]; } + ring = &sc->txq[ac]; desc = &ring->desc[ring->cur]; data = &ring->data[ring->cur]; @@ -5647,6 +5700,8 @@ iwn_ampdu_tx_start(struct ieee80211com *ic, struct ieee80211_node *ni, if ((error = iwn_nic_lock(sc)) != 0) return 0; qid = *(int *)tap->txa_private; + DPRINTF(sc, IWN_DEBUG_XMIT, "%s: ra=%d tid=%d ssn=%d qid=%d\n", + __func__, wn->id, tid, tap->txa_start, qid); ops->ampdu_tx_start(sc, ni, qid, tid, tap->txa_start & 0xfff); iwn_nic_unlock(sc); @@ -5662,10 +5717,14 @@ iwn_ampdu_tx_stop(struct ieee80211_node *ni, struct ieee80211_tx_ampdu *tap) uint8_t tid = WME_AC_TO_TID(tap->txa_ac); int qid; + sc->sc_addba_stop(ni, tap); + if (tap->txa_private == NULL) return; qid = *(int *)tap->txa_private; + if (sc->txq[qid].queued != 0) + return; if (iwn_nic_lock(sc) != 0) return; ops->ampdu_tx_stop(sc, qid, tid, tap->txa_start & 0xfff); @@ -5673,7 +5732,6 @@ iwn_ampdu_tx_stop(struct ieee80211_node *ni, struct ieee80211_tx_ampdu *tap) sc->qid2tap[qid] = NULL; free(tap->txa_private, M_DEVBUF); tap->txa_private = NULL; - sc->sc_addba_stop(ni, tap); } static void diff --git a/src/add-ons/kernel/drivers/network/wlan/marvell88w8335/dev/malo/if_malo.c b/src/add-ons/kernel/drivers/network/wlan/marvell88w8335/dev/malo/if_malo.c index ae6ef88265..dbb4f385be 100644 --- a/src/add-ons/kernel/drivers/network/wlan/marvell88w8335/dev/malo/if_malo.c +++ b/src/add-ons/kernel/drivers/network/wlan/marvell88w8335/dev/malo/if_malo.c @@ -125,10 +125,10 @@ enum { MALLOC_DEFINE(M_MALODEV, "malodev", "malo driver dma buffers"); -static struct ieee80211vap *malo_vap_create(struct ieee80211com *ic, - const char name[IFNAMSIZ], int unit, int opmode, int flags, - const uint8_t bssid[IEEE80211_ADDR_LEN], - const uint8_t mac[IEEE80211_ADDR_LEN]); +static struct ieee80211vap *malo_vap_create(struct ieee80211com *, + const char [IFNAMSIZ], int, enum ieee80211_opmode, int, + const uint8_t [IEEE80211_ADDR_LEN], + const uint8_t [IEEE80211_ADDR_LEN]); static void malo_vap_delete(struct ieee80211vap *); static int malo_dma_setup(struct malo_softc *); static int malo_setup_hwdma(struct malo_softc *); @@ -344,10 +344,10 @@ bad: } static struct ieee80211vap * -malo_vap_create(struct ieee80211com *ic, - const char name[IFNAMSIZ], int unit, int opmode, int flags, - const uint8_t bssid[IEEE80211_ADDR_LEN], - const uint8_t mac[IEEE80211_ADDR_LEN]) +malo_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], int unit, + enum ieee80211_opmode opmode, int flags, + const uint8_t bssid[IEEE80211_ADDR_LEN], + const uint8_t mac[IEEE80211_ADDR_LEN]) { struct ifnet *ifp = ic->ic_ifp; struct malo_vap *mvp; diff --git a/src/add-ons/kernel/drivers/network/wlan/marvell88w8363/dev/mwl/if_mwl.c b/src/add-ons/kernel/drivers/network/wlan/marvell88w8363/dev/mwl/if_mwl.c index 0d47661c4e..f42a45d3a2 100644 --- a/src/add-ons/kernel/drivers/network/wlan/marvell88w8363/dev/mwl/if_mwl.c +++ b/src/add-ons/kernel/drivers/network/wlan/marvell88w8363/dev/mwl/if_mwl.c @@ -83,9 +83,9 @@ __FBSDID("$FreeBSD$"); #define SM(v,x) (((v) << x##_S) & x) static struct ieee80211vap *mwl_vap_create(struct ieee80211com *, - const char name[IFNAMSIZ], int unit, int opmode, - int flags, const uint8_t bssid[IEEE80211_ADDR_LEN], - const uint8_t mac[IEEE80211_ADDR_LEN]); + const char [IFNAMSIZ], int, enum ieee80211_opmode, int, + const uint8_t [IEEE80211_ADDR_LEN], + const uint8_t [IEEE80211_ADDR_LEN]); static void mwl_vap_delete(struct ieee80211vap *); static int mwl_setupdma(struct mwl_softc *); static int mwl_hal_reset(struct mwl_softc *sc); @@ -601,10 +601,10 @@ reclaim_address(struct mwl_softc *sc, uint8_t mac[IEEE80211_ADDR_LEN]) } static struct ieee80211vap * -mwl_vap_create(struct ieee80211com *ic, - const char name[IFNAMSIZ], int unit, int opmode, int flags, - const uint8_t bssid[IEEE80211_ADDR_LEN], - const uint8_t mac0[IEEE80211_ADDR_LEN]) +mwl_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], int unit, + enum ieee80211_opmode opmode, int flags, + const uint8_t bssid[IEEE80211_ADDR_LEN], + const uint8_t mac0[IEEE80211_ADDR_LEN]) { struct ifnet *ifp = ic->ic_ifp; struct mwl_softc *sc = ifp->if_softc; diff --git a/src/add-ons/kernel/drivers/network/wlan/marvell88w8363/dev/mwl/mwlhal.c b/src/add-ons/kernel/drivers/network/wlan/marvell88w8363/dev/mwl/mwlhal.c index 18992c2f68..3b8f27e2d3 100644 --- a/src/add-ons/kernel/drivers/network/wlan/marvell88w8363/dev/mwl/mwlhal.c +++ b/src/add-ons/kernel/drivers/network/wlan/marvell88w8363/dev/mwl/mwlhal.c @@ -1451,20 +1451,15 @@ mwl_hal_bastream_alloc(struct mwl_hal_vap *vap, int ba_policy, } sp = &mh->mh_streams[s]; mh->mh_bastreams &= ~(1<public.data[0] = a1; - sp->public.data[1] = a2; - IEEE80211_ADDR_COPY(sp->macaddr, Macaddr); - sp->tid = Tid; - sp->paraminfo = ParamInfo; - sp->setup = 0; - sp->ba_policy = ba_policy; - MWL_HAL_UNLOCK(mh); - return &sp->public; - } else { - MWL_HAL_UNLOCK(mh); - return NULL; - } + sp->public.data[0] = a1; + sp->public.data[1] = a2; + IEEE80211_ADDR_COPY(sp->macaddr, Macaddr); + sp->tid = Tid; + sp->paraminfo = ParamInfo; + sp->setup = 0; + sp->ba_policy = ba_policy; + MWL_HAL_UNLOCK(mh); + return sp != NULL ? &sp->public : NULL; } const MWL_HAL_BASTREAM * diff --git a/src/add-ons/kernel/drivers/network/wlan/ralinkwifi/Jamfile b/src/add-ons/kernel/drivers/network/wlan/ralinkwifi/Jamfile index a6be2bb172..ccdfb5b976 100644 --- a/src/add-ons/kernel/drivers/network/wlan/ralinkwifi/Jamfile +++ b/src/add-ons/kernel/drivers/network/wlan/ralinkwifi/Jamfile @@ -19,13 +19,16 @@ KernelAddon ralinkwifi : if_ral_pci.c rt2560.c rt2661.c + rt2860.c glue.c : libfreebsd_wlan.a libfreebsd_network.a ; -HAIKU_WIFI_FIRMWARE_PACKAGE on ralinkwifi = RT61_Firmware_V1.2 ; -HAIKU_WIFI_FIRMWARE_ARCHIVE on ralinkwifi = RT61_Firmware_V1.2.zip ; +HAIKU_WIFI_FIRMWARE_PACKAGES on ralinkwifi = RT61_Firmware_V1.2 + RT2860_Firmware_V26 ; +HAIKU_WIFI_FIRMWARE_ARCHIVES on ralinkwifi = RT61_Firmware_V1.2.zip + RT2860_Firmware_V26.zip ; HAIKU_WIFI_FIRMWARE_DO_EXTRACT on ralinkwifi = true ; diff --git a/src/add-ons/kernel/drivers/network/wlan/ralinkwifi/dev/ral/if_ral_pci.c b/src/add-ons/kernel/drivers/network/wlan/ralinkwifi/dev/ral/if_ral_pci.c index 68b662261f..cd892b50d9 100644 --- a/src/add-ons/kernel/drivers/network/wlan/ralinkwifi/dev/ral/if_ral_pci.c +++ b/src/add-ons/kernel/drivers/network/wlan/ralinkwifi/dev/ral/if_ral_pci.c @@ -57,6 +57,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include MODULE_DEPEND(ral, pci, 1, 1, 1); MODULE_DEPEND(ral, firmware, 1, 1, 1); @@ -70,11 +71,37 @@ struct ral_pci_ident { }; static const struct ral_pci_ident ral_pci_ids[] = { + { 0x1432, 0x7708, "Edimax RT2860" }, + { 0x1432, 0x7711, "Edimax RT3591" }, + { 0x1432, 0x7722, "Edimax RT3591" }, + { 0x1432, 0x7727, "Edimax RT2860" }, + { 0x1432, 0x7728, "Edimax RT2860" }, + { 0x1432, 0x7738, "Edimax RT2860" }, + { 0x1432, 0x7748, "Edimax RT2860" }, + { 0x1432, 0x7758, "Edimax RT2860" }, + { 0x1432, 0x7768, "Edimax RT2860" }, + { 0x1462, 0x891a, "MSI RT3090" }, { 0x1814, 0x0201, "Ralink Technology RT2560" }, { 0x1814, 0x0301, "Ralink Technology RT2561S" }, { 0x1814, 0x0302, "Ralink Technology RT2561" }, { 0x1814, 0x0401, "Ralink Technology RT2661" }, - + { 0x1814, 0x0601, "Ralink Technology RT2860" }, + { 0x1814, 0x0681, "Ralink Technology RT2890" }, + { 0x1814, 0x0701, "Ralink Technology RT2760" }, + { 0x1814, 0x0781, "Ralink Technology RT2790" }, + { 0x1814, 0x3060, "Ralink Technology RT3060" }, + { 0x1814, 0x3062, "Ralink Technology RT3062" }, + { 0x1814, 0x3090, "Ralink Technology RT3090" }, + { 0x1814, 0x3091, "Ralink Technology RT3091" }, + { 0x1814, 0x3092, "Ralink Technology RT3092" }, + { 0x1814, 0x3390, "Ralink Technology RT3390" }, + { 0x1814, 0x3562, "Ralink Technology RT3562" }, + { 0x1814, 0x3592, "Ralink Technology RT3592" }, + { 0x1814, 0x3593, "Ralink Technology RT3593" }, + { 0x1814, 0x5390, "Ralink Technology RT5390" }, + { 0x1814, 0x539a, "Ralink Technology RT5390" }, + { 0x1814, 0x539f, "Ralink Technology RT5390" }, + { 0x1a3b, 0x1059, "AWT RT2890" }, { 0, 0, NULL } }; @@ -101,12 +128,20 @@ static struct ral_opns { rt2661_suspend, rt2661_resume, rt2661_intr +}, ral_rt2860_opns = { + rt2860_attach, + rt2860_detach, + rt2860_shutdown, + rt2860_suspend, + rt2860_resume, + rt2860_intr }; struct ral_pci_softc { union { struct rt2560_softc sc_rt2560; struct rt2661_softc sc_rt2661; + struct rt2860_softc sc_rt2860; } u; struct ral_opns *sc_opns; @@ -180,8 +215,19 @@ ral_pci_attach(device_t dev) /* enable bus-mastering */ pci_enable_busmaster(dev); - psc->sc_opns = (pci_get_device(dev) == 0x0201) ? &ral_rt2560_opns : - &ral_rt2661_opns; + switch (pci_get_device(dev)) { + case 0x0201: + psc->sc_opns = &ral_rt2560_opns; + break; + case 0x0301: + case 0x0302: + case 0x0401: + psc->sc_opns = &ral_rt2661_opns; + break; + default: + psc->sc_opns = &ral_rt2860_opns; + break; + } psc->mem_rid = RAL_PCI_BAR0; psc->mem = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &psc->mem_rid, diff --git a/src/add-ons/kernel/drivers/network/wlan/ralinkwifi/dev/ral/rt2560.c b/src/add-ons/kernel/drivers/network/wlan/ralinkwifi/dev/ral/rt2560.c index 33667becf5..815794cae6 100644 --- a/src/add-ons/kernel/drivers/network/wlan/ralinkwifi/dev/ral/rt2560.c +++ b/src/add-ons/kernel/drivers/network/wlan/ralinkwifi/dev/ral/rt2560.c @@ -85,9 +85,9 @@ __FBSDID("$FreeBSD$"); #endif static struct ieee80211vap *rt2560_vap_create(struct ieee80211com *, - const char name[IFNAMSIZ], int unit, int opmode, - int flags, const uint8_t bssid[IEEE80211_ADDR_LEN], - const uint8_t mac[IEEE80211_ADDR_LEN]); + const char [IFNAMSIZ], int, enum ieee80211_opmode, + int, const uint8_t [IEEE80211_ADDR_LEN], + const uint8_t [IEEE80211_ADDR_LEN]); static void rt2560_vap_delete(struct ieee80211vap *); static void rt2560_dma_map_addr(void *, bus_dma_segment_t *, int, int); @@ -373,10 +373,10 @@ rt2560_detach(void *xsc) } static struct ieee80211vap * -rt2560_vap_create(struct ieee80211com *ic, - const char name[IFNAMSIZ], int unit, int opmode, int flags, - const uint8_t bssid[IEEE80211_ADDR_LEN], - const uint8_t mac[IEEE80211_ADDR_LEN]) +rt2560_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], int unit, + enum ieee80211_opmode opmode, int flags, + const uint8_t bssid[IEEE80211_ADDR_LEN], + const uint8_t mac[IEEE80211_ADDR_LEN]) { struct ifnet *ifp = ic->ic_ifp; struct rt2560_vap *rvp; diff --git a/src/add-ons/kernel/drivers/network/wlan/ralinkwifi/dev/ral/rt2661.c b/src/add-ons/kernel/drivers/network/wlan/ralinkwifi/dev/ral/rt2661.c index 0adc8990d4..63ab1d1c70 100644 --- a/src/add-ons/kernel/drivers/network/wlan/ralinkwifi/dev/ral/rt2661.c +++ b/src/add-ons/kernel/drivers/network/wlan/ralinkwifi/dev/ral/rt2661.c @@ -82,9 +82,9 @@ __FBSDID("$FreeBSD$"); #endif static struct ieee80211vap *rt2661_vap_create(struct ieee80211com *, - const char name[IFNAMSIZ], int unit, int opmode, - int flags, const uint8_t bssid[IEEE80211_ADDR_LEN], - const uint8_t mac[IEEE80211_ADDR_LEN]); + const char [IFNAMSIZ], int, enum ieee80211_opmode, + int, const uint8_t [IEEE80211_ADDR_LEN], + const uint8_t [IEEE80211_ADDR_LEN]); static void rt2661_vap_delete(struct ieee80211vap *); static void rt2661_dma_map_addr(void *, bus_dma_segment_t *, int, int); @@ -368,10 +368,10 @@ rt2661_detach(void *xsc) } static struct ieee80211vap * -rt2661_vap_create(struct ieee80211com *ic, - const char name[IFNAMSIZ], int unit, int opmode, int flags, - const uint8_t bssid[IEEE80211_ADDR_LEN], - const uint8_t mac[IEEE80211_ADDR_LEN]) +rt2661_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], int unit, + enum ieee80211_opmode opmode, int flags, + const uint8_t bssid[IEEE80211_ADDR_LEN], + const uint8_t mac[IEEE80211_ADDR_LEN]) { struct ifnet *ifp = ic->ic_ifp; struct rt2661_vap *rvp; diff --git a/src/add-ons/kernel/drivers/network/wlan/ralinkwifi/dev/ral/rt2860.c b/src/add-ons/kernel/drivers/network/wlan/ralinkwifi/dev/ral/rt2860.c new file mode 100644 index 0000000000..f3a6bd64c9 --- /dev/null +++ b/src/add-ons/kernel/drivers/network/wlan/ralinkwifi/dev/ral/rt2860.c @@ -0,0 +1,4107 @@ +/*- + * Copyright (c) 2007-2010 Damien Bergamini + * Copyright (c) 2012 Bernhard Schmidt + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * $OpenBSD: rt2860.c,v 1.65 2010/10/23 14:24:54 damien Exp $ + */ + +#include +__FBSDID("$FreeBSD$"); + +/*- + * Ralink Technology RT2860/RT3090/RT3390/RT3562 chipset driver + * http://www.ralinktech.com/ + */ + +#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 +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include + +#define RAL_DEBUG +#ifdef RAL_DEBUG +#define DPRINTF(x) do { if (sc->sc_debug > 0) printf x; } while (0) +#define DPRINTFN(n, x) do { if (sc->sc_debug >= (n)) printf x; } while (0) +#else +#define DPRINTF(x) +#define DPRINTFN(n, x) +#endif + +static struct ieee80211vap *rt2860_vap_create(struct ieee80211com *, + const char [IFNAMSIZ], int, enum ieee80211_opmode, + int, const uint8_t [IEEE80211_ADDR_LEN], + const uint8_t [IEEE80211_ADDR_LEN]); +static void rt2860_vap_delete(struct ieee80211vap *); +static void rt2860_dma_map_addr(void *, bus_dma_segment_t *, int, int); +static int rt2860_alloc_tx_ring(struct rt2860_softc *, + struct rt2860_tx_ring *); +static void rt2860_reset_tx_ring(struct rt2860_softc *, + struct rt2860_tx_ring *); +static void rt2860_free_tx_ring(struct rt2860_softc *, + struct rt2860_tx_ring *); +static int rt2860_alloc_tx_pool(struct rt2860_softc *); +static void rt2860_free_tx_pool(struct rt2860_softc *); +static int rt2860_alloc_rx_ring(struct rt2860_softc *, + struct rt2860_rx_ring *); +static void rt2860_reset_rx_ring(struct rt2860_softc *, + struct rt2860_rx_ring *); +static void rt2860_free_rx_ring(struct rt2860_softc *, + struct rt2860_rx_ring *); +static void rt2860_updatestats(struct rt2860_softc *); +static void rt2860_newassoc(struct ieee80211_node *, int); +static void rt2860_node_free(struct ieee80211_node *); +#ifdef IEEE80211_HT +static int rt2860_ampdu_rx_start(struct ieee80211com *, + struct ieee80211_node *, uint8_t); +static void rt2860_ampdu_rx_stop(struct ieee80211com *, + struct ieee80211_node *, uint8_t); +#endif +static int rt2860_newstate(struct ieee80211vap *, enum ieee80211_state, + int); +static uint16_t rt3090_efuse_read_2(struct rt2860_softc *, uint16_t); +static uint16_t rt2860_eeprom_read_2(struct rt2860_softc *, uint16_t); +static void rt2860_intr_coherent(struct rt2860_softc *); +static void rt2860_drain_stats_fifo(struct rt2860_softc *); +static void rt2860_tx_intr(struct rt2860_softc *, int); +static void rt2860_rx_intr(struct rt2860_softc *); +static void rt2860_tbtt_intr(struct rt2860_softc *); +static void rt2860_gp_intr(struct rt2860_softc *); +static int rt2860_tx(struct rt2860_softc *, struct mbuf *, + struct ieee80211_node *); +static int rt2860_raw_xmit(struct ieee80211_node *, struct mbuf *, + const struct ieee80211_bpf_params *); +static int rt2860_tx_raw(struct rt2860_softc *, struct mbuf *, + struct ieee80211_node *, + const struct ieee80211_bpf_params *params); +static void rt2860_start(struct ifnet *); +static void rt2860_start_locked(struct ifnet *); +static void rt2860_watchdog(void *); +static int rt2860_ioctl(struct ifnet *, u_long, caddr_t); +static void rt2860_mcu_bbp_write(struct rt2860_softc *, uint8_t, uint8_t); +static uint8_t rt2860_mcu_bbp_read(struct rt2860_softc *, uint8_t); +static void rt2860_rf_write(struct rt2860_softc *, uint8_t, uint32_t); +static uint8_t rt3090_rf_read(struct rt2860_softc *, uint8_t); +static void rt3090_rf_write(struct rt2860_softc *, uint8_t, uint8_t); +static int rt2860_mcu_cmd(struct rt2860_softc *, uint8_t, uint16_t, int); +static void rt2860_enable_mrr(struct rt2860_softc *); +static void rt2860_set_txpreamble(struct rt2860_softc *); +static void rt2860_set_basicrates(struct rt2860_softc *, + const struct ieee80211_rateset *); +static void rt2860_scan_start(struct ieee80211com *); +static void rt2860_scan_end(struct ieee80211com *); +static void rt2860_set_channel(struct ieee80211com *); +static void rt2860_select_chan_group(struct rt2860_softc *, int); +static void rt2860_set_chan(struct rt2860_softc *, u_int); +static void rt3090_set_chan(struct rt2860_softc *, u_int); +static int rt3090_rf_init(struct rt2860_softc *); +static void rt3090_rf_wakeup(struct rt2860_softc *); +static int rt3090_filter_calib(struct rt2860_softc *, uint8_t, uint8_t, + uint8_t *); +static void rt3090_rf_setup(struct rt2860_softc *); +static void rt2860_set_leds(struct rt2860_softc *, uint16_t); +static void rt2860_set_gp_timer(struct rt2860_softc *, int); +static void rt2860_set_bssid(struct rt2860_softc *, const uint8_t *); +static void rt2860_set_macaddr(struct rt2860_softc *, const uint8_t *); +static void rt2860_update_promisc(struct ifnet *); +static void rt2860_updateslot(struct ifnet *); +static void rt2860_updateprot(struct ifnet *); +static int rt2860_updateedca(struct ieee80211com *); +#ifdef HW_CRYPTO +static int rt2860_set_key(struct ieee80211com *, struct ieee80211_node *, + struct ieee80211_key *); +static void rt2860_delete_key(struct ieee80211com *, + struct ieee80211_node *, struct ieee80211_key *); +#endif +static int8_t rt2860_rssi2dbm(struct rt2860_softc *, uint8_t, uint8_t); +static const char *rt2860_get_rf(uint8_t); +static int rt2860_read_eeprom(struct rt2860_softc *, + uint8_t macaddr[IEEE80211_ADDR_LEN]); +static int rt2860_bbp_init(struct rt2860_softc *); +static int rt2860_txrx_enable(struct rt2860_softc *); +static void rt2860_init(void *); +static void rt2860_init_locked(struct rt2860_softc *); +static void rt2860_stop(void *); +static void rt2860_stop_locked(struct rt2860_softc *); +static int rt2860_load_microcode(struct rt2860_softc *); +#ifdef NOT_YET +static void rt2860_calib(struct rt2860_softc *); +#endif +static void rt3090_set_rx_antenna(struct rt2860_softc *, int); +static void rt2860_switch_chan(struct rt2860_softc *, + struct ieee80211_channel *); +static int rt2860_setup_beacon(struct rt2860_softc *, + struct ieee80211vap *); +static void rt2860_enable_tsf_sync(struct rt2860_softc *); + +static const struct { + uint32_t reg; + uint32_t val; +} rt2860_def_mac[] = { + RT2860_DEF_MAC +}; + +static const struct { + uint8_t reg; + uint8_t val; +} rt2860_def_bbp[] = { + RT2860_DEF_BBP +}; + +static const struct rfprog { + uint8_t chan; + uint32_t r1, r2, r3, r4; +} rt2860_rf2850[] = { + RT2860_RF2850 +}; + +struct { + uint8_t n, r, k; +} rt3090_freqs[] = { + RT3070_RF3052 +}; + +static const struct { + uint8_t reg; + uint8_t val; +} rt3090_def_rf[] = { + RT3070_DEF_RF +}; + +int +rt2860_attach(device_t dev, int id) +{ + struct rt2860_softc *sc = device_get_softc(dev); + struct ieee80211com *ic; + struct ifnet *ifp; + uint32_t tmp; + int error, ntries, qid; + uint8_t bands; + uint8_t macaddr[IEEE80211_ADDR_LEN]; + + sc->sc_dev = dev; + sc->sc_debug = 0; + + ifp = sc->sc_ifp = if_alloc(IFT_IEEE80211); + if (ifp == NULL) { + device_printf(sc->sc_dev, "can not if_alloc()\n"); + return ENOMEM; + } + ic = ifp->if_l2com; + + mtx_init(&sc->sc_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK, + MTX_DEF | MTX_RECURSE); + + callout_init_mtx(&sc->watchdog_ch, &sc->sc_mtx, 0); + + /* wait for NIC to initialize */ + for (ntries = 0; ntries < 100; ntries++) { + tmp = RAL_READ(sc, RT2860_ASIC_VER_ID); + if (tmp != 0 && tmp != 0xffffffff) + break; + DELAY(10); + } + if (ntries == 100) { + device_printf(sc->sc_dev, + "timeout waiting for NIC to initialize\n"); + error = EIO; + goto fail1; + } + sc->mac_ver = tmp >> 16; + sc->mac_rev = tmp & 0xffff; + + if (sc->mac_ver != 0x2860 && + (id == 0x0681 || id == 0x0781 || id == 0x1059)) + sc->sc_flags |= RT2860_ADVANCED_PS; + + /* retrieve RF rev. no and various other things from EEPROM */ + rt2860_read_eeprom(sc, macaddr); + if (bootverbose) { + device_printf(sc->sc_dev, "MAC/BBP RT%X (rev 0x%04X), " + "RF %s (MIMO %dT%dR), address %6D\n", + sc->mac_ver, sc->mac_rev, rt2860_get_rf(sc->rf_rev), + sc->ntxchains, sc->nrxchains, macaddr, ":"); + } + + /* + * Allocate Tx (4 EDCAs + HCCA + Mgt) and Rx rings. + */ + for (qid = 0; qid < 6; qid++) { + if ((error = rt2860_alloc_tx_ring(sc, &sc->txq[qid])) != 0) { + device_printf(sc->sc_dev, + "could not allocate Tx ring %d\n", qid); + goto fail2; + } + } + + if ((error = rt2860_alloc_rx_ring(sc, &sc->rxq)) != 0) { + device_printf(sc->sc_dev, "could not allocate Rx ring\n"); + goto fail2; + } + + if ((error = rt2860_alloc_tx_pool(sc)) != 0) { + device_printf(sc->sc_dev, "could not allocate Tx pool\n"); + goto fail3; + } + + /* mgmt ring is broken on RT2860C, use EDCA AC VO ring instead */ + sc->mgtqid = (sc->mac_ver == 0x2860 && sc->mac_rev == 0x0100) ? + WME_AC_VO : 5; + + ifp->if_softc = sc; + if_initname(ifp, device_get_name(dev), device_get_unit(dev)); + ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; + ifp->if_init = rt2860_init; + ifp->if_ioctl = rt2860_ioctl; + ifp->if_start = rt2860_start; + IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen); + ifp->if_snd.ifq_drv_maxlen = ifqmaxlen; + IFQ_SET_READY(&ifp->if_snd); + + ic->ic_ifp = ifp; + ic->ic_opmode = IEEE80211_M_STA; + ic->ic_phytype = IEEE80211_T_OFDM; /* not only, but not used */ + + /* set device capabilities */ + ic->ic_caps = + IEEE80211_C_STA /* station mode */ + | IEEE80211_C_IBSS /* ibss, nee adhoc, mode */ + | IEEE80211_C_HOSTAP /* hostap mode */ + | IEEE80211_C_MONITOR /* monitor mode */ + | IEEE80211_C_AHDEMO /* adhoc demo mode */ + | IEEE80211_C_WDS /* 4-address traffic works */ + | IEEE80211_C_MBSS /* mesh point link mode */ + | IEEE80211_C_SHPREAMBLE /* short preamble supported */ + | IEEE80211_C_SHSLOT /* short slot time supported */ + | IEEE80211_C_WPA /* capable of WPA1+WPA2 */ +#if 0 + | IEEE80211_C_BGSCAN /* capable of bg scanning */ +#endif + | IEEE80211_C_WME /* 802.11e */ + ; + + bands = 0; + setbit(&bands, IEEE80211_MODE_11B); + setbit(&bands, IEEE80211_MODE_11G); + if (sc->rf_rev == RT2860_RF_2750 || sc->rf_rev == RT2860_RF_2850) + setbit(&bands, IEEE80211_MODE_11A); + ieee80211_init_channels(ic, NULL, &bands); + + ieee80211_ifattach(ic, macaddr); + + ic->ic_wme.wme_update = rt2860_updateedca; + ic->ic_scan_start = rt2860_scan_start; + ic->ic_scan_end = rt2860_scan_end; + ic->ic_set_channel = rt2860_set_channel; + ic->ic_updateslot = rt2860_updateslot; + ic->ic_update_promisc = rt2860_update_promisc; + ic->ic_raw_xmit = rt2860_raw_xmit; + sc->sc_node_free = ic->ic_node_free; + ic->ic_node_free = rt2860_node_free; + ic->ic_newassoc = rt2860_newassoc; + + ic->ic_vap_create = rt2860_vap_create; + ic->ic_vap_delete = rt2860_vap_delete; + + ieee80211_radiotap_attach(ic, + &sc->sc_txtap.wt_ihdr, sizeof(sc->sc_txtap), + RT2860_TX_RADIOTAP_PRESENT, + &sc->sc_rxtap.wr_ihdr, sizeof(sc->sc_rxtap), + RT2860_RX_RADIOTAP_PRESENT); + +#ifdef RAL_DEBUG + SYSCTL_ADD_INT(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, + "debug", CTLFLAG_RW, &sc->sc_debug, 0, "debug msgs"); +#endif + if (bootverbose) + ieee80211_announce(ic); + + return 0; + +fail3: rt2860_free_rx_ring(sc, &sc->rxq); +fail2: while (--qid >= 0) + rt2860_free_tx_ring(sc, &sc->txq[qid]); +fail1: mtx_destroy(&sc->sc_mtx); + if_free(ifp); + return error; +} + +int +rt2860_detach(void *xsc) +{ + struct rt2860_softc *sc = xsc; + struct ifnet *ifp = sc->sc_ifp; + struct ieee80211com *ic = ifp->if_l2com; + int qid; + + RAL_LOCK(sc); + rt2860_stop_locked(sc); + RAL_UNLOCK(sc); + + ieee80211_ifdetach(ic); + + for (qid = 0; qid < 6; qid++) + rt2860_free_tx_ring(sc, &sc->txq[qid]); + rt2860_free_rx_ring(sc, &sc->rxq); + rt2860_free_tx_pool(sc); + + if_free(ifp); + + mtx_destroy(&sc->sc_mtx); + + return 0; +} + +void +rt2860_shutdown(void *xsc) +{ + struct rt2860_softc *sc = xsc; + + rt2860_stop(sc); +} + +void +rt2860_suspend(void *xsc) +{ + struct rt2860_softc *sc = xsc; + + rt2860_stop(sc); +} + +void +rt2860_resume(void *xsc) +{ + struct rt2860_softc *sc = xsc; + struct ifnet *ifp = sc->sc_ifp; + + if (ifp->if_flags & IFF_UP) + rt2860_init(sc); +} + +static struct ieee80211vap * +rt2860_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], int unit, + enum ieee80211_opmode opmode, int flags, + const uint8_t bssid[IEEE80211_ADDR_LEN], + const uint8_t mac[IEEE80211_ADDR_LEN]) +{ + struct ifnet *ifp = ic->ic_ifp; + struct rt2860_vap *rvp; + struct ieee80211vap *vap; + + switch (opmode) { + case IEEE80211_M_STA: + case IEEE80211_M_IBSS: + case IEEE80211_M_AHDEMO: + case IEEE80211_M_MONITOR: + case IEEE80211_M_HOSTAP: + case IEEE80211_M_MBSS: + /* XXXRP: TBD */ + if (!TAILQ_EMPTY(&ic->ic_vaps)) { + if_printf(ifp, "only 1 vap supported\n"); + return NULL; + } + if (opmode == IEEE80211_M_STA) + flags |= IEEE80211_CLONE_NOBEACONS; + break; + case IEEE80211_M_WDS: + if (TAILQ_EMPTY(&ic->ic_vaps) || + ic->ic_opmode != IEEE80211_M_HOSTAP) { + if_printf(ifp, "wds only supported in ap mode\n"); + return NULL; + } + /* + * Silently remove any request for a unique + * bssid; WDS vap's always share the local + * mac address. + */ + flags &= ~IEEE80211_CLONE_BSSID; + break; + default: + if_printf(ifp, "unknown opmode %d\n", opmode); + return NULL; + } + rvp = malloc(sizeof(struct rt2860_vap), M_80211_VAP, M_NOWAIT | M_ZERO); + if (rvp == NULL) + return NULL; + vap = &rvp->ral_vap; + ieee80211_vap_setup(ic, vap, name, unit, opmode, flags, bssid, mac); + + /* override state transition machine */ + rvp->ral_newstate = vap->iv_newstate; + vap->iv_newstate = rt2860_newstate; +#if 0 + vap->iv_update_beacon = rt2860_beacon_update; +#endif + + /* HW supports up to 255 STAs (0-254) in HostAP and IBSS modes */ + vap->iv_max_aid = min(IEEE80211_AID_MAX, RT2860_WCID_MAX); + + ieee80211_ratectl_init(vap); + /* complete setup */ + ieee80211_vap_attach(vap, ieee80211_media_change, ieee80211_media_status); + if (TAILQ_FIRST(&ic->ic_vaps) == vap) + ic->ic_opmode = opmode; + return vap; +} + +static void +rt2860_vap_delete(struct ieee80211vap *vap) +{ + struct rt2860_vap *rvp = RT2860_VAP(vap); + + ieee80211_ratectl_deinit(vap); + ieee80211_vap_detach(vap); + free(rvp, M_80211_VAP); +} + +static void +rt2860_dma_map_addr(void *arg, bus_dma_segment_t *segs, int nseg, int error) +{ + if (error != 0) + return; + + KASSERT(nseg == 1, ("too many DMA segments, %d should be 1", nseg)); + + *(bus_addr_t *)arg = segs[0].ds_addr; +} + + +static int +rt2860_alloc_tx_ring(struct rt2860_softc *sc, struct rt2860_tx_ring *ring) +{ + int size, error; + + size = RT2860_TX_RING_COUNT * sizeof (struct rt2860_txd); + + error = bus_dma_tag_create(bus_get_dma_tag(sc->sc_dev), 16, 0, + BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, + size, 1, size, 0, NULL, NULL, &ring->desc_dmat); + if (error != 0) { + device_printf(sc->sc_dev, "could not create desc DMA map\n"); + goto fail; + } + + error = bus_dmamem_alloc(ring->desc_dmat, (void **)&ring->txd, + BUS_DMA_NOWAIT | BUS_DMA_ZERO, &ring->desc_map); + if (error != 0) { + device_printf(sc->sc_dev, "could not allocate DMA memory\n"); + goto fail; + } + + error = bus_dmamap_load(ring->desc_dmat, ring->desc_map, ring->txd, + size, rt2860_dma_map_addr, &ring->paddr, 0); + if (error != 0) { + device_printf(sc->sc_dev, "could not load desc DMA map\n"); + goto fail; + } + + bus_dmamap_sync(ring->desc_dmat, ring->desc_map, BUS_DMASYNC_PREWRITE); + + return 0; + +fail: rt2860_free_tx_ring(sc, ring); + return error; +} + +void +rt2860_reset_tx_ring(struct rt2860_softc *sc, struct rt2860_tx_ring *ring) +{ + struct rt2860_tx_data *data; + int i; + + for (i = 0; i < RT2860_TX_RING_COUNT; i++) { + if ((data = ring->data[i]) == NULL) + continue; /* nothing mapped in this slot */ + + if (data->m != NULL) { + bus_dmamap_sync(sc->txwi_dmat, data->map, + BUS_DMASYNC_POSTWRITE); + bus_dmamap_unload(sc->txwi_dmat, data->map); + m_freem(data->m); + data->m = NULL; + } + if (data->ni != NULL) { + ieee80211_free_node(data->ni); + data->ni = NULL; + } + + SLIST_INSERT_HEAD(&sc->data_pool, data, next); + ring->data[i] = NULL; + } + + ring->queued = 0; + ring->cur = ring->next = 0; +} + +void +rt2860_free_tx_ring(struct rt2860_softc *sc, struct rt2860_tx_ring *ring) +{ + struct rt2860_tx_data *data; + int i; + + if (ring->txd != NULL) { + bus_dmamap_sync(ring->desc_dmat, ring->desc_map, + BUS_DMASYNC_POSTWRITE); + bus_dmamap_unload(ring->desc_dmat, ring->desc_map); + bus_dmamem_free(ring->desc_dmat, ring->txd, ring->desc_map); + } + if (ring->desc_dmat != NULL) + bus_dma_tag_destroy(ring->desc_dmat); + + for (i = 0; i < RT2860_TX_RING_COUNT; i++) { + if ((data = ring->data[i]) == NULL) + continue; /* nothing mapped in this slot */ + + if (data->m != NULL) { + bus_dmamap_sync(sc->txwi_dmat, data->map, + BUS_DMASYNC_POSTWRITE); + bus_dmamap_unload(sc->txwi_dmat, data->map); + m_freem(data->m); + } + if (data->ni != NULL) + ieee80211_free_node(data->ni); + + SLIST_INSERT_HEAD(&sc->data_pool, data, next); + } +} + +/* + * Allocate a pool of TX Wireless Information blocks. + */ +int +rt2860_alloc_tx_pool(struct rt2860_softc *sc) +{ + caddr_t vaddr; + bus_addr_t paddr; + int i, size, error; + + size = RT2860_TX_POOL_COUNT * RT2860_TXWI_DMASZ; + + /* init data_pool early in case of failure.. */ + SLIST_INIT(&sc->data_pool); + + error = bus_dma_tag_create(bus_get_dma_tag(sc->sc_dev), 1, 0, + BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, + size, 1, size, 0, NULL, NULL, &sc->txwi_dmat); + if (error != 0) { + device_printf(sc->sc_dev, "could not create txwi DMA tag\n"); + goto fail; + } + + error = bus_dmamem_alloc(sc->txwi_dmat, (void **)&sc->txwi_vaddr, + BUS_DMA_NOWAIT | BUS_DMA_ZERO, &sc->txwi_map); + if (error != 0) { + device_printf(sc->sc_dev, "could not allocate DMA memory\n"); + goto fail; + } + + error = bus_dmamap_load(sc->txwi_dmat, sc->txwi_map, + sc->txwi_vaddr, size, rt2860_dma_map_addr, &paddr, 0); + if (error != 0) { + device_printf(sc->sc_dev, "could not load txwi DMA map\n"); + goto fail; + } + + bus_dmamap_sync(sc->txwi_dmat, sc->txwi_map, BUS_DMASYNC_PREWRITE); + + vaddr = sc->txwi_vaddr; + for (i = 0; i < RT2860_TX_POOL_COUNT; i++) { + struct rt2860_tx_data *data = &sc->data[i]; + + error = bus_dmamap_create(sc->txwi_dmat, 0, &data->map); + if (error != 0) { + device_printf(sc->sc_dev, "could not create DMA map\n"); + goto fail; + } + data->txwi = (struct rt2860_txwi *)vaddr; + data->paddr = paddr; + vaddr += RT2860_TXWI_DMASZ; + paddr += RT2860_TXWI_DMASZ; + + SLIST_INSERT_HEAD(&sc->data_pool, data, next); + } + + return 0; + +fail: rt2860_free_tx_pool(sc); + return error; +} + +void +rt2860_free_tx_pool(struct rt2860_softc *sc) +{ + if (sc->txwi_vaddr != NULL) { + bus_dmamap_sync(sc->txwi_dmat, sc->txwi_map, + BUS_DMASYNC_POSTWRITE); + bus_dmamap_unload(sc->txwi_dmat, sc->txwi_map); + bus_dmamem_free(sc->txwi_dmat, sc->txwi_vaddr, sc->txwi_map); + } + if (sc->txwi_dmat != NULL) + bus_dma_tag_destroy(sc->txwi_dmat); + + while (!SLIST_EMPTY(&sc->data_pool)) { + struct rt2860_tx_data *data; + data = SLIST_FIRST(&sc->data_pool); + bus_dmamap_destroy(sc->txwi_dmat, data->map); + SLIST_REMOVE_HEAD(&sc->data_pool, next); + } +} + +int +rt2860_alloc_rx_ring(struct rt2860_softc *sc, struct rt2860_rx_ring *ring) +{ + bus_addr_t physaddr; + int i, size, error; + + size = RT2860_RX_RING_COUNT * sizeof (struct rt2860_rxd); + + error = bus_dma_tag_create(bus_get_dma_tag(sc->sc_dev), 16, 0, + BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, + size, 1, size, 0, NULL, NULL, &ring->desc_dmat); + if (error != 0) { + device_printf(sc->sc_dev, "could not create desc DMA tag\n"); + goto fail; + } + + error = bus_dmamem_alloc(ring->desc_dmat, (void **)&ring->rxd, + BUS_DMA_NOWAIT | BUS_DMA_ZERO, &ring->desc_map); + if (error != 0) { + device_printf(sc->sc_dev, "could not allocate DMA memory\n"); + goto fail; + } + + error = bus_dmamap_load(ring->desc_dmat, ring->desc_map, ring->rxd, + size, rt2860_dma_map_addr, &ring->paddr, 0); + if (error != 0) { + device_printf(sc->sc_dev, "could not load desc DMA map\n"); + goto fail; + } + + error = bus_dma_tag_create(bus_get_dma_tag(sc->sc_dev), 1, 0, + BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, MCLBYTES, + 1, MCLBYTES, 0, NULL, NULL, &ring->data_dmat); + if (error != 0) { + device_printf(sc->sc_dev, "could not create data DMA tag\n"); + goto fail; + } + + for (i = 0; i < RT2860_RX_RING_COUNT; i++) { + struct rt2860_rx_data *data = &ring->data[i]; + struct rt2860_rxd *rxd = &ring->rxd[i]; + + error = bus_dmamap_create(ring->data_dmat, 0, &data->map); + if (error != 0) { + device_printf(sc->sc_dev, "could not create DMA map\n"); + goto fail; + } + + data->m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); + if (data->m == NULL) { + device_printf(sc->sc_dev, + "could not allocate rx mbuf\n"); + error = ENOMEM; + goto fail; + } + + error = bus_dmamap_load(ring->data_dmat, data->map, + mtod(data->m, void *), MCLBYTES, rt2860_dma_map_addr, + &physaddr, 0); + if (error != 0) { + device_printf(sc->sc_dev, + "could not load rx buf DMA map"); + goto fail; + } + + rxd->sdp0 = htole32(physaddr); + rxd->sdl0 = htole16(MCLBYTES); + } + + bus_dmamap_sync(ring->desc_dmat, ring->desc_map, BUS_DMASYNC_PREWRITE); + + return 0; + +fail: rt2860_free_rx_ring(sc, ring); + return error; +} + +void +rt2860_reset_rx_ring(struct rt2860_softc *sc, struct rt2860_rx_ring *ring) +{ + int i; + + for (i = 0; i < RT2860_RX_RING_COUNT; i++) + ring->rxd[i].sdl0 &= ~htole16(RT2860_RX_DDONE); + + bus_dmamap_sync(ring->desc_dmat, ring->desc_map, BUS_DMASYNC_PREWRITE); + + ring->cur = 0; +} + +void +rt2860_free_rx_ring(struct rt2860_softc *sc, struct rt2860_rx_ring *ring) +{ + int i; + + if (ring->rxd != NULL) { + bus_dmamap_sync(ring->desc_dmat, ring->desc_map, + BUS_DMASYNC_POSTWRITE); + bus_dmamap_unload(ring->desc_dmat, ring->desc_map); + bus_dmamem_free(ring->desc_dmat, ring->rxd, ring->desc_map); + } + if (ring->desc_dmat != NULL) + bus_dma_tag_destroy(ring->desc_dmat); + + for (i = 0; i < RT2860_RX_RING_COUNT; i++) { + struct rt2860_rx_data *data = &ring->data[i]; + + if (data->m != NULL) { + bus_dmamap_sync(ring->data_dmat, data->map, + BUS_DMASYNC_POSTREAD); + bus_dmamap_unload(ring->data_dmat, data->map); + m_freem(data->m); + } + if (data->map != NULL) + bus_dmamap_destroy(ring->data_dmat, data->map); + } + if (ring->data_dmat != NULL) + bus_dma_tag_destroy(ring->data_dmat); +} + +static void +rt2860_updatestats(struct rt2860_softc *sc) +{ + struct ieee80211com *ic = sc->sc_ifp->if_l2com; + + /* + * In IBSS or HostAP modes (when the hardware sends beacons), the + * MAC can run into a livelock and start sending CTS-to-self frames + * like crazy if protection is enabled. Fortunately, we can detect + * when such a situation occurs and reset the MAC. + */ + if (ic->ic_curmode != IEEE80211_M_STA) { + /* check if we're in a livelock situation.. */ + uint32_t tmp = RAL_READ(sc, RT2860_DEBUG); + if ((tmp & (1 << 29)) && (tmp & (1 << 7 | 1 << 5))) { + /* ..and reset MAC/BBP for a while.. */ + DPRINTF(("CTS-to-self livelock detected\n")); + RAL_WRITE(sc, RT2860_MAC_SYS_CTRL, RT2860_MAC_SRST); + RAL_BARRIER_WRITE(sc); + DELAY(1); + RAL_WRITE(sc, RT2860_MAC_SYS_CTRL, + RT2860_MAC_RX_EN | RT2860_MAC_TX_EN); + } + } +} + +static void +rt2860_newassoc(struct ieee80211_node *ni, int isnew) +{ + struct ieee80211com *ic = ni->ni_ic; + struct rt2860_softc *sc = ic->ic_ifp->if_softc; + uint8_t wcid; + + wcid = IEEE80211_AID(ni->ni_associd); + if (isnew && ni->ni_associd != 0) { + sc->wcid2ni[wcid] = ni; + + /* init WCID table entry */ + RAL_WRITE_REGION_1(sc, RT2860_WCID_ENTRY(wcid), + ni->ni_macaddr, IEEE80211_ADDR_LEN); + } + DPRINTF(("new assoc isnew=%d addr=%s WCID=%d\n", + isnew, ether_sprintf(ni->ni_macaddr), wcid)); +} + +static void +rt2860_node_free(struct ieee80211_node *ni) +{ + struct ieee80211com *ic = ni->ni_ic; + struct rt2860_softc *sc = ic->ic_ifp->if_softc; + uint8_t wcid; + + if (ni->ni_associd != 0) { + wcid = IEEE80211_AID(ni->ni_associd); + + /* clear Rx WCID search table entry */ + RAL_SET_REGION_4(sc, RT2860_WCID_ENTRY(wcid), 0, 2); + } + sc->sc_node_free(ni); +} + +#ifdef IEEE80211_HT +static int +rt2860_ampdu_rx_start(struct ieee80211com *ic, struct ieee80211_node *ni, + uint8_t tid) +{ + struct rt2860_softc *sc = ic->ic_softc; + uint8_t wcid = ((struct rt2860_node *)ni)->wcid; + uint32_t tmp; + + /* update BA session mask */ + tmp = RAL_READ(sc, RT2860_WCID_ENTRY(wcid) + 4); + tmp |= (1 << tid) << 16; + RAL_WRITE(sc, RT2860_WCID_ENTRY(wcid) + 4, tmp); + return 0; +} + +static void +rt2860_ampdu_rx_stop(struct ieee80211com *ic, struct ieee80211_node *ni, + uint8_t tid) +{ + struct rt2860_softc *sc = ic->ic_softc; + uint8_t wcid = ((struct rt2860_node *)ni)->wcid; + uint32_t tmp; + + /* update BA session mask */ + tmp = RAL_READ(sc, RT2860_WCID_ENTRY(wcid) + 4); + tmp &= ~((1 << tid) << 16); + RAL_WRITE(sc, RT2860_WCID_ENTRY(wcid) + 4, tmp); +} +#endif + +int +rt2860_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg) +{ + struct rt2860_vap *rvp = RT2860_VAP(vap); + struct ieee80211com *ic = vap->iv_ic; + struct rt2860_softc *sc = ic->ic_ifp->if_softc; + uint32_t tmp; + int error; + + if (vap->iv_state == IEEE80211_S_RUN) { + /* turn link LED off */ + rt2860_set_leds(sc, RT2860_LED_RADIO); + } + + if (nstate == IEEE80211_S_INIT && vap->iv_state == IEEE80211_S_RUN) { + /* abort TSF synchronization */ + tmp = RAL_READ(sc, RT2860_BCN_TIME_CFG); + RAL_WRITE(sc, RT2860_BCN_TIME_CFG, + tmp & ~(RT2860_BCN_TX_EN | RT2860_TSF_TIMER_EN | + RT2860_TBTT_TIMER_EN)); + } + + rt2860_set_gp_timer(sc, 0); + + error = rvp->ral_newstate(vap, nstate, arg); + if (error != 0) + return (error); + + if (nstate == IEEE80211_S_RUN) { + struct ieee80211_node *ni = vap->iv_bss; + + if (ic->ic_opmode != IEEE80211_M_MONITOR) { + rt2860_enable_mrr(sc); + rt2860_set_txpreamble(sc); + rt2860_set_basicrates(sc, &ni->ni_rates); + rt2860_set_bssid(sc, ni->ni_bssid); + } + + if (vap->iv_opmode == IEEE80211_M_HOSTAP || + vap->iv_opmode == IEEE80211_M_IBSS || + vap->iv_opmode == IEEE80211_M_MBSS) { + error = rt2860_setup_beacon(sc, vap); + if (error != 0) + return error; + } + + if (ic->ic_opmode != IEEE80211_M_MONITOR) { + rt2860_enable_tsf_sync(sc); + rt2860_set_gp_timer(sc, 500); + } + + /* turn link LED on */ + rt2860_set_leds(sc, RT2860_LED_RADIO | + (IEEE80211_IS_CHAN_2GHZ(ni->ni_chan) ? + RT2860_LED_LINK_2GHZ : RT2860_LED_LINK_5GHZ)); + } + return error; +} + +/* Read 16-bit from eFUSE ROM (>=RT3071 only.) */ +static uint16_t +rt3090_efuse_read_2(struct rt2860_softc *sc, uint16_t addr) +{ + uint32_t tmp; + uint16_t reg; + int ntries; + + addr *= 2; + /*- + * Read one 16-byte block into registers EFUSE_DATA[0-3]: + * DATA0: F E D C + * DATA1: B A 9 8 + * DATA2: 7 6 5 4 + * DATA3: 3 2 1 0 + */ + tmp = RAL_READ(sc, RT3070_EFUSE_CTRL); + tmp &= ~(RT3070_EFSROM_MODE_MASK | RT3070_EFSROM_AIN_MASK); + tmp |= (addr & ~0xf) << RT3070_EFSROM_AIN_SHIFT | RT3070_EFSROM_KICK; + RAL_WRITE(sc, RT3070_EFUSE_CTRL, tmp); + for (ntries = 0; ntries < 500; ntries++) { + tmp = RAL_READ(sc, RT3070_EFUSE_CTRL); + if (!(tmp & RT3070_EFSROM_KICK)) + break; + DELAY(2); + } + if (ntries == 500) + return 0xffff; + + if ((tmp & RT3070_EFUSE_AOUT_MASK) == RT3070_EFUSE_AOUT_MASK) + return 0xffff; /* address not found */ + + /* determine to which 32-bit register our 16-bit word belongs */ + reg = RT3070_EFUSE_DATA3 - (addr & 0xc); + tmp = RAL_READ(sc, reg); + + return (addr & 2) ? tmp >> 16 : tmp & 0xffff; +} + +/* + * Read 16 bits at address 'addr' from the serial EEPROM (either 93C46, + * 93C66 or 93C86). + */ +static uint16_t +rt2860_eeprom_read_2(struct rt2860_softc *sc, uint16_t addr) +{ + uint32_t tmp; + uint16_t val; + int n; + + /* clock C once before the first command */ + RT2860_EEPROM_CTL(sc, 0); + + RT2860_EEPROM_CTL(sc, RT2860_S); + RT2860_EEPROM_CTL(sc, RT2860_S | RT2860_C); + RT2860_EEPROM_CTL(sc, RT2860_S); + + /* write start bit (1) */ + RT2860_EEPROM_CTL(sc, RT2860_S | RT2860_D); + RT2860_EEPROM_CTL(sc, RT2860_S | RT2860_D | RT2860_C); + + /* write READ opcode (10) */ + RT2860_EEPROM_CTL(sc, RT2860_S | RT2860_D); + RT2860_EEPROM_CTL(sc, RT2860_S | RT2860_D | RT2860_C); + RT2860_EEPROM_CTL(sc, RT2860_S); + RT2860_EEPROM_CTL(sc, RT2860_S | RT2860_C); + + /* write address (A5-A0 or A7-A0) */ + n = ((RAL_READ(sc, RT2860_PCI_EECTRL) & 0x30) == 0) ? 5 : 7; + for (; n >= 0; n--) { + RT2860_EEPROM_CTL(sc, RT2860_S | + (((addr >> n) & 1) << RT2860_SHIFT_D)); + RT2860_EEPROM_CTL(sc, RT2860_S | + (((addr >> n) & 1) << RT2860_SHIFT_D) | RT2860_C); + } + + RT2860_EEPROM_CTL(sc, RT2860_S); + + /* read data Q15-Q0 */ + val = 0; + for (n = 15; n >= 0; n--) { + RT2860_EEPROM_CTL(sc, RT2860_S | RT2860_C); + tmp = RAL_READ(sc, RT2860_PCI_EECTRL); + val |= ((tmp & RT2860_Q) >> RT2860_SHIFT_Q) << n; + RT2860_EEPROM_CTL(sc, RT2860_S); + } + + RT2860_EEPROM_CTL(sc, 0); + + /* clear Chip Select and clock C */ + RT2860_EEPROM_CTL(sc, RT2860_S); + RT2860_EEPROM_CTL(sc, 0); + RT2860_EEPROM_CTL(sc, RT2860_C); + + return val; +} + +static __inline uint16_t +rt2860_srom_read(struct rt2860_softc *sc, uint8_t addr) +{ + /* either eFUSE ROM or EEPROM */ + return sc->sc_srom_read(sc, addr); +} + +static void +rt2860_intr_coherent(struct rt2860_softc *sc) +{ + uint32_t tmp; + + /* DMA finds data coherent event when checking the DDONE bit */ + + DPRINTF(("Tx/Rx Coherent interrupt\n")); + + /* restart DMA engine */ + tmp = RAL_READ(sc, RT2860_WPDMA_GLO_CFG); + tmp &= ~(RT2860_TX_WB_DDONE | RT2860_RX_DMA_EN | RT2860_TX_DMA_EN); + RAL_WRITE(sc, RT2860_WPDMA_GLO_CFG, tmp); + + (void)rt2860_txrx_enable(sc); +} + +static void +rt2860_drain_stats_fifo(struct rt2860_softc *sc) +{ + struct ifnet *ifp = sc->sc_ifp; + struct ieee80211_node *ni; + uint32_t stat; + int retrycnt; + uint8_t wcid, mcs, pid; + + /* drain Tx status FIFO (maxsize = 16) */ + while ((stat = RAL_READ(sc, RT2860_TX_STAT_FIFO)) & RT2860_TXQ_VLD) { + DPRINTFN(4, ("tx stat 0x%08x\n", stat)); + + wcid = (stat >> RT2860_TXQ_WCID_SHIFT) & 0xff; + ni = sc->wcid2ni[wcid]; + + /* if no ACK was requested, no feedback is available */ + if (!(stat & RT2860_TXQ_ACKREQ) || wcid == 0xff || ni == NULL) + continue; + + /* update per-STA AMRR stats */ + if (stat & RT2860_TXQ_OK) { + /* + * Check if there were retries, ie if the Tx success + * rate is different from the requested rate. Note + * that it works only because we do not allow rate + * fallback from OFDM to CCK. + */ + mcs = (stat >> RT2860_TXQ_MCS_SHIFT) & 0x7f; + pid = (stat >> RT2860_TXQ_PID_SHIFT) & 0xf; + if (mcs + 1 != pid) + retrycnt = 1; + else + retrycnt = 0; + ieee80211_ratectl_tx_complete(ni->ni_vap, ni, + IEEE80211_RATECTL_TX_SUCCESS, &retrycnt, NULL); + } else { + ieee80211_ratectl_tx_complete(ni->ni_vap, ni, + IEEE80211_RATECTL_TX_FAILURE, &retrycnt, NULL); + ifp->if_oerrors++; + } + } +} + +static void +rt2860_tx_intr(struct rt2860_softc *sc, int qid) +{ + struct ifnet *ifp = sc->sc_ifp; + struct rt2860_tx_ring *ring = &sc->txq[qid]; + uint32_t hw; + + rt2860_drain_stats_fifo(sc); + + hw = RAL_READ(sc, RT2860_TX_DTX_IDX(qid)); + while (ring->next != hw) { + struct rt2860_tx_data *data = ring->data[ring->next]; + + if (data != NULL) { + bus_dmamap_sync(sc->txwi_dmat, data->map, + BUS_DMASYNC_POSTWRITE); + bus_dmamap_unload(sc->txwi_dmat, data->map); + if (data->m->m_flags & M_TXCB) { + ieee80211_process_callback(data->ni, data->m, + 0); + } + m_freem(data->m); + ieee80211_free_node(data->ni); + data->m = NULL; + data->ni = NULL; + + SLIST_INSERT_HEAD(&sc->data_pool, data, next); + ring->data[ring->next] = NULL; + + ifp->if_opackets++; + } + ring->queued--; + ring->next = (ring->next + 1) % RT2860_TX_RING_COUNT; + } + + sc->sc_tx_timer = 0; + if (ring->queued < RT2860_TX_RING_COUNT) + sc->qfullmsk &= ~(1 << qid); + ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; + rt2860_start_locked(ifp); +} + +/* + * Return the Rx chain with the highest RSSI for a given frame. + */ +static __inline uint8_t +rt2860_maxrssi_chain(struct rt2860_softc *sc, const struct rt2860_rxwi *rxwi) +{ + uint8_t rxchain = 0; + + if (sc->nrxchains > 1) { + if (rxwi->rssi[1] > rxwi->rssi[rxchain]) + rxchain = 1; + if (sc->nrxchains > 2) + if (rxwi->rssi[2] > rxwi->rssi[rxchain]) + rxchain = 2; + } + return rxchain; +} + +static void +rt2860_rx_intr(struct rt2860_softc *sc) +{ + struct rt2860_rx_radiotap_header *tap; + struct ifnet *ifp = sc->sc_ifp; + struct ieee80211com *ic = ifp->if_l2com; + struct ieee80211_frame *wh; + struct ieee80211_node *ni; + struct mbuf *m, *m1; + bus_addr_t physaddr; + uint32_t hw; + uint16_t phy; + uint8_t ant; + int8_t rssi, nf; + int error; + + hw = RAL_READ(sc, RT2860_FS_DRX_IDX) & 0xfff; + while (sc->rxq.cur != hw) { + struct rt2860_rx_data *data = &sc->rxq.data[sc->rxq.cur]; + struct rt2860_rxd *rxd = &sc->rxq.rxd[sc->rxq.cur]; + struct rt2860_rxwi *rxwi; + + bus_dmamap_sync(sc->rxq.desc_dmat, sc->rxq.desc_map, + BUS_DMASYNC_POSTREAD); + + if (__predict_false(!(rxd->sdl0 & htole16(RT2860_RX_DDONE)))) { + DPRINTF(("RXD DDONE bit not set!\n")); + break; /* should not happen */ + } + + if (__predict_false(rxd->flags & + htole32(RT2860_RX_CRCERR | RT2860_RX_ICVERR))) { + ifp->if_ierrors++; + goto skip; + } + +#ifdef HW_CRYPTO + if (__predict_false(rxd->flags & htole32(RT2860_RX_MICERR))) { + /* report MIC failures to net80211 for TKIP */ + ic->ic_stats.is_rx_locmicfail++; + ieee80211_michael_mic_failure(ic, 0/* XXX */); + ifp->if_ierrors++; + goto skip; + } +#endif + + m1 = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); + if (__predict_false(m1 == NULL)) { + ifp->if_ierrors++; + goto skip; + } + + bus_dmamap_sync(sc->rxq.data_dmat, data->map, + BUS_DMASYNC_POSTREAD); + bus_dmamap_unload(sc->rxq.data_dmat, data->map); + + error = bus_dmamap_load(sc->rxq.data_dmat, data->map, + mtod(m1, void *), MCLBYTES, rt2860_dma_map_addr, + &physaddr, 0); + if (__predict_false(error != 0)) { + m_freem(m1); + + /* try to reload the old mbuf */ + error = bus_dmamap_load(sc->rxq.data_dmat, data->map, + mtod(data->m, void *), MCLBYTES, + rt2860_dma_map_addr, &physaddr, 0); + if (__predict_false(error != 0)) { + panic("%s: could not load old rx mbuf", + device_get_name(sc->sc_dev)); + } + /* physical address may have changed */ + rxd->sdp0 = htole32(physaddr); + ifp->if_ierrors++; + goto skip; + } + + /* + * New mbuf successfully loaded, update Rx ring and continue + * processing. + */ + m = data->m; + data->m = m1; + rxd->sdp0 = htole32(physaddr); + + rxwi = mtod(m, struct rt2860_rxwi *); + + /* finalize mbuf */ + m->m_pkthdr.rcvif = ifp; + m->m_data = (caddr_t)(rxwi + 1); + m->m_pkthdr.len = m->m_len = le16toh(rxwi->len) & 0xfff; + + wh = mtod(m, struct ieee80211_frame *); +#ifdef HW_CRYPTO + if (wh->i_fc[1] & IEEE80211_FC1_WEP) { + /* frame is decrypted by hardware */ + wh->i_fc[1] &= ~IEEE80211_FC1_WEP; + } +#endif + + /* HW may insert 2 padding bytes after 802.11 header */ + if (rxd->flags & htole32(RT2860_RX_L2PAD)) { + u_int hdrlen = ieee80211_hdrsize(wh); + ovbcopy(wh, (caddr_t)wh + 2, hdrlen); + m->m_data += 2; + wh = mtod(m, struct ieee80211_frame *); + } + + ant = rt2860_maxrssi_chain(sc, rxwi); + rssi = rt2860_rssi2dbm(sc, rxwi->rssi[ant], ant); + nf = RT2860_NOISE_FLOOR; + + if (ieee80211_radiotap_active(ic)) { + tap = &sc->sc_rxtap; + tap->wr_flags = 0; + tap->wr_antenna = ant; + tap->wr_antsignal = nf + rssi; + tap->wr_antnoise = nf; + /* in case it can't be found below */ + tap->wr_rate = 2; + phy = le16toh(rxwi->phy); + switch (phy & RT2860_PHY_MODE) { + case RT2860_PHY_CCK: + switch ((phy & RT2860_PHY_MCS) & ~RT2860_PHY_SHPRE) { + case 0: tap->wr_rate = 2; break; + case 1: tap->wr_rate = 4; break; + case 2: tap->wr_rate = 11; break; + case 3: tap->wr_rate = 22; break; + } + if (phy & RT2860_PHY_SHPRE) + tap->wr_flags |= IEEE80211_RADIOTAP_F_SHORTPRE; + break; + case RT2860_PHY_OFDM: + switch (phy & RT2860_PHY_MCS) { + case 0: tap->wr_rate = 12; break; + case 1: tap->wr_rate = 18; break; + case 2: tap->wr_rate = 24; break; + case 3: tap->wr_rate = 36; break; + case 4: tap->wr_rate = 48; break; + case 5: tap->wr_rate = 72; break; + case 6: tap->wr_rate = 96; break; + case 7: tap->wr_rate = 108; break; + } + break; + } + } + + RAL_UNLOCK(sc); + wh = mtod(m, struct ieee80211_frame *); + + /* send the frame to the 802.11 layer */ + ni = ieee80211_find_rxnode(ic, + (struct ieee80211_frame_min *)wh); + if (ni != NULL) { + (void)ieee80211_input(ni, m, rssi - nf, nf); + ieee80211_free_node(ni); + } else + (void)ieee80211_input_all(ic, m, rssi - nf, nf); + + RAL_LOCK(sc); + +skip: rxd->sdl0 &= ~htole16(RT2860_RX_DDONE); + + bus_dmamap_sync(sc->rxq.desc_dmat, sc->rxq.desc_map, + BUS_DMASYNC_PREWRITE); + + sc->rxq.cur = (sc->rxq.cur + 1) % RT2860_RX_RING_COUNT; + } + + /* tell HW what we have processed */ + RAL_WRITE(sc, RT2860_RX_CALC_IDX, + (sc->rxq.cur - 1) % RT2860_RX_RING_COUNT); +} + +static void +rt2860_tbtt_intr(struct rt2860_softc *sc) +{ +#if 0 + struct ieee80211com *ic = &sc->sc_ic; + +#ifndef IEEE80211_STA_ONLY + if (ic->ic_opmode == IEEE80211_M_HOSTAP) { + /* one less beacon until next DTIM */ + if (ic->ic_dtim_count == 0) + ic->ic_dtim_count = ic->ic_dtim_period - 1; + else + ic->ic_dtim_count--; + + /* update dynamic parts of beacon */ + rt2860_setup_beacon(sc); + + /* flush buffered multicast frames */ + if (ic->ic_dtim_count == 0) + ieee80211_notify_dtim(ic); + } +#endif + /* check if protection mode has changed */ + if ((sc->sc_ic_flags ^ ic->ic_flags) & IEEE80211_F_USEPROT) { + rt2860_updateprot(ic); + sc->sc_ic_flags = ic->ic_flags; + } +#endif +} + +static void +rt2860_gp_intr(struct rt2860_softc *sc) +{ + struct ieee80211com *ic = sc->sc_ifp->if_l2com; + struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps); + + DPRINTFN(2, ("GP timeout state=%d\n", vap->iv_state)); + + if (vap->iv_state == IEEE80211_S_RUN) + rt2860_updatestats(sc); +} + +void +rt2860_intr(void *arg) +{ + struct rt2860_softc *sc = arg; + uint32_t r; + + RAL_LOCK(sc); + +#ifndef __HAIKU__ + r = RAL_READ(sc, RT2860_INT_STATUS); + if (__predict_false(r == 0xffffffff)) { + RAL_UNLOCK(sc); + return; /* device likely went away */ + } + if (r == 0) { + RAL_UNLOCK(sc); + return; /* not for us */ + } +#else + r = atomic_get((int32 *)&sc->sc_intr_status); +#endif + + /* acknowledge interrupts */ + RAL_WRITE(sc, RT2860_INT_STATUS, r); + + if (r & RT2860_TX_RX_COHERENT) + rt2860_intr_coherent(sc); + + if (r & RT2860_MAC_INT_2) /* TX status */ + rt2860_drain_stats_fifo(sc); + + if (r & RT2860_TX_DONE_INT5) + rt2860_tx_intr(sc, 5); + + if (r & RT2860_RX_DONE_INT) + rt2860_rx_intr(sc); + + if (r & RT2860_TX_DONE_INT4) + rt2860_tx_intr(sc, 4); + + if (r & RT2860_TX_DONE_INT3) + rt2860_tx_intr(sc, 3); + + if (r & RT2860_TX_DONE_INT2) + rt2860_tx_intr(sc, 2); + + if (r & RT2860_TX_DONE_INT1) + rt2860_tx_intr(sc, 1); + + if (r & RT2860_TX_DONE_INT0) + rt2860_tx_intr(sc, 0); + + if (r & RT2860_MAC_INT_0) /* TBTT */ + rt2860_tbtt_intr(sc); + + if (r & RT2860_MAC_INT_3) /* Auto wakeup */ + /* TBD wakeup */; + + if (r & RT2860_MAC_INT_4) /* GP timer */ + rt2860_gp_intr(sc); + + RAL_UNLOCK(sc); +} + +static int +rt2860_tx(struct rt2860_softc *sc, struct mbuf *m, struct ieee80211_node *ni) +{ + struct ifnet *ifp = sc->sc_ifp; + struct ieee80211com *ic = ifp->if_l2com; + struct ieee80211vap *vap = ni->ni_vap; + struct rt2860_tx_ring *ring; + struct rt2860_tx_data *data; + struct rt2860_txd *txd; + struct rt2860_txwi *txwi; + struct ieee80211_frame *wh; + const struct ieee80211_txparam *tp; + struct ieee80211_key *k; + struct mbuf *m1; + bus_dma_segment_t segs[RT2860_MAX_SCATTER]; + bus_dma_segment_t *seg; + u_int hdrlen; + uint16_t qos, dur; + uint8_t type, qsel, mcs, pid, tid, qid; + int i, nsegs, ntxds, pad, rate, ridx, error; + + /* the data pool contains at least one element, pick the first */ + data = SLIST_FIRST(&sc->data_pool); + + wh = mtod(m, struct ieee80211_frame *); + + if (wh->i_fc[1] & IEEE80211_FC1_WEP) { + k = ieee80211_crypto_encap(ni, m); + if (k == NULL) { + m_freem(m); + return ENOBUFS; + } + + /* packet header may have moved, reset our local pointer */ + wh = mtod(m, struct ieee80211_frame *); + } + + hdrlen = ieee80211_anyhdrsize(wh); + type = wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK; + + tp = &vap->iv_txparms[ieee80211_chan2mode(ni->ni_chan)]; + if (IEEE80211_IS_MULTICAST(wh->i_addr1)) { + rate = tp->mcastrate; + } else if (m->m_flags & M_EAPOL) { + rate = tp->mgmtrate; + } else if (tp->ucastrate != IEEE80211_FIXED_RATE_NONE) { + rate = tp->ucastrate; + } else { + (void) ieee80211_ratectl_rate(ni, NULL, 0); + rate = ni->ni_txrate; + } + rate &= IEEE80211_RATE_VAL; + + qid = M_WME_GETAC(m); + if (IEEE80211_QOS_HAS_SEQ(wh)) { + qos = ((const struct ieee80211_qosframe *)wh)->i_qos[0]; + tid = qos & IEEE80211_QOS_TID; + } else { + qos = 0; + tid = 0; + } + ring = &sc->txq[qid]; + ridx = ic->ic_rt->rateCodeToIndex[rate]; + + /* get MCS code from rate index */ + mcs = rt2860_rates[ridx].mcs; + + /* setup TX Wireless Information */ + txwi = data->txwi; + txwi->flags = 0; + /* let HW generate seq numbers for non-QoS frames */ + txwi->xflags = qos ? 0 : RT2860_TX_NSEQ; + if (type == IEEE80211_FC0_TYPE_DATA) + txwi->wcid = IEEE80211_AID(ni->ni_associd); + else + txwi->wcid = 0xff; + txwi->len = htole16(m->m_pkthdr.len); + if (rt2860_rates[ridx].phy == IEEE80211_T_DS) { + txwi->phy = htole16(RT2860_PHY_CCK); + if (ridx != RT2860_RIDX_CCK1 && + (ic->ic_flags & IEEE80211_F_SHPREAMBLE)) + mcs |= RT2860_PHY_SHPRE; + } else + txwi->phy = htole16(RT2860_PHY_OFDM); + txwi->phy |= htole16(mcs); + + /* + * We store the MCS code into the driver-private PacketID field. + * The PacketID is latched into TX_STAT_FIFO when Tx completes so + * that we know at which initial rate the frame was transmitted. + * We add 1 to the MCS code because setting the PacketID field to + * 0 means that we don't want feedback in TX_STAT_FIFO. + */ + pid = (mcs + 1) & 0xf; + txwi->len |= htole16(pid << RT2860_TX_PID_SHIFT); + + /* check if RTS/CTS or CTS-to-self protection is required */ + if (!IEEE80211_IS_MULTICAST(wh->i_addr1) && + (m->m_pkthdr.len + IEEE80211_CRC_LEN > vap->iv_rtsthreshold || + ((ic->ic_flags & IEEE80211_F_USEPROT) && + rt2860_rates[ridx].phy == IEEE80211_T_OFDM))) + txwi->txop = RT2860_TX_TXOP_HT; + else + txwi->txop = RT2860_TX_TXOP_BACKOFF; + + if (!IEEE80211_IS_MULTICAST(wh->i_addr1) && + (!qos || (qos & IEEE80211_QOS_ACKPOLICY) != + IEEE80211_QOS_ACKPOLICY_NOACK)) { + txwi->xflags |= RT2860_TX_ACK; + + if (ic->ic_flags & IEEE80211_F_SHPREAMBLE) + dur = rt2860_rates[ridx].sp_ack_dur; + else + dur = rt2860_rates[ridx].lp_ack_dur; + *(uint16_t *)wh->i_dur = htole16(dur); + } + /* ask MAC to insert timestamp into probe responses */ + if ((wh->i_fc[0] & + (IEEE80211_FC0_TYPE_MASK | IEEE80211_FC0_SUBTYPE_MASK)) == + (IEEE80211_FC0_TYPE_MGT | IEEE80211_FC0_SUBTYPE_PROBE_RESP)) + /* NOTE: beacons do not pass through tx_data() */ + txwi->flags |= RT2860_TX_TS; + + if (ieee80211_radiotap_active_vap(vap)) { + struct rt2860_tx_radiotap_header *tap = &sc->sc_txtap; + + tap->wt_flags = 0; + tap->wt_rate = rate; + if (mcs & RT2860_PHY_SHPRE) + tap->wt_flags |= IEEE80211_RADIOTAP_F_SHORTPRE; + + ieee80211_radiotap_tx(vap, m); + } + + pad = (hdrlen + 3) & ~3; + + /* copy and trim 802.11 header */ + memcpy(txwi + 1, wh, hdrlen); + m_adj(m, hdrlen); + + error = bus_dmamap_load_mbuf_sg(sc->txwi_dmat, data->map, m, segs, + &nsegs, 0); + if (__predict_false(error != 0 && error != EFBIG)) { + device_printf(sc->sc_dev, "can't map mbuf (error %d)\n", + error); + m_freem(m); + return error; + } + if (__predict_true(error == 0)) { + /* determine how many TXDs are required */ + ntxds = 1 + (nsegs / 2); + + if (ring->queued + ntxds >= RT2860_TX_RING_COUNT) { + /* not enough free TXDs, force mbuf defrag */ + bus_dmamap_unload(sc->txwi_dmat, data->map); + error = EFBIG; + } + } + if (__predict_false(error != 0)) { + m1 = m_defrag(m, M_DONTWAIT); + if (m1 == NULL) { + device_printf(sc->sc_dev, + "could not defragment mbuf\n"); + m_freem(m); + return ENOBUFS; + } + m = m1; + + error = bus_dmamap_load_mbuf_sg(sc->txwi_dmat, data->map, m, + segs, &nsegs, 0); + if (__predict_false(error != 0)) { + device_printf(sc->sc_dev, "can't map mbuf (error %d)\n", + error); + m_freem(m); + return error; + } + + /* determine how many TXDs are now required */ + ntxds = 1 + (nsegs / 2); + + if (ring->queued + ntxds >= RT2860_TX_RING_COUNT) { + /* this is a hopeless case, drop the mbuf! */ + bus_dmamap_unload(sc->txwi_dmat, data->map); + m_freem(m); + return ENOBUFS; + } + } + + qsel = (qid < WME_NUM_AC) ? RT2860_TX_QSEL_EDCA : RT2860_TX_QSEL_MGMT; + + /* first segment is TXWI + 802.11 header */ + txd = &ring->txd[ring->cur]; + txd->sdp0 = htole32(data->paddr); + txd->sdl0 = htole16(sizeof (struct rt2860_txwi) + pad); + txd->flags = qsel; + + /* setup payload segments */ + seg = &segs[0]; + for (i = nsegs; i >= 2; i -= 2) { + txd->sdp1 = htole32(seg->ds_addr); + txd->sdl1 = htole16(seg->ds_len); + seg++; + ring->cur = (ring->cur + 1) % RT2860_TX_RING_COUNT; + /* grab a new Tx descriptor */ + txd = &ring->txd[ring->cur]; + txd->sdp0 = htole32(seg->ds_addr); + txd->sdl0 = htole16(seg->ds_len); + txd->flags = qsel; + seg++; + } + /* finalize last segment */ + if (i > 0) { + txd->sdp1 = htole32(seg->ds_addr); + txd->sdl1 = htole16(seg->ds_len | RT2860_TX_LS1); + } else { + txd->sdl0 |= htole16(RT2860_TX_LS0); + txd->sdl1 = 0; + } + + /* remove from the free pool and link it into the SW Tx slot */ + SLIST_REMOVE_HEAD(&sc->data_pool, next); + data->m = m; + data->ni = ni; + ring->data[ring->cur] = data; + + bus_dmamap_sync(sc->txwi_dmat, sc->txwi_map, BUS_DMASYNC_PREWRITE); + bus_dmamap_sync(sc->txwi_dmat, data->map, BUS_DMASYNC_PREWRITE); + bus_dmamap_sync(ring->desc_dmat, ring->desc_map, BUS_DMASYNC_PREWRITE); + + DPRINTFN(4, ("sending frame qid=%d wcid=%d nsegs=%d ridx=%d\n", + qid, txwi->wcid, nsegs, ridx)); + + ring->cur = (ring->cur + 1) % RT2860_TX_RING_COUNT; + ring->queued += ntxds; + if (ring->queued >= RT2860_TX_RING_COUNT) + sc->qfullmsk |= 1 << qid; + + /* kick Tx */ + RAL_WRITE(sc, RT2860_TX_CTX_IDX(qid), ring->cur); + + return 0; +} + +static int +rt2860_raw_xmit(struct ieee80211_node *ni, struct mbuf *m, + const struct ieee80211_bpf_params *params) +{ + struct ieee80211com *ic = ni->ni_ic; + struct ifnet *ifp = ic->ic_ifp; + struct rt2860_softc *sc = ifp->if_softc; + int error; + + RAL_LOCK(sc); + + /* prevent management frames from being sent if we're not ready */ + if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) { + RAL_UNLOCK(sc); + m_freem(m); + ieee80211_free_node(ni); + return ENETDOWN; + } + if (params == NULL) { + /* + * Legacy path; interpret frame contents to decide + * precisely how to send the frame. + */ + error = rt2860_tx(sc, m, ni); + } else { + /* + * Caller supplied explicit parameters to use in + * sending the frame. + */ + error = rt2860_tx_raw(sc, m, ni, params); + } + if (error != 0) { + /* NB: m is reclaimed on tx failure */ + ieee80211_free_node(ni); + ifp->if_oerrors++; + } + sc->sc_tx_timer = 5; + RAL_UNLOCK(sc); + return error; +} + +static int +rt2860_tx_raw(struct rt2860_softc *sc, struct mbuf *m, + struct ieee80211_node *ni, const struct ieee80211_bpf_params *params) +{ + struct ifnet *ifp = sc->sc_ifp; + struct ieee80211com *ic = ifp->if_l2com; + struct ieee80211vap *vap = ni->ni_vap; + struct rt2860_tx_ring *ring; + struct rt2860_tx_data *data; + struct rt2860_txd *txd; + struct rt2860_txwi *txwi; + struct ieee80211_frame *wh; + struct mbuf *m1; + bus_dma_segment_t segs[RT2860_MAX_SCATTER]; + bus_dma_segment_t *seg; + u_int hdrlen; + uint16_t dur; + uint8_t type, qsel, mcs, pid, tid, qid; + int i, nsegs, ntxds, pad, rate, ridx, error; + + /* the data pool contains at least one element, pick the first */ + data = SLIST_FIRST(&sc->data_pool); + + wh = mtod(m, struct ieee80211_frame *); + hdrlen = ieee80211_hdrsize(wh); + type = wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK; + + /* Choose a TX rate index. */ + rate = params->ibp_rate0; + ridx = ic->ic_rt->rateCodeToIndex[rate]; + if (ridx == (uint8_t)-1) { + /* XXX fall back to mcast/mgmt rate? */ + m_freem(m); + return EINVAL; + } + + qid = params->ibp_pri & 3; + tid = 0; + ring = &sc->txq[qid]; + + /* get MCS code from rate index */ + mcs = rt2860_rates[ridx].mcs; + + /* setup TX Wireless Information */ + txwi = data->txwi; + txwi->flags = 0; + /* let HW generate seq numbers for non-QoS frames */ + txwi->xflags = params->ibp_pri & 3 ? 0 : RT2860_TX_NSEQ; + txwi->wcid = 0xff; + txwi->len = htole16(m->m_pkthdr.len); + if (rt2860_rates[ridx].phy == IEEE80211_T_DS) { + txwi->phy = htole16(RT2860_PHY_CCK); + if (ridx != RT2860_RIDX_CCK1 && + (ic->ic_flags & IEEE80211_F_SHPREAMBLE)) + mcs |= RT2860_PHY_SHPRE; + } else + txwi->phy = htole16(RT2860_PHY_OFDM); + txwi->phy |= htole16(mcs); + + /* + * We store the MCS code into the driver-private PacketID field. + * The PacketID is latched into TX_STAT_FIFO when Tx completes so + * that we know at which initial rate the frame was transmitted. + * We add 1 to the MCS code because setting the PacketID field to + * 0 means that we don't want feedback in TX_STAT_FIFO. + */ + pid = (mcs + 1) & 0xf; + txwi->len |= htole16(pid << RT2860_TX_PID_SHIFT); + + /* check if RTS/CTS or CTS-to-self protection is required */ + if (params->ibp_flags & IEEE80211_BPF_RTS || + params->ibp_flags & IEEE80211_BPF_CTS) + txwi->txop = RT2860_TX_TXOP_HT; + else + txwi->txop = RT2860_TX_TXOP_BACKOFF; + if ((params->ibp_flags & IEEE80211_BPF_NOACK) == 0) { + txwi->xflags |= RT2860_TX_ACK; + + if (ic->ic_flags & IEEE80211_F_SHPREAMBLE) + dur = rt2860_rates[ridx].sp_ack_dur; + else + dur = rt2860_rates[ridx].lp_ack_dur; + *(uint16_t *)wh->i_dur = htole16(dur); + } + /* ask MAC to insert timestamp into probe responses */ + if ((wh->i_fc[0] & + (IEEE80211_FC0_TYPE_MASK | IEEE80211_FC0_SUBTYPE_MASK)) == + (IEEE80211_FC0_TYPE_MGT | IEEE80211_FC0_SUBTYPE_PROBE_RESP)) + /* NOTE: beacons do not pass through tx_data() */ + txwi->flags |= RT2860_TX_TS; + + if (ieee80211_radiotap_active_vap(vap)) { + struct rt2860_tx_radiotap_header *tap = &sc->sc_txtap; + + tap->wt_flags = 0; + tap->wt_rate = rate; + if (mcs & RT2860_PHY_SHPRE) + tap->wt_flags |= IEEE80211_RADIOTAP_F_SHORTPRE; + + ieee80211_radiotap_tx(vap, m); + } + + pad = (hdrlen + 3) & ~3; + + /* copy and trim 802.11 header */ + memcpy(txwi + 1, wh, hdrlen); + m_adj(m, hdrlen); + + error = bus_dmamap_load_mbuf_sg(sc->txwi_dmat, data->map, m, segs, + &nsegs, 0); + if (__predict_false(error != 0 && error != EFBIG)) { + device_printf(sc->sc_dev, "can't map mbuf (error %d)\n", + error); + m_freem(m); + return error; + } + if (__predict_true(error == 0)) { + /* determine how many TXDs are required */ + ntxds = 1 + (nsegs / 2); + + if (ring->queued + ntxds >= RT2860_TX_RING_COUNT) { + /* not enough free TXDs, force mbuf defrag */ + bus_dmamap_unload(sc->txwi_dmat, data->map); + error = EFBIG; + } + } + if (__predict_false(error != 0)) { + m1 = m_defrag(m, M_DONTWAIT); + if (m1 == NULL) { + device_printf(sc->sc_dev, + "could not defragment mbuf\n"); + m_freem(m); + return ENOBUFS; + } + m = m1; + + error = bus_dmamap_load_mbuf_sg(sc->txwi_dmat, data->map, m, + segs, &nsegs, 0); + if (__predict_false(error != 0)) { + device_printf(sc->sc_dev, "can't map mbuf (error %d)\n", + error); + m_freem(m); + return error; + } + + /* determine how many TXDs are now required */ + ntxds = 1 + (nsegs / 2); + + if (ring->queued + ntxds >= RT2860_TX_RING_COUNT) { + /* this is a hopeless case, drop the mbuf! */ + bus_dmamap_unload(sc->txwi_dmat, data->map); + m_freem(m); + return ENOBUFS; + } + } + + qsel = (qid < WME_NUM_AC) ? RT2860_TX_QSEL_EDCA : RT2860_TX_QSEL_MGMT; + + /* first segment is TXWI + 802.11 header */ + txd = &ring->txd[ring->cur]; + txd->sdp0 = htole32(data->paddr); + txd->sdl0 = htole16(sizeof (struct rt2860_txwi) + pad); + txd->flags = qsel; + + /* setup payload segments */ + seg = &segs[0]; + for (i = nsegs; i >= 2; i -= 2) { + txd->sdp1 = htole32(seg->ds_addr); + txd->sdl1 = htole16(seg->ds_len); + seg++; + ring->cur = (ring->cur + 1) % RT2860_TX_RING_COUNT; + /* grab a new Tx descriptor */ + txd = &ring->txd[ring->cur]; + txd->sdp0 = htole32(seg->ds_addr); + txd->sdl0 = htole16(seg->ds_len); + txd->flags = qsel; + seg++; + } + /* finalize last segment */ + if (i > 0) { + txd->sdp1 = htole32(seg->ds_addr); + txd->sdl1 = htole16(seg->ds_len | RT2860_TX_LS1); + } else { + txd->sdl0 |= htole16(RT2860_TX_LS0); + txd->sdl1 = 0; + } + + /* remove from the free pool and link it into the SW Tx slot */ + SLIST_REMOVE_HEAD(&sc->data_pool, next); + data->m = m; + data->ni = ni; + ring->data[ring->cur] = data; + + bus_dmamap_sync(sc->txwi_dmat, sc->txwi_map, BUS_DMASYNC_PREWRITE); + bus_dmamap_sync(sc->txwi_dmat, data->map, BUS_DMASYNC_PREWRITE); + bus_dmamap_sync(ring->desc_dmat, ring->desc_map, BUS_DMASYNC_PREWRITE); + + DPRINTFN(4, ("sending frame qid=%d wcid=%d nsegs=%d ridx=%d\n", + qid, txwi->wcid, nsegs, ridx)); + + ring->cur = (ring->cur + 1) % RT2860_TX_RING_COUNT; + ring->queued += ntxds; + if (ring->queued >= RT2860_TX_RING_COUNT) + sc->qfullmsk |= 1 << qid; + + /* kick Tx */ + RAL_WRITE(sc, RT2860_TX_CTX_IDX(qid), ring->cur); + + return 0; +} + +static void +rt2860_start(struct ifnet *ifp) +{ + struct rt2860_softc *sc = ifp->if_softc; + + RAL_LOCK(sc); + rt2860_start_locked(ifp); + RAL_UNLOCK(sc); +} + +static void +rt2860_start_locked(struct ifnet *ifp) +{ + struct rt2860_softc *sc = ifp->if_softc; + struct ieee80211_node *ni; + struct mbuf *m; + + RAL_LOCK_ASSERT(sc); + + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0 || + (ifp->if_drv_flags & IFF_DRV_OACTIVE)) + return; + + for (;;) { + if (SLIST_EMPTY(&sc->data_pool) || sc->qfullmsk != 0) { + ifp->if_drv_flags |= IFF_DRV_OACTIVE; + break; + } + IFQ_DRV_DEQUEUE(&ifp->if_snd, m); + if (m == NULL) + break; + ni = (struct ieee80211_node *)m->m_pkthdr.rcvif; + if (rt2860_tx(sc, m, ni) != 0) { + ieee80211_free_node(ni); + ifp->if_oerrors++; + continue; + } + sc->sc_tx_timer = 5; + } +} + +static void +rt2860_watchdog(void *arg) +{ + struct rt2860_softc *sc = arg; + struct ifnet *ifp = sc->sc_ifp; + + RAL_LOCK_ASSERT(sc); + + KASSERT(ifp->if_drv_flags & IFF_DRV_RUNNING, ("not running")); + + if (sc->sc_invalid) /* card ejected */ + return; + + if (sc->sc_tx_timer > 0 && --sc->sc_tx_timer == 0) { + if_printf(ifp, "device timeout\n"); + rt2860_stop_locked(sc); + rt2860_init_locked(sc); + ifp->if_oerrors++; + return; + } + callout_reset(&sc->watchdog_ch, hz, rt2860_watchdog, sc); +} + +static int +rt2860_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) +{ + struct rt2860_softc *sc = ifp->if_softc; + struct ieee80211com *ic = ifp->if_l2com; + struct ifreq *ifr = (struct ifreq *)data; + int error = 0, startall = 0; + + switch (cmd) { + case SIOCSIFFLAGS: + RAL_LOCK(sc); + if (ifp->if_flags & IFF_UP) { + if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) { + rt2860_init_locked(sc); + startall = 1; + } else + rt2860_update_promisc(ifp); + } else { + if (ifp->if_drv_flags & IFF_DRV_RUNNING) + rt2860_stop_locked(sc); + } + RAL_UNLOCK(sc); + if (startall) + ieee80211_start_all(ic); + break; + case SIOCGIFMEDIA: + error = ifmedia_ioctl(ifp, ifr, &ic->ic_media, cmd); + break; + case SIOCSIFADDR: + error = ether_ioctl(ifp, cmd, data); + break; + default: + error = EINVAL; + break; + } + return error; +} + +/* + * Reading and writing from/to the BBP is different from RT2560 and RT2661. + * We access the BBP through the 8051 microcontroller unit which means that + * the microcode must be loaded first. + */ +void +rt2860_mcu_bbp_write(struct rt2860_softc *sc, uint8_t reg, uint8_t val) +{ + int ntries; + + for (ntries = 0; ntries < 100; ntries++) { + if (!(RAL_READ(sc, RT2860_H2M_BBPAGENT) & RT2860_BBP_CSR_KICK)) + break; + DELAY(1); + } + if (ntries == 100) { + device_printf(sc->sc_dev, + "could not write to BBP through MCU\n"); + return; + } + + RAL_WRITE(sc, RT2860_H2M_BBPAGENT, RT2860_BBP_RW_PARALLEL | + RT2860_BBP_CSR_KICK | reg << 8 | val); + RAL_BARRIER_WRITE(sc); + + rt2860_mcu_cmd(sc, RT2860_MCU_CMD_BBP, 0, 0); + DELAY(1000); +} + +uint8_t +rt2860_mcu_bbp_read(struct rt2860_softc *sc, uint8_t reg) +{ + uint32_t val; + int ntries; + + for (ntries = 0; ntries < 100; ntries++) { + if (!(RAL_READ(sc, RT2860_H2M_BBPAGENT) & RT2860_BBP_CSR_KICK)) + break; + DELAY(1); + } + if (ntries == 100) { + device_printf(sc->sc_dev, + "could not read from BBP through MCU\n"); + return 0; + } + + RAL_WRITE(sc, RT2860_H2M_BBPAGENT, RT2860_BBP_RW_PARALLEL | + RT2860_BBP_CSR_KICK | RT2860_BBP_CSR_READ | reg << 8); + RAL_BARRIER_WRITE(sc); + + rt2860_mcu_cmd(sc, RT2860_MCU_CMD_BBP, 0, 0); + DELAY(1000); + + for (ntries = 0; ntries < 100; ntries++) { + val = RAL_READ(sc, RT2860_H2M_BBPAGENT); + if (!(val & RT2860_BBP_CSR_KICK)) + return val & 0xff; + DELAY(1); + } + device_printf(sc->sc_dev, "could not read from BBP through MCU\n"); + + return 0; +} + +/* + * Write to one of the 4 programmable 24-bit RF registers. + */ +static void +rt2860_rf_write(struct rt2860_softc *sc, uint8_t reg, uint32_t val) +{ + uint32_t tmp; + int ntries; + + for (ntries = 0; ntries < 100; ntries++) { + if (!(RAL_READ(sc, RT2860_RF_CSR_CFG0) & RT2860_RF_REG_CTRL)) + break; + DELAY(1); + } + if (ntries == 100) { + device_printf(sc->sc_dev, "could not write to RF\n"); + return; + } + + /* RF registers are 24-bit on the RT2860 */ + tmp = RT2860_RF_REG_CTRL | 24 << RT2860_RF_REG_WIDTH_SHIFT | + (val & 0x3fffff) << 2 | (reg & 3); + RAL_WRITE(sc, RT2860_RF_CSR_CFG0, tmp); +} + +static uint8_t +rt3090_rf_read(struct rt2860_softc *sc, uint8_t reg) +{ + uint32_t tmp; + int ntries; + + for (ntries = 0; ntries < 100; ntries++) { + if (!(RAL_READ(sc, RT3070_RF_CSR_CFG) & RT3070_RF_KICK)) + break; + DELAY(1); + } + if (ntries == 100) { + device_printf(sc->sc_dev, "could not read RF register\n"); + return 0xff; + } + tmp = RT3070_RF_KICK | reg << 8; + RAL_WRITE(sc, RT3070_RF_CSR_CFG, tmp); + + for (ntries = 0; ntries < 100; ntries++) { + tmp = RAL_READ(sc, RT3070_RF_CSR_CFG); + if (!(tmp & RT3070_RF_KICK)) + break; + DELAY(1); + } + if (ntries == 100) { + device_printf(sc->sc_dev, "could not read RF register\n"); + return 0xff; + } + return tmp & 0xff; +} + +void +rt3090_rf_write(struct rt2860_softc *sc, uint8_t reg, uint8_t val) +{ + uint32_t tmp; + int ntries; + + for (ntries = 0; ntries < 10; ntries++) { + if (!(RAL_READ(sc, RT3070_RF_CSR_CFG) & RT3070_RF_KICK)) + break; + DELAY(10); + } + if (ntries == 10) { + device_printf(sc->sc_dev, "could not write to RF\n"); + return; + } + + tmp = RT3070_RF_WRITE | RT3070_RF_KICK | reg << 8 | val; + RAL_WRITE(sc, RT3070_RF_CSR_CFG, tmp); +} + +/* + * Send a command to the 8051 microcontroller unit. + */ +int +rt2860_mcu_cmd(struct rt2860_softc *sc, uint8_t cmd, uint16_t arg, int wait) +{ + int slot, ntries; + uint32_t tmp; + uint8_t cid; + + for (ntries = 0; ntries < 100; ntries++) { + if (!(RAL_READ(sc, RT2860_H2M_MAILBOX) & RT2860_H2M_BUSY)) + break; + DELAY(2); + } + if (ntries == 100) + return EIO; + + cid = wait ? cmd : RT2860_TOKEN_NO_INTR; + RAL_WRITE(sc, RT2860_H2M_MAILBOX, RT2860_H2M_BUSY | cid << 16 | arg); + RAL_BARRIER_WRITE(sc); + RAL_WRITE(sc, RT2860_HOST_CMD, cmd); + + if (!wait) + return 0; + /* wait for the command to complete */ + for (ntries = 0; ntries < 200; ntries++) { + tmp = RAL_READ(sc, RT2860_H2M_MAILBOX_CID); + /* find the command slot */ + for (slot = 0; slot < 4; slot++, tmp >>= 8) + if ((tmp & 0xff) == cid) + break; + if (slot < 4) + break; + DELAY(100); + } + if (ntries == 200) { + /* clear command and status */ + RAL_WRITE(sc, RT2860_H2M_MAILBOX_STATUS, 0xffffffff); + RAL_WRITE(sc, RT2860_H2M_MAILBOX_CID, 0xffffffff); + return ETIMEDOUT; + } + /* get command status (1 means success) */ + tmp = RAL_READ(sc, RT2860_H2M_MAILBOX_STATUS); + tmp = (tmp >> (slot * 8)) & 0xff; + DPRINTF(("MCU command=0x%02x slot=%d status=0x%02x\n", + cmd, slot, tmp)); + /* clear command and status */ + RAL_WRITE(sc, RT2860_H2M_MAILBOX_STATUS, 0xffffffff); + RAL_WRITE(sc, RT2860_H2M_MAILBOX_CID, 0xffffffff); + return (tmp == 1) ? 0 : EIO; +} + +static void +rt2860_enable_mrr(struct rt2860_softc *sc) +{ +#define CCK(mcs) (mcs) +#define OFDM(mcs) (1 << 3 | (mcs)) + RAL_WRITE(sc, RT2860_LG_FBK_CFG0, + OFDM(6) << 28 | /* 54->48 */ + OFDM(5) << 24 | /* 48->36 */ + OFDM(4) << 20 | /* 36->24 */ + OFDM(3) << 16 | /* 24->18 */ + OFDM(2) << 12 | /* 18->12 */ + OFDM(1) << 8 | /* 12-> 9 */ + OFDM(0) << 4 | /* 9-> 6 */ + OFDM(0)); /* 6-> 6 */ + + RAL_WRITE(sc, RT2860_LG_FBK_CFG1, + CCK(2) << 12 | /* 11->5.5 */ + CCK(1) << 8 | /* 5.5-> 2 */ + CCK(0) << 4 | /* 2-> 1 */ + CCK(0)); /* 1-> 1 */ +#undef OFDM +#undef CCK +} + +static void +rt2860_set_txpreamble(struct rt2860_softc *sc) +{ + struct ifnet *ifp = sc->sc_ifp; + struct ieee80211com *ic = ifp->if_l2com; + uint32_t tmp; + + tmp = RAL_READ(sc, RT2860_AUTO_RSP_CFG); + tmp &= ~RT2860_CCK_SHORT_EN; + if (ic->ic_flags & IEEE80211_F_SHPREAMBLE) + tmp |= RT2860_CCK_SHORT_EN; + RAL_WRITE(sc, RT2860_AUTO_RSP_CFG, tmp); +} + +void +rt2860_set_basicrates(struct rt2860_softc *sc, + const struct ieee80211_rateset *rs) +{ +#define RV(r) ((r) & IEEE80211_RATE_VAL) + struct ifnet *ifp = sc->sc_ifp; + struct ieee80211com *ic = ifp->if_l2com; + uint32_t mask = 0; + uint8_t rate; + int i; + + for (i = 0; i < rs->rs_nrates; i++) { + rate = rs->rs_rates[i]; + + if (!(rate & IEEE80211_RATE_BASIC)) + continue; + + mask |= 1 << ic->ic_rt->rateCodeToIndex[RV(rate)]; + } + + RAL_WRITE(sc, RT2860_LEGACY_BASIC_RATE, mask); +#undef RV +} + +static void +rt2860_scan_start(struct ieee80211com *ic) +{ + struct ifnet *ifp = ic->ic_ifp; + struct rt2860_softc *sc = ifp->if_softc; + uint32_t tmp; + + tmp = RAL_READ(sc, RT2860_BCN_TIME_CFG); + RAL_WRITE(sc, RT2860_BCN_TIME_CFG, + tmp & ~(RT2860_BCN_TX_EN | RT2860_TSF_TIMER_EN | + RT2860_TBTT_TIMER_EN)); + rt2860_set_gp_timer(sc, 0); +} + +static void +rt2860_scan_end(struct ieee80211com *ic) +{ + struct ifnet *ifp = ic->ic_ifp; + struct rt2860_softc *sc = ifp->if_softc; + struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps); + + if (vap->iv_state == IEEE80211_S_RUN) { + rt2860_enable_tsf_sync(sc); + rt2860_set_gp_timer(sc, 500); + } +} + +static void +rt2860_set_channel(struct ieee80211com *ic) +{ + struct ifnet *ifp = ic->ic_ifp; + struct rt2860_softc *sc = ifp->if_softc; + + RAL_LOCK(sc); + rt2860_switch_chan(sc, ic->ic_curchan); + RAL_UNLOCK(sc); +} + +static void +rt2860_select_chan_group(struct rt2860_softc *sc, int group) +{ + uint32_t tmp; + uint8_t agc; + + rt2860_mcu_bbp_write(sc, 62, 0x37 - sc->lna[group]); + rt2860_mcu_bbp_write(sc, 63, 0x37 - sc->lna[group]); + rt2860_mcu_bbp_write(sc, 64, 0x37 - sc->lna[group]); + rt2860_mcu_bbp_write(sc, 86, 0x00); + + if (group == 0) { + if (sc->ext_2ghz_lna) { + rt2860_mcu_bbp_write(sc, 82, 0x62); + rt2860_mcu_bbp_write(sc, 75, 0x46); + } else { + rt2860_mcu_bbp_write(sc, 82, 0x84); + rt2860_mcu_bbp_write(sc, 75, 0x50); + } + } else { + if (sc->ext_5ghz_lna) { + rt2860_mcu_bbp_write(sc, 82, 0xf2); + rt2860_mcu_bbp_write(sc, 75, 0x46); + } else { + rt2860_mcu_bbp_write(sc, 82, 0xf2); + rt2860_mcu_bbp_write(sc, 75, 0x50); + } + } + + tmp = RAL_READ(sc, RT2860_TX_BAND_CFG); + tmp &= ~(RT2860_5G_BAND_SEL_N | RT2860_5G_BAND_SEL_P); + tmp |= (group == 0) ? RT2860_5G_BAND_SEL_N : RT2860_5G_BAND_SEL_P; + RAL_WRITE(sc, RT2860_TX_BAND_CFG, tmp); + + /* enable appropriate Power Amplifiers and Low Noise Amplifiers */ + tmp = RT2860_RFTR_EN | RT2860_TRSW_EN | RT2860_LNA_PE0_EN; + if (sc->nrxchains > 1) + tmp |= RT2860_LNA_PE1_EN; + if (sc->mac_ver == 0x3593 && sc->nrxchains > 2) + tmp |= RT3593_LNA_PE2_EN; + if (group == 0) { /* 2GHz */ + tmp |= RT2860_PA_PE_G0_EN; + if (sc->ntxchains > 1) + tmp |= RT2860_PA_PE_G1_EN; + if (sc->mac_ver == 0x3593 && sc->ntxchains > 2) + tmp |= RT3593_PA_PE_G2_EN; + } else { /* 5GHz */ + tmp |= RT2860_PA_PE_A0_EN; + if (sc->ntxchains > 1) + tmp |= RT2860_PA_PE_A1_EN; + if (sc->mac_ver == 0x3593 && sc->ntxchains > 2) + tmp |= RT3593_PA_PE_A2_EN; + } + RAL_WRITE(sc, RT2860_TX_PIN_CFG, tmp); + + if (sc->mac_ver == 0x3593) { + tmp = RAL_READ(sc, RT2860_GPIO_CTRL); + if (sc->sc_flags & RT2860_PCIE) { + tmp &= ~0x01010000; + if (group == 0) + tmp |= 0x00010000; + } else { + tmp &= ~0x00008080; + if (group == 0) + tmp |= 0x00000080; + } + tmp = (tmp & ~0x00001000) | 0x00000010; + RAL_WRITE(sc, RT2860_GPIO_CTRL, tmp); + } + + /* set initial AGC value */ + if (group == 0) { /* 2GHz band */ + if (sc->mac_ver >= 0x3071) + agc = 0x1c + sc->lna[0] * 2; + else + agc = 0x2e + sc->lna[0]; + } else { /* 5GHz band */ + agc = 0x32 + (sc->lna[group] * 5) / 3; + } + rt2860_mcu_bbp_write(sc, 66, agc); + + DELAY(1000); +} + +static void +rt2860_set_chan(struct rt2860_softc *sc, u_int chan) +{ + const struct rfprog *rfprog = rt2860_rf2850; + uint32_t r2, r3, r4; + int8_t txpow1, txpow2; + u_int i; + + /* find the settings for this channel (we know it exists) */ + for (i = 0; rfprog[i].chan != chan; i++); + + r2 = rfprog[i].r2; + if (sc->ntxchains == 1) + r2 |= 1 << 12; /* 1T: disable Tx chain 2 */ + if (sc->nrxchains == 1) + r2 |= 1 << 15 | 1 << 4; /* 1R: disable Rx chains 2 & 3 */ + else if (sc->nrxchains == 2) + r2 |= 1 << 4; /* 2R: disable Rx chain 3 */ + + /* use Tx power values from EEPROM */ + txpow1 = sc->txpow1[i]; + txpow2 = sc->txpow2[i]; + if (chan > 14) { + if (txpow1 >= 0) + txpow1 = txpow1 << 1 | 1; + else + txpow1 = (7 + txpow1) << 1; + if (txpow2 >= 0) + txpow2 = txpow2 << 1 | 1; + else + txpow2 = (7 + txpow2) << 1; + } + r3 = rfprog[i].r3 | txpow1 << 7; + r4 = rfprog[i].r4 | sc->freq << 13 | txpow2 << 4; + + rt2860_rf_write(sc, RT2860_RF1, rfprog[i].r1); + rt2860_rf_write(sc, RT2860_RF2, r2); + rt2860_rf_write(sc, RT2860_RF3, r3); + rt2860_rf_write(sc, RT2860_RF4, r4); + + DELAY(200); + + rt2860_rf_write(sc, RT2860_RF1, rfprog[i].r1); + rt2860_rf_write(sc, RT2860_RF2, r2); + rt2860_rf_write(sc, RT2860_RF3, r3 | 1); + rt2860_rf_write(sc, RT2860_RF4, r4); + + DELAY(200); + + rt2860_rf_write(sc, RT2860_RF1, rfprog[i].r1); + rt2860_rf_write(sc, RT2860_RF2, r2); + rt2860_rf_write(sc, RT2860_RF3, r3); + rt2860_rf_write(sc, RT2860_RF4, r4); +} + +static void +rt3090_set_chan(struct rt2860_softc *sc, u_int chan) +{ + int8_t txpow1, txpow2; + uint8_t rf; + int i; + + /* RT3090 is 2GHz only */ + KASSERT(chan >= 1 && chan <= 14, ("chan %d not support", chan)); + + /* find the settings for this channel (we know it exists) */ + for (i = 0; rt2860_rf2850[i].chan != chan; i++); + + /* use Tx power values from EEPROM */ + txpow1 = sc->txpow1[i]; + txpow2 = sc->txpow2[i]; + + rt3090_rf_write(sc, 2, rt3090_freqs[i].n); + rf = rt3090_rf_read(sc, 3); + rf = (rf & ~0x0f) | rt3090_freqs[i].k; + rt3090_rf_write(sc, 3, rf); + rf = rt3090_rf_read(sc, 6); + rf = (rf & ~0x03) | rt3090_freqs[i].r; + rt3090_rf_write(sc, 6, rf); + + /* set Tx0 power */ + rf = rt3090_rf_read(sc, 12); + rf = (rf & ~0x1f) | txpow1; + rt3090_rf_write(sc, 12, rf); + + /* set Tx1 power */ + rf = rt3090_rf_read(sc, 13); + rf = (rf & ~0x1f) | txpow2; + rt3090_rf_write(sc, 13, rf); + + rf = rt3090_rf_read(sc, 1); + rf &= ~0xfc; + if (sc->ntxchains == 1) + rf |= RT3070_TX1_PD | RT3070_TX2_PD; + else if (sc->ntxchains == 2) + rf |= RT3070_TX2_PD; + if (sc->nrxchains == 1) + rf |= RT3070_RX1_PD | RT3070_RX2_PD; + else if (sc->nrxchains == 2) + rf |= RT3070_RX2_PD; + rt3090_rf_write(sc, 1, rf); + + /* set RF offset */ + rf = rt3090_rf_read(sc, 23); + rf = (rf & ~0x7f) | sc->freq; + rt3090_rf_write(sc, 23, rf); + + /* program RF filter */ + rf = rt3090_rf_read(sc, 24); /* Tx */ + rf = (rf & ~0x3f) | sc->rf24_20mhz; + rt3090_rf_write(sc, 24, rf); + rf = rt3090_rf_read(sc, 31); /* Rx */ + rf = (rf & ~0x3f) | sc->rf24_20mhz; + rt3090_rf_write(sc, 31, rf); + + /* enable RF tuning */ + rf = rt3090_rf_read(sc, 7); + rt3090_rf_write(sc, 7, rf | RT3070_TUNE); +} + +static int +rt3090_rf_init(struct rt2860_softc *sc) +{ +#define N(a) (sizeof (a) / sizeof ((a)[0])) + uint32_t tmp; + uint8_t rf, bbp; + int i; + + rf = rt3090_rf_read(sc, 30); + /* toggle RF R30 bit 7 */ + rt3090_rf_write(sc, 30, rf | 0x80); + DELAY(1000); + rt3090_rf_write(sc, 30, rf & ~0x80); + + tmp = RAL_READ(sc, RT3070_LDO_CFG0); + tmp &= ~0x1f000000; + if (sc->patch_dac && sc->mac_rev < 0x0211) + tmp |= 0x0d000000; /* 1.35V */ + else + tmp |= 0x01000000; /* 1.2V */ + RAL_WRITE(sc, RT3070_LDO_CFG0, tmp); + + /* patch LNA_PE_G1 */ + tmp = RAL_READ(sc, RT3070_GPIO_SWITCH); + RAL_WRITE(sc, RT3070_GPIO_SWITCH, tmp & ~0x20); + + /* initialize RF registers to default value */ + for (i = 0; i < N(rt3090_def_rf); i++) { + rt3090_rf_write(sc, rt3090_def_rf[i].reg, + rt3090_def_rf[i].val); + } + + /* select 20MHz bandwidth */ + rt3090_rf_write(sc, 31, 0x14); + + rf = rt3090_rf_read(sc, 6); + rt3090_rf_write(sc, 6, rf | 0x40); + + if (sc->mac_ver != 0x3593) { + /* calibrate filter for 20MHz bandwidth */ + sc->rf24_20mhz = 0x1f; /* default value */ + rt3090_filter_calib(sc, 0x07, 0x16, &sc->rf24_20mhz); + + /* select 40MHz bandwidth */ + bbp = rt2860_mcu_bbp_read(sc, 4); + rt2860_mcu_bbp_write(sc, 4, (bbp & ~0x08) | 0x10); + rf = rt3090_rf_read(sc, 31); + rt3090_rf_write(sc, 31, rf | 0x20); + + /* calibrate filter for 40MHz bandwidth */ + sc->rf24_40mhz = 0x2f; /* default value */ + rt3090_filter_calib(sc, 0x27, 0x19, &sc->rf24_40mhz); + + /* go back to 20MHz bandwidth */ + bbp = rt2860_mcu_bbp_read(sc, 4); + rt2860_mcu_bbp_write(sc, 4, bbp & ~0x18); + } + if (sc->mac_rev < 0x0211) + rt3090_rf_write(sc, 27, 0x03); + + tmp = RAL_READ(sc, RT3070_OPT_14); + RAL_WRITE(sc, RT3070_OPT_14, tmp | 1); + + if (sc->rf_rev == RT3070_RF_3020) + rt3090_set_rx_antenna(sc, 0); + + bbp = rt2860_mcu_bbp_read(sc, 138); + if (sc->mac_ver == 0x3593) { + if (sc->ntxchains == 1) + bbp |= 0x60; /* turn off DAC1 and DAC2 */ + else if (sc->ntxchains == 2) + bbp |= 0x40; /* turn off DAC2 */ + if (sc->nrxchains == 1) + bbp &= ~0x06; /* turn off ADC1 and ADC2 */ + else if (sc->nrxchains == 2) + bbp &= ~0x04; /* turn off ADC2 */ + } else { + if (sc->ntxchains == 1) + bbp |= 0x20; /* turn off DAC1 */ + if (sc->nrxchains == 1) + bbp &= ~0x02; /* turn off ADC1 */ + } + rt2860_mcu_bbp_write(sc, 138, bbp); + + rf = rt3090_rf_read(sc, 1); + rf &= ~(RT3070_RX0_PD | RT3070_TX0_PD); + rf |= RT3070_RF_BLOCK | RT3070_RX1_PD | RT3070_TX1_PD; + rt3090_rf_write(sc, 1, rf); + + rf = rt3090_rf_read(sc, 15); + rt3090_rf_write(sc, 15, rf & ~RT3070_TX_LO2); + + rf = rt3090_rf_read(sc, 17); + rf &= ~RT3070_TX_LO1; + if (sc->mac_rev >= 0x0211 && !sc->ext_2ghz_lna) + rf |= 0x20; /* fix for long range Rx issue */ + if (sc->txmixgain_2ghz >= 2) + rf = (rf & ~0x7) | sc->txmixgain_2ghz; + rt3090_rf_write(sc, 17, rf); + + rf = rt3090_rf_read(sc, 20); + rt3090_rf_write(sc, 20, rf & ~RT3070_RX_LO1); + + rf = rt3090_rf_read(sc, 21); + rt3090_rf_write(sc, 21, rf & ~RT3070_RX_LO2); + + return 0; +#undef N +} + +void +rt3090_rf_wakeup(struct rt2860_softc *sc) +{ + uint32_t tmp; + uint8_t rf; + + if (sc->mac_ver == 0x3593) { + /* enable VCO */ + rf = rt3090_rf_read(sc, 1); + rt3090_rf_write(sc, 1, rf | RT3593_VCO); + + /* initiate VCO calibration */ + rf = rt3090_rf_read(sc, 3); + rt3090_rf_write(sc, 3, rf | RT3593_VCOCAL); + + /* enable VCO bias current control */ + rf = rt3090_rf_read(sc, 6); + rt3090_rf_write(sc, 6, rf | RT3593_VCO_IC); + + /* initiate res calibration */ + rf = rt3090_rf_read(sc, 2); + rt3090_rf_write(sc, 2, rf | RT3593_RESCAL); + + /* set reference current control to 0.33 mA */ + rf = rt3090_rf_read(sc, 22); + rf &= ~RT3593_CP_IC_MASK; + rf |= 1 << RT3593_CP_IC_SHIFT; + rt3090_rf_write(sc, 22, rf); + + /* enable RX CTB */ + rf = rt3090_rf_read(sc, 46); + rt3090_rf_write(sc, 46, rf | RT3593_RX_CTB); + + rf = rt3090_rf_read(sc, 20); + rf &= ~(RT3593_LDO_RF_VC_MASK | RT3593_LDO_PLL_VC_MASK); + rt3090_rf_write(sc, 20, rf); + } else { + /* enable RF block */ + rf = rt3090_rf_read(sc, 1); + rt3090_rf_write(sc, 1, rf | RT3070_RF_BLOCK); + + /* enable VCO bias current control */ + rf = rt3090_rf_read(sc, 7); + rt3090_rf_write(sc, 7, rf | 0x30); + + rf = rt3090_rf_read(sc, 9); + rt3090_rf_write(sc, 9, rf | 0x0e); + + /* enable RX CTB */ + rf = rt3090_rf_read(sc, 21); + rt3090_rf_write(sc, 21, rf | RT3070_RX_CTB); + + /* fix Tx to Rx IQ glitch by raising RF voltage */ + rf = rt3090_rf_read(sc, 27); + rf &= ~0x77; + if (sc->mac_rev < 0x0211) + rf |= 0x03; + rt3090_rf_write(sc, 27, rf); + } + if (sc->patch_dac && sc->mac_rev < 0x0211) { + tmp = RAL_READ(sc, RT3070_LDO_CFG0); + tmp = (tmp & ~0x1f000000) | 0x0d000000; + RAL_WRITE(sc, RT3070_LDO_CFG0, tmp); + } +} + +int +rt3090_filter_calib(struct rt2860_softc *sc, uint8_t init, uint8_t target, + uint8_t *val) +{ + uint8_t rf22, rf24; + uint8_t bbp55_pb, bbp55_sb, delta; + int ntries; + + /* program filter */ + rf24 = rt3090_rf_read(sc, 24); + rf24 = (rf24 & 0xc0) | init; /* initial filter value */ + rt3090_rf_write(sc, 24, rf24); + + /* enable baseband loopback mode */ + rf22 = rt3090_rf_read(sc, 22); + rt3090_rf_write(sc, 22, rf22 | RT3070_BB_LOOPBACK); + + /* set power and frequency of passband test tone */ + rt2860_mcu_bbp_write(sc, 24, 0x00); + for (ntries = 0; ntries < 100; ntries++) { + /* transmit test tone */ + rt2860_mcu_bbp_write(sc, 25, 0x90); + DELAY(1000); + /* read received power */ + bbp55_pb = rt2860_mcu_bbp_read(sc, 55); + if (bbp55_pb != 0) + break; + } + if (ntries == 100) + return ETIMEDOUT; + + /* set power and frequency of stopband test tone */ + rt2860_mcu_bbp_write(sc, 24, 0x06); + for (ntries = 0; ntries < 100; ntries++) { + /* transmit test tone */ + rt2860_mcu_bbp_write(sc, 25, 0x90); + DELAY(1000); + /* read received power */ + bbp55_sb = rt2860_mcu_bbp_read(sc, 55); + + delta = bbp55_pb - bbp55_sb; + if (delta > target) + break; + + /* reprogram filter */ + rf24++; + rt3090_rf_write(sc, 24, rf24); + } + if (ntries < 100) { + if (rf24 != init) + rf24--; /* backtrack */ + *val = rf24; + rt3090_rf_write(sc, 24, rf24); + } + + /* restore initial state */ + rt2860_mcu_bbp_write(sc, 24, 0x00); + + /* disable baseband loopback mode */ + rf22 = rt3090_rf_read(sc, 22); + rt3090_rf_write(sc, 22, rf22 & ~RT3070_BB_LOOPBACK); + + return 0; +} + +static void +rt3090_rf_setup(struct rt2860_softc *sc) +{ + uint8_t bbp; + int i; + + if (sc->mac_rev >= 0x0211) { + /* enable DC filter */ + rt2860_mcu_bbp_write(sc, 103, 0xc0); + + /* improve power consumption */ + bbp = rt2860_mcu_bbp_read(sc, 31); + rt2860_mcu_bbp_write(sc, 31, bbp & ~0x03); + } + + RAL_WRITE(sc, RT2860_TX_SW_CFG1, 0); + if (sc->mac_rev < 0x0211) { + RAL_WRITE(sc, RT2860_TX_SW_CFG2, + sc->patch_dac ? 0x2c : 0x0f); + } else + RAL_WRITE(sc, RT2860_TX_SW_CFG2, 0); + + /* initialize RF registers from ROM */ + for (i = 0; i < 10; i++) { + if (sc->rf[i].reg == 0 || sc->rf[i].reg == 0xff) + continue; + rt3090_rf_write(sc, sc->rf[i].reg, sc->rf[i].val); + } +} + +static void +rt2860_set_leds(struct rt2860_softc *sc, uint16_t which) +{ + rt2860_mcu_cmd(sc, RT2860_MCU_CMD_LEDS, + which | (sc->leds & 0x7f), 0); +} + +/* + * Hardware has a general-purpose programmable timer interrupt that can + * periodically raise MAC_INT_4. + */ +static void +rt2860_set_gp_timer(struct rt2860_softc *sc, int ms) +{ + uint32_t tmp; + + /* disable GP timer before reprogramming it */ + tmp = RAL_READ(sc, RT2860_INT_TIMER_EN); + RAL_WRITE(sc, RT2860_INT_TIMER_EN, tmp & ~RT2860_GP_TIMER_EN); + + if (ms == 0) + return; + + tmp = RAL_READ(sc, RT2860_INT_TIMER_CFG); + ms *= 16; /* Unit: 64us */ + tmp = (tmp & 0xffff) | ms << RT2860_GP_TIMER_SHIFT; + RAL_WRITE(sc, RT2860_INT_TIMER_CFG, tmp); + + /* enable GP timer */ + tmp = RAL_READ(sc, RT2860_INT_TIMER_EN); + RAL_WRITE(sc, RT2860_INT_TIMER_EN, tmp | RT2860_GP_TIMER_EN); +} + +static void +rt2860_set_bssid(struct rt2860_softc *sc, const uint8_t *bssid) +{ + RAL_WRITE(sc, RT2860_MAC_BSSID_DW0, + bssid[0] | bssid[1] << 8 | bssid[2] << 16 | bssid[3] << 24); + RAL_WRITE(sc, RT2860_MAC_BSSID_DW1, + bssid[4] | bssid[5] << 8); +} + +static void +rt2860_set_macaddr(struct rt2860_softc *sc, const uint8_t *addr) +{ + RAL_WRITE(sc, RT2860_MAC_ADDR_DW0, + addr[0] | addr[1] << 8 | addr[2] << 16 | addr[3] << 24); + RAL_WRITE(sc, RT2860_MAC_ADDR_DW1, + addr[4] | addr[5] << 8 | 0xff << 16); +} + +static void +rt2860_updateslot(struct ifnet *ifp) +{ + struct rt2860_softc *sc = ifp->if_softc; + struct ieee80211com *ic = ifp->if_l2com; + uint32_t tmp; + + tmp = RAL_READ(sc, RT2860_BKOFF_SLOT_CFG); + tmp &= ~0xff; + tmp |= (ic->ic_flags & IEEE80211_F_SHSLOT) ? 9 : 20; + RAL_WRITE(sc, RT2860_BKOFF_SLOT_CFG, tmp); +} + +static void +rt2860_updateprot(struct ifnet *ifp) +{ + struct rt2860_softc *sc = ifp->if_softc; + struct ieee80211com *ic = ifp->if_l2com; + uint32_t tmp; + + tmp = RT2860_RTSTH_EN | RT2860_PROT_NAV_SHORT | RT2860_TXOP_ALLOW_ALL; + /* setup protection frame rate (MCS code) */ + tmp |= IEEE80211_IS_CHAN_5GHZ(ic->ic_curchan) ? + rt2860_rates[RT2860_RIDX_OFDM6].mcs : + rt2860_rates[RT2860_RIDX_CCK11].mcs; + + /* CCK frames don't require protection */ + RAL_WRITE(sc, RT2860_CCK_PROT_CFG, tmp); + + if (ic->ic_flags & IEEE80211_F_USEPROT) { + if (ic->ic_protmode == IEEE80211_PROT_RTSCTS) + tmp |= RT2860_PROT_CTRL_RTS_CTS; + else if (ic->ic_protmode == IEEE80211_PROT_CTSONLY) + tmp |= RT2860_PROT_CTRL_CTS; + } + RAL_WRITE(sc, RT2860_OFDM_PROT_CFG, tmp); +} + +static void +rt2860_update_promisc(struct ifnet *ifp) +{ + struct rt2860_softc *sc = ifp->if_softc; + uint32_t tmp; + + tmp = RAL_READ(sc, RT2860_RX_FILTR_CFG); + tmp &= ~RT2860_DROP_NOT_MYBSS; + if (!(ifp->if_flags & IFF_PROMISC)) + tmp |= RT2860_DROP_NOT_MYBSS; + RAL_WRITE(sc, RT2860_RX_FILTR_CFG, tmp); +} + +static int +rt2860_updateedca(struct ieee80211com *ic) +{ + struct rt2860_softc *sc = ic->ic_ifp->if_softc; + const struct wmeParams *wmep; + int aci; + + wmep = ic->ic_wme.wme_chanParams.cap_wmeParams; + + /* update MAC TX configuration registers */ + for (aci = 0; aci < WME_NUM_AC; aci++) { + RAL_WRITE(sc, RT2860_EDCA_AC_CFG(aci), + wmep[aci].wmep_logcwmax << 16 | + wmep[aci].wmep_logcwmin << 12 | + wmep[aci].wmep_aifsn << 8 | + wmep[aci].wmep_txopLimit); + } + + /* update SCH/DMA registers too */ + RAL_WRITE(sc, RT2860_WMM_AIFSN_CFG, + wmep[WME_AC_VO].wmep_aifsn << 12 | + wmep[WME_AC_VI].wmep_aifsn << 8 | + wmep[WME_AC_BK].wmep_aifsn << 4 | + wmep[WME_AC_BE].wmep_aifsn); + RAL_WRITE(sc, RT2860_WMM_CWMIN_CFG, + wmep[WME_AC_VO].wmep_logcwmin << 12 | + wmep[WME_AC_VI].wmep_logcwmin << 8 | + wmep[WME_AC_BK].wmep_logcwmin << 4 | + wmep[WME_AC_BE].wmep_logcwmin); + RAL_WRITE(sc, RT2860_WMM_CWMAX_CFG, + wmep[WME_AC_VO].wmep_logcwmax << 12 | + wmep[WME_AC_VI].wmep_logcwmax << 8 | + wmep[WME_AC_BK].wmep_logcwmax << 4 | + wmep[WME_AC_BE].wmep_logcwmax); + RAL_WRITE(sc, RT2860_WMM_TXOP0_CFG, + wmep[WME_AC_BK].wmep_txopLimit << 16 | + wmep[WME_AC_BE].wmep_txopLimit); + RAL_WRITE(sc, RT2860_WMM_TXOP1_CFG, + wmep[WME_AC_VO].wmep_txopLimit << 16 | + wmep[WME_AC_VI].wmep_txopLimit); + + return 0; +} + +#ifdef HW_CRYPTO +static int +rt2860_set_key(struct ieee80211com *ic, struct ieee80211_node *ni, + struct ieee80211_key *k) +{ + struct rt2860_softc *sc = ic->ic_softc; + bus_size_t base; + uint32_t attr; + uint8_t mode, wcid, iv[8]; + + /* defer setting of WEP keys until interface is brought up */ + if ((ic->ic_if.if_flags & (IFF_UP | IFF_RUNNING)) != + (IFF_UP | IFF_RUNNING)) + return 0; + + /* map net80211 cipher to RT2860 security mode */ + switch (k->k_cipher) { + case IEEE80211_CIPHER_WEP40: + mode = RT2860_MODE_WEP40; + break; + case IEEE80211_CIPHER_WEP104: + mode = RT2860_MODE_WEP104; + break; + case IEEE80211_CIPHER_TKIP: + mode = RT2860_MODE_TKIP; + break; + case IEEE80211_CIPHER_CCMP: + mode = RT2860_MODE_AES_CCMP; + break; + default: + return EINVAL; + } + + if (k->k_flags & IEEE80211_KEY_GROUP) { + wcid = 0; /* NB: update WCID0 for group keys */ + base = RT2860_SKEY(0, k->k_id); + } else { + wcid = ((struct rt2860_node *)ni)->wcid; + base = RT2860_PKEY(wcid); + } + + if (k->k_cipher == IEEE80211_CIPHER_TKIP) { + RAL_WRITE_REGION_1(sc, base, k->k_key, 16); +#ifndef IEEE80211_STA_ONLY + if (ic->ic_opmode == IEEE80211_M_HOSTAP) { + RAL_WRITE_REGION_1(sc, base + 16, &k->k_key[16], 8); + RAL_WRITE_REGION_1(sc, base + 24, &k->k_key[24], 8); + } else +#endif + { + RAL_WRITE_REGION_1(sc, base + 16, &k->k_key[24], 8); + RAL_WRITE_REGION_1(sc, base + 24, &k->k_key[16], 8); + } + } else + RAL_WRITE_REGION_1(sc, base, k->k_key, k->k_len); + + if (!(k->k_flags & IEEE80211_KEY_GROUP) || + (k->k_flags & IEEE80211_KEY_TX)) { + /* set initial packet number in IV+EIV */ + if (k->k_cipher == IEEE80211_CIPHER_WEP40 || + k->k_cipher == IEEE80211_CIPHER_WEP104) { + uint32_t val = arc4random(); + /* skip weak IVs from Fluhrer/Mantin/Shamir */ + if (val >= 0x03ff00 && (val & 0xf8ff00) == 0x00ff00) + val += 0x000100; + iv[0] = val; + iv[1] = val >> 8; + iv[2] = val >> 16; + iv[3] = k->k_id << 6; + iv[4] = iv[5] = iv[6] = iv[7] = 0; + } else { + if (k->k_cipher == IEEE80211_CIPHER_TKIP) { + iv[0] = k->k_tsc >> 8; + iv[1] = (iv[0] | 0x20) & 0x7f; + iv[2] = k->k_tsc; + } else /* CCMP */ { + iv[0] = k->k_tsc; + iv[1] = k->k_tsc >> 8; + iv[2] = 0; + } + iv[3] = k->k_id << 6 | IEEE80211_WEP_EXTIV; + iv[4] = k->k_tsc >> 16; + iv[5] = k->k_tsc >> 24; + iv[6] = k->k_tsc >> 32; + iv[7] = k->k_tsc >> 40; + } + RAL_WRITE_REGION_1(sc, RT2860_IVEIV(wcid), iv, 8); + } + + if (k->k_flags & IEEE80211_KEY_GROUP) { + /* install group key */ + attr = RAL_READ(sc, RT2860_SKEY_MODE_0_7); + attr &= ~(0xf << (k->k_id * 4)); + attr |= mode << (k->k_id * 4); + RAL_WRITE(sc, RT2860_SKEY_MODE_0_7, attr); + } else { + /* install pairwise key */ + attr = RAL_READ(sc, RT2860_WCID_ATTR(wcid)); + attr = (attr & ~0xf) | (mode << 1) | RT2860_RX_PKEY_EN; + RAL_WRITE(sc, RT2860_WCID_ATTR(wcid), attr); + } + return 0; +} + +static void +rt2860_delete_key(struct ieee80211com *ic, struct ieee80211_node *ni, + struct ieee80211_key *k) +{ + struct rt2860_softc *sc = ic->ic_softc; + uint32_t attr; + uint8_t wcid; + + if (k->k_flags & IEEE80211_KEY_GROUP) { + /* remove group key */ + attr = RAL_READ(sc, RT2860_SKEY_MODE_0_7); + attr &= ~(0xf << (k->k_id * 4)); + RAL_WRITE(sc, RT2860_SKEY_MODE_0_7, attr); + + } else { + /* remove pairwise key */ + wcid = ((struct rt2860_node *)ni)->wcid; + attr = RAL_READ(sc, RT2860_WCID_ATTR(wcid)); + attr &= ~0xf; + RAL_WRITE(sc, RT2860_WCID_ATTR(wcid), attr); + } +} +#endif + +static int8_t +rt2860_rssi2dbm(struct rt2860_softc *sc, uint8_t rssi, uint8_t rxchain) +{ + struct ifnet *ifp = sc->sc_ifp; + struct ieee80211com *ic = ifp->if_l2com; + struct ieee80211_channel *c = ic->ic_curchan; + int delta; + + if (IEEE80211_IS_CHAN_5GHZ(c)) { + u_int chan = ieee80211_chan2ieee(ic, c); + delta = sc->rssi_5ghz[rxchain]; + + /* determine channel group */ + if (chan <= 64) + delta -= sc->lna[1]; + else if (chan <= 128) + delta -= sc->lna[2]; + else + delta -= sc->lna[3]; + } else + delta = sc->rssi_2ghz[rxchain] - sc->lna[0]; + + return -12 - delta - rssi; +} + +/* + * Add `delta' (signed) to each 4-bit sub-word of a 32-bit word. + * Used to adjust per-rate Tx power registers. + */ +static __inline uint32_t +b4inc(uint32_t b32, int8_t delta) +{ + int8_t i, b4; + + for (i = 0; i < 8; i++) { + b4 = b32 & 0xf; + b4 += delta; + if (b4 < 0) + b4 = 0; + else if (b4 > 0xf) + b4 = 0xf; + b32 = b32 >> 4 | b4 << 28; + } + return b32; +} + +static const char * +rt2860_get_rf(uint8_t rev) +{ + switch (rev) { + case RT2860_RF_2820: return "RT2820"; + case RT2860_RF_2850: return "RT2850"; + case RT2860_RF_2720: return "RT2720"; + case RT2860_RF_2750: return "RT2750"; + case RT3070_RF_3020: return "RT3020"; + case RT3070_RF_2020: return "RT2020"; + case RT3070_RF_3021: return "RT3021"; + case RT3070_RF_3022: return "RT3022"; + case RT3070_RF_3052: return "RT3052"; + case RT3070_RF_3320: return "RT3320"; + case RT3070_RF_3053: return "RT3053"; + default: return "unknown"; + } +} + +static int +rt2860_read_eeprom(struct rt2860_softc *sc, uint8_t macaddr[IEEE80211_ADDR_LEN]) +{ + int8_t delta_2ghz, delta_5ghz; + uint32_t tmp; + uint16_t val; + int ridx, ant, i; + + /* check whether the ROM is eFUSE ROM or EEPROM */ + sc->sc_srom_read = rt2860_eeprom_read_2; + if (sc->mac_ver >= 0x3071) { + tmp = RAL_READ(sc, RT3070_EFUSE_CTRL); + DPRINTF(("EFUSE_CTRL=0x%08x\n", tmp)); + if (tmp & RT3070_SEL_EFUSE) + sc->sc_srom_read = rt3090_efuse_read_2; + } + + /* read EEPROM version */ + val = rt2860_srom_read(sc, RT2860_EEPROM_VERSION); + DPRINTF(("EEPROM rev=%d, FAE=%d\n", val & 0xff, val >> 8)); + + /* read MAC address */ + val = rt2860_srom_read(sc, RT2860_EEPROM_MAC01); + macaddr[0] = val & 0xff; + macaddr[1] = val >> 8; + val = rt2860_srom_read(sc, RT2860_EEPROM_MAC23); + macaddr[2] = val & 0xff; + macaddr[3] = val >> 8; + val = rt2860_srom_read(sc, RT2860_EEPROM_MAC45); + macaddr[4] = val & 0xff; + macaddr[5] = val >> 8; + + /* read country code */ + val = rt2860_srom_read(sc, RT2860_EEPROM_COUNTRY); + DPRINTF(("EEPROM region code=0x%04x\n", val)); + + /* read vendor BBP settings */ + for (i = 0; i < 8; i++) { + val = rt2860_srom_read(sc, RT2860_EEPROM_BBP_BASE + i); + sc->bbp[i].val = val & 0xff; + sc->bbp[i].reg = val >> 8; + DPRINTF(("BBP%d=0x%02x\n", sc->bbp[i].reg, sc->bbp[i].val)); + } + if (sc->mac_ver >= 0x3071) { + /* read vendor RF settings */ + for (i = 0; i < 10; i++) { + val = rt2860_srom_read(sc, RT3071_EEPROM_RF_BASE + i); + sc->rf[i].val = val & 0xff; + sc->rf[i].reg = val >> 8; + DPRINTF(("RF%d=0x%02x\n", sc->rf[i].reg, + sc->rf[i].val)); + } + } + + /* read RF frequency offset from EEPROM */ + val = rt2860_srom_read(sc, RT2860_EEPROM_FREQ_LEDS); + sc->freq = ((val & 0xff) != 0xff) ? val & 0xff : 0; + DPRINTF(("EEPROM freq offset %d\n", sc->freq & 0xff)); + if ((val >> 8) != 0xff) { + /* read LEDs operating mode */ + sc->leds = val >> 8; + sc->led[0] = rt2860_srom_read(sc, RT2860_EEPROM_LED1); + sc->led[1] = rt2860_srom_read(sc, RT2860_EEPROM_LED2); + sc->led[2] = rt2860_srom_read(sc, RT2860_EEPROM_LED3); + } else { + /* broken EEPROM, use default settings */ + sc->leds = 0x01; + sc->led[0] = 0x5555; + sc->led[1] = 0x2221; + sc->led[2] = 0xa9f8; + } + DPRINTF(("EEPROM LED mode=0x%02x, LEDs=0x%04x/0x%04x/0x%04x\n", + sc->leds, sc->led[0], sc->led[1], sc->led[2])); + + /* read RF information */ + val = rt2860_srom_read(sc, RT2860_EEPROM_ANTENNA); + if (val == 0xffff) { + DPRINTF(("invalid EEPROM antenna info, using default\n")); + if (sc->mac_ver == 0x3593) { + /* default to RF3053 3T3R */ + sc->rf_rev = RT3070_RF_3053; + sc->ntxchains = 3; + sc->nrxchains = 3; + } else if (sc->mac_ver >= 0x3071) { + /* default to RF3020 1T1R */ + sc->rf_rev = RT3070_RF_3020; + sc->ntxchains = 1; + sc->nrxchains = 1; + } else { + /* default to RF2820 1T2R */ + sc->rf_rev = RT2860_RF_2820; + sc->ntxchains = 1; + sc->nrxchains = 2; + } + } else { + sc->rf_rev = (val >> 8) & 0xf; + sc->ntxchains = (val >> 4) & 0xf; + sc->nrxchains = val & 0xf; + } + DPRINTF(("EEPROM RF rev=0x%02x chains=%dT%dR\n", + sc->rf_rev, sc->ntxchains, sc->nrxchains)); + + /* check if RF supports automatic Tx access gain control */ + val = rt2860_srom_read(sc, RT2860_EEPROM_CONFIG); + DPRINTF(("EEPROM CFG 0x%04x\n", val)); + /* check if driver should patch the DAC issue */ + if ((val >> 8) != 0xff) + sc->patch_dac = (val >> 15) & 1; + if ((val & 0xff) != 0xff) { + sc->ext_5ghz_lna = (val >> 3) & 1; + sc->ext_2ghz_lna = (val >> 2) & 1; + /* check if RF supports automatic Tx access gain control */ + sc->calib_2ghz = sc->calib_5ghz = 0; /* XXX (val >> 1) & 1 */; + /* check if we have a hardware radio switch */ + sc->rfswitch = val & 1; + } + if (sc->sc_flags & RT2860_ADVANCED_PS) { + /* read PCIe power save level */ + val = rt2860_srom_read(sc, RT2860_EEPROM_PCIE_PSLEVEL); + if ((val & 0xff) != 0xff) { + sc->pslevel = val & 0x3; + val = rt2860_srom_read(sc, RT2860_EEPROM_REV); + if ((val & 0xff80) != 0x9280) + sc->pslevel = MIN(sc->pslevel, 1); + DPRINTF(("EEPROM PCIe PS Level=%d\n", sc->pslevel)); + } + } + + /* read power settings for 2GHz channels */ + for (i = 0; i < 14; i += 2) { + val = rt2860_srom_read(sc, + RT2860_EEPROM_PWR2GHZ_BASE1 + i / 2); + sc->txpow1[i + 0] = (int8_t)(val & 0xff); + sc->txpow1[i + 1] = (int8_t)(val >> 8); + + val = rt2860_srom_read(sc, + RT2860_EEPROM_PWR2GHZ_BASE2 + i / 2); + sc->txpow2[i + 0] = (int8_t)(val & 0xff); + sc->txpow2[i + 1] = (int8_t)(val >> 8); + } + /* fix broken Tx power entries */ + for (i = 0; i < 14; i++) { + if (sc->txpow1[i] < 0 || sc->txpow1[i] > 31) + sc->txpow1[i] = 5; + if (sc->txpow2[i] < 0 || sc->txpow2[i] > 31) + sc->txpow2[i] = 5; + DPRINTF(("chan %d: power1=%d, power2=%d\n", + rt2860_rf2850[i].chan, sc->txpow1[i], sc->txpow2[i])); + } + /* read power settings for 5GHz channels */ + for (i = 0; i < 40; i += 2) { + val = rt2860_srom_read(sc, + RT2860_EEPROM_PWR5GHZ_BASE1 + i / 2); + sc->txpow1[i + 14] = (int8_t)(val & 0xff); + sc->txpow1[i + 15] = (int8_t)(val >> 8); + + val = rt2860_srom_read(sc, + RT2860_EEPROM_PWR5GHZ_BASE2 + i / 2); + sc->txpow2[i + 14] = (int8_t)(val & 0xff); + sc->txpow2[i + 15] = (int8_t)(val >> 8); + } + /* fix broken Tx power entries */ + for (i = 0; i < 40; i++) { + if (sc->txpow1[14 + i] < -7 || sc->txpow1[14 + i] > 15) + sc->txpow1[14 + i] = 5; + if (sc->txpow2[14 + i] < -7 || sc->txpow2[14 + i] > 15) + sc->txpow2[14 + i] = 5; + DPRINTF(("chan %d: power1=%d, power2=%d\n", + rt2860_rf2850[14 + i].chan, sc->txpow1[14 + i], + sc->txpow2[14 + i])); + } + + /* read Tx power compensation for each Tx rate */ + val = rt2860_srom_read(sc, RT2860_EEPROM_DELTAPWR); + delta_2ghz = delta_5ghz = 0; + if ((val & 0xff) != 0xff && (val & 0x80)) { + delta_2ghz = val & 0xf; + if (!(val & 0x40)) /* negative number */ + delta_2ghz = -delta_2ghz; + } + val >>= 8; + if ((val & 0xff) != 0xff && (val & 0x80)) { + delta_5ghz = val & 0xf; + if (!(val & 0x40)) /* negative number */ + delta_5ghz = -delta_5ghz; + } + DPRINTF(("power compensation=%d (2GHz), %d (5GHz)\n", + delta_2ghz, delta_5ghz)); + + for (ridx = 0; ridx < 5; ridx++) { + uint32_t reg; + + val = rt2860_srom_read(sc, RT2860_EEPROM_RPWR + ridx * 2); + reg = val; + val = rt2860_srom_read(sc, RT2860_EEPROM_RPWR + ridx * 2 + 1); + reg |= (uint32_t)val << 16; + + sc->txpow20mhz[ridx] = reg; + sc->txpow40mhz_2ghz[ridx] = b4inc(reg, delta_2ghz); + sc->txpow40mhz_5ghz[ridx] = b4inc(reg, delta_5ghz); + + DPRINTF(("ridx %d: power 20MHz=0x%08x, 40MHz/2GHz=0x%08x, " + "40MHz/5GHz=0x%08x\n", ridx, sc->txpow20mhz[ridx], + sc->txpow40mhz_2ghz[ridx], sc->txpow40mhz_5ghz[ridx])); + } + + /* read factory-calibrated samples for temperature compensation */ + val = rt2860_srom_read(sc, RT2860_EEPROM_TSSI1_2GHZ); + sc->tssi_2ghz[0] = val & 0xff; /* [-4] */ + sc->tssi_2ghz[1] = val >> 8; /* [-3] */ + val = rt2860_srom_read(sc, RT2860_EEPROM_TSSI2_2GHZ); + sc->tssi_2ghz[2] = val & 0xff; /* [-2] */ + sc->tssi_2ghz[3] = val >> 8; /* [-1] */ + val = rt2860_srom_read(sc, RT2860_EEPROM_TSSI3_2GHZ); + sc->tssi_2ghz[4] = val & 0xff; /* [+0] */ + sc->tssi_2ghz[5] = val >> 8; /* [+1] */ + val = rt2860_srom_read(sc, RT2860_EEPROM_TSSI4_2GHZ); + sc->tssi_2ghz[6] = val & 0xff; /* [+2] */ + sc->tssi_2ghz[7] = val >> 8; /* [+3] */ + val = rt2860_srom_read(sc, RT2860_EEPROM_TSSI5_2GHZ); + sc->tssi_2ghz[8] = val & 0xff; /* [+4] */ + sc->step_2ghz = val >> 8; + DPRINTF(("TSSI 2GHz: 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x " + "0x%02x 0x%02x step=%d\n", sc->tssi_2ghz[0], sc->tssi_2ghz[1], + sc->tssi_2ghz[2], sc->tssi_2ghz[3], sc->tssi_2ghz[4], + sc->tssi_2ghz[5], sc->tssi_2ghz[6], sc->tssi_2ghz[7], + sc->tssi_2ghz[8], sc->step_2ghz)); + /* check that ref value is correct, otherwise disable calibration */ + if (sc->tssi_2ghz[4] == 0xff) + sc->calib_2ghz = 0; + + val = rt2860_srom_read(sc, RT2860_EEPROM_TSSI1_5GHZ); + sc->tssi_5ghz[0] = val & 0xff; /* [-4] */ + sc->tssi_5ghz[1] = val >> 8; /* [-3] */ + val = rt2860_srom_read(sc, RT2860_EEPROM_TSSI2_5GHZ); + sc->tssi_5ghz[2] = val & 0xff; /* [-2] */ + sc->tssi_5ghz[3] = val >> 8; /* [-1] */ + val = rt2860_srom_read(sc, RT2860_EEPROM_TSSI3_5GHZ); + sc->tssi_5ghz[4] = val & 0xff; /* [+0] */ + sc->tssi_5ghz[5] = val >> 8; /* [+1] */ + val = rt2860_srom_read(sc, RT2860_EEPROM_TSSI4_5GHZ); + sc->tssi_5ghz[6] = val & 0xff; /* [+2] */ + sc->tssi_5ghz[7] = val >> 8; /* [+3] */ + val = rt2860_srom_read(sc, RT2860_EEPROM_TSSI5_5GHZ); + sc->tssi_5ghz[8] = val & 0xff; /* [+4] */ + sc->step_5ghz = val >> 8; + DPRINTF(("TSSI 5GHz: 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x " + "0x%02x 0x%02x step=%d\n", sc->tssi_5ghz[0], sc->tssi_5ghz[1], + sc->tssi_5ghz[2], sc->tssi_5ghz[3], sc->tssi_5ghz[4], + sc->tssi_5ghz[5], sc->tssi_5ghz[6], sc->tssi_5ghz[7], + sc->tssi_5ghz[8], sc->step_5ghz)); + /* check that ref value is correct, otherwise disable calibration */ + if (sc->tssi_5ghz[4] == 0xff) + sc->calib_5ghz = 0; + + /* read RSSI offsets and LNA gains from EEPROM */ + val = rt2860_srom_read(sc, RT2860_EEPROM_RSSI1_2GHZ); + sc->rssi_2ghz[0] = val & 0xff; /* Ant A */ + sc->rssi_2ghz[1] = val >> 8; /* Ant B */ + val = rt2860_srom_read(sc, RT2860_EEPROM_RSSI2_2GHZ); + if (sc->mac_ver >= 0x3071) { + /* + * On RT3090 chips (limited to 2 Rx chains), this ROM + * field contains the Tx mixer gain for the 2GHz band. + */ + if ((val & 0xff) != 0xff) + sc->txmixgain_2ghz = val & 0x7; + DPRINTF(("tx mixer gain=%u (2GHz)\n", sc->txmixgain_2ghz)); + } else + sc->rssi_2ghz[2] = val & 0xff; /* Ant C */ + sc->lna[2] = val >> 8; /* channel group 2 */ + + val = rt2860_srom_read(sc, RT2860_EEPROM_RSSI1_5GHZ); + sc->rssi_5ghz[0] = val & 0xff; /* Ant A */ + sc->rssi_5ghz[1] = val >> 8; /* Ant B */ + val = rt2860_srom_read(sc, RT2860_EEPROM_RSSI2_5GHZ); + sc->rssi_5ghz[2] = val & 0xff; /* Ant C */ + sc->lna[3] = val >> 8; /* channel group 3 */ + + val = rt2860_srom_read(sc, RT2860_EEPROM_LNA); + if (sc->mac_ver >= 0x3071) + sc->lna[0] = RT3090_DEF_LNA; + else /* channel group 0 */ + sc->lna[0] = val & 0xff; + sc->lna[1] = val >> 8; /* channel group 1 */ + + /* fix broken 5GHz LNA entries */ + if (sc->lna[2] == 0 || sc->lna[2] == 0xff) { + DPRINTF(("invalid LNA for channel group %d\n", 2)); + sc->lna[2] = sc->lna[1]; + } + if (sc->lna[3] == 0 || sc->lna[3] == 0xff) { + DPRINTF(("invalid LNA for channel group %d\n", 3)); + sc->lna[3] = sc->lna[1]; + } + + /* fix broken RSSI offset entries */ + for (ant = 0; ant < 3; ant++) { + if (sc->rssi_2ghz[ant] < -10 || sc->rssi_2ghz[ant] > 10) { + DPRINTF(("invalid RSSI%d offset: %d (2GHz)\n", + ant + 1, sc->rssi_2ghz[ant])); + sc->rssi_2ghz[ant] = 0; + } + if (sc->rssi_5ghz[ant] < -10 || sc->rssi_5ghz[ant] > 10) { + DPRINTF(("invalid RSSI%d offset: %d (5GHz)\n", + ant + 1, sc->rssi_5ghz[ant])); + sc->rssi_5ghz[ant] = 0; + } + } + + return 0; +} + +int +rt2860_bbp_init(struct rt2860_softc *sc) +{ +#define N(a) (sizeof (a) / sizeof ((a)[0])) + int i, ntries; + + /* wait for BBP to wake up */ + for (ntries = 0; ntries < 20; ntries++) { + uint8_t bbp0 = rt2860_mcu_bbp_read(sc, 0); + if (bbp0 != 0 && bbp0 != 0xff) + break; + } + if (ntries == 20) { + device_printf(sc->sc_dev, + "timeout waiting for BBP to wake up\n"); + return ETIMEDOUT; + } + + /* initialize BBP registers to default values */ + for (i = 0; i < N(rt2860_def_bbp); i++) { + rt2860_mcu_bbp_write(sc, rt2860_def_bbp[i].reg, + rt2860_def_bbp[i].val); + } + + /* fix BBP84 for RT2860E */ + if (sc->mac_ver == 0x2860 && sc->mac_rev != 0x0101) + rt2860_mcu_bbp_write(sc, 84, 0x19); + + if (sc->mac_ver >= 0x3071) { + rt2860_mcu_bbp_write(sc, 79, 0x13); + rt2860_mcu_bbp_write(sc, 80, 0x05); + rt2860_mcu_bbp_write(sc, 81, 0x33); + } else if (sc->mac_ver == 0x2860 && sc->mac_rev == 0x0100) { + rt2860_mcu_bbp_write(sc, 69, 0x16); + rt2860_mcu_bbp_write(sc, 73, 0x12); + } + + return 0; +#undef N +} + +static int +rt2860_txrx_enable(struct rt2860_softc *sc) +{ + struct ifnet *ifp = sc->sc_ifp; + struct ieee80211com *ic = ifp->if_l2com; + uint32_t tmp; + int ntries; + + /* enable Tx/Rx DMA engine */ + RAL_WRITE(sc, RT2860_MAC_SYS_CTRL, RT2860_MAC_TX_EN); + RAL_BARRIER_READ_WRITE(sc); + for (ntries = 0; ntries < 200; ntries++) { + tmp = RAL_READ(sc, RT2860_WPDMA_GLO_CFG); + if ((tmp & (RT2860_TX_DMA_BUSY | RT2860_RX_DMA_BUSY)) == 0) + break; + DELAY(1000); + } + if (ntries == 200) { + device_printf(sc->sc_dev, "timeout waiting for DMA engine\n"); + return ETIMEDOUT; + } + + DELAY(50); + + tmp |= RT2860_RX_DMA_EN | RT2860_TX_DMA_EN | + RT2860_WPDMA_BT_SIZE64 << RT2860_WPDMA_BT_SIZE_SHIFT; + RAL_WRITE(sc, RT2860_WPDMA_GLO_CFG, tmp); + + /* set Rx filter */ + tmp = RT2860_DROP_CRC_ERR | RT2860_DROP_PHY_ERR; + if (ic->ic_opmode != IEEE80211_M_MONITOR) { + tmp |= RT2860_DROP_UC_NOME | RT2860_DROP_DUPL | + RT2860_DROP_CTS | RT2860_DROP_BA | RT2860_DROP_ACK | + RT2860_DROP_VER_ERR | RT2860_DROP_CTRL_RSV | + RT2860_DROP_CFACK | RT2860_DROP_CFEND; + if (ic->ic_opmode == IEEE80211_M_STA) + tmp |= RT2860_DROP_RTS | RT2860_DROP_PSPOLL; + } + RAL_WRITE(sc, RT2860_RX_FILTR_CFG, tmp); + + RAL_WRITE(sc, RT2860_MAC_SYS_CTRL, + RT2860_MAC_RX_EN | RT2860_MAC_TX_EN); + + return 0; +} + +static void +rt2860_init(void *arg) +{ + struct rt2860_softc *sc = arg; + struct ifnet *ifp = sc->sc_ifp; + struct ieee80211com *ic = ifp->if_l2com; + + RAL_LOCK(sc); + rt2860_init_locked(sc); + RAL_UNLOCK(sc); + + if (ifp->if_drv_flags & IFF_DRV_RUNNING) + ieee80211_start_all(ic); +} + +static void +rt2860_init_locked(struct rt2860_softc *sc) +{ +#define N(a) (sizeof (a) / sizeof ((a)[0])) + struct ifnet *ifp = sc->sc_ifp; + struct ieee80211com *ic = ifp->if_l2com; + uint32_t tmp; + uint8_t bbp1, bbp3; + int i, qid, ridx, ntries, error; + + RAL_LOCK_ASSERT(sc); + + if (sc->rfswitch) { + /* hardware has a radio switch on GPIO pin 2 */ + if (!(RAL_READ(sc, RT2860_GPIO_CTRL) & (1 << 2))) { + device_printf(sc->sc_dev, + "radio is disabled by hardware switch\n"); +#ifdef notyet + rt2860_stop_locked(sc); + return; +#endif + } + } + RAL_WRITE(sc, RT2860_PWR_PIN_CFG, RT2860_IO_RA_PE); + + /* disable DMA */ + tmp = RAL_READ(sc, RT2860_WPDMA_GLO_CFG); + tmp &= 0xff0; + RAL_WRITE(sc, RT2860_WPDMA_GLO_CFG, tmp); + + /* PBF hardware reset */ + RAL_WRITE(sc, RT2860_SYS_CTRL, 0xe1f); + RAL_BARRIER_WRITE(sc); + RAL_WRITE(sc, RT2860_SYS_CTRL, 0xe00); + + if ((error = rt2860_load_microcode(sc)) != 0) { + device_printf(sc->sc_dev, "could not load 8051 microcode\n"); + rt2860_stop_locked(sc); + return; + } + + rt2860_set_macaddr(sc, IF_LLADDR(ifp)); + + /* init Tx power for all Tx rates (from EEPROM) */ + for (ridx = 0; ridx < 5; ridx++) { + if (sc->txpow20mhz[ridx] == 0xffffffff) + continue; + RAL_WRITE(sc, RT2860_TX_PWR_CFG(ridx), sc->txpow20mhz[ridx]); + } + + for (ntries = 0; ntries < 100; ntries++) { + tmp = RAL_READ(sc, RT2860_WPDMA_GLO_CFG); + if ((tmp & (RT2860_TX_DMA_BUSY | RT2860_RX_DMA_BUSY)) == 0) + break; + DELAY(1000); + } + if (ntries == 100) { + device_printf(sc->sc_dev, "timeout waiting for DMA engine\n"); + rt2860_stop_locked(sc); + return; + } + tmp &= 0xff0; + RAL_WRITE(sc, RT2860_WPDMA_GLO_CFG, tmp); + + /* reset Rx ring and all 6 Tx rings */ + RAL_WRITE(sc, RT2860_WPDMA_RST_IDX, 0x1003f); + + /* PBF hardware reset */ + RAL_WRITE(sc, RT2860_SYS_CTRL, 0xe1f); + RAL_BARRIER_WRITE(sc); + RAL_WRITE(sc, RT2860_SYS_CTRL, 0xe00); + + RAL_WRITE(sc, RT2860_PWR_PIN_CFG, RT2860_IO_RA_PE | RT2860_IO_RF_PE); + + RAL_WRITE(sc, RT2860_MAC_SYS_CTRL, RT2860_BBP_HRST | RT2860_MAC_SRST); + RAL_BARRIER_WRITE(sc); + RAL_WRITE(sc, RT2860_MAC_SYS_CTRL, 0); + + for (i = 0; i < N(rt2860_def_mac); i++) + RAL_WRITE(sc, rt2860_def_mac[i].reg, rt2860_def_mac[i].val); + if (sc->mac_ver >= 0x3071) { + /* set delay of PA_PE assertion to 1us (unit of 0.25us) */ + RAL_WRITE(sc, RT2860_TX_SW_CFG0, + 4 << RT2860_DLY_PAPE_EN_SHIFT); + } + + if (!(RAL_READ(sc, RT2860_PCI_CFG) & RT2860_PCI_CFG_PCI)) { + sc->sc_flags |= RT2860_PCIE; + /* PCIe has different clock cycle count than PCI */ + tmp = RAL_READ(sc, RT2860_US_CYC_CNT); + tmp = (tmp & ~0xff) | 0x7d; + RAL_WRITE(sc, RT2860_US_CYC_CNT, tmp); + } + + /* wait while MAC is busy */ + for (ntries = 0; ntries < 100; ntries++) { + if (!(RAL_READ(sc, RT2860_MAC_STATUS_REG) & + (RT2860_RX_STATUS_BUSY | RT2860_TX_STATUS_BUSY))) + break; + DELAY(1000); + } + if (ntries == 100) { + device_printf(sc->sc_dev, "timeout waiting for MAC\n"); + rt2860_stop_locked(sc); + return; + } + + /* clear Host to MCU mailbox */ + RAL_WRITE(sc, RT2860_H2M_BBPAGENT, 0); + RAL_WRITE(sc, RT2860_H2M_MAILBOX, 0); + + rt2860_mcu_cmd(sc, RT2860_MCU_CMD_RFRESET, 0, 0); + DELAY(1000); + + if ((error = rt2860_bbp_init(sc)) != 0) { + rt2860_stop_locked(sc); + return; + } + + /* clear RX WCID search table */ + RAL_SET_REGION_4(sc, RT2860_WCID_ENTRY(0), 0, 512); + /* clear pairwise key table */ + RAL_SET_REGION_4(sc, RT2860_PKEY(0), 0, 2048); + /* clear IV/EIV table */ + RAL_SET_REGION_4(sc, RT2860_IVEIV(0), 0, 512); + /* clear WCID attribute table */ + RAL_SET_REGION_4(sc, RT2860_WCID_ATTR(0), 0, 256); + /* clear shared key table */ + RAL_SET_REGION_4(sc, RT2860_SKEY(0, 0), 0, 8 * 32); + /* clear shared key mode */ + RAL_SET_REGION_4(sc, RT2860_SKEY_MODE_0_7, 0, 4); + + /* init Tx rings (4 EDCAs + HCCA + Mgt) */ + for (qid = 0; qid < 6; qid++) { + RAL_WRITE(sc, RT2860_TX_BASE_PTR(qid), sc->txq[qid].paddr); + RAL_WRITE(sc, RT2860_TX_MAX_CNT(qid), RT2860_TX_RING_COUNT); + RAL_WRITE(sc, RT2860_TX_CTX_IDX(qid), 0); + } + + /* init Rx ring */ + RAL_WRITE(sc, RT2860_RX_BASE_PTR, sc->rxq.paddr); + RAL_WRITE(sc, RT2860_RX_MAX_CNT, RT2860_RX_RING_COUNT); + RAL_WRITE(sc, RT2860_RX_CALC_IDX, RT2860_RX_RING_COUNT - 1); + + /* setup maximum buffer sizes */ + RAL_WRITE(sc, RT2860_MAX_LEN_CFG, 1 << 12 | + (MCLBYTES - sizeof (struct rt2860_rxwi) - 2)); + + for (ntries = 0; ntries < 100; ntries++) { + tmp = RAL_READ(sc, RT2860_WPDMA_GLO_CFG); + if ((tmp & (RT2860_TX_DMA_BUSY | RT2860_RX_DMA_BUSY)) == 0) + break; + DELAY(1000); + } + if (ntries == 100) { + device_printf(sc->sc_dev, "timeout waiting for DMA engine\n"); + rt2860_stop_locked(sc); + return; + } + tmp &= 0xff0; + RAL_WRITE(sc, RT2860_WPDMA_GLO_CFG, tmp); + + /* disable interrupts mitigation */ + RAL_WRITE(sc, RT2860_DELAY_INT_CFG, 0); + + /* write vendor-specific BBP values (from EEPROM) */ + for (i = 0; i < 8; i++) { + if (sc->bbp[i].reg == 0 || sc->bbp[i].reg == 0xff) + continue; + rt2860_mcu_bbp_write(sc, sc->bbp[i].reg, sc->bbp[i].val); + } + + /* select Main antenna for 1T1R devices */ + if (sc->rf_rev == RT3070_RF_2020 || + sc->rf_rev == RT3070_RF_3020 || + sc->rf_rev == RT3070_RF_3320) + rt3090_set_rx_antenna(sc, 0); + + /* send LEDs operating mode to microcontroller */ + rt2860_mcu_cmd(sc, RT2860_MCU_CMD_LED1, sc->led[0], 0); + rt2860_mcu_cmd(sc, RT2860_MCU_CMD_LED2, sc->led[1], 0); + rt2860_mcu_cmd(sc, RT2860_MCU_CMD_LED3, sc->led[2], 0); + + if (sc->mac_ver >= 0x3071) + rt3090_rf_init(sc); + + rt2860_mcu_cmd(sc, RT2860_MCU_CMD_SLEEP, 0x02ff, 1); + rt2860_mcu_cmd(sc, RT2860_MCU_CMD_WAKEUP, 0, 1); + + if (sc->mac_ver >= 0x3071) + rt3090_rf_wakeup(sc); + + /* disable non-existing Rx chains */ + bbp3 = rt2860_mcu_bbp_read(sc, 3); + bbp3 &= ~(1 << 3 | 1 << 4); + if (sc->nrxchains == 2) + bbp3 |= 1 << 3; + else if (sc->nrxchains == 3) + bbp3 |= 1 << 4; + rt2860_mcu_bbp_write(sc, 3, bbp3); + + /* disable non-existing Tx chains */ + bbp1 = rt2860_mcu_bbp_read(sc, 1); + if (sc->ntxchains == 1) + bbp1 = (bbp1 & ~(1 << 3 | 1 << 4)); + else if (sc->mac_ver == 0x3593 && sc->ntxchains == 2) + bbp1 = (bbp1 & ~(1 << 4)) | 1 << 3; + else if (sc->mac_ver == 0x3593 && sc->ntxchains == 3) + bbp1 = (bbp1 & ~(1 << 3)) | 1 << 4; + rt2860_mcu_bbp_write(sc, 1, bbp1); + + if (sc->mac_ver >= 0x3071) + rt3090_rf_setup(sc); + + /* select default channel */ + rt2860_switch_chan(sc, ic->ic_curchan); + + /* reset RF from MCU */ + rt2860_mcu_cmd(sc, RT2860_MCU_CMD_RFRESET, 0, 0); + + /* set RTS threshold */ + tmp = RAL_READ(sc, RT2860_TX_RTS_CFG); + tmp &= ~0xffff00; + tmp |= IEEE80211_RTS_DEFAULT << 8; + RAL_WRITE(sc, RT2860_TX_RTS_CFG, tmp); + + /* setup initial protection mode */ + rt2860_updateprot(ifp); + + /* turn radio LED on */ + rt2860_set_leds(sc, RT2860_LED_RADIO); + + /* enable Tx/Rx DMA engine */ + if ((error = rt2860_txrx_enable(sc)) != 0) { + rt2860_stop_locked(sc); + return; + } + + /* clear pending interrupts */ + RAL_WRITE(sc, RT2860_INT_STATUS, 0xffffffff); + /* enable interrupts */ + RAL_WRITE(sc, RT2860_INT_MASK, 0x3fffc); + + if (sc->sc_flags & RT2860_ADVANCED_PS) + rt2860_mcu_cmd(sc, RT2860_MCU_CMD_PSLEVEL, sc->pslevel, 0); + + ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; + ifp->if_drv_flags |= IFF_DRV_RUNNING; + + callout_reset(&sc->watchdog_ch, hz, rt2860_watchdog, sc); +#undef N +} + +static void +rt2860_stop(void *arg) +{ + struct rt2860_softc *sc = arg; + + RAL_LOCK(sc); + rt2860_stop_locked(sc); + RAL_UNLOCK(sc); +} + +static void +rt2860_stop_locked(struct rt2860_softc *sc) +{ + struct ifnet *ifp = sc->sc_ifp; + uint32_t tmp; + int qid; + + if (ifp->if_drv_flags & IFF_DRV_RUNNING) + rt2860_set_leds(sc, 0); /* turn all LEDs off */ + + callout_stop(&sc->watchdog_ch); + sc->sc_tx_timer = 0; + ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); + + /* disable interrupts */ + RAL_WRITE(sc, RT2860_INT_MASK, 0); + + /* disable GP timer */ + rt2860_set_gp_timer(sc, 0); + + /* disable Rx */ + tmp = RAL_READ(sc, RT2860_MAC_SYS_CTRL); + tmp &= ~(RT2860_MAC_RX_EN | RT2860_MAC_TX_EN); + RAL_WRITE(sc, RT2860_MAC_SYS_CTRL, tmp); + + /* reset adapter */ + RAL_WRITE(sc, RT2860_MAC_SYS_CTRL, RT2860_BBP_HRST | RT2860_MAC_SRST); + RAL_BARRIER_WRITE(sc); + RAL_WRITE(sc, RT2860_MAC_SYS_CTRL, 0); + + /* reset Tx and Rx rings (and reclaim TXWIs) */ + sc->qfullmsk = 0; + for (qid = 0; qid < 6; qid++) + rt2860_reset_tx_ring(sc, &sc->txq[qid]); + rt2860_reset_rx_ring(sc, &sc->rxq); +} + +int +rt2860_load_microcode(struct rt2860_softc *sc) +{ + const struct firmware *fp; + int ntries, error; + + RAL_LOCK_ASSERT(sc); + + RAL_UNLOCK(sc); + fp = firmware_get("rt2860fw"); + RAL_LOCK(sc); + if (fp == NULL) { + device_printf(sc->sc_dev, + "unable to receive rt2860fw firmware image\n"); + return EINVAL; + } + + /* set "host program ram write selection" bit */ + RAL_WRITE(sc, RT2860_SYS_CTRL, RT2860_HST_PM_SEL); + /* write microcode image */ + RAL_WRITE_REGION_1(sc, RT2860_FW_BASE, fp->data, fp->datasize); + /* kick microcontroller unit */ + RAL_WRITE(sc, RT2860_SYS_CTRL, 0); + RAL_BARRIER_WRITE(sc); + RAL_WRITE(sc, RT2860_SYS_CTRL, RT2860_MCU_RESET); + + RAL_WRITE(sc, RT2860_H2M_BBPAGENT, 0); + RAL_WRITE(sc, RT2860_H2M_MAILBOX, 0); + + /* wait until microcontroller is ready */ + RAL_BARRIER_READ_WRITE(sc); + for (ntries = 0; ntries < 1000; ntries++) { + if (RAL_READ(sc, RT2860_SYS_CTRL) & RT2860_MCU_READY) + break; + DELAY(1000); + } + if (ntries == 1000) { + device_printf(sc->sc_dev, + "timeout waiting for MCU to initialize\n"); + error = ETIMEDOUT; + } else + error = 0; + + firmware_put(fp, FIRMWARE_UNLOAD); + return error; +} + +/* + * This function is called periodically to adjust Tx power based on + * temperature variation. + */ +#ifdef NOT_YET +static void +rt2860_calib(struct rt2860_softc *sc) +{ + struct ieee80211com *ic = &sc->sc_ic; + const uint8_t *tssi; + uint8_t step, bbp49; + int8_t ridx, d; + + /* read current temperature */ + bbp49 = rt2860_mcu_bbp_read(sc, 49); + + if (IEEE80211_IS_CHAN_2GHZ(ic->ic_bss->ni_chan)) { + tssi = &sc->tssi_2ghz[4]; + step = sc->step_2ghz; + } else { + tssi = &sc->tssi_5ghz[4]; + step = sc->step_5ghz; + } + + if (bbp49 < tssi[0]) { /* lower than reference */ + /* use higher Tx power than default */ + for (d = 0; d > -4 && bbp49 <= tssi[d - 1]; d--); + } else if (bbp49 > tssi[0]) { /* greater than reference */ + /* use lower Tx power than default */ + for (d = 0; d < +4 && bbp49 >= tssi[d + 1]; d++); + } else { + /* use default Tx power */ + d = 0; + } + d *= step; + + DPRINTF(("BBP49=0x%02x, adjusting Tx power by %d\n", bbp49, d)); + + /* write adjusted Tx power values for each Tx rate */ + for (ridx = 0; ridx < 5; ridx++) { + if (sc->txpow20mhz[ridx] == 0xffffffff) + continue; + RAL_WRITE(sc, RT2860_TX_PWR_CFG(ridx), + b4inc(sc->txpow20mhz[ridx], d)); + } +} +#endif + +static void +rt3090_set_rx_antenna(struct rt2860_softc *sc, int aux) +{ + uint32_t tmp; + + if (aux) { + tmp = RAL_READ(sc, RT2860_PCI_EECTRL); + RAL_WRITE(sc, RT2860_PCI_EECTRL, tmp & ~RT2860_C); + tmp = RAL_READ(sc, RT2860_GPIO_CTRL); + RAL_WRITE(sc, RT2860_GPIO_CTRL, (tmp & ~0x0808) | 0x08); + } else { + tmp = RAL_READ(sc, RT2860_PCI_EECTRL); + RAL_WRITE(sc, RT2860_PCI_EECTRL, tmp | RT2860_C); + tmp = RAL_READ(sc, RT2860_GPIO_CTRL); + RAL_WRITE(sc, RT2860_GPIO_CTRL, tmp & ~0x0808); + } +} + +static void +rt2860_switch_chan(struct rt2860_softc *sc, struct ieee80211_channel *c) +{ + struct ifnet *ifp = sc->sc_ifp; + struct ieee80211com *ic = ifp->if_l2com; + u_int chan, group; + + chan = ieee80211_chan2ieee(ic, c); + if (chan == 0 || chan == IEEE80211_CHAN_ANY) + return; + + if (sc->mac_ver >= 0x3071) + rt3090_set_chan(sc, chan); + else + rt2860_set_chan(sc, chan); + + /* determine channel group */ + if (chan <= 14) + group = 0; + else if (chan <= 64) + group = 1; + else if (chan <= 128) + group = 2; + else + group = 3; + + /* XXX necessary only when group has changed! */ + rt2860_select_chan_group(sc, group); + + DELAY(1000); +} + +static int +rt2860_setup_beacon(struct rt2860_softc *sc, struct ieee80211vap *vap) +{ + struct ieee80211com *ic = vap->iv_ic; + struct ieee80211_beacon_offsets bo; + struct rt2860_txwi txwi; + struct mbuf *m; + int ridx; + + if ((m = ieee80211_beacon_alloc(vap->iv_bss, &bo)) == NULL) + return ENOBUFS; + + memset(&txwi, 0, sizeof txwi); + txwi.wcid = 0xff; + txwi.len = htole16(m->m_pkthdr.len); + /* send beacons at the lowest available rate */ + ridx = IEEE80211_IS_CHAN_5GHZ(ic->ic_bsschan) ? + RT2860_RIDX_OFDM6 : RT2860_RIDX_CCK1; + txwi.phy = htole16(rt2860_rates[ridx].mcs); + if (rt2860_rates[ridx].phy == IEEE80211_T_OFDM) + txwi.phy |= htole16(RT2860_PHY_OFDM); + txwi.txop = RT2860_TX_TXOP_HT; + txwi.flags = RT2860_TX_TS; + txwi.xflags = RT2860_TX_NSEQ; + + RAL_WRITE_REGION_1(sc, RT2860_BCN_BASE(0), + (uint8_t *)&txwi, sizeof txwi); + RAL_WRITE_REGION_1(sc, RT2860_BCN_BASE(0) + sizeof txwi, + mtod(m, uint8_t *), m->m_pkthdr.len); + + m_freem(m); + + return 0; +} + +static void +rt2860_enable_tsf_sync(struct rt2860_softc *sc) +{ + struct ifnet *ifp = sc->sc_ifp; + struct ieee80211com *ic = ifp->if_l2com; + struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps); + uint32_t tmp; + + tmp = RAL_READ(sc, RT2860_BCN_TIME_CFG); + + tmp &= ~0x1fffff; + tmp |= vap->iv_bss->ni_intval * 16; + tmp |= RT2860_TSF_TIMER_EN | RT2860_TBTT_TIMER_EN; + if (vap->iv_opmode == IEEE80211_M_STA) { + /* + * Local TSF is always updated with remote TSF on beacon + * reception. + */ + tmp |= 1 << RT2860_TSF_SYNC_MODE_SHIFT; + } + else if (vap->iv_opmode == IEEE80211_M_IBSS || + vap->iv_opmode == IEEE80211_M_MBSS) { + tmp |= RT2860_BCN_TX_EN; + /* + * Local TSF is updated with remote TSF on beacon reception + * only if the remote TSF is greater than local TSF. + */ + tmp |= 2 << RT2860_TSF_SYNC_MODE_SHIFT; + } else if (vap->iv_opmode == IEEE80211_M_HOSTAP) { + tmp |= RT2860_BCN_TX_EN; + /* SYNC with nobody */ + tmp |= 3 << RT2860_TSF_SYNC_MODE_SHIFT; + } + + RAL_WRITE(sc, RT2860_BCN_TIME_CFG, tmp); +} diff --git a/src/add-ons/kernel/drivers/network/wlan/ralinkwifi/dev/ral/rt2860reg.h b/src/add-ons/kernel/drivers/network/wlan/ralinkwifi/dev/ral/rt2860reg.h new file mode 100644 index 0000000000..06c275d47f --- /dev/null +++ b/src/add-ons/kernel/drivers/network/wlan/ralinkwifi/dev/ral/rt2860reg.h @@ -0,0 +1,1255 @@ +/*- + * Copyright (c) 2007 Damien Bergamini + * Copyright (c) 2012 Bernhard Schmidt + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * $OpenBSD: rt2860reg.h,v 1.30 2010/05/10 18:17:10 damien Exp $ + * $FreeBSD$ + */ + +#define RT2860_NOISE_FLOOR -95 + +/* PCI registers */ +#define RT2860_PCI_CFG 0x0000 +#define RT2860_PCI_EECTRL 0x0004 +#define RT2860_PCI_MCUCTRL 0x0008 +#define RT2860_PCI_SYSCTRL 0x000c +#define RT2860_PCIE_JTAG 0x0010 + +#define RT3090_AUX_CTRL 0x010c + +#define RT3070_OPT_14 0x0114 + +/* SCH/DMA registers */ +#define RT2860_INT_STATUS 0x0200 +#define RT2860_INT_MASK 0x0204 +#define RT2860_WPDMA_GLO_CFG 0x0208 +#define RT2860_WPDMA_RST_IDX 0x020c +#define RT2860_DELAY_INT_CFG 0x0210 +#define RT2860_WMM_AIFSN_CFG 0x0214 +#define RT2860_WMM_CWMIN_CFG 0x0218 +#define RT2860_WMM_CWMAX_CFG 0x021c +#define RT2860_WMM_TXOP0_CFG 0x0220 +#define RT2860_WMM_TXOP1_CFG 0x0224 +#define RT2860_GPIO_CTRL 0x0228 +#define RT2860_MCU_CMD_REG 0x022c +#define RT2860_TX_BASE_PTR(qid) (0x0230 + (qid) * 16) +#define RT2860_TX_MAX_CNT(qid) (0x0234 + (qid) * 16) +#define RT2860_TX_CTX_IDX(qid) (0x0238 + (qid) * 16) +#define RT2860_TX_DTX_IDX(qid) (0x023c + (qid) * 16) +#define RT2860_RX_BASE_PTR 0x0290 +#define RT2860_RX_MAX_CNT 0x0294 +#define RT2860_RX_CALC_IDX 0x0298 +#define RT2860_FS_DRX_IDX 0x029c +#define RT2860_USB_DMA_CFG 0x02a0 /* RT2870 only */ +#define RT2860_US_CYC_CNT 0x02a4 + +/* PBF registers */ +#define RT2860_SYS_CTRL 0x0400 +#define RT2860_HOST_CMD 0x0404 +#define RT2860_PBF_CFG 0x0408 +#define RT2860_MAX_PCNT 0x040c +#define RT2860_BUF_CTRL 0x0410 +#define RT2860_MCU_INT_STA 0x0414 +#define RT2860_MCU_INT_ENA 0x0418 +#define RT2860_TXQ_IO(qid) (0x041c + (qid) * 4) +#define RT2860_RX0Q_IO 0x0424 +#define RT2860_BCN_OFFSET0 0x042c +#define RT2860_BCN_OFFSET1 0x0430 +#define RT2860_TXRXQ_STA 0x0434 +#define RT2860_TXRXQ_PCNT 0x0438 +#define RT2860_PBF_DBG 0x043c +#define RT2860_CAP_CTRL 0x0440 + +/* RT3070 registers */ +#define RT3070_RF_CSR_CFG 0x0500 +#define RT3070_EFUSE_CTRL 0x0580 +#define RT3070_EFUSE_DATA0 0x0590 +#define RT3070_EFUSE_DATA1 0x0594 +#define RT3070_EFUSE_DATA2 0x0598 +#define RT3070_EFUSE_DATA3 0x059c +#define RT3090_OSC_CTRL 0x05a4 +#define RT3070_LDO_CFG0 0x05d4 +#define RT3070_GPIO_SWITCH 0x05dc + +/* MAC registers */ +#define RT2860_ASIC_VER_ID 0x1000 +#define RT2860_MAC_SYS_CTRL 0x1004 +#define RT2860_MAC_ADDR_DW0 0x1008 +#define RT2860_MAC_ADDR_DW1 0x100c +#define RT2860_MAC_BSSID_DW0 0x1010 +#define RT2860_MAC_BSSID_DW1 0x1014 +#define RT2860_MAX_LEN_CFG 0x1018 +#define RT2860_BBP_CSR_CFG 0x101c +#define RT2860_RF_CSR_CFG0 0x1020 +#define RT2860_RF_CSR_CFG1 0x1024 +#define RT2860_RF_CSR_CFG2 0x1028 +#define RT2860_LED_CFG 0x102c + +/* undocumented registers */ +#define RT2860_DEBUG 0x10f4 + +/* MAC Timing control registers */ +#define RT2860_XIFS_TIME_CFG 0x1100 +#define RT2860_BKOFF_SLOT_CFG 0x1104 +#define RT2860_NAV_TIME_CFG 0x1108 +#define RT2860_CH_TIME_CFG 0x110c +#define RT2860_PBF_LIFE_TIMER 0x1110 +#define RT2860_BCN_TIME_CFG 0x1114 +#define RT2860_TBTT_SYNC_CFG 0x1118 +#define RT2860_TSF_TIMER_DW0 0x111c +#define RT2860_TSF_TIMER_DW1 0x1120 +#define RT2860_TBTT_TIMER 0x1124 +#define RT2860_INT_TIMER_CFG 0x1128 +#define RT2860_INT_TIMER_EN 0x112c +#define RT2860_CH_IDLE_TIME 0x1130 + +/* MAC Power Save configuration registers */ +#define RT2860_MAC_STATUS_REG 0x1200 +#define RT2860_PWR_PIN_CFG 0x1204 +#define RT2860_AUTO_WAKEUP_CFG 0x1208 + +/* MAC TX configuration registers */ +#define RT2860_EDCA_AC_CFG(aci) (0x1300 + (aci) * 4) +#define RT2860_EDCA_TID_AC_MAP 0x1310 +#define RT2860_TX_PWR_CFG(ridx) (0x1314 + (ridx) * 4) +#define RT2860_TX_PIN_CFG 0x1328 +#define RT2860_TX_BAND_CFG 0x132c +#define RT2860_TX_SW_CFG0 0x1330 +#define RT2860_TX_SW_CFG1 0x1334 +#define RT2860_TX_SW_CFG2 0x1338 +#define RT2860_TXOP_THRES_CFG 0x133c +#define RT2860_TXOP_CTRL_CFG 0x1340 +#define RT2860_TX_RTS_CFG 0x1344 +#define RT2860_TX_TIMEOUT_CFG 0x1348 +#define RT2860_TX_RTY_CFG 0x134c +#define RT2860_TX_LINK_CFG 0x1350 +#define RT2860_HT_FBK_CFG0 0x1354 +#define RT2860_HT_FBK_CFG1 0x1358 +#define RT2860_LG_FBK_CFG0 0x135c +#define RT2860_LG_FBK_CFG1 0x1360 +#define RT2860_CCK_PROT_CFG 0x1364 +#define RT2860_OFDM_PROT_CFG 0x1368 +#define RT2860_MM20_PROT_CFG 0x136c +#define RT2860_MM40_PROT_CFG 0x1370 +#define RT2860_GF20_PROT_CFG 0x1374 +#define RT2860_GF40_PROT_CFG 0x1378 +#define RT2860_EXP_CTS_TIME 0x137c +#define RT2860_EXP_ACK_TIME 0x1380 + +/* MAC RX configuration registers */ +#define RT2860_RX_FILTR_CFG 0x1400 +#define RT2860_AUTO_RSP_CFG 0x1404 +#define RT2860_LEGACY_BASIC_RATE 0x1408 +#define RT2860_HT_BASIC_RATE 0x140c +#define RT2860_HT_CTRL_CFG 0x1410 +#define RT2860_SIFS_COST_CFG 0x1414 +#define RT2860_RX_PARSER_CFG 0x1418 + +/* MAC Security configuration registers */ +#define RT2860_TX_SEC_CNT0 0x1500 +#define RT2860_RX_SEC_CNT0 0x1504 +#define RT2860_CCMP_FC_MUTE 0x1508 + +/* MAC HCCA/PSMP configuration registers */ +#define RT2860_TXOP_HLDR_ADDR0 0x1600 +#define RT2860_TXOP_HLDR_ADDR1 0x1604 +#define RT2860_TXOP_HLDR_ET 0x1608 +#define RT2860_QOS_CFPOLL_RA_DW0 0x160c +#define RT2860_QOS_CFPOLL_A1_DW1 0x1610 +#define RT2860_QOS_CFPOLL_QC 0x1614 + +/* MAC Statistics Counters */ +#define RT2860_RX_STA_CNT0 0x1700 +#define RT2860_RX_STA_CNT1 0x1704 +#define RT2860_RX_STA_CNT2 0x1708 +#define RT2860_TX_STA_CNT0 0x170c +#define RT2860_TX_STA_CNT1 0x1710 +#define RT2860_TX_STA_CNT2 0x1714 +#define RT2860_TX_STAT_FIFO 0x1718 + +/* RX WCID search table */ +#define RT2860_WCID_ENTRY(wcid) (0x1800 + (wcid) * 8) + +#define RT2860_FW_BASE 0x2000 +#define RT2870_FW_BASE 0x3000 + +/* Pair-wise key table */ +#define RT2860_PKEY(wcid) (0x4000 + (wcid) * 32) + +/* IV/EIV table */ +#define RT2860_IVEIV(wcid) (0x6000 + (wcid) * 8) + +/* WCID attribute table */ +#define RT2860_WCID_ATTR(wcid) (0x6800 + (wcid) * 4) + +/* Shared Key Table */ +#define RT2860_SKEY(vap, kidx) (0x6c00 + (vap) * 128 + (kidx) * 32) + +/* Shared Key Mode */ +#define RT2860_SKEY_MODE_0_7 0x7000 +#define RT2860_SKEY_MODE_8_15 0x7004 +#define RT2860_SKEY_MODE_16_23 0x7008 +#define RT2860_SKEY_MODE_24_31 0x700c + +/* Shared Memory between MCU and host */ +#define RT2860_H2M_MAILBOX 0x7010 +#define RT2860_H2M_MAILBOX_CID 0x7014 +#define RT2860_H2M_MAILBOX_STATUS 0x701c +#define RT2860_H2M_BBPAGENT 0x7028 +#define RT2860_BCN_BASE(vap) (0x7800 + (vap) * 512) + + +/* possible flags for RT2860_PCI_CFG */ +#define RT2860_PCI_CFG_USB (1 << 17) +#define RT2860_PCI_CFG_PCI (1 << 16) + +/* possible flags for register RT2860_PCI_EECTRL */ +#define RT2860_C (1 << 0) +#define RT2860_S (1 << 1) +#define RT2860_D (1 << 2) +#define RT2860_SHIFT_D 2 +#define RT2860_Q (1 << 3) +#define RT2860_SHIFT_Q 3 + +/* possible flags for registers INT_STATUS/INT_MASK */ +#define RT2860_TX_COHERENT (1 << 17) +#define RT2860_RX_COHERENT (1 << 16) +#define RT2860_MAC_INT_4 (1 << 15) +#define RT2860_MAC_INT_3 (1 << 14) +#define RT2860_MAC_INT_2 (1 << 13) +#define RT2860_MAC_INT_1 (1 << 12) +#define RT2860_MAC_INT_0 (1 << 11) +#define RT2860_TX_RX_COHERENT (1 << 10) +#define RT2860_MCU_CMD_INT (1 << 9) +#define RT2860_TX_DONE_INT5 (1 << 8) +#define RT2860_TX_DONE_INT4 (1 << 7) +#define RT2860_TX_DONE_INT3 (1 << 6) +#define RT2860_TX_DONE_INT2 (1 << 5) +#define RT2860_TX_DONE_INT1 (1 << 4) +#define RT2860_TX_DONE_INT0 (1 << 3) +#define RT2860_RX_DONE_INT (1 << 2) +#define RT2860_TX_DLY_INT (1 << 1) +#define RT2860_RX_DLY_INT (1 << 0) + +/* possible flags for register WPDMA_GLO_CFG */ +#define RT2860_HDR_SEG_LEN_SHIFT 8 +#define RT2860_BIG_ENDIAN (1 << 7) +#define RT2860_TX_WB_DDONE (1 << 6) +#define RT2860_WPDMA_BT_SIZE_SHIFT 4 +#define RT2860_WPDMA_BT_SIZE16 0 +#define RT2860_WPDMA_BT_SIZE32 1 +#define RT2860_WPDMA_BT_SIZE64 2 +#define RT2860_WPDMA_BT_SIZE128 3 +#define RT2860_RX_DMA_BUSY (1 << 3) +#define RT2860_RX_DMA_EN (1 << 2) +#define RT2860_TX_DMA_BUSY (1 << 1) +#define RT2860_TX_DMA_EN (1 << 0) + +/* possible flags for register DELAY_INT_CFG */ +#define RT2860_TXDLY_INT_EN (1 << 31) +#define RT2860_TXMAX_PINT_SHIFT 24 +#define RT2860_TXMAX_PTIME_SHIFT 16 +#define RT2860_RXDLY_INT_EN (1 << 15) +#define RT2860_RXMAX_PINT_SHIFT 8 +#define RT2860_RXMAX_PTIME_SHIFT 0 + +/* possible flags for register GPIO_CTRL */ +#define RT2860_GPIO_D_SHIFT 8 +#define RT2860_GPIO_O_SHIFT 0 + +/* possible flags for register USB_DMA_CFG */ +#define RT2860_USB_TX_BUSY (1 << 31) +#define RT2860_USB_RX_BUSY (1 << 30) +#define RT2860_USB_EPOUT_VLD_SHIFT 24 +#define RT2860_USB_TX_EN (1 << 23) +#define RT2860_USB_RX_EN (1 << 22) +#define RT2860_USB_RX_AGG_EN (1 << 21) +#define RT2860_USB_TXOP_HALT (1 << 20) +#define RT2860_USB_TX_CLEAR (1 << 19) +#define RT2860_USB_PHY_WD_EN (1 << 16) +#define RT2860_USB_PHY_MAN_RST (1 << 15) +#define RT2860_USB_RX_AGG_LMT(x) ((x) << 8) /* in unit of 1KB */ +#define RT2860_USB_RX_AGG_TO(x) ((x) & 0xff) /* in unit of 33ns */ + +/* possible flags for register US_CYC_CNT */ +#define RT2860_TEST_EN (1 << 24) +#define RT2860_TEST_SEL_SHIFT 16 +#define RT2860_BT_MODE_EN (1 << 8) +#define RT2860_US_CYC_CNT_SHIFT 0 + +/* possible flags for register SYS_CTRL */ +#define RT2860_HST_PM_SEL (1 << 16) +#define RT2860_CAP_MODE (1 << 14) +#define RT2860_PME_OEN (1 << 13) +#define RT2860_CLKSELECT (1 << 12) +#define RT2860_PBF_CLK_EN (1 << 11) +#define RT2860_MAC_CLK_EN (1 << 10) +#define RT2860_DMA_CLK_EN (1 << 9) +#define RT2860_MCU_READY (1 << 7) +#define RT2860_ASY_RESET (1 << 4) +#define RT2860_PBF_RESET (1 << 3) +#define RT2860_MAC_RESET (1 << 2) +#define RT2860_DMA_RESET (1 << 1) +#define RT2860_MCU_RESET (1 << 0) + +/* possible values for register HOST_CMD */ +#define RT2860_MCU_CMD_SLEEP 0x30 +#define RT2860_MCU_CMD_WAKEUP 0x31 +#define RT2860_MCU_CMD_LEDS 0x50 +#define RT2860_MCU_CMD_LED_RSSI 0x51 +#define RT2860_MCU_CMD_LED1 0x52 +#define RT2860_MCU_CMD_LED2 0x53 +#define RT2860_MCU_CMD_LED3 0x54 +#define RT2860_MCU_CMD_RFRESET 0x72 +#define RT2860_MCU_CMD_ANTSEL 0x73 +#define RT2860_MCU_CMD_BBP 0x80 +#define RT2860_MCU_CMD_PSLEVEL 0x83 + +/* possible flags for register PBF_CFG */ +#define RT2860_TX1Q_NUM_SHIFT 21 +#define RT2860_TX2Q_NUM_SHIFT 16 +#define RT2860_NULL0_MODE (1 << 15) +#define RT2860_NULL1_MODE (1 << 14) +#define RT2860_RX_DROP_MODE (1 << 13) +#define RT2860_TX0Q_MANUAL (1 << 12) +#define RT2860_TX1Q_MANUAL (1 << 11) +#define RT2860_TX2Q_MANUAL (1 << 10) +#define RT2860_RX0Q_MANUAL (1 << 9) +#define RT2860_HCCA_EN (1 << 8) +#define RT2860_TX0Q_EN (1 << 4) +#define RT2860_TX1Q_EN (1 << 3) +#define RT2860_TX2Q_EN (1 << 2) +#define RT2860_RX0Q_EN (1 << 1) + +/* possible flags for register BUF_CTRL */ +#define RT2860_WRITE_TXQ(qid) (1 << (11 - (qid))) +#define RT2860_NULL0_KICK (1 << 7) +#define RT2860_NULL1_KICK (1 << 6) +#define RT2860_BUF_RESET (1 << 5) +#define RT2860_READ_TXQ(qid) (1 << (3 - (qid)) +#define RT2860_READ_RX0Q (1 << 0) + +/* possible flags for registers MCU_INT_STA/MCU_INT_ENA */ +#define RT2860_MCU_MAC_INT_8 (1 << 24) +#define RT2860_MCU_MAC_INT_7 (1 << 23) +#define RT2860_MCU_MAC_INT_6 (1 << 22) +#define RT2860_MCU_MAC_INT_4 (1 << 20) +#define RT2860_MCU_MAC_INT_3 (1 << 19) +#define RT2860_MCU_MAC_INT_2 (1 << 18) +#define RT2860_MCU_MAC_INT_1 (1 << 17) +#define RT2860_MCU_MAC_INT_0 (1 << 16) +#define RT2860_DTX0_INT (1 << 11) +#define RT2860_DTX1_INT (1 << 10) +#define RT2860_DTX2_INT (1 << 9) +#define RT2860_DRX0_INT (1 << 8) +#define RT2860_HCMD_INT (1 << 7) +#define RT2860_N0TX_INT (1 << 6) +#define RT2860_N1TX_INT (1 << 5) +#define RT2860_BCNTX_INT (1 << 4) +#define RT2860_MTX0_INT (1 << 3) +#define RT2860_MTX1_INT (1 << 2) +#define RT2860_MTX2_INT (1 << 1) +#define RT2860_MRX0_INT (1 << 0) + +/* possible flags for register TXRXQ_PCNT */ +#define RT2860_RX0Q_PCNT_MASK 0xff000000 +#define RT2860_TX2Q_PCNT_MASK 0x00ff0000 +#define RT2860_TX1Q_PCNT_MASK 0x0000ff00 +#define RT2860_TX0Q_PCNT_MASK 0x000000ff + +/* possible flags for register CAP_CTRL */ +#define RT2860_CAP_ADC_FEQ (1 << 31) +#define RT2860_CAP_START (1 << 30) +#define RT2860_MAN_TRIG (1 << 29) +#define RT2860_TRIG_OFFSET_SHIFT 16 +#define RT2860_START_ADDR_SHIFT 0 + +/* possible flags for register RF_CSR_CFG */ +#define RT3070_RF_KICK (1 << 17) +#define RT3070_RF_WRITE (1 << 16) + +/* possible flags for register EFUSE_CTRL */ +#define RT3070_SEL_EFUSE (1 << 31) +#define RT3070_EFSROM_KICK (1 << 30) +#define RT3070_EFSROM_AIN_MASK 0x03ff0000 +#define RT3070_EFSROM_AIN_SHIFT 16 +#define RT3070_EFSROM_MODE_MASK 0x000000c0 +#define RT3070_EFUSE_AOUT_MASK 0x0000003f + +/* possible flags for register MAC_SYS_CTRL */ +#define RT2860_RX_TS_EN (1 << 7) +#define RT2860_WLAN_HALT_EN (1 << 6) +#define RT2860_PBF_LOOP_EN (1 << 5) +#define RT2860_CONT_TX_TEST (1 << 4) +#define RT2860_MAC_RX_EN (1 << 3) +#define RT2860_MAC_TX_EN (1 << 2) +#define RT2860_BBP_HRST (1 << 1) +#define RT2860_MAC_SRST (1 << 0) + +/* possible flags for register MAC_BSSID_DW1 */ +#define RT2860_MULTI_BCN_NUM_SHIFT 18 +#define RT2860_MULTI_BSSID_MODE_SHIFT 16 + +/* possible flags for register MAX_LEN_CFG */ +#define RT2860_MIN_MPDU_LEN_SHIFT 16 +#define RT2860_MAX_PSDU_LEN_SHIFT 12 +#define RT2860_MAX_PSDU_LEN8K 0 +#define RT2860_MAX_PSDU_LEN16K 1 +#define RT2860_MAX_PSDU_LEN32K 2 +#define RT2860_MAX_PSDU_LEN64K 3 +#define RT2860_MAX_MPDU_LEN_SHIFT 0 + +/* possible flags for registers BBP_CSR_CFG/H2M_BBPAGENT */ +#define RT2860_BBP_RW_PARALLEL (1 << 19) +#define RT2860_BBP_PAR_DUR_112_5 (1 << 18) +#define RT2860_BBP_CSR_KICK (1 << 17) +#define RT2860_BBP_CSR_READ (1 << 16) +#define RT2860_BBP_ADDR_SHIFT 8 +#define RT2860_BBP_DATA_SHIFT 0 + +/* possible flags for register RF_CSR_CFG0 */ +#define RT2860_RF_REG_CTRL (1 << 31) +#define RT2860_RF_LE_SEL1 (1 << 30) +#define RT2860_RF_LE_STBY (1 << 29) +#define RT2860_RF_REG_WIDTH_SHIFT 24 +#define RT2860_RF_REG_0_SHIFT 0 + +/* possible flags for register RF_CSR_CFG1 */ +#define RT2860_RF_DUR_5 (1 << 24) +#define RT2860_RF_REG_1_SHIFT 0 + +/* possible flags for register LED_CFG */ +#define RT2860_LED_POL (1 << 30) +#define RT2860_Y_LED_MODE_SHIFT 28 +#define RT2860_G_LED_MODE_SHIFT 26 +#define RT2860_R_LED_MODE_SHIFT 24 +#define RT2860_LED_MODE_OFF 0 +#define RT2860_LED_MODE_BLINK_TX 1 +#define RT2860_LED_MODE_SLOW_BLINK 2 +#define RT2860_LED_MODE_ON 3 +#define RT2860_SLOW_BLK_TIME_SHIFT 16 +#define RT2860_LED_OFF_TIME_SHIFT 8 +#define RT2860_LED_ON_TIME_SHIFT 0 + +/* possible flags for register XIFS_TIME_CFG */ +#define RT2860_BB_RXEND_EN (1 << 29) +#define RT2860_EIFS_TIME_SHIFT 20 +#define RT2860_OFDM_XIFS_TIME_SHIFT 16 +#define RT2860_OFDM_SIFS_TIME_SHIFT 8 +#define RT2860_CCK_SIFS_TIME_SHIFT 0 + +/* possible flags for register BKOFF_SLOT_CFG */ +#define RT2860_CC_DELAY_TIME_SHIFT 8 +#define RT2860_SLOT_TIME 0 + +/* possible flags for register NAV_TIME_CFG */ +#define RT2860_NAV_UPD (1 << 31) +#define RT2860_NAV_UPD_VAL_SHIFT 16 +#define RT2860_NAV_CLR_EN (1 << 15) +#define RT2860_NAV_TIMER_SHIFT 0 + +/* possible flags for register CH_TIME_CFG */ +#define RT2860_EIFS_AS_CH_BUSY (1 << 4) +#define RT2860_NAV_AS_CH_BUSY (1 << 3) +#define RT2860_RX_AS_CH_BUSY (1 << 2) +#define RT2860_TX_AS_CH_BUSY (1 << 1) +#define RT2860_CH_STA_TIMER_EN (1 << 0) + +/* possible values for register BCN_TIME_CFG */ +#define RT2860_TSF_INS_COMP_SHIFT 24 +#define RT2860_BCN_TX_EN (1 << 20) +#define RT2860_TBTT_TIMER_EN (1 << 19) +#define RT2860_TSF_SYNC_MODE_SHIFT 17 +#define RT2860_TSF_SYNC_MODE_DIS 0 +#define RT2860_TSF_SYNC_MODE_STA 1 +#define RT2860_TSF_SYNC_MODE_IBSS 2 +#define RT2860_TSF_SYNC_MODE_HOSTAP 3 +#define RT2860_TSF_TIMER_EN (1 << 16) +#define RT2860_BCN_INTVAL_SHIFT 0 + +/* possible flags for register TBTT_SYNC_CFG */ +#define RT2860_BCN_CWMIN_SHIFT 20 +#define RT2860_BCN_AIFSN_SHIFT 16 +#define RT2860_BCN_EXP_WIN_SHIFT 8 +#define RT2860_TBTT_ADJUST_SHIFT 0 + +/* possible flags for register INT_TIMER_CFG */ +#define RT2860_GP_TIMER_SHIFT 16 +#define RT2860_PRE_TBTT_TIMER_SHIFT 0 + +/* possible flags for register INT_TIMER_EN */ +#define RT2860_GP_TIMER_EN (1 << 1) +#define RT2860_PRE_TBTT_INT_EN (1 << 0) + +/* possible flags for register MAC_STATUS_REG */ +#define RT2860_RX_STATUS_BUSY (1 << 1) +#define RT2860_TX_STATUS_BUSY (1 << 0) + +/* possible flags for register PWR_PIN_CFG */ +#define RT2860_IO_ADDA_PD (1 << 3) +#define RT2860_IO_PLL_PD (1 << 2) +#define RT2860_IO_RA_PE (1 << 1) +#define RT2860_IO_RF_PE (1 << 0) + +/* possible flags for register AUTO_WAKEUP_CFG */ +#define RT2860_AUTO_WAKEUP_EN (1 << 15) +#define RT2860_SLEEP_TBTT_NUM_SHIFT 8 +#define RT2860_WAKEUP_LEAD_TIME_SHIFT 0 + +/* possible flags for register TX_PIN_CFG */ +#define RT3593_LNA_PE_G2_POL (1 << 31) +#define RT3593_LNA_PE_A2_POL (1 << 30) +#define RT3593_LNA_PE_G2_EN (1 << 29) +#define RT3593_LNA_PE_A2_EN (1 << 28) +#define RT3593_LNA_PE2_EN (RT3593_LNA_PE_A2_EN | RT3593_LNA_PE_G2_EN) +#define RT3593_PA_PE_G2_POL (1 << 27) +#define RT3593_PA_PE_A2_POL (1 << 26) +#define RT3593_PA_PE_G2_EN (1 << 25) +#define RT3593_PA_PE_A2_EN (1 << 24) +#define RT2860_TRSW_POL (1 << 19) +#define RT2860_TRSW_EN (1 << 18) +#define RT2860_RFTR_POL (1 << 17) +#define RT2860_RFTR_EN (1 << 16) +#define RT2860_LNA_PE_G1_POL (1 << 15) +#define RT2860_LNA_PE_A1_POL (1 << 14) +#define RT2860_LNA_PE_G0_POL (1 << 13) +#define RT2860_LNA_PE_A0_POL (1 << 12) +#define RT2860_LNA_PE_G1_EN (1 << 11) +#define RT2860_LNA_PE_A1_EN (1 << 10) +#define RT2860_LNA_PE1_EN (RT2860_LNA_PE_A1_EN | RT2860_LNA_PE_G1_EN) +#define RT2860_LNA_PE_G0_EN (1 << 9) +#define RT2860_LNA_PE_A0_EN (1 << 8) +#define RT2860_LNA_PE0_EN (RT2860_LNA_PE_A0_EN | RT2860_LNA_PE_G0_EN) +#define RT2860_PA_PE_G1_POL (1 << 7) +#define RT2860_PA_PE_A1_POL (1 << 6) +#define RT2860_PA_PE_G0_POL (1 << 5) +#define RT2860_PA_PE_A0_POL (1 << 4) +#define RT2860_PA_PE_G1_EN (1 << 3) +#define RT2860_PA_PE_A1_EN (1 << 2) +#define RT2860_PA_PE_G0_EN (1 << 1) +#define RT2860_PA_PE_A0_EN (1 << 0) + +/* possible flags for register TX_BAND_CFG */ +#define RT2860_5G_BAND_SEL_N (1 << 2) +#define RT2860_5G_BAND_SEL_P (1 << 1) +#define RT2860_TX_BAND_SEL (1 << 0) + +/* possible flags for register TX_SW_CFG0 */ +#define RT2860_DLY_RFTR_EN_SHIFT 24 +#define RT2860_DLY_TRSW_EN_SHIFT 16 +#define RT2860_DLY_PAPE_EN_SHIFT 8 +#define RT2860_DLY_TXPE_EN_SHIFT 0 + +/* possible flags for register TX_SW_CFG1 */ +#define RT2860_DLY_RFTR_DIS_SHIFT 16 +#define RT2860_DLY_TRSW_DIS_SHIFT 8 +#define RT2860_DLY_PAPE_DIS SHIFT 0 + +/* possible flags for register TX_SW_CFG2 */ +#define RT2860_DLY_LNA_EN_SHIFT 24 +#define RT2860_DLY_LNA_DIS_SHIFT 16 +#define RT2860_DLY_DAC_EN_SHIFT 8 +#define RT2860_DLY_DAC_DIS_SHIFT 0 + +/* possible flags for register TXOP_THRES_CFG */ +#define RT2860_TXOP_REM_THRES_SHIFT 24 +#define RT2860_CF_END_THRES_SHIFT 16 +#define RT2860_RDG_IN_THRES 8 +#define RT2860_RDG_OUT_THRES 0 + +/* possible flags for register TXOP_CTRL_CFG */ +#define RT2860_EXT_CW_MIN_SHIFT 16 +#define RT2860_EXT_CCA_DLY_SHIFT 8 +#define RT2860_EXT_CCA_EN (1 << 7) +#define RT2860_LSIG_TXOP_EN (1 << 6) +#define RT2860_TXOP_TRUN_EN_MIMOPS (1 << 4) +#define RT2860_TXOP_TRUN_EN_TXOP (1 << 3) +#define RT2860_TXOP_TRUN_EN_RATE (1 << 2) +#define RT2860_TXOP_TRUN_EN_AC (1 << 1) +#define RT2860_TXOP_TRUN_EN_TIMEOUT (1 << 0) + +/* possible flags for register TX_RTS_CFG */ +#define RT2860_RTS_FBK_EN (1 << 24) +#define RT2860_RTS_THRES_SHIFT 8 +#define RT2860_RTS_RTY_LIMIT_SHIFT 0 + +/* possible flags for register TX_TIMEOUT_CFG */ +#define RT2860_TXOP_TIMEOUT_SHIFT 16 +#define RT2860_RX_ACK_TIMEOUT_SHIFT 8 +#define RT2860_MPDU_LIFE_TIME_SHIFT 4 + +/* possible flags for register TX_RTY_CFG */ +#define RT2860_TX_AUTOFB_EN (1 << 30) +#define RT2860_AGG_RTY_MODE_TIMER (1 << 29) +#define RT2860_NAG_RTY_MODE_TIMER (1 << 28) +#define RT2860_LONG_RTY_THRES_SHIFT 16 +#define RT2860_LONG_RTY_LIMIT_SHIFT 8 +#define RT2860_SHORT_RTY_LIMIT_SHIFT 0 + +/* possible flags for register TX_LINK_CFG */ +#define RT2860_REMOTE_MFS_SHIFT 24 +#define RT2860_REMOTE_MFB_SHIFT 16 +#define RT2860_TX_CFACK_EN (1 << 12) +#define RT2860_TX_RDG_EN (1 << 11) +#define RT2860_TX_MRQ_EN (1 << 10) +#define RT2860_REMOTE_UMFS_EN (1 << 9) +#define RT2860_TX_MFB_EN (1 << 8) +#define RT2860_REMOTE_MFB_LT_SHIFT 0 + +/* possible flags for registers *_PROT_CFG */ +#define RT2860_RTSTH_EN (1 << 26) +#define RT2860_TXOP_ALLOW_GF40 (1 << 25) +#define RT2860_TXOP_ALLOW_GF20 (1 << 24) +#define RT2860_TXOP_ALLOW_MM40 (1 << 23) +#define RT2860_TXOP_ALLOW_MM20 (1 << 22) +#define RT2860_TXOP_ALLOW_OFDM (1 << 21) +#define RT2860_TXOP_ALLOW_CCK (1 << 20) +#define RT2860_TXOP_ALLOW_ALL (0x3f << 20) +#define RT2860_PROT_NAV_SHORT (1 << 18) +#define RT2860_PROT_NAV_LONG (2 << 18) +#define RT2860_PROT_CTRL_RTS_CTS (1 << 16) +#define RT2860_PROT_CTRL_CTS (2 << 16) + +/* possible flags for registers EXP_{CTS,ACK}_TIME */ +#define RT2860_EXP_OFDM_TIME_SHIFT 16 +#define RT2860_EXP_CCK_TIME_SHIFT 0 + +/* possible flags for register RX_FILTR_CFG */ +#define RT2860_DROP_CTRL_RSV (1 << 16) +#define RT2860_DROP_BAR (1 << 15) +#define RT2860_DROP_BA (1 << 14) +#define RT2860_DROP_PSPOLL (1 << 13) +#define RT2860_DROP_RTS (1 << 12) +#define RT2860_DROP_CTS (1 << 11) +#define RT2860_DROP_ACK (1 << 10) +#define RT2860_DROP_CFEND (1 << 9) +#define RT2860_DROP_CFACK (1 << 8) +#define RT2860_DROP_DUPL (1 << 7) +#define RT2860_DROP_BC (1 << 6) +#define RT2860_DROP_MC (1 << 5) +#define RT2860_DROP_VER_ERR (1 << 4) +#define RT2860_DROP_NOT_MYBSS (1 << 3) +#define RT2860_DROP_UC_NOME (1 << 2) +#define RT2860_DROP_PHY_ERR (1 << 1) +#define RT2860_DROP_CRC_ERR (1 << 0) + +/* possible flags for register AUTO_RSP_CFG */ +#define RT2860_CTRL_PWR_BIT (1 << 7) +#define RT2860_BAC_ACK_POLICY (1 << 6) +#define RT2860_CCK_SHORT_EN (1 << 4) +#define RT2860_CTS_40M_REF_EN (1 << 3) +#define RT2860_CTS_40M_MODE_EN (1 << 2) +#define RT2860_BAC_ACKPOLICY_EN (1 << 1) +#define RT2860_AUTO_RSP_EN (1 << 0) + +/* possible flags for register SIFS_COST_CFG */ +#define RT2860_OFDM_SIFS_COST_SHIFT 8 +#define RT2860_CCK_SIFS_COST_SHIFT 0 + +/* possible flags for register TXOP_HLDR_ET */ +#define RT2860_TXOP_ETM1_EN (1 << 25) +#define RT2860_TXOP_ETM0_EN (1 << 24) +#define RT2860_TXOP_ETM_THRES_SHIFT 16 +#define RT2860_TXOP_ETO_EN (1 << 8) +#define RT2860_TXOP_ETO_THRES_SHIFT 1 +#define RT2860_PER_RX_RST_EN (1 << 0) + +/* possible flags for register TX_STAT_FIFO */ +#define RT2860_TXQ_MCS_SHIFT 16 +#define RT2860_TXQ_WCID_SHIFT 8 +#define RT2860_TXQ_ACKREQ (1 << 7) +#define RT2860_TXQ_AGG (1 << 6) +#define RT2860_TXQ_OK (1 << 5) +#define RT2860_TXQ_PID_SHIFT 1 +#define RT2860_TXQ_VLD (1 << 0) + +/* possible flags for register WCID_ATTR */ +#define RT2860_MODE_NOSEC 0 +#define RT2860_MODE_WEP40 1 +#define RT2860_MODE_WEP104 2 +#define RT2860_MODE_TKIP 3 +#define RT2860_MODE_AES_CCMP 4 +#define RT2860_MODE_CKIP40 5 +#define RT2860_MODE_CKIP104 6 +#define RT2860_MODE_CKIP128 7 +#define RT2860_RX_PKEY_EN (1 << 0) + +/* possible flags for register H2M_MAILBOX */ +#define RT2860_H2M_BUSY (1 << 24) +#define RT2860_TOKEN_NO_INTR 0xff + + +/* possible flags for MCU command RT2860_MCU_CMD_LEDS */ +#define RT2860_LED_RADIO (1 << 13) +#define RT2860_LED_LINK_2GHZ (1 << 14) +#define RT2860_LED_LINK_5GHZ (1 << 15) + + +/* possible flags for RT3020 RF register 1 */ +#define RT3070_RF_BLOCK (1 << 0) +#define RT3070_RX0_PD (1 << 2) +#define RT3070_TX0_PD (1 << 3) +#define RT3070_RX1_PD (1 << 4) +#define RT3070_TX1_PD (1 << 5) +#define RT3070_RX2_PD (1 << 6) +#define RT3070_TX2_PD (1 << 7) + +/* possible flags for RT3020 RF register 7 */ +#define RT3070_TUNE (1 << 0) + +/* possible flags for RT3020 RF register 15 */ +#define RT3070_TX_LO2 (1 << 3) + +/* possible flags for RT3020 RF register 17 */ +#define RT3070_TX_LO1 (1 << 3) + +/* possible flags for RT3020 RF register 20 */ +#define RT3070_RX_LO1 (1 << 3) + +/* possible flags for RT3020 RF register 21 */ +#define RT3070_RX_LO2 (1 << 3) +#define RT3070_RX_CTB (1 << 7) + +/* possible flags for RT3020 RF register 22 */ +#define RT3070_BB_LOOPBACK (1 << 0) + +/* possible flags for RT3053 RF register 1 */ +#define RT3593_VCO (1 << 0) + +/* possible flags for RT3053 RF register 2 */ +#define RT3593_RESCAL (1 << 7) + +/* possible flags for RT3053 RF register 3 */ +#define RT3593_VCOCAL (1 << 7) + +/* possible flags for RT3053 RF register 6 */ +#define RT3593_VCO_IC (1 << 6) + +/* possible flags for RT3053 RF register 20 */ +#define RT3593_LDO_PLL_VC_MASK 0x0e +#define RT3593_LDO_RF_VC_MASK 0xe0 + +/* possible flags for RT3053 RF register 22 */ +#define RT3593_CP_IC_MASK 0xe0 +#define RT3593_CP_IC_SHIFT 5 + +/* possible flags for RT3053 RF register 46 */ +#define RT3593_RX_CTB (1 << 5) + +#define RT3090_DEF_LNA 10 + +/* RT2860 TX descriptor */ +struct rt2860_txd { + uint32_t sdp0; /* Segment Data Pointer 0 */ + uint16_t sdl1; /* Segment Data Length 1 */ +#define RT2860_TX_BURST (1 << 15) +#define RT2860_TX_LS1 (1 << 14) /* SDP1 is the last segment */ + + uint16_t sdl0; /* Segment Data Length 0 */ +#define RT2860_TX_DDONE (1 << 15) +#define RT2860_TX_LS0 (1 << 14) /* SDP0 is the last segment */ + + uint32_t sdp1; /* Segment Data Pointer 1 */ + uint8_t reserved[3]; + uint8_t flags; +#define RT2860_TX_QSEL_SHIFT 1 +#define RT2860_TX_QSEL_MGMT (0 << 1) +#define RT2860_TX_QSEL_HCCA (1 << 1) +#define RT2860_TX_QSEL_EDCA (2 << 1) +#define RT2860_TX_WIV (1 << 0) +} __packed; + +/* RT2870 TX descriptor */ +struct rt2870_txd { + uint16_t len; + uint8_t pad; + uint8_t flags; +} __packed; + +/* TX Wireless Information */ +struct rt2860_txwi { + uint8_t flags; +#define RT2860_TX_MPDU_DSITY_SHIFT 5 +#define RT2860_TX_AMPDU (1 << 4) +#define RT2860_TX_TS (1 << 3) +#define RT2860_TX_CFACK (1 << 2) +#define RT2860_TX_MMPS (1 << 1) +#define RT2860_TX_FRAG (1 << 0) + + uint8_t txop; +#define RT2860_TX_TXOP_HT 0 +#define RT2860_TX_TXOP_PIFS 1 +#define RT2860_TX_TXOP_SIFS 2 +#define RT2860_TX_TXOP_BACKOFF 3 + + uint16_t phy; +#define RT2860_PHY_MODE 0xc000 +#define RT2860_PHY_CCK (0 << 14) +#define RT2860_PHY_OFDM (1 << 14) +#define RT2860_PHY_HT (2 << 14) +#define RT2860_PHY_HT_GF (3 << 14) +#define RT2860_PHY_SGI (1 << 8) +#define RT2860_PHY_BW40 (1 << 7) +#define RT2860_PHY_MCS 0x7f +#define RT2860_PHY_SHPRE (1 << 3) + + uint8_t xflags; +#define RT2860_TX_BAWINSIZE_SHIFT 2 +#define RT2860_TX_NSEQ (1 << 1) +#define RT2860_TX_ACK (1 << 0) + + uint8_t wcid; /* Wireless Client ID */ + uint16_t len; +#define RT2860_TX_PID_SHIFT 12 + + uint32_t iv; + uint32_t eiv; +} __packed; + +/* RT2860 RX descriptor */ +struct rt2860_rxd { + uint32_t sdp0; + uint16_t sdl1; /* unused */ + uint16_t sdl0; +#define RT2860_RX_DDONE (1 << 15) +#define RT2860_RX_LS0 (1 << 14) + + uint32_t sdp1; /* unused */ + uint32_t flags; +#define RT2860_RX_DEC (1 << 16) +#define RT2860_RX_AMPDU (1 << 15) +#define RT2860_RX_L2PAD (1 << 14) +#define RT2860_RX_RSSI (1 << 13) +#define RT2860_RX_HTC (1 << 12) +#define RT2860_RX_AMSDU (1 << 11) +#define RT2860_RX_MICERR (1 << 10) +#define RT2860_RX_ICVERR (1 << 9) +#define RT2860_RX_CRCERR (1 << 8) +#define RT2860_RX_MYBSS (1 << 7) +#define RT2860_RX_BC (1 << 6) +#define RT2860_RX_MC (1 << 5) +#define RT2860_RX_UC2ME (1 << 4) +#define RT2860_RX_FRAG (1 << 3) +#define RT2860_RX_NULL (1 << 2) +#define RT2860_RX_DATA (1 << 1) +#define RT2860_RX_BA (1 << 0) +} __packed; + +/* RT2870 RX descriptor */ +struct rt2870_rxd { + /* single 32-bit field */ + uint32_t flags; +} __packed; + +/* RX Wireless Information */ +struct rt2860_rxwi { + uint8_t wcid; + uint8_t keyidx; +#define RT2860_RX_UDF_SHIFT 5 +#define RT2860_RX_BSS_IDX_SHIFT 2 + + uint16_t len; +#define RT2860_RX_TID_SHIFT 12 + + uint16_t seq; + uint16_t phy; + uint8_t rssi[3]; + uint8_t reserved1; + uint8_t snr[2]; + uint16_t reserved2; +} __packed; + + +/* first DMA segment contains TXWI + 802.11 header + 32-bit padding */ +#define RT2860_TXWI_DMASZ \ + (sizeof (struct rt2860_txwi) + \ + sizeof (struct ieee80211_frame) + 6 + \ + sizeof (uint16_t)) + +#define RT2860_RF1 0 +#define RT2860_RF2 2 +#define RT2860_RF3 1 +#define RT2860_RF4 3 + +#define RT2860_RF_2820 1 /* 2T3R */ +#define RT2860_RF_2850 2 /* dual-band 2T3R */ +#define RT2860_RF_2720 3 /* 1T2R */ +#define RT2860_RF_2750 4 /* dual-band 1T2R */ +#define RT3070_RF_3020 5 /* 1T1R */ +#define RT3070_RF_2020 6 /* b/g */ +#define RT3070_RF_3021 7 /* 1T2R */ +#define RT3070_RF_3022 8 /* 2T2R */ +#define RT3070_RF_3052 9 /* dual-band 2T2R */ +#define RT3070_RF_3320 11 /* 1T1R */ +#define RT3070_RF_3053 13 /* dual-band 3T3R */ + +/* USB commands for RT2870 only */ +#define RT2870_RESET 1 +#define RT2870_WRITE_2 2 +#define RT2870_WRITE_REGION_1 6 +#define RT2870_READ_REGION_1 7 +#define RT2870_EEPROM_READ 9 + +#define RT2860_EEPROM_DELAY 1 /* minimum hold time (microsecond) */ + +#define RT2860_EEPROM_VERSION 0x01 +#define RT2860_EEPROM_MAC01 0x02 +#define RT2860_EEPROM_MAC23 0x03 +#define RT2860_EEPROM_MAC45 0x04 +#define RT2860_EEPROM_PCIE_PSLEVEL 0x11 +#define RT2860_EEPROM_REV 0x12 +#define RT2860_EEPROM_ANTENNA 0x1a +#define RT2860_EEPROM_CONFIG 0x1b +#define RT2860_EEPROM_COUNTRY 0x1c +#define RT2860_EEPROM_FREQ_LEDS 0x1d +#define RT2860_EEPROM_LED1 0x1e +#define RT2860_EEPROM_LED2 0x1f +#define RT2860_EEPROM_LED3 0x20 +#define RT2860_EEPROM_LNA 0x22 +#define RT2860_EEPROM_RSSI1_2GHZ 0x23 +#define RT2860_EEPROM_RSSI2_2GHZ 0x24 +#define RT2860_EEPROM_RSSI1_5GHZ 0x25 +#define RT2860_EEPROM_RSSI2_5GHZ 0x26 +#define RT2860_EEPROM_DELTAPWR 0x28 +#define RT2860_EEPROM_PWR2GHZ_BASE1 0x29 +#define RT2860_EEPROM_PWR2GHZ_BASE2 0x30 +#define RT2860_EEPROM_TSSI1_2GHZ 0x37 +#define RT2860_EEPROM_TSSI2_2GHZ 0x38 +#define RT2860_EEPROM_TSSI3_2GHZ 0x39 +#define RT2860_EEPROM_TSSI4_2GHZ 0x3a +#define RT2860_EEPROM_TSSI5_2GHZ 0x3b +#define RT2860_EEPROM_PWR5GHZ_BASE1 0x3c +#define RT2860_EEPROM_PWR5GHZ_BASE2 0x53 +#define RT2860_EEPROM_TSSI1_5GHZ 0x6a +#define RT2860_EEPROM_TSSI2_5GHZ 0x6b +#define RT2860_EEPROM_TSSI3_5GHZ 0x6c +#define RT2860_EEPROM_TSSI4_5GHZ 0x6d +#define RT2860_EEPROM_TSSI5_5GHZ 0x6e +#define RT2860_EEPROM_RPWR 0x6f +#define RT2860_EEPROM_BBP_BASE 0x78 +#define RT3071_EEPROM_RF_BASE 0x82 + +#define RT2860_RIDX_CCK1 0 +#define RT2860_RIDX_CCK11 3 +#define RT2860_RIDX_OFDM6 4 +#define RT2860_RIDX_MAX 11 +static const struct rt2860_rate { + uint8_t rate; + uint8_t mcs; + enum ieee80211_phytype phy; + uint8_t ctl_ridx; + uint16_t sp_ack_dur; + uint16_t lp_ack_dur; +} rt2860_rates[] = { + { 2, 0, IEEE80211_T_DS, 0, 314, 314 }, + { 4, 1, IEEE80211_T_DS, 1, 258, 162 }, + { 11, 2, IEEE80211_T_DS, 2, 223, 127 }, + { 22, 3, IEEE80211_T_DS, 3, 213, 117 }, + { 12, 0, IEEE80211_T_OFDM, 4, 60, 60 }, + { 18, 1, IEEE80211_T_OFDM, 4, 52, 52 }, + { 24, 2, IEEE80211_T_OFDM, 6, 48, 48 }, + { 36, 3, IEEE80211_T_OFDM, 6, 44, 44 }, + { 48, 4, IEEE80211_T_OFDM, 8, 44, 44 }, + { 72, 5, IEEE80211_T_OFDM, 8, 40, 40 }, + { 96, 6, IEEE80211_T_OFDM, 8, 40, 40 }, + { 108, 7, IEEE80211_T_OFDM, 8, 40, 40 } +}; + +/* + * Control and status registers access macros. + */ +#define RAL_READ(sc, reg) \ + bus_space_read_4((sc)->sc_st, (sc)->sc_sh, (reg)) + +#define RAL_WRITE(sc, reg, val) \ + bus_space_write_4((sc)->sc_st, (sc)->sc_sh, (reg), (val)) + +#define RAL_BARRIER_WRITE(sc) \ + bus_space_barrier((sc)->sc_st, (sc)->sc_sh, 0, 0x1800, \ + BUS_SPACE_BARRIER_WRITE) + +#define RAL_BARRIER_READ_WRITE(sc) \ + bus_space_barrier((sc)->sc_st, (sc)->sc_sh, 0, 0x1800, \ + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE) + +#define RAL_WRITE_REGION_1(sc, offset, datap, count) \ + bus_space_write_region_1((sc)->sc_st, (sc)->sc_sh, (offset), \ + (datap), (count)) + +#define RAL_SET_REGION_4(sc, offset, val, count) \ + bus_space_set_region_4((sc)->sc_st, (sc)->sc_sh, (offset), \ + (val), (count)) + +/* + * EEPROM access macro. + */ +#define RT2860_EEPROM_CTL(sc, val) do { \ + RAL_WRITE((sc), RT2860_PCI_EECTRL, (val)); \ + RAL_BARRIER_READ_WRITE((sc)); \ + DELAY(RT2860_EEPROM_DELAY); \ +} while (/* CONSTCOND */0) + +/* + * Default values for MAC registers; values taken from the reference driver. + */ +#define RT2860_DEF_MAC \ + { RT2860_BCN_OFFSET0, 0xf8f0e8e0 }, \ + { RT2860_LEGACY_BASIC_RATE, 0x0000013f }, \ + { RT2860_HT_BASIC_RATE, 0x00008003 }, \ + { RT2860_MAC_SYS_CTRL, 0x00000000 }, \ + { RT2860_BKOFF_SLOT_CFG, 0x00000209 }, \ + { RT2860_TX_SW_CFG0, 0x00000000 }, \ + { RT2860_TX_SW_CFG1, 0x00080606 }, \ + { RT2860_TX_LINK_CFG, 0x00001020 }, \ + { RT2860_TX_TIMEOUT_CFG, 0x000a2090 }, \ + { RT2860_LED_CFG, 0x7f031e46 }, \ + { RT2860_WMM_AIFSN_CFG, 0x00002273 }, \ + { RT2860_WMM_CWMIN_CFG, 0x00002344 }, \ + { RT2860_WMM_CWMAX_CFG, 0x000034aa }, \ + { RT2860_MAX_PCNT, 0x1f3fbf9f }, \ + { RT2860_TX_RTY_CFG, 0x47d01f0f }, \ + { RT2860_AUTO_RSP_CFG, 0x00000013 }, \ + { RT2860_CCK_PROT_CFG, 0x05740003 }, \ + { RT2860_OFDM_PROT_CFG, 0x05740003 }, \ + { RT2860_GF20_PROT_CFG, 0x01744004 }, \ + { RT2860_GF40_PROT_CFG, 0x03f44084 }, \ + { RT2860_MM20_PROT_CFG, 0x01744004 }, \ + { RT2860_MM40_PROT_CFG, 0x03f54084 }, \ + { RT2860_TXOP_CTRL_CFG, 0x0000583f }, \ + { RT2860_TXOP_HLDR_ET, 0x00000002 }, \ + { RT2860_TX_RTS_CFG, 0x00092b20 }, \ + { RT2860_EXP_ACK_TIME, 0x002400ca }, \ + { RT2860_XIFS_TIME_CFG, 0x33a41010 }, \ + { RT2860_PWR_PIN_CFG, 0x00000003 } + +/* XXX only a few registers differ from above, try to merge? */ +#define RT2870_DEF_MAC \ + { RT2860_BCN_OFFSET0, 0xf8f0e8e0 }, \ + { RT2860_LEGACY_BASIC_RATE, 0x0000013f }, \ + { RT2860_HT_BASIC_RATE, 0x00008003 }, \ + { RT2860_MAC_SYS_CTRL, 0x00000000 }, \ + { RT2860_BKOFF_SLOT_CFG, 0x00000209 }, \ + { RT2860_TX_SW_CFG0, 0x00000000 }, \ + { RT2860_TX_SW_CFG1, 0x00080606 }, \ + { RT2860_TX_LINK_CFG, 0x00001020 }, \ + { RT2860_TX_TIMEOUT_CFG, 0x000a2090 }, \ + { RT2860_LED_CFG, 0x7f031e46 }, \ + { RT2860_WMM_AIFSN_CFG, 0x00002273 }, \ + { RT2860_WMM_CWMIN_CFG, 0x00002344 }, \ + { RT2860_WMM_CWMAX_CFG, 0x000034aa }, \ + { RT2860_MAX_PCNT, 0x1f3fbf9f }, \ + { RT2860_TX_RTY_CFG, 0x47d01f0f }, \ + { RT2860_AUTO_RSP_CFG, 0x00000013 }, \ + { RT2860_CCK_PROT_CFG, 0x05740003 }, \ + { RT2860_OFDM_PROT_CFG, 0x05740003 }, \ + { RT2860_PBF_CFG, 0x00f40006 }, \ + { RT2860_WPDMA_GLO_CFG, 0x00000030 }, \ + { RT2860_GF20_PROT_CFG, 0x01744004 }, \ + { RT2860_GF40_PROT_CFG, 0x03f44084 }, \ + { RT2860_MM20_PROT_CFG, 0x01744004 }, \ + { RT2860_MM40_PROT_CFG, 0x03f44084 }, \ + { RT2860_TXOP_CTRL_CFG, 0x0000583f }, \ + { RT2860_TXOP_HLDR_ET, 0x00000002 }, \ + { RT2860_TX_RTS_CFG, 0x00092b20 }, \ + { RT2860_EXP_ACK_TIME, 0x002400ca }, \ + { RT2860_XIFS_TIME_CFG, 0x33a41010 }, \ + { RT2860_PWR_PIN_CFG, 0x00000003 } + +/* + * Default values for BBP registers; values taken from the reference driver. + */ +#define RT2860_DEF_BBP \ + { 65, 0x2c }, \ + { 66, 0x38 }, \ + { 69, 0x12 }, \ + { 70, 0x0a }, \ + { 73, 0x10 }, \ + { 81, 0x37 }, \ + { 82, 0x62 }, \ + { 83, 0x6a }, \ + { 84, 0x99 }, \ + { 86, 0x00 }, \ + { 91, 0x04 }, \ + { 92, 0x00 }, \ + { 103, 0x00 }, \ + { 105, 0x05 }, \ + { 106, 0x35 } + +/* + * Default settings for RF registers; values derived from the reference driver. + */ +#define RT2860_RF2850 \ + { 1, 0x100bb3, 0x1301e1, 0x05a014, 0x001402 }, \ + { 2, 0x100bb3, 0x1301e1, 0x05a014, 0x001407 }, \ + { 3, 0x100bb3, 0x1301e2, 0x05a014, 0x001402 }, \ + { 4, 0x100bb3, 0x1301e2, 0x05a014, 0x001407 }, \ + { 5, 0x100bb3, 0x1301e3, 0x05a014, 0x001402 }, \ + { 6, 0x100bb3, 0x1301e3, 0x05a014, 0x001407 }, \ + { 7, 0x100bb3, 0x1301e4, 0x05a014, 0x001402 }, \ + { 8, 0x100bb3, 0x1301e4, 0x05a014, 0x001407 }, \ + { 9, 0x100bb3, 0x1301e5, 0x05a014, 0x001402 }, \ + { 10, 0x100bb3, 0x1301e5, 0x05a014, 0x001407 }, \ + { 11, 0x100bb3, 0x1301e6, 0x05a014, 0x001402 }, \ + { 12, 0x100bb3, 0x1301e6, 0x05a014, 0x001407 }, \ + { 13, 0x100bb3, 0x1301e7, 0x05a014, 0x001402 }, \ + { 14, 0x100bb3, 0x1301e8, 0x05a014, 0x001404 }, \ + { 36, 0x100bb3, 0x130266, 0x056014, 0x001408 }, \ + { 38, 0x100bb3, 0x130267, 0x056014, 0x001404 }, \ + { 40, 0x100bb2, 0x1301a0, 0x056014, 0x001400 }, \ + { 44, 0x100bb2, 0x1301a0, 0x056014, 0x001408 }, \ + { 46, 0x100bb2, 0x1301a1, 0x056014, 0x001402 }, \ + { 48, 0x100bb2, 0x1301a1, 0x056014, 0x001406 }, \ + { 52, 0x100bb2, 0x1301a2, 0x056014, 0x001404 }, \ + { 54, 0x100bb2, 0x1301a2, 0x056014, 0x001408 }, \ + { 56, 0x100bb2, 0x1301a3, 0x056014, 0x001402 }, \ + { 60, 0x100bb2, 0x1301a4, 0x056014, 0x001400 }, \ + { 62, 0x100bb2, 0x1301a4, 0x056014, 0x001404 }, \ + { 64, 0x100bb2, 0x1301a4, 0x056014, 0x001408 }, \ + { 100, 0x100bb2, 0x1301ac, 0x05e014, 0x001400 }, \ + { 102, 0x100bb2, 0x1701ac, 0x15e014, 0x001404 }, \ + { 104, 0x100bb2, 0x1701ac, 0x15e014, 0x001408 }, \ + { 108, 0x100bb3, 0x17028c, 0x15e014, 0x001404 }, \ + { 110, 0x100bb3, 0x13028d, 0x05e014, 0x001400 }, \ + { 112, 0x100bb3, 0x13028d, 0x05e014, 0x001406 }, \ + { 116, 0x100bb3, 0x13028e, 0x05e014, 0x001408 }, \ + { 118, 0x100bb3, 0x13028f, 0x05e014, 0x001404 }, \ + { 120, 0x100bb1, 0x1300e0, 0x05e014, 0x001400 }, \ + { 124, 0x100bb1, 0x1300e0, 0x05e014, 0x001404 }, \ + { 126, 0x100bb1, 0x1300e0, 0x05e014, 0x001406 }, \ + { 128, 0x100bb1, 0x1300e0, 0x05e014, 0x001408 }, \ + { 132, 0x100bb1, 0x1300e1, 0x05e014, 0x001402 }, \ + { 134, 0x100bb1, 0x1300e1, 0x05e014, 0x001404 }, \ + { 136, 0x100bb1, 0x1300e1, 0x05e014, 0x001406 }, \ + { 140, 0x100bb1, 0x1300e2, 0x05e014, 0x001400 }, \ + { 149, 0x100bb1, 0x1300e2, 0x05e014, 0x001409 }, \ + { 151, 0x100bb1, 0x1300e3, 0x05e014, 0x001401 }, \ + { 153, 0x100bb1, 0x1300e3, 0x05e014, 0x001403 }, \ + { 157, 0x100bb1, 0x1300e3, 0x05e014, 0x001407 }, \ + { 159, 0x100bb1, 0x1300e3, 0x05e014, 0x001409 }, \ + { 161, 0x100bb1, 0x1300e4, 0x05e014, 0x001401 }, \ + { 165, 0x100bb1, 0x1300e4, 0x05e014, 0x001405 }, \ + { 167, 0x100bb1, 0x1300f4, 0x05e014, 0x001407 }, \ + { 169, 0x100bb1, 0x1300f4, 0x05e014, 0x001409 }, \ + { 171, 0x100bb1, 0x1300f5, 0x05e014, 0x001401 }, \ + { 173, 0x100bb1, 0x1300f5, 0x05e014, 0x001403 } + +#define RT3070_RF3052 \ + { 0xf1, 2, 2 }, \ + { 0xf1, 2, 7 }, \ + { 0xf2, 2, 2 }, \ + { 0xf2, 2, 7 }, \ + { 0xf3, 2, 2 }, \ + { 0xf3, 2, 7 }, \ + { 0xf4, 2, 2 }, \ + { 0xf4, 2, 7 }, \ + { 0xf5, 2, 2 }, \ + { 0xf5, 2, 7 }, \ + { 0xf6, 2, 2 }, \ + { 0xf6, 2, 7 }, \ + { 0xf7, 2, 2 }, \ + { 0xf8, 2, 4 }, \ + { 0x56, 0, 4 }, \ + { 0x56, 0, 6 }, \ + { 0x56, 0, 8 }, \ + { 0x57, 0, 0 }, \ + { 0x57, 0, 2 }, \ + { 0x57, 0, 4 }, \ + { 0x57, 0, 8 }, \ + { 0x57, 0, 10 }, \ + { 0x58, 0, 0 }, \ + { 0x58, 0, 4 }, \ + { 0x58, 0, 6 }, \ + { 0x58, 0, 8 }, \ + { 0x5b, 0, 8 }, \ + { 0x5b, 0, 10 }, \ + { 0x5c, 0, 0 }, \ + { 0x5c, 0, 4 }, \ + { 0x5c, 0, 6 }, \ + { 0x5c, 0, 8 }, \ + { 0x5d, 0, 0 }, \ + { 0x5d, 0, 2 }, \ + { 0x5d, 0, 4 }, \ + { 0x5d, 0, 8 }, \ + { 0x5d, 0, 10 }, \ + { 0x5e, 0, 0 }, \ + { 0x5e, 0, 4 }, \ + { 0x5e, 0, 6 }, \ + { 0x5e, 0, 8 }, \ + { 0x5f, 0, 0 }, \ + { 0x5f, 0, 9 }, \ + { 0x5f, 0, 11 }, \ + { 0x60, 0, 1 }, \ + { 0x60, 0, 5 }, \ + { 0x60, 0, 7 }, \ + { 0x60, 0, 9 }, \ + { 0x61, 0, 1 }, \ + { 0x61, 0, 3 }, \ + { 0x61, 0, 5 }, \ + { 0x61, 0, 7 }, \ + { 0x61, 0, 9 } + +#define RT3070_DEF_RF \ + { 4, 0x40 }, \ + { 5, 0x03 }, \ + { 6, 0x02 }, \ + { 7, 0x70 }, \ + { 9, 0x0f }, \ + { 10, 0x41 }, \ + { 11, 0x21 }, \ + { 12, 0x7b }, \ + { 14, 0x90 }, \ + { 15, 0x58 }, \ + { 16, 0xb3 }, \ + { 17, 0x92 }, \ + { 18, 0x2c }, \ + { 19, 0x02 }, \ + { 20, 0xba }, \ + { 21, 0xdb }, \ + { 24, 0x16 }, \ + { 25, 0x01 }, \ + { 29, 0x1f } + +#define RT3572_DEF_RF \ + { 0, 0x70 }, \ + { 1, 0x81 }, \ + { 2, 0xf1 }, \ + { 3, 0x02 }, \ + { 4, 0x4c }, \ + { 5, 0x05 }, \ + { 6, 0x4a }, \ + { 7, 0xd8 }, \ + { 9, 0xc3 }, \ + { 10, 0xf1 }, \ + { 11, 0xb9 }, \ + { 12, 0x70 }, \ + { 13, 0x65 }, \ + { 14, 0xa0 }, \ + { 15, 0x53 }, \ + { 16, 0x4c }, \ + { 17, 0x23 }, \ + { 18, 0xac }, \ + { 19, 0x93 }, \ + { 20, 0xb3 }, \ + { 21, 0xd0 }, \ + { 22, 0x00 }, \ + { 23, 0x3c }, \ + { 24, 0x16 }, \ + { 25, 0x15 }, \ + { 26, 0x85 }, \ + { 27, 0x00 }, \ + { 28, 0x00 }, \ + { 29, 0x9b }, \ + { 30, 0x09 }, \ + { 31, 0x10 } diff --git a/src/add-ons/kernel/drivers/network/wlan/ralinkwifi/dev/ral/rt2860var.h b/src/add-ons/kernel/drivers/network/wlan/ralinkwifi/dev/ral/rt2860var.h new file mode 100644 index 0000000000..653502be00 --- /dev/null +++ b/src/add-ons/kernel/drivers/network/wlan/ralinkwifi/dev/ral/rt2860var.h @@ -0,0 +1,214 @@ +/*- + * Copyright (c) 2007 Damien Bergamini + * Copyright (c) 2012 Bernhard Schmidt + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * $OpenBSD: rt2860var.h,v 1.20 2010/09/07 16:21:42 deraadt Exp $ + * $FreeBSD$ + */ + +#define RT2860_TX_RING_COUNT 64 +#define RT2860_RX_RING_COUNT 128 +#define RT2860_TX_POOL_COUNT (RT2860_TX_RING_COUNT * 2) + +#define RT2860_MAX_SCATTER ((RT2860_TX_RING_COUNT * 2) - 1) + +/* HW supports up to 255 STAs */ +#define RT2860_WCID_MAX 254 +#define RT2860_AID2WCID(aid) ((aid) & 0xff) + +struct rt2860_rx_radiotap_header { + struct ieee80211_radiotap_header wr_ihdr; + uint64_t wr_tsf; + uint8_t wr_flags; + uint8_t wr_rate; + uint16_t wr_chan_freq; + uint16_t wr_chan_flags; + uint8_t wr_antenna; + int8_t wr_antsignal; + int8_t wr_antnoise; +} __packed; + +#define RT2860_RX_RADIOTAP_PRESENT \ + ((1 << IEEE80211_RADIOTAP_TSFT) | \ + (1 << IEEE80211_RADIOTAP_FLAGS) | \ + (1 << IEEE80211_RADIOTAP_RATE) | \ + (1 << IEEE80211_RADIOTAP_CHANNEL) | \ + (1 << IEEE80211_RADIOTAP_ANTENNA) | \ + (1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL) | \ + (1 << IEEE80211_RADIOTAP_DBM_ANTNOISE)) + +struct rt2860_tx_radiotap_header { + struct ieee80211_radiotap_header wt_ihdr; + uint8_t wt_flags; + uint8_t wt_rate; + uint16_t wt_chan_freq; + uint16_t wt_chan_flags; +} __packed; + +#define RT2860_TX_RADIOTAP_PRESENT \ + ((1 << IEEE80211_RADIOTAP_FLAGS) | \ + (1 << IEEE80211_RADIOTAP_RATE) | \ + (1 << IEEE80211_RADIOTAP_CHANNEL)) + +struct rt2860_tx_data { + struct rt2860_txwi *txwi; + struct mbuf *m; + struct ieee80211_node *ni; + bus_dmamap_t map; + bus_addr_t paddr; + SLIST_ENTRY(rt2860_tx_data) next; +}; + +struct rt2860_tx_ring { + struct rt2860_txd *txd; + bus_addr_t paddr; + bus_dma_tag_t desc_dmat; + bus_dmamap_t desc_map; + bus_dma_segment_t seg; + struct rt2860_tx_data *data[RT2860_TX_RING_COUNT]; + int cur; + int next; + int queued; +}; + +struct rt2860_rx_data { + struct mbuf *m; + bus_dmamap_t map; +}; + +struct rt2860_rx_ring { + struct rt2860_rxd *rxd; + bus_addr_t paddr; + bus_dma_tag_t desc_dmat; + bus_dmamap_t desc_map; + bus_dma_tag_t data_dmat; + bus_dma_segment_t seg; + unsigned int cur; /* must be unsigned */ + struct rt2860_rx_data data[RT2860_RX_RING_COUNT]; +}; + +struct rt2860_node { + struct ieee80211_node ni; + uint8_t wcid; + uint8_t ridx[IEEE80211_RATE_MAXSIZE]; + uint8_t ctl_ridx[IEEE80211_RATE_MAXSIZE]; +}; + +struct rt2860_vap { + struct ieee80211vap ral_vap; + + int (*ral_newstate)(struct ieee80211vap *, + enum ieee80211_state, int); +}; +#define RT2860_VAP(vap) ((struct rt2860_vap *)(vap)) + +struct rt2860_softc { + struct ifnet *sc_ifp; + device_t sc_dev; + bus_space_tag_t sc_st; + bus_space_handle_t sc_sh; + + struct mtx sc_mtx; + + struct callout watchdog_ch; + + int sc_invalid; + int sc_debug; +/* + * The same in both up to here + * ------------------------------------------------ + */ + + uint16_t (*sc_srom_read)(struct rt2860_softc *, + uint16_t); + void (*sc_node_free)(struct ieee80211_node *); + + int sc_flags; +#define RT2860_ENABLED (1 << 0) +#define RT2860_ADVANCED_PS (1 << 1) +#define RT2860_PCIE (1 << 2) + + struct ieee80211_node *wcid2ni[RT2860_WCID_MAX]; + + struct rt2860_tx_ring txq[6]; + struct rt2860_rx_ring rxq; + + SLIST_HEAD(, rt2860_tx_data) data_pool; + struct rt2860_tx_data data[RT2860_TX_POOL_COUNT]; + bus_dma_tag_t txwi_dmat; + bus_dmamap_t txwi_map; + bus_dma_segment_t txwi_seg; + caddr_t txwi_vaddr; + + int sc_tx_timer; + int mgtqid; + uint8_t qfullmsk; + + uint16_t mac_ver; + uint16_t mac_rev; + uint8_t rf_rev; + uint8_t freq; + uint8_t ntxchains; + uint8_t nrxchains; + uint8_t pslevel; + int8_t txpow1[54]; + int8_t txpow2[54]; + int8_t rssi_2ghz[3]; + int8_t rssi_5ghz[3]; + uint8_t lna[4]; + uint8_t rf24_20mhz; + uint8_t rf24_40mhz; + uint8_t patch_dac; + uint8_t rfswitch; + uint8_t ext_2ghz_lna; + uint8_t ext_5ghz_lna; + uint8_t calib_2ghz; + uint8_t calib_5ghz; + uint8_t txmixgain_2ghz; + uint8_t txmixgain_5ghz; + uint8_t tssi_2ghz[9]; + uint8_t tssi_5ghz[9]; + uint8_t step_2ghz; + uint8_t step_5ghz; + struct { + uint8_t reg; + uint8_t val; + } bbp[8], rf[10]; + uint8_t leds; + uint16_t led[3]; + uint32_t txpow20mhz[5]; + uint32_t txpow40mhz_2ghz[5]; + uint32_t txpow40mhz_5ghz[5]; + + struct rt2860_rx_radiotap_header sc_rxtap; + int sc_rxtap_len; + struct rt2860_tx_radiotap_header sc_txtap; + int sc_txtap_len; + +#if defined(__HAIKU__) + uint32_t sc_intr_status; +#endif +}; + +int rt2860_attach(device_t, int); +int rt2860_detach(void *); +void rt2860_shutdown(void *); +void rt2860_suspend(void *); +void rt2860_resume(void *); +void rt2860_intr(void *); + +#define RAL_LOCK(sc) mtx_lock(&(sc)->sc_mtx) +#define RAL_LOCK_ASSERT(sc) mtx_assert(&(sc)->sc_mtx, MA_OWNED) +#define RAL_UNLOCK(sc) mtx_unlock(&(sc)->sc_mtx) diff --git a/src/add-ons/kernel/drivers/network/wlan/ralinkwifi/glue.c b/src/add-ons/kernel/drivers/network/wlan/ralinkwifi/glue.c index 53c58ef18f..e07c1b438a 100644 --- a/src/add-ons/kernel/drivers/network/wlan/ralinkwifi/glue.c +++ b/src/add-ons/kernel/drivers/network/wlan/ralinkwifi/glue.c @@ -19,13 +19,16 @@ #include #include +#include +#include HAIKU_FBSD_WLAN_DRIVER_GLUE(ralinkwifi, ral, pci) HAIKU_DRIVER_REQUIREMENTS(FBSD_TASKQUEUES | FBSD_SWI_TASKQUEUE | FBSD_WLAN); HAIKU_FIRMWARE_VERSION(0); -HAIKU_FIRMWARE_NAME_MAP(3) = {{"rt2561fw", "rt2561.bin"}, - {"rt2561sfw", "rt2561s.bin"}, {"rt2661fw", "rt2661.bin"}}; +HAIKU_FIRMWARE_NAME_MAP(4) = {{"rt2561fw", "rt2561.bin"}, + {"rt2561sfw", "rt2561s.bin"}, {"rt2661fw", "rt2661.bin"}, + {"rt2860fw", "rt2860.bin"}}; NO_HAIKU_FBSD_MII_DRIVER(); NO_HAIKU_REENABLE_INTERRUPTS(); @@ -39,21 +42,43 @@ int HAIKU_CHECK_DISABLE_INTERRUPTS(device_t dev) { struct rt2560_softc* sc = (struct rt2560_softc*)device_get_softc(dev); - // assuming that rt2560 and rt2661 share a common context data structure + // sc_ifp is common between context data structures struct ifnet* ifp = sc->sc_ifp; - if (pci_get_device(dev) == 0x0201) { - // disable interrupts - RAL_WRITE(sc, RT2560_CSR8, 0xffffffff); - } else { - // disable MAC and MCU interrupts - RAL_WRITE(sc, RT2661_INT_MASK_CSR, 0xffffff7f); - RAL_WRITE(sc, RT2661_MCU_INT_MASK_CSR, 0xffffffff); - } + switch (pci_get_device(dev)) { + case 0x0201: + // disable interrupts + RAL_WRITE(sc, RT2560_CSR8, 0xffffffff); - if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) { - // don't re-enable interrupts if we're shutting down - return 0; + if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) { + // don't re-enable interrupts if we're shutting down + return 0; + } + break; + case 0x0301: + case 0x0302: + case 0x0401: + // disable MAC and MCU interrupts + RAL_WRITE(sc, RT2661_INT_MASK_CSR, 0xffffff7f); + RAL_WRITE(sc, RT2661_MCU_INT_MASK_CSR, 0xffffffff); + + if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) { + // don't re-enable interrupts if we're shutting down + return 0; + } + break; + default: + { + uint32 r; + struct rt2860_softc* sc = + (struct rt2860_softc*)device_get_softc(dev); + r = RAL_READ(sc, RT2860_INT_STATUS); + if (r == 0 || r == 0xffffffff) + return 0; + + atomic_set((int32*)&sc->sc_intr_status, r); + break; + } } return 1; diff --git a/src/add-ons/kernel/drivers/network/wlan/wavelanwifi/dev/wi/if_wi.c b/src/add-ons/kernel/drivers/network/wlan/wavelanwifi/dev/wi/if_wi.c index e46b74866b..70574ff5d0 100644 --- a/src/add-ons/kernel/drivers/network/wlan/wavelanwifi/dev/wi/if_wi.c +++ b/src/add-ons/kernel/drivers/network/wlan/wavelanwifi/dev/wi/if_wi.c @@ -108,10 +108,10 @@ __FBSDID("$FreeBSD$"); #include #include -static struct ieee80211vap *wi_vap_create(struct ieee80211com *ic, - const char name[IFNAMSIZ], int unit, int opmode, int flags, - const uint8_t bssid[IEEE80211_ADDR_LEN], - const uint8_t mac[IEEE80211_ADDR_LEN]); +static struct ieee80211vap *wi_vap_create(struct ieee80211com *, + const char [IFNAMSIZ], int, enum ieee80211_opmode, int, + const uint8_t [IEEE80211_ADDR_LEN], + const uint8_t [IEEE80211_ADDR_LEN]); static void wi_vap_delete(struct ieee80211vap *vap); static void wi_stop_locked(struct wi_softc *sc, int disable); static void wi_start_locked(struct ifnet *); @@ -506,10 +506,10 @@ wi_detach(device_t dev) } static struct ieee80211vap * -wi_vap_create(struct ieee80211com *ic, - const char name[IFNAMSIZ], int unit, int opmode, int flags, - const uint8_t bssid[IEEE80211_ADDR_LEN], - const uint8_t mac[IEEE80211_ADDR_LEN]) +wi_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], int unit, + enum ieee80211_opmode opmode, int flags, + const uint8_t bssid[IEEE80211_ADDR_LEN], + const uint8_t mac[IEEE80211_ADDR_LEN]) { struct wi_softc *sc = ic->ic_ifp->if_softc; struct wi_vap *wvp; diff --git a/src/add-ons/kernel/network/protocols/ipv6/ipv6.cpp b/src/add-ons/kernel/network/protocols/ipv6/ipv6.cpp index 177b91faf8..0a5120fb96 100644 --- a/src/add-ons/kernel/network/protocols/ipv6/ipv6.cpp +++ b/src/add-ons/kernel/network/protocols/ipv6/ipv6.cpp @@ -1141,6 +1141,8 @@ ipv6_setsockopt(net_protocol* _protocol, int level, int option, delete protocol->multicast_address; protocol->multicast_address = (struct sockaddr*)address; + + sDatalinkModule->put_interface(interface); return B_OK; } if (option == IPV6_MULTICAST_HOPS) { diff --git a/src/add-ons/kernel/network/stack/device_interfaces.cpp b/src/add-ons/kernel/network/stack/device_interfaces.cpp index af179b2bb5..a3030f09ea 100644 --- a/src/add-ons/kernel/network/stack/device_interfaces.cpp +++ b/src/add-ons/kernel/network/stack/device_interfaces.cpp @@ -464,6 +464,8 @@ get_device_interface(const char* name, bool create) } } + close_module_list(cookie); + return NULL; } diff --git a/src/add-ons/kernel/network/stack/stack.cpp b/src/add-ons/kernel/network/stack/stack.cpp index 4b2a0a1407..9ca32c0bf4 100644 --- a/src/add-ons/kernel/network/stack/stack.cpp +++ b/src/add-ons/kernel/network/stack/stack.cpp @@ -759,6 +759,8 @@ scan_modules(const char* path) put_module(name); } } + + close_module_list(cookie); } diff --git a/src/add-ons/media/plugins/ffmpeg/AVFormatWriter.cpp b/src/add-ons/media/plugins/ffmpeg/AVFormatWriter.cpp index 1e2bcfed7d..e12a958176 100644 --- a/src/add-ons/media/plugins/ffmpeg/AVFormatWriter.cpp +++ b/src/add-ons/media/plugins/ffmpeg/AVFormatWriter.cpp @@ -363,11 +363,12 @@ AVFormatWriter::Init(const media_file_format* fileFormat) if (buffer == NULL) return B_NO_MEMORY; - // Init I/O context with buffer and hook functions, pass ourself as - // cookie. - if (init_put_byte(fIOContext, buffer, kIOBufferSize, 1, this, - 0, _Write, _Seek) != 0) { - TRACE(" init_put_byte() failed!\n"); + // Allocate I/O context and initialize it with buffer + // and hook functions, pass ourself as cookie. + fIOContext = av_alloc_put_byte(buffer, kIOBufferSize, 1, this, + 0, _Write, _Seek); + if (fIOContext == NULL) { + TRACE("av_alloc_put_byte() failed!\n"); return B_ERROR; } diff --git a/src/add-ons/opengl/swpipe/Jamfile b/src/add-ons/opengl/swpipe/Jamfile index 6d067ffc7e..4f462b6685 100644 --- a/src/add-ons/opengl/swpipe/Jamfile +++ b/src/add-ons/opengl/swpipe/Jamfile @@ -1,10 +1,7 @@ SubDir HAIKU_TOP src add-ons opengl swpipe ; +SubDirSysHdrs $(HAIKU_MESA_HEADERS) ; -UseHeaders [ FDirName $(HAIKU_MESA_DIR) src gallium auxiliary ] ; -UseHeaders [ FDirName $(HAIKU_MESA_DIR) src gallium drivers ] ; -UseHeaders [ FDirName $(HAIKU_MESA_DIR) src gallium include ] ; -UseHeaders [ FDirName $(HAIKU_MESA_DIR) src mapi ] ; -UseHeaders [ FDirName $(HAIKU_MESA_DIR) src mesa ] ; +UsePrivateHeaders interface ; local sources = SoftwareRenderer.cpp @@ -13,117 +10,36 @@ local sources = GalliumFramebuffer.cpp bitmap_wrapper.cpp ; -local HAIKU_SWPIPE_DRIVER = $(HAIKU_GALLIUM_SOFTPIPE_LIB) ; - -local llvmLibraries = ; -if $(HAIKU_LLVM_DIR) { - # TODO: Add LLVM OptionalBuildPackage - SubDirC++Flags [ FDefines HAVE_LLVM=0x0302 ] ; - - # TODO: This is a hack for now - SubDirSysHdrs /boot/common/include ; - HAIKU_LLVM_DIR = /boot/common/lib ; - - HAIKU_SWPIPE_DRIVER = $(HAIKU_GALLIUM_LLVMPIPE_LIB) ; - - llvmLibraries = - $(HAIKU_LLVM_DIR)/libLLVMAsmParser.a - $(HAIKU_LLVM_DIR)/libLLVMInstrumentation.a - $(HAIKU_LLVM_DIR)/libLLVMLinker.a - $(HAIKU_LLVM_DIR)/libLLVMArchive.a - $(HAIKU_LLVM_DIR)/libLLVMBitReader.a - $(HAIKU_LLVM_DIR)/libLLVMDebugInfo.a - $(HAIKU_LLVM_DIR)/libLLVMJIT.a - $(HAIKU_LLVM_DIR)/libLLVMipo.a - $(HAIKU_LLVM_DIR)/libLLVMVectorize.a - $(HAIKU_LLVM_DIR)/libLLVMBitWriter.a - $(HAIKU_LLVM_DIR)/libLLVMTableGen.a - $(HAIKU_LLVM_DIR)/libLLVMHexagonCodeGen.a - $(HAIKU_LLVM_DIR)/libLLVMHexagonAsmPrinter.a - $(HAIKU_LLVM_DIR)/libLLVMHexagonDesc.a - $(HAIKU_LLVM_DIR)/libLLVMHexagonInfo.a - $(HAIKU_LLVM_DIR)/libLLVMNVPTXCodeGen.a - $(HAIKU_LLVM_DIR)/libLLVMNVPTXDesc.a - $(HAIKU_LLVM_DIR)/libLLVMNVPTXInfo.a - $(HAIKU_LLVM_DIR)/libLLVMNVPTXAsmPrinter.a - $(HAIKU_LLVM_DIR)/libLLVMMBlazeCodeGen.a - $(HAIKU_LLVM_DIR)/libLLVMMBlazeAsmParser.a - $(HAIKU_LLVM_DIR)/libLLVMMBlazeDisassembler.a - $(HAIKU_LLVM_DIR)/libLLVMMBlazeDesc.a - $(HAIKU_LLVM_DIR)/libLLVMMBlazeInfo.a - $(HAIKU_LLVM_DIR)/libLLVMMBlazeAsmPrinter.a - $(HAIKU_LLVM_DIR)/libLLVMCppBackendCodeGen.a - $(HAIKU_LLVM_DIR)/libLLVMCppBackendInfo.a - $(HAIKU_LLVM_DIR)/libLLVMMSP430CodeGen.a - $(HAIKU_LLVM_DIR)/libLLVMMSP430Desc.a - $(HAIKU_LLVM_DIR)/libLLVMMSP430AsmPrinter.a - $(HAIKU_LLVM_DIR)/libLLVMMSP430Info.a - $(HAIKU_LLVM_DIR)/libLLVMXCoreCodeGen.a - $(HAIKU_LLVM_DIR)/libLLVMXCoreDesc.a - $(HAIKU_LLVM_DIR)/libLLVMXCoreInfo.a - $(HAIKU_LLVM_DIR)/libLLVMCellSPUCodeGen.a - $(HAIKU_LLVM_DIR)/libLLVMCellSPUDesc.a - $(HAIKU_LLVM_DIR)/libLLVMCellSPUInfo.a - $(HAIKU_LLVM_DIR)/libLLVMMipsAsmParser.a - $(HAIKU_LLVM_DIR)/libLLVMMipsCodeGen.a - $(HAIKU_LLVM_DIR)/libLLVMMipsDesc.a - $(HAIKU_LLVM_DIR)/libLLVMMipsAsmPrinter.a - $(HAIKU_LLVM_DIR)/libLLVMMipsDisassembler.a - $(HAIKU_LLVM_DIR)/libLLVMMipsInfo.a - $(HAIKU_LLVM_DIR)/libLLVMARMAsmParser.a - $(HAIKU_LLVM_DIR)/libLLVMARMCodeGen.a - $(HAIKU_LLVM_DIR)/libLLVMARMDisassembler.a - $(HAIKU_LLVM_DIR)/libLLVMARMDesc.a - $(HAIKU_LLVM_DIR)/libLLVMARMInfo.a - $(HAIKU_LLVM_DIR)/libLLVMARMAsmPrinter.a - $(HAIKU_LLVM_DIR)/libLLVMPowerPCCodeGen.a - $(HAIKU_LLVM_DIR)/libLLVMPowerPCDesc.a - $(HAIKU_LLVM_DIR)/libLLVMPowerPCInfo.a - $(HAIKU_LLVM_DIR)/libLLVMPowerPCAsmPrinter.a - $(HAIKU_LLVM_DIR)/libLLVMSparcCodeGen.a - $(HAIKU_LLVM_DIR)/libLLVMSparcDesc.a - $(HAIKU_LLVM_DIR)/libLLVMSparcInfo.a - $(HAIKU_LLVM_DIR)/libLLVMX86AsmParser.a - $(HAIKU_LLVM_DIR)/libLLVMX86CodeGen.a - $(HAIKU_LLVM_DIR)/libLLVMSelectionDAG.a - $(HAIKU_LLVM_DIR)/libLLVMAsmPrinter.a - $(HAIKU_LLVM_DIR)/libLLVMX86Disassembler.a - $(HAIKU_LLVM_DIR)/libLLVMX86Desc.a - $(HAIKU_LLVM_DIR)/libLLVMX86Info.a - $(HAIKU_LLVM_DIR)/libLLVMX86AsmPrinter.a - $(HAIKU_LLVM_DIR)/libLLVMX86Utils.a - $(HAIKU_LLVM_DIR)/libLLVMMCDisassembler.a - $(HAIKU_LLVM_DIR)/libLLVMMCParser.a - $(HAIKU_LLVM_DIR)/libLLVMInterpreter.a - $(HAIKU_LLVM_DIR)/libLLVMCodeGen.a - $(HAIKU_LLVM_DIR)/libLLVMScalarOpts.a - $(HAIKU_LLVM_DIR)/libLLVMInstCombine.a - $(HAIKU_LLVM_DIR)/libLLVMTransformUtils.a - $(HAIKU_LLVM_DIR)/libLLVMipa.a - $(HAIKU_LLVM_DIR)/libLLVMAnalysis.a - $(HAIKU_LLVM_DIR)/libLLVMMCJIT.a - $(HAIKU_LLVM_DIR)/libLLVMRuntimeDyld.a - $(HAIKU_LLVM_DIR)/libLLVMExecutionEngine.a - $(HAIKU_LLVM_DIR)/libLLVMTarget.a - $(HAIKU_LLVM_DIR)/libLLVMMC.a - $(HAIKU_LLVM_DIR)/libLLVMObject.a - $(HAIKU_LLVM_DIR)/libLLVMCore.a - $(HAIKU_LLVM_DIR)/libLLVMSupport.a ; -} - -UsePrivateHeaders interface ; -SubDirSysHdrs $(HAIKU_MESA_HEADERS) ; Includes [ FGristFiles $(sources) ] : $(HAIKU_MESA_HEADERS_DEPENDENCY) ; +UseHeaders [ FDirName $(HAIKU_MESA_DIR) src gallium auxiliary ] ; +UseHeaders [ FDirName $(HAIKU_MESA_DIR) src gallium drivers ] ; +UseHeaders [ FDirName $(HAIKU_MESA_DIR) src gallium include ] ; +UseHeaders [ FDirName $(HAIKU_MESA_DIR) src mapi ] ; +UseHeaders [ FDirName $(HAIKU_MESA_DIR) src mesa ] ; + AddResources Software\ Renderer : SoftwareRenderer.rdef ; +if FIsBuildFeatureEnabled(llvm) { + SubDirC++Flags [ FDefines HAVE_LLVM=0x0302 ] ; +} + +# LLVM Pipe enabled Gallium Software Renderer +# Requires: +# - LLVM optional package +# - Mesa optional package compiled with LLVM installed +# SoftPipe enabled Gallium Software Renderer +# Requires: +# - Mesa optional package compiled *without* LLVM installed Addon Software\ Renderer : $(sources) - : libGL.so - $(HAIKU_SWPIPE_DRIVER) + : + libGL.so + $(HAIKU_GALLIUM_SOFTPIPE_LIB) + $(HAIKU_GALLIUM_LLVMPIPE_LIB) $(HAIKU_MESA_LIB) $(HAIKU_GLSL_LIB) $(HAIKU_GALLIUM_LIB) - $(llvmLibraries) + $(HAIKU_LLVM_LIBS) be translation stdc++ $(TARGET_LIBSUPC++) ; diff --git a/src/add-ons/print/drivers/pdf/source/DocInfoWindow.cpp b/src/add-ons/print/drivers/pdf/source/DocInfoWindow.cpp index 393ead67e9..e1dd5e0720 100644 --- a/src/add-ons/print/drivers/pdf/source/DocInfoWindow.cpp +++ b/src/add-ons/print/drivers/pdf/source/DocInfoWindow.cpp @@ -425,7 +425,7 @@ void DocInfoWindow::_EmptyKeyList() { while (fKeyList->CountItems() > 0L) - delete fKeyList->RemoveItem(0L); + delete fKeyList->RemoveItem((int32)0); } diff --git a/src/add-ons/print/drivers/pdf/source/PrinterDriver.cpp b/src/add-ons/print/drivers/pdf/source/PrinterDriver.cpp index 9bdb410445..2ccb112c50 100644 --- a/src/add-ons/print/drivers/pdf/source/PrinterDriver.cpp +++ b/src/add-ons/print/drivers/pdf/source/PrinterDriver.cpp @@ -201,7 +201,7 @@ PrinterDriver::PrintPage(int32 pageNumber, int32 pageCount) { char text[128]; - sprintf(text, "Faking print of page %ld/%ld...", pageNumber, pageCount); + sprintf(text, "Faking print of page %" B_PRId32 "/%" B_PRId32 "...", pageNumber, pageCount); BAlert *alert = new BAlert("PrinterDriver::PrintPage()", text, "Hmm?"); alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); diff --git a/src/add-ons/screen_savers/flurry/Flurry.rdef b/src/add-ons/screen_savers/flurry/Flurry.rdef index b9a8c18122..1ffcd77e47 100644 --- a/src/add-ons/screen_savers/flurry/Flurry.rdef +++ b/src/add-ons/screen_savers/flurry/Flurry.rdef @@ -1,7 +1,7 @@ -resource app_signature "application/x-vnd.Haiku-Flurry"; +resource app_signature "application/x-vnd.Haiku-FlurryScreensaver"; -resource app_name_catalog_entry "x-vnd.Haiku-Flurry:System name:Flurry"; +resource app_name_catalog_entry "x-vnd.Haiku-FlurryScreensaver:System name:Flurry"; resource app_version { major = 1, diff --git a/src/add-ons/screen_savers/flurry/Jamfile b/src/add-ons/screen_savers/flurry/Jamfile index 18e487b6cb..1fd0cf8a97 100644 --- a/src/add-ons/screen_savers/flurry/Jamfile +++ b/src/add-ons/screen_savers/flurry/Jamfile @@ -28,7 +28,7 @@ ScreenSaver Flurry : ; DoCatalogs Flurry : - x-vnd.Haiku-Flurry + x-vnd.Haiku-FlurryScreensaver : $(sources) ; diff --git a/src/apps/bsnow/SnowView.cpp b/src/apps/bsnow/SnowView.cpp index a203ded88b..1a3765d9c7 100644 --- a/src/apps/bsnow/SnowView.cpp +++ b/src/apps/bsnow/SnowView.cpp @@ -169,7 +169,7 @@ void SnowView::AttachedToWindow() fFallenReg = new BRegion; fInvalidator = spawn_thread(SnowMakerThread, INVALIDATOR_THREAD_NAME, B_LOW_PRIORITY, (void *)this); resume_thread(fInvalidator); - printf("BSnow: OK: ws = %ld x %ld\n", fCachedWsWidth, fCachedWsHeight); + printf("BSnow: OK: ws = %" B_PRId32 " x %" B_PRId32 "\n", fCachedWsWidth, fCachedWsHeight); #ifdef DEBUG Window()->AddCommonFilter(new BMessageFilter(B_ANY_DELIVERY, B_ANY_SOURCE, msgfilter)); #endif @@ -326,7 +326,7 @@ void SnowView::Calc() if (fCachedWsWidth != pFrame.Width() || fCachedWsHeight != pFrame.Height()) { fCachedWsWidth = pFrame.IntegerWidth(); fCachedWsHeight = pFrame.IntegerHeight(); - printf("BSnow: Parent resized to %ld %ld\n", fCachedWsWidth, fCachedWsHeight); + printf("BSnow: Parent resized to %" B_PRId32 " %" B_PRId32 "\n", fCachedWsWidth, fCachedWsHeight); fFallenReg->MakeEmpty(); /* remove all the fallen snow */ ResizeTo(pFrame.IntegerWidth(), pFrame.IntegerHeight()); fDragger->MoveTo(pFrame.IntegerWidth()-7, pFrame.IntegerHeight()-7); diff --git a/src/apps/cdplayer/CDDBSupport.cpp b/src/apps/cdplayer/CDDBSupport.cpp index 4e6875ce60..d108901c2a 100644 --- a/src/apps/cdplayer/CDDBSupport.cpp +++ b/src/apps/cdplayer/CDDBSupport.cpp @@ -245,7 +245,7 @@ CDDBData::Load(const entry_ref &ref) time->SetMinutes(0); time->SetSeconds(0); - STRACE(("CDDBData::Load: Adding Track %s (%ld:%ld)\n", newTrack->String(), + STRACE(("CDDBData::Load: Adding Track %s (%" B_PRId32 ":%" B_PRId32 ")\n", newTrack->String(), time->minutes, time->seconds)); fTrackList.AddItem(newTrack); @@ -332,7 +332,8 @@ CDDBData::Save(const char *filename) BString entry; char timestring[10]; - sprintf(timestring,"%.2ld:%.2ld", fDiscTime.GetMinutes(), fDiscTime.GetSeconds()); + sprintf(timestring,"%.2" B_PRId32 ":%.2" B_PRId32 "", fDiscTime.GetMinutes(), + fDiscTime.GetSeconds()); entry << fArtist << " - " << fAlbum << "\t" << timestring << "\n"; file.Write(entry.String(), entry.Length()); @@ -351,7 +352,8 @@ CDDBData::Save(const char *filename) entry = *trackstr; - sprintf(timestring,"%.2ld:%.2ld", time->GetMinutes(), time->GetSeconds()); + sprintf(timestring,"%.2" B_PRId32 ":%.2" B_PRId32 "", time->GetMinutes(), + time->GetSeconds()); entry << "\t" << timestring << "\n"; file.Write(entry.String(), entry.Length()); @@ -361,7 +363,8 @@ CDDBData::Save(const char *filename) } file.WriteAttr("CD:key", B_INT32_TYPE, 0, &fDiscID, sizeof(int32)); - STRACE(("CDDBData::Save: Wrote CD identifier: %ld(%lx)\n", fDiscID, fDiscID)); + STRACE(("CDDBData::Save: Wrote CD identifier: %" B_PRId32 "(%" B_PRIx32 ")\n", + fDiscID, fDiscID)); file.WriteAttr("CD:tracks", B_STRING_TYPE, 0, tracksattr.String(), tracksattr.Length() + 1); if (fGenre.CountChars() > 0) @@ -391,7 +394,7 @@ CDDBData::RenameTrack(const int32 &index, const char *newName) BString *name = (BString*)fTrackList.ItemAt(index); if (name) { - STRACE(("CDDBData::RenameTrack(%ld,%s)\n", index, newName)); + STRACE(("CDDBData::RenameTrack(%" B_PRId32 ",%s)\n", index, newName)); name->SetTo(newName); return true; } @@ -409,7 +412,8 @@ CDDBData::AddTrack(const char *track, const CDAudioTime &time, STRACE(("CDDBData::AddTrack failed - NULL name\n")); return; } - STRACE(("CDDBData::AddTrack(%s, %ld:%.2ld,%d)\n", track, time.minutes, time.seconds, index)); + STRACE(("CDDBData::AddTrack(%s, %" B_PRId32 ":%.2" B_PRId32 ",%d)\n", track, + time.minutes, time.seconds, index)); fTrackList.AddItem(new BString(track)); fTimeList.AddItem(new CDAudioTime(time)); @@ -691,7 +695,7 @@ CDDBQuery::_ReadFromServer(BString &data) // Query for the existence of the disc in the database char idString[10]; - sprintf(idString, "%08lx", fCDData.DiscID()); + sprintf(idString, "%08" B_PRIx32, fCDData.DiscID()); BString query; int32 trackCount = GetTrackCount(&fSCSIData); diff --git a/src/apps/charactermap/CharacterWindow.cpp b/src/apps/charactermap/CharacterWindow.cpp index 3f222884e8..05b5b433cc 100644 --- a/src/apps/charactermap/CharacterWindow.cpp +++ b/src/apps/charactermap/CharacterWindow.cpp @@ -60,7 +60,7 @@ public: protected: const char* UpdateText() const { - snprintf(fText, sizeof(fText), "%ldpt", Value()); + snprintf(fText, sizeof(fText), "%" B_PRId32 "pt", Value()); return fText; } @@ -310,7 +310,7 @@ CharacterWindow::MessageReceived(BMessage* message) sizeof(utf8Hex)); char text[128]; - snprintf(text, sizeof(text), " %s: %#lx (%ld), UTF-8: %s", + snprintf(text, sizeof(text), " %s: %#" B_PRIx32 " (%" B_PRId32 "), UTF-8: %s", B_TRANSLATE("Code"), character, character, utf8Hex); char glyph[20]; diff --git a/src/apps/cortex/TransportView/TransportView.cpp b/src/apps/cortex/TransportView/TransportView.cpp index 9dc1ef5748..925cec47ab 100644 --- a/src/apps/cortex/TransportView/TransportView.cpp +++ b/src/apps/cortex/TransportView/TransportView.cpp @@ -528,7 +528,7 @@ void TransportView::_selectGroup( err = m_manager->findGroup(groupID, &m_group); if(err < B_OK) { PRINT(( - "* TransportView::_selectGroup(%ld): findGroup() failed:\n" + "* TransportView::_selectGroup(%" B_PRId32 "): findGroup() failed:\n" " %s\n", groupID, strerror(err))); @@ -784,7 +784,7 @@ void TransportView::_populateTimeSourceMenu( B_RAW_TYPE, &r->node(), sizeof(media_node)); - sprintf(nameBuffer, "%s: %ld", + sprintf(nameBuffer, "%s: %" B_PRId32, r->name(), r->id()); i = new BMenuItem( @@ -1088,12 +1088,12 @@ void TransportView::_timeSourceCreated( if(err < B_OK) return; -// PRINT(("### _timeSourceCreated(): %ld\n", id)); +// PRINT(("### _timeSourceCreated(): %" B_PRId32 "\n", id)); NodeRef* ref; err = m_manager->getNodeRef(id, &ref); if(err < B_OK) { PRINT(( - "!!! TransportView::_timeSourceCreated(): node %ld doesn't exist\n", + "!!! TransportView::_timeSourceCreated(): node %" B_PRId32 " doesn't exist\n", id)); return; } @@ -1105,7 +1105,7 @@ void TransportView::_timeSourceCreated( B_RAW_TYPE, &ref->node(), sizeof(media_node)); - sprintf(nameBuffer, "%s: %ld", + sprintf(nameBuffer, "%s: %" B_PRId32, ref->name(), ref->id()); BMenuItem* i = new BMenuItem( @@ -1126,7 +1126,7 @@ void TransportView::_timeSourceDeleted( if(err < B_OK) return; -// PRINT(("### _timeSourceDeleted(): %ld\n", id)); +// PRINT(("### _timeSourceDeleted(): %" B_PRId32 "\n", id)); BMenu* menu = m_timeSourceView->Menu(); ASSERT(menu); diff --git a/src/apps/debugger/arch/Architecture.cpp b/src/apps/debugger/arch/Architecture.cpp index c1724f78ec..42fd88eea9 100644 --- a/src/apps/debugger/arch/Architecture.cpp +++ b/src/apps/debugger/arch/Architecture.cpp @@ -194,6 +194,9 @@ Architecture::CreateStackTrace(Team* team, break; } + if (stackTrace->CountFrames() == 0) + return B_ERROR; + stackTraceDeleter.Detach(); _stackTrace = stackTrace; return B_OK; diff --git a/src/apps/debugger/arch/x86_64/ArchitectureX8664.cpp b/src/apps/debugger/arch/x86_64/ArchitectureX8664.cpp index 05ba2a4315..3c27c878e9 100644 --- a/src/apps/debugger/arch/x86_64/ArchitectureX8664.cpp +++ b/src/apps/debugger/arch/x86_64/ArchitectureX8664.cpp @@ -470,9 +470,8 @@ status_t ArchitectureX8664::GetInstructionInfo(target_addr_t address, InstructionInfo& _info, CpuState* state) { - // read the code + // read the code - maximum x86{-64} instruction size = 15 bytes uint8 buffer[16]; - // TODO: What's the maximum instruction size? ssize_t bytesRead = fTeamMemory->ReadMemory(address, buffer, sizeof(buffer)); if (bytesRead < 0) @@ -484,37 +483,7 @@ ArchitectureX8664::GetInstructionInfo(target_addr_t address, if (error != B_OK) return error; - // disassemble the instruction - BString line; - target_addr_t instructionAddress; - target_addr_t targetAddress = 0; - target_size_t instructionSize; - bool breakpointAllowed; - error = disassembler.GetNextInstruction(line, instructionAddress, - instructionSize, breakpointAllowed); - if (error != B_OK) - return error; - - // FIXME: Is this correct for x86_64? I'm not entirely sure. - instruction_type instructionType = INSTRUCTION_TYPE_OTHER; - if (buffer[0] == 0xff && (buffer[1] & 0x34) == 0x10) { - // absolute call with r/m32 - instructionType = INSTRUCTION_TYPE_SUBROUTINE_CALL; - } else if (buffer[0] == 0xe8 && instructionSize == 5) { - // relative call with rel32 -- don't categorize the call with 0 as - // subroutine call, since it is only used to get the address of the GOT - if (buffer[1] != 0 || buffer[2] != 0 || buffer[3] != 0 - || buffer[4] != 0) { - instructionType = INSTRUCTION_TYPE_SUBROUTINE_CALL; - } - } - - if (!_info.SetTo(instructionAddress, targetAddress, instructionSize, - instructionType, breakpointAllowed, line)) { - return B_NO_MEMORY; - } - - return B_OK; + return disassembler.GetNextInstructionInfo(_info, state); } diff --git a/src/apps/debugger/arch/x86_64/disasm/DisassemblerX8664.cpp b/src/apps/debugger/arch/x86_64/disasm/DisassemblerX8664.cpp index 7122943d11..07424ce51b 100644 --- a/src/apps/debugger/arch/x86_64/disasm/DisassemblerX8664.cpp +++ b/src/apps/debugger/arch/x86_64/disasm/DisassemblerX8664.cpp @@ -14,6 +14,46 @@ #include +#include "CpuStateX8664.h" +#include "InstructionInfo.h" + + +static uint8 RegisterNumberFromUdisIndex(int32 udisIndex) +{ + switch (udisIndex) { + case UD_R_RIP: return X86_64_REGISTER_RIP; + case UD_R_RSP: return X86_64_REGISTER_RSP; + case UD_R_RBP: return X86_64_REGISTER_RBP; + + case UD_R_RAX: return X86_64_REGISTER_RAX; + case UD_R_RBX: return X86_64_REGISTER_RBX; + case UD_R_RCX: return X86_64_REGISTER_RCX; + case UD_R_RDX: return X86_64_REGISTER_RDX; + + case UD_R_RSI: return X86_64_REGISTER_RSI; + case UD_R_RDI: return X86_64_REGISTER_RDI; + + case UD_R_R8: return X86_64_REGISTER_R8; + case UD_R_R9: return X86_64_REGISTER_R9; + case UD_R_R10: return X86_64_REGISTER_R10; + case UD_R_R11: return X86_64_REGISTER_R11; + case UD_R_R12: return X86_64_REGISTER_R12; + case UD_R_R13: return X86_64_REGISTER_R13; + case UD_R_R14: return X86_64_REGISTER_R14; + case UD_R_R15: return X86_64_REGISTER_R15; + + case UD_R_CS: return X86_64_REGISTER_CS; + case UD_R_DS: return X86_64_REGISTER_DS; + case UD_R_ES: return X86_64_REGISTER_ES; + case UD_R_FS: return X86_64_REGISTER_FS; + case UD_R_GS: return X86_64_REGISTER_GS; + case UD_R_SS: return X86_64_REGISTER_SS; + } + + return X86_64_INT_REGISTER_END; +} + + struct DisassemblerX8664::UdisData : ud_t { }; @@ -109,3 +149,85 @@ DisassemblerX8664::GetPreviousInstruction(target_addr_t nextAddress, } } } + + +status_t +DisassemblerX8664::GetNextInstructionInfo(InstructionInfo& _info, + CpuState* state) +{ + unsigned int size = ud_disassemble(fUdisData); + if (size < 1) + return B_ENTRY_NOT_FOUND; + + uint32 address = (uint32)ud_insn_off(fUdisData); + + instruction_type type = INSTRUCTION_TYPE_OTHER; + target_addr_t targetAddress = 0; + + if (fUdisData->mnemonic == UD_Icall) + type = INSTRUCTION_TYPE_SUBROUTINE_CALL; + else if (fUdisData->mnemonic == UD_Ijmp) + type = INSTRUCTION_TYPE_JUMP; + if (state != NULL) + targetAddress = GetInstructionTargetAddress(state); + + char buffer[256]; + snprintf(buffer, sizeof(buffer), "0x%08" B_PRIx32 ": %16.16s %s", address, + ud_insn_hex(fUdisData), ud_insn_asm(fUdisData)); + // TODO: Resolve symbols! + + if (!_info.SetTo(address, targetAddress, size, type, true, buffer)) + return B_NO_MEMORY; + + return B_OK; +} + + +target_addr_t +DisassemblerX8664::GetInstructionTargetAddress(CpuState* state) const +{ + if (fUdisData->mnemonic != UD_Icall && fUdisData->mnemonic != UD_Ijmp) + return 0; + + CpuStateX8664* x64State = dynamic_cast(state); + if (x64State == NULL) + return 0; + + target_addr_t targetAddress = 0; + switch (fUdisData->operand[0].type) { + case UD_OP_REG: + { + targetAddress = x64State->IntRegisterValue( + RegisterNumberFromUdisIndex(fUdisData->operand[0].base)); + targetAddress += fUdisData->operand[0].offset; + } + break; + case UD_OP_MEM: + { + targetAddress = x64State->IntRegisterValue( + RegisterNumberFromUdisIndex(fUdisData->operand[0].base)); + targetAddress += x64State->IntRegisterValue( + RegisterNumberFromUdisIndex(fUdisData->operand[0].index)) + * fUdisData->operand[0].scale; + } + break; + case UD_OP_JIMM: + { + targetAddress = ud_insn_off(fUdisData) + + fUdisData->operand[0].lval.sdword + ud_insn_len(fUdisData); + } + break; + + case UD_OP_IMM: + case UD_OP_CONST: + { + targetAddress = fUdisData->operand[0].lval.udword; + } + break; + + default: + break; + } + + return targetAddress; +} diff --git a/src/apps/debugger/arch/x86_64/disasm/DisassemblerX8664.h b/src/apps/debugger/arch/x86_64/disasm/DisassemblerX8664.h index af045f4b7b..9a61a9508e 100644 --- a/src/apps/debugger/arch/x86_64/disasm/DisassemblerX8664.h +++ b/src/apps/debugger/arch/x86_64/disasm/DisassemblerX8664.h @@ -11,6 +11,10 @@ #include "Types.h" +class CpuState; +class InstructionInfo; + + class DisassemblerX8664 { public: DisassemblerX8664(); @@ -27,7 +31,13 @@ public: target_addr_t nextAddress, target_addr_t& _address, target_size_t& _size); + virtual status_t GetNextInstructionInfo( + InstructionInfo& _info, + CpuState* state); +private: + target_addr_t GetInstructionTargetAddress( + CpuState* state) const; private: struct UdisData; diff --git a/src/apps/debugger/arch/x86_64/disasm/Jamfile b/src/apps/debugger/arch/x86_64/disasm/Jamfile index 7abcbb21b7..7424d3d780 100644 --- a/src/apps/debugger/arch/x86_64/disasm/Jamfile +++ b/src/apps/debugger/arch/x86_64/disasm/Jamfile @@ -3,9 +3,12 @@ SubDir HAIKU_TOP src apps debugger arch x86_64 disasm ; CCFLAGS += -Werror ; C++FLAGS += -Werror ; +UsePrivateHeaders shared ; + UseHeaders [ LibraryHeaders udis86 ] ; UseHeaders [ LibraryHeaders [ FDirName udis86 libudis86 ] ] ; +SubDirHdrs [ FDirName $(SUBDIR) $(DOTDOT) ] ; SubDirHdrs [ FDirName $(SUBDIR) $(DOTDOT) $(DOTDOT) ] ; SubDirHdrs [ FDirName $(SUBDIR) $(DOTDOT) $(DOTDOT) $(DOTDOT) types ] ; diff --git a/src/apps/deskbar/BarApp.h b/src/apps/deskbar/BarApp.h index 0427150583..86535daa73 100644 --- a/src/apps/deskbar/BarApp.h +++ b/src/apps/deskbar/BarApp.h @@ -103,6 +103,7 @@ struct clock_settings { bool showTimeZone; }; + class BFile; class BList; class BBitmap; @@ -110,66 +111,68 @@ class PreferencesWindow; class TBarView; class TBarWindow; - class BarTeamInfo { public: - BarTeamInfo(BList* teams, uint32 flags, char* sig, BBitmap* icon, - char* name); - BarTeamInfo(const BarTeamInfo &info); - ~BarTeamInfo(); + BarTeamInfo(BList* teams, uint32 flags, + char* sig, BBitmap* icon, char* name); + BarTeamInfo(const BarTeamInfo &info); + ~BarTeamInfo(); - BList* teams; - uint32 flags; - char* sig; - BBitmap* icon; - char* name; + BList* teams; + uint32 flags; + char* sig; + BBitmap* icon; + char* name; }; - class TBarApp : public BApplication { - public: - TBarApp(); - virtual ~TBarApp(); +public: + TBarApp(); + virtual ~TBarApp(); - virtual bool QuitRequested(); - virtual void MessageReceived(BMessage* message); - virtual void RefsReceived(BMessage* refs); + virtual bool QuitRequested(); + virtual void MessageReceived(BMessage* message); + virtual void RefsReceived(BMessage* refs); - desk_settings* Settings() { return &fSettings; } - clock_settings* ClockSettings() { return &fClockSettings; } - TBarView* BarView() const { return fBarView; } - TBarWindow* BarWindow() const { return fBarWindow; } + desk_settings* Settings() { return &fSettings; } + clock_settings* ClockSettings() { return &fClockSettings; } - static void Subscribe(const BMessenger &subscriber, BList*); - static void Unsubscribe(const BMessenger &subscriber); - int32 IconSize(); + TBarView* BarView() const { return fBarView; } + TBarWindow* BarWindow() const { return fBarWindow; } - private: - void AddTeam(team_id team, uint32 flags, const char* sig, entry_ref*); - void RemoveTeam(team_id); + static void Subscribe(const BMessenger &subscriber, + BList*); + static void Unsubscribe(const BMessenger &subscriber); - void InitSettings(); - void SaveSettings(); + int32 IconSize(); - void ShowPreferencesWindow(); - void ResizeTeamIcons(); - void FetchAppIcon(const char* signature, BBitmap* icon); - BRect IconRect(); +private: + void AddTeam(team_id team, uint32 flags, + const char* sig, entry_ref*); + void RemoveTeam(team_id); - TBarWindow* fBarWindow; - TBarView* fBarView; - BMessenger fSwitcherMessenger; - BMessenger fStatusViewMessenger; - BFile* fSettingsFile; - BFile* fClockSettingsFile; - desk_settings fSettings; - clock_settings fClockSettings; + void InitSettings(); + void SaveSettings(); - PreferencesWindow* fPreferencesWindow; + void ShowPreferencesWindow(); + void ResizeTeamIcons(); + void FetchAppIcon(const char* signature, + BBitmap* icon); - static BLocker sSubscriberLock; - static BList sBarTeamInfoList; - static BList sSubscribers; + BRect IconRect(); + TBarWindow* fBarWindow; + TBarView* fBarView; + BMessenger fSwitcherMessenger; + BMessenger fStatusViewMessenger; + BFile* fSettingsFile; + BFile* fClockSettingsFile; + desk_settings fSettings; + clock_settings fClockSettings; + PreferencesWindow* fPreferencesWindow; + + static BLocker sSubscriberLock; + static BList sBarTeamInfoList; + static BList sSubscribers; }; diff --git a/src/apps/deskbar/PreferencesWindow.cpp b/src/apps/deskbar/PreferencesWindow.cpp index eb4fcf6ff9..5312603937 100644 --- a/src/apps/deskbar/PreferencesWindow.cpp +++ b/src/apps/deskbar/PreferencesWindow.cpp @@ -12,7 +12,6 @@ #include -#include #include #include #include @@ -25,10 +24,9 @@ #include #include #include -#include #include #include -#include +#include #include #include @@ -36,29 +34,6 @@ #include "StatusView.h" -namespace BPrivate { - -class SettingsItem : public BStringItem { - public: - SettingsItem(const char* label, BView* view) - : - BStringItem(label), - fSettingsView(view) - { - } - - BView* View() - { - return fSettingsView; - } - - private: - BView* fSettingsView; -}; - -} // namespace BPrivate - - static const float kIndentSpacing = be_control_look->DefaultItemSpacing() * 2.3; static const uint32 kSettingsViewChanged = 'Svch'; @@ -73,15 +48,6 @@ PreferencesWindow::PreferencesWindow(BRect frame) BWindow(frame, B_TRANSLATE("Deskbar preferences"), B_TITLED_WINDOW, B_NOT_RESIZABLE | B_AUTO_UPDATE_SIZE_LIMITS | B_NOT_ZOOMABLE) { - // Main view controls - fSettingsTypeListView = new BListView("List View", - B_SINGLE_SELECTION_LIST); - - BScrollView* scrollView = new BScrollView("scrollview", - fSettingsTypeListView, 0, false, true); - - fSettingsContainerBox = new BBox("SettingsContainerBox"); - // Menu controls fMenuRecentDocuments = new BCheckBox(B_TRANSLATE("Recent documents:"), new BMessage(kUpdateRecentCounts)); @@ -223,6 +189,7 @@ PreferencesWindow::PreferencesWindow(BRect frame) B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING) .End() .View(); + menuSettingsView->SetName(B_TRANSLATE("Menu")); BView* applicationsSettingsView = BLayoutBuilder::Group<>() .AddGroup(B_VERTICAL, 0) @@ -243,6 +210,7 @@ PreferencesWindow::PreferencesWindow(BRect frame) B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING) .End() .View(); + applicationsSettingsView->SetName(B_TRANSLATE("Applications")); BView* windowSettingsView = BLayoutBuilder::Group<>() .AddGroup(B_VERTICAL, 0) @@ -254,33 +222,18 @@ PreferencesWindow::PreferencesWindow(BRect frame) B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING) .End() .View(); + windowSettingsView->SetName(B_TRANSLATE("Window")); + + BTabView* tabView = new BTabView("tabview", B_WIDTH_FROM_LABEL); + tabView->AddTab(menuSettingsView); + tabView->AddTab(applicationsSettingsView); + tabView->AddTab(windowSettingsView); BLayoutBuilder::Group<>(this) - .AddGroup(B_HORIZONTAL, B_USE_DEFAULT_SPACING) - .Add(scrollView) - .Add(fSettingsContainerBox) - .SetInsets(B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING, - B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING) + .Add(tabView) + .SetInsets(B_USE_DEFAULT_SPACING) .End(); - fSettingsTypeListView->AddItem(new SettingsItem(B_TRANSLATE("Menu"), - menuSettingsView)); - fSettingsTypeListView->AddItem(new SettingsItem(B_TRANSLATE("Applications"), - applicationsSettingsView)); - fSettingsTypeListView->AddItem(new SettingsItem(B_TRANSLATE("Window"), - windowSettingsView)); - - // constraint the listview width so that the longest item fits - float width = 0; - fSettingsTypeListView->GetPreferredSize(&width, NULL); - width += B_V_SCROLL_BAR_WIDTH; - fSettingsTypeListView->SetExplicitMinSize(BSize(width, 0)); - fSettingsTypeListView->SetExplicitMaxSize(BSize(width, B_SIZE_UNLIMITED)); - - fSettingsTypeListView->SetSelectionMessage( - new BMessage(kSettingsViewChanged)); - fSettingsTypeListView->Select(0); - CenterOnScreen(); } @@ -312,10 +265,6 @@ PreferencesWindow::MessageReceived(BMessage* message) EnableDisableDependentItems(); break; - case kSettingsViewChanged: - _HandleChangedSettingsView(); - break; - default: BWindow::MessageReceived(message); break; @@ -388,35 +337,3 @@ PreferencesWindow::EnableDisableDependentItems() fWindowAutoRaise->SetEnabled( fWindowAlwaysOnTop->Value() == B_CONTROL_OFF); } - - -// #pragma mark - - - -void -PreferencesWindow::_HandleChangedSettingsView() -{ - int32 currentSelection = fSettingsTypeListView->CurrentSelection(); - if (currentSelection < 0) - return; - - BView* oldView = fSettingsContainerBox->ChildAt(0); - - if (oldView != NULL) - oldView->RemoveSelf(); - - SettingsItem* selectedItem = - dynamic_cast - (fSettingsTypeListView->ItemAt(currentSelection)); - - if (selectedItem != NULL) { - fSettingsContainerBox->SetLabel(selectedItem->Text()); - - BView* view = selectedItem->View(); - view->SetViewColor(fSettingsContainerBox->ViewColor()); - view->Hide(); - fSettingsContainerBox->AddChild(view); - - view->Show(); - } -} diff --git a/src/apps/deskbar/PreferencesWindow.h b/src/apps/deskbar/PreferencesWindow.h index 6d07e58eb5..3f0540d010 100644 --- a/src/apps/deskbar/PreferencesWindow.h +++ b/src/apps/deskbar/PreferencesWindow.h @@ -22,13 +22,9 @@ const uint32 kResizeTeamIcons = 'RTIs'; const uint32 kAutoRaise = 'AtRs'; const uint32 kAutoHide = 'AtHd'; -class BBox; -class BButton; class BCheckBox; -class BListView; class BRadioButton; class BSlider; -class BStringView; class BTextControl; class PreferencesWindow : public BWindow @@ -37,19 +33,14 @@ public: PreferencesWindow(BRect frame); ~PreferencesWindow(); - virtual void MessageReceived(BMessage* message); - virtual bool QuitRequested(); - virtual void WindowActivated(bool active); + virtual void MessageReceived(BMessage* message); + virtual bool QuitRequested(); + virtual void WindowActivated(bool active); - void UpdateRecentCounts(); - void EnableDisableDependentItems(); + void UpdateRecentCounts(); + void EnableDisableDependentItems(); private: - void _HandleChangedSettingsView(); - - BListView* fSettingsTypeListView; - BBox* fSettingsContainerBox; - BCheckBox* fMenuRecentDocuments; BCheckBox* fMenuRecentApplications; BCheckBox* fMenuRecentFolders; diff --git a/src/apps/deskcalc/DeskCalc.cpp b/src/apps/deskcalc/DeskCalc.cpp index 7b97aa8b83..af78d8ebe3 100644 --- a/src/apps/deskcalc/DeskCalc.cpp +++ b/src/apps/deskcalc/DeskCalc.cpp @@ -38,7 +38,7 @@ main(int argc, char* argv[]) BString result = parser.Evaluate(expression.String()); printf("%s\n", result.String()); } catch (ParseException e) { - printf("%s at %ld\n", e.message.String(), e.position + 1); + printf("%s at %" B_PRId32 "\n", e.message.String(), e.position + 1); return 1; } } diff --git a/src/apps/deskcalc/ExpressionTextView.cpp b/src/apps/deskcalc/ExpressionTextView.cpp index b9e948b357..ae27e55553 100644 --- a/src/apps/deskcalc/ExpressionTextView.cpp +++ b/src/apps/deskcalc/ExpressionTextView.cpp @@ -373,7 +373,7 @@ ExpressionTextView::AddExpressionToHistory(const char* expression) return; } while (fPreviousExpressions.CountItems() > kMaxPreviousExpressions) - delete (BString*)fPreviousExpressions.RemoveItem(0L); + delete (BString*)fPreviousExpressions.RemoveItem((int32)0); fHistoryPos = fPreviousExpressions.CountItems(); } diff --git a/src/apps/fontdemo/ControlView.cpp b/src/apps/fontdemo/ControlView.cpp index 771e8400b2..80e069a49a 100644 --- a/src/apps/fontdemo/ControlView.cpp +++ b/src/apps/fontdemo/ControlView.cpp @@ -380,7 +380,7 @@ ControlView::MessageReceived(BMessage* msg) printf("Failed to add style or family to the message\n"); return; } - printf("InstalledStyles(%ld), Font(%s), Style(%s)\n", + printf("InstalledStyles(%" B_PRId32 "), Font(%s), Style(%s)\n", installedStyles, newFontFamilyItem->Label(), newstyleitem->Label()); _UpdateAndSendStyle(msg); diff --git a/src/apps/fontdemo/Jamfile b/src/apps/fontdemo/Jamfile index 616621f2b0..81bfb02757 100644 --- a/src/apps/fontdemo/Jamfile +++ b/src/apps/fontdemo/Jamfile @@ -17,8 +17,3 @@ DoCatalogs FontDemo : ControlView.cpp FontDemoView.cpp ; - -AddCatalogEntryAttribute FontDemo - : - x-vnd.Haiku-FontDemo:FontDemo:FontDemo -; diff --git a/src/apps/installer/InstallerApp.cpp b/src/apps/installer/InstallerApp.cpp index 22b7ee6e1b..8f16d34015 100644 --- a/src/apps/installer/InstallerApp.cpp +++ b/src/apps/installer/InstallerApp.cpp @@ -10,9 +10,12 @@ #include #include #include +#include #include #include +#include "tracker_private.h" + static const uint32 kMsgAgree = 'agre'; @@ -183,7 +186,7 @@ InstallerApp::ReadyToRun() infoText << B_TRANSLATE( "NOTE: While the naming strategy for hard disks is still as described " "under 2.1) the naming scheme for partitions has changed.\n\n"); - infoText << B_TRANSLATE( + infoText << B_TRANSLATE( "GRUB's naming scheme is still: (hdN,n)\n\n"); infoText << B_TRANSLATE( "All hard disks start with \"hd\".\n"); @@ -250,8 +253,11 @@ InstallerApp::ReadyToRun() BRect eulaFrame = BRect(0, 0, 600, 450); fEULAWindow = new BWindow(eulaFrame, B_TRANSLATE("README"), - B_MODAL_WINDOW, B_NOT_ZOOMABLE | B_NOT_MINIMIZABLE - | B_AUTO_UPDATE_SIZE_LIMITS); + B_MODAL_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL, B_NOT_ZOOMABLE + | B_NOT_MINIMIZABLE | B_AUTO_UPDATE_SIZE_LIMITS); + + if (!be_roster->IsRunning(kTrackerSignature)) + fEULAWindow->SetWorkspaces(B_ALL_WORKSPACES); BLayoutBuilder::Group<>(fEULAWindow, B_VERTICAL, 10) .SetInsets(10) diff --git a/src/apps/installer/InstallerWindow.cpp b/src/apps/installer/InstallerWindow.cpp index 4dd4899640..251f4f57e3 100644 --- a/src/apps/installer/InstallerWindow.cpp +++ b/src/apps/installer/InstallerWindow.cpp @@ -165,6 +165,9 @@ InstallerWindow::InstallerWindow() fWorkerThread(new WorkerThread(this)), fCopyEngineCancelSemaphore(-1) { + if (!be_roster->IsRunning(kTrackerSignature)) + SetWorkspaces(B_ALL_WORKSPACES); + LogoView* logoView = new LogoView(); fStatusView = new BTextView("statusView", be_plain_font, NULL, diff --git a/src/apps/mediaconverter/MediaConverterApp.cpp b/src/apps/mediaconverter/MediaConverterApp.cpp index 67af42588b..76572ad7eb 100644 --- a/src/apps/mediaconverter/MediaConverterApp.cpp +++ b/src/apps/mediaconverter/MediaConverterApp.cpp @@ -525,10 +525,10 @@ MediaConverterApp::_ConvertFile(BMediaFile* inFile, BMediaFile* outFile, for (int64 i = start; (i <= end) && !fCancel; i += framesRead) { if ((ret = inVidTrack->ReadFrames(videoBuffer, &framesRead, &mh)) != B_OK) { - fprintf(stderr, "Error reading video frame %Ld: %s\n", i, + fprintf(stderr, "Error reading video frame %" B_PRId64 ": %s\n", i, strerror(ret)); snprintf(status.LockBuffer(128), 128, - B_TRANSLATE("Error read video frame %Ld"), i); + B_TRANSLATE("Error read video frame %" B_PRId64), i); status.UnlockBuffer(); SetStatusMessage(status.String()); @@ -537,10 +537,10 @@ MediaConverterApp::_ConvertFile(BMediaFile* inFile, BMediaFile* outFile, if ((ret = outVidTrack->WriteFrames(videoBuffer, framesRead, mh.u.encoded_video.field_flags)) != B_OK) { - fprintf(stderr, "Error writing video frame %Ld: %s\n", i, + fprintf(stderr, "Error writing video frame %" B_PRId64 ": %s\n", i, strerror(ret)); snprintf(status.LockBuffer(128), 128, - B_TRANSLATE("Error writing video frame %Ld"), i); + B_TRANSLATE("Error writing video frame %" B_PRId64), i); status.UnlockBuffer(); SetStatusMessage(status.String()); @@ -551,7 +551,7 @@ MediaConverterApp::_ConvertFile(BMediaFile* inFile, BMediaFile* outFile, if (currPercent > lastPercent) { lastPercent = currPercent; snprintf(status.LockBuffer(128), 128, - B_TRANSLATE("Writing video track: %ld%% complete"), + B_TRANSLATE("Writing video track: %" B_PRId32 "%% complete"), currPercent); status.UnlockBuffer(); SetStatusMessage(status.String()); @@ -587,7 +587,7 @@ MediaConverterApp::_ConvertFile(BMediaFile* inFile, BMediaFile* outFile, &mh)) != B_OK) { fprintf(stderr, "Error reading audio frames: %s\n", strerror(ret)); snprintf(status.LockBuffer(128), 128, - B_TRANSLATE("Error read audio frame %Ld"), i); + B_TRANSLATE("Error read audio frame %" B_PRId64), i); status.UnlockBuffer(); SetStatusMessage(status.String()); @@ -598,7 +598,7 @@ MediaConverterApp::_ConvertFile(BMediaFile* inFile, BMediaFile* outFile, framesRead)) != B_OK) { fprintf(stderr, "Error writing audio frames: %s\n", strerror(ret)); snprintf(status.LockBuffer(128), 128, - B_TRANSLATE("Error writing audio frame %Ld"), i); + B_TRANSLATE("Error writing audio frame %" B_PRId64), i); status.UnlockBuffer(); SetStatusMessage(status.String()); @@ -609,7 +609,7 @@ MediaConverterApp::_ConvertFile(BMediaFile* inFile, BMediaFile* outFile, if (currPercent > lastPercent) { lastPercent = currPercent; snprintf(status.LockBuffer(128), 128, - B_TRANSLATE("Writing audio track: %ld%% complete"), + B_TRANSLATE("Writing audio track: %" B_PRId32 "%% complete"), currPercent); status.UnlockBuffer(); SetStatusMessage(status.String()); diff --git a/src/apps/mediaconverter/MediaConverterWindow.cpp b/src/apps/mediaconverter/MediaConverterWindow.cpp index c835ec8fc0..1049be1693 100644 --- a/src/apps/mediaconverter/MediaConverterWindow.cpp +++ b/src/apps/mediaconverter/MediaConverterWindow.cpp @@ -501,7 +501,7 @@ MediaConverterWindow::BuildAudioVideoMenus() BMenu* menu = fAudioMenu->Menu(); BMenuItem* item; // clear out old audio codec menu items - while ((item = menu->RemoveItem(0L)) != NULL) + while ((item = menu->RemoveItem((int32)0)) != NULL) delete item; bool separator = true; @@ -558,7 +558,7 @@ MediaConverterWindow::BuildAudioVideoMenus() // clear out old video codec menu items menu = fVideoMenu->Menu(); - while ((item = menu->RemoveItem(0L)) != NULL) + while ((item = menu->RemoveItem((int32)0)) != NULL) delete item; separator = true; diff --git a/src/apps/pairs/Jamfile b/src/apps/pairs/Jamfile index 3127be1c09..a8585d066f 100644 --- a/src/apps/pairs/Jamfile +++ b/src/apps/pairs/Jamfile @@ -16,8 +16,3 @@ DoCatalogs Pairs : PairsView.cpp PairsWindow.cpp ; - -AddCatalogEntryAttribute Pairs - : - x-vnd.Haiku-Pairs:PairsWindow:Pairs -; diff --git a/src/apps/pairs/PairsView.cpp b/src/apps/pairs/PairsView.cpp index 569832c59b..64074be72c 100644 --- a/src/apps/pairs/PairsView.cpp +++ b/src/apps/pairs/PairsView.cpp @@ -183,7 +183,7 @@ PairsView::_ReadRandomIcons() } // delete the remaining bitmaps from the list - while (BBitmap* bitmap = (BBitmap*)bitmaps.RemoveItem(0L)) + while (BBitmap* bitmap = (BBitmap*)bitmaps.RemoveItem((int32)0)) delete bitmap; } diff --git a/src/apps/poorman/StatusSlider.cpp b/src/apps/poorman/StatusSlider.cpp index 694cda00c3..9c39ea4b5c 100644 --- a/src/apps/poorman/StatusSlider.cpp +++ b/src/apps/poorman/StatusSlider.cpp @@ -23,7 +23,7 @@ StatusSlider::StatusSlider(const char* name, const char* label, const char* StatusSlider::UpdateText() const { - sprintf(fTemp, "%ld %s", Value(), fStatusPrefix); + sprintf(fTemp, "%" B_PRId32 " %s", Value(), fStatusPrefix); return fTemp; } diff --git a/src/apps/poorman/libhttpd/libhttpd.c b/src/apps/poorman/libhttpd/libhttpd.c index dd9f5f68bd..f57f65f0b0 100644 --- a/src/apps/poorman/libhttpd/libhttpd.c +++ b/src/apps/poorman/libhttpd/libhttpd.c @@ -2921,7 +2921,7 @@ ls( httpd_conn* hc ) /* And print. */ (void) fprintf( fp, - "%10lld %s %.80s%s%s%s\n", + "%10" B_PRId64 " %s %.80s%s%s%s\n", (int64_t) lsb.st_size, timestr, encrname, S_ISDIR(sb.st_mode) ? "/" : "", nameptrs[i], linkprefix, link, fileclass ); diff --git a/src/apps/readonlybootprompt/BootPromptWindow.cpp b/src/apps/readonlybootprompt/BootPromptWindow.cpp index 12611894cc..f34d3af422 100644 --- a/src/apps/readonlybootprompt/BootPromptWindow.cpp +++ b/src/apps/readonlybootprompt/BootPromptWindow.cpp @@ -137,7 +137,8 @@ compare_void_list_items(const void* _a, const void* _b) BootPromptWindow::BootPromptWindow() : BWindow(BRect(0, 0, 530, 400), "", - B_TITLED_WINDOW, B_NOT_ZOOMABLE | B_NOT_MINIMIZABLE | B_NOT_CLOSABLE), + B_TITLED_WINDOW, B_NOT_ZOOMABLE | B_NOT_MINIMIZABLE | B_NOT_CLOSABLE, + B_ALL_WORKSPACES), fDefaultKeymapItem(NULL) { SetSizeLimits(450, 16384, 350, 16384); diff --git a/src/apps/showimage/ShowImageWindow.cpp b/src/apps/showimage/ShowImageWindow.cpp index b79059e54c..687be6ce9b 100644 --- a/src/apps/showimage/ShowImageWindow.cpp +++ b/src/apps/showimage/ShowImageWindow.cpp @@ -711,7 +711,7 @@ ShowImageWindow::MessageReceived(BMessage* message) while (fGoToPageMenu->CountItems() > 0) { // Remove all page numbers - delete fGoToPageMenu->RemoveItem(0L); + delete fGoToPageMenu->RemoveItem((int32)0); } for (int32 i = 1; i <= pages; i++) { diff --git a/src/apps/soundrecorder/FileUtils.cpp b/src/apps/soundrecorder/FileUtils.cpp index ba5ccf2206..6200866867 100644 --- a/src/apps/soundrecorder/FileUtils.cpp +++ b/src/apps/soundrecorder/FileUtils.cpp @@ -27,7 +27,7 @@ CopyFileData(BFile& dst, BFile& src) struct stat src_stat; status_t err = src.GetStat(&src_stat); if (err != B_OK) { - printf("couldn't get stat: %#010lx\n", err); + printf("couldn't get stat: %#010" B_PRIx32 "\n", err); return err; } diff --git a/src/apps/soundrecorder/RecorderWindow.cpp b/src/apps/soundrecorder/RecorderWindow.cpp index 49a182b299..1e5c673006 100644 --- a/src/apps/soundrecorder/RecorderWindow.cpp +++ b/src/apps/soundrecorder/RecorderWindow.cpp @@ -457,7 +457,7 @@ RecorderWindow::InitWindow() error = fRoster->GetDormantNodes(dni, &real_count, 0, &output_format, 0, B_BUFFER_PRODUCER | B_PHYSICAL_INPUT); if (real_count > maxInputCount) { - WINDOW((stderr, "dropped %ld inputs\n", real_count - maxInputCount)); + WINDOW((stderr, "dropped %" B_PRId32 " inputs\n", real_count - maxInputCount)); real_count = maxInputCount; } char selected_name[B_MEDIA_NAME_LENGTH] = "Default input"; @@ -1172,7 +1172,7 @@ RecorderWindow::ErrorAlert(const char * action, status_t err) { char msg[300]; if (err != B_OK) - sprintf(msg, "%s: %s. [%lx]", action, strerror(err), (int32) err); + sprintf(msg, "%s: %s. [%" B_PRIx32 "]", action, strerror(err), (int32) err); else sprintf(msg, "%s.", action); BAlert* alert = new BAlert("", msg, B_TRANSLATE("Stop")); diff --git a/src/apps/soundrecorder/TrackSlider.cpp b/src/apps/soundrecorder/TrackSlider.cpp index 34e92e576b..9cbb606906 100644 --- a/src/apps/soundrecorder/TrackSlider.cpp +++ b/src/apps/soundrecorder/TrackSlider.cpp @@ -408,8 +408,8 @@ TrackSlider::_TimeToString(bigtime_t timestamp, char *string) uint32 seconds = timestamp / 1000000LL; timestamp -= seconds * 1000000LL; uint32 centiseconds = timestamp / 10000LL; - sprintf(string, "%02ld:%02ld:%02ld:%02ld", hours, minutes, seconds, - centiseconds); + sprintf(string, "%02" B_PRId32 ":%02" B_PRId32 ":%02" B_PRId32 ":%02" + B_PRId32, hours, minutes, seconds, centiseconds); } diff --git a/src/apps/stylededit/Constants.h b/src/apps/stylededit/Constants.h index 03f7387f6e..4c955b6bac 100644 --- a/src/apps/stylededit/Constants.h +++ b/src/apps/stylededit/Constants.h @@ -81,7 +81,7 @@ const uint32 SAVE_THEN_QUIT = 'FPsq'; // Update StatusView const uint32 UPDATE_STATUS = 'UPSt'; const uint32 UNLOCK_FILE = 'UNLk'; -const uint32 UPDATE_LINE_SEL = 'UPls'; +const uint32 UPDATE_LINE_SELECTION = 'UPls'; #endif // CONSTANTS_H diff --git a/src/apps/stylededit/StyledEditApp.cpp b/src/apps/stylededit/StyledEditApp.cpp index 664ecbff4c..0460af8d18 100644 --- a/src/apps/stylededit/StyledEditApp.cpp +++ b/src/apps/stylededit/StyledEditApp.cpp @@ -266,18 +266,18 @@ StyledEditApp::RefsReceived(BMessage* message) length = -1; } - BMessage* selMessage = NULL; + BMessage* selection = NULL; if (line >= 0 || (start >= 0 && length >= 0)) { - selMessage = new BMessage(UPDATE_LINE_SEL); + selection = new BMessage(UPDATE_LINE_SELECTION); if (line >= 0) - selMessage->AddInt32("be:line", line); + selection->AddInt32("be:line", line); if (start >= 0) { - selMessage->AddInt32("be:selection_offset", start); - selMessage->AddInt32("be:selection_length", max_c(0, length)); + selection->AddInt32("be:selection_offset", start); + selection->AddInt32("be:selection_length", max_c(0, length)); } } - OpenDocument(&ref, selMessage); + OpenDocument(&ref, selection); index++; } } diff --git a/src/apps/stylededit/StyledEditWindow.cpp b/src/apps/stylededit/StyledEditWindow.cpp index 3193bcfc85..9e08d4f5ad 100644 --- a/src/apps/stylededit/StyledEditWindow.cpp +++ b/src/apps/stylededit/StyledEditWindow.cpp @@ -535,7 +535,7 @@ StyledEditWindow::MessageReceived(BMessage* message) break; } - case UPDATE_LINE_SEL: + case UPDATE_LINE_SELECTION: { int32 line; if (message->FindInt32("be:line", &line) == B_OK) { @@ -1337,31 +1337,13 @@ StyledEditWindow::_LoadAttrs() } // info about position of caret may live in the file attributes - int32 line = 0; - int32 lineMax = fTextView->CountLines(); - if (documentNode.ReadAttr("be:line", - B_INT32_TYPE, 0, &line, sizeof(line)) == sizeof(line)) - line = min_c(max_c(0, line), lineMax); - else - line = 0; + int32 position = 0; + if (documentNode.ReadAttr("be:caret_position", B_INT32_TYPE, 0, + &position, sizeof(position)) != sizeof(position)) + position = 0; - int32 start = 0, length = 0, finish = 0; - int32 offsetMax = fTextView->OffsetAt(lineMax); - if (documentNode.ReadAttr("be:selection_offset", - B_INT32_TYPE, 0, &start, sizeof(start)) == sizeof(start) - && documentNode.ReadAttr("be:selection_length", - B_INT32_TYPE, 0, &length, sizeof(length)) == sizeof(length)) - { - finish = start + length; - start = min_c(max_c(0, start), offsetMax); - finish = min_c(max_c(0, finish), offsetMax); - } else { - start = fTextView->OffsetAt(line); - finish = start; - } - - fTextView->Select(start, finish); - fTextView->ScrollToOffset(start); + fTextView->Select(position, position); + fTextView->ScrollToOffset(position); } @@ -1390,17 +1372,11 @@ StyledEditWindow::_SaveAttrs() documentNode.WriteAttr(kInfoAttributeName, B_RECT_TYPE, 0, &frame, sizeof(BRect)); - // preserve current line and selection too - int32 line = fTextView->CurrentLine(); - documentNode.WriteAttr("be:line", B_INT32_TYPE, 0, &line, sizeof(line)); - + // preserve caret line and position int32 start, end; fTextView->GetSelection(&start, &end); - int32 length = end - start; - documentNode.WriteAttr("be:selection_offset", + documentNode.WriteAttr("be:caret_position", B_INT32_TYPE, 0, &start, sizeof(start)); - documentNode.WriteAttr("be:selection_length", - B_INT32_TYPE, 0, &length, sizeof(length)); } diff --git a/src/apps/terminal/Shell.cpp b/src/apps/terminal/Shell.cpp index 12c3c92689..5dd10ae79d 100644 --- a/src/apps/terminal/Shell.cpp +++ b/src/apps/terminal/Shell.cpp @@ -539,7 +539,7 @@ Shell::_Spawn(int row, int col, const ShellParameters& parameters) /* * setenv TERM and TTY. */ - setenv("TERM", "xterm", true); + setenv("TERM", "xterm-color", true); setenv("TTY", ttyName, true); setenv("TTYPE", parameters.Encoding(), true); diff --git a/src/apps/terminal/TermParse.cpp b/src/apps/terminal/TermParse.cpp index 0ae798a326..6664dd0b59 100644 --- a/src/apps/terminal/TermParse.cpp +++ b/src/apps/terminal/TermParse.cpp @@ -833,23 +833,30 @@ TermParse::EscParse() fAttr = FORECOLORED(7); break; - case 1: /* Bold */ - case 5: - fAttr |= BOLD; + case 1: /* Bright / Bold */ + fAttr |= FORECOLORED(8); + fAttr |= FORESET; break; case 4: /* Underline */ fAttr |= UNDERLINE; break; + case 5: + fAttr |= BOLD; + break; + case 7: /* Inverse */ fAttr |= INVERSE; break; - case 22: /* Not Bold */ - fAttr &= ~BOLD; + case 2: /* Faint: decreased intensity */ + case 21: /* Bright/Bold: off or Underline: Double */ + case 22: /* Not Bold, not bright, not faint */ + fAttr &= ~(FORECOLORED(8) | BOLD); + fAttr |= FORESET; break; - + case 24: /* Not Underline */ fAttr &= ~UNDERLINE; break; @@ -866,7 +873,7 @@ TermParse::EscParse() case 35: case 36: case 37: - fAttr &= ~FORECOLOR; + fAttr &= ~FORECOLORED(7); fAttr |= FORECOLORED(param[row] - 30); fAttr |= FORESET; break; @@ -875,7 +882,7 @@ TermParse::EscParse() { if (nparam != 3 || param[1] != 5) break; - fAttr &= ~FORECOLOR; + fAttr &= ~FORECOLORED(255 - 8); fAttr |= FORECOLORED(param[2]); fAttr |= FORESET; diff --git a/src/apps/terminal/TermView.cpp b/src/apps/terminal/TermView.cpp index 8da3c92dc7..c79960e357 100644 --- a/src/apps/terminal/TermView.cpp +++ b/src/apps/terminal/TermView.cpp @@ -79,14 +79,14 @@ static rgb_color kTermColorTable[256] = { { 6, 152, 154, 0}, // cyan {245, 245, 245, 0}, // white - {128, 128, 128, 0}, // black + { 64, 64, 64, 0}, // black {255, 0, 0, 0}, // red { 0, 255, 0, 0}, // green {255, 255, 0, 0}, // yellow { 0, 0, 255, 0}, // blue {255, 0, 255, 0}, // magenta { 0, 255, 255, 0}, // cyan - {255, 255, 255, 0}, // white + {128, 128, 128, 0}, // white { 0, 0, 0, 0}, { 0, 0, 51, 0}, diff --git a/src/apps/tv/Controller.cpp b/src/apps/tv/Controller.cpp index 512c41f50e..9f006653f9 100644 --- a/src/apps/tv/Controller.cpp +++ b/src/apps/tv/Controller.cpp @@ -147,7 +147,7 @@ Controller::ConnectInterface(int i) printf(" name '%s'\n", parameter->Name()); printf(" kind '%s'\n", parameter->Kind()); printf(" unit '%s'\n", parameter->Unit()); - printf(" flags 0x%08lx\n", parameter->Flags()); + printf(" flags 0x%08" B_PRIx32 "\n", parameter->Flags()); // XXX TODO: matching on Name is weak if (strcmp(parameter->Name(), "Channel") == 0 || strcmp(parameter->Kind(), B_TUNER_CHANNEL) == 0) { diff --git a/src/apps/tv/DeviceRoster.cpp b/src/apps/tv/DeviceRoster.cpp index f94a4d11ec..d2fd4da56a 100644 --- a/src/apps/tv/DeviceRoster.cpp +++ b/src/apps/tv/DeviceRoster.cpp @@ -41,7 +41,7 @@ DeviceRoster::DeviceRoster() err = MediaRoster()->GetLiveNodes(info, &info_count, NULL, NULL, "DVB*", B_BUFFER_PRODUCER | B_PHYSICAL_INPUT); if (err != B_OK || info_count < 1) { - printf("Can't find live DVB node. Found %ld nodes, error %08lx (%s)\n", + printf("Can't find live DVB node. Found %" B_PRId32 " nodes, error %08" B_PRIx32 " (%s)\n", info_count, err, strerror(err)); fDeviceCount = 0; } else { diff --git a/src/apps/tv/MainWin.cpp b/src/apps/tv/MainWin.cpp index e3283a9bdc..9f57fd0116 100644 --- a/src/apps/tv/MainWin.cpp +++ b/src/apps/tv/MainWin.cpp @@ -974,7 +974,7 @@ MainWin::KeyDown(BMessage *msg) uint32 raw_char = msg->FindInt32("raw_char"); uint32 modifiers = msg->FindInt32("modifiers"); - printf("key 0x%lx, raw_char 0x%lx, modifiers 0x%lx\n", key, raw_char, + printf("key 0x%" B_PRIx32 ", raw_char 0x%" B_PRIx32 ", modifiers 0x%" B_PRIx32 "\n", key, raw_char, modifiers); switch (raw_char) { diff --git a/src/apps/tv/VideoNode.cpp b/src/apps/tv/VideoNode.cpp index 70c6755153..a9aaff4f08 100644 --- a/src/apps/tv/VideoNode.cpp +++ b/src/apps/tv/VideoNode.cpp @@ -446,7 +446,7 @@ VideoNode::CreateBuffers(BRect frame, color_space cspace, bool overlay) printf("VideoNode::CreateBuffers failed\n"); return B_ERROR; } - printf("overlay bitmap: got: bytes per row: %ld\n", + printf("overlay bitmap: got: bytes per row: %" B_PRId32 "\n", fBitmap->BytesPerRow()); fOverlayActive = overlay; UnlockBitmap(); diff --git a/src/bin/network/arp/arp.cpp b/src/bin/network/arp/arp.cpp index 9a8be9f450..1e41394306 100644 --- a/src/bin/network/arp/arp.cpp +++ b/src/bin/network/arp/arp.cpp @@ -270,7 +270,7 @@ set_entries_from_file(const char *filename) char *rest = line; const char *argument = next_argument(&rest); if (argument == NULL) { - fprintf(stderr, "%s: Line %ld is invalid (missing hostname).\n", + fprintf(stderr, "%s: Line %" B_PRId32 " is invalid (missing hostname).\n", kProgramName, counter); continue; } @@ -280,12 +280,12 @@ set_entries_from_file(const char *filename) // get host by name struct hostent *host = gethostbyname(argument); if (host == NULL) { - fprintf(stderr, "%s: Line %ld, host \"%s\" is not known in the IPv4 domain: %s\n", + fprintf(stderr, "%s: Line %" B_PRId32 ", host \"%s\" is not known in the IPv4 domain: %s\n", kProgramName, counter, argument, strerror(errno)); continue; } if (host->h_addrtype != AF_INET) { - fprintf(stderr, "%s: Line %ld, host \"%s\" is not known in the IPv4 domain.\n", + fprintf(stderr, "%s: Line " B_PRId32 ", host \"%s\" is not known in the IPv4 domain.\n", kProgramName, counter, argument); continue; } @@ -299,14 +299,14 @@ set_entries_from_file(const char *filename) argument = next_argument(&rest); if (argument == NULL) { - fprintf(stderr, "%s: Line %ld is invalid (missing ethernet address).\n", + fprintf(stderr, "%s: Line %" B_PRId32 " is invalid (missing ethernet address).\n", kProgramName, counter); continue; } uint8 ethernetAddress[6]; if (!parse_ethernet_address(argument, ethernetAddress)) { - fprintf(stderr, "%s: Line %ld, \"%s\" is not a valid ethernet address.\n", + fprintf(stderr, "%s: Line %" B_PRId32 ", \"%s\" is not a valid ethernet address.\n", kProgramName, counter, argument); continue; } @@ -316,14 +316,14 @@ set_entries_from_file(const char *filename) uint32 flags = ARP_FLAG_PERMANENT; while ((argument = next_argument(&rest)) != NULL) { if (!set_flags(flags, argument)) { - fprintf(stderr, "%s: Line %ld, ignoring invalid flag \"%s\".\n", + fprintf(stderr, "%s: Line %" B_PRId32 ", ignoring invalid flag \"%s\".\n", kProgramName, counter, argument); } } status_t status = set_entry(&address, ethernetAddress, flags); if (status != B_OK) { - fprintf(stderr, "%s: Line %ld, ARP entry could not been set: %s\n", + fprintf(stderr, "%s: Line %" B_PRId32 ", ARP entry could not been set: %s\n", kProgramName, counter, strerror(status)); } } diff --git a/src/data/beos_mime/application/x-xar b/src/data/beos_mime/application/x-xar new file mode 100644 index 0000000000..bc4481bd6f --- /dev/null +++ b/src/data/beos_mime/application/x-xar @@ -0,0 +1,50 @@ +resource(0, "BEOS:TYPE") #'MIMS' "application/x-vnd.Be-meta-mime"; + +resource(1, "META:TYPE") "application/x-xar"; + +resource(2, "META:S:DESC") #'MSDC' "XAR archive"; + +resource(3, "META:SNIFF_RULE") "0.50 (\"xar!\")"; + +resource(4, "META:PREF_APP") #'MSIG' "application/x-vnd.Haiku-Expander"; + +resource(5, "META:EXTENS") message(234) { + "extensions" = "xar", + "type" = "application/x-xar" +}; + +resource(6, "META:ICON") #'VICN' array { + $"6E6369660703010000020006023CC7EE389BC0BA16573E39B04977C84556E300" + $"FFF8EAFFF5DEAC020006023C96323A4D3FBAFC013D5A974B57A54A022600983F" + $"04FFE6C276020006023A492400000000000040000047000044000000FFEFCEFF" + $"FFD16E02000602BB8A46BA62453C0CE4BD0B7C487ECB4BD08500E1AB36FFFFEB" + $"C0020006023B61A038E755B9F2003C4C154AC9623D6A0500FFC0C0FFFF9E9E04" + $"0188140608B2AB445F49C62DC959C521CAC2C755C7C9C7C0C625CAECC2F2C9BC" + $"C48CCC1CC1595F405B3E5943060AEEEA0E234022C1D822C0BC22C348B40BC4C7" + $"B647C63EB4FBC58EB7DDC715B99EC79CB99FC217BEC1BCDCBBA1BB96BD24BC34" + $"BA49BB0AB905BAECB623BD02B766BBBFB4CABE5B0606BA0B3EBC76C283B89ABF" + $"85B784C0FAB80BBE35B70A392ABB83B808BC45B746BA98B8F3B992B9F9060AEA" + $"EE0EBF8DBD1CC6133FC618C550C8A9C274C7A7C3C7C96EC17059C0655ABD825A" + $"BEEF5ABC61C969BB91C5DCB9D2C7CDBA87C472B94EC33AB910C181BA7DC269B9" + $"A3C064BB8A060CEEEEEEC59341C221BE88C3E6BF4B42BDDABF27BD75BCE0BF91" + $"BDFFBE5ABB9DC0EFBA6BC263BA45C4E2BA45C392BA45C684BA85C84EBD7ACA0E" + $"BBD3C92EBF59CB0B44CB67C3C8C8E2C297CA75C4E2C76FC5A3C5FFC5CEC314C5" + $"D2C490C5CAC1970606BA0B444EBA6BC263BA45C4E2BA45C392BA45C684BA85C8" + $"4EBD7ACA0EBBD3C92EBF59CB0B44CB6706076E3BC59341C3DFC2B9C4ECC16EC2" + $"CFC405444ECB67C3C8C8E2C297CA75C4E2C76FC5A3C5FFC5CEC314C5D2C490C5" + $"CAC1970607EE3AC59341C221BE88C3E6BF4B42BDDABF27BD75BCE0BF91BDFFBE" + $"5ABB9DC0EFBA6BC263444EC3DFC2B9C2CFC405C4ECC16E0606EE0A234022C1D8" + $"22C0BC22C348B40BC4C7B647C63EB4FBC58EB7DDC715B99EC79CB99FC2170606" + $"EA0E2340B99FC217BEC1BCDCBBA1BB96BD24BC34BA49BB0AB905BAECB623BD02" + $"B766BBBFB4CABE5B0607BA3BBF8DBD1CC6133FC85BBD37C775BE3CC91DBC5BC9" + $"69BB91C5DCB9D2C7CDBA87C472B94EC33AB910C181BA7DC269B9A3C064BB8A06" + $"07BA3BC6133FC618C550C8A9C274C7A7C3C7C96EC17059C0655ABD825ABEEF5A" + $"BC61C969BB91C85BBD37C91DBC5BC775BE3C0408FEBB3F423A333F36BBD4B9A7" + $"32392B38393A4F3A4B37C6A0BE0946414B42C093BFD53F3838BDDBBE4EBCD5BA" + $"EBBED22FBF7308023F383F2E0606F60F3E3022492444244D245A2255225A225A" + $"305A30553049324D32443208024027472E08024727412F0405B602512E275529" + $"5526552C522B562E0803482E4B274E2E0802492C4D2C0B0A060100000A000401" + $"0203041001178400040A01040709020A000A0202060B000A040105000A030108" + $"000A00010C1815FF01178220040A00010D1001178200040A00010E1001178402" + $"040A05010E000A00050F101112131815FF0117822204" +}; diff --git a/src/kits/bluetooth/CommandManager.cpp b/src/kits/bluetooth/CommandManager.cpp index fad66ca482..931f4d18f6 100644 --- a/src/kits/bluetooth/CommandManager.cpp +++ b/src/kits/bluetooth/CommandManager.cpp @@ -8,10 +8,12 @@ #include +#include inline void* buildCommand(uint8 ogf, uint8 ocf, void** param, size_t psize, size_t* outsize) { + CALLED(); struct hci_command_header* header; #ifdef BT_IOCTLS_PASS_SIZE @@ -57,6 +59,7 @@ status_t NonParameterCommandRequest(uint8 ofg, uint8 ocf, int32* result, hci_id hId, BMessenger* messenger) { + CALLED(); int8 bt_status = BT_ERROR; BluetoothCommand<> simpleCommand(ofg, ocf); @@ -87,6 +90,7 @@ NonParameterCommandRequest(uint8 ofg, uint8 ocf, int32* result, hci_id hId, void* buildReset(size_t* outsize) { + CALLED(); return buildCommand(OGF_CONTROL_BASEBAND, OCF_RESET, NULL, 0, outsize); } @@ -94,6 +98,7 @@ void* buildReset(size_t* outsize) void* buildReadLocalName(size_t* outsize) { + CALLED(); return buildCommand(OGF_CONTROL_BASEBAND, OCF_READ_LOCAL_NAME, NULL, 0, outsize); } @@ -101,6 +106,7 @@ void* buildReadLocalName(size_t* outsize) void* buildReadClassOfDevice(size_t* outsize) { + CALLED(); return buildCommand(OGF_CONTROL_BASEBAND, OCF_READ_CLASS_OF_DEV, NULL, 0, outsize); } @@ -108,6 +114,7 @@ void* buildReadClassOfDevice(size_t* outsize) void* buildReadScan(size_t* outsize) { + CALLED(); return buildCommand(OGF_CONTROL_BASEBAND, OCF_READ_SCAN_ENABLE, NULL, 0, outsize); } @@ -115,6 +122,7 @@ void* buildReadScan(size_t* outsize) void* buildWriteScan(uint8 scanmode, size_t* outsize) { + CALLED(); struct hci_write_scan_enable* param; void* command = buildCommand(OGF_CONTROL_BASEBAND, OCF_WRITE_SCAN_ENABLE, (void**) ¶m, sizeof(struct hci_write_scan_enable), outsize); @@ -136,7 +144,7 @@ void* buildWriteScan(uint8 scanmode, size_t* outsize) void* buildRemoteNameRequest(bdaddr_t bdaddr, uint8 pscan_rep_mode, uint16 clock_offset, size_t* outsize) { - + CALLED(); struct hci_remote_name_request* param; void* command = buildCommand(OGF_LINK_CONTROL, OCF_REMOTE_NAME_REQUEST, (void**)¶m, sizeof(struct hci_remote_name_request), outsize); @@ -153,7 +161,7 @@ void* buildRemoteNameRequest(bdaddr_t bdaddr, uint8 pscan_rep_mode, void* buildInquiry(uint32 lap, uint8 length, uint8 num_rsp, size_t* outsize) { - + CALLED(); struct hci_cp_inquiry* param; void* command = buildCommand(OGF_LINK_CONTROL, OCF_INQUIRY, (void**) ¶m, sizeof(struct hci_cp_inquiry), outsize); @@ -173,15 +181,15 @@ void* buildInquiry(uint32 lap, uint8 length, uint8 num_rsp, size_t* outsize) void* buildInquiryCancel(size_t* outsize) { - + CALLED(); return buildCommand(OGF_LINK_CONTROL, OCF_INQUIRY_CANCEL, NULL, 0, outsize); - } void* buildPinCodeRequestReply(bdaddr_t bdaddr, uint8 length, char pincode[16], size_t* outsize) { + CALLED(); struct hci_cp_pin_code_reply* param; if (length > HCI_PIN_SIZE) // PinCode cannot be longer than 16 @@ -202,7 +210,7 @@ void* buildPinCodeRequestReply(bdaddr_t bdaddr, uint8 length, char pincode[16], void* buildPinCodeRequestNegativeReply(bdaddr_t bdaddr, size_t* outsize) { - + CALLED(); struct hci_cp_pin_code_neg_reply* param; void* command = buildCommand(OGF_LINK_CONTROL, OCF_PIN_CODE_NEG_REPLY, @@ -220,6 +228,7 @@ void* buildPinCodeRequestNegativeReply(bdaddr_t bdaddr, size_t* outsize) void* buildAcceptConnectionRequest(bdaddr_t bdaddr, uint8 role, size_t* outsize) { + CALLED(); struct hci_cp_accept_conn_req* param; void* command = buildCommand(OGF_LINK_CONTROL, OCF_ACCEPT_CONN_REQ, @@ -236,6 +245,7 @@ void* buildAcceptConnectionRequest(bdaddr_t bdaddr, uint8 role, size_t* outsize) void* buildRejectConnectionRequest(bdaddr_t bdaddr, size_t* outsize) { + CALLED(); struct hci_cp_reject_conn_req* param; void* command = buildCommand(OGF_LINK_CONTROL, OCF_REJECT_CONN_REQ, @@ -256,6 +266,7 @@ void* buildRejectConnectionRequest(bdaddr_t bdaddr, size_t* outsize) void* buildReadLocalVersionInformation(size_t* outsize) { + CALLED(); return buildCommand(OGF_INFORMATIONAL_PARAM, OCF_READ_LOCAL_VERSION, NULL, 0, outsize); } @@ -263,6 +274,7 @@ void* buildReadLocalVersionInformation(size_t* outsize) void* buildReadBufferSize(size_t* outsize) { + CALLED(); return buildCommand(OGF_INFORMATIONAL_PARAM, OCF_READ_BUFFER_SIZE, NULL, 0, outsize); } @@ -270,6 +282,7 @@ void* buildReadBufferSize(size_t* outsize) void* buildReadBdAddr(size_t* outsize) { + CALLED(); return buildCommand(OGF_INFORMATIONAL_PARAM, OCF_READ_BD_ADDR, NULL, 0, outsize); } @@ -703,6 +716,7 @@ const char* lmpVersion[] = { "1.0 " , "1.1 " , "1.2 " , "2.0 " , "2.1 "}; const char* BluetoothHciVersion(uint16 ver) { + CALLED(); return hciVersion[ver]; } @@ -710,6 +724,7 @@ BluetoothHciVersion(uint16 ver) const char* BluetoothLmpVersion(uint16 ver) { + CALLED(); return lmpVersion[ver]; } @@ -717,7 +732,7 @@ BluetoothLmpVersion(uint16 ver) const char* BluetoothCommandOpcode(uint16 opcode) { - + CALLED(); // NOTE: BT implementations beyond 2.1 // could specify new commands with OCF numbers // beyond the boundaries of the arrays and crash. @@ -761,6 +776,7 @@ BluetoothCommandOpcode(uint16 opcode) const char* BluetoothEvent(uint8 event) { + CALLED(); if (event < sizeof(bluetoothEvents) / sizeof(const char*)) return bluetoothEvents[event - 1]; else @@ -771,6 +787,7 @@ BluetoothEvent(uint8 event) const char* BluetoothManufacturer(uint16 manufacturer) { + CALLED(); if (manufacturer < sizeof(bluetoothManufacturers) / sizeof(const char*)) return bluetoothManufacturers[manufacturer]; else if (manufacturer == 0xFFFF) @@ -783,6 +800,7 @@ BluetoothManufacturer(uint16 manufacturer) const char* BluetoothError(uint8 error) { + CALLED(); if (error < sizeof(bluetoothErrors) / sizeof(const char*)) return bluetoothErrors[error]; else diff --git a/src/kits/bluetooth/DeviceClass.cpp b/src/kits/bluetooth/DeviceClass.cpp index 33ef99e86f..7eb3c4857b 100644 --- a/src/kits/bluetooth/DeviceClass.cpp +++ b/src/kits/bluetooth/DeviceClass.cpp @@ -4,6 +4,7 @@ */ #include +#include #include #include @@ -18,6 +19,7 @@ namespace Bluetooth { void DeviceClass::GetServiceClass(BString& serviceClass) { + CALLED(); static const char *services[] = { B_TRANSLATE_MARK("Positioning"), B_TRANSLATE_MARK("Networking"), B_TRANSLATE_MARK("Rendering"), B_TRANSLATE_MARK("Capturing"), B_TRANSLATE_MARK("Object transfer"), @@ -41,13 +43,13 @@ DeviceClass::GetServiceClass(BString& serviceClass) } else serviceClass << B_TRANSLATE("Unspecified"); - } void DeviceClass::GetMajorDeviceClass(BString& majorClass) { + CALLED(); static const char *major_devices[] = { B_TRANSLATE_MARK("Miscellaneous"), B_TRANSLATE_MARK("Computer"), B_TRANSLATE_MARK("Phone"), B_TRANSLATE_MARK("LAN access"), B_TRANSLATE_MARK("Audio/Video"), @@ -65,6 +67,7 @@ DeviceClass::GetMajorDeviceClass(BString& majorClass) void DeviceClass::GetMinorDeviceClass(BString& minorClass) { + CALLED(); uint major = MajorDeviceClass(); uint minor = MinorDeviceClass(); @@ -322,6 +325,7 @@ DeviceClass::GetMinorDeviceClass(BString& minorClass) void DeviceClass::DumpDeviceClass(BString& string) { + CALLED(); string << B_TRANSLATE("Service classes: "); GetServiceClass(string); string << " | "; @@ -337,6 +341,7 @@ DeviceClass::DumpDeviceClass(BString& string) void DeviceClass::Draw(BView* view, const BPoint& point) { + CALLED(); rgb_color kBlack = { 0,0,0,0 }; rgb_color kBlue = { 28,110,157,0 }; rgb_color kWhite = { 255,255,255,0 }; @@ -414,10 +419,8 @@ DeviceClass::Draw(BView* view, const BPoint& point) view->StrokeLine(BPoint(point.x + IconInsets + uint(PixelsForIcon/4), point.y + IconInsets + uint(PixelsForIcon/4))); break; - } - + } view->SetHighColor(kBlack); } - } diff --git a/src/kits/bluetooth/DiscoveryAgent.cpp b/src/kits/bluetooth/DiscoveryAgent.cpp index ece1202737..fb5a5e2e05 100644 --- a/src/kits/bluetooth/DiscoveryAgent.cpp +++ b/src/kits/bluetooth/DiscoveryAgent.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include #include @@ -23,6 +24,7 @@ namespace Bluetooth { RemoteDevicesList DiscoveryAgent::RetrieveDevices(int option) { + CALLED(); // No inquiry process initiated if (fLastUsedListener == NULL) return RemoteDevicesList(); @@ -34,6 +36,7 @@ DiscoveryAgent::RetrieveDevices(int option) status_t DiscoveryAgent::StartInquiry(int accessCode, DiscoveryListener* listener) { + CALLED(); return StartInquiry(accessCode, listener, GetInquiryTime()); } @@ -41,6 +44,7 @@ DiscoveryAgent::StartInquiry(int accessCode, DiscoveryListener* listener) status_t DiscoveryAgent::StartInquiry(uint32 accessCode, DiscoveryListener* listener, bigtime_t secs) { + CALLED(); size_t size; if (fMessenger == NULL) @@ -91,6 +95,7 @@ DiscoveryAgent::StartInquiry(uint32 accessCode, DiscoveryListener* listener, big status_t DiscoveryAgent::CancelInquiry(DiscoveryListener* listener) { + CALLED(); size_t size; if (fMessenger == NULL) @@ -123,12 +128,14 @@ DiscoveryAgent::CancelInquiry(DiscoveryListener* listener) void DiscoveryAgent::SetLocalDeviceOwner(LocalDevice* ld) { + CALLED(); fLocalDevice = ld; } DiscoveryAgent::DiscoveryAgent(LocalDevice* ld) { + CALLED(); fLocalDevice = ld; fMessenger = _RetrieveBluetoothMessenger(); } @@ -136,6 +143,7 @@ DiscoveryAgent::DiscoveryAgent(LocalDevice* ld) DiscoveryAgent::~DiscoveryAgent() { + CALLED(); delete fMessenger; } diff --git a/src/kits/bluetooth/DiscoveryListener.cpp b/src/kits/bluetooth/DiscoveryListener.cpp index 6ee7bbb060..c8cf32e6d9 100644 --- a/src/kits/bluetooth/DiscoveryListener.cpp +++ b/src/kits/bluetooth/DiscoveryListener.cpp @@ -10,6 +10,7 @@ #include #include #include +#include #include @@ -24,21 +25,21 @@ namespace Bluetooth { void DiscoveryListener::DeviceDiscovered(RemoteDevice* btDevice, DeviceClass cod) { - + CALLED(); } void DiscoveryListener::InquiryStarted(status_t status) { - + CALLED(); } void DiscoveryListener::InquiryCompleted(int discType) { - + CALLED(); } @@ -50,6 +51,7 @@ DiscoveryListener::InquiryCompleted(int discType) void DiscoveryListener::SetLocalDeviceOwner(LocalDevice* ld) { + CALLED(); fLocalDevice = ld; } @@ -57,6 +59,7 @@ DiscoveryListener::SetLocalDeviceOwner(LocalDevice* ld) RemoteDevicesList DiscoveryListener::GetRemoteDevicesList(void) { + CALLED(); return fRemoteDevicesList; } @@ -64,6 +67,7 @@ DiscoveryListener::GetRemoteDevicesList(void) void DiscoveryListener::MessageReceived(BMessage* message) { + CALLED(); int8 status; switch (message->what) { @@ -147,9 +151,9 @@ DiscoveryListener::DiscoveryListener() BLooper(), fRemoteDevicesList(BT_MAX_RESPONSES) { + CALLED(); // TODO: Make a better handling of the running not running state Run(); } - } diff --git a/src/kits/bluetooth/KitSupport.cpp b/src/kits/bluetooth/KitSupport.cpp index 65f29bedc3..da9eef1136 100644 --- a/src/kits/bluetooth/KitSupport.cpp +++ b/src/kits/bluetooth/KitSupport.cpp @@ -6,6 +6,7 @@ */ #include #include +#include #include @@ -13,6 +14,7 @@ BMessenger* _RetrieveBluetoothMessenger(void) { + CALLED(); // Fix/review: leaking memory here BMessenger* fMessenger = new BMessenger(BLUETOOTH_SIGNATURE); @@ -26,12 +28,13 @@ BMessenger* _RetrieveBluetoothMessenger(void) uint8 GetInquiryTime() { + CALLED(); return BT_DEFAULT_INQUIRY_TIME; } void SetInquiryTime(uint8 time) { + CALLED(); ((void)(time)); } - diff --git a/src/kits/bluetooth/RemoteDevice.cpp b/src/kits/bluetooth/RemoteDevice.cpp index d80eb4f1f9..bbd8fcfe5d 100644 --- a/src/kits/bluetooth/RemoteDevice.cpp +++ b/src/kits/bluetooth/RemoteDevice.cpp @@ -14,6 +14,7 @@ #include #include +#include #include #include @@ -35,6 +36,7 @@ static const uint16 invalidConnectionHandle = 0xF000; bool RemoteDevice::IsTrustedDevice(void) { + CALLED(); return true; } @@ -42,6 +44,7 @@ RemoteDevice::IsTrustedDevice(void) BString RemoteDevice::GetFriendlyName(bool alwaysAsk) { + CALLED(); if (!alwaysAsk) { // Check if the name is already retrieved // TODO: Check if It is known from a KnownDevicesList @@ -101,6 +104,7 @@ RemoteDevice::GetFriendlyName(bool alwaysAsk) BString RemoteDevice::GetFriendlyName() { + CALLED(); return GetFriendlyName(true); } @@ -108,6 +112,7 @@ RemoteDevice::GetFriendlyName() bdaddr_t RemoteDevice::GetBluetoothAddress() { + CALLED(); return fBdaddr; } @@ -115,6 +120,7 @@ RemoteDevice::GetBluetoothAddress() bool RemoteDevice::Equals(RemoteDevice* obj) { + CALLED(); return bdaddrUtils::Compare(fBdaddr, obj->GetBluetoothAddress()); } @@ -125,6 +131,7 @@ RemoteDevice::Equals(RemoteDevice* obj) bool RemoteDevice::Authenticate() { + CALLED(); int8 btStatus = BT_ERROR; if (fMessenger == NULL || fDiscovererLocalDevice == NULL) @@ -200,6 +207,7 @@ RemoteDevice::Authenticate() status_t RemoteDevice::Disconnect(int8 reason) { + CALLED(); if (fHandle != invalidConnectionHandle) { int8 btStatus = BT_ERROR; @@ -248,6 +256,7 @@ RemoteDevice::Disconnect(int8 reason) bool RemoteDevice::IsAuthenticated() { + CALLED(); return true; } @@ -258,6 +267,7 @@ RemoteDevice::IsAuthenticated() bool RemoteDevice::IsEncrypted() { + CALLED(); return true; } @@ -265,6 +275,7 @@ RemoteDevice::IsEncrypted() LocalDevice* RemoteDevice::GetLocalDeviceOwner() { + CALLED(); return fDiscovererLocalDevice; } @@ -273,6 +284,7 @@ RemoteDevice::GetLocalDeviceOwner() void RemoteDevice::SetLocalDeviceOwner(LocalDevice* ld) { + CALLED(); fDiscovererLocalDevice = ld; } @@ -284,6 +296,7 @@ RemoteDevice::RemoteDevice(const bdaddr_t address, uint8 record[3]) fDiscovererLocalDevice(NULL), fHandle(invalidConnectionHandle) { + CALLED(); fBdaddr = address; fDeviceClass.SetRecord(record); fMessenger = _RetrieveBluetoothMessenger(); @@ -296,6 +309,7 @@ RemoteDevice::RemoteDevice(const BString& address) fDiscovererLocalDevice(NULL), fHandle(invalidConnectionHandle) { + CALLED(); fBdaddr = bdaddrUtils::FromString((const char*)address.String()); fMessenger = _RetrieveBluetoothMessenger(); } @@ -303,6 +317,7 @@ RemoteDevice::RemoteDevice(const BString& address) RemoteDevice::~RemoteDevice() { + CALLED(); delete fMessenger; } @@ -317,6 +332,7 @@ RemoteDevice::GetProperty(const char* property) /* Throwing */ status_t RemoteDevice::GetProperty(const char* property, uint32* value) /* Throwing */ { + CALLED(); return B_ERROR; } @@ -324,8 +340,8 @@ RemoteDevice::GetProperty(const char* property, uint32* value) /* Throwing */ DeviceClass RemoteDevice::GetDeviceClass() { + CALLED(); return fDeviceClass; } - } diff --git a/src/kits/game/WindowScreen.cpp b/src/kits/game/WindowScreen.cpp index 38d482b2f4..a5773de891 100644 --- a/src/kits/game/WindowScreen.cpp +++ b/src/kits/game/WindowScreen.cpp @@ -536,7 +536,7 @@ BWindowScreen::Suspend(char* label) CALLED(); if (fDebugState) { fprintf(stderr, "## Debugger(\"%s\").", label); - fprintf(stderr, " Press Alt-F%ld or Cmd-F%ld to resume.\n", + fprintf(stderr, " Press Alt-F%" B_PRId32 " or Cmd-F%" B_PRId32 " to resume.\n", fWorkspaceIndex + 1, fWorkspaceIndex + 1); if (IsLocked()) diff --git a/src/kits/interface/TextView.cpp b/src/kits/interface/TextView.cpp index 3d97a6339b..47d665e231 100644 --- a/src/kits/interface/TextView.cpp +++ b/src/kits/interface/TextView.cpp @@ -3343,6 +3343,8 @@ BTextView::_InitObject(BRect textRect, const BFont *initialFont, fInstalledNavigateWordwiseShortcuts = false; fInstalledNavigateToTopOrBottomShortcuts = false; + fInstalledSelectWordwiseShortcuts = false; + fInstalledSelectToTopOrBottomShortcuts = false; // We put these here instead of in the constructor initializer list // to have less code duplication, and a single place where to do changes @@ -3619,6 +3621,7 @@ BTextView::_HandlePageKey(uint32 inPageKey, bool commandKeyDown) currentMessage->FindInt32("modifiers", &mods); bool shiftDown = mods & B_SHIFT_KEY; + bool controlDown = mods & B_CONTROL_KEY; STELine* line = NULL; int32 selStart = fSelStart; int32 selEnd = fSelEnd; @@ -3631,7 +3634,7 @@ BTextView::_HandlePageKey(uint32 inPageKey, bool commandKeyDown) break; } - if (commandKeyDown) { + if (commandKeyDown || controlDown) { _ScrollTo(0, 0); fCaretOffset = 0; } else { @@ -3664,7 +3667,7 @@ BTextView::_HandlePageKey(uint32 inPageKey, bool commandKeyDown) break; } - if (commandKeyDown) { + if (commandKeyDown || controlDown) { _ScrollTo(0, fTextRect.bottom + fLayoutData->bottomInset); fCaretOffset = fText->Length(); } else { @@ -5178,6 +5181,18 @@ BTextView::_Activate() new BMessage(NAVIGATE_TO_NEXT_WORD), this); fInstalledNavigateWordwiseShortcuts = true; } + if (!Window()->HasShortcut(B_LEFT_ARROW, B_COMMAND_KEY | B_SHIFT_KEY) + && !Window()->HasShortcut(B_RIGHT_ARROW, B_COMMAND_KEY | B_SHIFT_KEY)) { + BMessage* message = new BMessage(NAVIGATE_TO_PREVIOUS_WORD); + message->AddInt32("modifiers", B_SHIFT_KEY); + Window()->AddShortcut(B_LEFT_ARROW, B_COMMAND_KEY | B_SHIFT_KEY, + message, this); + message = new BMessage(NAVIGATE_TO_NEXT_WORD); + message->AddInt32("modifiers", B_SHIFT_KEY); + Window()->AddShortcut(B_RIGHT_ARROW, B_COMMAND_KEY | B_SHIFT_KEY, + message, this); + fInstalledSelectWordwiseShortcuts = true; + } if (!Window()->HasShortcut(B_HOME, B_COMMAND_KEY) && !Window()->HasShortcut(B_END, B_COMMAND_KEY)) { Window()->AddShortcut(B_HOME, B_COMMAND_KEY, @@ -5186,6 +5201,18 @@ BTextView::_Activate() new BMessage(NAVIGATE_TO_BOTTOM), this); fInstalledNavigateToTopOrBottomShortcuts = true; } + if (!Window()->HasShortcut(B_HOME, B_COMMAND_KEY | B_SHIFT_KEY) + && !Window()->HasShortcut(B_END, B_COMMAND_KEY | B_SHIFT_KEY)) { + BMessage* message = new BMessage(NAVIGATE_TO_TOP); + message->AddInt32("modifiers", B_SHIFT_KEY); + Window()->AddShortcut(B_HOME, B_COMMAND_KEY | B_SHIFT_KEY, + message, this); + message = new BMessage(NAVIGATE_TO_BOTTOM); + message->AddInt32("modifiers", B_SHIFT_KEY); + Window()->AddShortcut(B_END, B_COMMAND_KEY | B_SHIFT_KEY, + message, this); + fInstalledSelectToTopOrBottomShortcuts = true; + } } } @@ -5212,11 +5239,21 @@ BTextView::_Deactivate() Window()->RemoveShortcut(B_RIGHT_ARROW, B_COMMAND_KEY); fInstalledNavigateWordwiseShortcuts = false; } + if (fInstalledSelectWordwiseShortcuts) { + Window()->RemoveShortcut(B_LEFT_ARROW, B_COMMAND_KEY | B_SHIFT_KEY); + Window()->RemoveShortcut(B_RIGHT_ARROW, B_COMMAND_KEY | B_SHIFT_KEY); + fInstalledSelectWordwiseShortcuts = false; + } if (fInstalledNavigateToTopOrBottomShortcuts) { Window()->RemoveShortcut(B_HOME, B_COMMAND_KEY); Window()->RemoveShortcut(B_END, B_COMMAND_KEY); fInstalledNavigateToTopOrBottomShortcuts = false; } + if (fInstalledSelectToTopOrBottomShortcuts) { + Window()->RemoveShortcut(B_HOME, B_COMMAND_KEY | B_SHIFT_KEY); + Window()->RemoveShortcut(B_END, B_COMMAND_KEY | B_SHIFT_KEY); + fInstalledSelectToTopOrBottomShortcuts = false; + } } } diff --git a/src/kits/interface/Window.cpp b/src/kits/interface/Window.cpp index 78089889e2..10cd771a53 100644 --- a/src/kits/interface/Window.cpp +++ b/src/kits/interface/Window.cpp @@ -2139,13 +2139,13 @@ BWindow::DecoratorFrame() const // else use fall-back values from above } - if (fLook & kLeftTitledWindowLook) { + if (fLook == kLeftTitledWindowLook) { decoratorFrame.top -= borderWidth; - decoratorFrame.left -= tabRect.Width(); + decoratorFrame.left -= borderWidth + tabRect.Width(); decoratorFrame.right += borderWidth; decoratorFrame.bottom += borderWidth; } else { - decoratorFrame.top -= tabRect.Height(); + decoratorFrame.top -= borderWidth + tabRect.Height(); decoratorFrame.left -= borderWidth; decoratorFrame.right += borderWidth; decoratorFrame.bottom += borderWidth; diff --git a/src/kits/midi2/MidiRosterLooper.cpp b/src/kits/midi2/MidiRosterLooper.cpp index c4b64ea501..1b5592b479 100644 --- a/src/kits/midi2/MidiRosterLooper.cpp +++ b/src/kits/midi2/MidiRosterLooper.cpp @@ -47,8 +47,8 @@ BMidiRosterLooper::~BMidiRosterLooper() BMidiEndpoint* endp = EndpointAt(t); if (endp->fRefCount > 0) { fprintf( - stderr, "[midi] WARNING: Endpoint %ld (%p) has " - "not been Release()d properly (refcount = %ld)\n", + stderr, "[midi] WARNING: Endpoint %" B_PRId32 " (%p) has " + "not been Release()d properly (refcount = %" B_PRId32 ")\n", endp->ID(), endp, endp->fRefCount); } else { delete endp; diff --git a/src/kits/print/PicturePrinter.cpp b/src/kits/print/PicturePrinter.cpp index b90d0f64be..5f7a2538cb 100644 --- a/src/kits/print/PicturePrinter.cpp +++ b/src/kits/print/PicturePrinter.cpp @@ -399,7 +399,7 @@ void PicturePrinter::SetFontFlags(int32 flags) { if (flags == 0) Print("none set"); PRINT_FLAG(B_DISABLE_ANTIALIASING); PRINT_FLAG(B_FORCE_ANTIALIASING); - if (flags != f) printf("Unknown Additional Flags %ld", flags & ~f); + if (flags != f) printf("Unknown Additional Flags %" B_PRId32 "", flags & ~f); Cr(); } @@ -420,7 +420,7 @@ void PicturePrinter::SetFontFace(int32 flags) { PRINT_FLAG(B_OUTLINED_FACE); PRINT_FLAG(B_UNDERSCORE_FACE); PRINT_FLAG(B_STRIKEOUT_FACE); - if (flags != f) printf("Unknown Additional Flags %ld", flags & ~f); + if (flags != f) printf("Unknown Additional Flags %" B_PRId32 "", flags & ~f); Cr(); } diff --git a/src/kits/print/PrinterDriverAddOn.cpp b/src/kits/print/PrinterDriverAddOn.cpp index 9befde35c9..3368658135 100644 --- a/src/kits/print/PrinterDriverAddOn.cpp +++ b/src/kits/print/PrinterDriverAddOn.cpp @@ -143,8 +143,8 @@ PrinterDriverAddOn::TakeJob(const char* spoolFile, BDirectory* spoolFolder) // This seems to be required for legacy? // HP PCL3 add-on crashes without it! BMessage parameters(B_REFS_RECEIVED); - parameters.AddInt32("file", (int32)&file); - parameters.AddInt32("printer", (int32)spoolFolder); + parameters.AddInt32("file", (addr_t)&file); + parameters.AddInt32("printer", (addr_t)spoolFolder); BMessage* message = (*func)(&file, spoolFolder, ¶meters); if (message == NULL || message->what != 'okok') diff --git a/src/kits/tracker/AUTHORS b/src/kits/tracker/AUTHORS index 183f215bc1..a000c92b5f 100644 --- a/src/kits/tracker/AUTHORS +++ b/src/kits/tracker/AUTHORS @@ -7,4 +7,4 @@ Jeff Bush, Robert Chinn, Doug Fulton, Kenny Carruthers, -Dianne Hackborn \ No newline at end of file +Dianne Hackborn diff --git a/src/kits/tracker/AttributeStream.h b/src/kits/tracker/AttributeStream.h index f029ad1678..21dfab8e8b 100644 --- a/src/kits/tracker/AttributeStream.h +++ b/src/kits/tracker/AttributeStream.h @@ -79,7 +79,7 @@ public: AttributeInfo(const AttributeInfo &); AttributeInfo(const char*, attr_info); AttributeInfo(const char*, uint32, off_t); - + void SetTo(const AttributeInfo &); void SetTo(const char*, attr_info); void SetTo(const char*, uint32, off_t); @@ -186,7 +186,7 @@ protected: private: AttributeInfo fCurrentAttr; BNode* fNode; - + typedef AttributeStreamNode _inherited; }; @@ -224,7 +224,7 @@ protected: { delete [] fData; } - + AttributeInfo fAttr; char* fData; }; diff --git a/src/kits/tracker/Bitmaps.h b/src/kits/tracker/Bitmaps.h index c04331fd67..b32698ca0e 100644 --- a/src/kits/tracker/Bitmaps.h +++ b/src/kits/tracker/Bitmaps.h @@ -87,7 +87,7 @@ public: private: image_id find_image(void* memAddr) const; - + mutable BLocker fLock; BResources fResources; }; diff --git a/src/kits/tracker/Commands.h b/src/kits/tracker/Commands.h index 869270be48..a98d6147e7 100644 --- a/src/kits/tracker/Commands.h +++ b/src/kits/tracker/Commands.h @@ -140,7 +140,7 @@ const uint32 kUpdateVolumeSpaceBar = 'UpSB'; const uint32 kShowVolumeSpaceBar = 'ShSB'; const uint32 kSpaceBarColorChanged = 'SBcc'; -const uint32 kDontMoveFilesToTrashChanged = 'STdm'; +const uint32 kMoveFilesToTrashChanged = 'STdm'; const uint32 kAskBeforeDeleteFileChanged = 'STad'; } // namespace BPrivate diff --git a/src/kits/tracker/ContainerWindow.cpp b/src/kits/tracker/ContainerWindow.cpp index 6b2611cfcf..c6cf7ce3d8 100644 --- a/src/kits/tracker/ContainerWindow.cpp +++ b/src/kits/tracker/ContainerWindow.cpp @@ -604,7 +604,7 @@ BContainerWindow::BContainerWindow(LockingList* list, app->StartWatching(this, kWindowsShowFullPathChanged); app->StartWatching(this, kSingleWindowBrowseChanged); app->StartWatching(this, kShowNavigatorChanged); - app->StartWatching(this, kDontMoveFilesToTrashChanged); + app->StartWatching(this, kMoveFilesToTrashChanged); app->Unlock(); } @@ -625,7 +625,7 @@ BContainerWindow::~BContainerWindow() app->StopWatching(this, kWindowsShowFullPathChanged); app->StopWatching(this, kSingleWindowBrowseChanged); app->StopWatching(this, kShowNavigatorChanged); - app->StopWatching(this, kDontMoveFilesToTrashChanged); + app->StopWatching(this, kMoveFilesToTrashChanged); app->Unlock(); } @@ -1687,10 +1687,10 @@ BContainerWindow::MessageReceived(BMessage* message) settings.SingleWindowBrowse()); break; - case kDontMoveFilesToTrashChanged: + case kMoveFilesToTrashChanged: { bool dontMoveToTrash - = settings.DontMoveFilesToTrash(); + = settings.MoveFilesToTrash(); BMenuItem* item = fFileContextMenu->FindItem(kMoveToTrash); @@ -1934,8 +1934,8 @@ BContainerWindow::AddFileMenu(BMenu* menu) menu->AddItem(new BMenuItem(B_TRANSLATE("Duplicate"), new BMessage(kDuplicateSelection), 'D')); - menu->AddItem(new BMenuItem(TrackerSettings().DontMoveFilesToTrash() - ? B_TRANSLATE("Delete") : B_TRANSLATE("Move to Trash"), + menu->AddItem(new BMenuItem(TrackerSettings().MoveFilesToTrash() + ? B_TRANSLATE("Move to Trash") : B_TRANSLATE("Delete"), new BMessage(kMoveToTrash), 'T')); menu->AddSeparatorItem(); @@ -2758,8 +2758,8 @@ BContainerWindow::AddFileContextMenus(BMenu* menu) } if (!IsTrash() && !InTrash()) { - menu->AddItem(new BMenuItem(TrackerSettings().DontMoveFilesToTrash() - ? B_TRANSLATE("Delete") : B_TRANSLATE("Move to Trash"), + menu->AddItem(new BMenuItem(TrackerSettings().MoveFilesToTrash() + ? B_TRANSLATE("Move to Trash") : B_TRANSLATE("Delete"), new BMessage(kMoveToTrash), 'T')); // add separator for copy to/move to items (navigation items) diff --git a/src/kits/tracker/DeskWindow.h b/src/kits/tracker/DeskWindow.h index f2099df8a2..d83a55a715 100644 --- a/src/kits/tracker/DeskWindow.h +++ b/src/kits/tracker/DeskWindow.h @@ -67,9 +67,9 @@ public: void UpdateDesktopBackgroundImages(); // Desktop window has special background image handling - + void SaveDesktopPoseLocations(); - + protected: virtual void AddWindowContextMenus(BMenu*); virtual BPoseView* NewPoseView(Model*, BRect, uint32); @@ -84,7 +84,7 @@ private: BPopUpMenu* fTrashContextMenu; BRect fOldFrame; - + // in the desktop window addon shortcuts have to be added by AddShortcut // and we don't always get the MenusBeginning call to check for new // addons/update the shortcuts -- instead we need to node monitor the @@ -93,7 +93,7 @@ private: bool fShouldUpdateAddonShortcuts; std::set fCurrentAddonShortcuts; // keeps track of which shortcuts are installed for Tracker addons - + typedef BContainerWindow _inherited; }; diff --git a/src/kits/tracker/DesktopPoseView.cpp b/src/kits/tracker/DesktopPoseView.cpp index 4a34df9f7e..de9828a3c0 100644 --- a/src/kits/tracker/DesktopPoseView.cpp +++ b/src/kits/tracker/DesktopPoseView.cpp @@ -271,11 +271,11 @@ DesktopPoseView::AdaptToDesktopIntegrationChange(BMessage* message) { bool mountVolumesOnDesktop = true; bool mountSharedVolumesOntoDesktop = true; - + message->FindBool("MountVolumesOntoDesktop", &mountVolumesOnDesktop); message->FindBool("MountSharedVolumesOntoDesktop", &mountSharedVolumesOntoDesktop); - + ShowVolumes(false, mountSharedVolumesOntoDesktop); ShowVolumes(mountVolumesOnDesktop, mountSharedVolumesOntoDesktop); } diff --git a/src/kits/tracker/DesktopPoseView.h b/src/kits/tracker/DesktopPoseView.h index 8d7ffad52e..a6c8731b77 100644 --- a/src/kits/tracker/DesktopPoseView.h +++ b/src/kits/tracker/DesktopPoseView.h @@ -31,7 +31,7 @@ of Be Incorporated in the United States and other countries. Other brand product names are registered trademarks or trademarks of their respective holders. All rights reserved. */ - + // DesktopPoseView adds support for displaying integrated desktops // from multiple volumes to BPoseView #ifndef _DESKTOP_POSE_VIEW_H diff --git a/src/kits/tracker/DialogPane.cpp b/src/kits/tracker/DialogPane.cpp index 06b60369a2..ececc6492d 100644 --- a/src/kits/tracker/DialogPane.cpp +++ b/src/kits/tracker/DialogPane.cpp @@ -505,7 +505,7 @@ PaneSwitch::DrawInState(PaneSwitch::State state) switch (state) { case kCollapsed: BeginLineArray(6); - + if (fLeftAligned) { AddLine(BPoint(rect.left + 3, rect.top + 1), BPoint(rect.left + 3, rect.bottom - 1), outlineColor); diff --git a/src/kits/tracker/DialogPane.h b/src/kits/tracker/DialogPane.h index c9d12a0b8a..495ad7c149 100644 --- a/src/kits/tracker/DialogPane.h +++ b/src/kits/tracker/DialogPane.h @@ -68,15 +68,15 @@ public: uint32 flags = B_WILL_DRAW); virtual ~DialogPane(); - + BRect FrameForMode(int32); BRect BoundsForMode(int32); - + int32 Mode() const; virtual void SetMode(int32, bool initialSetup = false); - + void AddItem(BView*, int32 toMode); - + void SetSwitch(BControl*); virtual void AttachedToWindow(); @@ -87,18 +87,18 @@ protected: // called only by the constructor virtual void MessageReceived(BMessage* message); - + private: int32 fMode; BRect fMode1Frame; BRect fMode2Frame; BRect fMode3Frame; - + ViewList fMode2Items; ViewList fMode3Items; BControl* fLatch; - + typedef BView _inherited; }; diff --git a/src/kits/tracker/FBCPadding.cpp b/src/kits/tracker/FBCPadding.cpp index 9b1ac457cb..20aef9e3a8 100644 --- a/src/kits/tracker/FBCPadding.cpp +++ b/src/kits/tracker/FBCPadding.cpp @@ -145,6 +145,6 @@ SetPanelDirectory__10BFilePanelFP9entry_ref { self->SetPanelDirectory(r); } - + } #endif diff --git a/src/kits/tracker/FSClipboard.cpp b/src/kits/tracker/FSClipboard.cpp index ce90756fc5..851ce4ad34 100644 --- a/src/kits/tracker/FSClipboard.cpp +++ b/src/kits/tracker/FSClipboard.cpp @@ -266,7 +266,7 @@ FSClipboardAddPoses(const node_ref* directory, PoseList* list, refsAdded++; } else { clip->RemoveName(modeName); - + clipNode.node = *node; clipNode.moveMode = kDelete; // note removing node updateMessage.AddData("tcnode", T_CLIPBOARD_NODE, @@ -280,7 +280,7 @@ FSClipboardAddPoses(const node_ref* directory, PoseList* list, if (clip->AddRef(refName, model->EntryRef()) == B_OK && clip->AddInt32(modeName, (int32)moveMode) == B_OK) { pose->SetClipboardMode(moveMode); - + clipNode.node = *node; updateMessage.AddData("tcnode", T_CLIPBOARD_NODE, &clipNode, sizeof(TClipboardNodeRef), true, @@ -422,7 +422,7 @@ FSClipboardPaste(Model* model, uint32 linksMode) uint32 newMoveMode = 0; bool sameDirectory = destNodeRef->device == ref.device && destNodeRef->node == ref.directory; - + if (!entry.Exists()) { // The entry doesn't exist anymore, so we'll remove // that entry from the clipboard as well @@ -567,7 +567,7 @@ FSClipboardFindNodeMode(Model* model, bool autoLock, bool updateRefIfNeeded) } if (change) be_clipboard->Commit(); - + if (autoLock) be_clipboard->Unlock(); @@ -744,7 +744,7 @@ BClipboardRefsWatcher::UpdateNode(node_ref* node, entry_ref* ref) clip->RemoveName(name); MakeModeName(name); clip->RemoveName(name); - + RemoveNode(node); } be_clipboard->Commit(); diff --git a/src/kits/tracker/FSUtils.cpp b/src/kits/tracker/FSUtils.cpp index 040b2a4063..b5821180d2 100644 --- a/src/kits/tracker/FSUtils.cpp +++ b/src/kits/tracker/FSUtils.cpp @@ -2842,9 +2842,9 @@ status_t _DeleteTask(BObjectList* list, bool confirm) { if (confirm) { - bool dontMoveToTrash = TrackerSettings().DontMoveFilesToTrash(); + bool MoveToTrash = TrackerSettings().MoveFilesToTrash(); - if (!dontMoveToTrash) { + if (MoveToTrash) { BAlert* alert = new BAlert("", B_TRANSLATE_NOCOLLECT(kDeleteConfirmationStr), B_TRANSLATE("Cancel"), B_TRANSLATE("Move to Trash"), diff --git a/src/kits/tracker/FavoritesMenu.cpp b/src/kits/tracker/FavoritesMenu.cpp index 294448a326..ba169b15f6 100644 --- a/src/kits/tracker/FavoritesMenu.cpp +++ b/src/kits/tracker/FavoritesMenu.cpp @@ -166,7 +166,7 @@ FavoritesMenu::AddNextItem() BMenuItem* item = BNavMenu::NewModelItem(&model, model.IsDirectory() ? fOpenFolderMessage : fOpenFileMessage, fTarget); - + if (item == NULL) return true; @@ -314,7 +314,7 @@ FavoritesMenu::ShouldShowModel(const Model* model) if (!fRefFilter || model->Node() == NULL) return true; - + struct stat_beos statBeOS; convert_to_stat_beos(model->StatBuf(), &statBeOS); diff --git a/src/kits/tracker/FavoritesMenu.h b/src/kits/tracker/FavoritesMenu.h index 2863534bf4..496d77a5d5 100644 --- a/src/kits/tracker/FavoritesMenu.h +++ b/src/kits/tracker/FavoritesMenu.h @@ -58,7 +58,7 @@ class FavoritesMenu : public BSlowMenu { BMessage* openFileMessage, const BMessenger &, bool isSavePanel, BRefFilter* filter = NULL); virtual ~FavoritesMenu(); - + void SetRefFilter(BRefFilter* filter); private: @@ -67,9 +67,9 @@ class FavoritesMenu : public BSlowMenu { virtual bool AddNextItem(); virtual void DoneBuildingItemList(); virtual void ClearMenuBuildingState(); - + bool ShouldShowModel(const Model* model); - + BMessage* fOpenFolderMessage; BMessage* fOpenFileMessage; BMessenger fTarget; diff --git a/src/kits/tracker/FilePanelPriv.cpp b/src/kits/tracker/FilePanelPriv.cpp index 70d8cc3432..64cb1326ed 100644 --- a/src/kits/tracker/FilePanelPriv.cpp +++ b/src/kits/tracker/FilePanelPriv.cpp @@ -885,9 +885,9 @@ TFilePanel::AddFileContextMenus(BMenu* menu) new BMessage(kGetInfo), 'I')); menu->AddItem(new BMenuItem(B_TRANSLATE("Edit name"), new BMessage(kEditItem), 'E')); - menu->AddItem(new BMenuItem(TrackerSettings().DontMoveFilesToTrash() - ? B_TRANSLATE("Delete") - : B_TRANSLATE("Move to Trash"), + menu->AddItem(new BMenuItem(TrackerSettings().MoveFilesToTrash() + ? B_TRANSLATE("Move to Trash") + : B_TRANSLATE("Delete"), new BMessage(kMoveToTrash), 'T')); menu->AddSeparatorItem(); menu->AddItem(new BMenuItem(B_TRANSLATE("Cut"), diff --git a/src/kits/tracker/FindPanel.cpp b/src/kits/tracker/FindPanel.cpp index 939fb192f8..258f39bab3 100644 --- a/src/kits/tracker/FindPanel.cpp +++ b/src/kits/tracker/FindPanel.cpp @@ -219,7 +219,7 @@ FindWindow::FindWindow(const entry_ref* newRef, bool editIfTemplateOnly) fFromTemplate = IsQueryTemplate(fFile); - fBackground = new FindPanel(Bounds(), fFile, this, fFromTemplate, + fBackground = new FindPanel(Bounds(), fFile, this, fFromTemplate, fEditTemplateOnly); AddChild(fBackground); } diff --git a/src/kits/tracker/FunctionObject.h b/src/kits/tracker/FunctionObject.h index 9b53ae7a6f..d3a406185c 100644 --- a/src/kits/tracker/FunctionObject.h +++ b/src/kits/tracker/FunctionObject.h @@ -240,7 +240,7 @@ public: p3(p3) { } - + virtual void operator()() { (function)(p1.Pass(), p2.Pass(), p3.Pass()); } private: diff --git a/src/kits/tracker/GroupedMenu.cpp b/src/kits/tracker/GroupedMenu.cpp index 7d73de2a25..4b3323c38f 100644 --- a/src/kits/tracker/GroupedMenu.cpp +++ b/src/kits/tracker/GroupedMenu.cpp @@ -24,7 +24,7 @@ TMenuItemGroup::TMenuItemGroup(const char* name) TMenuItemGroup::~TMenuItemGroup() { free((char*)fName); - + if (fMenu == NULL) { BMenuItem* item; while ((item = RemoveItem((int32)0)) != NULL) diff --git a/src/kits/tracker/IconCache.cpp b/src/kits/tracker/IconCache.cpp index 8cf9d8e195..d64e140113 100644 --- a/src/kits/tracker/IconCache.cpp +++ b/src/kits/tracker/IconCache.cpp @@ -526,7 +526,7 @@ IconCache::GetIconFromFileTypes(ModelNodeLazyOpener* modelOpener, (SharedCacheEntry*)entry); // OK to cast here, have a runtime check source = kPreferredAppForNode; - // set source as preferred for node, so that next time we + // set source as preferred for node, so that next time we // get a hit in the initial find that uses // GetIconForPreferredApp } else diff --git a/src/kits/tracker/IconCache.h b/src/kits/tracker/IconCache.h index 9ca10f2cc0..571489ac8a 100644 --- a/src/kits/tracker/IconCache.h +++ b/src/kits/tracker/IconCache.h @@ -126,15 +126,15 @@ class IconCacheEntry { public: IconCacheEntry(); ~IconCacheEntry(); - + void SetAliasFor(const SharedIconCache*, const SharedCacheEntry*); static IconCacheEntry* ResolveIfAlias(const SharedIconCache*, IconCacheEntry*); IconCacheEntry* ResolveIfAlias(const SharedIconCache*); - + void SetIcon(BBitmap* bitmap, IconDrawMode mode, icon_size size, bool create = false); - + bool HaveIconBitmap(IconDrawMode mode, icon_size size) const; bool CanConstructBitmap(IconDrawMode mode, icon_size size) const; static bool AlternateModeForIconConstructing(IconDrawMode requestedMode, @@ -169,9 +169,9 @@ protected: BBitmap* fHilitedLargeIcon; BBitmap* fHilitedMiniIcon; int32 fAliasForIndex; - + // list of other icon kinds would be added here - + friend class SharedIconCache; friend class NodeIconCache; }; @@ -191,7 +191,7 @@ public: bool Lock(); void Unlock(); bool IsLocked() const; - + private: Benaphore fLock; }; @@ -210,7 +210,7 @@ public: const char* FileType() const; const char* AppSignature() const; - + // hash table support uint32 Hash() const; static uint32 Hash(const char* fileType, const char* appSignature = 0); @@ -277,19 +277,19 @@ public: NodeCacheEntry(const node_ref*, bool permanent = false); void Draw(BView*, BPoint, IconDrawMode mode, icon_size size, bool async = false); - + void Draw(BView*, BPoint, IconDrawMode, icon_size, void (*)(BView*, BPoint, BBitmap*, void*), void* = NULL); const node_ref* Node() const; - + uint32 Hash() const; static uint32 Hash(const node_ref*); bool operator==(const NodeCacheEntry&) const; void SetTo(const node_ref*); void MakePermanent(); bool Permanent() const; - + int32 fNext; private: node_ref fRef; @@ -348,7 +348,7 @@ const int32 kColorTransformTableSize = 256; class IconCache { public: IconCache(); - + void Draw(Model*, BView*, BPoint where, IconDrawMode mode, icon_size size, bool async = false); // draw an icon for a model, load the icon from the appropriate @@ -376,13 +376,13 @@ public: void Deleting(const BView*); // hook to manage deleting draw view caches for views that are // going away - + // icon changed calls, used when a node or a file type has an icon changed // the icons for the node/file type will be flushed and re-cached during // the next draw void IconChanged(Model*); void IconChanged(const char* mimeType, const char* appSignature); - + bool IsIconFrom(const Model*, const char* mimeType, const char* appSignature) const; // called when metamime database changed to figure out which models @@ -510,7 +510,7 @@ SharedIconCache::ResolveIfAlias(IconCacheEntry* entry) const { if (entry->fAliasForIndex < 0) return entry; - + return fHashTable.ElementAt(entry->fAliasForIndex); } diff --git a/src/kits/tracker/InfoWindow.cpp b/src/kits/tracker/InfoWindow.cpp index b5c9840ad3..f07c50342a 100644 --- a/src/kits/tracker/InfoWindow.cpp +++ b/src/kits/tracker/InfoWindow.cpp @@ -2129,7 +2129,7 @@ AttributeView::BuildContextMenu(BMenu* parent) parent->AddItem(new BMenuItem(B_TRANSLATE("Edit name"), new BMessage(kEditItem), 'E')); parent->AddSeparatorItem(); - + if (fModel->IsVolume()) { BMenuItem* item = new BMenuItem(B_TRANSLATE("Unmount"), new BMessage(kUnmountVolume), 'U'); diff --git a/src/kits/tracker/MiniMenuField.cpp b/src/kits/tracker/MiniMenuField.cpp index c67af408c7..27ac5181e7 100644 --- a/src/kits/tracker/MiniMenuField.cpp +++ b/src/kits/tracker/MiniMenuField.cpp @@ -100,14 +100,14 @@ MiniMenuField::Draw(BRect) BRect rect(bounds); rect.right--; rect.bottom--; - + rgb_color darkest = tint_color(kBlack, 0.6f); rgb_color dark = tint_color(kBlack, 0.4f); rgb_color medium = dark; rgb_color light = tint_color(kBlack, 0.03f); - + SetHighColor(medium); - + // draw frame and shadow BeginLineArray(10); AddLine(rect.RightTop(), rect.RightBottom(), darkest); @@ -123,7 +123,7 @@ MiniMenuField::Draw(BRect) AddLine(rect.LeftTop(), rect.RightTop(), light); EndLineArray(); - + // draw triangle rect = BRect(5, 5, 15, 15); const rgb_color outlineColor = kBlack; diff --git a/src/kits/tracker/Navigator.cpp b/src/kits/tracker/Navigator.cpp index 5aff95950f..9f29594587 100644 --- a/src/kits/tracker/Navigator.cpp +++ b/src/kits/tracker/Navigator.cpp @@ -85,7 +85,7 @@ BNavigatorButton::AttachedToWindow() &bmpOn); SetPicture(bmpOn, true, true); delete bmpOn; - + BBitmap* bmpOff = 0; GetTrackerResources()->GetBitmapResource(B_MESSAGE_TYPE, fResIDOff, &bmpOff); @@ -139,7 +139,7 @@ BNavigator::BNavigator(const Model* model, BRect rect, uint32 resizeMask) { // Get initial path model->GetPath(&fPath); - + SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); float top = 2 + (be_plain_font->Size() - 8) / 2; @@ -298,14 +298,14 @@ BNavigator::SendNavigationMessage(NavigationAction action, BEntry* entry, BMessage message; message.AddRef("refs", &ref); message.AddInt32("action", action); - + // get the node of this folder for selecting it in the new location const node_ref* nodeRef; if (Window() && Window()->TargetModel()) nodeRef = Window()->TargetModel()->NodeRef(); else nodeRef = NULL; - + // if the option key was held down, open in new window (send message // to be_app) otherwise send message to this window. TTracker // (be_app) understands nodeRefToSlection, BContainerWindow doesn't, @@ -361,7 +361,7 @@ BNavigator::GoTo() Window()->PostMessage(&message); } else { BPath path; - + if (Window() && Window()->TargetModel()) { Window()->TargetModel()->GetPath(&path); fLocation->SetText(path.Path()); diff --git a/src/kits/tracker/Navigator.h b/src/kits/tracker/Navigator.h index be31770547..56fe2d42d7 100644 --- a/src/kits/tracker/Navigator.h +++ b/src/kits/tracker/Navigator.h @@ -68,9 +68,9 @@ class BNavigatorButton : public BPictureButton { public: BNavigatorButton(BRect rect, const char* name, BMessage* message, int32 resIDon, int32 resIDoff, int32 resIDdisabled); - + ~BNavigatorButton(); - + virtual void AttachedToWindow(); void SetPicture(BBitmap*, bool enabled, bool on); diff --git a/src/kits/tracker/NodePreloader.cpp b/src/kits/tracker/NodePreloader.cpp index d01333868a..dbea4199dc 100644 --- a/src/kits/tracker/NodePreloader.cpp +++ b/src/kits/tracker/NodePreloader.cpp @@ -106,7 +106,7 @@ void NodePreloader::MessageReceived(BMessage* message) { // respond to node monitor notifications - + node_ref itemNode; switch (message->what) { case B_NODE_MONITOR: @@ -173,7 +173,7 @@ NodePreloader::PreloadOne(const char* dirPath) entry_ref ref; if (dir.GetNextRef(&ref) != B_OK) break; - + BEntry entry(&ref); if (!entry.IsFile()) // only interrested in files diff --git a/src/kits/tracker/NodeWalker.cpp b/src/kits/tracker/NodeWalker.cpp index e95ef660a8..b539644edc 100644 --- a/src/kits/tracker/NodeWalker.cpp +++ b/src/kits/tracker/NodeWalker.cpp @@ -258,7 +258,7 @@ status_t TNodeWalker::PopDirCommon() { ASSERT(fTopIndex >= 0); - + // done with the old dir, pop it fDirs.RemoveItemAt(fTopIndex); fTopIndex--; @@ -303,7 +303,7 @@ TNodeWalker::GetNextEntry(BEntry* entry, bool traverse) fIncludeTopDir = false; return fTopDir->GetEntry(entry); } - + // Get the next entry. status_t err = fTopDir->GetNextEntry(entry, traverse); @@ -346,7 +346,7 @@ TNodeWalker::GetNextRef(entry_ref* ref) err = entry.GetRef(ref); return err; } - + // Get the next entry. status_t err = fTopDir->GetNextRef(ref); if (err != B_OK) { @@ -370,7 +370,7 @@ build_dirent(const BEntry* source, struct dirent* ent, { entry_ref ref; source->GetRef(&ref); - + size_t recordLength = strlen(ref.name) + sizeof(dirent); if (recordLength > size || count <= 0) // can't fit in buffer, bail @@ -424,7 +424,7 @@ TNodeWalker::GetNextDirents(struct dirent* ent, size_t size, int32 count) return build_dirent(fJustFile, ent, size, count); } - + // Get the next entry. int32 result = fTopDir->GetNextDirents(ent, size, count); diff --git a/src/kits/tracker/NodeWalker.h b/src/kits/tracker/NodeWalker.h index f13f65e23b..8cf76385cd 100644 --- a/src/kits/tracker/NodeWalker.h +++ b/src/kits/tracker/NodeWalker.h @@ -57,7 +57,7 @@ class TWalker : public BEntryList { public: virtual ~TWalker(); - + virtual status_t GetNextEntry(BEntry*, bool traverse = false) = 0; virtual status_t GetNextRef(entry_ref*) = 0; virtual int32 GetNextDirents(struct dirent*, size_t, @@ -83,7 +83,7 @@ public: TNodeWalker(const char* path); TNodeWalker(const entry_ref* ref); TNodeWalker(const BDirectory* dir); - + virtual status_t GetNextEntry(BEntry*, bool traverse = false); virtual status_t GetNextRef(entry_ref*); virtual int32 GetNextDirents(struct dirent*, size_t, @@ -126,7 +126,7 @@ public: virtual int32 GetNextDirents(struct dirent*, size_t, int32 count = INT_MAX); virtual status_t Rewind(); - + virtual status_t NextVolume(); // skips to the next volume // Note: it would be cool to return const BVolume* @@ -150,13 +150,13 @@ class TQueryWalker : public TWalker { public: TQueryWalker(const char* predicate); virtual ~TQueryWalker(); - + // Does an in-fix walk of all entries virtual status_t GetNextEntry(BEntry*, bool traverse = false); virtual status_t GetNextRef(entry_ref*); virtual int32 GetNextDirents(struct dirent*, size_t, int32 count = INT_MAX); - + virtual status_t NextVolume(); // skips to the next volume virtual status_t Rewind(); @@ -164,7 +164,7 @@ public: private: virtual int32 CountEntries(); // can't count - + BQuery fQuery; BVolumeRoster fVolRoster; BVolume fVol; diff --git a/src/kits/tracker/OverrideAlert.cpp b/src/kits/tracker/OverrideAlert.cpp index b282b8006f..6c74d45abe 100644 --- a/src/kits/tracker/OverrideAlert.cpp +++ b/src/kits/tracker/OverrideAlert.cpp @@ -53,7 +53,7 @@ OverrideAlert::OverrideAlert(const char* title, const char* text, fButtonModifiers[1] = modifiers2; fButtonModifiers[2] = modifiers3; UpdateButtons(modifiers(), true); - + BPoint where = OverPosition(Frame().Width(), Frame().Height()); MoveTo(where.x, where.y); } @@ -71,7 +71,7 @@ OverrideAlert::OverrideAlert(const char* title, const char* text, fButtonModifiers[1] = modifiers2; fButtonModifiers[2] = modifiers3; UpdateButtons(modifiers(), true); - + BPoint where = OverPosition(Frame().Width(), Frame().Height()); MoveTo(where.x, where.y); } @@ -89,7 +89,7 @@ OverrideAlert::DispatchMessage(BMessage* message, BHandler* handler) || message->what == B_UNMAPPED_KEY_DOWN || message->what == B_UNMAPPED_KEY_UP) { uint32 modifiers; - if (message->FindInt32("modifiers", (int32*)&modifiers) == B_OK) + if (message->FindInt32("modifiers", (int32*)&modifiers) == B_OK) UpdateButtons(modifiers); } BAlert::DispatchMessage(message, handler); @@ -107,36 +107,36 @@ OverrideAlert::OverPosition(float width, float height) BRect screenFrame; BRect desirableRect; screenFrame = BScreen(window).Frame(); - + if (window) { // If we found a window associated with this calling thread, // place alert over that window so that the first button is // on top of it. This allows name editing confirmations to // work with focus follows mouse -- when the alert goes away, // the underlying window will still have focus. - + desirableRect = window->Frame(); float midX = (desirableRect.left + desirableRect.right) / 2.0f; float midY = (desirableRect.top * 3.0f + desirableRect.bottom) / 4.0f; - + desirableRect.left = midX - ceilf(width / 2.0f); desirableRect.right = desirableRect.left+width; desirableRect.top = midY - ceilf(height / 3.0f); desirableRect.bottom = desirableRect.top + height; - + } else { // Otherwise, just place alert in center of screen. - + desirableRect = screenFrame; float midX = (desirableRect.left + desirableRect.right) / 2.0f; float midY = (desirableRect.top * 3.0f + desirableRect.bottom) / 4.0f; - + desirableRect.left = midX - ceilf(width / 2.0f); desirableRect.right = desirableRect.left + width; desirableRect.top = midY - ceilf(height / 3.0f); desirableRect.bottom = desirableRect.top + height; } - + return desirableRect.LeftTop(); } @@ -146,7 +146,7 @@ OverrideAlert::UpdateButtons(uint32 modifiers, bool force) { if (modifiers == fCurModifiers && !force) return; - + fCurModifiers = modifiers; for (int32 i = 0; i < 3; i++) { BButton* button = ButtonAt(i); diff --git a/src/kits/tracker/Pose.cpp b/src/kits/tracker/Pose.cpp index 7befef5792..88ddbc0c82 100644 --- a/src/kits/tracker/Pose.cpp +++ b/src/kits/tracker/Pose.cpp @@ -143,7 +143,7 @@ BPose::AddWidget(BPoseView* poseView, BColumn* column) BModelOpener opener(fModel); if (fModel->InitCheck() != B_OK) return NULL; - + BTextWidget* widget = new BTextWidget(fModel, column, poseView); fWidgetList.AddItem(widget); return widget; @@ -157,7 +157,7 @@ BPose::AddWidget(BPoseView* poseView, BColumn* column, opener.OpenNode(); if (fModel->InitCheck() != B_OK) return NULL; - + BTextWidget* widget = new BTextWidget(fModel, column, poseView); fWidgetList.AddItem(widget); return widget; @@ -494,7 +494,7 @@ BPose::PointInPose(const BPoseView* poseView, BPoint where) const return rect.Contains(where); } - + // MINI_ICON_MODE rect calc BRect rect(location, location); rect.right += B_MINI_ICON + kMiniIconSeparator; @@ -502,7 +502,7 @@ BPose::PointInPose(const BPoseView* poseView, BPoint where) const BTextWidget* widget = WidgetFor(poseView->FirstColumn()->AttrHash()); if (widget) rect.right += ceil(widget->TextWidth(poseView) + 1); - + return rect.Contains(where); } @@ -552,14 +552,14 @@ BPose::Draw(BRect rect, const BRect& updateRect, BPoseView* poseView, return; } else fBackgroundClean = false; - + bool directDraw = (drawView == poseView); bool windowActive = poseView->Window()->IsActive(); bool showSelectionWhenInactive = poseView->fShowSelectionWhenInactive; bool isDrawingSelectionRect = poseView->fIsDrawingSelectionRect; - + ModelNodeLazyOpener modelOpener(fModel); - + if (poseView->ViewMode() == kListMode) { uint32 size = poseView->IconSizeInt(); BRect iconRect(rect); @@ -571,37 +571,37 @@ BPose::Draw(BRect rect, const BRect& updateRect, BPoseView* poseView, DrawIcon(iconRect.LeftTop(), drawView, poseView->IconSize(), directDraw, !windowActive && !showSelectionWhenInactive); } - + // draw text int32 columnsToDraw = 1; if (fullDraw) columnsToDraw = poseView->CountColumns(); - + for (int32 index = 0; index < columnsToDraw; index++) { BColumn* column = poseView->ColumnAt(index); if (!column) break; - + // if widget doesn't exist, create it BTextWidget* widget = WidgetFor(column, poseView, modelOpener); - + if (widget && widget->IsVisible()) { BRect widgetRect(widget->ColumnRect(rect.LeftTop(), column, poseView)); - + if (updateRect.Intersects(widgetRect)) { BRect widgetTextRect(widget->CalcRect(rect.LeftTop(), column, poseView)); - + bool selectDuringDraw = directDraw && selected && windowActive; - + if (index == 0 && selectDuringDraw) { //draw with dark background to select text drawView->PushState(); drawView->SetLowColor(0, 0, 0); } - + if (index == 0) { widget->Draw(widgetRect, widgetTextRect, column->Width(), poseView, drawView, selected, @@ -611,7 +611,7 @@ BPose::Draw(BRect rect, const BRect& updateRect, BPoseView* poseView, poseView, drawView, false, fClipboardMode, offset, directDraw); } - + if (index == 0 && selectDuringDraw) drawView->PopState(); else if (index == 0 && selected) { @@ -640,11 +640,11 @@ BPose::Draw(BRect rect, const BRect& updateRect, BPoseView* poseView, DrawIcon(iconOrigin, drawView, poseView->IconSize(), directDraw, !windowActive && !showSelectionWhenInactive); - + BColumn* column = poseView->FirstColumn(); if (!column) return; - + BTextWidget* widget = WidgetFor(column, poseView, modelOpener); if (!widget || !widget->IsVisible()) return; @@ -653,7 +653,7 @@ BPose::Draw(BRect rect, const BRect& updateRect, BPoseView* poseView, bool selectDuringDraw = directDraw && selected && (poseView->IsDesktopWindow() || windowActive); - + if (selectDuringDraw) { // draw with dark background to select text drawView->PushState(); @@ -698,7 +698,7 @@ BPose::DeselectWithoutErasingBackground(BRect, BPoseView* poseView) BColumn* column = poseView->FirstColumn(); if (!column) return; - + BTextWidget* widget = WidgetFor(column->AttrHash()); if (!widget || !widget->IsVisible()) return; diff --git a/src/kits/tracker/PoseList.cpp b/src/kits/tracker/PoseList.cpp index d90e7b077a..b805827356 100644 --- a/src/kits/tracker/PoseList.cpp +++ b/src/kits/tracker/PoseList.cpp @@ -126,7 +126,7 @@ PoseList::FindAllPoses(const node_ref* node) const result->AddItem(pose, 0); continue; } - + if (!model->IsSymLink()) continue; @@ -135,7 +135,7 @@ PoseList::FindAllPoses(const node_ref* node) const result->AddItem(pose); continue; } - + if (model == NULL) { Model model(pose->TargetModel()->EntryRef(), true); if (*model.NodeRef() == *node) diff --git a/src/kits/tracker/PoseView.cpp b/src/kits/tracker/PoseView.cpp index 23e356b5af..87ea8b3bf4 100644 --- a/src/kits/tracker/PoseView.cpp +++ b/src/kits/tracker/PoseView.cpp @@ -2323,7 +2323,7 @@ BPoseView::MessageReceived(BMessage* message) { TrackerSettings settings; - if ((modifiers() & B_SHIFT_KEY) != 0 || settings.DontMoveFilesToTrash()) + if ((modifiers() & B_SHIFT_KEY) != 0 || !settings.MoveFilesToTrash()) DeleteSelection(true, settings.AskBeforeDeleteFile()); else MoveSelectionToTrash(); @@ -6461,7 +6461,7 @@ BPoseView::KeyDown(const char* bytes, int32 count) } else { TrackerSettings settings; - if ((modifiers() & B_SHIFT_KEY) != 0 || settings.DontMoveFilesToTrash()) + if ((modifiers() & B_SHIFT_KEY) != 0 || !settings.MoveFilesToTrash()) DeleteSelection(true, settings.AskBeforeDeleteFile()); else MoveSelectionToTrash(); @@ -8366,7 +8366,7 @@ BPoseView::OpenParent() void BPoseView::IdentifySelection(bool force) -{ +{ int32 count = fSelectionList->CountItems(); for (int32 index = 0; index < count; index++) { BPose* pose = fSelectionList->ItemAt(index); diff --git a/src/kits/tracker/PoseViewScripting.cpp b/src/kits/tracker/PoseViewScripting.cpp index 0d87eb2ccd..94089a3e48 100644 --- a/src/kits/tracker/PoseViewScripting.cpp +++ b/src/kits/tracker/PoseViewScripting.cpp @@ -214,7 +214,7 @@ BPoseView::GetSupportedSuites(BMessage* _SCRIPTING_ONLY(data)) BPropertyInfo propertyInfo( const_cast(kPosesPropertyList)); data->AddFlat("messages", &propertyInfo); - + return _inherited::GetSupportedSuites(data); #else return B_UNSUPPORTED; @@ -247,9 +247,9 @@ BPoseView::HandleScriptingMessage(BMessage* _SCRIPTING_ONLY(message)) if (result != B_OK || index == -1) return false; - + ASSERT(property); - + switch (message->what) { case B_CREATE_PROPERTY: handled = CreateProperty(message, &specifier, form, property, @@ -259,12 +259,12 @@ BPoseView::HandleScriptingMessage(BMessage* _SCRIPTING_ONLY(message)) case B_GET_PROPERTY: handled = GetProperty(&specifier, form, property, &reply); break; - + case B_SET_PROPERTY: handled = SetProperty(message, &specifier, form, property, &reply); break; - + case B_COUNT_PROPERTIES: handled = CountProperty(&specifier, form, property, &reply); break; @@ -272,7 +272,7 @@ BPoseView::HandleScriptingMessage(BMessage* _SCRIPTING_ONLY(message)) case B_DELETE_PROPERTY: handled = DeleteProperty(&specifier, form, property, &reply); break; - + case B_EXECUTE_PROPERTY: handled = ExecuteProperty(&specifier, form, property, &reply); break; @@ -300,7 +300,7 @@ BPoseView::ExecuteProperty(BMessage* _SCRIPTING_ONLY(specifier), bool handled = false; if (strcmp(property, kPropertyEntry) == 0) { BMessage launchMessage(B_REFS_RECEIVED); - + if (form == (int32)B_ENTRY_SPECIFIER) { // move all poses specified by entry_ref to Trash entry_ref ref; @@ -491,7 +491,7 @@ BPoseView::DeleteProperty(BMessage* _SCRIPTING_ONLY(specifier), if (error == B_OK) { TrackerSettings settings; - if (!settings.DontMoveFilesToTrash()) { + if (settings.MoveFilesToTrash()) { // move the list we build into trash, don't make the // trashing task select the next item MoveListToTrash(entryList, false, false); @@ -574,21 +574,21 @@ BPoseView::GetProperty(BMessage* _SCRIPTING_ONLY(specifier), entry_ref ref; if (specifier->FindRef("data", &ref) != B_OK) break; - + int32 poseIndex; BPose* pose = FindPose(&ref, &poseIndex); - + for (;;) { if (form == (int32)kPreviousSpecifier) pose = PoseAtIndex(--poseIndex); else if (form == (int32)kNextSpecifier) pose = PoseAtIndex(++poseIndex); - + if (!pose) { error = B_ENTRY_NOT_FOUND; break; } - + if (pose->IsSelected()) { reply->AddRef("result", pose->TargetModel()->EntryRef()); @@ -596,7 +596,7 @@ BPoseView::GetProperty(BMessage* _SCRIPTING_ONLY(specifier), break; } } - + handled = true; break; } @@ -622,7 +622,7 @@ BPoseView::GetProperty(BMessage* _SCRIPTING_ONLY(specifier), int32 index; if (specifier->FindInt32("index", &index) != B_OK) break; - + if (!PoseAtIndex(index)) { error = B_BAD_INDEX; handled = true; @@ -643,7 +643,7 @@ BPoseView::GetProperty(BMessage* _SCRIPTING_ONLY(specifier), entry_ref ref; if (specifier->FindRef("data", &ref) != B_OK) break; - + int32 tmp; BPose* pose = FindPose(&ref, form, &tmp); @@ -652,7 +652,7 @@ BPoseView::GetProperty(BMessage* _SCRIPTING_ONLY(specifier), handled = true; break; } - + reply->AddRef("result", pose->TargetModel()->EntryRef()); reply->AddInt32("index", IndexOfPose(pose)); @@ -661,7 +661,7 @@ BPoseView::GetProperty(BMessage* _SCRIPTING_ONLY(specifier), } } } - + if (error != B_OK) reply->AddInt32("error", error); diff --git a/src/kits/tracker/QueryPoseView.cpp b/src/kits/tracker/QueryPoseView.cpp index b74a3a9f1d..30723ce196 100644 --- a/src/kits/tracker/QueryPoseView.cpp +++ b/src/kits/tracker/QueryPoseView.cpp @@ -264,20 +264,20 @@ BQueryPoseView::InitDirentIterator(const entry_ref* ref) fQueryListContainer = new QueryEntryListCollection(&sourceModel, this, oldPoseList); fCreateOldPoseList = false; - + if (fQueryListContainer->InitCheck() != B_OK) { delete fQueryListContainer; fQueryListContainer = NULL; return NULL; } - + fShowResultsFromTrash = fQueryListContainer->ShowResultsFromTrash(); TTracker::WatchNode(sourceModel.NodeRef(), B_WATCH_NAME | B_WATCH_STAT | B_WATCH_ATTR, this); fQueryList = fQueryListContainer->QueryList(); - + if (fQueryListContainer->DynamicDateQuery()) { // calculate the time to trigger the query refresh - next midnight @@ -328,7 +328,7 @@ BQueryPoseView::InitDirentIterator(const entry_ref* ref) PRINT(("%" B_PRId32 " hours, %" B_PRId32 " minutes, %" B_PRId32 " seconds till midnight\n", hoursTillMidnight, minutesTillMidnight, secondsTillMidnight)); - + int32 refreshInSeconds = delta % 60; int32 refreshInMinutes = delta / 60; int32 refreshInHours = refreshInMinutes / 60; @@ -348,7 +348,7 @@ BQueryPoseView::InitDirentIterator(const entry_ref* ref) NewLockingMemberFunctionObject(&BQueryPoseView::Refresh, this), delta); } - + return fQueryListContainer->Clone(); } @@ -603,7 +603,7 @@ status_t QueryEntryListCollection::GetNextEntry(BEntry* entry, bool traverse) { status_t result = B_ERROR; - + for (int32 count = fQueryListRep->fQueryList->CountItems(); fQueryListRep->fQueryListIndex < count; fQueryListRep->fQueryListIndex++) { @@ -641,7 +641,7 @@ status_t QueryEntryListCollection::GetNextRef(entry_ref* ref) { status_t result = B_ERROR; - + for (int32 count = fQueryListRep->fQueryList->CountItems(); fQueryListRep->fQueryListIndex < count; fQueryListRep->fQueryListIndex++) { @@ -660,7 +660,7 @@ status_t QueryEntryListCollection::Rewind() { fQueryListRep->fQueryListIndex = 0; - + return B_OK; } diff --git a/src/kits/tracker/RecentItems.h b/src/kits/tracker/RecentItems.h index 7bfb60c23d..b40655eaba 100644 --- a/src/kits/tracker/RecentItems.h +++ b/src/kits/tracker/RecentItems.h @@ -103,7 +103,7 @@ public: const char* ofType = NULL, const char* openedByAppSig = NULL); BRecentFilesList(int32 maxItems, bool navMenuFolders, const char* ofTypeList[], int32 ofTypeListCount, - const char* openedByAppSig = NULL); + const char* openedByAppSig = NULL); virtual ~BRecentFilesList(); // use one of the two NewFileListMenu calls to get an entire menu diff --git a/src/kits/tracker/RegExp.cpp b/src/kits/tracker/RegExp.cpp index bad5947bcc..15cf7b89f6 100644 --- a/src/kits/tracker/RegExp.cpp +++ b/src/kits/tracker/RegExp.cpp @@ -108,7 +108,7 @@ const uint8 kRegExpMagic = 0234; // of node is a literal string; for others, it is a node leading into a // sub-FSM. In particular, the operand of a kRegExpBranch node is the first // node of the branch. (NB this is* not* a tree structure: the tail of the -// branch connects to the thing following the set of kRegExpBranches). +// branch connects to the thing following the set of kRegExpBranches). // The opcodes are: // diff --git a/src/kits/tracker/RegExp.h b/src/kits/tracker/RegExp.h index 699e0d66ad..f1021e10fe 100644 --- a/src/kits/tracker/RegExp.h +++ b/src/kits/tracker/RegExp.h @@ -108,12 +108,12 @@ public: RegExp(const char*); RegExp(const BString&); ~RegExp(); - + status_t InitCheck() const; - + status_t SetTo(const char*); status_t SetTo(const BString &); - + bool Matches(const char* string) const; bool Matches(const BString &) const; diff --git a/src/kits/tracker/Settings.cpp b/src/kits/tracker/Settings.cpp index 99df1bbeb7..0c20b53dad 100644 --- a/src/kits/tracker/Settings.cpp +++ b/src/kits/tracker/Settings.cpp @@ -97,7 +97,7 @@ StringValueSetting::Handle(const char* const* argv) { if (!*++argv) return fValueExpectedErrorString; - + ValueChanged(*argv); return 0; } diff --git a/src/kits/tracker/SettingsHandler.cpp b/src/kits/tracker/SettingsHandler.cpp index 32f4fb84b1..ca42949c91 100644 --- a/src/kits/tracker/SettingsHandler.cpp +++ b/src/kits/tracker/SettingsHandler.cpp @@ -91,7 +91,7 @@ ArgvParser::MakeArgvEmpty() // done with current argv, free it up for (int32 index = 0; index < fArgc; index++) delete[] fCurrentArgv[index]; - + fArgc = 0; } @@ -125,7 +125,7 @@ ArgvParser::NextArgv() } fCurrentArgs[++fCurrentArgsPos] = '\0'; // terminate current arg pos - + // copy it as a string to the current argv slot fCurrentArgv[fArgc] = new char [strlen(fCurrentArgs) + 1]; strcpy(fCurrentArgv[fArgc], fCurrentArgs); @@ -409,7 +409,7 @@ Settings::MakeSettingsDirectory(BDirectory* resultingSettingsDir) BPath path; if (find_directory(B_USER_SETTINGS_DIRECTORY, &path, true) != B_OK) return; - + // make sure there is a directory // mkdir() will only make one leaf at a time, unfortunately path.Append(fSettingsDir); diff --git a/src/kits/tracker/SettingsHandler.h b/src/kits/tracker/SettingsHandler.h index 6b959f2a3c..6f5a1c88bd 100644 --- a/src/kits/tracker/SettingsHandler.h +++ b/src/kits/tracker/SettingsHandler.h @@ -85,7 +85,7 @@ private: FILE* fFile; char* fBuffer; int32 fPos; - + int fArgc; char** fCurrentArgv; @@ -108,7 +108,7 @@ public: virtual ~SettingsArgvDispatcher() {}; void SaveSettings(Settings* settings, bool onlyIfNonDefault); - + const char* Name() const { return name; } // name as it appears in the settings file diff --git a/src/kits/tracker/SettingsViews.cpp b/src/kits/tracker/SettingsViews.cpp index 5436978f49..d44d767792 100644 --- a/src/kits/tracker/SettingsViews.cpp +++ b/src/kits/tracker/SettingsViews.cpp @@ -956,12 +956,12 @@ TrashSettingsView::TrashSettingsView() : SettingsView("TrashSettingsView") { - fDontMoveFilesToTrashCheckBox = new BCheckBox("", - B_TRANSLATE("Don't move files to Trash"), - new BMessage(kDontMoveFilesToTrashChanged)); + fMoveFilesToTrashCheckBox = new BCheckBox("", + B_TRANSLATE("Move deleted files to Trash first"), + new BMessage(kMoveFilesToTrashChanged)); fAskBeforeDeleteFileCheckBox = new BCheckBox("", - B_TRANSLATE("Ask before delete"), + B_TRANSLATE("Ask before deleting for good"), new BMessage(kAskBeforeDeleteFileChanged)); const float spacing = be_control_look->DefaultItemSpacing(); @@ -970,7 +970,7 @@ TrashSettingsView::TrashSettingsView() layout->SetOrientation(B_VERTICAL); layout->SetSpacing(0); BGroupLayoutBuilder(layout) - .Add(fDontMoveFilesToTrashCheckBox) + .Add(fMoveFilesToTrashCheckBox) .Add(fAskBeforeDeleteFileCheckBox) .AddGlue() .SetInsets(spacing, spacing, spacing, spacing); @@ -981,7 +981,7 @@ TrashSettingsView::TrashSettingsView() void TrashSettingsView::AttachedToWindow() { - fDontMoveFilesToTrashCheckBox->SetTarget(this); + fMoveFilesToTrashCheckBox->SetTarget(this); fAskBeforeDeleteFileCheckBox->SetTarget(this); } @@ -995,11 +995,11 @@ TrashSettingsView::MessageReceived(BMessage* message) TrackerSettings settings; switch (message->what) { - case kDontMoveFilesToTrashChanged: - settings.SetDontMoveFilesToTrash( - fDontMoveFilesToTrashCheckBox->Value() == 1); + case kMoveFilesToTrashChanged: + settings.SetMoveFilesToTrash( + fMoveFilesToTrashCheckBox->Value() == 1); - tracker->SendNotices(kDontMoveFilesToTrashChanged); + tracker->SendNotices(kMoveFilesToTrashChanged); Window()->PostMessage(kSettingsContentsModified); break; @@ -1023,7 +1023,7 @@ TrashSettingsView::SetDefaults() { TrackerSettings settings; - settings.SetDontMoveFilesToTrash(false); + settings.SetMoveFilesToTrash(true); settings.SetAskBeforeDeleteFile(true); ShowCurrentSettings(); @@ -1036,7 +1036,7 @@ TrashSettingsView::IsDefaultable() const { TrackerSettings settings; - return settings.DontMoveFilesToTrash() != false + return settings.MoveFilesToTrash() != true || settings.AskBeforeDeleteFile() != true; } @@ -1046,7 +1046,7 @@ TrashSettingsView::Revert() { TrackerSettings settings; - settings.SetDontMoveFilesToTrash(fDontMoveFilesToTrash); + settings.SetMoveFilesToTrash(fMoveFilesToTrash); settings.SetAskBeforeDeleteFile(fAskBeforeDeleteFile); ShowCurrentSettings(); @@ -1061,7 +1061,7 @@ TrashSettingsView::_SendNotices() if (!tracker) return; - tracker->SendNotices(kDontMoveFilesToTrashChanged); + tracker->SendNotices(kMoveFilesToTrashChanged); tracker->SendNotices(kAskBeforeDeleteFileChanged); } @@ -1071,7 +1071,7 @@ TrashSettingsView::ShowCurrentSettings() { TrackerSettings settings; - fDontMoveFilesToTrashCheckBox->SetValue(settings.DontMoveFilesToTrash()); + fMoveFilesToTrashCheckBox->SetValue(settings.MoveFilesToTrash()); fAskBeforeDeleteFileCheckBox->SetValue(settings.AskBeforeDeleteFile()); } @@ -1081,7 +1081,7 @@ TrashSettingsView::RecordRevertSettings() { TrackerSettings settings; - fDontMoveFilesToTrash = settings.DontMoveFilesToTrash(); + fMoveFilesToTrash = settings.MoveFilesToTrash(); fAskBeforeDeleteFile = settings.AskBeforeDeleteFile(); } @@ -1089,8 +1089,8 @@ TrashSettingsView::RecordRevertSettings() bool TrashSettingsView::IsRevertable() const { - return fDontMoveFilesToTrash - != (fDontMoveFilesToTrashCheckBox->Value() > 0) + return fMoveFilesToTrash + != (fMoveFilesToTrashCheckBox->Value() > 0) || fAskBeforeDeleteFile != (fAskBeforeDeleteFileCheckBox->Value() > 0); } diff --git a/src/kits/tracker/SettingsViews.h b/src/kits/tracker/SettingsViews.h index bc3474bb26..f6c21beb44 100644 --- a/src/kits/tracker/SettingsViews.h +++ b/src/kits/tracker/SettingsViews.h @@ -181,10 +181,10 @@ class TrashSettingsView : public SettingsView { private: void _SendNotices(); - BCheckBox* fDontMoveFilesToTrashCheckBox; + BCheckBox* fMoveFilesToTrashCheckBox; BCheckBox* fAskBeforeDeleteFileCheckBox; - bool fDontMoveFilesToTrash; + bool fMoveFilesToTrash; bool fAskBeforeDeleteFile; typedef SettingsView _inherited; diff --git a/src/kits/tracker/SlowContextPopup.cpp b/src/kits/tracker/SlowContextPopup.cpp index 814ba39f29..5b1a4237f5 100644 --- a/src/kits/tracker/SlowContextPopup.cpp +++ b/src/kits/tracker/SlowContextPopup.cpp @@ -134,7 +134,7 @@ BSlowContextMenu::SetNavDir(const entry_ref* ref) { ForceRebuild(); // reset the slow menu building mechanism so we can add more stuff - + fNavDir = *ref; } @@ -188,7 +188,7 @@ BSlowContextMenu::AddDynamicItem(add_state state) { if (fMenuBuilt) return false; - + if (state == B_ABORT) { ClearMenuBuildingState(); return false; @@ -229,7 +229,7 @@ BSlowContextMenu::StartBuildingItemList() } fIteratingDesktop = false; - + BDirectory parent; status_t err = entry.GetParent(&parent); fItemList = new BObjectList(50); @@ -308,7 +308,7 @@ BSlowContextMenu::AddNextItem() BuildVolumeMenu(); return false; } - + // limit nav menus to 500 items only if (fItemList->CountItems() > 500) return false; @@ -332,7 +332,7 @@ BSlowContextMenu::AddNextItem() } model.CloseNode(); - + if (!BPoseView::PoseVisible(&model, &poseInfo)) { return true; } @@ -367,7 +367,7 @@ BSlowContextMenu::NewModelItem(Model* model, const BMessage* invokeMessage, entry_ref ref; bool container = false; if (model->IsSymLink()) { - + Model* newResolvedModel = NULL; Model* result = model->LinkTo(); @@ -379,21 +379,21 @@ BSlowContextMenu::NewModelItem(Model* model, const BMessage* invokeMessage, delete newResolvedModel; newResolvedModel = NULL; } - + result = newResolvedModel; } if (result) { BModelOpener opener(result); // open the model, if it ain't open already - + PoseInfo poseInfo; - + if (result->Node()) { result->Node()->ReadAttr(kAttrPoseInfo, B_RAW_TYPE, 0, &poseInfo, sizeof(poseInfo)); } - + result->CloseNode(); ref = *result->EntryRef(); @@ -421,7 +421,7 @@ BSlowContextMenu::NewModelItem(Model* model, const BMessage* invokeMessage, } else { BNavMenu* menu = new BNavMenu(truncatedString.String(), invokeMessage->what, target, parentWindow, typeslist); - + menu->SetNavDir(&ref); if (hook) menu->InitTrackingHook(hook->fTrackingHook, &(hook->fTarget), @@ -443,10 +443,10 @@ BSlowContextMenu::BuildVolumeMenu() roster.Rewind(); while (roster.GetNextVolume(&volume) == B_OK) { - + if (!volume.IsPersistent()) continue; - + BDirectory startDir; if (volume.GetRootDirectory(&startDir) == B_OK) { BEntry entry; @@ -457,7 +457,7 @@ BSlowContextMenu::BuildVolumeMenu() delete model; continue; } - + BNavMenu* menu = new BNavMenu(model->Name(), fMessage.what, fMessenger, fParentWindow, fTypesList); diff --git a/src/kits/tracker/SlowContextPopup.h b/src/kits/tracker/SlowContextPopup.h index c29769b6d5..31fac10095 100644 --- a/src/kits/tracker/SlowContextPopup.h +++ b/src/kits/tracker/SlowContextPopup.h @@ -50,9 +50,9 @@ public: virtual void DetachedFromWindow(); void SetNavDir(const entry_ref*); - + void ClearMenu(); - + void ForceRebuild(); bool NeedsToRebuild() const; // will cause menu to get rebuilt next time it is shown diff --git a/src/kits/tracker/SlowMenu.cpp b/src/kits/tracker/SlowMenu.cpp index 45a4f52c0c..7077a5f642 100644 --- a/src/kits/tracker/SlowMenu.cpp +++ b/src/kits/tracker/SlowMenu.cpp @@ -52,7 +52,7 @@ BSlowMenu::AddDynamicItem(add_state state) { if (fMenuBuilt) return false; - + if (state == B_ABORT) { ClearMenuBuildingState(); return false; diff --git a/src/kits/tracker/TaskLoop.h b/src/kits/tracker/TaskLoop.h index 5282ef838d..e5c0014d19 100644 --- a/src/kits/tracker/TaskLoop.h +++ b/src/kits/tracker/TaskLoop.h @@ -69,7 +69,7 @@ class OneShotDelayedTask : public DelayedTask { public: OneShotDelayedTask(FunctionObject* functor, bigtime_t delay); virtual ~OneShotDelayedTask(); - + virtual bool RunIfNeeded(bigtime_t currentTime); protected: @@ -196,7 +196,7 @@ protected: bool Pulse(); // return true if quitting bigtime_t LatestRunTime() const; - + virtual bool KeepPulsingWhenEmpty() const = 0; virtual void StartPulsingIfNeeded() = 0; @@ -226,7 +226,7 @@ private: volatile bool fNeedToQuit; volatile thread_id fScanThread; bool fKeepThread; - + typedef TaskLoop _inherited; }; @@ -243,7 +243,7 @@ public: private: virtual bool KeepPulsingWhenEmpty() const; virtual void StartPulsingIfNeeded(); - + bigtime_t fNextHeartBeatTime; bool fPulseMe; }; diff --git a/src/kits/tracker/TemplatesMenu.cpp b/src/kits/tracker/TemplatesMenu.cpp index 20dfc36cbf..eda9cedc97 100644 --- a/src/kits/tracker/TemplatesMenu.cpp +++ b/src/kits/tracker/TemplatesMenu.cpp @@ -164,7 +164,7 @@ TemplatesMenu::BuildMenu(bool addItems) entry_ref ref; entry.GetRef(&ref); - + BMessage* message = new BMessage(kNewEntryFromTemplate); message->AddRef("refs_template", &ref); message->AddString("name", fileName); diff --git a/src/kits/tracker/TextWidget.cpp b/src/kits/tracker/TextWidget.cpp index 1713031a3a..8a63e86181 100644 --- a/src/kits/tracker/TextWidget.cpp +++ b/src/kits/tracker/TextWidget.cpp @@ -229,7 +229,7 @@ BTextWidget::CheckExpiration() get_click_speed(&doubleClickSpeed); bigtime_t delta = system_time() - fLastClickedTime; - + if (delta > doubleClickSpeed) { // at least 'doubleClickSpeed' microseconds ellapsed and no click // was registered since. @@ -278,7 +278,7 @@ BTextWidget::MouseUp(BRect bounds, BPoseView* view, BPose* pose, BPoint) fParams.pose = pose; fParams.bounds = bounds; - fParams.poseView = view; + fParams.poseView = view; } else fLastClickedTime = 0; } diff --git a/src/kits/tracker/TextWidget.h b/src/kits/tracker/TextWidget.h index 1c3e9df980..6571ec168b 100644 --- a/src/kits/tracker/TextWidget.h +++ b/src/kits/tracker/TextWidget.h @@ -66,7 +66,7 @@ public: // and current drawing view are different void MouseUp(BRect bounds, BPoseView*, BPose*, BPoint mouseLoc); - + BRect CalcRect(BPoint poseLoc, const BColumn*, const BPoseView*); // returns the rect derived from the formatted string width // may force WidgetAttributeText recalculation @@ -79,7 +79,7 @@ public: BRect CalcOldRect(BPoint poseLoc, const BColumn*, const BPoseView*); // after an update call this to determine the old rect so that // we can invalidate properly - + void StartEdit(BRect bounds, BPoseView*, BPose*); void StopEdit(bool saveChanges, BPoint loc, BPoseView*, BPose*, int32 index); @@ -104,7 +104,7 @@ public: void CheckExpiration(); void CancelWait(); - + private: BRect CalcRectCommon(BPoint poseLoc, const BColumn*, const BPoseView*, float width); @@ -118,7 +118,7 @@ private: bool fVisible : 1; bool fActive : 1; bool fSymLink : 1; - + bigtime_t fLastClickedTime; struct MouseUpParams fParams; }; diff --git a/src/kits/tracker/TitleView.cpp b/src/kits/tracker/TitleView.cpp index a0838d9ef9..471e9b19a6 100644 --- a/src/kits/tracker/TitleView.cpp +++ b/src/kits/tracker/TitleView.cpp @@ -235,7 +235,7 @@ BTitleView::Draw(BRect /*updateRect*/, bool useOffscreen, bool updateOnly, // fill background with light gray background if (!updateOnly) view->FillRect(bounds, B_SOLID_LOW); - + view->BeginLineArray(4); view->AddLine(bounds.LeftTop(), bounds.RightTop(), sShadowColor); view->AddLine(bounds.LeftBottom(), bounds.RightBottom(), @@ -399,7 +399,7 @@ BTitleView::MouseMoved(BPoint where, uint32 code, const BMessage* message) else SetViewCursor(B_CURSOR_SYSTEM_DEFAULT); break; - + case B_EXITED_VIEW: SetViewCursor(B_CURSOR_SYSTEM_DEFAULT); break; @@ -546,10 +546,10 @@ BColumnTitle::Draw(BView* view, bool pressed) triangle[1] = center + BPoint(3.5, -1.5); triangle[2] = center + BPoint(0.0, 2.0); } - + uint32 flags = view->Flags(); view->SetFlags(flags | B_SUBPIXEL_PRECISE); - + if (secondary) { view->SetHighColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), 1.3)); @@ -559,7 +559,7 @@ BColumnTitle::Draw(BView* view, bool pressed) 1.6)); view->FillTriangle(triangle[0], triangle[1], triangle[2]); } - + view->SetFlags(flags); } @@ -579,7 +579,7 @@ BColumnTitle::Draw(BView* view, bool pressed) pressed ? sLightShadowColor : sLightShadowColor); view->AddLine(rect.LeftTop(), rect.RightTop(), pressed ? sDarkShadowColor : sShineColor); - + view->AddLine(rect.LeftTop(), rect.LeftBottom(), pressed ? sDarkShadowColor : sShineColor); view->AddLine(rect.RightTop(), rect.RightBottom(), @@ -820,7 +820,7 @@ ColumnDragState::Moved(BPoint where, uint32) } else drawOutline = true; } - + if (drawOutline) DrawOutline(where.x - fInitialMouseTrackOffset); else if (undrawOutline) @@ -845,7 +845,7 @@ ColumnDragState::Clicked(BPoint /*where*/) uint32 primarySort = poseView->PrimarySort(); uint32 secondarySort = poseView->SecondarySort(); bool shift = (modifiers() & B_SHIFT_KEY) != 0; - + // For now: // if we hit the primary sort field again // then if shift key was down, switch primary and secondary diff --git a/src/kits/tracker/TitleView.h b/src/kits/tracker/TitleView.h index 9df1d20141..9ad50f2dc1 100644 --- a/src/kits/tracker/TitleView.h +++ b/src/kits/tracker/TitleView.h @@ -85,7 +85,7 @@ public: protected: void MouseMoved(BPoint, uint32, const BMessage*); - + private: BColumnTitle* FindColumnTitle(BPoint) const; BColumnTitle* InColumnResizeArea(BPoint) const; @@ -100,7 +100,7 @@ private: ColumnTrackState* fTrackingState; static OffscreenBitmap* sOffscreen; - + typedef BView _inherited; friend class ColumnTrackState; @@ -112,7 +112,7 @@ class BColumnTitle { public: BColumnTitle(BTitleView*, BColumn*); virtual ~BColumnTitle() {} - + virtual void Draw(BView*, bool pressed = false); BColumn* Column() const; diff --git a/src/kits/tracker/Tracker.cpp b/src/kits/tracker/Tracker.cpp index e327762bdf..021fff7aea 100644 --- a/src/kits/tracker/Tracker.cpp +++ b/src/kits/tracker/Tracker.cpp @@ -233,7 +233,7 @@ TTracker::TTracker() setrlimit(RLIMIT_NOFILE, &rl); fNodeMonitorCount = DEFAULT_MON_NUM; - + gLocalizedNamePreferred = BLocaleRoster::Default()->IsFilesystemTranslationPreferred(); diff --git a/src/kits/tracker/TrackerScripting.cpp b/src/kits/tracker/TrackerScripting.cpp index 421b0549da..86ea02d41b 100644 --- a/src/kits/tracker/TrackerScripting.cpp +++ b/src/kits/tracker/TrackerScripting.cpp @@ -237,7 +237,7 @@ TTracker::DeleteProperty(BMessage* /*specifier*/, int32 form, if (form != B_DIRECT_SPECIFIER) // only support direct specifier return false; - + // empty the trash FSEmptyTrash(); return true; @@ -293,11 +293,11 @@ bool TTracker::ExecuteProperty(BMessage*, int32 form, const char* property, BMessage*) { if (strcmp(property, kPropertyPreferences) == 0) { - + if (form != B_DIRECT_SPECIFIER) // only support direct specifier return false; - + ShowSettingsWindow(); return true; diff --git a/src/kits/tracker/TrackerSettings.cpp b/src/kits/tracker/TrackerSettings.cpp index 7eebfa4e21..5ee3ed202c 100644 --- a/src/kits/tracker/TrackerSettings.cpp +++ b/src/kits/tracker/TrackerSettings.cpp @@ -82,7 +82,7 @@ class TTrackerState : public Settings { HexScalarValueSetting* fFreeSpaceColor; HexScalarValueSetting* fWarningSpaceColor; - BooleanValueSetting* fDontMoveFilesToTrash; + BooleanValueSetting* fMoveFilesToTrash; BooleanValueSetting* fAskBeforeDeleteFile; Benaphore fInitLock; @@ -202,8 +202,8 @@ TTrackerState::LoadSettingsIfNeeded() Add(fWarningSpaceColor = new HexScalarValueSetting("WarningSpaceColor", 0xc0cb0000, "", "")); - Add(fDontMoveFilesToTrash - = new BooleanValueSetting("DontMoveFilesToTrash", false)); + Add(fMoveFilesToTrash + = new BooleanValueSetting("MoveFilesToTrash", true)); Add(fAskBeforeDeleteFile = new BooleanValueSetting("AskBeforeDeleteFile", true)); @@ -509,16 +509,16 @@ TrackerSettings::SetRecentFoldersCount(int32 count) bool -TrackerSettings::DontMoveFilesToTrash() +TrackerSettings::MoveFilesToTrash() { - return gTrackerState.fDontMoveFilesToTrash->Value(); + return gTrackerState.fMoveFilesToTrash->Value(); } void -TrackerSettings::SetDontMoveFilesToTrash(bool enabled) +TrackerSettings::SetMoveFilesToTrash(bool enabled) { - gTrackerState.fDontMoveFilesToTrash->SetValue(enabled); + gTrackerState.fMoveFilesToTrash->SetValue(enabled); } diff --git a/src/kits/tracker/TrackerSettings.h b/src/kits/tracker/TrackerSettings.h index efec805a58..da762ebb7b 100644 --- a/src/kits/tracker/TrackerSettings.h +++ b/src/kits/tracker/TrackerSettings.h @@ -76,7 +76,7 @@ class TrackerSettings { void SetMountSharedVolumesOntoDesktop(bool); bool EjectWhenUnmounting(); void SetEjectWhenUnmounting(bool); - + bool ShowVolumeSpaceBar(); void SetShowVolumeSpaceBar(bool); rgb_color UsedSpaceColor(); @@ -85,7 +85,7 @@ class TrackerSettings { void SetFreeSpaceColor(rgb_color color); rgb_color WarningSpaceColor(); void SetWarningSpaceColor(rgb_color color); - + bool ShowFullPathInTitleBar(); void SetShowFullPathInTitleBar(bool); bool SortFolderNamesFirst(); @@ -118,8 +118,8 @@ class TrackerSettings { bool ClockIs24Hr(); void SetClockTo24Hr(bool); - bool DontMoveFilesToTrash(); - void SetDontMoveFilesToTrash(bool); + bool MoveFilesToTrash(); + void SetMoveFilesToTrash(bool); bool AskBeforeDeleteFile(); void SetAskBeforeDeleteFile(bool); diff --git a/src/kits/tracker/TrackerSettingsWindow.cpp b/src/kits/tracker/TrackerSettingsWindow.cpp index 4be73c1bc3..66267a60d3 100644 --- a/src/kits/tracker/TrackerSettingsWindow.cpp +++ b/src/kits/tracker/TrackerSettingsWindow.cpp @@ -195,12 +195,12 @@ TrackerSettingsWindow::_ViewAt(int32 i) { if (!Lock()) return NULL; - + SettingsItem* item = dynamic_cast (fSettingsTypeListView->ItemAt(i)); - + Unlock(); - + return item->View(); } @@ -227,7 +227,7 @@ TrackerSettingsWindow::_UpdateButtons() defaultable |= _ViewAt(i)->IsDefaultable(); revertable |= _ViewAt(i)->IsRevertable(); } - + fDefaultsButton->SetEnabled(defaultable); fRevertButton->SetEnabled(revertable); } @@ -237,7 +237,7 @@ void TrackerSettingsWindow::_HandlePressedDefaultsButton() { int32 itemCount = fSettingsTypeListView->CountItems(); - + for (int32 i = 0; i < itemCount; i++) { if (_ViewAt(i)->IsDefaultable()) _ViewAt(i)->SetDefaults(); diff --git a/src/kits/tracker/TrackerString.cpp b/src/kits/tracker/TrackerString.cpp index 175c1c9089..201c449069 100644 --- a/src/kits/tracker/TrackerString.cpp +++ b/src/kits/tracker/TrackerString.cpp @@ -73,13 +73,13 @@ TrackerString::Matches(const char* string, bool caseSensitivity, default: case kNone: return false; - + case kStartsWith: return StartsWith(string, caseSensitivity); - + case kEndsWith: return EndsWith(string, caseSensitivity); - + case kContains: return Contains(string, caseSensitivity); @@ -97,14 +97,14 @@ TrackerString::MatchesRegExp(const char* pattern, bool caseSensitivity) const { BString patternString(pattern); BString textString(String()); - + if (caseSensitivity == false) { patternString.ToLower(); textString.ToLower(); } - + RegExp expression(patternString); - + if (expression.InitCheck() != B_OK) return false; @@ -127,7 +127,7 @@ TrackerString::EndsWith(const char* string, bool caseSensitivity) const int32 position = Length() - (int32)strlen(string); if (position < 0) return false; - + if (caseSensitivity) return FindLast(string) == position; else @@ -442,7 +442,7 @@ TrackerString::MatchesBracketExpression(const char* string, bool inverse = *pattern == '^' || *pattern == '!'; // We allow both ^ and ! as a initial inverting character. - + if (inverse) pattern++; @@ -533,7 +533,7 @@ TrackerString::StringMatchesPattern(const char* string, const char* pattern, string = MoveToEndOfGlyph(string); } } - + if (*pattern == '\0') { // An ending * matches all strings. return true; @@ -588,7 +588,7 @@ TrackerString::StringMatchesPattern(const char* string, const char* pattern, } break; } - + case '[': pattern++; @@ -603,7 +603,7 @@ TrackerString::StringMatchesPattern(const char* string, const char* pattern, // Skip the rest of the bracket: while (*pattern != ']' && *pattern != '\0') pattern++; - + // Failure if no closing bracket; if (*pattern == '\0') return false; diff --git a/src/kits/tracker/TrackerString.h b/src/kits/tracker/TrackerString.h index 0fb890c529..be9929f3a3 100644 --- a/src/kits/tracker/TrackerString.h +++ b/src/kits/tracker/TrackerString.h @@ -70,7 +70,7 @@ public: bool MatchesRegExp(const char*, bool caseSensitivity = true) const; bool MatchesRegExp(const RegExp&) const; bool MatchesRegExp(const RegExp*) const; - + bool MatchesGlob(const char*, bool caseSensitivity = false) const; bool EndsWith(const char*, bool caseSensitivity = false) const; bool StartsWith(const char*, bool caseSensitivity = false) const; @@ -106,13 +106,13 @@ private: // Not counting start! bool IsStartOfGlyph(char) const; const char* MoveToEndOfGlyph(const char*) const; - + // Functions for Glob matching: bool MatchesBracketExpression(const char* string, const char* pattern, bool caseSensitivity) const; bool StringMatchesPattern(const char* string, const char* pattern, bool caseSensitivity) const; - + char ConditionalToLower(char c, bool toLower) const; bool CharsAreEqual(char char1, char char2, bool toLower) const; bool UTF8CharsAreEqual(const char* string1, const char* string2) const; @@ -124,7 +124,7 @@ TrackerString::MatchesRegExp(const RegExp* expression) const { if (expression == NULL || expression->InitCheck() != B_OK) return false; - + return expression->Matches(*this); } @@ -134,7 +134,7 @@ TrackerString::MatchesRegExp(const RegExp &expression) const { if (expression.InitCheck() != B_OK) return false; - + return expression.Matches(*this); } diff --git a/src/kits/tracker/TrashWatcher.cpp b/src/kits/tracker/TrashWatcher.cpp index c5ce5a7d55..7143fbb82b 100644 --- a/src/kits/tracker/TrashWatcher.cpp +++ b/src/kits/tracker/TrashWatcher.cpp @@ -172,7 +172,7 @@ BTrashWatcher::UpdateTrashIcons() const void* vectorData = GetTrackerResources()->LoadResource( B_VECTOR_ICON_TYPE, fTrashFull ? R_TrashFullIcon : R_TrashIcon, &vectorSize); - + if (vectorData) { trashDir.WriteAttr(kAttrIcon, B_VECTOR_ICON_TYPE, 0, vectorData, vectorSize); @@ -185,7 +185,7 @@ BTrashWatcher::UpdateTrashIcons() largeData, largeSize); } else TRESPASS(); - + if (smallData) { trashDir.WriteAttr(kAttrMiniIcon, 'MICN', 0, smallData, smallSize); diff --git a/src/kits/tracker/TrashWatcher.h b/src/kits/tracker/TrashWatcher.h index 789666a9a4..ef0e2d324a 100644 --- a/src/kits/tracker/TrashWatcher.h +++ b/src/kits/tracker/TrashWatcher.h @@ -53,7 +53,7 @@ public: protected: virtual void MessageReceived(BMessage*); - + private: void WatchTrashDirs(); void UpdateTrashIcons(); diff --git a/src/kits/tracker/ViewState.h b/src/kits/tracker/ViewState.h index 8284a28293..40484e390e 100644 --- a/src/kits/tracker/ViewState.h +++ b/src/kits/tracker/ViewState.h @@ -151,10 +151,10 @@ class BViewState { uint32 fPrimarySortType; uint32 fSecondarySortType; bool fReverseSort; - + void _Init(); void _StorePreviousState(); - + uint32 fPreviousViewMode; uint32 fPreviousLastIconMode; uint32 fPreviousIconSize; diff --git a/src/libs/compat/freebsd_network/bus.cpp b/src/libs/compat/freebsd_network/bus.cpp index bc89fe8900..22aed56b3c 100644 --- a/src/libs/compat/freebsd_network/bus.cpp +++ b/src/libs/compat/freebsd_network/bus.cpp @@ -256,6 +256,13 @@ rman_get_bustag(struct resource *res) } +int +rman_get_rid(struct resource *res) +{ + return 0; +} + + // #pragma mark - Interrupt handling diff --git a/src/libs/compat/freebsd_network/compat.c b/src/libs/compat/freebsd_network/compat.c index f17eb59319..33957800b1 100644 --- a/src/libs/compat/freebsd_network/compat.c +++ b/src/libs/compat/freebsd_network/compat.c @@ -175,6 +175,14 @@ device_get_parent(device_t dev) } +devclass_t +device_get_devclass(device_t dev) +{ + // TODO find out what to do + return 0; +} + + int device_get_children(device_t dev, device_t **devlistp, int *devcountp) { @@ -641,3 +649,4 @@ pmap_kextract(vm_offset_t virtualAddress) return (vm_paddr_t)entry.address; } + diff --git a/src/libs/compat/freebsd_network/compat/dev/mii/miidevs b/src/libs/compat/freebsd_network/compat/dev/mii/miidevs index 1b98542fdc..5629290c96 100644 --- a/src/libs/compat/freebsd_network/compat/dev/mii/miidevs +++ b/src/libs/compat/freebsd_network/compat/dev/mii/miidevs @@ -1,5 +1,5 @@ $FreeBSD$ -/*$NetBSD: miidevs,v 1.99 2011/01/26 18:39:04 bouyer Exp $*/ +/*$NetBSD: miidevs,v 1.105 2011/11/25 23:28:14 jakllsch Exp $*/ /*- * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc. @@ -146,6 +146,7 @@ model xxBROADCOM BCM5214 0x0028 BCM5214 Quad 10/100 media interface model xxBROADCOM BCM5221 0x001e BCM5221 10/100 media interface model xxBROADCOM BCM5222 0x0032 BCM5222 Dual 10/100 media interface model xxBROADCOM BCM4401 0x0036 BCM4401 10/100 media interface +model xxBROADCOM BCM5365 0x0037 BCM5365 10/100 5-port PHY switch model BROADCOM BCM5400 0x0004 BCM5400 1000BASE-T media interface model BROADCOM BCM5401 0x0005 BCM5401 1000BASE-T media interface model BROADCOM BCM5411 0x0007 BCM5411 1000BASE-T media interface @@ -164,21 +165,25 @@ model BROADCOM BCM54K2 0x002e BCM54K2 1000BASE-T media interface model BROADCOM BCM5714 0x0034 BCM5714 1000BASE-T media interface model BROADCOM BCM5780 0x0035 BCM5780 1000BASE-T media interface model BROADCOM BCM5708C 0x0036 BCM5708C 1000BASE-T media interface +model BROADCOM2 BCM5325 0x0003 BCM5325 10/100 5-port PHY switch model BROADCOM2 BCM5906 0x0004 BCM5906 10/100baseTX media interface model BROADCOM2 BCM5481 0x000a BCM5481 1000BASE-T media interface model BROADCOM2 BCM5482 0x000b BCM5482 1000BASE-T media interface model BROADCOM2 BCM5755 0x000c BCM5755 1000BASE-T media interface model BROADCOM2 BCM5754 0x000e BCM5754/5787 1000BASE-T media interface model BROADCOM2 BCM5708S 0x0015 BCM5708S 1000/2500baseSX PHY +model BROADCOM2 BCM5785 0x0016 BCM5785 1000BASE-T media interface model BROADCOM2 BCM5709CAX 0x002c BCM5709CAX 10/100/1000baseT PHY model BROADCOM2 BCM5722 0x002d BCM5722 1000BASE-T media interface model BROADCOM2 BCM5784 0x003a BCM5784 10/100/1000baseT PHY model BROADCOM2 BCM5709C 0x003c BCM5709 10/100/1000baseT PHY model BROADCOM2 BCM5761 0x003d BCM5761 10/100/1000baseT PHY model BROADCOM2 BCM5709S 0x003f BCM5709S 1000/2500baseSX PHY +model BROADCOM3 BCM57780 0x0019 BCM57780 1000BASE-T media interface model BROADCOM3 BCM5717C 0x0020 BCM5717C 1000BASE-T media interface model BROADCOM3 BCM5719C 0x0022 BCM5719C 1000BASE-T media interface model BROADCOM3 BCM57765 0x0024 BCM57765 1000BASE-T media interface +model BROADCOM3 BCM5720C 0x0036 BCM5720C 1000BASE-T media interface model xxBROADCOM_ALT1 BCM5906 0x0004 BCM5906 10/100baseTX media interface /* Cicada Semiconductor PHYs (now owned by Vitesse?) */ @@ -217,6 +222,10 @@ model yyINTEL I82562ET 0x0033 i82562ET 10/100 media interface model yyINTEL I82553 0x0035 i82553 10/100 media interface model yyINTEL I82566 0x0039 i82566 10/100/1000 media interface model INTEL I82577 0x0005 i82577 10/100/1000 media interface +model INTEL I82579 0x0009 i82579 10/100/1000 media interface +model xxMARVELL I82563 0x000a i82563 10/100/1000 media interface + +model yyINTEL IGP01E1000 0x0038 Intel IGP01E1000 Gigabit PHY /* Jato Technologies PHYs */ model xxJATO BASEX 0x0000 Jato 1000baseX media interface @@ -245,18 +254,24 @@ model xxMARVELL E3082 0x0008 Marvell 88E3082 10/100 Fast Ethernet PHY model xxMARVELL E1112 0x0009 Marvell 88E1112 Gigabit PHY model xxMARVELL E1149 0x000b Marvell 88E1149 Gigabit PHY model xxMARVELL E1111 0x000c Marvell 88E1111 Gigabit PHY +model xxMARVELL E1145 0x000d Marvell 88E1145 Quad Gigabit PHY model xxMARVELL E1116 0x0021 Marvell 88E1116 Gigabit PHY model xxMARVELL E1116R 0x0024 Marvell 88E1116R Gigabit PHY model xxMARVELL E1118 0x0022 Marvell 88E1118 Gigabit PHY model xxMARVELL E1149R 0x0025 Marvell 88E1149R Quad Gigabit PHY model xxMARVELL E3016 0x0026 Marvell 88E3016 10/100 Fast Ethernet PHY model xxMARVELL PHYG65G 0x0027 Marvell PHYG65G Gigabit PHY +model xxMARVELL E1116R_29 0x0029 Marvell 88E1116R Gigabit PHY model MARVELL E1000 0x0005 Marvell 88E1000 Gigabit PHY model MARVELL E1011 0x0002 Marvell 88E1011 Gigabit PHY model MARVELL E1000_3 0x0003 Marvell 88E1000 Gigabit PHY model MARVELL E1000_5 0x0005 Marvell 88E1000 Gigabit PHY model MARVELL E1111 0x000c Marvell 88E1111 Gigabit PHY +/* Myson Technology PHYs */ +model xxMYSON MTD972 0x0000 MTD972 10/100 media interface +model MYSON MTD803 0x0000 MTD803 3-in-1 media interface + /* National Semiconductor PHYs */ model xxNATSEMI DP83840 0x0000 DP83840 10/100 media interface model xxNATSEMI DP83843 0x0001 DP83843 10/100 media interface @@ -265,6 +280,7 @@ model xxNATSEMI DP83847 0x0003 DP83847 10/100 media interface model xxNATSEMI DP83891 0x0005 DP83891 1000BASE-T media interface model xxNATSEMI DP83861 0x0006 DP83861 1000BASE-T media interface model xxNATSEMI DP83865 0x0007 DP83865 1000BASE-T media interface +model xxNATSEMI DP83849 0x000a DP83849 10/100 media interface /* PMC Sierra PHYs */ model xxPMCSIERRA PM8351 0x0000 PM8351 OctalPHY Gigabit interface diff --git a/src/libs/compat/freebsd_network/compat/machine/bus.h b/src/libs/compat/freebsd_network/compat/machine/bus.h index 717f895fed..002ee23f00 100644 --- a/src/libs/compat/freebsd_network/compat/machine/bus.h +++ b/src/libs/compat/freebsd_network/compat/machine/bus.h @@ -115,6 +115,9 @@ #include +struct resource; + + // TODO: x86 specific! #define I386_BUS_SPACE_IO 0 #define I386_BUS_SPACE_MEM 1 @@ -215,6 +218,14 @@ bus_space_write_region_1(bus_space_tag_t tag, bus_space_handle_t bsh, } +static inline void +bus_space_set_region_4(bus_space_tag_t tag, bus_space_handle_t bsh, + bus_size_t offset, u_int32_t value, size_t count) +{ + /* TODO implement */ +} + + static inline void bus_space_barrier(bus_space_tag_t tag, bus_space_handle_t handle, bus_size_t offset, bus_size_t len, int flags) diff --git a/src/libs/compat/freebsd_network/compat/sys/bus.h b/src/libs/compat/freebsd_network/compat/sys/bus.h index a7d1add66a..889cd9992a 100644 --- a/src/libs/compat/freebsd_network/compat/sys/bus.h +++ b/src/libs/compat/freebsd_network/compat/sys/bus.h @@ -33,6 +33,9 @@ #define bus_barrier(r, o, l, f) \ bus_space_barrier((r)->r_bustag, (r)->r_bushandle, (o), (l), (f)) +#define bus_read_region_1(r, o, d, c) \ + bus_space_read_region_1((r)->r_bustag, (r)->r_bushandle, (o), (d), (c)) + #define FILTER_STRAY B_UNHANDLED_INTERRUPT #define FILTER_HANDLED B_HANDLED_INTERRUPT #define FILTER_SCHEDULE_THREAD B_INVOKE_SCHEDULER @@ -115,6 +118,7 @@ void device_set_desc_copy(device_t dev, const char *desc); const char *device_get_desc(device_t dev); device_t device_get_parent(device_t dev); u_int32_t device_get_flags(device_t dev); +devclass_t device_get_devclass(device_t dev); int device_get_children(device_t dev, device_t **devlistp, int *devcountp); void device_set_ivars(device_t dev, void *); diff --git a/src/libs/compat/freebsd_network/compat/sys/haiku-module.h b/src/libs/compat/freebsd_network/compat/sys/haiku-module.h index ec2d98fd1a..26e07bb3de 100644 --- a/src/libs/compat/freebsd_network/compat/sys/haiku-module.h +++ b/src/libs/compat/freebsd_network/compat/sys/haiku-module.h @@ -36,6 +36,7 @@ struct device_method { typedef struct device_method device_method_t; #define DEVMETHOD(name, func) { #name, (device_method_signature_t)&func } +#define DEVMETHOD_END { 0, 0 } typedef struct { const char *name; @@ -255,5 +256,9 @@ extern const char* __haiku_firmware_name_map[][2]; driver_t *DRIVER_MODULE_NAME(name, busname) = &(driver); \ devclass_t *__class_ ## name ## _ ## busname ## _ ## devclass = &(devclass) +#define DRIVER_MODULE_ORDERED(name, busname, driver, devclass, evh, arg, order) \ + DRIVER_MODULE(name, busname, driver, devclass, evh, arg) + +#define nitems(_a) (sizeof((_a)) / sizeof((_a)[0])) #endif /* _FBSD_COMPAT_SYS_HAIKU_MODULE_H_ */ diff --git a/src/libs/compat/freebsd_network/compat/sys/mutex.h b/src/libs/compat/freebsd_network/compat/sys/mutex.h index 444aea6e93..18b2838557 100644 --- a/src/libs/compat/freebsd_network/compat/sys/mutex.h +++ b/src/libs/compat/freebsd_network/compat/sys/mutex.h @@ -25,6 +25,9 @@ #define MTX_DEF 0x0000 #define MTX_RECURSE 0x0004 +#define MTX_QUIET 0x40000 +#define MTX_DUPOK 0x400000 + #define MTX_NETWORK_LOCK "network driver" diff --git a/src/libs/compat/freebsd_network/compat/sys/rman.h b/src/libs/compat/freebsd_network/compat/sys/rman.h index a537e2b154..c3911d974f 100644 --- a/src/libs/compat/freebsd_network/compat/sys/rman.h +++ b/src/libs/compat/freebsd_network/compat/sys/rman.h @@ -59,6 +59,7 @@ struct resource { bus_space_handle_t rman_get_bushandle(struct resource *); bus_space_tag_t rman_get_bustag(struct resource *); +int rman_get_rid(struct resource *); static inline u_long diff --git a/src/libs/compat/freebsd_network/compat/sys/sysctl.h b/src/libs/compat/freebsd_network/compat/sys/sysctl.h index a1519bda8d..0f324a296a 100644 --- a/src/libs/compat/freebsd_network/compat/sys/sysctl.h +++ b/src/libs/compat/freebsd_network/compat/sys/sysctl.h @@ -157,6 +157,7 @@ SYSCTL_CHILDREN(void *ptr) #define SYSCTL_NODE(...) #define SYSCTL_INT(...) +#define SYSCTL_UINT(...) #define SYSCTL_PROC(...) #endif diff --git a/src/libs/compat/freebsd_network/mutex.c b/src/libs/compat/freebsd_network/mutex.c index 3944e60b27..f626b359d9 100644 --- a/src/libs/compat/freebsd_network/mutex.c +++ b/src/libs/compat/freebsd_network/mutex.c @@ -21,14 +21,13 @@ void mtx_init(struct mtx *mutex, const char *name, const char *type, int options) { - if (options == MTX_DEF) { - mutex_init_etc(&mutex->u.mutex.lock, name, MUTEX_FLAG_CLONE_NAME); - mutex->u.mutex.owner = -1; - } else if (options == MTX_RECURSE) { + if (options & MTX_RECURSE) { recursive_lock_init_etc(&mutex->u.recursive, name, MUTEX_FLAG_CLONE_NAME); - } else - panic("fbsd: unsupported mutex type"); + } else { + mutex_init_etc(&mutex->u.mutex.lock, name, MUTEX_FLAG_CLONE_NAME); + mutex->u.mutex.owner = -1; + } mutex->type = options; } @@ -37,10 +36,10 @@ mtx_init(struct mtx *mutex, const char *name, const char *type, void mtx_destroy(struct mtx *mutex) { - if (mutex->type == MTX_DEF) - mutex_destroy(&mutex->u.mutex.lock); - else if (mutex->type == MTX_RECURSE) + if (mutex->type & MTX_RECURSE) recursive_lock_destroy(&mutex->u.recursive); + else + mutex_destroy(&mutex->u.mutex.lock); } diff --git a/src/libs/compat/freebsd_network/shared.h b/src/libs/compat/freebsd_network/shared.h index a1ffb40a96..51cbba8a1c 100644 --- a/src/libs/compat/freebsd_network/shared.h +++ b/src/libs/compat/freebsd_network/shared.h @@ -21,7 +21,7 @@ struct device { driver_t *driver; struct list children; - int32 flags; + uint32 flags; char device_name[128]; int unit; diff --git a/src/libs/compat/freebsd_wlan/net80211/ieee80211_var.h b/src/libs/compat/freebsd_wlan/net80211/ieee80211_var.h index 93db5b313e..de24cbd4cc 100644 --- a/src/libs/compat/freebsd_wlan/net80211/ieee80211_var.h +++ b/src/libs/compat/freebsd_wlan/net80211/ieee80211_var.h @@ -232,7 +232,7 @@ struct ieee80211com { /* virtual ap create/delete */ struct ieee80211vap* (*ic_vap_create)(struct ieee80211com *, const char name[IFNAMSIZ], int unit, - int opmode, int flags, + enum ieee80211_opmode opmode, int flags, const uint8_t bssid[IEEE80211_ADDR_LEN], const uint8_t macaddr[IEEE80211_ADDR_LEN]); void (*ic_vap_delete)(struct ieee80211vap *); diff --git a/src/libs/icon/message/MessageImporter.cpp b/src/libs/icon/message/MessageImporter.cpp index 403b2ccc1d..bcf782122e 100644 --- a/src/libs/icon/message/MessageImporter.cpp +++ b/src/libs/icon/message/MessageImporter.cpp @@ -182,7 +182,7 @@ MessageImporter::_ImportShapes(const BMessage* archive, PathContainer* paths, int32 styleIndex; if (shapeArchive.FindInt32("style ref", &styleIndex) < B_OK) { printf("MessageImporter::_ImportShapes() - " - "Shape %ld doesn't reference a Style!", i); + "Shape %" B_PRId32 " doesn't reference a Style!", i); continue; } #ifdef ICON_O_MATIC @@ -192,7 +192,7 @@ MessageImporter::_ImportShapes(const BMessage* archive, PathContainer* paths, #endif if (!style) { printf("MessageImporter::_ImportShapes() - " - "Shape %ld wants Style %ld, which does not exist\n", + "Shape %" B_PRId32 " wants Style %" B_PRId32 ", which does not exist\n", i, styleIndex); continue; } @@ -218,7 +218,7 @@ MessageImporter::_ImportShapes(const BMessage* archive, PathContainer* paths, #endif if (!path) { printf("MessageImporter::_ImportShapes() - " - "Shape %ld referenced path %ld, " + "Shape %" B_PRId32 " referenced path %" B_PRId32 ", " "which does not exist\n", i, pathIndex); continue; } diff --git a/src/libs/icon/shape/VectorPath.cpp b/src/libs/icon/shape/VectorPath.cpp index a2f88a8a73..b800a07db4 100644 --- a/src/libs/icon/shape/VectorPath.cpp +++ b/src/libs/icon/shape/VectorPath.cpp @@ -976,7 +976,7 @@ void VectorPath::PrintToStream() const { for (int32 i = 0; i < fPointCount; i++) { - printf("point %ld: (%f, %f) -> (%f, %f) -> (%f, %f) (%d)\n", i, + printf("point %" B_PRId32 ": (%f, %f) -> (%f, %f) -> (%f, %f) (%d)\n", i, fPath[i].point_in.x, fPath[i].point_in.y, fPath[i].point.x, fPath[i].point.y, fPath[i].point_out.x, fPath[i].point_out.y, fPath[i].connected); @@ -1085,7 +1085,7 @@ VectorPath::_SetPointCount(int32 count) // reallocation might have failed fPointCount = 0; fAllocCount = 0; - fprintf(stderr, "VectorPath::_SetPointCount(%ld) - allocation failed!\n", + fprintf(stderr, "VectorPath::_SetPointCount(%" B_PRId32 ") - allocation failed!\n", count); } diff --git a/src/libs/icon/style/GradientTransformable.cpp b/src/libs/icon/style/GradientTransformable.cpp index 50c8525a65..5baf553b72 100644 --- a/src/libs/icon/style/GradientTransformable.cpp +++ b/src/libs/icon/style/GradientTransformable.cpp @@ -591,7 +591,7 @@ Gradient::PrintToStream() const string_for_interpolation(fInterpolation), fInheritTransformation); for (int32 i = 0; BGradient::ColorStop* step = ColorAt(i); i++) { - printf(" %ld: offset: %.1f -> color(%d, %d, %d, %d)\n", + printf(" %" B_PRId32 ": offset: %.1f -> color(%d, %d, %d, %d)\n", i, step->offset, step->color.red, step->color.green, diff --git a/src/preferences/backgrounds/BackgroundImage.cpp b/src/preferences/backgrounds/BackgroundImage.cpp index d6c34a648c..a4b41ec0c2 100644 --- a/src/preferences/backgrounds/BackgroundImage.cpp +++ b/src/preferences/backgrounds/BackgroundImage.cpp @@ -561,7 +561,17 @@ Image::Image(BPath path) fBitmap(NULL), fPath(path) { - name = path.Leaf(); + const int32 kMaxWidth = 40; + fName = path.Leaf(); + int extra = fName.Length() - kMaxWidth; + if (extra > 0) { + int offset = fName.FindLast('.'); + if (offset > 0) { + offset++; + fName.Truncate(offset - extra) << B_UTF8_ELLIPSIS; + fName.Append(path.Leaf() + offset); + } + } } diff --git a/src/preferences/backgrounds/BackgroundImage.h b/src/preferences/backgrounds/BackgroundImage.h index aa11a711df..1e4ca03c80 100644 --- a/src/preferences/backgrounds/BackgroundImage.h +++ b/src/preferences/backgrounds/BackgroundImage.h @@ -165,13 +165,13 @@ public: ~Image(); void UnloadBitmap(); - const char* GetName() {return name.String();} + const char* GetName() { return fName.String(); } BBitmap* GetBitmap(); - BPath GetPath() {return fPath;} + BPath GetPath() { return fPath; } private: BBitmap* fBitmap; BPath fPath; - BString name; + BString fName; }; #endif diff --git a/src/preferences/printers/JobListView.cpp b/src/preferences/printers/JobListView.cpp index 473ec65102..ff371d9ef4 100644 --- a/src/preferences/printers/JobListView.cpp +++ b/src/preferences/printers/JobListView.cpp @@ -42,7 +42,7 @@ JobListView::JobListView(BRect frame) JobListView::~JobListView() { while (!IsEmpty()) - delete RemoveItem(0L); + delete RemoveItem((int32)0); } @@ -61,7 +61,7 @@ JobListView::SetSpoolFolder(SpoolFolder* folder) { // clear list while (!IsEmpty()) - delete RemoveItem(0L); + delete RemoveItem((int32)0); if (folder == NULL) return; diff --git a/src/preferences/printers/PrinterListView.cpp b/src/preferences/printers/PrinterListView.cpp index bfc5f50814..1c7deaa98e 100644 --- a/src/preferences/printers/PrinterListView.cpp +++ b/src/preferences/printers/PrinterListView.cpp @@ -45,7 +45,7 @@ PrinterListView::PrinterListView(BRect frame) PrinterListView::~PrinterListView() { while (!IsEmpty()) - delete RemoveItem(0L); + delete RemoveItem((int32)0); } @@ -54,7 +54,7 @@ PrinterListView::BuildPrinterList() { // clear list while (!IsEmpty()) - delete RemoveItem(0L); + delete RemoveItem((int32)0); // Find directory containing printer definition nodes BPath path; diff --git a/src/preferences/virtualmemory/SettingsWindow.cpp b/src/preferences/virtualmemory/SettingsWindow.cpp index 5dd0c312a2..38bf127c48 100644 --- a/src/preferences/virtualmemory/SettingsWindow.cpp +++ b/src/preferences/virtualmemory/SettingsWindow.cpp @@ -162,7 +162,7 @@ SettingsWindow::SettingsWindow() fSwapEnabledCheckBox->SetExplicitAlignment(align); fSwapAutomaticCheckBox = new BCheckBox("auto swap", - B_TRANSLATE("Choose swap size automatically"), + B_TRANSLATE("Automatic swap management"), new BMessage(kMsgSwapAutomaticUpdate)); fSwapEnabledCheckBox->SetExplicitAlignment(align); diff --git a/src/servers/cddb_daemon/cddb_daemon.cpp b/src/servers/cddb_daemon/cddb_daemon.cpp index ef2529d72a..f21617335c 100644 --- a/src/servers/cddb_daemon/cddb_daemon.cpp +++ b/src/servers/cddb_daemon/cddb_daemon.cpp @@ -84,11 +84,11 @@ CDDBDaemon::_Lookup(const dev_t device) uint32 cddbId; if (!_CanLookup(device, &cddbId, toc)) { free(toc); - printf("Skipping device with id %ld.\n", device); + printf("Skipping device with id %" B_PRId32 ".\n", device); return B_BAD_TYPE; } - printf("Looking up CD with CDDB Id %08lx.\n", cddbId); + printf("Looking up CD with CDDB Id %08" B_PRIx32 ".\n", cddbId); CDDBServer cddb_server("freedb.freedb.org:80"); @@ -123,7 +123,7 @@ CDDBDaemon::_Lookup(const dev_t device) // Delete itens in the query response BList; int32 count = queryResponse.CountItems(); for (int32 i = 0; i < count; ++i) { - delete (QueryResponseData*)queryResponse.RemoveItem(0L); + delete (QueryResponseData*)queryResponse.RemoveItem((int32)0); } queryResponse.MakeEmpty(); @@ -131,7 +131,7 @@ CDDBDaemon::_Lookup(const dev_t device) // Delete itens in the track data BList in the read response data; count = readResponse.tracks.CountItems(); for (int32 i = 0; i < count; ++i) { - delete (TrackData*)readResponse.tracks.RemoveItem(0L); + delete (TrackData*)readResponse.tracks.RemoveItem((int32)0); } readResponse.tracks.MakeEmpty(); diff --git a/src/servers/cddb_daemon/cddb_server.cpp b/src/servers/cddb_daemon/cddb_server.cpp index 8bbc93fd2a..d0d8ebb1d2 100644 --- a/src/servers/cddb_daemon/cddb_server.cpp +++ b/src/servers/cddb_daemon/cddb_server.cpp @@ -56,7 +56,7 @@ CDDBServer::Query(uint32 cddbId, const scsi_toc_toc* toc, BList* queryResponse) // Convert CDDB id to hexadecimal format. char hexCddbId[9]; - sprintf(hexCddbId, "%08lx", cddbId); + sprintf(hexCddbId, "%08" B_PRIx32 "", cddbId); // Assemble the Query command. int32 numTracks = toc->last_track + 1 - toc->first_track; diff --git a/src/servers/print/ConfigWindow.cpp b/src/servers/print/ConfigWindow.cpp index eebea2dee2..6a8f6fb2ec 100644 --- a/src/servers/print/ConfigWindow.cpp +++ b/src/servers/print/ConfigWindow.cpp @@ -414,7 +414,7 @@ ConfigWindow::SetupPrintersMenu(BMenu* menu) { // clear menu while (menu->CountItems() != 0) - delete menu->RemoveItem(0L); + delete menu->RemoveItem((int32)0); // fill menu with printer names BAutolock lock(gLock); diff --git a/src/system/libroot/posix/Jamfile b/src/system/libroot/posix/Jamfile index b796810c3c..b6b720ada8 100644 --- a/src/system/libroot/posix/Jamfile +++ b/src/system/libroot/posix/Jamfile @@ -18,9 +18,12 @@ MergeObject posix_main.o : errno.c fcntl.cpp fnmatch.c + fts.c + ftw.c glob.c inttypes.c libgen.cpp + nftw.c poll.c $(PWD_BACKEND) scheduler.cpp diff --git a/src/system/libroot/posix/fts.c b/src/system/libroot/posix/fts.c new file mode 100644 index 0000000000..ce7ac95981 --- /dev/null +++ b/src/system/libroot/posix/fts.c @@ -0,0 +1,1209 @@ +/*- + * Copyright (c) 1990, 1993, 1994 + * The Regents of the University of California. 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. + * 4. Neither the name of the University 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 REGENTS 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 REGENTS 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. + * + * $OpenBSD: fts.c,v 1.22 1999/10/03 19:22:22 millert Exp $ + */ + +#if 0 +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)fts.c 8.6 (Berkeley) 8/14/94"; +#endif /* LIBC_SCCS and not lint */ +#endif + +#include + +#ifdef __HAIKU__ +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#else +__FBSDID("$FreeBSD$"); + +#include "namespace.h" +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include "un-namespace.h" + +#include "gen-private.h" +#endif + +static FTSENT *fts_alloc(FTS *, char *, size_t); +static FTSENT *fts_build(FTS *, int); +static void fts_lfree(FTSENT *); +static void fts_load(FTS *, FTSENT *); +static size_t fts_maxarglen(char * const *); +static void fts_padjust(FTS *, FTSENT *); +static int fts_palloc(FTS *, size_t); +static FTSENT *fts_sort(FTS *, FTSENT *, size_t); +static int fts_stat(FTS *, FTSENT *, int); +static int fts_safe_changedir(FTS *, FTSENT *, int, char *); +static int fts_ufslinks(FTS *, const FTSENT *); + +#define ISDOT(a) (a[0] == '.' && (!a[1] || (a[1] == '.' && !a[2]))) + +#define CLR(opt) (sp->fts_options &= ~(opt)) +#define ISSET(opt) (sp->fts_options & (opt)) +#define SET(opt) (sp->fts_options |= (opt)) + +#define FCHDIR(sp, fd) (!ISSET(FTS_NOCHDIR) && fchdir(fd)) + +/* fts_build flags */ +#define BCHILD 1 /* fts_children */ +#define BNAMES 2 /* fts_children, names only */ +#define BREAD 3 /* fts_read */ + +/* + * Internal representation of an FTS, including extra implementation + * details. The FTS returned from fts_open points to this structure's + * ftsp_fts member (and can be cast to an _fts_private as required) + */ +struct _fts_private { + FTS ftsp_fts; +#ifndef __HAIKU__ + struct statfs ftsp_statfs; +#endif + dev_t ftsp_dev; + int ftsp_linksreliable; +}; + +#ifndef __HAIKU__ +/* + * The "FTS_NOSTAT" option can avoid a lot of calls to stat(2) if it + * knows that a directory could not possibly have subdirectories. This + * is decided by looking at the link count: a subdirectory would + * increment its parent's link count by virtue of its own ".." entry. + * This assumption only holds for UFS-like filesystems that implement + * links and directories this way, so we must punt for others. + */ + +static const char *ufslike_filesystems[] = { + "ufs", + "zfs", + "nfs", + "nfs4", + "ext2fs", + 0 +}; +#endif /* !__HAIKU__ */ + +FTS * +fts_open(argv, options, compar) + char * const *argv; + int options; + int (*compar)(const FTSENT * const *, const FTSENT * const *); +{ + struct _fts_private *priv; + FTS *sp; + FTSENT *p, *root; + FTSENT *parent, *tmp; + size_t len, nitems; + + /* Options check. */ + if (options & ~FTS_OPTIONMASK) { + errno = EINVAL; + return (NULL); + } + + /* fts_open() requires at least one path */ + if (*argv == NULL) { + errno = EINVAL; + return (NULL); + } + + /* Allocate/initialize the stream. */ + if ((priv = calloc(1, sizeof(*priv))) == NULL) + return (NULL); + sp = &priv->ftsp_fts; + sp->fts_compar = compar; + sp->fts_options = options; + + /* Shush, GCC. */ + tmp = NULL; + + /* Logical walks turn on NOCHDIR; symbolic links are too hard. */ + if (ISSET(FTS_LOGICAL)) + SET(FTS_NOCHDIR); + + /* + * Start out with 1K of path space, and enough, in any case, + * to hold the user's paths. + */ + if (fts_palloc(sp, MAX(fts_maxarglen(argv), MAXPATHLEN))) + goto mem1; + + /* Allocate/initialize root's parent. */ + if ((parent = fts_alloc(sp, "", 0)) == NULL) + goto mem2; + parent->fts_level = FTS_ROOTPARENTLEVEL; + + /* Allocate/initialize root(s). */ + for (root = NULL, nitems = 0; *argv != NULL; ++argv, ++nitems) { + /* Don't allow zero-length paths. */ + if ((len = strlen(*argv)) == 0) { + errno = ENOENT; + goto mem3; + } + + p = fts_alloc(sp, *argv, len); + p->fts_level = FTS_ROOTLEVEL; + p->fts_parent = parent; + p->fts_accpath = p->fts_name; + p->fts_info = fts_stat(sp, p, ISSET(FTS_COMFOLLOW)); + + /* Command-line "." and ".." are real directories. */ + if (p->fts_info == FTS_DOT) + p->fts_info = FTS_D; + + /* + * If comparison routine supplied, traverse in sorted + * order; otherwise traverse in the order specified. + */ + if (compar) { + p->fts_link = root; + root = p; + } else { + p->fts_link = NULL; + if (root == NULL) + tmp = root = p; + else { + tmp->fts_link = p; + tmp = p; + } + } + } + if (compar && nitems > 1) + root = fts_sort(sp, root, nitems); + + /* + * Allocate a dummy pointer and make fts_read think that we've just + * finished the node before the root(s); set p->fts_info to FTS_INIT + * so that everything about the "current" node is ignored. + */ + if ((sp->fts_cur = fts_alloc(sp, "", 0)) == NULL) + goto mem3; + sp->fts_cur->fts_link = root; + sp->fts_cur->fts_info = FTS_INIT; + + /* + * If using chdir(2), grab a file descriptor pointing to dot to ensure + * that we can get back here; this could be avoided for some paths, + * but almost certainly not worth the effort. Slashes, symbolic links, + * and ".." are all fairly nasty problems. Note, if we can't get the + * descriptor we run anyway, just more slowly. + */ + if (!ISSET(FTS_NOCHDIR) && + (sp->fts_rfd = open(".", O_RDONLY | O_CLOEXEC, 0)) < 0) + SET(FTS_NOCHDIR); + + return (sp); + +mem3: fts_lfree(root); + free(parent); +mem2: free(sp->fts_path); +mem1: free(sp); + return (NULL); +} + +static void +fts_load(FTS *sp, FTSENT *p) +{ + size_t len; + char *cp; + + /* + * Load the stream structure for the next traversal. Since we don't + * actually enter the directory until after the preorder visit, set + * the fts_accpath field specially so the chdir gets done to the right + * place and the user can access the first node. From fts_open it's + * known that the path will fit. + */ + len = p->fts_pathlen = p->fts_namelen; + memmove(sp->fts_path, p->fts_name, len + 1); + if ((cp = strrchr(p->fts_name, '/')) && (cp != p->fts_name || cp[1])) { + len = strlen(++cp); + memmove(p->fts_name, cp, len + 1); + p->fts_namelen = len; + } + p->fts_accpath = p->fts_path = sp->fts_path; + sp->fts_dev = p->fts_dev; +} + +int +fts_close(FTS *sp) +{ + FTSENT *freep, *p; + int saved_errno; + + /* + * This still works if we haven't read anything -- the dummy structure + * points to the root list, so we step through to the end of the root + * list which has a valid parent pointer. + */ + if (sp->fts_cur) { + for (p = sp->fts_cur; p->fts_level >= FTS_ROOTLEVEL;) { + freep = p; + p = p->fts_link != NULL ? p->fts_link : p->fts_parent; + free(freep); + } + free(p); + } + + /* Free up child linked list, sort array, path buffer. */ + if (sp->fts_child) + fts_lfree(sp->fts_child); + if (sp->fts_array) + free(sp->fts_array); + free(sp->fts_path); + + /* Return to original directory, save errno if necessary. */ + if (!ISSET(FTS_NOCHDIR)) { + saved_errno = fchdir(sp->fts_rfd) ? errno : 0; + (void)close(sp->fts_rfd); + + /* Set errno and return. */ + if (saved_errno != 0) { + /* Free up the stream pointer. */ + free(sp); + errno = saved_errno; + return (-1); + } + } + + /* Free up the stream pointer. */ + free(sp); + return (0); +} + +/* + * Special case of "/" at the end of the path so that slashes aren't + * appended which would cause paths to be written as "....//foo". + */ +#define NAPPEND(p) \ + (p->fts_path[p->fts_pathlen - 1] == '/' \ + ? p->fts_pathlen - 1 : p->fts_pathlen) + +FTSENT * +fts_read(FTS *sp) +{ + FTSENT *p, *tmp; + int instr; + char *t; + int saved_errno; + + /* If finished or unrecoverable error, return NULL. */ + if (sp->fts_cur == NULL || ISSET(FTS_STOP)) + return (NULL); + + /* Set current node pointer. */ + p = sp->fts_cur; + + /* Save and zero out user instructions. */ + instr = p->fts_instr; + p->fts_instr = FTS_NOINSTR; + + /* Any type of file may be re-visited; re-stat and re-turn. */ + if (instr == FTS_AGAIN) { + p->fts_info = fts_stat(sp, p, 0); + return (p); + } + + /* + * Following a symlink -- SLNONE test allows application to see + * SLNONE and recover. If indirecting through a symlink, have + * keep a pointer to current location. If unable to get that + * pointer, follow fails. + */ + if (instr == FTS_FOLLOW && + (p->fts_info == FTS_SL || p->fts_info == FTS_SLNONE)) { + p->fts_info = fts_stat(sp, p, 1); + if (p->fts_info == FTS_D && !ISSET(FTS_NOCHDIR)) { + if ((p->fts_symfd = open(".", O_RDONLY | O_CLOEXEC, + 0)) < 0) { + p->fts_errno = errno; + p->fts_info = FTS_ERR; + } else + p->fts_flags |= FTS_SYMFOLLOW; + } + return (p); + } + + /* Directory in pre-order. */ + if (p->fts_info == FTS_D) { + /* If skipped or crossed mount point, do post-order visit. */ + if (instr == FTS_SKIP || + (ISSET(FTS_XDEV) && p->fts_dev != sp->fts_dev)) { + if (p->fts_flags & FTS_SYMFOLLOW) + (void)close(p->fts_symfd); + if (sp->fts_child) { + fts_lfree(sp->fts_child); + sp->fts_child = NULL; + } + p->fts_info = FTS_DP; + return (p); + } + + /* Rebuild if only read the names and now traversing. */ + if (sp->fts_child != NULL && ISSET(FTS_NAMEONLY)) { + CLR(FTS_NAMEONLY); + fts_lfree(sp->fts_child); + sp->fts_child = NULL; + } + + /* + * Cd to the subdirectory. + * + * If have already read and now fail to chdir, whack the list + * to make the names come out right, and set the parent errno + * so the application will eventually get an error condition. + * Set the FTS_DONTCHDIR flag so that when we logically change + * directories back to the parent we don't do a chdir. + * + * If haven't read do so. If the read fails, fts_build sets + * FTS_STOP or the fts_info field of the node. + */ + if (sp->fts_child != NULL) { + if (fts_safe_changedir(sp, p, -1, p->fts_accpath)) { + p->fts_errno = errno; + p->fts_flags |= FTS_DONTCHDIR; + for (p = sp->fts_child; p != NULL; + p = p->fts_link) + p->fts_accpath = + p->fts_parent->fts_accpath; + } + } else if ((sp->fts_child = fts_build(sp, BREAD)) == NULL) { + if (ISSET(FTS_STOP)) + return (NULL); + return (p); + } + p = sp->fts_child; + sp->fts_child = NULL; + goto name; + } + + /* Move to the next node on this level. */ +next: tmp = p; + if ((p = p->fts_link) != NULL) { + free(tmp); + + /* + * If reached the top, return to the original directory (or + * the root of the tree), and load the paths for the next root. + */ + if (p->fts_level == FTS_ROOTLEVEL) { + if (FCHDIR(sp, sp->fts_rfd)) { + SET(FTS_STOP); + return (NULL); + } + fts_load(sp, p); + return (sp->fts_cur = p); + } + + /* + * User may have called fts_set on the node. If skipped, + * ignore. If followed, get a file descriptor so we can + * get back if necessary. + */ + if (p->fts_instr == FTS_SKIP) + goto next; + if (p->fts_instr == FTS_FOLLOW) { + p->fts_info = fts_stat(sp, p, 1); + if (p->fts_info == FTS_D && !ISSET(FTS_NOCHDIR)) { + if ((p->fts_symfd = + open(".", O_RDONLY | O_CLOEXEC, 0)) < 0) { + p->fts_errno = errno; + p->fts_info = FTS_ERR; + } else + p->fts_flags |= FTS_SYMFOLLOW; + } + p->fts_instr = FTS_NOINSTR; + } + +name: t = sp->fts_path + NAPPEND(p->fts_parent); + *t++ = '/'; + memmove(t, p->fts_name, p->fts_namelen + 1); + return (sp->fts_cur = p); + } + + /* Move up to the parent node. */ + p = tmp->fts_parent; + free(tmp); + + if (p->fts_level == FTS_ROOTPARENTLEVEL) { + /* + * Done; free everything up and set errno to 0 so the user + * can distinguish between error and EOF. + */ + free(p); + errno = 0; + return (sp->fts_cur = NULL); + } + + /* NUL terminate the pathname. */ + sp->fts_path[p->fts_pathlen] = '\0'; + + /* + * Return to the parent directory. If at a root node or came through + * a symlink, go back through the file descriptor. Otherwise, cd up + * one directory. + */ + if (p->fts_level == FTS_ROOTLEVEL) { + if (FCHDIR(sp, sp->fts_rfd)) { + SET(FTS_STOP); + return (NULL); + } + } else if (p->fts_flags & FTS_SYMFOLLOW) { + if (FCHDIR(sp, p->fts_symfd)) { + saved_errno = errno; + (void)close(p->fts_symfd); + errno = saved_errno; + SET(FTS_STOP); + return (NULL); + } + (void)close(p->fts_symfd); + } else if (!(p->fts_flags & FTS_DONTCHDIR) && + fts_safe_changedir(sp, p->fts_parent, -1, "..")) { + SET(FTS_STOP); + return (NULL); + } + p->fts_info = p->fts_errno ? FTS_ERR : FTS_DP; + return (sp->fts_cur = p); +} + +/* + * Fts_set takes the stream as an argument although it's not used in this + * implementation; it would be necessary if anyone wanted to add global + * semantics to fts using fts_set. An error return is allowed for similar + * reasons. + */ +/* ARGSUSED */ +int +fts_set(FTS *sp, FTSENT *p, int instr) +{ + if (instr != 0 && instr != FTS_AGAIN && instr != FTS_FOLLOW && + instr != FTS_NOINSTR && instr != FTS_SKIP) { + errno = EINVAL; + return (1); + } + p->fts_instr = instr; + return (0); +} + +FTSENT * +fts_children(FTS *sp, int instr) +{ + FTSENT *p; + int fd; + + if (instr != 0 && instr != FTS_NAMEONLY) { + errno = EINVAL; + return (NULL); + } + + /* Set current node pointer. */ + p = sp->fts_cur; + + /* + * Errno set to 0 so user can distinguish empty directory from + * an error. + */ + errno = 0; + + /* Fatal errors stop here. */ + if (ISSET(FTS_STOP)) + return (NULL); + + /* Return logical hierarchy of user's arguments. */ + if (p->fts_info == FTS_INIT) + return (p->fts_link); + + /* + * If not a directory being visited in pre-order, stop here. Could + * allow FTS_DNR, assuming the user has fixed the problem, but the + * same effect is available with FTS_AGAIN. + */ + if (p->fts_info != FTS_D /* && p->fts_info != FTS_DNR */) + return (NULL); + + /* Free up any previous child list. */ + if (sp->fts_child != NULL) + fts_lfree(sp->fts_child); + + if (instr == FTS_NAMEONLY) { + SET(FTS_NAMEONLY); + instr = BNAMES; + } else + instr = BCHILD; + + /* + * If using chdir on a relative path and called BEFORE fts_read does + * its chdir to the root of a traversal, we can lose -- we need to + * chdir into the subdirectory, and we don't know where the current + * directory is, so we can't get back so that the upcoming chdir by + * fts_read will work. + */ + if (p->fts_level != FTS_ROOTLEVEL || p->fts_accpath[0] == '/' || + ISSET(FTS_NOCHDIR)) + return (sp->fts_child = fts_build(sp, instr)); + + if ((fd = open(".", O_RDONLY | O_CLOEXEC, 0)) < 0) + return (NULL); + sp->fts_child = fts_build(sp, instr); + if (fchdir(fd)) { + (void)close(fd); + return (NULL); + } + (void)close(fd); + return (sp->fts_child); +} + +#ifndef fts_get_clientptr +#error "fts_get_clientptr not defined" +#endif + +void * +(fts_get_clientptr)(FTS *sp) +{ + + return (fts_get_clientptr(sp)); +} + +#ifndef fts_get_stream +#error "fts_get_stream not defined" +#endif + +FTS * +(fts_get_stream)(FTSENT *p) +{ + return (fts_get_stream(p)); +} + +void +fts_set_clientptr(FTS *sp, void *clientptr) +{ + + sp->fts_clientptr = clientptr; +} + +/* + * This is the tricky part -- do not casually change *anything* in here. The + * idea is to build the linked list of entries that are used by fts_children + * and fts_read. There are lots of special cases. + * + * The real slowdown in walking the tree is the stat calls. If FTS_NOSTAT is + * set and it's a physical walk (so that symbolic links can't be directories), + * we can do things quickly. First, if it's a 4.4BSD file system, the type + * of the file is in the directory entry. Otherwise, we assume that the number + * of subdirectories in a node is equal to the number of links to the parent. + * The former skips all stat calls. The latter skips stat calls in any leaf + * directories and for any files after the subdirectories in the directory have + * been found, cutting the stat calls by about 2/3. + */ +static FTSENT * +fts_build(FTS *sp, int type) +{ + struct dirent *dp; + FTSENT *p, *head; + FTSENT *cur, *tail; + DIR *dirp; + void *oldaddr; + char *cp; + int cderrno, descend, saved_errno, nostat, doadjust; +#ifdef FTS_WHITEOUT + int oflag; +#endif + long level; + long nlinks; /* has to be signed because -1 is a magic value */ + size_t dnamlen, len, maxlen, nitems; + + /* Set current node pointer. */ + cur = sp->fts_cur; + + /* + * Open the directory for reading. If this fails, we're done. + * If being called from fts_read, set the fts_info field. + */ +#ifdef FTS_WHITEOUT + if (ISSET(FTS_WHITEOUT)) + oflag = DTF_NODUP | DTF_REWIND; + else + oflag = DTF_HIDEW | DTF_NODUP | DTF_REWIND; +#else +#define __opendir2(path, flag) opendir(path) +#endif + if ((dirp = __opendir2(cur->fts_accpath, oflag)) == NULL) { + if (type == BREAD) { + cur->fts_info = FTS_DNR; + cur->fts_errno = errno; + } + return (NULL); + } + + /* + * Nlinks is the number of possible entries of type directory in the + * directory if we're cheating on stat calls, 0 if we're not doing + * any stat calls at all, -1 if we're doing stats on everything. + */ + if (type == BNAMES) { + nlinks = 0; + /* Be quiet about nostat, GCC. */ + nostat = 0; + } else if (ISSET(FTS_NOSTAT) && ISSET(FTS_PHYSICAL)) { + if (fts_ufslinks(sp, cur)) + nlinks = cur->fts_nlink - (ISSET(FTS_SEEDOT) ? 0 : 2); + else + nlinks = -1; + nostat = 1; + } else { + nlinks = -1; + nostat = 0; + } + +#ifdef notdef + (void)printf("nlinks == %d (cur: %d)\n", nlinks, cur->fts_nlink); + (void)printf("NOSTAT %d PHYSICAL %d SEEDOT %d\n", + ISSET(FTS_NOSTAT), ISSET(FTS_PHYSICAL), ISSET(FTS_SEEDOT)); +#endif + /* + * If we're going to need to stat anything or we want to descend + * and stay in the directory, chdir. If this fails we keep going, + * but set a flag so we don't chdir after the post-order visit. + * We won't be able to stat anything, but we can still return the + * names themselves. Note, that since fts_read won't be able to + * chdir into the directory, it will have to return different path + * names than before, i.e. "a/b" instead of "b". Since the node + * has already been visited in pre-order, have to wait until the + * post-order visit to return the error. There is a special case + * here, if there was nothing to stat then it's not an error to + * not be able to stat. This is all fairly nasty. If a program + * needed sorted entries or stat information, they had better be + * checking FTS_NS on the returned nodes. + */ + cderrno = 0; + if (nlinks || type == BREAD) { + if (fts_safe_changedir(sp, cur, dirfd(dirp), NULL)) { + if (nlinks && type == BREAD) + cur->fts_errno = errno; + cur->fts_flags |= FTS_DONTCHDIR; + descend = 0; + cderrno = errno; + } else + descend = 1; + } else + descend = 0; + + /* + * Figure out the max file name length that can be stored in the + * current path -- the inner loop allocates more path as necessary. + * We really wouldn't have to do the maxlen calculations here, we + * could do them in fts_read before returning the path, but it's a + * lot easier here since the length is part of the dirent structure. + * + * If not changing directories set a pointer so that can just append + * each new name into the path. + */ + len = NAPPEND(cur); + if (ISSET(FTS_NOCHDIR)) { + cp = sp->fts_path + len; + *cp++ = '/'; + } else { + /* GCC, you're too verbose. */ + cp = NULL; + } + len++; + maxlen = sp->fts_pathlen - len; + + level = cur->fts_level + 1; + + /* Read the directory, attaching each entry to the `link' pointer. */ + doadjust = 0; + for (head = tail = NULL, nitems = 0; dirp && (dp = readdir(dirp));) { + dnamlen = strlen(dp->d_name); + if (!ISSET(FTS_SEEDOT) && ISDOT(dp->d_name)) + continue; + + if ((p = fts_alloc(sp, dp->d_name, dnamlen)) == NULL) + goto mem1; + if (dnamlen >= maxlen) { /* include space for NUL */ + oldaddr = sp->fts_path; + if (fts_palloc(sp, dnamlen + len + 1)) { + /* + * No more memory for path or structures. Save + * errno, free up the current structure and the + * structures already allocated. + */ +mem1: saved_errno = errno; + if (p) + free(p); + fts_lfree(head); + (void)closedir(dirp); + cur->fts_info = FTS_ERR; + SET(FTS_STOP); + errno = saved_errno; + return (NULL); + } + /* Did realloc() change the pointer? */ + if (oldaddr != sp->fts_path) { + doadjust = 1; + if (ISSET(FTS_NOCHDIR)) + cp = sp->fts_path + len; + } + maxlen = sp->fts_pathlen - len; + } + + p->fts_level = level; + p->fts_parent = sp->fts_cur; + p->fts_pathlen = len + dnamlen; + +#ifdef FTS_WHITEOUT + if (dp->d_type == DT_WHT) + p->fts_flags |= FTS_ISW; +#endif + + if (cderrno) { + if (nlinks) { + p->fts_info = FTS_NS; + p->fts_errno = cderrno; + } else + p->fts_info = FTS_NSOK; + p->fts_accpath = cur->fts_accpath; + } else if (nlinks == 0 +#ifdef DT_DIR + || (nostat && + dp->d_type != DT_DIR && dp->d_type != DT_UNKNOWN) +#endif + ) { + p->fts_accpath = + ISSET(FTS_NOCHDIR) ? p->fts_path : p->fts_name; + p->fts_info = FTS_NSOK; + } else { + /* Build a file name for fts_stat to stat. */ + if (ISSET(FTS_NOCHDIR)) { + p->fts_accpath = p->fts_path; + memmove(cp, p->fts_name, p->fts_namelen + 1); + } else + p->fts_accpath = p->fts_name; + /* Stat it. */ + p->fts_info = fts_stat(sp, p, 0); + + /* Decrement link count if applicable. */ + if (nlinks > 0 && (p->fts_info == FTS_D || + p->fts_info == FTS_DC || p->fts_info == FTS_DOT)) + --nlinks; + } + + /* We walk in directory order so "ls -f" doesn't get upset. */ + p->fts_link = NULL; + if (head == NULL) + head = tail = p; + else { + tail->fts_link = p; + tail = p; + } + ++nitems; + } + if (dirp) + (void)closedir(dirp); + + /* + * If realloc() changed the address of the path, adjust the + * addresses for the rest of the tree and the dir list. + */ + if (doadjust) + fts_padjust(sp, head); + + /* + * If not changing directories, reset the path back to original + * state. + */ + if (ISSET(FTS_NOCHDIR)) + sp->fts_path[cur->fts_pathlen] = '\0'; + + /* + * If descended after called from fts_children or after called from + * fts_read and nothing found, get back. At the root level we use + * the saved fd; if one of fts_open()'s arguments is a relative path + * to an empty directory, we wind up here with no other way back. If + * can't get back, we're done. + */ + if (descend && (type == BCHILD || !nitems) && + (cur->fts_level == FTS_ROOTLEVEL ? + FCHDIR(sp, sp->fts_rfd) : + fts_safe_changedir(sp, cur->fts_parent, -1, ".."))) { + cur->fts_info = FTS_ERR; + SET(FTS_STOP); + return (NULL); + } + + /* If didn't find anything, return NULL. */ + if (!nitems) { + if (type == BREAD) + cur->fts_info = FTS_DP; + return (NULL); + } + + /* Sort the entries. */ + if (sp->fts_compar && nitems > 1) + head = fts_sort(sp, head, nitems); + return (head); +} + +static int +fts_stat(FTS *sp, FTSENT *p, int follow) +{ + FTSENT *t; + dev_t dev; + ino_t ino; + struct stat *sbp, sb; + int saved_errno; + + /* If user needs stat info, stat buffer already allocated. */ + sbp = ISSET(FTS_NOSTAT) ? &sb : p->fts_statp; + +#ifdef FTS_WHITEOUT + /* Check for whiteout. */ + if (p->fts_flags & FTS_ISW) { + if (sbp != &sb) { + memset(sbp, '\0', sizeof(*sbp)); + sbp->st_mode = S_IFWHT; + } + return (FTS_W); + } +#endif + + /* + * If doing a logical walk, or application requested FTS_FOLLOW, do + * a stat(2). If that fails, check for a non-existent symlink. If + * fail, set the errno from the stat call. + */ + if (ISSET(FTS_LOGICAL) || follow) { + if (stat(p->fts_accpath, sbp)) { + saved_errno = errno; + if (!lstat(p->fts_accpath, sbp)) { + errno = 0; + return (FTS_SLNONE); + } + p->fts_errno = saved_errno; + goto err; + } + } else if (lstat(p->fts_accpath, sbp)) { + p->fts_errno = errno; +err: memset(sbp, 0, sizeof(struct stat)); + return (FTS_NS); + } + + if (S_ISDIR(sbp->st_mode)) { + /* + * Set the device/inode. Used to find cycles and check for + * crossing mount points. Also remember the link count, used + * in fts_build to limit the number of stat calls. It is + * understood that these fields are only referenced if fts_info + * is set to FTS_D. + */ + dev = p->fts_dev = sbp->st_dev; + ino = p->fts_ino = sbp->st_ino; + p->fts_nlink = sbp->st_nlink; + + if (ISDOT(p->fts_name)) + return (FTS_DOT); + + /* + * Cycle detection is done by brute force when the directory + * is first encountered. If the tree gets deep enough or the + * number of symbolic links to directories is high enough, + * something faster might be worthwhile. + */ + for (t = p->fts_parent; + t->fts_level >= FTS_ROOTLEVEL; t = t->fts_parent) + if (ino == t->fts_ino && dev == t->fts_dev) { + p->fts_cycle = t; + return (FTS_DC); + } + return (FTS_D); + } + if (S_ISLNK(sbp->st_mode)) + return (FTS_SL); + if (S_ISREG(sbp->st_mode)) + return (FTS_F); + return (FTS_DEFAULT); +} + +/* + * The comparison function takes pointers to pointers to FTSENT structures. + * Qsort wants a comparison function that takes pointers to void. + * (Both with appropriate levels of const-poisoning, of course!) + * Use a trampoline function to deal with the difference. + */ +static int +fts_compar(const void *a, const void *b) +{ + FTS *parent; + + parent = (*(const FTSENT * const *)a)->fts_fts; + return (*parent->fts_compar)(a, b); +} + +static FTSENT * +fts_sort(FTS *sp, FTSENT *head, size_t nitems) +{ + FTSENT **ap, *p; + FTSENT **old_array; + + /* + * Construct an array of pointers to the structures and call qsort(3). + * Reassemble the array in the order returned by qsort. If unable to + * sort for memory reasons, return the directory entries in their + * current order. Allocate enough space for the current needs plus + * 40 so don't realloc one entry at a time. + */ + if (nitems > sp->fts_nitems) { + sp->fts_nitems = nitems + 40; + old_array = sp->fts_array; + if ((sp->fts_array = realloc(old_array, + sp->fts_nitems * sizeof(FTSENT *))) == NULL) { + free(old_array); + sp->fts_nitems = 0; + return (head); + } + } + for (ap = sp->fts_array, p = head; p; p = p->fts_link) + *ap++ = p; + qsort(sp->fts_array, nitems, sizeof(FTSENT *), fts_compar); + for (head = *(ap = sp->fts_array); --nitems; ++ap) + ap[0]->fts_link = ap[1]; + ap[0]->fts_link = NULL; + return (head); +} + +static FTSENT * +fts_alloc(FTS *sp, char *name, size_t namelen) +{ + FTSENT *p; + size_t len; + + struct ftsent_withstat { + FTSENT ent; + struct stat statbuf; + }; + + /* + * The file name is a variable length array and no stat structure is + * necessary if the user has set the nostat bit. Allocate the FTSENT + * structure, the file name and the stat structure in one chunk, but + * be careful that the stat structure is reasonably aligned. + */ + if (ISSET(FTS_NOSTAT)) + len = sizeof(FTSENT) + namelen + 1; + else + len = sizeof(struct ftsent_withstat) + namelen + 1; + + if ((p = malloc(len)) == NULL) + return (NULL); + + if (ISSET(FTS_NOSTAT)) { + p->fts_name = (char *)(p + 1); + p->fts_statp = NULL; + } else { + p->fts_name = (char *)((struct ftsent_withstat *)p + 1); + p->fts_statp = &((struct ftsent_withstat *)p)->statbuf; + } + + /* Copy the name and guarantee NUL termination. */ + memcpy(p->fts_name, name, namelen); + p->fts_name[namelen] = '\0'; + p->fts_namelen = namelen; + p->fts_path = sp->fts_path; + p->fts_errno = 0; + p->fts_flags = 0; + p->fts_instr = FTS_NOINSTR; + p->fts_number = 0; + p->fts_pointer = NULL; + p->fts_fts = sp; + return (p); +} + +static void +fts_lfree(FTSENT *head) +{ + FTSENT *p; + + /* Free a linked list of structures. */ + while ((p = head)) { + head = head->fts_link; + free(p); + } +} + +/* + * Allow essentially unlimited paths; find, rm, ls should all work on any tree. + * Most systems will allow creation of paths much longer than MAXPATHLEN, even + * though the kernel won't resolve them. Add the size (not just what's needed) + * plus 256 bytes so don't realloc the path 2 bytes at a time. + */ +static int +fts_palloc(FTS *sp, size_t more) +{ + char *old_path; + sp->fts_pathlen += more + 256; + + old_path = sp->fts_path; + sp->fts_path = realloc(old_path, sp->fts_pathlen); + if (sp->fts_path == NULL) + free(old_path); + + return (sp->fts_path == NULL); +} + +/* + * When the path is realloc'd, have to fix all of the pointers in structures + * already returned. + */ +static void +fts_padjust(FTS *sp, FTSENT *head) +{ + FTSENT *p; + char *addr = sp->fts_path; + +#define ADJUST(p) do { \ + if ((p)->fts_accpath != (p)->fts_name) { \ + (p)->fts_accpath = \ + (char *)addr + ((p)->fts_accpath - (p)->fts_path); \ + } \ + (p)->fts_path = addr; \ +} while (0) + /* Adjust the current set of children. */ + for (p = sp->fts_child; p; p = p->fts_link) + ADJUST(p); + + /* Adjust the rest of the tree, including the current level. */ + for (p = head; p->fts_level >= FTS_ROOTLEVEL;) { + ADJUST(p); + p = p->fts_link ? p->fts_link : p->fts_parent; + } +} + +static size_t +fts_maxarglen(argv) + char * const *argv; +{ + size_t len, max; + + for (max = 0; *argv; ++argv) + if ((len = strlen(*argv)) > max) + max = len; + return (max + 1); +} + +/* + * Change to dir specified by fd or p->fts_accpath without getting + * tricked by someone changing the world out from underneath us. + * Assumes p->fts_dev and p->fts_ino are filled in. + */ +static int +fts_safe_changedir(FTS *sp, FTSENT *p, int fd, char *path) +{ + int ret, oerrno, newfd; + struct stat sb; + + newfd = fd; + if (ISSET(FTS_NOCHDIR)) + return (0); + if (fd < 0 && (newfd = open(path, O_RDONLY | O_CLOEXEC, 0)) < 0) + return (-1); + if (fstat(newfd, &sb)) { + ret = -1; + goto bail; + } + if (p->fts_dev != sb.st_dev || p->fts_ino != sb.st_ino) { + errno = ENOENT; /* disinformation */ + ret = -1; + goto bail; + } + ret = fchdir(newfd); +bail: + oerrno = errno; + if (fd < 0) + (void)close(newfd); + errno = oerrno; + return (ret); +} + +/* + * Check if the filesystem for "ent" has UFS-style links. + */ +static int +fts_ufslinks(FTS *sp, const FTSENT *ent) +{ + struct _fts_private *priv; +#ifndef __HAIKU__ + const char **cpp; +#endif + + priv = (struct _fts_private *)sp; + /* + * If this node's device is different from the previous, grab + * the filesystem information, and decide on the reliability + * of the link information from this filesystem for stat(2) + * avoidance. + */ + if (priv->ftsp_dev != ent->fts_dev) { +#ifndef __HAIKU__ + if (statfs(ent->fts_path, &priv->ftsp_statfs) != -1) { + priv->ftsp_dev = ent->fts_dev; + priv->ftsp_linksreliable = 0; + for (cpp = ufslike_filesystems; *cpp; cpp++) { + if (strcmp(priv->ftsp_statfs.f_fstypename, + *cpp) == 0) { + priv->ftsp_linksreliable = 1; + break; + } + } + } else { + priv->ftsp_linksreliable = 0; + } +#else + priv->ftsp_linksreliable = 0; +#endif + } + return (priv->ftsp_linksreliable); +} diff --git a/src/system/libroot/posix/ftw.c b/src/system/libroot/posix/ftw.c new file mode 100644 index 0000000000..67ff8c20e1 --- /dev/null +++ b/src/system/libroot/posix/ftw.c @@ -0,0 +1,91 @@ +/* $OpenBSD: ftw.c,v 1.5 2005/08/08 08:05:34 espie Exp $ */ + +/* + * Copyright (c) 2003, 2004 Todd C. Miller + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Sponsored in part by the Defense Advanced Research Projects + * Agency (DARPA) and Air Force Research Laboratory, Air Force + * Materiel Command, USAF, under agreement number F39502-99-1-0512. + */ + +#include +// __FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include + +int +ftw(const char *path, int (*fn)(const char *, const struct stat *, int), + int nfds) +{ + char * const paths[2] = { (char *)path, NULL }; + FTSENT *cur; + FTS *ftsp; + int error = 0, fnflag, sverrno; + + /* XXX - nfds is currently unused */ + if (nfds < 1) { + errno = EINVAL; + return (-1); + } + + ftsp = fts_open(paths, FTS_LOGICAL | FTS_COMFOLLOW | FTS_NOCHDIR, NULL); + if (ftsp == NULL) + return (-1); + while ((cur = fts_read(ftsp)) != NULL) { + switch (cur->fts_info) { + case FTS_D: + fnflag = FTW_D; + break; + case FTS_DNR: + fnflag = FTW_DNR; + break; + case FTS_DP: + /* we only visit in preorder */ + continue; + case FTS_F: + case FTS_DEFAULT: + fnflag = FTW_F; + break; + case FTS_NS: + case FTS_NSOK: + case FTS_SLNONE: + fnflag = FTW_NS; + break; + case FTS_SL: + fnflag = FTW_SL; + break; + case FTS_DC: + errno = ELOOP; + /* FALLTHROUGH */ + default: + error = -1; + goto done; + } + error = fn(cur->fts_path, cur->fts_statp, fnflag); + if (error != 0) + break; + } +done: + sverrno = errno; + if (fts_close(ftsp) != 0 && error == 0) + error = -1; + else + errno = sverrno; + return (error); +} diff --git a/src/system/libroot/posix/nftw.c b/src/system/libroot/posix/nftw.c new file mode 100644 index 0000000000..88e8c09074 --- /dev/null +++ b/src/system/libroot/posix/nftw.c @@ -0,0 +1,109 @@ +/* $OpenBSD: nftw.c,v 1.7 2006/03/31 19:41:44 millert Exp $ */ + +/* + * Copyright (c) 2003, 2004 Todd C. Miller + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Sponsored in part by the Defense Advanced Research Projects + * Agency (DARPA) and Air Force Research Laboratory, Air Force + * Materiel Command, USAF, under agreement number F39502-99-1-0512. + */ + +#include +//__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include + +int +nftw(const char *path, int (*fn)(const char *, const struct stat *, int, + struct FTW *), int nfds, int ftwflags) +{ + char * const paths[2] = { (char *)path, NULL }; + struct FTW ftw; + FTSENT *cur; + FTS *ftsp; + int error = 0, ftsflags, fnflag, postorder, sverrno; + + /* XXX - nfds is currently unused */ + if (nfds < 1) { + errno = EINVAL; + return (-1); + } + + ftsflags = FTS_COMFOLLOW; + if (!(ftwflags & FTW_CHDIR)) + ftsflags |= FTS_NOCHDIR; + if (ftwflags & FTW_MOUNT) + ftsflags |= FTS_XDEV; + if (ftwflags & FTW_PHYS) + ftsflags |= FTS_PHYSICAL; + else + ftsflags |= FTS_LOGICAL; + postorder = (ftwflags & FTW_DEPTH) != 0; + ftsp = fts_open(paths, ftsflags, NULL); + if (ftsp == NULL) + return (-1); + while ((cur = fts_read(ftsp)) != NULL) { + switch (cur->fts_info) { + case FTS_D: + if (postorder) + continue; + fnflag = FTW_D; + break; + case FTS_DC: + continue; + case FTS_DNR: + fnflag = FTW_DNR; + break; + case FTS_DP: + if (!postorder) + continue; + fnflag = FTW_DP; + break; + case FTS_F: + case FTS_DEFAULT: + fnflag = FTW_F; + break; + case FTS_NS: + case FTS_NSOK: + fnflag = FTW_NS; + break; + case FTS_SL: + fnflag = FTW_SL; + break; + case FTS_SLNONE: + fnflag = FTW_SLN; + break; + default: + error = -1; + goto done; + } + ftw.base = cur->fts_pathlen - cur->fts_namelen; + ftw.level = cur->fts_level; + error = fn(cur->fts_path, cur->fts_statp, fnflag, &ftw); + if (error != 0) + break; + } +done: + sverrno = errno; + if (fts_close(ftsp) != 0 && error == 0) + error = -1; + else + errno = sverrno; + return (error); +} diff --git a/src/tests/kits/game/chart/Chart.cpp b/src/tests/kits/game/chart/Chart.cpp index 0dad69f69f..5afa64849b 100644 --- a/src/tests/kits/game/chart/Chart.cpp +++ b/src/tests/kits/game/chart/Chart.cpp @@ -31,7 +31,7 @@ main() } -ChartApp::ChartApp() : BApplication("application/x-vnd.Be.ChartDemo") +ChartApp::ChartApp() : BApplication("application/x-vnd.Haiku-ChartDemo") { fWindow = new ChartWindow(BRect(120, 150, 965, 591), B_TRANSLATE_SYSTEM_NAME("Chart")); diff --git a/src/tests/kits/game/chart/Chart.rdef b/src/tests/kits/game/chart/Chart.rdef index 90f7ac6254..7834deb6de 100644 --- a/src/tests/kits/game/chart/Chart.rdef +++ b/src/tests/kits/game/chart/Chart.rdef @@ -1,5 +1,7 @@ -resource app_signature "application/x-vnd.Be.ChartDemo"; +resource app_signature "application/x-vnd.Haiku-ChartDemo"; + +resource app_name_catalog_entry "x-vnd.Haiku-ChartDemo:System name:Chart"; resource app_flags B_MULTIPLE_LAUNCH; diff --git a/src/tests/kits/game/chart/Jamfile b/src/tests/kits/game/chart/Jamfile index b05224afb0..50040512b6 100644 --- a/src/tests/kits/game/chart/Jamfile +++ b/src/tests/kits/game/chart/Jamfile @@ -13,7 +13,7 @@ Application Chart : ; DoCatalogs Chart : - x-vnd.Be.ChartDemo + x-vnd.Haiku-ChartDemo : Chart.cpp ChartWindow.cpp diff --git a/src/tests/servers/app/playground/Jamfile b/src/tests/servers/app/playground/Jamfile index 343845d4f9..327085ddec 100644 --- a/src/tests/servers/app/playground/Jamfile +++ b/src/tests/servers/app/playground/Jamfile @@ -11,7 +11,7 @@ Application Playground : ObjectView.cpp ObjectWindow.cpp States.cpp - : be $(TARGET_LIBSUPC++) + : be $(TARGET_LIBSUPC++) $(HAIKU_LOCALE_LIBS) : Playground.rdef ; @@ -20,3 +20,10 @@ if ( $(TARGET_PLATFORM) = libbe_test ) { : tests!apps ; } +DoCatalogs Playground : + application/x-vnd.Haiku-Playground + : + main.cpp + ObjectView.cpp + ObjectWindow.cpp +; diff --git a/src/tests/servers/app/playground/ObjectView.cpp b/src/tests/servers/app/playground/ObjectView.cpp index 497304ff5e..ffa736ce0b 100644 --- a/src/tests/servers/app/playground/ObjectView.cpp +++ b/src/tests/servers/app/playground/ObjectView.cpp @@ -4,6 +4,7 @@ #include #include +#include #include #include #include @@ -12,9 +13,12 @@ #include #include +#include "ObjectView.h" #include "States.h" -#include "ObjectView.h" +#undef B_TRANSLATION_CONTEXT +#define B_TRANSLATION_CONTEXT "Playground" + const unsigned char kMoveCursor[] = { 16, 1, 8, 8, 0x01, 0x80, 0x02, 0x40, 0x04, 0x20, 0x08, 0x10, @@ -157,7 +161,7 @@ ObjectView::Draw(BRect updateRect) SetDrawingMode(B_OP_OVER); SetHighColor(255, 0, 0, 128); - const char* message = "Click and drag to draw an object"; + const char* message = B_TRANSLATE("Click and drag to draw an object"); float width = StringWidth(message); BPoint p((r.Width() - width) / 2.0, r.Height() / 2.0); @@ -341,7 +345,7 @@ if (dragMessage) { helper->FillRect(r); helper->SetHighColor(0, 0, 0, 255); - const char* text = "Test"; + const char* text = B_TRANSLATE("Test"); float pos = (r.Width() - helper->StringWidth(text)) / 2; helper->DrawString(text, BPoint(pos, 25)); helper->Sync(); diff --git a/src/tests/servers/app/playground/ObjectWindow.cpp b/src/tests/servers/app/playground/ObjectWindow.cpp index 3b9129ba2d..0b6b9cc590 100644 --- a/src/tests/servers/app/playground/ObjectWindow.cpp +++ b/src/tests/servers/app/playground/ObjectWindow.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -28,10 +29,13 @@ #include #include "ObjectView.h" +#include "ObjectWindow.h" #include "States.h" //#include "StatusView.h" -#include "ObjectWindow.h" + +#undef B_TRANSLATION_CONTEXT +#define B_TRANSLATION_CONTEXT "Playground" enum { MSG_SET_OBJECT_TYPE = 'stot', @@ -126,12 +130,12 @@ ObjectWindow::ObjectWindow(BRect frame, const char* name) BMenuBar* menuBar = new BMenuBar(b, "menu bar"); AddChild(menuBar); - BMenu* menu = new BMenu("File"); + BMenu* menu = new BMenu(B_TRANSLATE("File")); menuBar->AddItem(menu); - menu->AddItem(new BMenu("Submenu")); + menu->AddItem(new BMenu(B_TRANSLATE("Submenu"))); - BMenuItem* menuItem = new BMenuItem("Quit", new BMessage(B_QUIT_REQUESTED), + BMenuItem* menuItem = new BMenuItem(B_TRANSLATE("Quit"), new BMessage(B_QUIT_REQUESTED), 'Q'); menu->AddItem(menuItem); @@ -170,7 +174,7 @@ ObjectWindow::ObjectWindow(BRect frame, const char* name) BBox* controlGroup = new BBox(b, "controls box", B_FOLLOW_LEFT | B_FOLLOW_TOP_BOTTOM, B_WILL_DRAW, B_FANCY_BORDER); - controlGroup->SetLabel("Controls"); + controlGroup->SetLabel(B_TRANSLATE("Controls")); bg->AddChild(controlGroup); b = controlGroup->Bounds(); @@ -180,14 +184,14 @@ ObjectWindow::ObjectWindow(BRect frame, const char* name) b.right = b.left + b.Width() / 2.0 - 5.0; // new button - fNewB = new BButton(b, "new button", "New Object", + fNewB = new BButton(b, "new button", B_TRANSLATE("New object"), new BMessage(MSG_NEW_OBJECT)); controlGroup->AddChild(fNewB); SetDefaultButton(fNewB); // clear button b.OffsetBy(0, fNewB->Bounds().Height() + 5.0); - fClearB = new BButton(b, "clear button", "Clear", new BMessage(MSG_CLEAR)); + fClearB = new BButton(b, "clear button", B_TRANSLATE("Clear"), new BMessage(MSG_CLEAR)); controlGroup->AddChild(fClearB); // object type radio buttons @@ -197,7 +201,7 @@ ObjectWindow::ObjectWindow(BRect frame, const char* name) b.OffsetBy(0, fClearB->Bounds().Height() + 5.0); message = new BMessage(MSG_SET_OBJECT_TYPE); message->AddInt32("type", OBJECT_LINE); - radioButton = new BRadioButton(b, "radio 1", "Line", message); + radioButton = new BRadioButton(b, "radio 1", B_TRANSLATE("Line"), message); controlGroup->AddChild(radioButton); radioButton->SetValue(B_CONTROL_ON); @@ -205,72 +209,72 @@ ObjectWindow::ObjectWindow(BRect frame, const char* name) b.OffsetBy(0, radioButton->Bounds().Height() + 5.0); message = new BMessage(MSG_SET_OBJECT_TYPE); message->AddInt32("type", OBJECT_RECT); - radioButton = new BRadioButton(b, "radio 2", "Rect", message); + radioButton = new BRadioButton(b, "radio 2", B_TRANSLATE("Rect"), message); controlGroup->AddChild(radioButton); b.OffsetBy(0, radioButton->Bounds().Height() + 5.0); message = new BMessage(MSG_SET_OBJECT_TYPE); message->AddInt32("type", OBJECT_ROUND_RECT); - radioButton = new BRadioButton(b, "radio 3", "Round Rect", message); + radioButton = new BRadioButton(b, "radio 3", B_TRANSLATE("Round rect"), message); controlGroup->AddChild(radioButton); b.OffsetBy(0, radioButton->Bounds().Height() + 5.0); message = new BMessage(MSG_SET_OBJECT_TYPE); message->AddInt32("type", OBJECT_ELLIPSE); - radioButton = new BRadioButton(b, "radio 4", "Ellipse", message); + radioButton = new BRadioButton(b, "radio 4", B_TRANSLATE("Ellipse"), message); controlGroup->AddChild(radioButton); // drawing mode - BPopUpMenu* popupMenu = new BPopUpMenu(""); + BPopUpMenu* popupMenu = new BPopUpMenu(B_TRANSLATE("")); message = new BMessage(MSG_SET_DRAWING_MODE); message->AddInt32("mode", B_OP_COPY); - popupMenu->AddItem(new BMenuItem("Copy", message)); + popupMenu->AddItem(new BMenuItem(B_TRANSLATE("Copy"), message)); message = new BMessage(MSG_SET_DRAWING_MODE); message->AddInt32("mode", B_OP_OVER); - popupMenu->AddItem(new BMenuItem("Over", message)); + popupMenu->AddItem(new BMenuItem(B_TRANSLATE("Over"), message)); message = new BMessage(MSG_SET_DRAWING_MODE); message->AddInt32("mode", B_OP_INVERT); - popupMenu->AddItem(new BMenuItem("Invert", message)); + popupMenu->AddItem(new BMenuItem(B_TRANSLATE("Invert"), message)); message = new BMessage(MSG_SET_DRAWING_MODE); message->AddInt32("mode", B_OP_BLEND); - popupMenu->AddItem(new BMenuItem("Blend", message)); + popupMenu->AddItem(new BMenuItem(B_TRANSLATE("Blend"), message)); message = new BMessage(MSG_SET_DRAWING_MODE); message->AddInt32("mode", B_OP_SELECT); - popupMenu->AddItem(new BMenuItem("Select", message)); + popupMenu->AddItem(new BMenuItem(B_TRANSLATE("Select"), message)); message = new BMessage(MSG_SET_DRAWING_MODE); message->AddInt32("mode", B_OP_ERASE); - popupMenu->AddItem(new BMenuItem("Erase", message)); + popupMenu->AddItem(new BMenuItem(B_TRANSLATE("Erase"), message)); message = new BMessage(MSG_SET_DRAWING_MODE); message->AddInt32("mode", B_OP_ADD); - popupMenu->AddItem(new BMenuItem("Add", message)); + popupMenu->AddItem(new BMenuItem(B_TRANSLATE("Add"), message)); message = new BMessage(MSG_SET_DRAWING_MODE); message->AddInt32("mode", B_OP_SUBTRACT); - popupMenu->AddItem(new BMenuItem("Subtract", message)); + popupMenu->AddItem(new BMenuItem(B_TRANSLATE("Subtract"), message)); message = new BMessage(MSG_SET_DRAWING_MODE); message->AddInt32("mode", B_OP_MIN); - popupMenu->AddItem(new BMenuItem("Min", message)); + popupMenu->AddItem(new BMenuItem(B_TRANSLATE("Min"), message)); message = new BMessage(MSG_SET_DRAWING_MODE); message->AddInt32("mode", B_OP_MAX); - popupMenu->AddItem(new BMenuItem("Max", message)); + popupMenu->AddItem(new BMenuItem(B_TRANSLATE("Max"), message)); message = new BMessage(MSG_SET_DRAWING_MODE); message->AddInt32("mode", B_OP_ALPHA); - BMenuItem* item = new BMenuItem("Alpha", message); + BMenuItem* item = new BMenuItem(B_TRANSLATE("Alpha"), message); item->SetMarked(true); popupMenu->AddItem(item); b.OffsetBy(0, radioButton->Bounds().Height() + 10.0); - fDrawingModeMF = new BMenuField(b, "drawing mode field", "Mode:", + fDrawingModeMF = new BMenuField(b, "drawing mode field", B_TRANSLATE("Mode:"), popupMenu); controlGroup->AddChild(fDrawingModeMF); @@ -286,7 +290,7 @@ ObjectWindow::ObjectWindow(BRect frame, const char* name) // alpha text control b.OffsetBy(0, fColorControl-> Bounds().Height() + 5.0); - fAlphaTC = new BTextControl(b, "alpha text control", "Alpha:", "", + fAlphaTC = new BTextControl(b, "alpha text control", B_TRANSLATE("Alpha:"), "", new BMessage(MSG_SET_COLOR)); controlGroup->AddChild(fAlphaTC); @@ -300,14 +304,14 @@ ObjectWindow::ObjectWindow(BRect frame, const char* name) // fill check box b.OffsetBy(0, fAlphaTC->Bounds().Height() + 5.0); - fFillCB = new BCheckBox(b, "fill check box", "Fill", + fFillCB = new BCheckBox(b, "fill check box", B_TRANSLATE("Fill"), new BMessage(MSG_SET_FILL_OR_STROKE)); controlGroup->AddChild(fFillCB); // pen size text control b.OffsetBy(0, radioButton->Bounds().Height() + 5.0); b.bottom = b.top + 10.0;//35; - fPenSizeS = new BSlider(b, "width slider", "Width:", NULL, 1, 100, + fPenSizeS = new BSlider(b, "width slider", B_TRANSLATE("Width:"), NULL, 1, 100, B_TRIANGLE_THUMB); fPenSizeS->SetLimitLabels("1", "100"); fPenSizeS->SetModificationMessage(new BMessage(MSG_SET_PEN_SIZE)); @@ -417,8 +421,9 @@ ObjectWindow::MessageReceived(BMessage* message) break; case MSG_CLEAR: { BAlert *alert = new BAlert("Playground", - "Do you really want to clear all drawing objects?", - "No", "Yes"); + B_TRANSLATE("Clear all drawing objects?"), + B_TRANSLATE("Cancel"), B_TRANSLATE("Clear")); + alert->SetShortcut(0, B_ESCAPE); if (alert->Go() == 1) { fObjectView->MakeEmpty(); fObjectLV->MakeEmpty(); diff --git a/src/tests/servers/app/playground/main.cpp b/src/tests/servers/app/playground/main.cpp index 56121230c5..6d2d0a29b9 100644 --- a/src/tests/servers/app/playground/main.cpp +++ b/src/tests/servers/app/playground/main.cpp @@ -2,10 +2,15 @@ #include #include +#include #include #include "ObjectWindow.h" +#undef B_TRANSLATION_CONTEXT +#define B_TRANSLATION_CONTEXT "Playground" + + // main int main(int argc, char** argv) @@ -13,7 +18,7 @@ main(int argc, char** argv) BApplication* app = new BApplication("application/x-vnd.Haiku-Playground"); BRect frame(50.0, 50.0, 600.0, 400.0); - BWindow* window = new ObjectWindow(frame, "Playground"); + BWindow* window = new ObjectWindow(frame, B_TRANSLATE_SYSTEM_NAME("Playground")); window->Show();