diff --git a/build/jam/ArchitectureRules b/build/jam/ArchitectureRules index 216ca71fb3..513b5fa5ee 100644 --- a/build/jam/ArchitectureRules +++ b/build/jam/ArchitectureRules @@ -38,6 +38,12 @@ rule ArchitectureSetup architecture gccBaseFlags += -Wno-array-bounds ; } + local cpu = $(HAIKU_CPU_$(architecture)) ; + if $(cpu) = arm { + # For stackcrawls + gccBaseFlags += -mapcs-frame ; + } + # activating graphite optimizations if $(HAIKU_USE_GCC_GRAPHITE_$(architecture)) = 1 { gccBaseFlags += -floop-interchange -ftree-loop-distribution @@ -67,7 +73,6 @@ rule ArchitectureSetup architecture Exit "HAIKU_STRIP_$(architecture) not set. Please re-run configure." ; } - local cpu = $(HAIKU_CPU_$(architecture)) ; HAIKU_ARCH_$(architecture) = $(cpu) ; HAIKU_ARCH ?= $(cpu) ; # Set only, if not set yet. This way HAIKU_ARCH is set to the primary diff --git a/build/jam/HaikuImage b/build/jam/HaikuImage new file mode 100644 index 0000000000..7f3624bfbd --- /dev/null +++ b/build/jam/HaikuImage @@ -0,0 +1,993 @@ +# This file defines what ends up on the Haiku image (respectively in the Haiku +# installation directory) and it executes the rules building the image +# (respectively installing the files in the installation directory). + + +SYSTEM_BIN = [ FFilterByBuildFeatures + "[" + addattr alert arp + base64 basename bash bc beep bfsinfo + cal cat catattr checkfs checkitout chgrp chmod chop chown chroot cksum clear + clockconfig cmp collectcatkeys comm compress copyattr CortexAddOnHost cp + csplit cut date dc dd desklink df diff diff3 dircolors dirname + diskimage draggers driveinfo dstcheck du dumpcatalog + echo eject env error expand expr + factor false fdinfo ffm filepanel find finddir FirstBootPrompt fmt fold + fortune frcode ftp ftpd funzip fwcontrol + gawk gdb@x86 getlimits groups gzip gzexe + hd head hey hostname + id ident ifconfig install installsound iroster isvolume + ideinfo@ide idestatus@ide + join kernel_debugger keymap keystore kill + less lessecho lesskey link linkcatkeys listarea listattr listimage listdev + listport listres listsem listusb ln locale locate logger login logname ls + lsindex + mail2mbox makebootable mbox2mail md5sum merge message mimeset mkdos mkdir + mkfifo mkfs mkindex mktemp modifiers mount mount_nfs mountvolume mv + netcat netstat nl nohup notify nproc + od open + passwd paste patch pathchk pc ping ping6 play playfile playsound playwav + pr prio printenv printf profile ps ptx pwd + query quit + rc readlink reindex release renice rlog rm rmattr rmindex rmdir roster + route + safemode screen_blanker screenmode screenshot sdiff setdecor setmime settype + setversion setvolume seq sha1sum shar shred shuf shutdown sleep sort + spamdbm split stat strace stty su sum sync sysinfo + tac tail tcpdump tcptester tee telnet telnetd test timeout top touch + tput tr traceroute translate trash true truncate tsort tty + uname unchop unexpand unmount uniq unlink unshar unzip unzipsfx + updatedb uptime urlwrapper useradd uudecode uuencode + vdir version vmstat + waitfor watch wc wget whoami writembr@x86 xargs xres + yes + zdiff zforce zgrep zip zipcloak zipgrep zipnote zipsplit zmore znew +] ; + +SYSTEM_APPS = [ FFilterByBuildFeatures + AboutSystem ActivityMonitor BootManager@x86 CDPlayer CharacterMap + CodyCam Debugger DeskCalc Devices DiskProbe DiskUsage DriveSetup + Expander GLInfo@x86 Icon-O-Matic Installer LaunchBox Magnify Mail + MediaConverter MediaPlayer MidiPlayer NetworkStatus PackageInstaller People + PoorMan PowerStatus ProcessController Screenshot ShowImage SoundRecorder + StyledEdit Terminal TextSearch TV WebWatch Workspaces +] ; +SYSTEM_PREFERENCES = [ FFilterByBuildFeatures + Appearance Backgrounds CPUFrequency DataTranslations + Deskbar E-mail FileTypes Keyboard Keymap Locale Media + Mouse Network Notifications Printers Screen ScreenSaver + Shortcuts Sounds Time Touchpad Tracker VirtualMemory +] ; +SYSTEM_DEMOS = [ FFilterByBuildFeatures + BSnow Chart Clock Cortex FontDemo GLTeapot@x86 + $(HAIKU_INCLUDE_TRADEMARKS)Haiku3d@x86 Mandelbrot OverlayImage PatchBay + Pairs Playground Pulse Sudoku +] ; +SYSTEM_LIBS = [ FFilterByBuildFeatures + libbe.so libbsd.so libbnetapi.so + libdebug.so libdevice.so + libgame.so libGL.so@x86 libglut.so@x86 + libgnu.so libmail.so libmedia.so libmidi.so libmidi2.so + libnetwork.so + libroot.so libroot-addon-icu.so + libscreensaver.so + libtextencoding.so libtiff.so libtracker.so libtranslation.so + $(HAIKU_SHARED_LIBSTDC++) $(HAIKU_SHARED_LIBSUPC++) +] ; +PRIVATE_SYSTEM_LIBS = [ FFilterByBuildFeatures + $(HAIKU_JPEG_CURRENT_LIB) + $(HAIKU_LIBPNG_CURRENT_LIB) + $(HAIKU_ZLIB_CURRENT_LIB) + $(HAIKU_FREETYPE_CURRENT_LIB) + libalm.so + libfluidsynth.so + libilmimf.so +] ; +SYSTEM_SERVERS = [ FFilterByBuildFeatures + app_server cddb_daemon debug_server input_server keystore_server mail_daemon + media_addon_server media_server midi_server mount_server net_server + notification_server power_daemon print_server print_addon_server registrar + syslog_daemon dns_resolver_server nfs4_idmapper_server +] ; + +SYSTEM_NETWORK_DEVICES = ethernet loopback ; +SYSTEM_NETWORK_DATALINK_PROTOCOLS = ethernet_frame arp loopback_frame + ipv6_datagram ; +#SYSTEM_NETWORK_PPP = ipcp modem pap pppoe ; +SYSTEM_NETWORK_PROTOCOLS = ipv4 tcp udp icmp unix icmp6 ipv6 ; + +SYSTEM_ADD_ONS_ACCELERANTS = [ FFilterByBuildFeatures + x86,x86_64 @{ + vesa.accelerant intel_extreme.accelerant + }@ # x86,x86_64 + x86 @{ + 3dfx.accelerant ati.accelerant matrox.accelerant neomagic.accelerant + nvidia.accelerant intel_810.accelerant + radeon.accelerant radeon_hd.accelerant s3.accelerant + #via.accelerant vmware.accelerant + }@ # x86 +] ; +SYSTEM_ADD_ONS_TRANSLATORS = BMPTranslator EXRTranslator GIFTranslator + HVIFTranslator ICOTranslator JPEGTranslator JPEG2000Translator + PCXTranslator PNGTranslator PPMTranslator + RAWTranslator RTFTranslator SGITranslator STXTTranslator TGATranslator + TIFFTranslator WebPTranslator WonderBrushTranslator ICNSTranslator +; +SYSTEM_ADD_ONS_LOCALE_CATALOGS = plaintext ; +SYSTEM_ADD_ONS_MEDIA = [ FFilterByBuildFeatures + cortex_audioadapter.media_addon + cortex_flanger.media_addon + dvb.media_addon@x86 + hmulti_audio.media_addon + mixer.media_addon + opensound.media_addon + tone_producer_demo.media_addon + usb_webcam.media_addon + video_producer_demo.media_addon + video_window_demo.media_addon + firewire_dv.media_addon@x86 + #legacy.media_addon + equalizer.media_addon + vst_host.media_addon +] ; +SYSTEM_ADD_ONS_MEDIA_PLUGINS = [ FFilterByBuildFeatures + ffmpeg@ffmpeg raw_decoder +] ; +SYSTEM_ADD_ONS_PRINT = + Canon\ LIPS3\ Compatible + Canon\ LIPS4\ Compatible + Gutenprint + PCL5\ Compatible + PCL6\ Compatible + PDF\ Writer + PS\ Compatible + Preview +; +SYSTEM_ADD_ONS_PRINT_TRANSPORT = HP\ JetDirect IPP LPR + # Parallel\ Port + Print\ To\ File Serial\ Port USB\ Port +; +SYSTEM_ADD_ONS_SCREENSAVERS = [ FFilterByBuildFeatures + Butterfly DebugNow Flurry@x86 + GLife@x86 $(HAIKU_INCLUDE_TRADEMARKS)Haiku Icons IFS Leaves + Message Spider Gravity@x86 +] ; +SYSTEM_ADD_ONS_DRIVERS_AUDIO = auich auvia echo3g emuxki hda ice1712 sis7018 ; +SYSTEM_ADD_ONS_DRIVERS_AUDIO_OLD = ; #cmedia usb_audio ; +SYSTEM_ADD_ONS_DRIVERS_GRAPHICS = [ FFilterByBuildFeatures + x86,x86_64 @{ + vesa intel_extreme + }@ # x86,x86_64 + x86 @{ + ati 3dfx intel_810 matrox neomagic nvidia radeon radeon_hd + s3 #via vmware + }@ # x86 +] ; +SYSTEM_ADD_ONS_DRIVERS_MIDI = emuxki ice1712 usb_midi ; +SYSTEM_ADD_ONS_DRIVERS_NET = [ FFilterByBuildFeatures + x86,x86_64 @{ + 3com atheros813x ar81xx attansic_l1 attansic_l2 broadcom440x + broadcom570x dec21xxx ipro100 ipro1000 jmicron2x0 marvell_yukon nforce + pcnet rtl8139 rtl81xx sis19x syskonnect via_rhine vt612x + }@ # x86_64 + + etherpci pegasus sis900 usb_davicom usb_asix usb_ecm wb840 + + # WLAN drivers + x86 @{ + aironetwifi atheroswifi broadcom43xx + iprowifi2100 iprowifi2200 iprowifi3945 + iprowifi4965 marvell88w8363 marvell88w8335 + ralinkwifi wavelanwifi + }@ # x86 + + # WWAN drivers + #usb_beceemwmx@gpl +] ; +SYSTEM_ADD_ONS_DRIVERS_POWER = [ FFilterByBuildFeatures acpi_button@x86 ] ; +SYSTEM_ADD_ONS_BUS_MANAGERS = [ FFilterByBuildFeatures + ata@ata pci ps2@x86,x86_64 isa@x86,x86_64 + ide@ide scsi config_manager agp_gart@x86,x86_64 usb firewire@x86 acpi@x86 + virtio random +] ; +SYSTEM_ADD_ONS_FILE_SYSTEMS = bfs btrfs cdda exfat ext2 fat iso9660 nfs nfs4 + attribute_overlay write_overlay ntfs reiserfs@x86 udf googlefs ; + +# wifi firmware +for driver in $(SYSTEM_ADD_ONS_DRIVERS_NET) { + local package = [ on $(driver) return $(HAIKU_WIFI_FIRMWARE_PACKAGE) ] ; + local archive = [ on $(driver) return $(HAIKU_WIFI_FIRMWARE_ARCHIVE) ] ; + local extract = [ on $(driver) return $(HAIKU_WIFI_FIRMWARE_DO_EXTRACT) ] ; + if $(archive) { + AddWifiFirmwareToHaikuImage $(driver) : $(package) : $(archive) + : $(extract) ; + } + local packages = [ on $(driver) return $(HAIKU_WIFI_FIRMWARE_PACKAGES) ] ; + local archives = [ on $(driver) return $(HAIKU_WIFI_FIRMWARE_ARCHIVES) ] ; + for archive in $(archives) { + AddWifiFirmwareToHaikuImage $(driver) : $(packages[1]) : $(archive) + : $(extract) ; + packages = $(packages[2-]) ; + } +} + + +# modules +AddFilesToHaikuImage system add-ons kernel bus_managers + : $(SYSTEM_ADD_ONS_BUS_MANAGERS) ; +AddFilesToHaikuImage system add-ons kernel busses agp_gart + : intel@x86,x86_64 ; + +if $(HAIKU_ATA_STACK) = 1 { + AddFilesToHaikuImage system add-ons kernel busses ata + : generic_ide_pci it8211 legacy_sata silicon_image_3112 ide_isa@x86 ; +} else { + AddFilesToHaikuImage system add-ons kernel busses ide + : generic_ide_pci it8211 legacy_sata silicon_image_3112 ide_isa@x86 ; +} + +AddFilesToHaikuImage system add-ons kernel busses random + : virtio_rng ; +AddFilesToHaikuImage system add-ons kernel busses scsi + : ahci virtio_scsi ; +AddFilesToHaikuImage system add-ons kernel busses usb + : uhci ohci ehci ; +AddFilesToHaikuImage system add-ons kernel busses virtio + : virtio_pci ; +AddFilesToHaikuImage system add-ons kernel console : vga_text ; +AddFilesToHaikuImage system add-ons kernel debugger + : demangle disasm@x86 hangman + invalidate_on_exit usb_keyboard qrencode + run_on_exit ; +AddFilesToHaikuImage system add-ons kernel file_systems + : $(SYSTEM_ADD_ONS_FILE_SYSTEMS) ; +AddFilesToHaikuImage system add-ons kernel generic + : ata_adapter@ata bios@x86,x86_64 dpc ide_adapter@ide + locked_pool mpu401 scsi_periph tty ; +AddFilesToHaikuImage system add-ons kernel partitioning_systems + : amiga_rdb apple efi_gpt intel session ; +AddFilesToHaikuImage system add-ons kernel interrupt_controllers + : openpic@ppc ; + +if $(TARGET_ARCH) = x86 || $(TARGET_ARCH) = x86_64 { + AddFilesToHaikuImage system add-ons kernel cpu : generic_x86 ; +} + +# drivers +AddNewDriversToHaikuImage disk scsi : scsi_cd scsi_disk ; +AddNewDriversToHaikuImage disk virtual : virtio_block ; +AddNewDriversToHaikuImage power : enhanced_speedstep@x86 ; +AddNewDriversToHaikuImage power : acpi_battery@x86 ; +#AddNewDriversToHaikuImage display : display_controls@x86 ; + +# legacy drivers +AddDriversToHaikuImage : console dprintf null + tty zero ; +AddDriversToHaikuImage audio hmulti : $(SYSTEM_ADD_ONS_DRIVERS_AUDIO) ; +AddDriversToHaikuImage audio old : $(SYSTEM_ADD_ONS_DRIVERS_AUDIO_OLD) ; +AddDriversToHaikuImage midi : $(SYSTEM_ADD_ONS_DRIVERS_MIDI) ; +AddDriversToHaikuImage bus : usb_raw fw_raw@x86 ; +AddDriversToHaikuImage disk floppy : pc_floppy@x86 ; +AddDriversToHaikuImage disk usb : usb_disk ; +AddDriversToHaikuImage disk usb : usb_floppy ; +AddDriversToHaikuImage printer usb : usb_printer ; +AddDriversToHaikuImage disk virtual : nbd ; +AddDriversToHaikuImage dvb : cx23882 ; +AddDriversToHaikuImage graphics : $(SYSTEM_ADD_ONS_DRIVERS_GRAPHICS) ; +AddDriversToHaikuImage input : ps2_hid usb_hid wacom ; +AddDriversToHaikuImage misc : poke mem ; +AddDriversToHaikuImage net : $(SYSTEM_ADD_ONS_DRIVERS_NET) ; +AddDriversToHaikuImage ports : usb_serial ; +AddDriversToHaikuImage power : $(SYSTEM_ADD_ONS_DRIVERS_POWER) ; + +# kernel +AddFilesToHaikuImage system : kernel_$(TARGET_ARCH) ; + +# libs +AddLibrariesToHaikuHybridImage system lib + : $(SYSTEM_LIBS) $(PRIVATE_SYSTEM_LIBS) ; + +# libnetwork.so replaces quite a few libraries +SYSTEM_LIBS_LIBNETWORK_ALIASES + = libsocket.so libbind.so libnet.so ; + +if $(HAIKU_GCC_VERSION[1]) = 2 { + local lib ; + for lib in $(SYSTEM_LIBS_LIBNETWORK_ALIASES) { + AddSymlinkToHaikuHybridImage system lib : libnetwork.so : $(lib) + : : true ; + } + + AddSymlinkToHaikuHybridImage system lib : libbnetapi.so : libnetapi.so + : : true ; +} + + +# libGL.so has GLU (like BeOS) built-in +SYSTEM_LIBS_LIBGL_ALIASES = libGLU.so ; + +if $(TARGET_ARCH) = x86 { + local lib ; + for lib in $(SYSTEM_LIBS_LIBGL_ALIASES) { + AddSymlinkToHaikuHybridImage system lib : libGL.so : $(lib) : : true ; + } +} + + +SYSTEM_LIBS_ALIASES = + $(SYSTEM_LIBS_LIBNETWORK_ALIASES) + libnetapi.so + $(SYSTEM_LIBS_LIBGL_ALIASES) +; + +OPTIONAL_LIBS_ALIASES = + libfreetype.so + libjpeg.so + libpng.so + libz.so +; + +# libfreetype.so links to the current freetype lib +AddSymlinkToHaikuHybridImage system lib : $(HAIKU_FREETYPE_CURRENT_LIB:BS) + : $(HAIKU_FREETYPE_CURRENT_LINK) : : true ; +AddSymlinkToHaikuHybridImage system lib : $(HAIKU_FREETYPE_CURRENT_LINK) + : libfreetype.so : : true ; + +# libpng.so links to the current libpng +AddSymlinkToHaikuHybridImage system lib : $(HAIKU_LIBPNG_CURRENT_LIB:BS) + : $(HAIKU_LIBPNG_CURRENT_LINK) : : true ; +AddSymlinkToHaikuHybridImage system lib : $(HAIKU_LIBPNG_CURRENT_LINK) + : libpng.so : : true ; + +# libjpeg.so links to the current libjpeg +AddSymlinkToHaikuHybridImage system lib : $(HAIKU_JPEG_CURRENT_LIB:BS) + : $(HAIKU_JPEG_CURRENT_LINK) : : true ; +AddSymlinkToHaikuHybridImage system lib : $(HAIKU_JPEG_CURRENT_LINK) + : libjpeg.so : : true ; + +# zlib.so links to the current zlib +AddSymlinkToHaikuHybridImage system lib : $(HAIKU_ZLIB_CURRENT_LIB:BS) + : $(HAIKU_ZLIB_CURRENT_LINK) : : true ; +AddSymlinkToHaikuHybridImage system lib : $(HAIKU_ZLIB_CURRENT_LINK) + : libz.so : : true ; + +# servers +AddFilesToHaikuImage system servers : $(SYSTEM_SERVERS) ; + +# apps +AddFilesToHaikuImage system : runtime_loader Deskbar Tracker ; +AddFilesToHaikuImage system bin : $(SYSTEM_BIN) consoled ; +AddFilesToHaikuImage system apps : $(SYSTEM_APPS) ; +AddFilesToHaikuImage system preferences : $(SYSTEM_PREFERENCES) ; +AddFilesToHaikuImage system demos : $(SYSTEM_DEMOS) ; + +SEARCH on which = [ FDirName $(HAIKU_TOP) data bin ] ; +AddFilesToHaikuImage system bin : which ; +SEARCH on installoptionalpackage = [ FDirName $(HAIKU_TOP) data bin ] ; +AddFilesToHaikuImage system bin : installoptionalpackage ; +SEARCH on install-wifi-firmwares.sh = [ FDirName $(HAIKU_TOP) data bin ] ; +AddFilesToHaikuImage system bin : install-wifi-firmwares.sh ; +SEARCH on welcome = [ FDirName $(HAIKU_TOP) data bin ] ; +AddFilesToHaikuImage system bin : welcome ; +AddSymlinkToHaikuImage home Desktop + : /boot/system/bin/welcome : Welcome ; +SEARCH on userguide = [ FDirName $(HAIKU_TOP) data bin ] ; +AddFilesToHaikuImage system bin : userguide ; +AddSymlinkToHaikuImage home Desktop + : /boot/system/bin/userguide : User\ Guide ; + +# Add the files to be used by installoptionalpackage. +AddDirectoryToHaikuImage common data optional-packages ; +local optional-pkg-files = BuildFeatures OptionalPackageDependencies + OptionalPackages OptionalLibPackages ; +for name in $(optional-pkg-files) { + local file = [ FDirName $(HAIKU_TOP) build jam $(name) ] ; + AddFilesToHaikuImage common data optional-packages : $(file) ; +} +AddInstalledPackagesFileToHaikuImage ; + +AddSymlinkToHaikuImage system bin : bash : sh ; +AddSymlinkToHaikuImage system bin : trash : untrash ; + +AddSymlinkToHaikuImage home Desktop : /boot/home : Home ; + +# Mailbox folders and symlink +AddDirectoryToHaikuImage home mail draft ; +AddDirectoryToHaikuImage home mail in ; +AddDirectoryToHaikuImage home mail out ; + +AddSymlinkToHaikuImage home config : settings/deskbar : be ; +# Deskbar Application links +AddDirectoryToHaikuImage home config settings deskbar Applications ; +DESKBAR_APPLICATIONS = ActivityMonitor CharacterMap CodyCam CDPlayer DeskCalc + Devices DiskProbe DriveSetup DiskUsage Expander Icon-O-Matic Installer + Magnify Mail MediaConverter MediaPlayer MidiPlayer People PoorMan + Screenshot SoundRecorder StyledEdit Terminal TV +; +local linkTarget ; +for linkTarget in $(DESKBAR_APPLICATIONS) { + AddSymlinkToHaikuImage home config settings deskbar Applications + : /boot/system/apps/$(linkTarget) : $(linkTarget) ; +} + +# Deskbar Desktop applets links +AddDirectoryToHaikuImage home config settings deskbar Desktop\ applets ; +DESKBAR_DESKTOP_APPLETS = LaunchBox NetworkStatus PowerStatus ProcessController + Workspaces +; +for linkTarget in $(DESKBAR_DESKTOP_APPLETS) { + AddSymlinkToHaikuImage home config settings deskbar Desktop\ applets + : /boot/system/apps/$(linkTarget) : $(linkTarget) ; +} + +# Deskbar Preferences links +AddDirectoryToHaikuImage home config settings deskbar Preferences ; +DESKBAR_PREFERENCES = $(SYSTEM_PREFERENCES:B) ; +for linkTarget in $(DESKBAR_PREFERENCES) { + AddSymlinkToHaikuImage home config settings deskbar Preferences + : /boot/system/preferences/$(linkTarget) + : $(linkTarget) ; +} + +# Deskbar Demo links +AddDirectoryToHaikuImage home config settings deskbar Demos ; +for linkTarget in $(SYSTEM_DEMOS) { + AddSymlinkToHaikuImage home config settings deskbar Demos + : /boot/system/demos/$(linkTarget) : $(linkTarget) ; +} + +AddSymlinkToHaikuImage system bin : less : more ; +AddSymlinkToHaikuImage system bin : gzip : gunzip ; +AddSymlinkToHaikuImage system bin : gzip : zcat ; +AddSymlinkToHaikuImage system bin : zdiff : zcmp ; +AddSymlinkToHaikuImage system bin : unzip : zipinfo ; +AddSymlinkToHaikuImage system bin : gawk : awk ; + + +# scripts and data files +local bootScripts = Bootscript Bootscript.cd SetupEnvironment Netscript + InstallerInitScript InstallerFinishScript ; +SEARCH on $(bootScripts) = [ FDirName $(HAIKU_TOP) data system boot ] ; +AddFilesToHaikuImage system boot : $(bootScripts) ; + +local userBootScripts = UserBootscript UserSetupEnvironment.sample ; +SEARCH on $(userBootScripts) = [ FDirName $(HAIKU_TOP) data config boot ] ; +AddFilesToHaikuImage home config boot : $(userBootScripts) ; + +# Add boot launch directory +AddDirectoryToHaikuImage home config boot launch ; + +local logoArtwork = + $(HAIKU_INCLUDE_TRADEMARKS)"HAIKU logo - white on blue - big.png" + $(HAIKU_INCLUDE_TRADEMARKS)"HAIKU logo - white on blue - normal.png" ; +SEARCH on $(logoArtwork) = [ FDirName $(HAIKU_TOP) data artwork ] ; +AddFilesToHaikuImage system data artwork : $(logoArtwork) ; + +AddDirectoryToHaikuImage system data sounds ; + +# Add mail provider infos. +AddFilesToHaikuImage home config settings Mail ProviderInfo : + $(HAIKU_PROVIDER_INFOS) ; + +# Mail spell check dictionaries +local spellFiles = words geekspeak ; +spellFiles = $(spellFiles:G=spell) ; +SEARCH on $(spellFiles) + = [ FDirName $(HAIKU_TOP) src apps mail ] ; +AddFilesToHaikuImage system data spell_check word_dictionary : $(spellFiles) ; + +local etcDir = [ FDirName $(HAIKU_TOP) data etc ] ; +local etcFiles = inputrc profile ; +etcFiles = $(etcFiles:G=etc) ; +SEARCH on $(etcFiles) = [ FDirName $(etcDir) ] ; +etcFiles += termcap sysless sysless.in ; +AddFilesToHaikuImage common etc : $(etcFiles) ; + +local profileFiles = [ Glob $(etcDir)/profile.d : *.sh ] ; +profileFiles = $(profileFiles:G=profile-d) ; +AddDirectoryToHaikuImage common etc profile.d ; +AddFilesToHaikuImage common etc profile.d : $(profileFiles) ; + +#local bashCompletionFiles = [ Glob $(etcDir)/bash_completion.d : * ] ; +#local bashCompletionHelperFiles +# = [ Glob $(etcDir)/bash_completion.d/helpers : * ] ; +#bashCompletionFiles = $(bashCompletionFiles:G=bash-completion) ; +#bashCompletionHelperFiles = $(bashCompletionHelperFiles:G=bash-completion-hlp) ; +#AddDirectoryToHaikuImage common etc bash_completion.d ; +#AddDirectoryToHaikuImage common etc bash_completion.d helpers ; +#AddFilesToHaikuImage common etc bash_completion.d : $(bashCompletionFiles) ; +#AddFilesToHaikuImage common etc bash_completion.d helpers +# : $(bashCompletionHelperFiles) ; + +local fortuneFiles = [ Glob $(HAIKU_TOP)/data/system/data/fortunes + : [a-zA-Z0-9]* ] ; +fortuneFiles = $(fortuneFiles:G=data!fortunes) ; +AddFilesToHaikuImage system data fortunes : $(fortuneFiles) ; + +local fontDir = [ FDirName $(HAIKU_TOP) data system data fonts ] ; +local psFonts = [ Glob $(fontDir)/psfonts : *.afm *.pfb ] ; +local ttFonts = [ Glob $(fontDir)/ttfonts : *.ttf ] ; +AddFilesToHaikuImage system data fonts psfonts : $(psFonts) ; +AddFilesToHaikuImage system data fonts ttfonts : $(ttFonts) ; + +local cannaDir = [ FDirName $(HAIKU_TOP) data system data Canna ] ; +local cannaDefault = [ Glob $(cannaDir)/default : *.canna *.gz ] ; +local cannaDic = [ Glob $(cannaDir)/dic : *.cbp ] ; +local cannaDicCanna = [ Glob $(cannaDir)/dic/canna + : *.cld *.ctd *.cbd *.dir ] ; +AddFilesToHaikuImage system data Canna default : $(cannaDefault) ; +AddFilesToHaikuImage system data Canna dic : $(cannaDic) ; +AddFilesToHaikuImage system data Canna dic canna : $(cannaDicCanna) ; +AddDirectoryToHaikuImage system data Canna dic group ; +AddDirectoryToHaikuImage system data Canna dic user ; + +local keymapFiles = [ Glob [ FDirName $(HAIKU_TOP) src data keymaps ] + : *.keymap ] ; +keymapFiles = $(keymapFiles:BG=keymap) ; +AddFilesToHaikuImage system data Keymaps : $(keymapFiles) ; +AddSymlinkToHaikuImage system data Keymaps : Swedish : Finnish ; +AddSymlinkToHaikuImage system data Keymaps : Slovene : Croatian ; +AddSymlinkToHaikuImage system data Keymaps : US-International : Brazilian ; + +# Copy keyboard layout files to the image one-by-one. +local keyboardLayoutsDir + = [ FDirName $(HAIKU_TOP) data system data KeyboardLayouts ] ; +local keyboardLayoutFiles = + "Generic 104-key" + "Generic 105-key International" + "Kinesis Advantage" + "Kinesis Ergo Elan International" + "TypeMatrix 2030" ; +keyboardLayoutFiles = $(keyboardLayoutFiles:G=keyboard-layout) ; +SEARCH on $(keyboardLayoutFiles) = $(keyboardLayoutsDir) ; +AddFilesToHaikuImage system data KeyboardLayouts + : $(keyboardLayoutFiles) ; + +# Add Apple Aluminum keyboard layout files to the image in an Apple Aluminum +# subdirectory. The subdirectory is turned into a submenu in the Layout menu +# of the Keymap preference app. +local appleAluminumDir + = [ FDirName $(HAIKU_TOP) data system data KeyboardLayouts + Apple\ Aluminum ] ; +local appleAluminumFiles = + "Apple Aluminium Extended International" + "Apple Aluminium International" + "Apple Aluminum (US)" + "Apple Aluminum Extended (US)" ; +appleAluminumFiles = $(appleAluminumFiles:G=keyboard-layout) ; +SEARCH on $(appleAluminumFiles) = $(appleAluminumDir) ; +AddFilesToHaikuImage system data KeyboardLayouts Apple\ Aluminum + : $(appleAluminumFiles) ; + +# Add ThinkPad keyboard layout files to the image in a ThinkPad +# subdirectory. The subdirectory is turned into a submenu in the Layout menu +# of the Keymap preference app. +local thinkpadDir + = [ FDirName $(HAIKU_TOP) data system data KeyboardLayouts ThinkPad ] ; +local thinkPadFiles = + "ThinkPad (US)" + "ThinkPad International" + "ThinkPad T400s (US)" + "ThinkPad T400s International" + "ThinkPad X1 (US)" + "ThinkPad X1 International" + "ThinkPad X100e (US)" + "ThinkPad X100e International" ; +thinkPadFiles = $(thinkPadFiles:G=keyboard-layout) ; +SEARCH on $(thinkPadFiles) = $(thinkpadDir) ; +AddFilesToHaikuImage system data KeyboardLayouts ThinkPad + : $(thinkPadFiles) ; + +local driverSettingsFiles = kernel ; +SEARCH on $(driverSettingsFiles) + = [ FDirName $(HAIKU_TOP) data settings kernel drivers ] ; +AddFilesToHaikuImage home config settings kernel drivers + : $(driverSettingsFiles) ; + +local networkSettingsFiles = services ; +SEARCH on $(networkSettingsFiles) + = [ FDirName $(HAIKU_TOP) data settings network ] ; +AddFilesToHaikuImage common settings network : $(networkSettingsFiles) ; + +# post install scripts and fresh install indicator file +local postInstallFiles = add_catalog_entry_attributes.sh + default_deskbar_items.sh mime_update.sh ; +postInstallFiles = $(postInstallFiles:G=post-install) ; +SEARCH on $(postInstallFiles) + = [ FDirName $(HAIKU_TOP) data common boot post_install ] ; +SEARCH on fresh_install + = [ FDirName $(HAIKU_TOP) data common settings ] ; +AddFilesToHaikuImage common boot post_install : $(postInstallFiles) ; +AddFilesToHaikuImage common settings : fresh_install ; + +# boot loader +AddFilesToHaikuImage system : haiku_loader ; + +# boot module links +AddBootModuleSymlinksToHaikuImage + acpi@x86 ata@ata pci isa@x86 config_manager dpc + ide@ide scsi usb + openpic@ppc + ata_adapter@ata ide_adapter@ide locked_pool scsi_periph + ahci generic_ide_pci it8211 legacy_sata silicon_image_3112 + ide_isa@x86 + uhci ohci ehci + scsi_cd scsi_disk usb_disk + virtio virtio_pci virtio_block virtio_scsi + efi_gpt + intel + bfs +; + +# add-ons +AddFilesToHaikuImage system add-ons accelerants + : $(SYSTEM_ADD_ONS_ACCELERANTS) ; + +# OpenGL renderers +if $(TARGET_ARCH) = x86 { + if $(HAIKU_GCC_VERSION[1]) = 2 { + AddFilesToHaikuHybridImage system add-ons opengl + : Legacy\ Software\ Rasterizer : : true ; + } else { + AddFilesToHaikuHybridImage system add-ons opengl + : Software\ Rasterizer : : true ; + # Future Gallium3d + } +} + +AddFilesToHaikuHybridImage system add-ons Translators + : $(SYSTEM_ADD_ONS_TRANSLATORS) : : true ; +AddFilesToHaikuImage system add-ons locale catalogs + : $(SYSTEM_ADD_ONS_LOCALE_CATALOGS) ; +AddFilesToHaikuHybridImage system add-ons locale catalogs + : $(SYSTEM_ADD_ONS_LOCALE_CATALOGS) : : true ; +AddFilesToHaikuImage system add-ons mail_daemon inbound_protocols : POP3 IMAP ; +AddFilesToHaikuImage system add-ons mail_daemon outbound_protocols : SMTP ; +AddFilesToHaikuImage system add-ons mail_daemon inbound_filters + : MatchHeader SpamFilter NewMailNotification ; +AddFilesToHaikuImage system add-ons mail_daemon outbound_filters : Fortune ; +AddFilesToHaikuImage system add-ons media : $(SYSTEM_ADD_ONS_MEDIA) ; +AddFilesToHaikuImage system add-ons media plugins + : $(SYSTEM_ADD_ONS_MEDIA_PLUGINS) ; +AddFilesToHaikuImage system add-ons Tracker + : FileType Mark\ as… Mark\ as\ Read Open\ Target\ Folder + Open\ Terminal ZipOMatic ; +AddSymlinkToHaikuImage system add-ons Tracker + : /boot/system/preferences/Backgrounds : Background ; +AddSymlinkToHaikuImage system add-ons Tracker + : /boot/system/apps/TextSearch : TextSearch ; +AddSymlinkToHaikuImage system add-ons Tracker + : /boot/system/apps/DiskUsage : DiskUsage ; +AddFilesToHaikuImage system add-ons input_server devices + : keyboard mouse tablet wacom ; +AddFilesToHaikuImage system add-ons input_server filters + : screen_saver shortcut_catcher ; +AddFilesToHaikuImage system add-ons kernel network + : notifications stack ; +AddFilesToHaikuImage system add-ons kernel network : dns_resolver ; +AddFilesToHaikuImage system add-ons kernel network devices + : $(SYSTEM_NETWORK_DEVICES) ; +AddFilesToHaikuImage system add-ons kernel network datalink_protocols + : $(SYSTEM_NETWORK_DATALINK_PROTOCOLS) ; +AddFilesToHaikuImage system add-ons kernel network ppp + : $(SYSTEM_NETWORK_PPP) ; +AddFilesToHaikuImage system add-ons kernel network protocols + : $(SYSTEM_NETWORK_PROTOCOLS) ; +AddFilesToHaikuImage system add-ons Print : $(SYSTEM_ADD_ONS_PRINT) ; +AddFilesToHaikuImage system add-ons Print transport + : $(SYSTEM_ADD_ONS_PRINT_TRANSPORT) ; +AddFilesToHaikuImage system add-ons Screen\ Savers + : $(SYSTEM_ADD_ONS_SCREENSAVERS) ; + +AddFilesToHaikuImage system add-ons disk_systems + : intel gpt bfs ntfs ; + +# decorators +AddDirectoryToHaikuImage home config add-ons decorators ; +#AddFilesToHaikuImage home config add-ons decorators : ; + +# create directories that will remain empty +AddDirectoryToHaikuImage common bin ; +AddDirectoryToHaikuImage common include ; +AddDirectoryToHaikuImage common lib ; +AddDirectoryToHaikuImage home Desktop ; +AddDirectoryToHaikuImage home config bin ; +AddDirectoryToHaikuImage home config lib ; +AddDirectoryToHaikuImage home mail ; +AddDirectoryToHaikuImage common var empty ; +AddDirectoryToHaikuImage common var log ; +AddDirectoryToHaikuImage common cache tmp ; + +AddDirectoryToHaikuImage home config add-ons kernel drivers bin ; +AddDirectoryToHaikuImage home config add-ons kernel drivers dev ; +AddDirectoryToHaikuImage home config add-ons input_server devices ; +AddDirectoryToHaikuImage home config add-ons input_server filters ; +AddDirectoryToHaikuImage home config add-ons input_server methods ; +AddDirectoryToHaikuImage home config add-ons media plugins ; +AddDirectoryToHaikuImage home config add-ons Tracker ; +AddDirectoryToHaikuImage home config add-ons Print ; +AddDirectoryToHaikuImage home config add-ons Screen\ Savers ; +AddDirectoryToHaikuImage home config add-ons Translators ; +AddDirectoryToHaikuImage system data synth ; +AddDirectoryToHaikuImage system add-ons input_server methods ; + +# optional +AddFilesToHaikuImage optional system add-ons input_server methods : canna ; + +# printers +AddDirectoryToHaikuImage home config settings printers Preview + : home-config-settings-printers-preview.rdef ; +AddDirectoryToHaikuImage home config settings printers "Save as PDF" + : home-config-settings-printers-save-as-pdf.rdef ; + +# PDF Writer enconding files +CopyDirectoryToHaikuImage system data + : [ FDirName $(HAIKU_TOP) src add-ons print drivers pdf encoding ] + : "PDF Writer" : -x Jamfile ; + +# Gutenprint data files +CopyDirectoryToHaikuImage system data + : [ FDirName $(HAIKU_TOP) src libs print libgutenprint src xml ] + : gutenprint : -x *.c -x Makefile.am -x Makefile.in ; + +# dvb channel settings +CopyDirectoryToHaikuImage home config settings Media + : [ FDirName $(HAIKU_TOP) data settings media dvb ] + : dvb : -x Jamfile ; + +# licenses +CopyDirectoryToHaikuImage system data + : [ FDirName $(HAIKU_TOP) data system data licenses ] + : licenses ; + +# Copy documentation as per DiskUsage's license requirement. +CopyDirectoryToHaikuImage system documentation + : [ FDirName $(HAIKU_TOP) docs apps diskusage ] + : diskusage ; + +# Copy documentation as per PDFlib Lite's license requirement. +CopyDirectoryToHaikuImage system documentation + : [ FDirName $(HAIKU_TOP) src libs pdflib doc ] + : pdflib ; + +# Copy sample programs as per PDFlib Lite's license requirement. +CopyDirectoryToHaikuImage develop sample-code + : [ FDirName $(HAIKU_TOP) src libs pdflib bind pdflib ] + : pdflib ; + +# 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 + + +HAIKU_IMAGE_OPTIONAL_PACKAGE_DESCRIPTIONS = ; + +include [ FDirName $(HAIKU_BUILD_RULES_DIR) OptionalPackages ] ; +include [ FDirName $(HAIKU_BUILD_RULES_DIR) OptionalTestPackages ] ; +include [ FDirName $(HAIKU_BUILD_RULES_DIR) OptionalLibPackages ] ; + +local optionalPackageDescriptions ; +if $(HAIKU_IMAGE_OPTIONAL_PACKAGE_DESCRIPTIONS) { + optionalPackageDescriptions = optional_package_descriptions ; + MakeLocate $(optionalPackageDescriptions) + : $(HAIKU_COMMON_PLATFORM_OBJECT_DIR) ; + + Depends $(optionalPackageDescriptions) + : $(HAIKU_IMAGE_OPTIONAL_PACKAGE_DESCRIPTIONS) ; + + actions together BuildOptionalPackageDescriptions + { + cat $(2) > $(1) + } + + BuildOptionalPackageDescriptions $(optionalPackageDescriptions) + : $(HAIKU_IMAGE_OPTIONAL_PACKAGE_DESCRIPTIONS) ; +} + + +#pragma mark - Alternative GCC Libraries + + +# We build a zip archive containing the libraries built with the alternative +# GCC and unzip onto our image. Building the archive is done by a sub-jam. +include [ FDirName $(HAIKU_BUILD_RULES_DIR) AlternativeGCCArchive ] ; + +if $(HAIKU_ADD_ALTERNATIVE_GCC_LIBS) = 1 + && $(HAIKU_ALTERNATIVE_GCC_OUTPUT_DIR) { + # let another jam build a zip with the system libraries + rule InvokeSubJam target : directory : jamLine + { + DIRECTORY on $(target) = $(directory) ; + COMMAND_LINE on $(target) = $(jamLine) ; + local optionalPackages = $(HAIKU_ADDED_OPTIONAL_PACKAGES:J=/) ; + OPTIONAL_PACKAGES on $(target) = $(optionalPackages:E="") ; + Always $(target) ; + InvokeSubJam1 $(target) ; + } + + actions InvokeSubJam1 + { + cd $(DIRECTORY) + export HAIKU_IGNORE_USER_BUILD_CONFIG=1 + export HAIKU_ADD_OPTIONAL_PACKAGES=$(OPTIONAL_PACKAGES) + export HAIKU_PRIMARY_GCC=$(HAIKU_GCC_VERSION[1]) + # NOTE: depending on when InvokeSubJam is called, you may end up with + # 2 * n - 1 jobs in total. + $(JAM:E=jam) -q -j$(JAMJOBS) $(COMMAND_LINE) ; + } + + local otherAlternativeSystemLibsZip + = alternative_system_libs.zip ; + MakeLocate $(otherAlternativeSystemLibsZip) + : $(HAIKU_ALTERNATIVE_GCC_OUTPUT_DIR) ; + + InvokeSubJam $(otherAlternativeSystemLibsZip) + : $(HAIKU_ALTERNATIVE_GCC_OUTPUT_DIR) + : "haiku-alternative-gcc-archive" ; + + # install the alternative libs in the right directory + ExtractArchiveToHaikuImage : $(otherAlternativeSystemLibsZip) ; +} + + +#pragma mark - User/Group Setup + + +# add the root user and the root and users groups +AddUserToHaikuImage $(HAIKU_ROOT_USER_NAME:E=baron) : 0 : 0 : /boot/home + : /bin/bash : $(HAIKU_ROOT_USER_REAL_NAME:E="Root User") ; +AddGroupToHaikuImage root : 0 : ; +AddGroupToHaikuImage users : 100 : ; + + +#pragma mark - Host Name + + +if $(HAIKU_IMAGE_HOST_NAME) { + actions BuildHaikuImageHostnameFile + { + echo "$(HAIKU_IMAGE_HOST_NAME)" > $(1) + } + + local file = hostname ; + Always $(file) ; + MakeLocate $(file) : $(HAIKU_COMMON_PLATFORM_OBJECT_DIR) ; + BuildHaikuImageHostnameFile $(file) ; + AddFilesToHaikuImage common settings network : $(file) ; +} + + +#pragma mark - Build The Image + + +# Execute pre-image user config rules. +UserBuildConfigRulePreImage ; + +# Set image name and directory defaults and locate the image. +HAIKU_IMAGE_NAME ?= $(HAIKU_DEFAULT_IMAGE_NAME) ; +HAIKU_IMAGE_DIR ?= $(HAIKU_DEFAULT_IMAGE_DIR) ; +HAIKU_IMAGE = $(HAIKU_IMAGE_NAME) ; +HAIKU_IMAGE_SIZE ?= $(HAIKU_DEFAULT_IMAGE_SIZE) ; # 300 MB +HAIKU_IMAGE_LABEL ?= $(HAIKU_DEFAULT_IMAGE_LABEL) ; +MakeLocate $(HAIKU_IMAGE) : $(HAIKU_IMAGE_DIR) ; + +# Set the default installation directory. +HAIKU_INSTALL_DIR ?= $(HAIKU_DEFAULT_INSTALL_DIR) ; + +# the pseudo target all image contents is attached to +NotFile $(HAIKU_IMAGE_CONTAINER_NAME) ; + +# Detect a hybrid GCC2/GCC4 image. +local isHybridBuild ; +if $(HAIKU_ADD_ALTERNATIVE_GCC_LIBS) = 1 + && $(HAIKU_ALTERNATIVE_GCC_OUTPUT_DIR) { + isHybridBuild = 1 ; +} + +# prepare the script that initializes the shell variables +HAIKU_IMAGE_INIT_VARIABLES_SCRIPT = haiku.image-init-vars ; +local script = $(HAIKU_IMAGE_INIT_VARIABLES_SCRIPT) ; +MakeLocate $(script) : $(HAIKU_OUTPUT_DIR) ; +Always $(script) ; + +AddVariableToScript $(script) : sourceDir : $(HAIKU_TOP) ; +AddVariableToScript $(script) : outputDir : $(HAIKU_OUTPUT_DIR) ; +AddVariableToScript $(script) : tmpDir : $(HAIKU_TMP_DIR) ; +AddVariableToScript $(script) : installDir : $(HAIKU_INSTALL_DIR) ; +#AddVariableToScript $(script) : isImage : 1 ; +AddVariableToScript $(script) : imageSize : $(HAIKU_IMAGE_SIZE) ; +AddVariableToScript $(script) : imageLabel : $(HAIKU_IMAGE_LABEL) ; +AddVariableToScript $(script) : addBuildCompatibilityLibDir + : $(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR) ; +AddVariableToScript $(script) : dontClearImage : $(HAIKU_DONT_CLEAR_IMAGE) ; +AddVariableToScript $(script) : updateOnly : [ IsUpdateHaikuImageOnly ] ; +AddTargetVariableToScript $(script) : addattr ; +AddTargetVariableToScript $(script) : bfs_shell : bfsShell ; +AddTargetVariableToScript $(script) : fs_shell_command : fsShellCommand ; +AddTargetVariableToScript $(script) : copyattr ; +AddTargetVariableToScript $(script) : create_image : createImage ; +AddTargetVariableToScript $(script) : makebootable ; +AddTargetVariableToScript $(script) : rc ; +AddTargetVariableToScript $(script) : resattr ; +AddTargetVariableToScript $(script) : unzip ; +AddTargetVariableToScript $(script) : vmdkimage ; +AddVariableToScript $(script) : stripCommand : $(HAIKU_STRIP) ; +if $(HOST_RM_ATTRS_TARGET) { + AddTargetVariableToScript $(script) : $(HOST_RM_ATTRS_TARGET) : rmAttrs ; +} else { + AddVariableToScript $(script) : rmAttrs : rm ; +} +if $(optionalPackageDescriptions) { + AddTargetVariableToScript $(script) : $(optionalPackageDescriptions) + : optionalPackageDescriptions ; +} + + +# create the other scripts +HAIKU_IMAGE_MAKE_DIRS_SCRIPT = haiku.image-make-dirs ; +HAIKU_IMAGE_COPY_FILES_SCRIPT = haiku.image-copy-files ; +HAIKU_IMAGE_EXTRACT_FILES_SCRIPT = haiku.image-extract-files ; +MakeLocate $(HAIKU_IMAGE_MAKE_DIRS_SCRIPT) $(HAIKU_IMAGE_COPY_FILES_SCRIPT) + $(HAIKU_IMAGE_EXTRACT_FILES_SCRIPT) : $(HAIKU_OUTPUT_DIR) ; + +CreateHaikuImageMakeDirectoriesScript $(HAIKU_IMAGE_MAKE_DIRS_SCRIPT) ; +CreateHaikuImageCopyFilesScript $(HAIKU_IMAGE_COPY_FILES_SCRIPT) ; +CreateHaikuImageExtractFilesScript $(HAIKU_IMAGE_EXTRACT_FILES_SCRIPT) ; + +# Convenience wrapper rule around BuildHaikuImage. +rule _BuildHaikuImage image : isImage : isVMwareImage +{ + # _BuildHaikuImage : : ; + # + + # build the image + # HAIKU_IMAGE_EARLY_USER_SCRIPTS, HAIKU_IMAGE_LATE_USER_SCRIPTS can be + # specified by the user. + BuildHaikuImage $(image) : + $(HAIKU_IMAGE_INIT_VARIABLES_SCRIPT) + $(HAIKU_IMAGE_EARLY_USER_SCRIPTS) + $(HAIKU_IMAGE_MAKE_DIRS_SCRIPT) + $(HAIKU_IMAGE_COPY_FILES_SCRIPT) + $(HAIKU_IMAGE_EXTRACT_FILES_SCRIPT) + $(HAIKU_IMAGE_LATE_USER_SCRIPTS) + : $(isImage) + : $(isVMwareImage) + ; + + # remove the scripts we have generated + RmTemps $(image) : + $(HAIKU_IMAGE_INIT_VARIABLES_SCRIPT) + $(HAIKU_IMAGE_MAKE_DIRS_SCRIPT) + $(HAIKU_IMAGE_COPY_FILES_SCRIPT) + $(HAIKU_IMAGE_EXTRACT_FILES_SCRIPT) + ; +} + +# build the image +_BuildHaikuImage $(HAIKU_IMAGE) : true ; +NotFile haiku-image ; +Depends haiku-image : $(HAIKU_IMAGE) ; + + +# install Haiku into a directory +NotFile install-haiku ; +_BuildHaikuImage install-haiku : 0 ; + + +# build the VMware image +HAIKU_VMWARE_IMAGE_NAME ?= $(HAIKU_DEFAULT_VMWARE_IMAGE_NAME) ; +HAIKU_VMWARE_IMAGE = $(HAIKU_VMWARE_IMAGE_NAME) ; +MakeLocate $(HAIKU_VMWARE_IMAGE) : $(HAIKU_IMAGE_DIR) ; + +_BuildHaikuImage $(HAIKU_VMWARE_IMAGE) : true : true ; +NotFile haiku-vmware-image ; +Depends haiku-vmware-image : $(HAIKU_VMWARE_IMAGE) ; + +# Execute post-image user config rules. +UserBuildConfigRulePostImage ; diff --git a/build/jam/MainBuildRules b/build/jam/MainBuildRules index 82ec60010e..5a84d5e285 100644 --- a/build/jam/MainBuildRules +++ b/build/jam/MainBuildRules @@ -181,6 +181,16 @@ actions AssembleNasm fi } +rule CompileDTS +{ + Depends $(<) : $(>) ; +} + +actions CompileDTS +{ + dtc -O dtb -o $(1) $(2); +} + rule Ld { # Ld : : : ; diff --git a/build/jam/board/sam460ex/BoardSetup b/build/jam/board/sam460ex/BoardSetup index d5f7798de0..1ab1d3e3d8 100644 --- a/build/jam/board/sam460ex/BoardSetup +++ b/build/jam/board/sam460ex/BoardSetup @@ -30,9 +30,10 @@ HAIKU_BOARD_LOADER_STACK_BASE = 0x02000000 ; # gcc flags for the specific cpu # -HAIKU_KERNEL_PIC_CCFLAGS += -mcpu=440fp -mtune=440fp ; -HAIKU_KERNEL_PIC_C++FLAGS += -mcpu=440fp -mtune=440fp ; -HAIKU_KERNEL_CCFLAGS += -mcpu=440fp -mtune=440fp ; -HAIKU_KERNEL_C++FLAGS += -mcpu=440fp -mtune=440fp ; -HAIKU_CCFLAGS_$(HAIKU_PACKAGING_ARCH) += -mcpu=440fp -mtune=440fp ; -HAIKU_C++FLAGS_$(HAIKU_PACKAGING_ARCH) += -mcpu=440fp -mtune=440fp ; +#HAIKU_KERNEL_PIC_CCFLAGS += -mcpu=440fp -mtune=440fp ; +#HAIKU_KERNEL_PIC_C++FLAGS += -mcpu=440fp -mtune=440fp ; +#HAIKU_KERNEL_CCFLAGS += -mcpu=440fp -mtune=440fp ; +#HAIKU_KERNEL_C++FLAGS += -mcpu=440fp -mtune=440fp ; +#HAIKU_CCFLAGS += -mcpu=440fp -mtune=440fp ; +#HAIKU_C++FLAGS += -mcpu=440fp -mtune=440fp ; + diff --git a/build/jam/board/verdex/BoardSetup b/build/jam/board/verdex/BoardSetup index 274c97defb..24f0d3098c 100644 --- a/build/jam/board/verdex/BoardSetup +++ b/build/jam/board/verdex/BoardSetup @@ -68,10 +68,11 @@ HAIKU_BOARD_SDIMAGE_FILES = # gcc flags for the specific cpu # -HAIKU_KERNEL_CCFLAGS += -mcpu=xscale ; -HAIKU_KERNEL_C++FLAGS += -mcpu=xscale ; -HAIKU_CCFLAGS_$(HAIKU_PACKAGING_ARCH) += -mcpu=xscale ; -HAIKU_C++FLAGS_$(HAIKU_PACKAGING_ARCH) += -mcpu=xscale ; +HAIKU_KERNEL_CCFLAGS += -mcpu=xscale -D__XSCALE__ ; +HAIKU_KERNEL_C++FLAGS += -mcpu=xscale -D__XSCALE__ ; +HAIKU_CCFLAGS += -mcpu=xscale -D__XSCALE__ ; +HAIKU_C++FLAGS += -mcpu=xscale -D__XSCALE__ ; +TARGET_ASFLAGS += -mcpu=xscale -D__XSCALE__ ; # Workaround for ld using 32k for alignment despite forcing it in the config... # should definitely not be needed! diff --git a/build/jam/packages/Haiku b/build/jam/packages/Haiku index a36a1f0833..eced2f8116 100644 --- a/build/jam/packages/Haiku +++ b/build/jam/packages/Haiku @@ -26,7 +26,7 @@ for driver in $(SYSTEM_ADD_ONS_DRIVERS_NET) { # modules AddFilesToPackage add-ons kernel bus_managers : $(SYSTEM_ADD_ONS_BUS_MANAGERS) ; -AddFilesToPackage add-ons kernel busses agp_gart : intel@x86 ; +AddFilesToPackage add-ons kernel busses agp_gart : intel@x86,x86_64 ; if $(HAIKU_ATA_STACK) = 1 { AddFilesToPackage add-ons kernel busses ata diff --git a/data/catalogs/apps/icon-o-matic/fr.catkeys b/data/catalogs/apps/icon-o-matic/fr.catkeys index 806631486e..cc263be4e0 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 806315965 +1 french x-vnd.haiku-icon_o_matic 2058853918 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) @@ -139,6 +139,7 @@ Save image Icon-O-Matic-SavePanel Enregistrer l'image Add Styles Icon-O-Matic-AddStylesCmd Ajouter des styles Remove Control Points Icon-O-Matic-RemovePointsCmd Enlever les points de contrôle Format Icon-O-Matic-SavePanel Format +Add rect Icon-O-Matic-PathsList Ajouter un rectangle Edit Icon-O-Matic-Menus Éditer Duplicate Icon-O-Matic-StylesList Dupliquer too big Icon-O-Matic-StyledTextImport trop grand @@ -161,6 +162,7 @@ Split Control Point Icon-O-Matic-SplitPointsCmd Diviser le point de contrôle Open… Icon-O-Matic-Menu-File Ouvrir… Color (#%02x%02x%02x) Icon-O-Matic-StyledTextImport Couleur (#%02x%02x%02x) Edit Gradient Icon-O-Matic-SetGradientCmd Éditer le dégadé +Clean Up Path Icon-O-Matic-CleanUpPathCmd Nettoyer le chemin Rounding Icon-O-Matic-PropertyNames Arrondi Remove Shapes Icon-O-Matic-RemoveShapesCmd Enlever les formes Clean up Icon-O-Matic-PathsList Nettoyer diff --git a/data/catalogs/apps/webpositive/ru.catkeys b/data/catalogs/apps/webpositive/ru.catkeys index b9b28e50a1..926f1b4e07 100644 --- a/data/catalogs/apps/webpositive/ru.catkeys +++ b/data/catalogs/apps/webpositive/ru.catkeys @@ -77,7 +77,7 @@ Bookmark info WebPositive Window Информация о закладке Size: Font Selection view Размер: Show tabs if only one page is open Settings Window Всегда показывать панель вкладок, даже если открыта только одна вкладка. About WebPositive Window О программе -Finish: Download Window Finishing time Завершиться в: +Finish: Download Window Finishing time Завершится в: Fonts Settings Window Шрифты OK Download Window OK Page source error WebPositive Window Ошибка в исходном коде страницы diff --git a/data/catalogs/preferences/screensaver/sv.catkeys b/data/catalogs/preferences/screensaver/sv.catkeys index 62006e74a4..d020cbdde3 100644 --- a/data/catalogs/preferences/screensaver/sv.catkeys +++ b/data/catalogs/preferences/screensaver/sv.catkeys @@ -1,4 +1,4 @@ -1 swedish x-vnd.Haiku-ScreenSaver 3630119516 +1 swedish x-vnd.Haiku-ScreenSaver 232492478 Could not load screen saver ScreenSaver Kunde inte läsa in skärmsläckaren 30 seconds ScreenSaver 30 sekunder Start screensaver ScreenSaver Starta skärmsläckare @@ -11,7 +11,9 @@ Display Power Management Signaling not available ScreenSaver Stöd för att sä ScreenSaver System name Skärmsläckare Test ScreenSaver Testa General ScreenSaver Allmänt +Fade now when mouse is here ScreenSaver Avta nu när musen är här Enable screensaver ScreenSaver Aktivera skärmsläckare +Don't fade when mouse is here ScreenSaver Avta inte nu när musen är här Cancel ScreenSaver Avbryt Turn off screen ScreenSaver Stäng av skärmen No options available ScreenSaver Inga alternativ tillgängliga diff --git a/docs/develop/kernel/scsi_asc-num-20130919.txt b/docs/develop/kernel/scsi_asc-num-20130919.txt new file mode 100644 index 0000000000..72cc30a072 --- /dev/null +++ b/docs/develop/kernel/scsi_asc-num-20130919.txt @@ -0,0 +1,728 @@ +File: ASC-NUM.TXT + +SCSI ASC/ASCQ Assignments +Numeric Sorted Listing +as of 9/19/13 + + D - DIRECT ACCESS DEVICE (SBC-3) device column key + .T - SEQUENTIAL ACCESS DEVICE (SSC-3) ------------------- + . L - PRINTER DEVICE (SSC) blank = reserved + . P - PROCESSOR DEVICE (SPC-2) not blank = allowed + . .W - WRITE ONCE READ MULTIPLE DEVICE (SBC) + . . R - C/DVD DEVICE (MMC-6) + . . O - OPTICAL MEMORY DEVICE (SBC) + . . .M - MEDIA CHANGER DEVICE (SMC-3) + . . . A - STORAGE ARRAY DEVICE (SCC-2) + . . . E - ENCLOSURE SERVICES DEVICE (SES-2) + . . . .B - SIMPLIFIED DIRECT-ACCESS DEVICE (RBC) + . . . . K - OPTICAL CARD READER/WRITER DEVICE (OCRW) + . . . . V - AUTOMATION/DRIVE INTERFACE (ADC-2) + . . . . .F - OBJECT-BASED STORAGE (OSD-2) +ASC/ASCQ DTLPWROMAEBKVF Description +------- -------------- ---------------------------------------------------- +00h/00h DTLPWROMAEBKVF NO ADDITIONAL SENSE INFORMATION +00h/01h T FILEMARK DETECTED +00h/02h T END-OF-PARTITION/MEDIUM DETECTED +00h/03h T SETMARK DETECTED +00h/04h T BEGINNING-OF-PARTITION/MEDIUM DETECTED +00h/05h TL END-OF-DATA DETECTED +00h/06h DTLPWROMAEBKVF I/O PROCESS TERMINATED +00h/07h T PROGRAMMABLE EARLY WARNING DETECTED +00h/11h R AUDIO PLAY OPERATION IN PROGRESS +00h/12h R AUDIO PLAY OPERATION PAUSED +00h/13h R AUDIO PLAY OPERATION SUCCESSFULLY COMPLETED +00h/14h R AUDIO PLAY OPERATION STOPPED DUE TO ERROR +00h/15h R NO CURRENT AUDIO STATUS TO RETURN +00h/16h DTLPWROMAEBKVF OPERATION IN PROGRESS +00h/17h DTL WROMAEBKVF CLEANING REQUESTED +00h/18h T ERASE OPERATION IN PROGRESS +00h/19h T LOCATE OPERATION IN PROGRESS +00h/1Ah T REWIND OPERATION IN PROGRESS +00h/1Bh T SET CAPACITY OPERATION IN PROGRESS +00h/1Ch T VERIFY OPERATION IN PROGRESS +00h/1Dh DT B ATA PASS THROUGH INFORMATION AVAILABLE +00h/1Eh DT R MAEBKV CONFLICTING SA CREATION REQUEST +00h/1Fh DT B LOGICAL UNIT TRANSITIONING TO ANOTHER POWER CONDITION +00h/20h DT P B EXTENDED COPY INFORMATION AVAILABLE +01h/00h D W O BK NO INDEX/SECTOR SIGNAL +02h/00h D WRO BK NO SEEK COMPLETE +03h/00h DTL W O BK PERIPHERAL DEVICE WRITE FAULT +03h/01h T NO WRITE CURRENT +03h/02h T EXCESSIVE WRITE ERRORS +04h/00h DTLPWROMAEBKVF LOGICAL UNIT NOT READY, CAUSE NOT REPORTABLE +04h/01h DTLPWROMAEBKVF LOGICAL UNIT IS IN PROCESS OF BECOMING READY +04h/02h DTLPWROMAEBKVF LOGICAL UNIT NOT READY, INITIALIZING COMMAND REQUIRED +04h/03h DTLPWROMAEBKVF LOGICAL UNIT NOT READY, MANUAL INTERVENTION REQUIRED +04h/04h DTL RO B LOGICAL UNIT NOT READY, FORMAT IN PROGRESS +04h/05h DT W O A BK F LOGICAL UNIT NOT READY, REBUILD IN PROGRESS +04h/06h DT W O A BK LOGICAL UNIT NOT READY, RECALCULATION IN PROGRESS +04h/07h DTLPWROMAEBKVF LOGICAL UNIT NOT READY, OPERATION IN PROGRESS +04h/08h R LOGICAL UNIT NOT READY, LONG WRITE IN PROGRESS +04h/09h DTLPWROMAEBKVF LOGICAL UNIT NOT READY, SELF-TEST IN PROGRESS +04h/0Ah DTLPWROMAEBKVF LOGICAL UNIT NOT ACCESSIBLE, ASYMMETRIC ACCESS STATE TRANSITION +04h/0Bh DTLPWROMAEBKVF LOGICAL UNIT NOT ACCESSIBLE, TARGET PORT IN STANDBY STATE +04h/0Ch DTLPWROMAEBKVF LOGICAL UNIT NOT ACCESSIBLE, TARGET PORT IN UNAVAILABLE STATE +04h/0Dh F LOGICAL UNIT NOT READY, STRUCTURE CHECK REQUIRED +04h/10h DT WROM B LOGICAL UNIT NOT READY, AUXILIARY MEMORY NOT ACCESSIBLE +04h/11h DT WRO AEB VF LOGICAL UNIT NOT READY, NOTIFY (ENABLE SPINUP) REQUIRED +04h/12h M V LOGICAL UNIT NOT READY, OFFLINE +04h/13h DT R MAEBKV LOGICAL UNIT NOT READY, SA CREATION IN PROGRESS +04h/14h D B LOGICAL UNIT NOT READY, SPACE ALLOCATION IN PROGRESS +04h/15h M LOGICAL UNIT NOT READY, ROBOTICS DISABLED +04h/16h M LOGICAL UNIT NOT READY, CONFIGURATION REQUIRED +04h/17h M LOGICAL UNIT NOT READY, CALIBRATION REQUIRED +04h/18h M LOGICAL UNIT NOT READY, A DOOR IS OPEN +04h/19h M LOGICAL UNIT NOT READY, OPERATING IN SEQUENTIAL MODE +04h/1Ah D B LOGICAL UNIT NOT READY, START STOP UNIT COMMAND IN PROGRESS +04h/1Bh D B LOGICAL UNIT NOT READY, SANITIZE IN PROGRESS +04h/1Ch DT MAEB LOGICAL UNIT NOT READY, ADDITIONAL POWER USE NOT YET GRANTED +04h/1Dh D LOGICAL UNIT NOT READY, CONFIGURATION IN PROGRESS +04h/1Eh D LOGICAL UNIT NOT READY, MICROCODE ACTIVATION REQUIRED +05h/00h DTL WROMAEBKVF LOGICAL UNIT DOES NOT RESPOND TO SELECTION +06h/00h D WROM BK NO REFERENCE POSITION FOUND +07h/00h DTL WROM BK MULTIPLE PERIPHERAL DEVICES SELECTED +08h/00h DTL WROMAEBKVF LOGICAL UNIT COMMUNICATION FAILURE +08h/01h DTL WROMAEBKVF LOGICAL UNIT COMMUNICATION TIME-OUT +08h/02h DTL WROMAEBKVF LOGICAL UNIT COMMUNICATION PARITY ERROR +08h/03h DT ROM BK LOGICAL UNIT COMMUNICATION CRC ERROR (ULTRA-DMA/32) +08h/04h DTLPWRO K UNREACHABLE COPY TARGET +09h/00h DT WRO B TRACK FOLLOWING ERROR +09h/01h WRO K TRACKING SERVO FAILURE +09h/02h WRO K FOCUS SERVO FAILURE +09h/03h WRO SPINDLE SERVO FAILURE +09h/04h DT WRO B HEAD SELECT FAULT +0Ah/00h DTLPWROMAEBKVF ERROR LOG OVERFLOW +0Bh/00h DTLPWROMAEBKVF WARNING +0Bh/01h DTLPWROMAEBKVF WARNING - SPECIFIED TEMPERATURE EXCEEDED +0Bh/02h DTLPWROMAEBKVF WARNING - ENCLOSURE DEGRADED +0Bh/03h DTLPWROMAEBKVF WARNING - BACKGROUND SELF-TEST FAILED +0Bh/04h DTLPWRO AEBKVF WARNING - BACKGROUND PRE-SCAN DETECTED MEDIUM ERROR +0Bh/05h DTLPWRO AEBKVF WARNING - BACKGROUND MEDIUM SCAN DETECTED MEDIUM ERROR +0Bh/06h DTLPWROMAEBKVF WARNING - NON-VOLATILE CACHE NOW VOLATILE +0Bh/07h DTLPWROMAEBKVF WARNING - DEGRADED POWER TO NON-VOLATILE CACHE +0Bh/08h DTLPWROMAEBKVF WARNING - POWER LOSS EXPECTED +0Bh/09h D WARNING - DEVICE STATISTICS NOTIFICATION ACTIVE +0Ch/00h T R WRITE ERROR +0Ch/01h K WRITE ERROR - RECOVERED WITH AUTO REALLOCATION +0Ch/02h D W O BK WRITE ERROR - AUTO REALLOCATION FAILED +0Ch/03h D W O BK WRITE ERROR - RECOMMEND REASSIGNMENT +0Ch/04h DT W O B COMPRESSION CHECK MISCOMPARE ERROR +0Ch/05h DT W O B DATA EXPANSION OCCURRED DURING COMPRESSION +0Ch/06h DT W O B BLOCK NOT COMPRESSIBLE +0Ch/07h R WRITE ERROR - RECOVERY NEEDED +0Ch/08h R WRITE ERROR - RECOVERY FAILED +0Ch/09h R WRITE ERROR - LOSS OF STREAMING +0Ch/0Ah R WRITE ERROR - PADDING BLOCKS ADDED +0Ch/0Bh DT WROM B AUXILIARY MEMORY WRITE ERROR +0Ch/0Ch DTLPWRO AEBKVF WRITE ERROR - UNEXPECTED UNSOLICITED DATA +0Ch/0Dh DTLPWRO AEBKVF WRITE ERROR - NOT ENOUGH UNSOLICITED DATA +0Ch/0Eh DT W O BK MULTIPLE WRITE ERRORS +0Ch/0Fh R DEFECTS IN ERROR WINDOW +0Dh/00h DTLPWRO A K ERROR DETECTED BY THIRD PARTY TEMPORARY INITIATOR +0Dh/01h DTLPWRO A K THIRD PARTY DEVICE FAILURE +0Dh/02h DTLPWRO A K COPY TARGET DEVICE NOT REACHABLE +0Dh/03h DTLPWRO A K INCORRECT COPY TARGET DEVICE TYPE +0Dh/04h DTLPWRO A K COPY TARGET DEVICE DATA UNDERRUN +0Dh/05h DTLPWRO A K COPY TARGET DEVICE DATA OVERRUN +0Eh/00h DT PWROMAEBK F INVALID INFORMATION UNIT +0Eh/01h DT PWROMAEBK F INFORMATION UNIT TOO SHORT +0Eh/02h DT PWROMAEBK F INFORMATION UNIT TOO LONG +0Eh/03h DT P R MAEBK F INVALID FIELD IN COMMAND INFORMATION UNIT +0Fh/00h +10h/00h D W O BK ID CRC OR ECC ERROR +10h/01h DT W O LOGICAL BLOCK GUARD CHECK FAILED +10h/02h DT W O LOGICAL BLOCK APPLICATION TAG CHECK FAILED +10h/03h DT W O LOGICAL BLOCK REFERENCE TAG CHECK FAILED +10h/04h T LOGICAL BLOCK PROTECTION ERROR ON RECOVER BUFFERED DATA +10h/05h T LOGICAL BLOCK PROTECTION METHOD ERROR +11h/00h DT WRO BK UNRECOVERED READ ERROR +11h/01h DT WRO BK READ RETRIES EXHAUSTED +11h/02h DT WRO BK ERROR TOO LONG TO CORRECT +11h/03h DT W O BK MULTIPLE READ ERRORS +11h/04h D W O BK UNRECOVERED READ ERROR - AUTO REALLOCATE FAILED +11h/05h WRO B L-EC UNCORRECTABLE ERROR +11h/06h WRO B CIRC UNRECOVERED ERROR +11h/07h W O B DATA RE-SYNCHRONIZATION ERROR +11h/08h T INCOMPLETE BLOCK READ +11h/09h T NO GAP FOUND +11h/0Ah DT O BK MISCORRECTED ERROR +11h/0Bh D W O BK UNRECOVERED READ ERROR - RECOMMEND REASSIGNMENT +11h/0Ch D W O BK UNRECOVERED READ ERROR - RECOMMEND REWRITE THE DATA +11h/0Dh DT WRO B DE-COMPRESSION CRC ERROR +11h/0Eh DT WRO B CANNOT DECOMPRESS USING DECLARED ALGORITHM +11h/0Fh R ERROR READING UPC/EAN NUMBER +11h/10h R ERROR READING ISRC NUMBER +11h/11h R READ ERROR - LOSS OF STREAMING +11h/12h DT WROM B AUXILIARY MEMORY READ ERROR +11h/13h DTLPWRO AEBKVF READ ERROR - FAILED RETRANSMISSION REQUEST +11h/14h D READ ERROR - LBA MARKED BAD BY APPLICATION CLIENT +11h/15h D WRITE AFTER SANITIZE REQUIRED +12h/00h D W O BK ADDRESS MARK NOT FOUND FOR ID FIELD +13h/00h D W O BK ADDRESS MARK NOT FOUND FOR DATA FIELD +14h/00h DTL WRO BK RECORDED ENTITY NOT FOUND +14h/01h DT WRO BK RECORD NOT FOUND +14h/02h T FILEMARK OR SETMARK NOT FOUND +14h/03h T END-OF-DATA NOT FOUND +14h/04h T BLOCK SEQUENCE ERROR +14h/05h DT W O BK RECORD NOT FOUND - RECOMMEND REASSIGNMENT +14h/06h DT W O BK RECORD NOT FOUND - DATA AUTO-REALLOCATED +14h/07h T LOCATE OPERATION FAILURE +15h/00h DTL WROM BK RANDOM POSITIONING ERROR +15h/01h DTL WROM BK MECHANICAL POSITIONING ERROR +15h/02h DT WRO BK POSITIONING ERROR DETECTED BY READ OF MEDIUM +16h/00h D W O BK DATA SYNCHRONIZATION MARK ERROR +16h/01h D W O BK DATA SYNC ERROR - DATA REWRITTEN +16h/02h D W O BK DATA SYNC ERROR - RECOMMEND REWRITE +16h/03h D W O BK DATA SYNC ERROR - DATA AUTO-REALLOCATED +16h/04h D W O BK DATA SYNC ERROR - RECOMMEND REASSIGNMENT +17h/00h DT WRO BK RECOVERED DATA WITH NO ERROR CORRECTION APPLIED +17h/01h DT WRO BK RECOVERED DATA WITH RETRIES +17h/02h DT WRO BK RECOVERED DATA WITH POSITIVE HEAD OFFSET +17h/03h DT WRO BK RECOVERED DATA WITH NEGATIVE HEAD OFFSET +17h/04h WRO B RECOVERED DATA WITH RETRIES AND/OR CIRC APPLIED +17h/05h D WRO BK RECOVERED DATA USING PREVIOUS SECTOR ID +17h/06h D W O BK RECOVERED DATA WITHOUT ECC - DATA AUTO-REALLOCATED +17h/07h D WRO BK RECOVERED DATA WITHOUT ECC - RECOMMEND REASSIGNMENT +17h/08h D WRO BK RECOVERED DATA WITHOUT ECC - RECOMMEND REWRITE +17h/09h D WRO BK RECOVERED DATA WITHOUT ECC - DATA REWRITTEN +18h/00h DT WRO BK RECOVERED DATA WITH ERROR CORRECTION APPLIED +18h/01h D WRO BK RECOVERED DATA WITH ERROR CORR. & RETRIES APPLIED +18h/02h D WRO BK RECOVERED DATA - DATA AUTO-REALLOCATED +18h/03h R RECOVERED DATA WITH CIRC +18h/04h R RECOVERED DATA WITH L-EC +18h/05h D WRO BK RECOVERED DATA - RECOMMEND REASSIGNMENT +18h/06h D WRO BK RECOVERED DATA - RECOMMEND REWRITE +18h/07h D W O BK RECOVERED DATA WITH ECC - DATA REWRITTEN +18h/08h R RECOVERED DATA WITH LINKING +19h/00h D O K DEFECT LIST ERROR +19h/01h D O K DEFECT LIST NOT AVAILABLE +19h/02h D O K DEFECT LIST ERROR IN PRIMARY LIST +19h/03h D O K DEFECT LIST ERROR IN GROWN LIST +1Ah/00h DTLPWROMAEBKVF PARAMETER LIST LENGTH ERROR +1Bh/00h DTLPWROMAEBKVF SYNCHRONOUS DATA TRANSFER ERROR +1Ch/00h D O BK DEFECT LIST NOT FOUND +1Ch/01h D O BK PRIMARY DEFECT LIST NOT FOUND +1Ch/02h D O BK GROWN DEFECT LIST NOT FOUND +1Dh/00h DT WRO BK MISCOMPARE DURING VERIFY OPERATION +1Dh/01h D B MISCOMPARE VERIFY OF UNMAPPED LBA +1Eh/00h D W O BK RECOVERED ID WITH ECC CORRECTION +1Fh/00h D O K PARTIAL DEFECT LIST TRANSFER +20h/00h DTLPWROMAEBKVF INVALID COMMAND OPERATION CODE +20h/01h DT PWROMAEBK ACCESS DENIED - INITIATOR PENDING-ENROLLED +20h/02h DT PWROMAEBK ACCESS DENIED - NO ACCESS RIGHTS +20h/03h DT PWROMAEBK ACCESS DENIED - INVALID MGMT ID KEY +20h/04h T ILLEGAL COMMAND WHILE IN WRITE CAPABLE STATE +20h/05h T Obsolete +20h/06h T ILLEGAL COMMAND WHILE IN EXPLICIT ADDRESS MODE +20h/07h T ILLEGAL COMMAND WHILE IN IMPLICIT ADDRESS MODE +20h/08h DT PWROMAEBK ACCESS DENIED - ENROLLMENT CONFLICT +20h/09h DT PWROMAEBK ACCESS DENIED - INVALID LU IDENTIFIER +20h/0Ah DT PWROMAEBK ACCESS DENIED - INVALID PROXY TOKEN +20h/0Bh DT PWROMAEBK ACCESS DENIED - ACL LUN CONFLICT +20h/0Ch T ILLEGAL COMMAND WHEN NOT IN APPEND-ONLY MODE +21h/00h DT WRO BK LOGICAL BLOCK ADDRESS OUT OF RANGE +21h/01h DT WROM BK INVALID ELEMENT ADDRESS +21h/02h R INVALID ADDRESS FOR WRITE +21h/03h R INVALID WRITE CROSSING LAYER JUMP +22h/00h D ILLEGAL FUNCTION (USE 20 00, 24 00, OR 26 00) +23h/00h DT P B INVALID TOKEN OPERATION, CAUSE NOT REPORTABLE +23h/01h DT P B INVALID TOKEN OPERATION, UNSUPPORTED TOKEN TYPE +23h/02h DT P B INVALID TOKEN OPERATION, REMOTE TOKEN USAGE NOT SUPPORTED +23h/03h DT P B INVALID TOKEN OPERATION, REMOTE ROD TOKEN CREATION NOT SUPPORTED +23h/04h DT P B INVALID TOKEN OPERATION, TOKEN UNKNOWN +23h/05h DT P B INVALID TOKEN OPERATION, TOKEN CORRUPT +23h/06h DT P B INVALID TOKEN OPERATION, TOKEN REVOKED +23h/07h DT P B INVALID TOKEN OPERATION, TOKEN EXPIRED +23h/08h DT P B INVALID TOKEN OPERATION, TOKEN CANCELLED +23h/09h DT P B INVALID TOKEN OPERATION, TOKEN DELETED +23h/0Ah DT P B INVALID TOKEN OPERATION, INVALID TOKEN LENGTH +24h/00h DTLPWROMAEBKVF INVALID FIELD IN CDB +24h/01h DTLPWRO AEBKVF CDB DECRYPTION ERROR +24h/02h T Obsolete +24h/03h T Obsolete +24h/04h F SECURITY AUDIT VALUE FROZEN +24h/05h F SECURITY WORKING KEY FROZEN +24h/06h F NONCE NOT UNIQUE +24h/07h F NONCE TIMESTAMP OUT OF RANGE +24h/08h DT R MAEBKV INVALID XCDB +25h/00h DTLPWROMAEBKVF LOGICAL UNIT NOT SUPPORTED +26h/00h DTLPWROMAEBKVF INVALID FIELD IN PARAMETER LIST +26h/01h DTLPWROMAEBKVF PARAMETER NOT SUPPORTED +26h/02h DTLPWROMAEBKVF PARAMETER VALUE INVALID +26h/03h DTLPWROMAE K THRESHOLD PARAMETERS NOT SUPPORTED +26h/04h DTLPWROMAEBKVF INVALID RELEASE OF PERSISTENT RESERVATION +26h/05h DTLPWRO A BK DATA DECRYPTION ERROR +26h/06h DTLPWRO K TOO MANY TARGET DESCRIPTORS +26h/07h DTLPWRO K UNSUPPORTED TARGET DESCRIPTOR TYPE CODE +26h/08h DTLPWRO K TOO MANY SEGMENT DESCRIPTORS +26h/09h DTLPWRO K UNSUPPORTED SEGMENT DESCRIPTOR TYPE CODE +26h/0Ah DTLPWRO K UNEXPECTED INEXACT SEGMENT +26h/0Bh DTLPWRO K INLINE DATA LENGTH EXCEEDED +26h/0Ch DTLPWRO K INVALID OPERATION FOR COPY SOURCE OR DESTINATION +26h/0Dh DTLPWRO K COPY SEGMENT GRANULARITY VIOLATION +26h/0Eh DT PWROMAEBK INVALID PARAMETER WHILE PORT IS ENABLED +26h/0Fh F INVALID DATA-OUT BUFFER INTEGRITY CHECK VALUE +26h/10h T DATA DECRYPTION KEY FAIL LIMIT REACHED +26h/11h T INCOMPLETE KEY-ASSOCIATED DATA SET +26h/12h T VENDOR SPECIFIC KEY REFERENCE NOT FOUND +27h/00h DT WRO BK WRITE PROTECTED +27h/01h DT WRO BK HARDWARE WRITE PROTECTED +27h/02h DT WRO BK LOGICAL UNIT SOFTWARE WRITE PROTECTED +27h/03h T R ASSOCIATED WRITE PROTECT +27h/04h T R PERSISTENT WRITE PROTECT +27h/05h T R PERMANENT WRITE PROTECT +27h/06h R F CONDITIONAL WRITE PROTECT +27h/07h D B SPACE ALLOCATION FAILED WRITE PROTECT +28h/00h DTLPWROMAEBKVF NOT READY TO READY CHANGE, MEDIUM MAY HAVE CHANGED +28h/01h DT WROM B IMPORT OR EXPORT ELEMENT ACCESSED +28h/02h R FORMAT-LAYER MAY HAVE CHANGED +28h/03h M IMPORT/EXPORT ELEMENT ACCESSED, MEDIUM CHANGED +29h/00h DTLPWROMAEBKVF POWER ON, RESET, OR BUS DEVICE RESET OCCURRED +29h/01h DTLPWROMAEBKVF POWER ON OCCURRED +29h/02h DTLPWROMAEBKVF SCSI BUS RESET OCCURRED +29h/03h DTLPWROMAEBKVF BUS DEVICE RESET FUNCTION OCCURRED +29h/04h DTLPWROMAEBKVF DEVICE INTERNAL RESET +29h/05h DTLPWROMAEBKVF TRANSCEIVER MODE CHANGED TO SINGLE-ENDED +29h/06h DTLPWROMAEBKVF TRANSCEIVER MODE CHANGED TO LVD +29h/07h DTLPWROMAEBKVF I_T NEXUS LOSS OCCURRED +2Ah/00h DTL WROMAEBKVF PARAMETERS CHANGED +2Ah/01h DTL WROMAEBKVF MODE PARAMETERS CHANGED +2Ah/02h DTL WROMAE K LOG PARAMETERS CHANGED +2Ah/03h DTLPWROMAE K RESERVATIONS PREEMPTED +2Ah/04h DTLPWROMAE RESERVATIONS RELEASED +2Ah/05h DTLPWROMAE REGISTRATIONS PREEMPTED +2Ah/06h DTLPWROMAEBKVF ASYMMETRIC ACCESS STATE CHANGED +2Ah/07h DTLPWROMAEBKVF IMPLICIT ASYMMETRIC ACCESS STATE TRANSITION FAILED +2Ah/08h DT WROMAEBKVF PRIORITY CHANGED +2Ah/09h D CAPACITY DATA HAS CHANGED +2Ah/0Ah DT ERROR HISTORY I_T NEXUS CLEARED +2Ah/0Bh DT ERROR HISTORY SNAPSHOT RELEASED +2Ah/0Ch F ERROR RECOVERY ATTRIBUTES HAVE CHANGED +2Ah/0Dh T DATA ENCRYPTION CAPABILITIES CHANGED +2Ah/10h DT M E V TIMESTAMP CHANGED +2Ah/11h T DATA ENCRYPTION PARAMETERS CHANGED BY ANOTHER I_T NEXUS +2Ah/12h T DATA ENCRYPTION PARAMETERS CHANGED BY VENDOR SPECIFIC EVENT +2Ah/13h T DATA ENCRYPTION KEY INSTANCE COUNTER HAS CHANGED +2Ah/14h DT R MAEBKV SA CREATION CAPABILITIES DATA HAS CHANGED +2Ah/15h T M V MEDIUM REMOVAL PREVENTION PREEMPTED +2Bh/00h DTLPWRO K COPY CANNOT EXECUTE SINCE HOST CANNOT DISCONNECT +2Ch/00h DTLPWROMAEBKVF COMMAND SEQUENCE ERROR +2Ch/01h TOO MANY WINDOWS SPECIFIED +2Ch/02h INVALID COMBINATION OF WINDOWS SPECIFIED +2Ch/03h R CURRENT PROGRAM AREA IS NOT EMPTY +2Ch/04h R CURRENT PROGRAM AREA IS EMPTY +2Ch/05h B ILLEGAL POWER CONDITION REQUEST +2Ch/06h R PERSISTENT PREVENT CONFLICT +2Ch/07h DTLPWROMAEBKVF PREVIOUS BUSY STATUS +2Ch/08h DTLPWROMAEBKVF PREVIOUS TASK SET FULL STATUS +2Ch/09h DTLPWROM EBKVF PREVIOUS RESERVATION CONFLICT STATUS +2Ch/0Ah F PARTITION OR COLLECTION CONTAINS USER OBJECTS +2Ch/0Bh T NOT RESERVED +2Ch/0Ch D ORWRITE GENERATION DOES NOT MATCH +2Dh/00h T OVERWRITE ERROR ON UPDATE IN PLACE +2Eh/00h D WROM B INSUFFICIENT TIME FOR OPERATION +2Eh/01h D W OM B COMMAND TIMEOUT BEFORE PROCESSING +2Eh/02h D W OM B COMMAND TIMEOUT DURING PROCESSING +2Eh/03h D W OM B COMMAND TIMEOUT DURING PROCESSING DUE TO ERROR RECOVERY +2Fh/00h DTLPWROMAEBKVF COMMANDS CLEARED BY ANOTHER INITIATOR +2Fh/01h D COMMANDS CLEARED BY POWER LOSS NOTIFICATION +2Fh/02h DTLPWROMAEBKVF COMMANDS CLEARED BY DEVICE SERVER +2Fh/03h DTLPWROMAEBKVF SOME COMMANDS CLEARED BY QUEUING LAYER EVENT +30h/00h DT WROM BK INCOMPATIBLE MEDIUM INSTALLED +30h/01h DT WRO BK CANNOT READ MEDIUM - UNKNOWN FORMAT +30h/02h DT WRO BK CANNOT READ MEDIUM - INCOMPATIBLE FORMAT +30h/03h DT R M K CLEANING CARTRIDGE INSTALLED +30h/04h DT WRO BK CANNOT WRITE MEDIUM - UNKNOWN FORMAT +30h/05h DT WRO BK CANNOT WRITE MEDIUM - INCOMPATIBLE FORMAT +30h/06h DT WRO B CANNOT FORMAT MEDIUM - INCOMPATIBLE MEDIUM +30h/07h DTL WROMAEBKVF CLEANING FAILURE +30h/08h R CANNOT WRITE - APPLICATION CODE MISMATCH +30h/09h R CURRENT SESSION NOT FIXATED FOR APPEND +30h/0Ah DT WRO AEBK CLEANING REQUEST REJECTED +30h/0Ch T WORM MEDIUM - OVERWRITE ATTEMPTED +30h/0Dh T WORM MEDIUM - INTEGRITY CHECK +30h/10h R MEDIUM NOT FORMATTED +30h/11h M INCOMPATIBLE VOLUME TYPE +30h/12h M INCOMPATIBLE VOLUME QUALIFIER +30h/13h M CLEANING VOLUME EXPIRED +31h/00h DT WRO BK MEDIUM FORMAT CORRUPTED +31h/01h D L RO B FORMAT COMMAND FAILED +31h/02h R ZONED FORMATTING FAILED DUE TO SPARE LINKING +31h/03h D B SANITIZE COMMAND FAILED +32h/00h D W O BK NO DEFECT SPARE LOCATION AVAILABLE +32h/01h D W O BK DEFECT LIST UPDATE FAILURE +33h/00h T TAPE LENGTH ERROR +34h/00h DTLPWROMAEBKVF ENCLOSURE FAILURE +35h/00h DTLPWROMAEBKVF ENCLOSURE SERVICES FAILURE +35h/01h DTLPWROMAEBKVF UNSUPPORTED ENCLOSURE FUNCTION +35h/02h DTLPWROMAEBKVF ENCLOSURE SERVICES UNAVAILABLE +35h/03h DTLPWROMAEBKVF ENCLOSURE SERVICES TRANSFER FAILURE +35h/04h DTLPWROMAEBKVF ENCLOSURE SERVICES TRANSFER REFUSED +35h/05h DTL WROMAEBKVF ENCLOSURE SERVICES CHECKSUM ERROR +36h/00h L RIBBON, INK, OR TONER FAILURE +37h/00h DTL WROMAEBKVF ROUNDED PARAMETER +38h/00h B EVENT STATUS NOTIFICATION +38h/02h B ESN - POWER MANAGEMENT CLASS EVENT +38h/04h B ESN - MEDIA CLASS EVENT +38h/06h B ESN - DEVICE BUSY CLASS EVENT +38h/07h D THIN PROVISIONING SOFT THRESHOLD REACHED +39h/00h DTL WROMAE K SAVING PARAMETERS NOT SUPPORTED +3Ah/00h DTL WROM BK MEDIUM NOT PRESENT +3Ah/01h DT WROM BK MEDIUM NOT PRESENT - TRAY CLOSED +3Ah/02h DT WROM BK MEDIUM NOT PRESENT - TRAY OPEN +3Ah/03h DT WROM B MEDIUM NOT PRESENT - LOADABLE +3Ah/04h DT WRO B MEDIUM NOT PRESENT - MEDIUM AUXILIARY MEMORY ACCESSIBLE +3Bh/00h TL SEQUENTIAL POSITIONING ERROR +3Bh/01h T TAPE POSITION ERROR AT BEGINNING-OF-MEDIUM +3Bh/02h T TAPE POSITION ERROR AT END-OF-MEDIUM +3Bh/03h L TAPE OR ELECTRONIC VERTICAL FORMS UNIT NOT READY +3Bh/04h L SLEW FAILURE +3Bh/05h L PAPER JAM +3Bh/06h L FAILED TO SENSE TOP-OF-FORM +3Bh/07h L FAILED TO SENSE BOTTOM-OF-FORM +3Bh/08h T REPOSITION ERROR +3Bh/09h READ PAST END OF MEDIUM +3Bh/0Ah READ PAST BEGINNING OF MEDIUM +3Bh/0Bh POSITION PAST END OF MEDIUM +3Bh/0Ch T POSITION PAST BEGINNING OF MEDIUM +3Bh/0Dh DT WROM BK MEDIUM DESTINATION ELEMENT FULL +3Bh/0Eh DT WROM BK MEDIUM SOURCE ELEMENT EMPTY +3Bh/0Fh R END OF MEDIUM REACHED +3Bh/11h DT WROM BK MEDIUM MAGAZINE NOT ACCESSIBLE +3Bh/12h DT WROM BK MEDIUM MAGAZINE REMOVED +3Bh/13h DT WROM BK MEDIUM MAGAZINE INSERTED +3Bh/14h DT WROM BK MEDIUM MAGAZINE LOCKED +3Bh/15h DT WROM BK MEDIUM MAGAZINE UNLOCKED +3Bh/16h R MECHANICAL POSITIONING OR CHANGER ERROR +3Bh/17h F READ PAST END OF USER OBJECT +3Bh/18h M ELEMENT DISABLED +3Bh/19h M ELEMENT ENABLED +3Bh/1Ah M DATA TRANSFER DEVICE REMOVED +3Bh/1Bh M DATA TRANSFER DEVICE INSERTED +3Bh/1Ch T TOO MANY LOGICAL OBJECTS ON PARTITION TO SUPPORT OPERATION +3Ch/00h +3Dh/00h DTLPWROMAE K INVALID BITS IN IDENTIFY MESSAGE +3Eh/00h DTLPWROMAEBKVF LOGICAL UNIT HAS NOT SELF-CONFIGURED YET +3Eh/01h DTLPWROMAEBKVF LOGICAL UNIT FAILURE +3Eh/02h DTLPWROMAEBKVF TIMEOUT ON LOGICAL UNIT +3Eh/03h DTLPWROMAEBKVF LOGICAL UNIT FAILED SELF-TEST +3Eh/04h DTLPWROMAEBKVF LOGICAL UNIT UNABLE TO UPDATE SELF-TEST LOG +3Fh/00h DTLPWROMAEBKVF TARGET OPERATING CONDITIONS HAVE CHANGED +3Fh/01h DTLPWROMAEBKVF MICROCODE HAS BEEN CHANGED +3Fh/02h DTLPWROM BK CHANGED OPERATING DEFINITION +3Fh/03h DTLPWROMAEBKVF INQUIRY DATA HAS CHANGED +3Fh/04h DT WROMAEBK COMPONENT DEVICE ATTACHED +3Fh/05h DT WROMAEBK DEVICE IDENTIFIER CHANGED +3Fh/06h DT WROMAEB REDUNDANCY GROUP CREATED OR MODIFIED +3Fh/07h DT WROMAEB REDUNDANCY GROUP DELETED +3Fh/08h DT WROMAEB SPARE CREATED OR MODIFIED +3Fh/09h DT WROMAEB SPARE DELETED +3Fh/0Ah DT WROMAEBK VOLUME SET CREATED OR MODIFIED +3Fh/0Bh DT WROMAEBK VOLUME SET DELETED +3Fh/0Ch DT WROMAEBK VOLUME SET DEASSIGNED +3Fh/0Dh DT WROMAEBK VOLUME SET REASSIGNED +3Fh/0Eh DTLPWROMAE REPORTED LUNS DATA HAS CHANGED +3Fh/0Fh DTLPWROMAEBKVF ECHO BUFFER OVERWRITTEN +3Fh/10h DT WROM B MEDIUM LOADABLE +3Fh/11h DT WROM B MEDIUM AUXILIARY MEMORY ACCESSIBLE +3Fh/12h DTLPWR MAEBK F iSCSI IP ADDRESS ADDED +3Fh/13h DTLPWR MAEBK F iSCSI IP ADDRESS REMOVED +3Fh/14h DTLPWR MAEBK F iSCSI IP ADDRESS CHANGED +3Fh/15h DTLPWR MAEBK INSPECT REFERRALS SENSE DESCRIPTORS +40h/00h D RAM FAILURE (SHOULD USE 40 NN) +40h/NNh DTLPWROMAEBKVF DIAGNOSTIC FAILURE ON COMPONENT NN (80h-FFh) +41h/00h D DATA PATH FAILURE (SHOULD USE 40 NN) +42h/00h D POWER-ON OR SELF-TEST FAILURE (SHOULD USE 40 NN) +43h/00h DTLPWROMAEBKVF MESSAGE ERROR +44h/00h DTLPWROMAEBKVF INTERNAL TARGET FAILURE +44h/01h DT P MAEBKVF PERSISTENT RESERVATION INFORMATION LOST +44h/71h DT B ATA DEVICE FAILED SET FEATURES +45h/00h DTLPWROMAEBKVF SELECT OR RESELECT FAILURE +46h/00h DTLPWROM BK UNSUCCESSFUL SOFT RESET +47h/00h DTLPWROMAEBKVF SCSI PARITY ERROR +47h/01h DTLPWROMAEBKVF DATA PHASE CRC ERROR DETECTED +47h/02h DTLPWROMAEBKVF SCSI PARITY ERROR DETECTED DURING ST DATA PHASE +47h/03h DTLPWROMAEBKVF INFORMATION UNIT iuCRC ERROR DETECTED +47h/04h DTLPWROMAEBKVF ASYNCHRONOUS INFORMATION PROTECTION ERROR DETECTED +47h/05h DTLPWROMAEBKVF PROTOCOL SERVICE CRC ERROR +47h/06h DT MAEBKVF PHY TEST FUNCTION IN PROGRESS +47h/7Fh DT PWROMAEBK SOME COMMANDS CLEARED BY ISCSI PROTOCOL EVENT +48h/00h DTLPWROMAEBKVF INITIATOR DETECTED ERROR MESSAGE RECEIVED +49h/00h DTLPWROMAEBKVF INVALID MESSAGE ERROR +4Ah/00h DTLPWROMAEBKVF COMMAND PHASE ERROR +4Bh/00h DTLPWROMAEBKVF DATA PHASE ERROR +4Bh/01h DT PWROMAEBK INVALID TARGET PORT TRANSFER TAG RECEIVED +4Bh/02h DT PWROMAEBK TOO MUCH WRITE DATA +4Bh/03h DT PWROMAEBK ACK/NAK TIMEOUT +4Bh/04h DT PWROMAEBK NAK RECEIVED +4Bh/05h DT PWROMAEBK DATA OFFSET ERROR +4Bh/06h DT PWROMAEBK INITIATOR RESPONSE TIMEOUT +4Bh/07h DT PWROMAEBK F CONNECTION LOST +4Bh/08h DT PWROMAEBK F DATA-IN BUFFER OVERFLOW - DATA BUFFER SIZE +4Bh/09h DT PWROMAEBK F DATA-IN BUFFER OVERFLOW - DATA BUFFER DESCRIPTOR AREA +4Bh/0Ah DT PWROMAEBK F DATA-IN BUFFER ERROR +4Bh/0Bh DT PWROMAEBK F DATA-OUT BUFFER OVERFLOW - DATA BUFFER SIZE +4Bh/0Ch DT PWROMAEBK F DATA-OUT BUFFER OVERFLOW - DATA BUFFER DESCRIPTOR AREA +4Bh/0Dh DT PWROMAEBK F DATA-OUT BUFFER ERROR +4Bh/0Eh DT PWROMAEBK F PCIE FABRIC ERROR +4Bh/0Fh DT PWROMAEBK F PCIE COMPLETION TIMEOUT +4Bh/10h DT PWROMAEBK F PCIE COMPLETER ABORT +4Bh/11h DT PWROMAEBK F PCIE POISONED TLP RECEIVED +4Bh/12h DT PWROMAEBK F PCIE ECRC CHECK FAILED +4Bh/13h DT PWROMAEBK F PCIE UNSUPPORTED REQUEST +4Bh/14h DT PWROMAEBK F PCIE ACS VIOLATION +4Bh/15h DT PWROMAEBK F PCIE TLP PREFIX BLOCKED +4Ch/00h DTLPWROMAEBKVF LOGICAL UNIT FAILED SELF-CONFIGURATION +4Dh/NNh DTLPWROMAEBKVF TAGGED OVERLAPPED COMMANDS (NN = TASK TAG) +4Eh/00h DTLPWROMAEBKVF OVERLAPPED COMMANDS ATTEMPTED +4Fh/00h +50h/00h T WRITE APPEND ERROR +50h/01h T WRITE APPEND POSITION ERROR +50h/02h T POSITION ERROR RELATED TO TIMING +51h/00h T RO ERASE FAILURE +51h/01h R ERASE FAILURE - INCOMPLETE ERASE OPERATION DETECTED +52h/00h T CARTRIDGE FAULT +53h/00h DTL WROM BK MEDIA LOAD OR EJECT FAILED +53h/01h T UNLOAD TAPE FAILURE +53h/02h DT WROM BK MEDIUM REMOVAL PREVENTED +53h/03h M MEDIUM REMOVAL PREVENTED BY DATA TRANSFER ELEMENT +53h/04h T MEDIUM THREAD OR UNTHREAD FAILURE +53h/05h M VOLUME IDENTIFIER INVALID +53h/06h M VOLUME IDENTIFIER MISSING +53h/07h M DUPLICATE VOLUME IDENTIFIER +53h/08h M ELEMENT STATUS UNKNOWN +54h/00h P SCSI TO HOST SYSTEM INTERFACE FAILURE +55h/00h P SYSTEM RESOURCE FAILURE +55h/01h D O BK SYSTEM BUFFER FULL +55h/02h DTLPWROMAE K INSUFFICIENT RESERVATION RESOURCES +55h/03h DTLPWROMAE K INSUFFICIENT RESOURCES +55h/04h DTLPWROMAE K INSUFFICIENT REGISTRATION RESOURCES +55h/05h DT PWROMAEBK INSUFFICIENT ACCESS CONTROL RESOURCES +55h/06h DT WROM B AUXILIARY MEMORY OUT OF SPACE +55h/07h F QUOTA ERROR +55h/08h T MAXIMUM NUMBER OF SUPPLEMENTAL DECRYPTION KEYS EXCEEDED +55h/09h M MEDIUM AUXILIARY MEMORY NOT ACCESSIBLE +55h/0Ah M DATA CURRENTLY UNAVAILABLE +55h/0Bh DTLPWROMAEBKVF INSUFFICIENT POWER FOR OPERATION +55h/0Ch DT P B INSUFFICIENT RESOURCES TO CREATE ROD +55h/0Dh DT P B INSUFFICIENT RESOURCES TO CREATE ROD TOKEN +56h/00h +57h/00h R UNABLE TO RECOVER TABLE-OF-CONTENTS +58h/00h O GENERATION DOES NOT EXIST +59h/00h O UPDATED BLOCK READ +5Ah/00h DTLPWRO BK OPERATOR REQUEST OR STATE CHANGE INPUT +5Ah/01h DT WROM BK OPERATOR MEDIUM REMOVAL REQUEST +5Ah/02h DT WRO A BK OPERATOR SELECTED WRITE PROTECT +5Ah/03h DT WRO A BK OPERATOR SELECTED WRITE PERMIT +5Bh/00h DTLPWROM K LOG EXCEPTION +5Bh/01h DTLPWROM K THRESHOLD CONDITION MET +5Bh/02h DTLPWROM K LOG COUNTER AT MAXIMUM +5Bh/03h DTLPWROM K LOG LIST CODES EXHAUSTED +5Ch/00h D O RPL STATUS CHANGE +5Ch/01h D O SPINDLES SYNCHRONIZED +5Ch/02h D O SPINDLES NOT SYNCHRONIZED +5Dh/00h DTLPWROMAEBKVF FAILURE PREDICTION THRESHOLD EXCEEDED +5Dh/01h R B MEDIA FAILURE PREDICTION THRESHOLD EXCEEDED +5Dh/02h R LOGICAL UNIT FAILURE PREDICTION THRESHOLD EXCEEDED +5Dh/03h R SPARE AREA EXHAUSTION PREDICTION THRESHOLD EXCEEDED +5Dh/10h D B HARDWARE IMPENDING FAILURE GENERAL HARD DRIVE FAILURE +5Dh/11h D B HARDWARE IMPENDING FAILURE DRIVE ERROR RATE TOO HIGH +5Dh/12h D B HARDWARE IMPENDING FAILURE DATA ERROR RATE TOO HIGH +5Dh/13h D B HARDWARE IMPENDING FAILURE SEEK ERROR RATE TOO HIGH +5Dh/14h D B HARDWARE IMPENDING FAILURE TOO MANY BLOCK REASSIGNS +5Dh/15h D B HARDWARE IMPENDING FAILURE ACCESS TIMES TOO HIGH +5Dh/16h D B HARDWARE IMPENDING FAILURE START UNIT TIMES TOO HIGH +5Dh/17h D B HARDWARE IMPENDING FAILURE CHANNEL PARAMETRICS +5Dh/18h D B HARDWARE IMPENDING FAILURE CONTROLLER DETECTED +5Dh/19h D B HARDWARE IMPENDING FAILURE THROUGHPUT PERFORMANCE +5Dh/1Ah D B HARDWARE IMPENDING FAILURE SEEK TIME PERFORMANCE +5Dh/1Bh D B HARDWARE IMPENDING FAILURE SPIN-UP RETRY COUNT +5Dh/1Ch D B HARDWARE IMPENDING FAILURE DRIVE CALIBRATION RETRY COUNT +5Dh/20h D B CONTROLLER IMPENDING FAILURE GENERAL HARD DRIVE FAILURE +5Dh/21h D B CONTROLLER IMPENDING FAILURE DRIVE ERROR RATE TOO HIGH +5Dh/22h D B CONTROLLER IMPENDING FAILURE DATA ERROR RATE TOO HIGH +5Dh/23h D B CONTROLLER IMPENDING FAILURE SEEK ERROR RATE TOO HIGH +5Dh/24h D B CONTROLLER IMPENDING FAILURE TOO MANY BLOCK REASSIGNS +5Dh/25h D B CONTROLLER IMPENDING FAILURE ACCESS TIMES TOO HIGH +5Dh/26h D B CONTROLLER IMPENDING FAILURE START UNIT TIMES TOO HIGH +5Dh/27h D B CONTROLLER IMPENDING FAILURE CHANNEL PARAMETRICS +5Dh/28h D B CONTROLLER IMPENDING FAILURE CONTROLLER DETECTED +5Dh/29h D B CONTROLLER IMPENDING FAILURE THROUGHPUT PERFORMANCE +5Dh/2Ah D B CONTROLLER IMPENDING FAILURE SEEK TIME PERFORMANCE +5Dh/2Bh D B CONTROLLER IMPENDING FAILURE SPIN-UP RETRY COUNT +5Dh/2Ch D B CONTROLLER IMPENDING FAILURE DRIVE CALIBRATION RETRY COUNT +5Dh/30h D B DATA CHANNEL IMPENDING FAILURE GENERAL HARD DRIVE FAILURE +5Dh/31h D B DATA CHANNEL IMPENDING FAILURE DRIVE ERROR RATE TOO HIGH +5Dh/32h D B DATA CHANNEL IMPENDING FAILURE DATA ERROR RATE TOO HIGH +5Dh/33h D B DATA CHANNEL IMPENDING FAILURE SEEK ERROR RATE TOO HIGH +5Dh/34h D B DATA CHANNEL IMPENDING FAILURE TOO MANY BLOCK REASSIGNS +5Dh/35h D B DATA CHANNEL IMPENDING FAILURE ACCESS TIMES TOO HIGH +5Dh/36h D B DATA CHANNEL IMPENDING FAILURE START UNIT TIMES TOO HIGH +5Dh/37h D B DATA CHANNEL IMPENDING FAILURE CHANNEL PARAMETRICS +5Dh/38h D B DATA CHANNEL IMPENDING FAILURE CONTROLLER DETECTED +5Dh/39h D B DATA CHANNEL IMPENDING FAILURE THROUGHPUT PERFORMANCE +5Dh/3Ah D B DATA CHANNEL IMPENDING FAILURE SEEK TIME PERFORMANCE +5Dh/3Bh D B DATA CHANNEL IMPENDING FAILURE SPIN-UP RETRY COUNT +5Dh/3Ch D B DATA CHANNEL IMPENDING FAILURE DRIVE CALIBRATION RETRY COUNT +5Dh/40h D B SERVO IMPENDING FAILURE GENERAL HARD DRIVE FAILURE +5Dh/41h D B SERVO IMPENDING FAILURE DRIVE ERROR RATE TOO HIGH +5Dh/42h D B SERVO IMPENDING FAILURE DATA ERROR RATE TOO HIGH +5Dh/43h D B SERVO IMPENDING FAILURE SEEK ERROR RATE TOO HIGH +5Dh/44h D B SERVO IMPENDING FAILURE TOO MANY BLOCK REASSIGNS +5Dh/45h D B SERVO IMPENDING FAILURE ACCESS TIMES TOO HIGH +5Dh/46h D B SERVO IMPENDING FAILURE START UNIT TIMES TOO HIGH +5Dh/47h D B SERVO IMPENDING FAILURE CHANNEL PARAMETRICS +5Dh/48h D B SERVO IMPENDING FAILURE CONTROLLER DETECTED +5Dh/49h D B SERVO IMPENDING FAILURE THROUGHPUT PERFORMANCE +5Dh/4Ah D B SERVO IMPENDING FAILURE SEEK TIME PERFORMANCE +5Dh/4Bh D B SERVO IMPENDING FAILURE SPIN-UP RETRY COUNT +5Dh/4Ch D B SERVO IMPENDING FAILURE DRIVE CALIBRATION RETRY COUNT +5Dh/50h D B SPINDLE IMPENDING FAILURE GENERAL HARD DRIVE FAILURE +5Dh/51h D B SPINDLE IMPENDING FAILURE DRIVE ERROR RATE TOO HIGH +5Dh/52h D B SPINDLE IMPENDING FAILURE DATA ERROR RATE TOO HIGH +5Dh/53h D B SPINDLE IMPENDING FAILURE SEEK ERROR RATE TOO HIGH +5Dh/54h D B SPINDLE IMPENDING FAILURE TOO MANY BLOCK REASSIGNS +5Dh/55h D B SPINDLE IMPENDING FAILURE ACCESS TIMES TOO HIGH +5Dh/56h D B SPINDLE IMPENDING FAILURE START UNIT TIMES TOO HIGH +5Dh/57h D B SPINDLE IMPENDING FAILURE CHANNEL PARAMETRICS +5Dh/58h D B SPINDLE IMPENDING FAILURE CONTROLLER DETECTED +5Dh/59h D B SPINDLE IMPENDING FAILURE THROUGHPUT PERFORMANCE +5Dh/5Ah D B SPINDLE IMPENDING FAILURE SEEK TIME PERFORMANCE +5Dh/5Bh D B SPINDLE IMPENDING FAILURE SPIN-UP RETRY COUNT +5Dh/5Ch D B SPINDLE IMPENDING FAILURE DRIVE CALIBRATION RETRY COUNT +5Dh/60h D B FIRMWARE IMPENDING FAILURE GENERAL HARD DRIVE FAILURE +5Dh/61h D B FIRMWARE IMPENDING FAILURE DRIVE ERROR RATE TOO HIGH +5Dh/62h D B FIRMWARE IMPENDING FAILURE DATA ERROR RATE TOO HIGH +5Dh/63h D B FIRMWARE IMPENDING FAILURE SEEK ERROR RATE TOO HIGH +5Dh/64h D B FIRMWARE IMPENDING FAILURE TOO MANY BLOCK REASSIGNS +5Dh/65h D B FIRMWARE IMPENDING FAILURE ACCESS TIMES TOO HIGH +5Dh/66h D B FIRMWARE IMPENDING FAILURE START UNIT TIMES TOO HIGH +5Dh/67h D B FIRMWARE IMPENDING FAILURE CHANNEL PARAMETRICS +5Dh/68h D B FIRMWARE IMPENDING FAILURE CONTROLLER DETECTED +5Dh/69h D B FIRMWARE IMPENDING FAILURE THROUGHPUT PERFORMANCE +5Dh/6Ah D B FIRMWARE IMPENDING FAILURE SEEK TIME PERFORMANCE +5Dh/6Bh D B FIRMWARE IMPENDING FAILURE SPIN-UP RETRY COUNT +5Dh/6Ch D B FIRMWARE IMPENDING FAILURE DRIVE CALIBRATION RETRY COUNT +5Dh/FFh DTLPWROMAEBKVF FAILURE PREDICTION THRESHOLD EXCEEDED (FALSE) +5Eh/00h DTLPWRO A K LOW POWER CONDITION ON +5Eh/01h DTLPWRO A K IDLE CONDITION ACTIVATED BY TIMER +5Eh/02h DTLPWRO A K STANDBY CONDITION ACTIVATED BY TIMER +5Eh/03h DTLPWRO A K IDLE CONDITION ACTIVATED BY COMMAND +5Eh/04h DTLPWRO A K STANDBY CONDITION ACTIVATED BY COMMAND +5Eh/05h DTLPWRO A K IDLE_B CONDITION ACTIVATED BY TIMER +5Eh/06h DTLPWRO A K IDLE_B CONDITION ACTIVATED BY COMMAND +5Eh/07h DTLPWRO A K IDLE_C CONDITION ACTIVATED BY TIMER +5Eh/08h DTLPWRO A K IDLE_C CONDITION ACTIVATED BY COMMAND +5Eh/09h DTLPWRO A K STANDBY_Y CONDITION ACTIVATED BY TIMER +5Eh/0Ah DTLPWRO A K STANDBY_Y CONDITION ACTIVATED BY COMMAND +5Eh/41h B POWER STATE CHANGE TO ACTIVE +5Eh/42h B POWER STATE CHANGE TO IDLE +5Eh/43h B POWER STATE CHANGE TO STANDBY +5Eh/45h B POWER STATE CHANGE TO SLEEP +5Eh/47h BK POWER STATE CHANGE TO DEVICE CONTROL +5Fh/00h +60h/00h LAMP FAILURE +61h/00h VIDEO ACQUISITION ERROR +61h/01h UNABLE TO ACQUIRE VIDEO +61h/02h OUT OF FOCUS +62h/00h SCAN HEAD POSITIONING ERROR +63h/00h R END OF USER AREA ENCOUNTERED ON THIS TRACK +63h/01h R PACKET DOES NOT FIT IN AVAILABLE SPACE +64h/00h R ILLEGAL MODE FOR THIS TRACK +64h/01h R INVALID PACKET SIZE +65h/00h DTLPWROMAEBKVF VOLTAGE FAULT +66h/00h AUTOMATIC DOCUMENT FEEDER COVER UP +66h/01h AUTOMATIC DOCUMENT FEEDER LIFT UP +66h/02h DOCUMENT JAM IN AUTOMATIC DOCUMENT FEEDER +66h/03h DOCUMENT MISS FEED AUTOMATIC IN DOCUMENT FEEDER +67h/00h A CONFIGURATION FAILURE +67h/01h A CONFIGURATION OF INCAPABLE LOGICAL UNITS FAILED +67h/02h A ADD LOGICAL UNIT FAILED +67h/03h A MODIFICATION OF LOGICAL UNIT FAILED +67h/04h A EXCHANGE OF LOGICAL UNIT FAILED +67h/05h A REMOVE OF LOGICAL UNIT FAILED +67h/06h A ATTACHMENT OF LOGICAL UNIT FAILED +67h/07h A CREATION OF LOGICAL UNIT FAILED +67h/08h A ASSIGN FAILURE OCCURRED +67h/09h A MULTIPLY ASSIGNED LOGICAL UNIT +67h/0Ah DTLPWROMAEBKVF SET TARGET PORT GROUPS COMMAND FAILED +67h/0Bh DT B ATA DEVICE FEATURE NOT ENABLED +68h/00h A LOGICAL UNIT NOT CONFIGURED +68h/01h D SUBSIDIARY LOGICAL UNIT NOT CONFIGURED +69h/00h A DATA LOSS ON LOGICAL UNIT +69h/01h A MULTIPLE LOGICAL UNIT FAILURES +69h/02h A PARITY/DATA MISMATCH +6Ah/00h A INFORMATIONAL, REFER TO LOG +6Bh/00h A STATE CHANGE HAS OCCURRED +6Bh/01h A REDUNDANCY LEVEL GOT BETTER +6Bh/02h A REDUNDANCY LEVEL GOT WORSE +6Ch/00h A REBUILD FAILURE OCCURRED +6Dh/00h A RECALCULATE FAILURE OCCURRED +6Eh/00h A COMMAND TO LOGICAL UNIT FAILED +6Fh/00h R COPY PROTECTION KEY EXCHANGE FAILURE - AUTHENTICATION FAILURE +6Fh/01h R COPY PROTECTION KEY EXCHANGE FAILURE - KEY NOT PRESENT +6Fh/02h R COPY PROTECTION KEY EXCHANGE FAILURE - KEY NOT ESTABLISHED +6Fh/03h R READ OF SCRAMBLED SECTOR WITHOUT AUTHENTICATION +6Fh/04h R MEDIA REGION CODE IS MISMATCHED TO LOGICAL UNIT REGION +6Fh/05h R DRIVE REGION MUST BE PERMANENT/REGION RESET COUNT ERROR +6Fh/06h R INSUFFICIENT BLOCK COUNT FOR BINDING NONCE RECORDING +6Fh/07h R CONFLICT IN BINDING NONCE RECORDING +70h/NNh T DECOMPRESSION EXCEPTION SHORT ALGORITHM ID OF NN +71h/00h T DECOMPRESSION EXCEPTION LONG ALGORITHM ID +72h/00h R SESSION FIXATION ERROR +72h/01h R SESSION FIXATION ERROR WRITING LEAD-IN +72h/02h R SESSION FIXATION ERROR WRITING LEAD-OUT +72h/03h R SESSION FIXATION ERROR - INCOMPLETE TRACK IN SESSION +72h/04h R EMPTY OR PARTIALLY WRITTEN RESERVED TRACK +72h/05h R NO MORE TRACK RESERVATIONS ALLOWED +72h/06h R RMZ EXTENSION IS NOT ALLOWED +72h/07h R NO MORE TEST ZONE EXTENSIONS ARE ALLOWED +73h/00h R CD CONTROL ERROR +73h/01h R POWER CALIBRATION AREA ALMOST FULL +73h/02h R POWER CALIBRATION AREA IS FULL +73h/03h R POWER CALIBRATION AREA ERROR +73h/04h R PROGRAM MEMORY AREA UPDATE FAILURE +73h/05h R PROGRAM MEMORY AREA IS FULL +73h/06h R RMA/PMA IS ALMOST FULL +73h/10h R CURRENT POWER CALIBRATION AREA ALMOST FULL +73h/11h R CURRENT POWER CALIBRATION AREA IS FULL +73h/17h R RDZ IS FULL +74h/00h T SECURITY ERROR +74h/01h T UNABLE TO DECRYPT DATA +74h/02h T UNENCRYPTED DATA ENCOUNTERED WHILE DECRYPTING +74h/03h T INCORRECT DATA ENCRYPTION KEY +74h/04h T CRYPTOGRAPHIC INTEGRITY VALIDATION FAILED +74h/05h T ERROR DECRYPTING DATA +74h/06h T UNKNOWN SIGNATURE VERIFICATION KEY +74h/07h T ENCRYPTION PARAMETERS NOT USEABLE +74h/08h DT R M E VF DIGITAL SIGNATURE VALIDATION FAILURE +74h/09h T ENCRYPTION MODE MISMATCH ON READ +74h/0Ah T ENCRYPTED BLOCK NOT RAW READ ENABLED +74h/0Bh T INCORRECT ENCRYPTION PARAMETERS +74h/0Ch DT R MAEBKV UNABLE TO DECRYPT PARAMETER LIST +74h/0Dh T ENCRYPTION ALGORITHM DISABLED +74h/10h DT R MAEBKV SA CREATION PARAMETER VALUE INVALID +74h/11h DT R MAEBKV SA CREATION PARAMETER VALUE REJECTED +74h/12h DT R MAEBKV INVALID SA USAGE +74h/21h T DATA ENCRYPTION CONFIGURATION PREVENTED +74h/30h DT R MAEBKV SA CREATION PARAMETER NOT SUPPORTED +74h/40h DT R MAEBKV AUTHENTICATION FAILED +74h/61h V EXTERNAL DATA ENCRYPTION KEY MANAGER ACCESS ERROR +74h/62h V EXTERNAL DATA ENCRYPTION KEY MANAGER ERROR +74h/63h V EXTERNAL DATA ENCRYPTION KEY NOT FOUND +74h/64h V EXTERNAL DATA ENCRYPTION REQUEST NOT AUTHORIZED +74h/6Eh T EXTERNAL DATA ENCRYPTION CONTROL TIMEOUT +74h/6Fh T EXTERNAL DATA ENCRYPTION CONTROL ERROR +74h/71h DT R M E V LOGICAL UNIT ACCESS NOT AUTHORIZED +74h/79h D SECURITY CONFLICT IN TRANSLATED DEVICE +75h/00h +76h/00h +77h/00h +78h/00h +79h/00h +7Ah/00h +7Bh/00h +7Ch/00h +7Dh/00h +7Eh/00h +7Fh/00h diff --git a/docs/develop/ports/ppc/mac/urls.txt b/docs/develop/ports/ppc/mac/urls.txt index b0cf634ba3..7e48f652d4 100644 --- a/docs/develop/ports/ppc/mac/urls.txt +++ b/docs/develop/ports/ppc/mac/urls.txt @@ -7,3 +7,5 @@ http://www.netneurotic.net/mac/openfirmware.html http://www.netbsd.org/ports/macppc/faq.html http://mail-index.netbsd.org/port-macppc/1999/03/21/0001.html http://mail-index.netbsd.org/port-macppc/1999/06/25/0006.html +http://ps-2.kev009.com/solinno.co.uk/7043-140/files/docs/ {OF,PReP} +http://www.openfirmware.org/1275/bindings/chrp/ diff --git a/docs/develop/ports/ppc/sam460ex/notes.txt b/docs/develop/ports/ppc/sam460ex/notes.txt new file mode 100644 index 0000000000..0c9827f147 --- /dev/null +++ b/docs/develop/ports/ppc/sam460ex/notes.txt @@ -0,0 +1,74 @@ +Notes on Sam460ex Haiku port -*- org -*- + +* U-Boot commands +** no-fdt no-initrd +# (seems the U-Boot input buffer is quite limited, can't paste much more on single line in minicom) +setenv ipaddr 192.168.4.100; tftpboot 0x4000000 192.168.4.2:haiku_loader_linux.ub; bootm 0x4000000 +** with FDT and tgz as initrd +setenv ipaddr 192.168.4.100 +tftpboot 0x4000000 192.168.4.2:haiku_loader_linux.ub +tftpboot 0x8000000 192.168.4.2:haiku_initrd.ub +tftpboot 0xc000000 192.168.4.2:sam460ex.dtb +fdt addr 0xc000000 +fdt header +bootm 0x4000000 0x8000000 0xc000000 plop +** for environment: +setenv booth1 'setenv ipaddr 192.168.4.100; tftpboot 0x4000000 192.168.4.2:haiku_loader_linux.ub' +setenv booth2 'tftpboot 0x8000000 192.168.4.2:haiku_initrd.ub' +setenv booth3 'tftpboot 0xc000000 192.168.4.2:sam460ex.dtb' +setenv booth4 'bootm 0x4000000 0x8000000 0xc000000 plop' +setenv booth 'run booth1; run booth2; run booth3; run booth4' +saveenv +run booth + + +* TODO U-Boot API? +** TODO move Partenope hack to proper official U-Boot API? +** TODO reserved regs? +BoardSetup +=:? +TARGET_BOOT_CCFLAGS += -ffixed-r2 -ffixed-r14 -ffixed-r29 ; +TARGET_BOOT_C++FLAGS += -ffixed-r2 -ffixed-r14 -ffixed-r29 ; + +* Other ports +** AROS port +https://www.gitorious.org/aros/aros/commits/sam460 +** Linux port +http://kernel.org/doc/ols/2003/ols2003-pages-340-350.pdf +** NetBSD +https://wiki.netbsd.org/users/rkujawa/sam4x0/ + +* PPC +** Classic +http://class.ee.iastate.edu/cpre211/labs/quickrefPPC.html +http://www.ibm.com/developerworks/library/l-ppc/ +http://www.csd.uwo.ca/~mburrel/stuff/ppc-asm.html +** Book-E +http://www.linux-kvm.org/page/PowerPC_Book_E_MMU +http://wiki.freebsd.org/powerpc/BookE +http://en.wikipedia.org/wiki/Memory_management_unit#PowerPC +** 440 +http://elinux.org/Book_E_and_PPC_440 +*** amcc 4x0 +http://c0ff33.net/drop/PPC440_UM2013.pdf +http://www.embeddeddeveloper.com/assets/processors/amcc/datasheets/PP460EX_DS2063.pdf +*** Freescale 440 (different mmu!!) +http://www.freescale.com/files/32bit/doc/white_paper/POWRPCARCPRMRM.pdf + +* FDT +http://www.denx.de/wiki/U-Boot/UBootFdtInfo +http://wiki.freebsd.org/FlattenedDeviceTree#Supporting_library_.28libfdt.29 +(see also arm docs) +** Sam440 dts +http://lxr.linux.no/linux+v3.4/arch/powerpc/boot/dts/sam440ep.dts +** Sam460ex dts: identical to amcc,Canyonlands !? +http://www.denx.de/wiki/view/DULG/Appendix#Section_13.1. + +* OF framebuffer +(not really usable from U-Boot (yet?)) +http://www.feedface.com/howto/forth.html +http://mail-index.netbsd.org/port-macppc/2004/12/13/0046.html +http://lists.freebsd.org/pipermail/svn-src-user/2012-January/004806.html +http://www.openfirmware.info/Bindings + +* TODO kdebug/disasm/ppc +http://code.google.com/p/ppcd/ diff --git a/headers/posix/signal.h b/headers/posix/signal.h index 7415cfe99c..d56cf2edfa 100644 --- a/headers/posix/signal.h +++ b/headers/posix/signal.h @@ -95,7 +95,7 @@ struct sigaction { #define SS_ONSTACK 0x1 #define SS_DISABLE 0x2 -#define MINSIGSTKSZ 4096 +#define MINSIGSTKSZ 8192 #define SIGSTKSZ 16384 /* for signals using an alternate stack */ diff --git a/headers/private/drivers/scsi_sense.h b/headers/private/drivers/scsi_sense.h new file mode 100644 index 0000000000..f4f056c62d --- /dev/null +++ b/headers/private/drivers/scsi_sense.h @@ -0,0 +1,800 @@ +/* + * Copyright 2013, Haiku, Inc. All Rights Reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Jérôme Duval + * + * Generated based on http://www.t10.org/lists/asc-num.txt 20130919 + * and http://www.t10.org/lists/2sensekey.htm + */ + + +// "standardized" error code to simplify handling of scsi errors +typedef enum { + err_act_ok, // executed successfully + err_act_retry, // failed, retry 3 times + err_act_fail, // failed, don't retry + err_act_many_retries, // failed, retry multiple times (currently 10 times) + err_act_start, // device requires a "start" command + err_act_invalid_req, // request is invalid + err_act_tur, // device requires a "test unit ready" command + err_act_rescan // device requires a rescan +} err_act; + + +typedef struct _scsi_sense_key_table +{ + uint8 key; + const char * label; + err_act action; + status_t err; +} scsi_sense_key_table; + + +scsi_sense_key_table sSCSISenseKeyTable[] = +{ + { 0x00, "No sense", err_act_ok, B_OK }, + { 0x01, "Recovered error", err_act_ok, B_OK }, + { 0x02, "Not ready", err_act_ok, B_DEV_NOT_READY }, + { 0x03, "Medium error", err_act_fail, B_DEV_RECALIBRATE_ERROR }, + { 0x04, "Hardware error", err_act_fail, B_DEV_SEEK_ERROR }, + { 0x05, "Illegal request", err_act_fail, B_DEV_INVALID_IOCTL }, + { 0x06, "Unit attention", err_act_fail, B_DEV_NOT_READY }, + { 0x07, "Data protect", err_act_fail, B_READ_ONLY_DEVICE }, + { 0x08, "Blank check", err_act_fail, B_DEV_UNREADABLE }, + { 0x09, "Vendor specific", err_act_fail, B_ERROR }, + { 0x0A, "Copy aborted", err_act_fail, B_ERROR }, + { 0x0B, "Aborted command", err_act_fail, B_CANCELED }, + { 0x0D, "Volume overflow", err_act_fail, B_DEV_SEEK_ERROR }, + { 0x0E, "Miscompare", err_act_ok, B_OK }, + { 0x0F, "Completed", err_act_ok, B_OK }, +}; + + +typedef struct _scsi_sense_asc_table +{ + unsigned short asc_ascq; + const char * label; + err_act action; + status_t err; +} scsi_sense_asc_table; + + +scsi_sense_asc_table sSCSISenseAscTable[] = +{ + { 0x0000, "No additional sense information", err_act_ok, B_OK }, // DTLPWROMAEBKVF + { 0x0001, "Filemark detected", err_act_fail, B_ERROR }, // T + { 0x0002, "End-of-partition/medium detected", err_act_fail, B_ERROR }, // T + { 0x0003, "Setmark detected", err_act_fail, B_ERROR }, // T + { 0x0004, "Beginning-of-partition/medium detected", err_act_fail, B_ERROR }, // T + { 0x0005, "End-of-data detected", err_act_fail, B_ERROR }, // TL + { 0x0006, "I/O process terminated", err_act_fail, B_ERROR }, // DTLPWROMAEBKVF + { 0x0007, "Programmable early warning detected", err_act_fail, B_ERROR }, // T + { 0x0011, "Audio play operation in progress", err_act_fail, B_DEV_NOT_READY }, // R + { 0x0012, "Audio play operation paused", err_act_ok, B_OK }, // R + { 0x0013, "Audio play operation successfully completed", err_act_ok, B_OK }, // R + { 0x0014, "Audio play operation stopped due to error", err_act_fail, B_ERROR }, // R + { 0x0015, "No current audio status to return", err_act_ok, B_OK }, // R + { 0x0016, "Operation in progress", err_act_fail, B_DEV_NOT_READY }, // DTLPWROMAEBKVF + { 0x0017, "Cleaning requested", err_act_fail, B_ERROR }, // DTL WROMAEBKVF + { 0x0018, "Erase operation in progress", err_act_fail, B_ERROR }, // T + { 0x0019, "Locate operation in progress", err_act_fail, B_ERROR }, // T + { 0x001A, "Rewind operation in progress", err_act_fail, B_ERROR }, // T + { 0x001B, "Set capacity operation in progress", err_act_fail, B_ERROR }, // T + { 0x001C, "Verify operation in progress", err_act_fail, B_ERROR }, // T + { 0x001D, "ATA pass through information available", err_act_fail, B_ERROR }, // DT B + { 0x001E, "Conflicting SA creation request", err_act_fail, B_ERROR }, // DT R MAEBKV + { 0x001F, "Logical unit transitioning to another power condition", err_act_fail, B_ERROR }, // DT B + { 0x0020, "Extended copy information available", err_act_fail, B_ERROR }, // DT P B + { 0x0100, "No index/sector signal", err_act_fail, B_ERROR }, // D W O BK + { 0x0200, "No seek complete", err_act_fail, B_ERROR }, // D WRO BK + { 0x0300, "Peripheral device write fault", err_act_fail, B_ERROR }, // DTL W O BK + { 0x0301, "No write current", err_act_fail, B_ERROR }, // T + { 0x0302, "Excessive write errors", err_act_fail, B_ERROR }, // T + { 0x0400, "Logical unit not ready, cause not reportable", err_act_fail, B_ERROR }, // DTLPWROMAEBKVF + { 0x0401, "Logical unit is in process of becoming ready", err_act_many_retries, B_DEV_NOT_READY }, // DTLPWROMAEBKVF + { 0x0402, "Logical unit not ready, initializing command required", err_act_start, B_NO_INIT }, // DTLPWROMAEBKVF + { 0x0403, "Logical unit not ready, manual intervention required", err_act_fail, B_DEV_NOT_READY }, // DTLPWROMAEBKVF + { 0x0404, "Logical unit not ready, format in progress", err_act_fail, B_DEV_NOT_READY }, // DTL RO B + { 0x0405, "Logical unit not ready, rebuild in progress", err_act_fail, B_DEV_NOT_READY }, // DT W O A BK F + { 0x0406, "Logical unit not ready, recalculation in progress", err_act_fail, B_DEV_NOT_READY }, // DT W O A BK + { 0x0407, "Logical unit not ready, operation in progress", err_act_fail, B_DEV_NOT_READY }, // DTLPWROMAEBKVF + { 0x0408, "Logical unit not ready, long write in progress", err_act_fail, B_DEV_NOT_READY }, // R + { 0x0409, "Logical unit not ready, self-test in progress", err_act_fail, B_DEV_NOT_READY }, // DTLPWROMAEBKVF + { 0x040A, "Logical unit not accessible, asymmetric access state transition", err_act_fail, B_ERROR }, // DTLPWROMAEBKVF + { 0x040B, "Logical unit not accessible, target port in standby state", err_act_fail, B_ERROR }, // DTLPWROMAEBKVF + { 0x040C, "Logical unit not accessible, target port in unavailable state", err_act_fail, B_ERROR }, // DTLPWROMAEBKVF + { 0x040D, "Logical unit not ready, structure check required", err_act_fail, B_ERROR }, // F + { 0x0410, "Logical unit not ready, auxiliary memory not accessible", err_act_fail, B_ERROR }, // DT WROM B + { 0x0411, "Logical unit not ready, notify (enable spinup) required", err_act_tur, B_DEV_NOT_READY }, // DT WRO AEB VF + { 0x0412, "Logical unit not ready, offline", err_act_fail, B_ERROR }, // M V + { 0x0413, "Logical unit not ready, SA creation in progress", err_act_fail, B_ERROR }, // DT R MAEBKV + { 0x0414, "Logical unit not ready, space allocation in progress", err_act_fail, B_ERROR }, // D B + { 0x0415, "Logical unit not ready, robotics disabled", err_act_fail, B_ERROR }, // M + { 0x0416, "Logical unit not ready, configuration required", err_act_fail, B_ERROR }, // M + { 0x0417, "Logical unit not ready, calibration required", err_act_fail, B_ERROR }, // M + { 0x0418, "Logical unit not ready, a door is open", err_act_fail, B_ERROR }, // M + { 0x0419, "Logical unit not ready, operating in sequential mode", err_act_fail, B_ERROR }, // M + { 0x041A, "Logical unit not ready, START STOP unit command in progress", err_act_fail, B_ERROR }, // D B + { 0x041B, "Logical unit not ready, sanitize in progress", err_act_fail, B_ERROR }, // D B + { 0x041C, "Logical unit not ready, additional power use not yet granted", err_act_fail, B_ERROR }, // DT MAEB + { 0x041D, "Logical unit not ready, configuration in progress", err_act_fail, B_ERROR }, // D + { 0x041E, "Logical unit not ready, microcode activation required", err_act_fail, B_ERROR }, // D + { 0x0500, "Logical unit does not respond to selection", err_act_fail, B_ERROR }, // DTL WROMAEBKVF + { 0x0600, "No reference position found", err_act_fail, B_ERROR }, // D WROM BK + { 0x0700, "Multiple peripheral devices selected", err_act_fail, B_ERROR }, // DTL WROM BK + { 0x0800, "Logical unit communication failure", err_act_fail, B_ERROR }, // DTL WROMAEBKVF + { 0x0801, "Logical unit communication time-out", err_act_fail, B_ERROR }, // DTL WROMAEBKVF + { 0x0802, "Logical unit communication parity error", err_act_fail, B_ERROR }, // DTL WROMAEBKVF + { 0x0803, "Logical unit communication CRC error (Ultra-DMA/32)", err_act_fail, B_ERROR }, // DT ROM BK + { 0x0804, "Unreachable copy target", err_act_fail, B_ERROR }, // DTLPWRO K + { 0x0900, "Track following error", err_act_fail, B_ERROR }, // DT WRO B + { 0x0901, "Tracking servo failure", err_act_fail, B_ERROR }, // WRO K + { 0x0902, "Focus servo failure", err_act_fail, B_ERROR }, // WRO K + { 0x0903, "Spindle servo failure", err_act_fail, B_ERROR }, // WRO + { 0x0904, "Head select fault", err_act_fail, B_ERROR }, // DT WRO B + { 0x0A00, "Error log overflow", err_act_fail, ENOSPC }, // DTLPWROMAEBKVF + { 0x0B00, "Warning", err_act_fail, B_ERROR }, // DTLPWROMAEBKVF + { 0x0B01, "Warning - specified temperature exceeded", err_act_fail, B_ERROR }, // DTLPWROMAEBKVF + { 0x0B02, "Warning - enclosure degraded", err_act_fail, B_ERROR }, // DTLPWROMAEBKVF + { 0x0B03, "Warning - background self-test failed", err_act_fail, B_ERROR }, // DTLPWROMAEBKVF + { 0x0B04, "Warning - background pre-scan detected medium error", err_act_fail, B_ERROR }, // DTLPWRO AEBKVF + { 0x0B05, "Warning - background medium scan detected medium error", err_act_fail, B_ERROR }, // DTLPWRO AEBKVF + { 0x0B06, "Warning - non-volatile cache now volatile", err_act_fail, B_ERROR }, // DTLPWROMAEBKVF + { 0x0B07, "Warning - degraded power to non-volatile cache", err_act_fail, B_ERROR }, // DTLPWROMAEBKVF + { 0x0B08, "Warning - power loss expected", err_act_fail, B_ERROR }, // DTLPWROMAEBKVF + { 0x0B09, "Warning - device statistics notification active", err_act_fail, B_ERROR }, // D + { 0x0C00, "Write error", err_act_fail, B_ERROR }, // T R + { 0x0C01, "Write error - recovered with auto reallocation", err_act_ok, B_OK }, // K + { 0x0C02, "Write error - auto reallocation failed", err_act_fail, B_ERROR }, // D W O BK + { 0x0C03, "Write error - recommend reassignment", err_act_fail, B_ERROR }, // D W O BK + { 0x0C04, "Compression check miscompare error", err_act_fail, B_ERROR }, // DT W O B + { 0x0C05, "Data expansion occurred during compression", err_act_fail, B_ERROR }, // DT W O B + { 0x0C06, "Block not compressible", err_act_fail, B_ERROR }, // DT W O B + { 0x0C07, "Write error - recovery needed", err_act_fail, B_ERROR }, // R + { 0x0C08, "Write error - recovery failed", err_act_fail, B_ERROR }, // R + { 0x0C09, "Write error - loss of streaming", err_act_fail, B_ERROR }, // R + { 0x0C0A, "Write error - padding blocks added", err_act_fail, B_ERROR }, // R + { 0x0C0B, "Auxiliary memory write error", err_act_fail, B_ERROR }, // DT WROM B + { 0x0C0C, "Write error - unexpected unsolicited data", err_act_fail, B_ERROR }, // DTLPWRO AEBKVF + { 0x0C0D, "Write error - not enough unsolicited data", err_act_fail, B_ERROR }, // DTLPWRO AEBKVF + { 0x0C0E, "Multiple write errors", err_act_fail, B_ERROR }, // DT W O BK + { 0x0C0F, "Defects in error window", err_act_fail, B_ERROR }, // R + { 0x0D00, "Error detected by third party temporary initiator", err_act_fail, B_ERROR }, // DTLPWRO A K + { 0x0D01, "Third party device failure", err_act_fail, B_ERROR }, // DTLPWRO A K + { 0x0D02, "Copy target device not reachable", err_act_fail, B_ERROR }, // DTLPWRO A K + { 0x0D03, "Incorrect copy target device type", err_act_fail, B_ERROR }, // DTLPWRO A K + { 0x0D04, "Copy target device data underrun", err_act_fail, B_ERROR }, // DTLPWRO A K + { 0x0D05, "Copy target device data overrun", err_act_fail, B_ERROR }, // DTLPWRO A K + { 0x0E00, "Invalid information unit", err_act_fail, B_ERROR }, // DT PWROMAEBK F + { 0x0E01, "Information unit too short", err_act_fail, B_ERROR }, // DT PWROMAEBK F + { 0x0E02, "Information unit too long", err_act_fail, B_ERROR }, // DT PWROMAEBK F + { 0x0E03, "Invalid field in command information unit", err_act_fail, B_ERROR }, // DT P R MAEBK F + { 0x1000, "ID CRC or ECC error", err_act_fail, B_ERROR }, // D W O BK + { 0x1001, "Logical block guard check failed", err_act_fail, B_ERROR }, // DT W O + { 0x1002, "Logical block application tag check failed", err_act_fail, B_ERROR }, // DT W O + { 0x1003, "Logical block reference tag check failed", err_act_fail, B_ERROR }, // DT W O + { 0x1004, "Logical block protection error on recover buffered data", err_act_fail, B_ERROR }, // T + { 0x1005, "Logical block protection method error", err_act_fail, B_ERROR }, // T + { 0x1100, "Unrecovered read error", err_act_fail, B_IO_ERROR }, // DT WRO BK + { 0x1101, "Read retries exhausted", err_act_fail, B_IO_ERROR }, // DT WRO BK + { 0x1102, "Error too long to correct", err_act_fail, B_IO_ERROR }, // DT WRO BK + { 0x1103, "Multiple read errors", err_act_fail, B_IO_ERROR }, // DT W O BK + { 0x1104, "Unrecovered read error - auto reallocate failed", err_act_fail, B_IO_ERROR }, // D W O BK + { 0x1105, "L-EC uncorrectable error", err_act_fail, B_IO_ERROR }, // WRO B + { 0x1106, "CIRC unrecovered error", err_act_fail, B_IO_ERROR }, // WRO B + { 0x1107, "Data re-synchronization error", err_act_fail, B_ERROR }, // W O B + { 0x1108, "Incomplete block read", err_act_fail, B_ERROR }, // T + { 0x1109, "No gap found", err_act_fail, B_ERROR }, // T + { 0x110A, "Miscorrected error", err_act_fail, B_ERROR }, // DT O BK + { 0x110B, "Unrecovered read error - recommend reassignment", err_act_fail, B_IO_ERROR }, // D W O BK + { 0x110C, "Unrecovered read error - recommend rewrite the data", err_act_fail, B_IO_ERROR }, // D W O BK + { 0x110D, "De-compression CRC error", err_act_fail, B_ERROR }, // DT WRO B + { 0x110E, "Cannot decompress using declared algorithm", err_act_fail, B_ERROR }, // DT WRO B + { 0x110F, "Error readingUPC/EAN number", err_act_fail, B_ERROR }, // R + { 0x1110, "Error reading ISRC number", err_act_fail, B_ERROR }, // R + { 0x1111, "Read error - loss of streaming", err_act_fail, B_ERROR }, // R + { 0x1112, "Auxiliary memory read error", err_act_fail, B_ERROR }, // DT WROM B + { 0x1113, "Read error - failed retransmission request", err_act_fail, B_ERROR }, // DTLPWRO AEBKVF + { 0x1114, "Read error - LBA marked bad by application client", err_act_fail, B_ERROR }, // D + { 0x1115, "Write after sanitize required", err_act_fail, B_ERROR }, // D + { 0x1200, "Address mark not found for ID field", err_act_fail, B_ERROR }, // D W O BK + { 0x1300, "Address mark not found for data field", err_act_fail, B_ERROR }, // D W O BK + { 0x1400, "Recorded entity not found", err_act_fail, B_ERROR }, // DTL WRO BK + { 0x1401, "Record not found", err_act_fail, B_ERROR }, // DT WRO BK + { 0x1402, "Filemark or setmark not found", err_act_fail, B_ERROR }, // T + { 0x1403, "End-of-data not found", err_act_fail, B_ERROR }, // T + { 0x1404, "Block sequence error", err_act_fail, B_ERROR }, // T + { 0x1405, "Record not found - recommend reassignment", err_act_fail, B_ERROR }, // DT W O BK + { 0x1406, "Record not found - data auto-reallocated", err_act_fail, B_ERROR }, // DT W O BK + { 0x1407, "Locate operation failure", err_act_fail, B_ERROR }, // T + { 0x1500, "Random positioning error", err_act_fail, B_ERROR }, // DTL WROM BK + { 0x1501, "Mechanical positioning error", err_act_fail, B_ERROR }, // DTL WROM BK + { 0x1502, "Positioning error detected by read of medium", err_act_fail, B_ERROR }, // DT WRO BK + { 0x1600, "Data synchronization mark error", err_act_fail, B_ERROR }, // D W O BK + { 0x1601, "Data sync error - data rewritten", err_act_fail, B_ERROR }, // D W O BK + { 0x1602, "Data sync error - recommend rewrite", err_act_fail, B_ERROR }, // D W O BK + { 0x1603, "Data sync error - data auto-reallocated", err_act_ok, B_OK }, // D W O BK + { 0x1604, "Data sync error - recommend reassignment", err_act_fail, B_ERROR }, // D W O BK + { 0x1700, "Recovered data with no error correction applied", err_act_ok, B_OK }, // DT WRO BK + { 0x1701, "Recovered data with retries", err_act_ok, B_OK }, // DT WRO BK + { 0x1702, "Recovered data with positive head offset", err_act_ok, B_OK }, // DT WRO BK + { 0x1703, "Recovered data with negative head offset", err_act_ok, B_OK }, // DT WRO BK + { 0x1704, "Recovered data with retries and/or CIRC applied", err_act_ok, B_OK }, // WRO B + { 0x1705, "Recovered data using previous sector ID", err_act_ok, B_OK }, // D WRO BK + { 0x1706, "Recovered data without ECC - data auto-reallocated", err_act_ok, B_OK }, // D W O BK + { 0x1707, "Recovered data without ECC - recommend reassignment", err_act_ok, B_OK }, // D WRO BK + { 0x1708, "Recovered data without ECC - recommend rewrite", err_act_ok, B_OK }, // D WRO BK + { 0x1709, "Recovered data without ECC - data rewritten", err_act_ok, B_OK }, // D WRO BK + { 0x1800, "Recovered data with error correction applied", err_act_ok, B_OK }, // DT WRO BK + { 0x1801, "Recovered data with error corr. & retries applied", err_act_ok, B_OK }, // D WRO BK + { 0x1802, "Recovered data - data auto-reallocated", err_act_ok, B_OK }, // D WRO BK + { 0x1803, "Recovered data with CIRC", err_act_ok, B_OK }, // R + { 0x1804, "Recovered data with l-EC", err_act_ok, B_OK }, // R + { 0x1805, "Recovered data - recommend reassignment", err_act_ok, B_OK }, // D WRO BK + { 0x1806, "Recovered data - recommend rewrite", err_act_ok, B_OK }, // D WRO BK + { 0x1807, "Recovered data with ECC - data rewritten", err_act_ok, B_OK }, // D W O BK + { 0x1808, "Recovered data with linking", err_act_fail, B_ERROR }, // R + { 0x1900, "Defect list error", err_act_fail, B_ERROR }, // D O K + { 0x1901, "Defect list not available", err_act_fail, B_ERROR }, // D O K + { 0x1902, "Defect list error in primary list", err_act_fail, B_ERROR }, // D O K + { 0x1903, "Defect list error in grown list", err_act_fail, B_ERROR }, // D O K + { 0x1A00, "Parameter list length error", err_act_fail, B_ERROR }, // DTLPWROMAEBKVF + { 0x1B00, "Synchronous data transfer error", err_act_fail, B_ERROR }, // DTLPWROMAEBKVF + { 0x1C00, "Defect list not found", err_act_fail, B_ERROR }, // D O BK + { 0x1C01, "Primary defect list not found", err_act_fail, B_ERROR }, // D O BK + { 0x1C02, "Grown defect list not found", err_act_fail, B_ERROR }, // D O BK + { 0x1D00, "Miscompare during verify operation", err_act_fail, B_ERROR }, // DT WRO BK + { 0x1D01, "Miscompare verify of unmapped LBA", err_act_fail, B_ERROR }, // D B + { 0x1E00, "Recovered ID with ECC correction", err_act_ok, B_OK }, // D W O BK + { 0x1F00, "Partial defect list transfer", err_act_fail, B_ERROR }, // D O K + { 0x2000, "Invalid command operation code", err_act_fail, B_DEV_INVALID_IOCTL }, // DTLPWROMAEBKVF + { 0x2001, "Access denied - initiator pending-enrolled", err_act_fail, B_ERROR }, // DT PWROMAEBK + { 0x2002, "Access denied - no access rights", err_act_fail, B_ERROR }, // DT PWROMAEBK + { 0x2003, "Access denied - invalid mgmt ID key", err_act_fail, B_ERROR }, // DT PWROMAEBK + { 0x2004, "Illegal command while in write capable state", err_act_fail, B_ERROR }, // T + { 0x2005, "Obsolete", err_act_fail, B_ERROR }, // T + { 0x2006, "Illegal command while in explicit address mode", err_act_fail, B_ERROR }, // T + { 0x2007, "Illegal command while in implicit address mode", err_act_fail, B_ERROR }, // T + { 0x2008, "Access denied - enrollment conflict", err_act_fail, B_ERROR }, // DT PWROMAEBK + { 0x2009, "Access denied - invalid LU identifier", err_act_fail, B_ERROR }, // DT PWROMAEBK + { 0x200A, "Access denied - invalid proxy token", err_act_fail, B_ERROR }, // DT PWROMAEBK + { 0x200B, "Access denied - ACL LUN conflict", err_act_fail, B_ERROR }, // DT PWROMAEBK + { 0x200C, "Illegal command when not in append-only mode", err_act_fail, B_DEV_INVALID_IOCTL }, // T + { 0x2100, "Logical block address out of range", err_act_fail, B_BAD_VALUE }, // DT WRO BK + { 0x2101, "Invalid element address", err_act_fail, B_BAD_VALUE }, // DT WROM BK + { 0x2102, "Invalid address for write", err_act_fail, B_ERROR }, // R + { 0x2103, "Invalid write crossing layer jump", err_act_fail, B_ERROR }, // R + { 0x2200, "Illegal function (use 20 00, 24 00, or 26 00)", err_act_fail, B_DEV_INVALID_IOCTL }, // D + { 0x2300, "Invalid token operation, cause not reportable", err_act_fail, B_ERROR }, // DT P B + { 0x2301, "Invalid token operation, unsupported token type", err_act_fail, B_ERROR }, // DT P B + { 0x2302, "Invalid token operation, remote token usage not supported", err_act_fail, B_ERROR }, // DT P B + { 0x2303, "Invalid token operation, remote ROD token creation not supported", err_act_fail, B_ERROR }, // DT P B + { 0x2304, "Invalid token operation, token unknown", err_act_fail, B_ERROR }, // DT P B + { 0x2305, "Invalid token operation, token corrupt", err_act_fail, B_ERROR }, // DT P B + { 0x2306, "Invalid token operation, token revoked", err_act_fail, B_ERROR }, // DT P B + { 0x2307, "Invalid token operation, token expired", err_act_fail, B_ERROR }, // DT P B + { 0x2308, "Invalid token operation, token cancelled", err_act_fail, B_ERROR }, // DT P B + { 0x2309, "Invalid token operation, token deleted", err_act_fail, B_ERROR }, // DT P B + { 0x230A, "Invalid token operation, invalid token length", err_act_fail, B_ERROR }, // DT P B + { 0x2400, "Invalid field in CDB", err_act_fail, B_BAD_VALUE }, // DTLPWROMAEBKVF + { 0x2401, "CDB decryption error", err_act_fail, B_ERROR }, // DTLPWRO AEBKVF + { 0x2402, "Obsolete", err_act_fail, B_ERROR }, // T + { 0x2403, "Obsolete", err_act_fail, B_ERROR }, // T + { 0x2404, "Security audit value frozen", err_act_fail, B_ERROR }, // F + { 0x2405, "Security working key frozen", err_act_fail, B_ERROR }, // F + { 0x2406, "NONCE not unique", err_act_fail, B_ERROR }, // F + { 0x2407, "NONCE timestamp out of range", err_act_fail, B_ERROR }, // F + { 0x2408, "Invalid XCDB", err_act_fail, B_ERROR }, // DT R MAEBKV + { 0x2500, "Logical unit not supported", err_act_fail, ENXIO }, // DTLPWROMAEBKVF + { 0x2600, "Invalid field in parameter list", err_act_fail, B_BAD_VALUE }, // DTLPWROMAEBKVF + { 0x2601, "Parameter not supported", err_act_fail, B_BAD_VALUE }, // DTLPWROMAEBKVF + { 0x2602, "Parameter value invalid", err_act_fail, B_BAD_VALUE }, // DTLPWROMAEBKVF + { 0x2603, "Threshold parameters not supported", err_act_fail, B_BAD_VALUE }, // DTLPWROMAE K + { 0x2604, "Invalid release of persistent reservation", err_act_fail, B_BAD_VALUE }, // DTLPWROMAEBKVF + { 0x2605, "Data decryption error", err_act_fail, B_ERROR }, // DTLPWRO A BK + { 0x2606, "Too many target descriptors", err_act_fail, B_ERROR }, // DTLPWRO K + { 0x2607, "Unsupported target descriptor type code", err_act_fail, B_ERROR }, // DTLPWRO K + { 0x2608, "Too many segment descriptors", err_act_fail, B_ERROR }, // DTLPWRO K + { 0x2609, "Unsupported segment descriptor type code", err_act_fail, B_ERROR }, // DTLPWRO K + { 0x260A, "Unexpected inexact segment", err_act_fail, B_ERROR }, // DTLPWRO K + { 0x260B, "Inline data length exceeded", err_act_fail, B_ERROR }, // DTLPWRO K + { 0x260C, "Invalid operation for copy source or destination", err_act_fail, B_ERROR }, // DTLPWRO K + { 0x260D, "Copy segment granularity violation", err_act_fail, B_ERROR }, // DTLPWRO K + { 0x260E, "Invalid parameter while port is enabled", err_act_fail, B_ERROR }, // DT PWROMAEBK + { 0x260F, "Invalid data-out buffer integrity check value", err_act_fail, B_ERROR }, // F + { 0x2610, "Data decryption key fail limit reached", err_act_fail, B_ERROR }, // T + { 0x2611, "Incomplete key-associated data set", err_act_fail, B_ERROR }, // T + { 0x2612, "Vendor specific key reference not found", err_act_fail, B_ERROR }, // T + { 0x2700, "Write protected", err_act_fail, B_READ_ONLY_DEVICE }, // DT WRO BK + { 0x2701, "Hardware write protected", err_act_fail, B_READ_ONLY_DEVICE }, // DT WRO BK + { 0x2702, "Logical unit software write protected", err_act_fail, B_READ_ONLY_DEVICE }, // DT WRO BK + { 0x2703, "Associated write protect", err_act_fail, B_READ_ONLY_DEVICE }, // T R + { 0x2704, "Persistent write protect", err_act_fail, B_READ_ONLY_DEVICE }, // T R + { 0x2705, "Permanent write protect", err_act_fail, B_READ_ONLY_DEVICE }, // T R + { 0x2706, "Conditional write protect", err_act_fail, B_READ_ONLY_DEVICE }, // R F + { 0x2707, "Space allocation failed write protect", err_act_fail, B_READ_ONLY_DEVICE }, // D B + { 0x2800, "Not ready to ready change, medium may have changed", err_act_fail, B_DEV_MEDIA_CHANGED }, // DTLPWROMAEBKVF + { 0x2801, "Import or export element accessed", err_act_fail, ENXIO }, // DT WROM B + { 0x2802, "Format-layer may have changed", err_act_fail, B_DEV_MEDIA_CHANGED }, // R + { 0x2803, "Import/export element accessed, medium changed", err_act_fail, B_ERROR }, // M + { 0x2900, "Power on, reset, or bus device reset occurred", err_act_retry, B_DEV_NOT_READY }, // DTLPWROMAEBKVF + { 0x2901, "Power on occurred", err_act_fail, B_ERROR }, // DTLPWROMAEBKVF + { 0x2902, "SCSI bus reset occurred", err_act_fail, B_ERROR }, // DTLPWROMAEBKVF + { 0x2903, "Bus device reset function occurred", err_act_fail, B_ERROR }, // DTLPWROMAEBKVF + { 0x2904, "Device internal reset", err_act_fail, B_ERROR }, // DTLPWROMAEBKVF + { 0x2905, "Transceiver mode changed to single-ended", err_act_fail, B_ERROR }, // DTLPWROMAEBKVF + { 0x2906, "Transceiver mode changed to LVD", err_act_fail, B_ERROR }, // DTLPWROMAEBKVF + { 0x2907, "I_T nexus loss occurred", err_act_fail, B_ERROR }, // DTLPWROMAEBKVF + { 0x2A00, "Parameters changed", err_act_fail, B_ERROR }, // DTL WROMAEBKVF + { 0x2A01, "Mode parameters changed", err_act_fail, B_ERROR }, // DTL WROMAEBKVF + { 0x2A02, "Log parameters changed", err_act_fail, B_ERROR }, // DTL WROMAE K + { 0x2A03, "Reservations preempted", err_act_fail, B_ERROR }, // DTLPWROMAE K + { 0x2A04, "Reservations released", err_act_fail, B_ERROR }, // DTLPWROMAE + { 0x2A05, "Registrations preempted", err_act_fail, B_ERROR }, // DTLPWROMAE + { 0x2A06, "Asymmetric access state changed", err_act_fail, B_ERROR }, // DTLPWROMAEBKVF + { 0x2A07, "Implicit asymmetric access state transition failed", err_act_fail, B_ERROR }, // DTLPWROMAEBKVF + { 0x2A08, "Priority changed", err_act_fail, B_ERROR }, // DT WROMAEBKVF + { 0x2A09, "Capacity data has changed", err_act_fail, B_ERROR }, // D + { 0x2A0A, "Error history I_T nexus cleared", err_act_fail, B_ERROR }, // DT + { 0x2A0B, "Error history snapshot released", err_act_fail, B_ERROR }, // DT + { 0x2A0C, "Error recovery attributes have changed", err_act_fail, B_ERROR }, // F + { 0x2A0D, "Data encryption capabilities changed", err_act_fail, B_ERROR }, // T + { 0x2A10, "Timestamp changed", err_act_fail, B_ERROR }, // DT M E V + { 0x2A11, "Data encryption parameters changed by another I_T nexus", err_act_fail, B_ERROR }, // T + { 0x2A12, "Data encryption parameters changed by vendor specific event", err_act_fail, B_ERROR }, // T + { 0x2A13, "Data encryption key instance counter has changed", err_act_fail, B_ERROR }, // T + { 0x2A14, "SA creation capabilities data has changed", err_act_fail, B_ERROR }, // DT R MAEBKV + { 0x2A15, "Medium removal prevention preempted", err_act_fail, B_ERROR }, // T M V + { 0x2B00, "Copy cannot execute since host cannot disconnect", err_act_fail, B_ERROR }, // DTLPWRO K + { 0x2C00, "Command sequence error", err_act_fail, B_ERROR }, // DTLPWROMAEBKVF + { 0x2C01, "Too many windows specified", err_act_fail, B_ERROR }, // + { 0x2C02, "Invalid combination of windows specified", err_act_fail, B_ERROR }, // + { 0x2C03, "Current program area is not empty", err_act_fail, B_ERROR }, // R + { 0x2C04, "Current program area is empty", err_act_fail, B_ERROR }, // R + { 0x2C05, "Illegal power condition request", err_act_fail, B_ERROR }, // B + { 0x2C06, "Persistent prevent conflict", err_act_fail, B_ERROR }, // R + { 0x2C07, "Previous busy status", err_act_fail, B_ERROR }, // DTLPWROMAEBKVF + { 0x2C08, "Previous task set full status", err_act_fail, B_ERROR }, // DTLPWROMAEBKVF + { 0x2C09, "Previous reservation conflict status", err_act_fail, B_ERROR }, // DTLPWROM EBKVF + { 0x2C0A, "Partition or collection contains user objects", err_act_fail, B_ERROR }, // F + { 0x2C0B, "Not reserved", err_act_fail, B_ERROR }, // T + { 0x2C0C, "ORWRITE generation does not match", err_act_fail, B_ERROR }, // D + { 0x2D00, "Overwrite error on update in place", err_act_fail, B_ERROR }, // T + { 0x2E00, "Insufficient time for operation", err_act_fail, B_ERROR }, // D WROM B + { 0x2E01, "Command timeout before processing", err_act_fail, B_ERROR }, // D W OM B + { 0x2E02, "Command timeout during processing", err_act_fail, B_ERROR }, // D W OM B + { 0x2E03, "Command timeout during processing due to error recovery", err_act_fail, B_ERROR }, // D W OM B + { 0x2F00, "Commands cleared by another initiator", err_act_fail, B_ERROR }, // DTLPWROMAEBKVF + { 0x2F01, "Commands cleared by power loss notification", err_act_fail, B_ERROR }, // D + { 0x2F02, "Commands cleared by device server", err_act_fail, B_ERROR }, // DTLPWROMAEBKVF + { 0x2F03, "Some commands cleared by queuing layer event", err_act_fail, B_ERROR }, // DTLPWROMAEBKVF + { 0x3000, "Incompatible medium installed", err_act_fail, B_ERROR }, // DT WROM BK + { 0x3001, "Cannot read medium - unknown format", err_act_fail, B_ERROR }, // DT WRO BK + { 0x3002, "Cannot read medium - incompatible format", err_act_fail, B_ERROR }, // DT WRO BK + { 0x3003, "Cleaning cartridge installed", err_act_fail, B_ERROR }, // DT R M K + { 0x3004, "Cannot write medium - unknown format", err_act_fail, B_ERROR }, // DT WRO BK + { 0x3005, "Cannot write medium - incompatible format", err_act_fail, B_ERROR }, // DT WRO BK + { 0x3006, "Cannot format medium - incompatible medium", err_act_fail, B_ERROR }, // DT WRO B + { 0x3007, "Cleaning failure", err_act_fail, B_ERROR }, // DTL WROMAEBKVF + { 0x3008, "Cannot write - application code mismatch", err_act_fail, B_ERROR }, // R + { 0x3009, "Current session not fixated for append", err_act_fail, B_ERROR }, // R + { 0x300A, "Cleaning request rejected", err_act_fail, B_ERROR }, // DT WRO AEBK + { 0x300C, "WORM medium - overwrite attempted", err_act_fail, B_ERROR }, // T + { 0x300D, "WORM medium - integrity check", err_act_fail, B_ERROR }, // T + { 0x3010, "Medium not formatted", err_act_fail, B_ERROR }, // R + { 0x3011, "Incompatible volume type", err_act_fail, B_ERROR }, // M + { 0x3012, "Incompatible volume qualifier", err_act_fail, B_ERROR }, // M + { 0x3013, "Cleaning volume expired", err_act_fail, B_ERROR }, // M + { 0x3100, "Medium format corrupted", err_act_fail, B_ERROR }, // DT WRO BK + { 0x3101, "Format command failed", err_act_fail, B_ERROR }, // D L RO B + { 0x3102, "Zoned formatting failed due to spare linking", err_act_fail, B_ERROR }, // R + { 0x3103, "SANITIZE command failed", err_act_fail, B_ERROR }, // D B + { 0x3200, "No defect spare location available", err_act_fail, B_ERROR }, // D W O BK + { 0x3201, "Defect list update failure", err_act_fail, B_ERROR }, // D W O BK + { 0x3300, "Tape length error", err_act_fail, B_ERROR }, // T + { 0x3400, "Enclosure failure", err_act_fail, B_ERROR }, // DTLPWROMAEBKVF + { 0x3500, "Enclosure services failure", err_act_fail, B_ERROR }, // DTLPWROMAEBKVF + { 0x3501, "Unsupported enclosure function", err_act_fail, B_ERROR }, // DTLPWROMAEBKVF + { 0x3502, "Enclosure services unavailable", err_act_fail, B_ERROR }, // DTLPWROMAEBKVF + { 0x3503, "Enclosure services transfer failure", err_act_fail, B_ERROR }, // DTLPWROMAEBKVF + { 0x3504, "Enclosure services transfer refused", err_act_fail, B_ERROR }, // DTLPWROMAEBKVF + { 0x3505, "Enclosure services checksum error", err_act_fail, B_ERROR }, // DTL WROMAEBKVF + { 0x3600, "Ribbon, ink, or toner failure", err_act_fail, B_ERROR }, // L + { 0x3700, "Rounded parameter", err_act_fail, B_ERROR }, // DTL WROMAEBKVF + { 0x3800, "Event status notification", err_act_fail, B_ERROR }, // B + { 0x3802, "ESN - power management class event", err_act_fail, B_ERROR }, // B + { 0x3804, "ESN - media class event", err_act_fail, B_ERROR }, // B + { 0x3806, "ESN - device busy class event", err_act_fail, B_ERROR }, // B + { 0x3807, "Thin provisioning soft threshold reached", err_act_fail, B_ERROR }, // D + { 0x3900, "Saving parameters not supported", err_act_fail, B_ERROR }, // DTL WROMAE K + { 0x3A00, "Medium not present", err_act_fail, B_DEV_NO_MEDIA }, // DTL WROM BK + { 0x3A01, "Medium not present - tray closed", err_act_fail, B_DEV_NO_MEDIA }, // DT WROM BK + { 0x3A02, "Medium not present - tray open", err_act_fail, B_DEV_NO_MEDIA }, // DT WROM BK + { 0x3A03, "Medium not present - loadable", err_act_fail, B_DEV_NO_MEDIA }, // DT WROM B + { 0x3A04, "Medium not present - medium auxiliary memory accessible", err_act_fail, B_DEV_NO_MEDIA }, // DT WRO B + { 0x3B00, "Sequential positioning error", err_act_fail, B_ERROR }, // TL + { 0x3B01, "Tape position error at beginning-of-medium", err_act_fail, B_ERROR }, // T + { 0x3B02, "Tape position error at end-of-medium", err_act_fail, B_ERROR }, // T + { 0x3B03, "Tape or electronic vertical forms unit not ready", err_act_fail, B_ERROR }, // L + { 0x3B04, "Slew failure", err_act_fail, B_ERROR }, // L + { 0x3B05, "Paper jam", err_act_fail, B_ERROR }, // L + { 0x3B06, "Failed to sense top-of-form", err_act_fail, B_ERROR }, // L + { 0x3B07, "Failed to sense bottom-of-form", err_act_fail, B_ERROR }, // L + { 0x3B08, "Reposition error", err_act_fail, B_ERROR }, // T + { 0x3B09, "Read past end of medium", err_act_fail, B_ERROR }, // + { 0x3B0A, "Read past beginning of medium", err_act_fail, B_ERROR }, // + { 0x3B0B, "Position past end of medium", err_act_fail, B_ERROR }, // + { 0x3B0C, "Position past beginning of medium", err_act_fail, B_ERROR }, // T + { 0x3B0D, "Medium destination element full", err_act_fail, B_DEVICE_FULL }, // DT WROM BK + { 0x3B0E, "Medium source element empty", err_act_fail, B_ERROR }, // DT WROM BK + { 0x3B0F, "End of medium reached", err_act_fail, B_ERROR }, // R + { 0x3B11, "Medium magazine not accessible", err_act_fail, B_ERROR }, // DT WROM BK + { 0x3B12, "Medium magazine removed", err_act_fail, B_ERROR }, // DT WROM BK + { 0x3B13, "Medium magazine inserted", err_act_fail, B_ERROR }, // DT WROM BK + { 0x3B14, "Medium magazine locked", err_act_fail, B_ERROR }, // DT WROM BK + { 0x3B15, "Medium magazine unlocked", err_act_fail, B_ERROR }, // DT WROM BK + { 0x3B16, "Mechanical positioning or changer error", err_act_fail, B_ERROR }, // R + { 0x3B17, "Read past end of user object", err_act_fail, B_ERROR }, // F + { 0x3B18, "Element disabled", err_act_fail, B_ERROR }, // M + { 0x3B19, "Element enabled", err_act_fail, B_ERROR }, // M + { 0x3B1A, "Data transfer device removed", err_act_fail, B_ERROR }, // M + { 0x3B1B, "Data transfer device inserted", err_act_fail, B_ERROR }, // M + { 0x3B1C, "Too many logical objects on partition to support operation", err_act_fail, B_ERROR }, // T + { 0x3D00, "Invalid bits in IDENTIFY message", err_act_fail, B_ERROR }, // DTLPWROMAE K + { 0x3E00, "Logical unit has not self-configured yet", err_act_fail, B_ERROR }, // DTLPWROMAEBKVF + { 0x3E01, "Logical unit failure", err_act_fail, B_ERROR }, // DTLPWROMAEBKVF + { 0x3E02, "Timeout on logical unit", err_act_fail, B_ERROR }, // DTLPWROMAEBKVF + { 0x3E03, "Logical unit failed self-test", err_act_fail, B_ERROR }, // DTLPWROMAEBKVF + { 0x3E04, "Logical unit unable to update self-test log", err_act_fail, B_ERROR }, // DTLPWROMAEBKVF + { 0x3F00, "Target operating conditions have changed", err_act_fail, B_ERROR }, // DTLPWROMAEBKVF + { 0x3F01, "Microcode has been changed", err_act_fail, B_ERROR }, // DTLPWROMAEBKVF + { 0x3F02, "Changed operating definition", err_act_fail, B_ERROR }, // DTLPWROM BK + { 0x3F03, "INQUIRY data has changed", err_act_fail, B_ERROR }, // DTLPWROMAEBKVF + { 0x3F04, "Component device attached", err_act_fail, B_ERROR }, // DT WROMAEBK + { 0x3F05, "Device identifier changed", err_act_fail, B_ERROR }, // DT WROMAEBK + { 0x3F06, "Redundancy group created or modified", err_act_fail, B_ERROR }, // DT WROMAEB + { 0x3F07, "Redundancy group deleted", err_act_fail, B_ERROR }, // DT WROMAEB + { 0x3F08, "Spare created or modified", err_act_fail, B_ERROR }, // DT WROMAEB + { 0x3F09, "Spare deleted", err_act_fail, B_ERROR }, // DT WROMAEB + { 0x3F0A, "Volume set created or modified", err_act_fail, B_ERROR }, // DT WROMAEBK + { 0x3F0B, "Volume set deleted", err_act_fail, B_ERROR }, // DT WROMAEBK + { 0x3F0C, "Volume set deassigned", err_act_fail, B_ERROR }, // DT WROMAEBK + { 0x3F0D, "Volume set reassigned", err_act_fail, B_ERROR }, // DT WROMAEBK + { 0x3F0E, "Reported LUNs data has changed", err_act_rescan, B_ERROR }, // DTLPWROMAE + { 0x3F0F, "Echo buffer overwritten", err_act_fail, B_ERROR }, // DTLPWROMAEBKVF + { 0x3F10, "Medium loadable", err_act_fail, B_ERROR }, // DT WROM B + { 0x3F11, "Medium auxiliary memory accessible", err_act_fail, B_ERROR }, // DT WROM B + { 0x3F12, "iSCSI IP address added", err_act_fail, B_ERROR }, // DTLPWR MAEBK F + { 0x3F13, "iSCSI IP address removed", err_act_fail, B_ERROR }, // DTLPWR MAEBK F + { 0x3F14, "iSCSI IP address changed", err_act_fail, B_ERROR }, // DTLPWR MAEBK F + { 0x3F15, "Inspect referrals sense descriptors", err_act_fail, B_ERROR }, // DTLPWR MAEBK + { 0x4000, "RAM failure", err_act_fail, B_ERROR }, // D + { 0x40ff, "Diagnostic failure on component ID ASQ", err_act_fail, B_ERROR }, // DTLPWROMAEBKVF + { 0x4100, "Data path failure", err_act_fail, B_ERROR }, // D + { 0x4200, "Power-on or self-test failure", err_act_fail, B_ERROR }, // D + { 0x4300, "Message error", err_act_fail, B_ERROR }, // DTLPWROMAEBKVF + { 0x4400, "Internal target failure", err_act_fail, B_ERROR }, // DTLPWROMAEBKVF + { 0x4401, "Persistent reservation information lost", err_act_fail, B_ERROR }, // DT P MAEBKVF + { 0x4471, "ATA device failed set features", err_act_fail, B_ERROR }, // DT B + { 0x4500, "Select or reselect failure", err_act_fail, B_ERROR }, // DTLPWROMAEBKVF + { 0x4600, "Unsuccessful soft reset", err_act_fail, B_ERROR }, // DTLPWROM BK + { 0x4700, "SCSI parity error", err_act_fail, B_ERROR }, // DTLPWROMAEBKVF + { 0x4701, "Data phase CRC error detected", err_act_fail, B_ERROR }, // DTLPWROMAEBKVF + { 0x4702, "SCSI parity error detected during ST data phase", err_act_fail, B_ERROR }, // DTLPWROMAEBKVF + { 0x4703, "Information unit iuCRC error detected", err_act_fail, B_ERROR }, // DTLPWROMAEBKVF + { 0x4704, "Asynchronous information protection error detected", err_act_fail, B_ERROR }, // DTLPWROMAEBKVF + { 0x4705, "Protocol service CRC error", err_act_fail, B_ERROR }, // DTLPWROMAEBKVF + { 0x4706, "PHY test function in progress", err_act_fail, B_ERROR }, // DT MAEBKVF + { 0x477F, "Some commands cleared by iSCSI protocol event", err_act_fail, B_ERROR }, // DT PWROMAEBK + { 0x4800, "Initiator detected error message received", err_act_fail, B_ERROR }, // DTLPWROMAEBKVF + { 0x4900, "Invalid message error", err_act_fail, B_ERROR }, // DTLPWROMAEBKVF + { 0x4A00, "Command phase error", err_act_fail, B_ERROR }, // DTLPWROMAEBKVF + { 0x4B00, "Data phase error", err_act_fail, B_ERROR }, // DTLPWROMAEBKVF + { 0x4B01, "Invalid target port transfer tag received", err_act_fail, B_ERROR }, // DT PWROMAEBK + { 0x4B02, "Too much write data", err_act_fail, B_ERROR }, // DT PWROMAEBK + { 0x4B03, "ACK/NAK timeout", err_act_fail, B_ERROR }, // DT PWROMAEBK + { 0x4B04, "NAK received", err_act_fail, B_ERROR }, // DT PWROMAEBK + { 0x4B05, "Data offset error", err_act_fail, B_ERROR }, // DT PWROMAEBK + { 0x4B06, "Initiator response timeout", err_act_fail, B_ERROR }, // DT PWROMAEBK + { 0x4B07, "Connection lost", err_act_fail, B_ERROR }, // DT PWROMAEBK F + { 0x4B08, "Data-in buffer overflow - data buffer size", err_act_fail, B_ERROR }, // DT PWROMAEBK F + { 0x4B09, "Data-in buffer overflow - data buffer descriptor area", err_act_fail, B_ERROR }, // DT PWROMAEBK F + { 0x4B0A, "Data-in buffer error", err_act_fail, B_ERROR }, // DT PWROMAEBK F + { 0x4B0B, "Data-out buffer overflow - data buffer size", err_act_fail, B_ERROR }, // DT PWROMAEBK F + { 0x4B0C, "Data-out buffer overflow - data buffer descriptor area", err_act_fail, B_ERROR }, // DT PWROMAEBK F + { 0x4B0D, "Data-out buffer error", err_act_fail, B_ERROR }, // DT PWROMAEBK F + { 0x4B0E, "PCIe fabric error", err_act_fail, B_ERROR }, // DT PWROMAEBK F + { 0x4B0F, "PCIe completion timeout", err_act_fail, B_ERROR }, // DT PWROMAEBK F + { 0x4B10, "PCIe completer abort", err_act_fail, B_ERROR }, // DT PWROMAEBK F + { 0x4B11, "PCIe poisoned TLP received", err_act_fail, B_ERROR }, // DT PWROMAEBK F + { 0x4B12, "PCIe eCRC check failed", err_act_fail, B_ERROR }, // DT PWROMAEBK F + { 0x4B13, "PCIe unsupported request", err_act_fail, B_ERROR }, // DT PWROMAEBK F + { 0x4B14, "PCIe ACS violation", err_act_fail, B_ERROR }, // DT PWROMAEBK F + { 0x4B15, "PCIe TLP prefix blocked", err_act_fail, B_ERROR }, // DT PWROMAEBK F + { 0x4C00, "Logical unit failed self-configuration", err_act_fail, B_ERROR }, // DTLPWROMAEBKVF + { 0x4DFF, "Tagged overlapped commands ASQ", err_act_fail, B_ERROR }, // DTLPWROMAEBKVF + { 0x4E00, "Overlapped commands attempted", err_act_fail, B_ERROR }, // DTLPWROMAEBKVF + { 0x5000, "Write append error", err_act_fail, B_ERROR }, // T + { 0x5001, "Write append position error", err_act_fail, B_ERROR }, // T + { 0x5002, "Position error related to timing", err_act_fail, B_ERROR }, // T + { 0x5100, "Erase failure", err_act_fail, B_ERROR }, // T RO + { 0x5101, "Erase failure - incomplete erase operation detected", err_act_fail, B_ERROR }, // R + { 0x5200, "Cartridge fault", err_act_fail, B_ERROR }, // T + { 0x5300, "Media load or eject failed", err_act_fail, B_ERROR }, // DTL WROM BK + { 0x5301, "Unload tape failure", err_act_fail, B_ERROR }, // T + { 0x5302, "Medium removal prevented", err_act_fail, B_ERROR }, // DT WROM BK + { 0x5303, "Medium removal prevented by data transfer element", err_act_fail, B_ERROR }, // M + { 0x5304, "Medium thread or unthread failure", err_act_fail, B_ERROR }, // T + { 0x5305, "Volume identifier invalid", err_act_fail, B_ERROR }, // M + { 0x5306, "Volume identifier missing", err_act_fail, B_ERROR }, // M + { 0x5307, "Duplicate volume identifier", err_act_fail, B_ERROR }, // M + { 0x5308, "Element status unknown", err_act_fail, B_ERROR }, // M + { 0x5400, "SCSI to host system interface failure", err_act_fail, B_ERROR }, // P + { 0x5500, "System resource failure", err_act_fail, B_ERROR }, // P + { 0x5501, "System buffer full", err_act_fail, B_DEVICE_FULL }, // D O BK + { 0x5502, "Insufficient reservation resources", err_act_fail, B_ERROR }, // DTLPWROMAE K + { 0x5503, "Insufficient resources", err_act_fail, B_ERROR }, // DTLPWROMAE K + { 0x5504, "Insufficient registration resources", err_act_fail, B_ERROR }, // DTLPWROMAE K + { 0x5505, "Insufficient access control resources", err_act_fail, B_ERROR }, // DT PWROMAEBK + { 0x5506, "Auxiliary memory out of space", err_act_fail, B_ERROR }, // DT WROM B + { 0x5507, "Quota error", err_act_fail, B_ERROR }, // F + { 0x5508, "Maximum number of supplemental decryption keys exceeded", err_act_fail, B_ERROR }, // T + { 0x5509, "Medium auxiliary memory not accessible", err_act_fail, B_ERROR }, // M + { 0x550A, "Data currently unavailable", err_act_fail, B_ERROR }, // M + { 0x550B, "Insufficient power for operation", err_act_fail, B_ERROR }, // DTLPWROMAEBKVF + { 0x550C, "Insufficient resources to create ROD", err_act_fail, B_ERROR }, // DT P B + { 0x550D, "Insufficient resources to create ROD token", err_act_fail, B_ERROR }, // DT P B + { 0x5700, "Unable to recover table-of-contents", err_act_fail, B_ERROR }, // R + { 0x5800, "Generation does not exist", err_act_fail, B_ERROR }, // O + { 0x5900, "Updated block read", err_act_fail, B_ERROR }, // O + { 0x5A00, "Operator request or state change input", err_act_fail, B_ERROR }, // DTLPWRO BK + { 0x5A01, "Operator medium removal request", err_act_retry, B_DEV_MEDIA_CHANGE_REQUESTED }, // DT WROM BK + { 0x5A02, "Operator selected write protect", err_act_fail, B_ERROR }, // DT WRO A BK + { 0x5A03, "Operator selected write permit", err_act_fail, B_ERROR }, // DT WRO A BK + { 0x5B00, "Log exception", err_act_fail, B_ERROR }, // DTLPWROM K + { 0x5B01, "Threshold condition met", err_act_fail, B_ERROR }, // DTLPWROM K + { 0x5B02, "Log counter at maximum", err_act_fail, B_ERROR }, // DTLPWROM K + { 0x5B03, "Log list codes exhausted", err_act_fail, B_ERROR }, // DTLPWROM K + { 0x5C00, "RPL status change", err_act_fail, B_ERROR }, // D O + { 0x5C01, "Spindles synchronized", err_act_ok, B_OK }, // D O + { 0x5C02, "Spindles not synchronized", err_act_fail, B_ERROR }, // D O + { 0x5D00, "Failure prediction threshold exceeded", err_act_fail, B_ERROR }, // DTLPWROMAEBKVF + { 0x5D01, "Media failure prediction threshold exceeded", err_act_fail, B_ERROR }, // R B + { 0x5D02, "Logical unit failure prediction threshold exceeded", err_act_fail, B_ERROR }, // R + { 0x5D03, "Spare area exhaustion prediction threshold exceeded", err_act_fail, B_ERROR }, // R + { 0x5D10, "Hardware impending failure general hard drive failure", err_act_fail, B_ERROR }, // D B + { 0x5D11, "Hardware impending failure drive error rate too high", err_act_fail, B_ERROR }, // D B + { 0x5D12, "Hardware impending failure data error rate too high", err_act_fail, B_ERROR }, // D B + { 0x5D13, "Hardware impending failure seek error rate too high", err_act_fail, B_ERROR }, // D B + { 0x5D14, "Hardware impending failure too many block reassigns", err_act_fail, B_ERROR }, // D B + { 0x5D15, "Hardware impending failure access times too high", err_act_fail, B_ERROR }, // D B + { 0x5D16, "Hardware impending failure start unit times too high", err_act_fail, B_ERROR }, // D B + { 0x5D17, "Hardware impending failure channel parametrics", err_act_fail, B_ERROR }, // D B + { 0x5D18, "Hardware impending failure controller detected", err_act_fail, B_ERROR }, // D B + { 0x5D19, "Hardware impending failure throughput performance", err_act_fail, B_ERROR }, // D B + { 0x5D1A, "Hardware impending failure seek time performance", err_act_fail, B_ERROR }, // D B + { 0x5D1B, "Hardware impending failure spin-up retry count", err_act_fail, B_ERROR }, // D B + { 0x5D1C, "Hardware impending failure drive calibration retry count", err_act_fail, B_ERROR }, // D B + { 0x5D20, "Controller impending failure general hard drive failure", err_act_fail, B_ERROR }, // D B + { 0x5D21, "Controller impending failure drive error rate too high", err_act_fail, B_ERROR }, // D B + { 0x5D22, "Controller impending failure data error rate too high", err_act_fail, B_ERROR }, // D B + { 0x5D23, "Controller impending failure seek error rate too high", err_act_fail, B_ERROR }, // D B + { 0x5D24, "Controller impending failure too many block reassigns", err_act_fail, B_ERROR }, // D B + { 0x5D25, "Controller impending failure access times too high", err_act_fail, B_ERROR }, // D B + { 0x5D26, "Controller impending failure start unit times too high", err_act_fail, B_ERROR }, // D B + { 0x5D27, "Controller impending failure channel parametrics", err_act_fail, B_ERROR }, // D B + { 0x5D28, "Controller impending failure controller detected", err_act_fail, B_ERROR }, // D B + { 0x5D29, "Controller impending failure throughput performance", err_act_fail, B_ERROR }, // D B + { 0x5D2A, "Controller impending failure seek time performance", err_act_fail, B_ERROR }, // D B + { 0x5D2B, "Controller impending failure spin-up retry count", err_act_fail, B_ERROR }, // D B + { 0x5D2C, "Controller impending failure drive calibration retry count", err_act_fail, B_ERROR }, // D B + { 0x5D30, "Data channel impending failure general hard drive failure", err_act_fail, B_ERROR }, // D B + { 0x5D31, "Data channel impending failure drive error rate too high", err_act_fail, B_ERROR }, // D B + { 0x5D32, "Data channel impending failure data error rate too high", err_act_fail, B_ERROR }, // D B + { 0x5D33, "Data channel impending failure seek error rate too high", err_act_fail, B_ERROR }, // D B + { 0x5D34, "Data channel impending failure too many block reassigns", err_act_fail, B_ERROR }, // D B + { 0x5D35, "Data channel impending failure access times too high", err_act_fail, B_ERROR }, // D B + { 0x5D36, "Data channel impending failure start unit times too high", err_act_fail, B_ERROR }, // D B + { 0x5D37, "Data channel impending failure channel parametrics", err_act_fail, B_ERROR }, // D B + { 0x5D38, "Data channel impending failure controller detected", err_act_fail, B_ERROR }, // D B + { 0x5D39, "Data channel impending failure throughput performance", err_act_fail, B_ERROR }, // D B + { 0x5D3A, "Data channel impending failure seek time performance", err_act_fail, B_ERROR }, // D B + { 0x5D3B, "Data channel impending failure spin-up retry count", err_act_fail, B_ERROR }, // D B + { 0x5D3C, "Data channel impending failure drive calibration retry count", err_act_fail, B_ERROR }, // D B + { 0x5D40, "Servo impending failure general hard drive failure", err_act_fail, B_ERROR }, // D B + { 0x5D41, "Servo impending failure drive error rate too high", err_act_fail, B_ERROR }, // D B + { 0x5D42, "Servo impending failure data error rate too high", err_act_fail, B_ERROR }, // D B + { 0x5D43, "Servo impending failure seek error rate too high", err_act_fail, B_ERROR }, // D B + { 0x5D44, "Servo impending failure too many block reassigns", err_act_fail, B_ERROR }, // D B + { 0x5D45, "Servo impending failure access times too high", err_act_fail, B_ERROR }, // D B + { 0x5D46, "Servo impending failure start unit times too high", err_act_fail, B_ERROR }, // D B + { 0x5D47, "Servo impending failure channel parametrics", err_act_fail, B_ERROR }, // D B + { 0x5D48, "Servo impending failure controller detected", err_act_fail, B_ERROR }, // D B + { 0x5D49, "Servo impending failure throughput performance", err_act_fail, B_ERROR }, // D B + { 0x5D4A, "Servo impending failure seek time performance", err_act_fail, B_ERROR }, // D B + { 0x5D4B, "Servo impending failure spin-up retry count", err_act_fail, B_ERROR }, // D B + { 0x5D4C, "Servo impending failure drive calibration retry count", err_act_fail, B_ERROR }, // D B + { 0x5D50, "Spindle impending failure general hard drive failure", err_act_fail, B_ERROR }, // D B + { 0x5D51, "Spindle impending failure drive error rate too high", err_act_fail, B_ERROR }, // D B + { 0x5D52, "Spindle impending failure data error rate too high", err_act_fail, B_ERROR }, // D B + { 0x5D53, "Spindle impending failure seek error rate too high", err_act_fail, B_ERROR }, // D B + { 0x5D54, "Spindle impending failure too many block reassigns", err_act_fail, B_ERROR }, // D B + { 0x5D55, "Spindle impending failure access times too high", err_act_fail, B_ERROR }, // D B + { 0x5D56, "Spindle impending failure start unit times too high", err_act_fail, B_ERROR }, // D B + { 0x5D57, "Spindle impending failure channel parametrics", err_act_fail, B_ERROR }, // D B + { 0x5D58, "Spindle impending failure controller detected", err_act_fail, B_ERROR }, // D B + { 0x5D59, "Spindle impending failure throughput performance", err_act_fail, B_ERROR }, // D B + { 0x5D5A, "Spindle impending failure seek time performance", err_act_fail, B_ERROR }, // D B + { 0x5D5B, "Spindle impending failure spin-up retry count", err_act_fail, B_ERROR }, // D B + { 0x5D5C, "Spindle impending failure drive calibration retry count", err_act_fail, B_ERROR }, // D B + { 0x5D60, "Firmware impending failure general hard drive failure", err_act_fail, B_ERROR }, // D B + { 0x5D61, "Firmware impending failure drive error rate too high", err_act_fail, B_ERROR }, // D B + { 0x5D62, "Firmware impending failure data error rate too high", err_act_fail, B_ERROR }, // D B + { 0x5D63, "Firmware impending failure seek error rate too high", err_act_fail, B_ERROR }, // D B + { 0x5D64, "Firmware impending failure too many block reassigns", err_act_fail, B_ERROR }, // D B + { 0x5D65, "Firmware impending failure access times too high", err_act_fail, B_ERROR }, // D B + { 0x5D66, "Firmware impending failure start unit times too high", err_act_fail, B_ERROR }, // D B + { 0x5D67, "Firmware impending failure channel parametrics", err_act_fail, B_ERROR }, // D B + { 0x5D68, "Firmware impending failure controller detected", err_act_fail, B_ERROR }, // D B + { 0x5D69, "Firmware impending failure throughput performance", err_act_fail, B_ERROR }, // D B + { 0x5D6A, "Firmware impending failure seek time performance", err_act_fail, B_ERROR }, // D B + { 0x5D6B, "Firmware impending failure spin-up retry count", err_act_fail, B_ERROR }, // D B + { 0x5D6C, "Firmware impending failure drive calibration retry count", err_act_fail, B_ERROR }, // D B + { 0x5DFF, "Failure prediction threshold exceeded (false)", err_act_fail, B_ERROR }, // DTLPWROMAEBKVF + { 0x5E00, "Low power condition on", err_act_fail, B_ERROR }, // DTLPWRO A K + { 0x5E01, "Idle condition activated by timer", err_act_fail, B_ERROR }, // DTLPWRO A K + { 0x5E02, "Standby condition activated by timer", err_act_fail, B_ERROR }, // DTLPWRO A K + { 0x5E03, "Idle condition activated by command", err_act_fail, B_ERROR }, // DTLPWRO A K + { 0x5E04, "Standby condition activated by command", err_act_fail, B_ERROR }, // DTLPWRO A K + { 0x5E05, "Idle-B condition activated by timer", err_act_fail, B_ERROR }, // DTLPWRO A K + { 0x5E06, "Idle-B condition activated by command", err_act_fail, B_ERROR }, // DTLPWRO A K + { 0x5E07, "Idle-C condition activated by timer", err_act_fail, B_ERROR }, // DTLPWRO A K + { 0x5E08, "Idle-C condition activated by command", err_act_fail, B_ERROR }, // DTLPWRO A K + { 0x5E09, "Standby-Y condition activated by timer", err_act_fail, B_ERROR }, // DTLPWRO A K + { 0x5E0A, "Standby-Y condition activated by command", err_act_fail, B_ERROR }, // DTLPWRO A K + { 0x5E41, "Power state change to active", err_act_fail, B_ERROR }, // B + { 0x5E42, "Power state change to idle", err_act_fail, B_ERROR }, // B + { 0x5E43, "Power state change to standby", err_act_fail, B_ERROR }, // B + { 0x5E45, "Power state change to sleep", err_act_fail, B_ERROR }, // B + { 0x5E47, "Power state change to device control", err_act_fail, B_ERROR }, // BK + { 0x6000, "Lamp failure", err_act_fail, B_ERROR }, // + { 0x6100, "Video acquisition error", err_act_fail, B_ERROR }, // + { 0x6101, "Unable to acquire video", err_act_fail, B_ERROR }, // + { 0x6102, "Out of focus", err_act_fail, B_ERROR }, // + { 0x6200, "Scan head positioning error", err_act_fail, B_ERROR }, // + { 0x6300, "End of user area encountered on this track", err_act_fail, B_ERROR }, // R + { 0x6301, "Packet does not fit in available space", err_act_fail, B_DEVICE_FULL }, // R + { 0x6400, "Illegal mode for this track", err_act_fail, B_DEV_NOT_READY }, // R + { 0x6401, "Invalid packet size", err_act_fail, B_ERROR }, // R + { 0x6500, "Voltage fault", err_act_fail, B_ERROR }, // DTLPWROMAEBKVF + { 0x6600, "Automatic document feeder cover up", err_act_fail, B_ERROR }, // + { 0x6601, "Automatic document feeder lift up", err_act_fail, B_ERROR }, // + { 0x6602, "Document jam in automatic document feeder", err_act_fail, B_ERROR }, // + { 0x6603, "Document miss feed automatic in document feeder", err_act_fail, B_ERROR }, // + { 0x6700, "Configuration failure", err_act_fail, B_ERROR }, // A + { 0x6701, "Configuration of incapable logical units failed", err_act_fail, B_ERROR }, // A + { 0x6702, "Add logical unit failed", err_act_fail, B_ERROR }, // A + { 0x6703, "Modification of logical unit failed", err_act_fail, B_ERROR }, // A + { 0x6704, "Exchange of logical unit failed", err_act_fail, B_ERROR }, // A + { 0x6705, "Remove of logical unit failed", err_act_fail, B_ERROR }, // A + { 0x6706, "Attachment of logical unit failed", err_act_fail, B_ERROR }, // A + { 0x6707, "Creation of logical unit failed", err_act_fail, B_ERROR }, // A + { 0x6708, "Assign failure occurred", err_act_fail, B_ERROR }, // A + { 0x6709, "Multiply assigned logical unit", err_act_fail, B_ERROR }, // A + { 0x670A, "Set target port groups command failed", err_act_fail, B_ERROR }, // DTLPWROMAEBKVF + { 0x670B, "ATA device feature not enabled", err_act_fail, B_ERROR }, // DT B + { 0x6800, "Logical unit not configured", err_act_fail, B_ERROR }, // A + { 0x6801, "Subsidiary logical unit not configured", err_act_fail, B_ERROR }, // D + { 0x6900, "Data loss on logical unit", err_act_fail, B_ERROR }, // A + { 0x6901, "Multiple logical unit failures", err_act_fail, B_ERROR }, // A + { 0x6902, "Parity/data mismatch", err_act_fail, B_ERROR }, // A + { 0x6A00, "Informational, refer to log", err_act_fail, B_ERROR }, // A + { 0x6B00, "State change has occurred", err_act_fail, B_ERROR }, // A + { 0x6B01, "Redundancy level got better", err_act_fail, B_ERROR }, // A + { 0x6B02, "Redundancy level got worse", err_act_fail, B_ERROR }, // A + { 0x6C00, "Rebuild failure occurred", err_act_fail, B_ERROR }, // A + { 0x6D00, "Recalculate failure occurred", err_act_fail, B_ERROR }, // A + { 0x6E00, "Command to logical unit failed", err_act_fail, B_ERROR }, // A + { 0x6F00, "Copy protection key exchange failure - authentication failure", err_act_fail, B_ERROR }, // R + { 0x6F01, "Copy protection key exchange failure - key not present", err_act_fail, B_ERROR }, // R + { 0x6F02, "Copy protection key exchange failure - key not established", err_act_fail, B_ERROR }, // R + { 0x6F03, "Read of scrambled sector without authentication", err_act_fail, B_ERROR }, // R + { 0x6F04, "Media region code is mismatched to logical unit region", err_act_fail, B_ERROR }, // R + { 0x6F05, "Drive region must be permanent/region reset count error", err_act_fail, B_ERROR }, // R + { 0x6F06, "Insufficient block count for binding NONCE recording", err_act_fail, B_ERROR }, // R + { 0x6F07, "Conflict in binding nonce recording", err_act_fail, B_ERROR }, // R + { 0x70FF, "Decompression exception short algorithm id ASQ", err_act_fail, B_ERROR }, // T + { 0x7100, "Decompression exception long algorithm id", err_act_fail, B_ERROR }, // T + { 0x7200, "Session fixation error", err_act_fail, B_ERROR }, // R + { 0x7201, "Session fixation error writing lead-in", err_act_fail, B_ERROR }, // R + { 0x7202, "Session fixation error writing lead-out", err_act_fail, B_ERROR }, // R + { 0x7203, "Session fixation error - incomplete track in session", err_act_fail, B_ERROR }, // R + { 0x7204, "Empty or partially written reserved track", err_act_fail, B_ERROR }, // R + { 0x7205, "No more track reservations allowed", err_act_fail, B_ERROR }, // R + { 0x7206, "RMZ extension is not allowed", err_act_fail, B_ERROR }, // R + { 0x7207, "No more test zone extensions are allowed", err_act_fail, B_ERROR }, // R + { 0x7300, "CD control error", err_act_fail, B_ERROR }, // R + { 0x7301, "Power calibration area almost full", err_act_fail, B_ERROR }, // R + { 0x7302, "Power calibration area is full", err_act_fail, B_DEVICE_FULL }, // R + { 0x7303, "Power calibration area error", err_act_fail, B_ERROR }, // R + { 0x7304, "Program memory area update failure", err_act_fail, B_ERROR }, // R + { 0x7305, "Program memory area is full", err_act_fail, B_ERROR }, // R + { 0x7306, "RMA/PMA is almost full", err_act_fail, B_ERROR }, // R + { 0x7310, "Current power calibration area almost full", err_act_fail, B_ERROR }, // R + { 0x7311, "Current power calibration area is full", err_act_fail, B_ERROR }, // R + { 0x7317, "RDZ is full", err_act_fail, B_ERROR }, // R + { 0x7400, "Security error", err_act_fail, B_ERROR }, // T + { 0x7401, "Unable to decrypt data", err_act_fail, B_ERROR }, // T + { 0x7402, "Unencrypted data encountered while decrypting", err_act_fail, B_ERROR }, // T + { 0x7403, "Incorrect data encryption key", err_act_fail, B_ERROR }, // T + { 0x7404, "Cryptographic integrity validation failed", err_act_fail, B_ERROR }, // T + { 0x7405, "Error decrypting data", err_act_fail, B_ERROR }, // T + { 0x7406, "Unknown signature verification key", err_act_fail, B_ERROR }, // T + { 0x7407, "Encryption parameters not useable", err_act_fail, B_ERROR }, // T + { 0x7408, "Digital signature validation failure", err_act_fail, B_ERROR }, // DT R M E VF + { 0x7409, "Encryption mode mismatch on read", err_act_fail, B_ERROR }, // T + { 0x740A, "Encrypted block not raw read enabled", err_act_fail, B_ERROR }, // T + { 0x740B, "Incorrect encryption parameters", err_act_fail, B_ERROR }, // T + { 0x740C, "Unable to decrypt parameter list", err_act_fail, B_ERROR }, // DT R MAEBKV + { 0x740D, "Encryption algorithm disabled", err_act_fail, B_ERROR }, // T + { 0x7410, "SA creation parameter value invalid", err_act_fail, B_ERROR }, // DT R MAEBKV + { 0x7411, "SA creation parameter value rejected", err_act_fail, B_ERROR }, // DT R MAEBKV + { 0x7412, "Invalid SA usage", err_act_fail, B_ERROR }, // DT R MAEBKV + { 0x7421, "Data encryption configuration prevented", err_act_fail, B_ERROR }, // T + { 0x7430, "SA creation parameter not supported", err_act_fail, B_ERROR }, // DT R MAEBKV + { 0x7440, "Authentication failed", err_act_fail, B_ERROR }, // DT R MAEBKV + { 0x7461, "External data encryption key manager access error", err_act_fail, B_ERROR }, // V + { 0x7462, "External data encryption key manager error", err_act_fail, B_ERROR }, // V + { 0x7463, "External data encryption key not found", err_act_fail, B_ERROR }, // V + { 0x7464, "External data encryption request not authorized", err_act_fail, B_ERROR }, // V + { 0x746E, "External data encryption control timeout", err_act_fail, B_ERROR }, // T + { 0x746F, "External data encryption control error", err_act_fail, B_ERROR }, // T + { 0x7471, "Logical unit access not authorized", err_act_fail, B_ERROR }, // DT R M E V + { 0x7479, "Security conflict in translated device", err_act_fail, B_ERROR }, // D +}; + +// Use these values for loop control during searching: +#define SCSI_SENSE_KEY_TABLE_LEN (sizeof(sSCSISenseKeyTable)/sizeof(scsi_sense_key_table)) +#define SCSI_SENSE_ASC_ASCQ_TABLE_LEN (sizeof(sSCSISenseAscTable)/sizeof(scsi_sense_asc_table)) + + +status_t +scsi_get_sense_key_info(uint8 key, const char **label, err_act *action, status_t *error) +{ + int i; + for (i = 0; i < (int)SCSI_SENSE_KEY_TABLE_LEN; i++) { + if (sSCSISenseKeyTable[i].key == key) { + *label = sSCSISenseKeyTable[i].label; + *action = sSCSISenseKeyTable[i].action; + *error = sSCSISenseKeyTable[i].err; + return B_OK; + } + } + *label = NULL; + return B_BAD_VALUE; +} + + +status_t +scsi_get_sense_asc_info(uint16 asc_asq, const char **label, err_act *action, status_t *error) +{ + int i; + for (i = 0; i < (int)SCSI_SENSE_ASC_ASCQ_TABLE_LEN; i++) { + if (sSCSISenseAscTable[i].asc_ascq == asc_asq) { + *label = sSCSISenseAscTable[i].label; + *action = sSCSISenseAscTable[i].action; + *error = sSCSISenseAscTable[i].err; + return B_OK; + } + } + *label = NULL; + return B_BAD_VALUE; +} + + + + + + diff --git a/headers/private/kernel/arch/arm/arch_cpu.h b/headers/private/kernel/arch/arm/arch_cpu.h index a70398aa64..fea6c68979 100644 --- a/headers/private/kernel/arch/arm/arch_cpu.h +++ b/headers/private/kernel/arch/arm/arch_cpu.h @@ -63,6 +63,7 @@ extern "C" { extern addr_t arm_get_far(void); extern int32 arm_get_fsr(void); +extern addr_t arm_get_fp(void); extern int mmu_read_c1(void); extern int mmu_write_c1(int val); diff --git a/headers/private/kernel/arch/ppc/arch_kernel_args.h b/headers/private/kernel/arch/ppc/arch_kernel_args.h index 7780bfe7c9..26370d0d30 100644 --- a/headers/private/kernel/arch/ppc/arch_kernel_args.h +++ b/headers/private/kernel/arch/ppc/arch_kernel_args.h @@ -29,6 +29,9 @@ typedef struct { // to the Open Firmware. uint32 num_virtual_ranges_to_keep; addr_range virtual_ranges_to_keep[MAX_VIRTUAL_RANGES_TO_KEEP]; + + // platform type we booted from + int platform; } arch_kernel_args; #endif /* KERNEL_ARCH_PPC_KERNEL_ARGS_H */ diff --git a/headers/private/kernel/arch/ppc/arch_mmu_amcc440.h b/headers/private/kernel/arch/ppc/arch_mmu_amcc440.h new file mode 100644 index 0000000000..5bc6f9d62a --- /dev/null +++ b/headers/private/kernel/arch/ppc/arch_mmu_amcc440.h @@ -0,0 +1,134 @@ +/* +** Copyright 2003, Axel Dörfler, axeld@pinc-software.de. All rights reserved. +** Distributed under the terms of the OpenBeOS License. +*/ +#ifndef _KERNEL_ARCH_PPC_MMU_AMCC440_H +#define _KERNEL_ARCH_PPC_MMU_AMCC440_H + + +#include +#include + +#include + + +/*** TLB - translation lookaside buffer ***/ + +#define TLB_COUNT 64 + +/** valid tlb length values */ +enum tlb_length { + TLB_LENGTH_1kB = 0x0, + TLB_LENGTH_4kB = 0x1, + TLB_LENGTH_16kB = 0x2, + TLB_LENGTH_64kB = 0x3, + TLB_LENGTH_256kB = 0x4, + TLB_LENGTH_1MB = 0x5, + TLB_LENGTH_16MB = 0x7, + TLB_LENGTH_256MB = 0x9, +}; + +#define TLB_V 0x200 + +/** structure of a real TLB entry */ +//FIXME +struct tlb_entry { + // word 0 + uint32 effective_page_number : 22; + uint32 valid : 1; + uint32 translation_address_space : 1; + uint32 page_size : 4; + uint32 parity_1 : 4; + //uint32 translation_id : 8; +//FIXME:rest is Classic stuff + // word 0 + // upper 32 bit + uint32 page_index : 15; // BEPI, block effective page index + uint32 _reserved0 : 4; + uint32 length : 11; + uint32 kernel_valid : 1; // Vs, Supervisor-state valid + uint32 user_valid : 1; // Vp, User-state valid + // lower 32 bit + uint32 physical_block_number : 15; // BPRN + uint32 write_through : 1; // WIMG + uint32 caching_inhibited : 1; + uint32 memory_coherent : 1; + uint32 guarded : 1; + uint32 _reserved1 : 1; + uint32 protection : 2; + + tlb_entry() + { + Clear(); + } + + void SetVirtualAddress(void *address) + { + page_index = uint32(address) >> 17; + } + + void SetPhysicalAddress(void *address) + { + physical_block_number = uint32(address) >> 17; + } + + void Clear() + { + memset((void *)this, 0, sizeof(tlb_entry)); + } +}; + +#if 0 // XXX:Classic +/*** PTE - page table entry ***/ + +enum pte_protection { + PTE_READ_ONLY = 3, + PTE_READ_WRITE = 2, +}; + +struct page_table_entry { + // upper 32 bit + uint32 valid : 1; + uint32 virtual_segment_id : 24; + uint32 secondary_hash : 1; + uint32 abbr_page_index : 6; + // lower 32 bit + uint32 physical_page_number : 20; + uint32 _reserved0 : 3; + uint32 referenced : 1; + uint32 changed : 1; + uint32 write_through : 1; // WIMG + uint32 caching_inhibited : 1; + uint32 memory_coherent : 1; + uint32 guarded : 1; + uint32 _reserved1 : 1; + uint32 page_protection : 2; + + static uint32 PrimaryHash(uint32 virtualSegmentID, uint32 virtualAddress); + static uint32 SecondaryHash(uint32 virtualSegmentID, uint32 virtualAddress); + static uint32 SecondaryHash(uint32 primaryHash); +}; + +struct page_table_entry_group { + struct page_table_entry entry[8]; +}; + +extern void ppc_get_page_table(page_table_entry_group **_pageTable, size_t *_size); +extern void ppc_set_page_table(page_table_entry_group *pageTable, size_t size); + +static inline segment_descriptor +ppc_get_segment_register(void *virtualAddress) +{ + return (segment_descriptor)get_sr(virtualAddress); +} + + +static inline void +ppc_set_segment_register(void *virtualAddress, segment_descriptor segment) +{ + set_sr(virtualAddress, *(uint32 *)&segment); +} + +#endif + +#endif /* _KERNEL_ARCH_PPC_MMU_AMCC440_H */ diff --git a/headers/private/kernel/arch/ppc/arch_platform.h b/headers/private/kernel/arch/ppc/arch_platform.h index d4550cda52..30d5ff132a 100644 --- a/headers/private/kernel/arch/ppc/arch_platform.h +++ b/headers/private/kernel/arch/ppc/arch_platform.h @@ -11,6 +11,7 @@ struct real_time_data; enum ppc_platform_type { PPC_PLATFORM_OPEN_FIRMWARE = 0, + PPC_PLATFORM_U_BOOT }; namespace BPrivate { diff --git a/headers/private/kernel/boot/platform/openfirmware/platform_kernel_args.h b/headers/private/kernel/boot/platform/openfirmware/platform_kernel_args.h index 94c8ab6c31..150afe25c3 100644 --- a/headers/private/kernel/boot/platform/openfirmware/platform_kernel_args.h +++ b/headers/private/kernel/boot/platform/openfirmware/platform_kernel_args.h @@ -19,6 +19,12 @@ typedef struct { void *openfirmware_entry; char rtc_path[128]; + + // XXX: HACK: must match the U-Boot platform args + // FIXME: use a union instead? + + // Flattened Device Tree blob + void *fdt; } platform_kernel_args; #endif /* KERNEL_BOOT_PLATFORM_OPENFIRMWARE_KERNEL_ARGS_H */ diff --git a/headers/private/kernel/boot/platform/u-boot/platform_kernel_args.h b/headers/private/kernel/boot/platform/u-boot/platform_kernel_args.h index 6e898ba11e..8a78bc69c4 100644 --- a/headers/private/kernel/boot/platform/u-boot/platform_kernel_args.h +++ b/headers/private/kernel/boot/platform/u-boot/platform_kernel_args.h @@ -17,7 +17,13 @@ typedef struct { - char dummy; + // XXX: HACK: must match the OF platform args + // FIXME: use a union instead? + void *openfirmware_entry; + char rtc_path[128]; + + // Flattened Device Tree blob + void *fdt; } platform_kernel_args; #endif /* KERNEL_BOOT_PLATFORM_UBOOT_KERNEL_ARGS_H */ diff --git a/headers/private/kernel/platform/openfirmware/openfirmware.h b/headers/private/kernel/platform/openfirmware/openfirmware.h index e5ebf77ddd..7c82079c6b 100644 --- a/headers/private/kernel/platform/openfirmware/openfirmware.h +++ b/headers/private/kernel/platform/openfirmware/openfirmware.h @@ -20,7 +20,7 @@ template struct of_region { AddressType base; uint32 size; -}; +} _PACKED; struct of_arguments { const char *name; diff --git a/headers/private/system/arch/arm/arch_config.h b/headers/private/system/arch/arm/arch_config.h index 409f58dfc0..5e203811bb 100644 --- a/headers/private/system/arch/arm/arch_config.h +++ b/headers/private/system/arch/arm/arch_config.h @@ -10,8 +10,14 @@ #define STACK_GROWS_DOWNWARDS -//#define ATOMIC_FUNCS_ARE_SYSCALLS -//#define ATOMIC64_FUNCS_ARE_SYSCALLS +// If we're building on ARMv5 or older, all our atomics need to be syscalls... :( +#if _M_ARM <= 5 +#define ATOMIC_FUNCS_ARE_SYSCALLS +#endif +// If we're building on ARMv6 or older, 64-bit atomics need to be syscalls... +#if _M_ARM < 7 +#define ATOMIC64_FUNCS_ARE_SYSCALLS +#endif #endif /* _KERNEL_ARCH_ARM_CONFIG_H */ diff --git a/headers/private/virtio/virtio.h b/headers/private/virtio/virtio.h index 03792426b4..12691a1e52 100644 --- a/headers/private/virtio/virtio.h +++ b/headers/private/virtio/virtio.h @@ -117,6 +117,12 @@ typedef struct { size_t readVectorCount, size_t writtenVectorCount, virtio_callback_func callback, void *callbackCookie); + bool (*queue_is_full)(virtio_queue queue); + + bool (*queue_is_empty)(virtio_queue queue); + + uint16 (*queue_size)(virtio_queue queue); + } virtio_device_interface; diff --git a/src/add-ons/accelerants/radeon_hd/display.cpp b/src/add-ons/accelerants/radeon_hd/display.cpp index 3a2238c005..172ac8d156 100644 --- a/src/add-ons/accelerants/radeon_hd/display.cpp +++ b/src/add-ons/accelerants/radeon_hd/display.cpp @@ -611,8 +611,8 @@ display_dce45_crtc_load_lut(uint8 crtcID) if (info.dceMajor >= 5) { Write32(OUT, NI_INPUT_CSC_CONTROL + regs->crtcOffset, - (NI_INPUT_CSC_GRPH_MODE(NI_INPUT_CSC_BYPASS) | - NI_INPUT_CSC_OVL_MODE(NI_INPUT_CSC_BYPASS))); + (NI_INPUT_CSC_GRPH_MODE(NI_INPUT_CSC_BYPASS) + | NI_INPUT_CSC_OVL_MODE(NI_INPUT_CSC_BYPASS))); Write32(OUT, NI_PRESCALE_GRPH_CONTROL + regs->crtcOffset, NI_GRPH_PRESCALE_BYPASS); Write32(OUT, NI_PRESCALE_OVL_CONTROL + regs->crtcOffset, @@ -638,17 +638,15 @@ display_dce45_crtc_load_lut(uint8 crtcID) Write32(OUT, EVERGREEN_DC_LUT_RW_INDEX, 0); for (int i = 0; i < 256; i++) { Write32(OUT, EVERGREEN_DC_LUT_30_COLOR + regs->crtcOffset, - (r[i] << 20) | - (g[i] << 10) | - (b[i] << 0)); + (r[i] << 20) | (g[i] << 10) | (b[i] << 0)); } if (info.dceMajor >= 5) { Write32(OUT, NI_DEGAMMA_CONTROL + regs->crtcOffset, - (NI_GRPH_DEGAMMA_MODE(NI_DEGAMMA_BYPASS) | - NI_OVL_DEGAMMA_MODE(NI_DEGAMMA_BYPASS) | - NI_ICON_DEGAMMA_MODE(NI_DEGAMMA_BYPASS) | - NI_CURSOR_DEGAMMA_MODE(NI_DEGAMMA_BYPASS))); + (NI_GRPH_DEGAMMA_MODE(NI_DEGAMMA_BYPASS) + | NI_OVL_DEGAMMA_MODE(NI_DEGAMMA_BYPASS) + | NI_ICON_DEGAMMA_MODE(NI_DEGAMMA_BYPASS) + | NI_CURSOR_DEGAMMA_MODE(NI_DEGAMMA_BYPASS))); Write32(OUT, NI_GAMUT_REMAP_CONTROL + regs->crtcOffset, (NI_GRPH_GAMUT_REMAP_MODE(NI_GAMUT_REMAP_BYPASS) | NI_OVL_GAMUT_REMAP_MODE(NI_GAMUT_REMAP_BYPASS))); @@ -693,9 +691,7 @@ display_avivo_crtc_load_lut(uint8 crtcID) Write32(OUT, AVIVO_DC_LUT_RW_INDEX, 0); for (int i = 0; i < 256; i++) { Write32(OUT, AVIVO_DC_LUT_30_COLOR, - (r[i] << 20) | - (g[i] << 10) | - (b[i] << 0)); + (r[i] << 20) | (g[i] << 10) | (b[i] << 0)); } Write32(OUT, AVIVO_D1GRPH_LUT_SEL + regs->crtcOffset, crtcID); diff --git a/src/add-ons/accelerants/radeon_hd/displayport.cpp b/src/add-ons/accelerants/radeon_hd/displayport.cpp index a2421a54b9..c777285611 100644 --- a/src/add-ons/accelerants/radeon_hd/displayport.cpp +++ b/src/add-ons/accelerants/radeon_hd/displayport.cpp @@ -772,7 +772,7 @@ dp_link_train(uint8 crtcID) { TRACE("%s\n", __func__); - uint32 connectorIndex = gDisplay[crtcID]->connectorIndex; + uint32 connectorIndex = gDisplay[crtcID]->connectorIndex; dp_info* dp = &gConnector[connectorIndex]->dpInfo; display_mode* mode = &gDisplay[crtcID]->currentMode; diff --git a/src/add-ons/kernel/bus_managers/pci/arch/ppc/Jamfile b/src/add-ons/kernel/bus_managers/pci/arch/ppc/Jamfile index 99e04130f6..2f81efb0e5 100644 --- a/src/add-ons/kernel/bus_managers/pci/arch/ppc/Jamfile +++ b/src/add-ons/kernel/bus_managers/pci/arch/ppc/Jamfile @@ -5,6 +5,7 @@ UsePrivateHeaders kernel [ FDirName kernel arch $(TARGET_ARCH) ] [ FDirName kernel boot platform $(HAIKU_BOOT_PLATFORM) ] ; SEARCH_SOURCE += [ FDirName $(SUBDIR) openfirmware ] ; +SEARCH_SOURCE += [ FDirName $(SUBDIR) u-boot ] ; KernelStaticLibrary pci_arch_bus_manager : pci_controller.cpp @@ -14,4 +15,7 @@ KernelStaticLibrary pci_arch_bus_manager : pci_openfirmware.cpp uninorth.cpp grackle.cpp + + # U-Boot + pci_u-boot.cpp ; diff --git a/src/add-ons/kernel/bus_managers/pci/arch/ppc/pci_controller.cpp b/src/add-ons/kernel/bus_managers/pci/arch/ppc/pci_controller.cpp index 8c0a6cd075..50caa2b6ff 100644 --- a/src/add-ons/kernel/bus_managers/pci/arch/ppc/pci_controller.cpp +++ b/src/add-ons/kernel/bus_managers/pci/arch/ppc/pci_controller.cpp @@ -11,6 +11,7 @@ #include "pci_private.h" #include "openfirmware/pci_openfirmware.h" +#include "u-boot/pci_u-boot.h" status_t @@ -19,9 +20,12 @@ pci_controller_init(void) switch (PPCPlatform::Default()->PlatformType()) { case PPC_PLATFORM_OPEN_FIRMWARE: return ppc_openfirmware_pci_controller_init(); - break; + case PPC_PLATFORM_U_BOOT: + return ppc_uboot_pci_controller_init(); + default: + panic("pci: unknown platform"); } - return B_OK; + return B_ERROR; } diff --git a/src/add-ons/kernel/bus_managers/pci/arch/ppc/u-boot/pci_u-boot.cpp b/src/add-ons/kernel/bus_managers/pci/arch/ppc/u-boot/pci_u-boot.cpp new file mode 100644 index 0000000000..0f00491f32 --- /dev/null +++ b/src/add-ons/kernel/bus_managers/pci/arch/ppc/u-boot/pci_u-boot.cpp @@ -0,0 +1,24 @@ +/* + * Copyright 2006, Ingo Weinhold . + * All rights reserved. Distributed under the terms of the MIT License. + */ + +#include "pci_u-boot.h" + +#include +#include + +#include + +//#include +//#include +//#include + + +status_t +ppc_uboot_pci_controller_init(void) +{ + return B_ERROR; +} + + diff --git a/src/add-ons/kernel/bus_managers/pci/arch/ppc/u-boot/pci_u-boot.h b/src/add-ons/kernel/bus_managers/pci/arch/ppc/u-boot/pci_u-boot.h new file mode 100644 index 0000000000..07a6a71916 --- /dev/null +++ b/src/add-ons/kernel/bus_managers/pci/arch/ppc/u-boot/pci_u-boot.h @@ -0,0 +1,13 @@ +/* + * Copyright 2012, François Revol . + * All rights reserved. Distributed under the terms of the MIT License. + */ + +#ifndef PCI_BUS_MANAGER_PPC_U_BOOT_H +#define PCI_BUS_MANAGER_PPC_U_BOOT_H + +#include + +status_t ppc_uboot_pci_controller_init(void); + +#endif // PCI_BUS_MANAGER_PPC_U_BOOT_H diff --git a/src/add-ons/kernel/bus_managers/ps2/Jamfile b/src/add-ons/kernel/bus_managers/ps2/Jamfile index d2abde2182..c5d6817669 100644 --- a/src/add-ons/kernel/bus_managers/ps2/Jamfile +++ b/src/add-ons/kernel/bus_managers/ps2/Jamfile @@ -8,6 +8,7 @@ KernelAddon ps2 : ps2_alps.cpp ps2_common.cpp ps2_dev.cpp + ps2_elantech.cpp ps2_keyboard.cpp ps2_module.cpp ps2_standard_mouse.cpp diff --git a/src/add-ons/kernel/bus_managers/ps2/ps2_alps.cpp b/src/add-ons/kernel/bus_managers/ps2/ps2_alps.cpp index 70625df8dd..31affc9e58 100644 --- a/src/add-ons/kernel/bus_managers/ps2/ps2_alps.cpp +++ b/src/add-ons/kernel/bus_managers/ps2/ps2_alps.cpp @@ -67,8 +67,8 @@ public: private: bool fFired; uint8 fLastPackage[PS2_PACKET_ALPS]; - timer fEventTimer; - alps_cookie* fCookie; + timer fEventTimer; + alps_cookie* fCookie; }; @@ -112,7 +112,7 @@ typedef struct alps_model_info { static const struct alps_model_info gALPSModelInfos[] = { {{0x32, 0x02, 0x14}, 0xf8, 0xf8, ALPS_PASS | ALPS_DUALPOINT}, - // Toshiba Salellite Pro M10 + // Toshiba Salellite Pro M10 // {{0x33, 0x02, 0x0a}, 0x88, 0xf8, ALPS_OLDPROTO}, // UMAX-530T {{0x53, 0x02, 0x0a}, 0xf8, 0xf8, 0}, @@ -155,15 +155,6 @@ static const struct alps_model_info gALPSModelInfos[] = { static alps_model_info* sFoundModel = NULL; -#define PS2_MOUSE_CMD_SET_SCALE11 0xe6 -#define PS2_MOUSE_CMD_SET_SCALE21 0xe7 -#define PS2_MOUSE_CMD_SET_RES 0xe8 -#define PS2_MOUSE_CMD_GET_INFO 0xe9 -#define PS2_MOUSE_CMD_SET_STREAM 0xea -#define PS2_MOUSE_CMD_SET_POLL 0xf0 -#define PS2_MOUSE_CMD_SET_RATE 0xf3 - - // touchpad proportions #define EDGE_MOTION_WIDTH 55 // increase the touchpad size a little bit @@ -279,16 +270,16 @@ probe_alps(ps2_dev* dev) TRACE("ALPS: probe\n"); val[0] = 0; - if (ps2_dev_command(dev, PS2_MOUSE_CMD_SET_RES, val, 1, NULL, 0) != B_OK - || ps2_dev_command(dev, PS2_MOUSE_CMD_SET_SCALE11, NULL, 0, NULL, 0) + if (ps2_dev_command(dev, PS2_CMD_MOUSE_SET_RES, val, 1, NULL, 0) != B_OK + || ps2_dev_command(dev, PS2_CMD_MOUSE_SET_SCALE11, NULL, 0, NULL, 0) != B_OK - || ps2_dev_command(dev, PS2_MOUSE_CMD_SET_SCALE11, NULL, 0, NULL, 0) + || ps2_dev_command(dev, PS2_CMD_MOUSE_SET_SCALE11, NULL, 0, NULL, 0) != B_OK - || ps2_dev_command(dev, PS2_MOUSE_CMD_SET_SCALE11, NULL, 0, NULL, 0) + || ps2_dev_command(dev, PS2_CMD_MOUSE_SET_SCALE11, NULL, 0, NULL, 0) != B_OK) return B_ERROR; - if (ps2_dev_command(dev, PS2_MOUSE_CMD_GET_INFO, NULL, 0, val, 3) + if (ps2_dev_command(dev, PS2_CMD_MOUSE_GET_INFO, NULL, 0, val, 3) != B_OK) return B_ERROR; @@ -296,16 +287,16 @@ probe_alps(ps2_dev* dev) return B_ERROR; val[0] = 0; - if (ps2_dev_command(dev, PS2_MOUSE_CMD_SET_RES, val, 1, NULL, 0) != B_OK - || ps2_dev_command(dev, PS2_MOUSE_CMD_SET_SCALE21, NULL, 0, NULL, 0) + if (ps2_dev_command(dev, PS2_CMD_MOUSE_SET_RES, val, 1, NULL, 0) != B_OK + || ps2_dev_command(dev, PS2_CMD_MOUSE_SET_SCALE21, NULL, 0, NULL, 0) != B_OK - || ps2_dev_command(dev, PS2_MOUSE_CMD_SET_SCALE21, NULL, 0, NULL, 0) + || ps2_dev_command(dev, PS2_CMD_MOUSE_SET_SCALE21, NULL, 0, NULL, 0) != B_OK - || ps2_dev_command(dev, PS2_MOUSE_CMD_SET_SCALE21, NULL, 0, NULL, 0) + || ps2_dev_command(dev, PS2_CMD_MOUSE_SET_SCALE21, NULL, 0, NULL, 0) != B_OK) return B_ERROR; - if (ps2_dev_command(dev, PS2_MOUSE_CMD_GET_INFO, NULL, 0, val, 3) + if (ps2_dev_command(dev, PS2_CMD_MOUSE_GET_INFO, NULL, 0, val, 3) != B_OK) return B_ERROR; @@ -337,12 +328,12 @@ switch_hardware_tab(ps2_dev* dev, bool on) { uint8 val[3]; uint8 arg = 0x00; - uint8 command = PS2_MOUSE_CMD_SET_RES; + uint8 command = PS2_CMD_MOUSE_SET_RES; if (on) { arg = 0x0A; - command = PS2_MOUSE_CMD_SET_RATE; + command = PS2_CMD_KEYBOARD_SET_TYPEMATIC; } - if (ps2_dev_command(dev, PS2_MOUSE_CMD_GET_INFO, NULL, 0, val, 3) != B_OK + if (ps2_dev_command(dev, PS2_CMD_MOUSE_GET_INFO, NULL, 0, val, 3) != B_OK || ps2_dev_command(dev, PS2_CMD_DISABLE, NULL, 0, NULL, 0) != B_OK || ps2_dev_command(dev, PS2_CMD_DISABLE, NULL, 0, NULL, 0) != B_OK || ps2_dev_command(dev, command, &arg, 1, NULL, 0) != B_OK) @@ -355,9 +346,9 @@ switch_hardware_tab(ps2_dev* dev, bool on) status_t enable_passthrough(ps2_dev* dev, bool on) { - uint8 command = PS2_MOUSE_CMD_SET_SCALE11; + uint8 command = PS2_CMD_MOUSE_SET_SCALE11; if (on) - command = PS2_MOUSE_CMD_SET_SCALE21; + command = PS2_CMD_MOUSE_SET_SCALE21; if (ps2_dev_command(dev, command, NULL, 0, NULL, 0) != B_OK || ps2_dev_command(dev, command, NULL, 0, NULL, 0) != B_OK @@ -438,7 +429,7 @@ alps_open(const char *name, uint32 flags, void **_cookie) if ((sFoundModel->flags & ALPS_PASS) != 0 && enable_passthrough(dev, true) != B_OK) goto err4; - + // switch tap mode off if (switch_hardware_tab(dev, false) != B_OK) goto err4; @@ -455,7 +446,7 @@ alps_open(const char *name, uint32 flags, void **_cookie) && enable_passthrough(dev, false) != B_OK) goto err4; - if (ps2_dev_command(dev, PS2_MOUSE_CMD_SET_STREAM, NULL, 0, NULL, 0) != B_OK) + if (ps2_dev_command(dev, PS2_CMD_MOUSE_SET_STREAM, NULL, 0, NULL, 0) != B_OK) goto err4; if (ps2_dev_command(dev, PS2_CMD_ENABLE, NULL, 0, NULL, 0) != B_OK) @@ -633,4 +624,3 @@ device_hooks gALPSDeviceHooks = { alps_read, alps_write, }; - diff --git a/src/add-ons/kernel/bus_managers/ps2/ps2_alps.h b/src/add-ons/kernel/bus_managers/ps2/ps2_alps.h index e9dea0683d..4e25dc6485 100644 --- a/src/add-ons/kernel/bus_managers/ps2/ps2_alps.h +++ b/src/add-ons/kernel/bus_managers/ps2/ps2_alps.h @@ -1,3 +1,10 @@ +/* + * Copyright 2011, Haiku, Inc. + * Distributed under the terms of the MIT License. + * + * Authors: + * Clemens Zeidler (haiku@Clemens-Zeidler.de) + */ #ifndef ALPS_H #define ALPS_H diff --git a/src/add-ons/kernel/bus_managers/ps2/ps2_common.cpp b/src/add-ons/kernel/bus_managers/ps2/ps2_common.cpp index 37f902e74d..d0560f272b 100644 --- a/src/add-ons/kernel/bus_managers/ps2/ps2_common.cpp +++ b/src/add-ons/kernel/bus_managers/ps2/ps2_common.cpp @@ -369,7 +369,7 @@ ps2_init(void) //ps2_selftest(); // Setup the command byte with disabled keyboard and AUX interrupts - // to prevent interrupts storm on some KBCs during active multiplexing + // to prevent interrupts storm on some KBCs during active multiplexing // activation procedure. Fixes #7635. status = ps2_setup_command_byte(false); if (status) { @@ -391,8 +391,9 @@ ps2_init(void) } if (gActiveMultiplexingEnabled) { - if (ps2_dev_command_timeout(&ps2_device[PS2_DEVICE_MOUSE], 0xe6, - NULL, 0, NULL, 0, 100000) == B_TIMED_OUT) { + if (ps2_dev_command_timeout(&ps2_device[PS2_DEVICE_MOUSE], + PS2_CMD_MOUSE_SET_SCALE11, NULL, 0, NULL, 0, 100000) + == B_TIMED_OUT) { INFO("ps2: accessing multiplexed mouse port 0 timed out, ignoring it!\n"); } else { ps2_service_notify_device_added(&ps2_device[PS2_DEVICE_MOUSE]); diff --git a/src/add-ons/kernel/bus_managers/ps2/ps2_common.h b/src/add-ons/kernel/bus_managers/ps2/ps2_common.h index fc302faead..c32c7349f0 100644 --- a/src/add-ons/kernel/bus_managers/ps2/ps2_common.h +++ b/src/add-ons/kernel/bus_managers/ps2/ps2_common.h @@ -28,6 +28,7 @@ #else # define INFO(x...) #endif +#define ERROR(x...) dprintf(x) //#define TRACE_PS2 #ifdef TRACE_PS2 diff --git a/src/add-ons/kernel/bus_managers/ps2/ps2_defs.h b/src/add-ons/kernel/bus_managers/ps2/ps2_defs.h index b9f237cc1c..25fbf1af28 100644 --- a/src/add-ons/kernel/bus_managers/ps2/ps2_defs.h +++ b/src/add-ons/kernel/bus_managers/ps2/ps2_defs.h @@ -48,7 +48,13 @@ #define PS2_BITS_TRANSLATE_SCANCODES 0x40 // data words +#define PS2_CMD_MOUSE_SET_SCALE11 0xe6 +#define PS2_CMD_MOUSE_SET_SCALE21 0xe7 +#define PS2_CMD_MOUSE_SET_RES 0xe8 +#define PS2_CMD_MOUSE_GET_INFO 0xe9 +#define PS2_CMD_MOUSE_SET_STREAM 0xea #define PS2_CMD_KEYBOARD_SET_LEDS 0xed +#define PS2_CMD_MOUSE_SET_POLL 0xf0 #define PS2_CMD_KEYBOARD_SET_TYPEMATIC 0xf3 #define PS2_CMD_ECHO 0xee #define PS2_CMD_TEST_PASSED 0xaa @@ -56,6 +62,7 @@ #define PS2_CMD_SET_SAMPLE_RATE 0xf3 #define PS2_CMD_ENABLE 0xf4 #define PS2_CMD_DISABLE 0xf5 +#define PS2_CMD_MOUSE_RESET_DIS 0xf6 #define PS2_CMD_RESET 0xff #define PS2_CMD_RESEND 0xfe @@ -79,6 +86,7 @@ #define PS2_PACKET_INTELLIMOUSE 4 #define PS2_PACKET_SYNAPTICS 6 #define PS2_PACKET_ALPS 6 +#define PS2_PACKET_ELANTECH 6 // version 1 is only 4 #define PS2_MAX_PACKET_SIZE 6 // Should be equal to the biggest packet size diff --git a/src/add-ons/kernel/bus_managers/ps2/ps2_dev.cpp b/src/add-ons/kernel/bus_managers/ps2/ps2_dev.cpp index 0cb799a5a4..4f7137b8e4 100644 --- a/src/add-ons/kernel/bus_managers/ps2/ps2_dev.cpp +++ b/src/add-ons/kernel/bus_managers/ps2/ps2_dev.cpp @@ -14,6 +14,7 @@ #include "ps2_service.h" #include "ps2_alps.h" +#include "ps2_elantech.h" #include "ps2_standard_mouse.h" #include "ps2_synaptics.h" #include "ps2_trackpoint.h" @@ -88,6 +89,12 @@ ps2_dev_detect_pointing(ps2_dev *dev, device_hooks **hooks) goto dev_found; } + status = probe_elantech(dev); + if (status == B_OK) { + *hooks = &gElantechDeviceHooks; + goto dev_found; + } + // reset the mouse for the case that the previous probes leaf the mouse in // a undefined state status = ps2_reset_mouse(dev); @@ -190,7 +197,7 @@ ps2_dev_publish(ps2_dev *dev) if (atomic_get(&dev->flags) & PS2_FLAG_KEYB) { status = devfs_publish_device(dev->name, &gKeyboardDeviceHooks); } else { - // Check if this is the "pass-through" device and wait until + // Check if this is the "pass-through" device and wait until // the parent_dev goes to enabled state. It is required to prevent // from messing up the Synaptics command sequences in synaptics_open. if (dev->parent_dev) { @@ -204,7 +211,7 @@ ps2_dev_publish(ps2_dev *dev) snooze(timeout / 20); } TRACE("ps2: publishing %s: parent %s is %s; wait time %" B_PRId64 - "\n", dev->name, dev->parent_dev->name, + "\n", dev->name, dev->parent_dev->name, status == B_OK ? "enabled" : "busy", system_time() - start); } @@ -490,3 +497,23 @@ ps2_dev_command_timeout(ps2_dev *dev, uint8 cmd, const uint8 *out, return dev->command(dev, cmd, out, out_count, in, in_count, timeout); } + +status_t +ps2_dev_sliced_command(ps2_dev *dev, uint8 cmd) +{ + if (ps2_dev_command(dev, PS2_CMD_MOUSE_SET_SCALE11) != B_OK) + return B_ERROR; + uint8 val = (cmd >> 6) & 3; + if (ps2_dev_command(dev, PS2_CMD_MOUSE_SET_RES, &val, 1) != B_OK) + return B_ERROR; + val = (cmd >> 4) & 3; + if (ps2_dev_command(dev, PS2_CMD_MOUSE_SET_RES, &val, 1) != B_OK) + return B_ERROR; + val = (cmd >> 2) & 3; + if (ps2_dev_command(dev, PS2_CMD_MOUSE_SET_RES, &val, 1) != B_OK) + return B_ERROR; + val = cmd & 3; + if (ps2_dev_command(dev, PS2_CMD_MOUSE_SET_RES, &val, 1) != B_OK) + return B_ERROR; + return B_OK; +} diff --git a/src/add-ons/kernel/bus_managers/ps2/ps2_dev.h b/src/add-ons/kernel/bus_managers/ps2/ps2_dev.h index c8c283609f..229dbe0c0f 100644 --- a/src/add-ons/kernel/bus_managers/ps2/ps2_dev.h +++ b/src/add-ons/kernel/bus_managers/ps2/ps2_dev.h @@ -76,10 +76,12 @@ void ps2_dev_exit(void); status_t standard_command_timeout(ps2_dev *dev, uint8 cmd, const uint8 *out, int out_count, uint8 *in, int in_count, bigtime_t timeout); -status_t ps2_dev_command(ps2_dev *dev, uint8 cmd, const uint8 *out, - int out_count, uint8 *in, int in_count); +status_t ps2_dev_command(ps2_dev *dev, uint8 cmd, const uint8 *out = NULL, + int out_count = 0, uint8 *in = NULL, int in_count = 0); status_t ps2_dev_command_timeout(ps2_dev *dev, uint8 cmd, const uint8 *out, int out_count, uint8 *in, int in_count, bigtime_t timeout); +status_t ps2_dev_sliced_command(ps2_dev *dev, uint8 cmd); + status_t ps2_reset_mouse(ps2_dev *dev); diff --git a/src/add-ons/kernel/bus_managers/ps2/ps2_elantech.cpp b/src/add-ons/kernel/bus_managers/ps2/ps2_elantech.cpp new file mode 100644 index 0000000000..355bd4f03b --- /dev/null +++ b/src/add-ons/kernel/bus_managers/ps2/ps2_elantech.cpp @@ -0,0 +1,801 @@ +/* + * Copyright 2013, Haiku, Inc. + * Distributed under the terms of the MIT License. + * + * Hardware specs taken from the linux driver, thanks a lot! + * Based on ps2_alps.c + * + * Authors: + * Jérôme Duval + */ + + +#include "ps2_elantech.h" + +#include +#include + +#include "ps2_service.h" + + +static int32 generate_event(timer* timer); + + +const bigtime_t kEventInterval = 1000 * 50; + + +class EventProducer { +public: + EventProducer() + { + fFired = false; + } + + status_t + FireEvent(elantech_cookie* cookie, uint8* package) + { + fCookie = cookie; + memcpy(fLastPackage, package, sizeof(uint8) * PS2_PACKET_ELANTECH); + + status_t status = add_timer(&fEventTimer, &generate_event, + kEventInterval, B_ONE_SHOT_RELATIVE_TIMER); + if (status == B_OK) + fFired = true; + return status; + } + + bool + CancelEvent() + { + if (!fFired) + return false; + fFired = false; + return cancel_timer(&fEventTimer); + } + + void + InjectEvent() + { + if (packet_buffer_write(fCookie->ring_buffer, fLastPackage, + PS2_PACKET_ELANTECH) != PS2_PACKET_ELANTECH) { + // buffer is full, drop new data + return; + } + release_sem_etc(fCookie->sem, 1, B_DO_NOT_RESCHEDULE); + } + +private: + bool fFired; + uint8 fLastPackage[PS2_PACKET_ELANTECH]; + timer fEventTimer; + elantech_cookie* fCookie; +}; + + +static EventProducer gEventProducer; + + +static int32 +generate_event(timer* timer) +{ + gEventProducer.InjectEvent(); + return 0; +} + + +const char* kElantechPath[4] = { + "input/touchpad/ps2/elantech_0", + "input/touchpad/ps2/elantech_1", + "input/touchpad/ps2/elantech_2", + "input/touchpad/ps2/elantech_3" +}; + + +#define ELANTECH_CMD_GET_ID 0x00 +#define ELANTECH_CMD_GET_VERSION 0x01 +#define ELANTECH_CMD_GET_CAPABILITIES 0x02 +#define ELANTECH_CMD_GET_SAMPLE 0x03 +#define ELANTECH_CMD_GET_RESOLUTION 0x04 + +#define ELANTECH_CMD_REGISTER_READ 0x10 +#define ELANTECH_CMD_REGISTER_WRITE 0x11 +#define ELANTECH_CMD_REGISTER_READWRITE 0x00 +#define ELANTECH_CMD_PS2_CUSTOM_CMD 0xf8 + + +// touchpad proportions +#define EDGE_MOTION_WIDTH 55 + +#define MIN_PRESSURE 0 +#define REAL_MAX_PRESSURE 50 +#define MAX_PRESSURE 255 + +#define ELANTECH_HISTORY_SIZE 256 + + +static hardware_specs gHardwareSpecs; + + +static status_t +get_elantech_movement(elantech_cookie *cookie, mouse_movement *movement) +{ + touch_event event; + uint8 event_buffer[PS2_PACKET_ELANTECH]; + + status_t status = acquire_sem_etc(cookie->sem, 1, B_CAN_INTERRUPT, 0); + if (status < B_OK) + return status; + + if (!cookie->dev->active) { + TRACE("ELANTECH: read_event: Error device no longer active\n"); + return B_ERROR; + } + + if (packet_buffer_read(cookie->ring_buffer, event_buffer, + cookie->dev->packet_size) != cookie->dev->packet_size) { + TRACE("ELANTECH: error copying buffer\n"); + return B_ERROR; + } + + if (cookie->crcEnabled && (event_buffer[3] & 0x08) != 0) { + TRACE("ELANTECH: bad crc buffer\n"); + return B_ERROR; + } else if (!cookie->crcEnabled && ((event_buffer[0] & 0x0c) != 0x04 + || (event_buffer[3] & 0x1c) != 0x10)) { + TRACE("ELANTECH: bad crc buffer\n"); + return B_ERROR; + } + uint8 type = event_buffer[3] & 3; + TRACE("ELANTECH: packet type %d\n", type); + TRACE("ELANTECH: packet content 0x%02x%02x%02x%02x%02x%02x\n", + event_buffer[0], event_buffer[1], event_buffer[2], event_buffer[3], + event_buffer[4], event_buffer[5]); + switch (type) { + case 0: + // fingers + cookie->fingers = event_buffer[1] & 0x1f; + break; + case 1: + if ((((event_buffer[3] & 0xe0) >> 5) - 1) != 0) { + // only process first finger + return B_OK; + } + event.zPressure = (event_buffer[1] & 0xf0) + | ((event_buffer[4] & 0xf0) >> 4); + + cookie->previousZ = event.zPressure; + + event.xPosition = ((event_buffer[1] & 0xf) << 8) | event_buffer[2]; + event.yPosition = (((event_buffer[4] & 0xf) << 8) + | event_buffer[5]); + TRACE("ELANTECH: buttons 0x%x x %ld y %ld z %d\n", + event.buttons, event.xPosition, event.yPosition, + event.zPressure); + break; + case 2: + TRACE("ELANTECH: packet type motion\n"); + // TODO + return B_OK; + default: + TRACE("ELANTECH: unknown packet type %d\n", type); + return B_ERROR; + } + + event.buttons = 0; + // finger on touchpad + if ((cookie->fingers & 1) != 0) { + // finger with normal width + event.wValue = 4; + } else { + event.wValue = 3; + } + status = cookie->movementMaker.EventToMovement(&event, movement); + + if (cookie->movementMaker.WasEdgeMotion() + || cookie->movementMaker.TapDragStarted()) { + gEventProducer.FireEvent(cookie, event_buffer); + } + + return status; +} + + +static void +default_settings(touchpad_settings *set) +{ + memcpy(set, &kDefaultTouchpadSettings, sizeof(touchpad_settings)); +} + + +static status_t +synaptics_dev_send_command(ps2_dev* dev, uint8 cmd, uint8 *in, int in_count) +{ + uint8 val; + if (ps2_dev_sliced_command(dev, cmd) != B_OK + || ps2_dev_command(dev, PS2_CMD_MOUSE_GET_INFO, NULL, 0, in, in_count) + != B_OK) { + TRACE("ELANTECH: synaptics_dev_send_command failed\n"); + return B_ERROR; + } + return B_OK; +} + + +static status_t +elantech_dev_send_command(ps2_dev* dev, uint8 cmd, uint8 *in, int in_count) +{ + uint8 val; + if (ps2_dev_command(dev, ELANTECH_CMD_PS2_CUSTOM_CMD) != B_OK + || ps2_dev_command(dev, cmd) != B_OK + || ps2_dev_command(dev, PS2_CMD_MOUSE_GET_INFO, NULL, 0, in, in_count) + != B_OK) { + TRACE("ELANTECH: elantech_dev_send_command failed\n"); + return B_ERROR; + } + return B_OK; +} + + +status_t +probe_elantech(ps2_dev* dev) +{ + int i; + uint8 val[3]; + TRACE("ELANTECH: probe\n"); + + ps2_dev_command(dev, PS2_CMD_MOUSE_RESET_DIS); + + if (ps2_dev_command(dev, PS2_CMD_DISABLE) != B_OK + || ps2_dev_command(dev, PS2_CMD_MOUSE_SET_SCALE11) != B_OK + || ps2_dev_command(dev, PS2_CMD_MOUSE_SET_SCALE11) != B_OK + || ps2_dev_command(dev, PS2_CMD_MOUSE_SET_SCALE11) != B_OK) { + TRACE("ELANTECH: not found (1)\n"); + return B_ERROR; + } + + if (ps2_dev_command(dev, PS2_CMD_MOUSE_GET_INFO, NULL, 0, val, 3) + != B_OK) { + TRACE("ELANTECH: not found (2)\n"); + return B_ERROR; + } + + if (val[0] != 0x3c || val[1] != 0x3 || (val[2] != 0xc8 && val[2] != 0x0)) { + TRACE("ELANTECH: not found (3)\n"); + return B_ERROR; + } + + val[0] = 0; + if (synaptics_dev_send_command(dev, ELANTECH_CMD_GET_VERSION, val, 3) + != B_OK) { + TRACE("ELANTECH: not found (4)\n"); + return B_ERROR; + } + + if (val[0] == 0x0 || val[2] == 10 || val[2] == 20 || val[2] == 40 + || val[2] == 60 || val[2] == 80 || val[2] == 100 || val[2] == 200) { + TRACE("ELANTECH: not found (5)\n"); + return B_ERROR; + } + + INFO("Elantech found\n"); + + dev->name = kElantechPath[dev->idx]; + dev->packet_size = PS2_PACKET_ELANTECH; + + return B_OK; +} + + +static status_t +elantech_write_reg(elantech_cookie* cookie, uint8 reg, uint8 value) +{ + if (reg < 0x7 || reg > 0x26) + return B_BAD_VALUE; + if (reg > 0x11 && reg < 0x20) + return B_BAD_VALUE; + + ps2_dev* dev = cookie->dev; + switch (cookie->version) { + case 1: + // TODO + return B_ERROR; + break; + case 2: + if (ps2_dev_command(dev, ELANTECH_CMD_PS2_CUSTOM_CMD) != B_OK + || ps2_dev_command(dev, ELANTECH_CMD_REGISTER_WRITE) != B_OK + || ps2_dev_command(dev, ELANTECH_CMD_PS2_CUSTOM_CMD) != B_OK + || ps2_dev_command(dev, reg) != B_OK + || ps2_dev_command(dev, ELANTECH_CMD_PS2_CUSTOM_CMD) != B_OK + || ps2_dev_command(dev, value) != B_OK + || ps2_dev_command(dev, PS2_CMD_MOUSE_SET_SCALE11) != B_OK) + return B_ERROR; + break; + case 3: + if (ps2_dev_command(dev, ELANTECH_CMD_PS2_CUSTOM_CMD) != B_OK + || ps2_dev_command(dev, ELANTECH_CMD_REGISTER_READWRITE) != B_OK + || ps2_dev_command(dev, ELANTECH_CMD_PS2_CUSTOM_CMD) != B_OK + || ps2_dev_command(dev, reg) != B_OK + || ps2_dev_command(dev, ELANTECH_CMD_PS2_CUSTOM_CMD) != B_OK + || ps2_dev_command(dev, value) != B_OK + || ps2_dev_command(dev, PS2_CMD_MOUSE_SET_SCALE11) != B_OK) + return B_ERROR; + break; + case 4: + if (ps2_dev_command(dev, ELANTECH_CMD_PS2_CUSTOM_CMD) != B_OK + || ps2_dev_command(dev, ELANTECH_CMD_REGISTER_READWRITE) != B_OK + || ps2_dev_command(dev, ELANTECH_CMD_PS2_CUSTOM_CMD) != B_OK + || ps2_dev_command(dev, reg) != B_OK + || ps2_dev_command(dev, ELANTECH_CMD_PS2_CUSTOM_CMD) != B_OK + || ps2_dev_command(dev, ELANTECH_CMD_REGISTER_READWRITE) != B_OK + || ps2_dev_command(dev, ELANTECH_CMD_PS2_CUSTOM_CMD) != B_OK + || ps2_dev_command(dev, value) != B_OK + || ps2_dev_command(dev, PS2_CMD_MOUSE_SET_SCALE11) != B_OK) + return B_ERROR; + break; + default: + TRACE("ELANTECH: read_write_reg: unknown version\n"); + return B_ERROR; + } + return B_OK; +} + + +static status_t +elantech_read_reg(elantech_cookie* cookie, uint8 reg, uint8 *value) +{ + if (reg < 0x7 || reg > 0x26) + return B_BAD_VALUE; + if (reg > 0x11 && reg < 0x20) + return B_BAD_VALUE; + + ps2_dev* dev = cookie->dev; + uint8 val[3]; + switch (cookie->version) { + case 1: + // TODO + return B_ERROR; + break; + case 2: + if (ps2_dev_command(dev, ELANTECH_CMD_PS2_CUSTOM_CMD) != B_OK + || ps2_dev_command(dev, ELANTECH_CMD_REGISTER_READ) != B_OK + || ps2_dev_command(dev, ELANTECH_CMD_PS2_CUSTOM_CMD) != B_OK + || ps2_dev_command(dev, reg) != B_OK + || ps2_dev_command(dev, PS2_CMD_MOUSE_GET_INFO, NULL, 0, val, + 3) != B_OK) + return B_ERROR; + break; + case 3: + case 4: + if (ps2_dev_command(dev, ELANTECH_CMD_PS2_CUSTOM_CMD) != B_OK + || ps2_dev_command(dev, ELANTECH_CMD_REGISTER_READWRITE) + != B_OK + || ps2_dev_command(dev, ELANTECH_CMD_PS2_CUSTOM_CMD) != B_OK + || ps2_dev_command(dev, reg) != B_OK + || ps2_dev_command(dev, PS2_CMD_MOUSE_GET_INFO, NULL, 0, val, + 3) != B_OK) + return B_ERROR; + break; + default: + TRACE("ELANTECH: read_write_reg: unknown version\n"); + return B_ERROR; + } + if (cookie->version == 4) + *value = val[1]; + else + *value = val[0]; + + return B_OK; +} + + + +static status_t +switch_hardware_tab(ps2_dev* dev, bool on) +{ + uint8 val[3]; + uint8 arg = 0x00; + uint8 command = PS2_CMD_MOUSE_SET_RES; + if (on) { + arg = 0x0A; + command = PS2_CMD_SET_SAMPLE_RATE; + } + if (ps2_dev_command(dev, PS2_CMD_MOUSE_GET_INFO, NULL, 0, val, 3) != B_OK + || ps2_dev_command(dev, PS2_CMD_DISABLE, NULL, 0, NULL, 0) != B_OK + || ps2_dev_command(dev, PS2_CMD_DISABLE, NULL, 0, NULL, 0) != B_OK + || ps2_dev_command(dev, command, &arg, 1, NULL, 0) != B_OK) + return B_ERROR; + + return B_OK; +} + + +static status_t +get_resolution_v4(elantech_cookie* cookie, uint32* x, uint32* y) +{ + uint8 val[3]; + if (elantech_dev_send_command(cookie->dev, ELANTECH_CMD_GET_RESOLUTION, + val, 3) != B_OK) + return B_ERROR; + *x = (val[1] & 0xf) * 10 + 790; + *y = ((val[1] & 0xf) >> 4) * 10 + 790; + return B_OK; +} + + +static status_t +get_range(elantech_cookie* cookie, uint32* x_min, uint32* y_min, uint32* x_max, + uint32* y_max, uint32 *width) +{ + status_t status = B_OK; + uint8 val[3]; + switch (cookie->version) { + case 1: + *x_min = 32; + *y_min = 32; + *x_max = 544; + *y_max = 344; + *width = 0; + break; + case 2: + // TODO + break; + case 3: + if ((cookie->send_command)(cookie->dev, ELANTECH_CMD_GET_ID, val, 3) + != B_OK) { + return B_ERROR; + } + *x_min = 0; + *y_min = 0; + *x_max = ((val[0] & 0xf) << 8) | val[1]; + *y_max = ((val[0] & 0xf0) << 4) | val[2]; + *width = 0; + break; + case 4: + if ((cookie->send_command)(cookie->dev, ELANTECH_CMD_GET_ID, val, 3) + != B_OK) { + return B_ERROR; + } + *x_min = 0; + *y_min = 0; + *x_max = ((val[0] & 0xf) << 8) | val[1]; + *y_max = ((val[0] & 0xf0) << 4) | val[2]; + if (cookie->capabilities[1] < 2 || cookie->capabilities[1] > *x_max) + return B_ERROR; + *width = *x_max / (cookie->capabilities[1] - 1); + break; + } + return B_OK; +} + + +static status_t +enable_absolute_mode(elantech_cookie* cookie) +{ + status_t status = B_OK; + switch (cookie->version) { + case 1: + status = elantech_write_reg(cookie, 0x10, 0x16); + if (status == B_OK) + status = elantech_write_reg(cookie, 0x11, 0x8f); + break; + case 2: + status = elantech_write_reg(cookie, 0x10, 0x54); + if (status == B_OK) + status = elantech_write_reg(cookie, 0x11, 0x88); + if (status == B_OK) + status = elantech_write_reg(cookie, 0x12, 0x60); + break; + case 3: + status = elantech_write_reg(cookie, 0x10, 0xb); + break; + case 4: + status = elantech_write_reg(cookie, 0x7, 0x1); + break; + + } + + if (cookie->version < 4) { + uint8 val; + + for (uint8 retry = 0; retry < 5; retry++) { + status = elantech_read_reg(cookie, 0x10, &val); + if (status != B_OK) + break; + snooze(100); + } + } + + return status; +} + + +status_t +elantech_open(const char *name, uint32 flags, void **_cookie) +{ + TRACE("ELANTECH: open %s\n", name); + ps2_dev* dev; + int i; + for (dev = NULL, i = 0; i < PS2_DEVICE_COUNT; i++) { + if (0 == strcmp(ps2_device[i].name, name)) { + dev = &ps2_device[i]; + break; + } + } + + if (dev == NULL) { + TRACE("ps2: dev = NULL\n"); + return B_ERROR; + } + + if (atomic_or(&dev->flags, PS2_FLAG_OPEN) & PS2_FLAG_OPEN) + return B_BUSY; + + elantech_cookie* cookie = (elantech_cookie*)malloc( + sizeof(elantech_cookie)); + if (cookie == NULL) + goto err1; + memset(cookie, 0, sizeof(*cookie)); + + cookie->movementMaker.Init(); + cookie->previousZ = 0; + *_cookie = cookie; + + cookie->dev = dev; + dev->cookie = cookie; + dev->disconnect = &elantech_disconnect; + dev->handle_int = &elantech_handle_int; + + default_settings(&cookie->settings); + + dev->packet_size = PS2_PACKET_ELANTECH; + + cookie->ring_buffer = create_packet_buffer( + ELANTECH_HISTORY_SIZE * dev->packet_size); + if (cookie->ring_buffer == NULL) { + TRACE("ELANTECH: can't allocate mouse actions buffer\n"); + goto err2; + } + // create the mouse semaphore, used for synchronization between + // the interrupt handler and the read operation + cookie->sem = create_sem(0, "ps2_elantech_sem"); + if (cookie->sem < 0) { + TRACE("ELANTECH: failed creating semaphore!\n"); + goto err3; + } + + uint8 val[3]; + if (synaptics_dev_send_command(dev, ELANTECH_CMD_GET_VERSION, val, 3) + != B_OK) { + TRACE("ELANTECH: get version failed!\n"); + goto err4; + } + cookie->fwVersion = (val[0] << 16) | (val[1] << 8) | val[2]; + if (cookie->fwVersion < 0x020030 || cookie->fwVersion == 0x020600) + cookie->version = 1; + else { + switch (val[0] & 0xf) { + case 2: + case 4: + cookie->version = 2; + break; + case 5: + cookie->version = 3; + case 6: + case 7: + cookie->version = 4; + break; + default: + TRACE("ELANTECH: unknown version!\n"); + goto err4; + } + } + TRACE("ELANTECH: version 0x%lx (0x%lx)\n", cookie->version, + cookie->fwVersion); + + if (cookie->version >= 3) + cookie->send_command = &elantech_dev_send_command; + else + cookie->send_command = &synaptics_dev_send_command; + cookie->crcEnabled = (cookie->fwVersion & 0x4000) == 0x4000; + + if ((cookie->send_command)(cookie->dev, ELANTECH_CMD_GET_CAPABILITIES, + cookie->capabilities, 3) != B_OK) { + TRACE("ELANTECH: get capabilities failed!\n"); + return B_ERROR; + } + + if (enable_absolute_mode(cookie) != B_OK) { + TRACE("ELANTECH: failed enabling absolute mode!\n"); + goto err4; + } + TRACE("ELANTECH: enabled absolute mode!\n"); + + uint32 x_min, x_max, y_min, y_max, width; + if (get_range(cookie, &x_min, &y_min, &x_max, &y_max, &width) != B_OK) { + TRACE("ELANTECH: get range failed!\n"); + goto err4; + } + + TRACE("ELANTECH: range x %ld-%ld y %ld-%ld (%ld)\n", x_min, x_max, + y_min, y_max, width); + + uint32 x_res, y_res; + if (get_resolution_v4(cookie, &x_res, &y_res) != B_OK) { + TRACE("ELANTECH: get resolution failed!\n"); + goto err4; + } + + TRACE("ELANTECH: resolution x %ld y %ld (dpi)\n", x_res, y_res); + + gHardwareSpecs.edgeMotionWidth = EDGE_MOTION_WIDTH; + + gHardwareSpecs.areaStartX = x_min; + gHardwareSpecs.areaEndX = x_max; + gHardwareSpecs.areaStartY = y_min; + gHardwareSpecs.areaEndY = y_max; + + gHardwareSpecs.minPressure = MIN_PRESSURE; + gHardwareSpecs.realMaxPressure = REAL_MAX_PRESSURE; + gHardwareSpecs.maxPressure = MAX_PRESSURE; + + cookie->movementMaker.SetSettings(&cookie->settings); + cookie->movementMaker.SetSpecs(&gHardwareSpecs); + + if (ps2_dev_command(dev, PS2_CMD_ENABLE, NULL, 0, NULL, 0) != B_OK) + goto err4; + + atomic_or(&dev->flags, PS2_FLAG_ENABLED); + + TRACE("ELANTECH: open %s success\n", name); + return B_OK; + +err4: + delete_sem(cookie->sem); +err3: + delete_packet_buffer(cookie->ring_buffer); +err2: + free(cookie); +err1: + atomic_and(&dev->flags, ~PS2_FLAG_OPEN); + + TRACE("ELANTECH: open %s failed\n", name); + return B_ERROR; +} + + +status_t +elantech_close(void *_cookie) +{ + gEventProducer.CancelEvent(); + + elantech_cookie *cookie = (elantech_cookie*)_cookie; + + ps2_dev_command_timeout(cookie->dev, PS2_CMD_DISABLE, NULL, 0, NULL, 0, + 150000); + + delete_packet_buffer(cookie->ring_buffer); + delete_sem(cookie->sem); + + atomic_and(&cookie->dev->flags, ~PS2_FLAG_OPEN); + atomic_and(&cookie->dev->flags, ~PS2_FLAG_ENABLED); + + // Reset the touchpad so it generate standard ps2 packets instead of + // extended ones. If not, BeOS is confused with such packets when rebooting + // without a complete shutdown. + status_t status = ps2_reset_mouse(cookie->dev); + if (status != B_OK) { + INFO("ps2: reset failed\n"); + return B_ERROR; + } + + TRACE("ELANTECH: close %s done\n", cookie->dev->name); + return B_OK; +} + + +status_t +elantech_freecookie(void *_cookie) +{ + free(_cookie); + return B_OK; +} + + +status_t +elantech_ioctl(void *_cookie, uint32 op, void *buffer, size_t length) +{ + elantech_cookie *cookie = (elantech_cookie*)_cookie; + mouse_movement movement; + status_t status; + + switch (op) { + case MS_READ: + TRACE("ELANTECH: MS_READ get event\n"); + if ((status = get_elantech_movement(cookie, &movement)) != B_OK) + return status; + return user_memcpy(buffer, &movement, sizeof(movement)); + + case MS_IS_TOUCHPAD: + TRACE("ELANTECH: MS_IS_TOUCHPAD\n"); + return B_OK; + + case MS_SET_TOUCHPAD_SETTINGS: + TRACE("ELANTECH: MS_SET_TOUCHPAD_SETTINGS"); + user_memcpy(&cookie->settings, buffer, sizeof(touchpad_settings)); + return B_OK; + + case MS_SET_CLICKSPEED: + TRACE("ELANTECH: ioctl MS_SETCLICK (set click speed)\n"); + return user_memcpy(&cookie->movementMaker.click_speed, buffer, + sizeof(bigtime_t)); + + default: + TRACE("ELANTECH: unknown opcode: %ld\n", op); + return B_BAD_VALUE; + } +} + + +static status_t +elantech_read(void* cookie, off_t pos, void* buffer, size_t* _length) +{ + *_length = 0; + return B_NOT_ALLOWED; +} + + +static status_t +elantech_write(void* cookie, off_t pos, const void* buffer, size_t* _length) +{ + *_length = 0; + return B_NOT_ALLOWED; +} + + +int32 +elantech_handle_int(ps2_dev* dev) +{ + elantech_cookie* cookie = (elantech_cookie*)dev->cookie; + + // we got a real event cancel the fake event + gEventProducer.CancelEvent(); + + uint8 val; + val = cookie->dev->history[0].data; + cookie->buffer[cookie->packet_index] = val; + cookie->packet_index++; + + if (cookie->packet_index < PS2_PACKET_ELANTECH) + return B_HANDLED_INTERRUPT; + + cookie->packet_index = 0; + if (packet_buffer_write(cookie->ring_buffer, + cookie->buffer, cookie->dev->packet_size) + != cookie->dev->packet_size) { + // buffer is full, drop new data + return B_HANDLED_INTERRUPT; + } + release_sem_etc(cookie->sem, 1, B_DO_NOT_RESCHEDULE); + return B_INVOKE_SCHEDULER; +} + + +void +elantech_disconnect(ps2_dev *dev) +{ + elantech_cookie *cookie = (elantech_cookie*)dev->cookie; + // the mouse device might not be opened at this point + INFO("ELANTECH: elantech_disconnect %s\n", dev->name); + if ((dev->flags & PS2_FLAG_OPEN) != 0) + release_sem(cookie->sem); +} + + +device_hooks gElantechDeviceHooks = { + elantech_open, + elantech_close, + elantech_freecookie, + elantech_ioctl, + elantech_read, + elantech_write, +}; diff --git a/src/add-ons/kernel/bus_managers/ps2/ps2_elantech.h b/src/add-ons/kernel/bus_managers/ps2/ps2_elantech.h new file mode 100644 index 0000000000..b68a7bb369 --- /dev/null +++ b/src/add-ons/kernel/bus_managers/ps2/ps2_elantech.h @@ -0,0 +1,59 @@ +/* + * Copyright 2013, Haiku, Inc. + * Distributed under the terms of the MIT License. + * + * The elantech_model_info struct and all the hardware specs are taken from the + * linux driver, thanks a lot! + * + * Authors: + * Jérôme Duval + */ +#ifndef _PS2_ELANTECH_H +#define _PS2_ELANTECH_H + + +#include + +#include + +#include "movement_maker.h" +#include "packet_buffer.h" +#include "ps2_dev.h" + + +typedef struct { + ps2_dev* dev; + + sem_id sem; + struct packet_buffer* ring_buffer; + size_t packet_index; + uint8 buffer[PS2_PACKET_ELANTECH]; + uint8 mode; + + uint8 previousZ; + TouchpadMovement movementMaker; + + touchpad_settings settings; + uint32 version; + uint32 fwVersion; + uint8 capabilities[3]; + bool crcEnabled; + uint32 fingers; + status_t (*send_command)(ps2_dev* dev, uint8 cmd, uint8 *in, int in_count); +} elantech_cookie; + + +status_t probe_elantech(ps2_dev *dev); + +status_t elantech_open(const char *name, uint32 flags, void **_cookie); +status_t elantech_close(void *_cookie); +status_t elantech_freecookie(void *_cookie); +status_t elantech_ioctl(void *_cookie, uint32 op, void *buffer, size_t length); + +int32 elantech_handle_int(ps2_dev *dev); +void elantech_disconnect(ps2_dev *dev); + +extern device_hooks gElantechDeviceHooks; + + +#endif /* _PS2_ELANTECH_H */ diff --git a/src/add-ons/kernel/bus_managers/virtio/VirtioModule.cpp b/src/add-ons/kernel/bus_managers/virtio/VirtioModule.cpp index f2a284e96e..41b5860365 100644 --- a/src/add-ons/kernel/bus_managers/virtio/VirtioModule.cpp +++ b/src/add-ons/kernel/bus_managers/virtio/VirtioModule.cpp @@ -134,6 +134,31 @@ virtio_queue_request(virtio_queue cookie, const physical_entry *readEntry, } +bool +virtio_queue_is_full(virtio_queue cookie) +{ + VirtioQueue *queue = (VirtioQueue *)cookie; + return queue->IsFull(); +} + + +bool +virtio_queue_is_empty(virtio_queue cookie) +{ + VirtioQueue *queue = (VirtioQueue *)cookie; + return queue->IsEmpty(); +} + + +uint16 +virtio_queue_size(virtio_queue cookie) +{ + VirtioQueue *queue = (VirtioQueue *)cookie; + return queue->Size(); +} + + + // #pragma mark - @@ -222,7 +247,10 @@ virtio_device_interface virtio_device_module = { virtio_alloc_queues, virtio_setup_interrupt, virtio_queue_request, - virtio_queue_request_v + virtio_queue_request_v, + virtio_queue_is_full, + virtio_queue_is_empty, + virtio_queue_size }; virtio_for_controller_interface virtio_for_controller_module = { diff --git a/src/add-ons/kernel/bus_managers/virtio/VirtioPrivate.h b/src/add-ons/kernel/bus_managers/virtio/VirtioPrivate.h index a83eaf8058..4e0e0d132e 100644 --- a/src/add-ons/kernel/bus_managers/virtio/VirtioPrivate.h +++ b/src/add-ons/kernel/bus_managers/virtio/VirtioPrivate.h @@ -107,6 +107,7 @@ public: bool IsFull() const { return fRingFree == 0; } bool IsEmpty() const { return fRingFree == fRingSize; } + uint16 Size() const { return fRingSize; } VirtioDevice* Device() { return fDevice; } diff --git a/src/add-ons/kernel/drivers/audio/hda/hda_codec.cpp b/src/add-ons/kernel/drivers/audio/hda/hda_codec.cpp index b8ff560260..4cdd2225a6 100644 --- a/src/add-ons/kernel/drivers/audio/hda/hda_codec.cpp +++ b/src/add-ons/kernel/drivers/audio/hda/hda_codec.cpp @@ -1154,7 +1154,7 @@ TRACE("build tree!\n"); static void -hda_codec_switch_init(hda_audio_group* audioGroup) +hda_audio_group_switch_init(hda_audio_group* audioGroup) { for (uint32 i = 0; i < audioGroup->widget_count; i++) { hda_widget& widget = audioGroup->widgets[i]; @@ -1175,10 +1175,8 @@ hda_codec_switch_init(hda_audio_group* audioGroup) static void -hda_codec_check_sense(hda_codec* codec, bool disable) +hda_audio_group_check_sense(hda_audio_group* audioGroup, bool disable) { - hda_audio_group* audioGroup = codec->audio_groups[0]; - for (uint32 i = 0; i < audioGroup->widget_count; i++) { hda_widget& widget = audioGroup->widgets[i]; @@ -1233,7 +1231,8 @@ hda_codec_switch_handler(hda_codec* codec) codec->unsol_response_read %= MAX_CODEC_UNSOL_RESPONSES; bool disable = response & 1; - hda_codec_check_sense(codec, disable); + hda_audio_group* audioGroup = codec->audio_groups[0]; + hda_audio_group_check_sense(audioGroup, disable); } return B_OK; } @@ -1285,8 +1284,8 @@ hda_codec_new_audio_group(hda_codec* codec, uint32 audioGroupNodeID) if (hda_audio_group_build_tree(audioGroup) != B_OK) goto err; - hda_codec_switch_init(audioGroup); - + hda_audio_group_switch_init(audioGroup); + audioGroup->playback_stream = hda_stream_new(audioGroup, STREAM_PLAYBACK); audioGroup->record_stream = hda_stream_new(audioGroup, STREAM_RECORD); TRACE("hda: streams playback %p, record %p\n", audioGroup->playback_stream, @@ -1295,6 +1294,7 @@ hda_codec_new_audio_group(hda_codec* codec, uint32 audioGroupNodeID) if (audioGroup->playback_stream != NULL || audioGroup->record_stream != NULL) { codec->audio_groups[codec->num_audio_groups++] = audioGroup; + hda_audio_group_check_sense(audioGroup, false); return B_OK; } @@ -1527,8 +1527,6 @@ hda_codec_new(hda_controller* controller, uint32 codecAddress) } } - hda_codec_check_sense(codec, false); - codec->unsol_response_thread = spawn_kernel_thread( (status_t(*)(void*))hda_codec_switch_handler, "hda_codec_unsol_thread", B_LOW_PRIORITY, codec); diff --git a/src/add-ons/kernel/drivers/disk/norflash/norflash.cpp b/src/add-ons/kernel/drivers/disk/norflash/norflash.cpp index 1fd7be7e40..fc9de2a4b8 100644 --- a/src/add-ons/kernel/drivers/disk/norflash/norflash.cpp +++ b/src/add-ons/kernel/drivers/disk/norflash/norflash.cpp @@ -63,6 +63,9 @@ nor_init_device(void *_info, void **_cookie) if (info->id < 0) return info->id; + info->mapped += HIDDEN_BLOCKS * info->blocksize; + + *_cookie = info; return B_OK; } diff --git a/src/add-ons/kernel/drivers/disk/usb/usb_disk/Jamfile b/src/add-ons/kernel/drivers/disk/usb/usb_disk/Jamfile index 862e3678a9..995055abb2 100644 --- a/src/add-ons/kernel/drivers/disk/usb/usb_disk/Jamfile +++ b/src/add-ons/kernel/drivers/disk/usb/usb_disk/Jamfile @@ -1,7 +1,7 @@ SubDir HAIKU_TOP src add-ons kernel drivers disk usb usb_disk ; SubDirSysHdrs $(HAIKU_TOP) src add-ons kernel bus_managers usb ; -UsePrivateHeaders kernel ; +UsePrivateHeaders drivers kernel ; KernelAddon usb_disk : usb_disk.cpp diff --git a/src/add-ons/kernel/drivers/disk/usb/usb_disk/usb_disk.cpp b/src/add-ons/kernel/drivers/disk/usb/usb_disk/usb_disk.cpp index ff03f98071..6c874f355b 100644 --- a/src/add-ons/kernel/drivers/disk/usb/usb_disk/usb_disk.cpp +++ b/src/add-ons/kernel/drivers/disk/usb/usb_disk/usb_disk.cpp @@ -18,6 +18,7 @@ #include +#include "scsi_sense.h" #include "usb_disk_scsi.h" @@ -136,11 +137,11 @@ status_t usb_disk_receive_csw(disk_device *device, status_t usb_disk_operation(device_lun *lun, uint8 operation, uint8 opLength, uint32 logicalBlockAddress, uint16 transferLength, void *data, size_t *dataLength, - bool directionIn); + bool directionIn, err_act *action = NULL); -status_t usb_disk_request_sense(device_lun *lun); +status_t usb_disk_request_sense(device_lun *lun, err_act *action); status_t usb_disk_mode_sense(device_lun *lun); -status_t usb_disk_test_unit_ready(device_lun *lun); +status_t usb_disk_test_unit_ready(device_lun *lun, err_act *action = NULL); status_t usb_disk_inquiry(device_lun *lun); status_t usb_disk_reset_capacity(device_lun *lun); status_t usb_disk_update_capacity(device_lun *lun); @@ -265,7 +266,7 @@ usb_disk_receive_csw(disk_device *device, command_status_wrapper *status) status_t usb_disk_operation(device_lun *lun, uint8 operation, uint8 opLength, uint32 logicalBlockAddress, uint16 transferLength, void *data, - size_t *dataLength, bool directionIn) + size_t *dataLength, bool directionIn, err_act *_action) { TRACE("operation: lun: %u; op: %u; oplen: %u; lba: %" B_PRIu32 "; tlen: %u; data: %p; dlen: %p (%lu); in: %c\n", @@ -407,7 +408,7 @@ usb_disk_operation(device_lun *lun, uint8 operation, uint8 opLength, " failed at the SCSI level\n", operation); } - result = usb_disk_request_sense(lun); + result = usb_disk_request_sense(lun, _action); return result == B_OK ? B_ERROR : result; } } @@ -437,7 +438,7 @@ usb_disk_operation(device_lun *lun, uint8 operation, uint8 opLength, status_t -usb_disk_request_sense(device_lun *lun) +usb_disk_request_sense(device_lun *lun, err_act *_action) { size_t dataLength = sizeof(scsi_request_sense_6_parameter); scsi_request_sense_6_parameter parameter; @@ -449,56 +450,42 @@ usb_disk_request_sense(device_lun *lun) return result; } + const char *label = NULL; + err_act action = err_act_fail; + status_t status = B_ERROR; + scsi_get_sense_asc_info((parameter.additional_sense_code << 8) + | parameter.additional_sense_code_qualifier, &label, &action, + &status); + if (parameter.sense_key > SCSI_SENSE_KEY_NOT_READY && parameter.sense_key != SCSI_SENSE_KEY_UNIT_ATTENTION) { TRACE_ALWAYS("request_sense: key: 0x%02x; asc: 0x%02x; ascq: " - "0x%02x;\n", parameter.sense_key, parameter.additional_sense_code, - parameter.additional_sense_code_qualifier); + "0x%02x; %s\n", parameter.sense_key, parameter.additional_sense_code, + parameter.additional_sense_code_qualifier, + label ? label : "(unknown)"); } - switch (parameter.sense_key) { - case SCSI_SENSE_KEY_NO_SENSE: - case SCSI_SENSE_KEY_RECOVERED_ERROR: - return B_OK; - - case SCSI_SENSE_KEY_HARDWARE_ERROR: - case SCSI_SENSE_KEY_MEDIUM_ERROR: - TRACE_ALWAYS("request_sense: media or hardware error\n"); - return B_DEV_UNREADABLE; - - case SCSI_SENSE_KEY_ILLEGAL_REQUEST: - TRACE_ALWAYS("request_sense: illegal request\n"); - return B_DEV_INVALID_IOCTL; - - case SCSI_SENSE_KEY_UNIT_ATTENTION: - if (parameter.additional_sense_code - != SCSI_ASC_MEDIUM_NOT_PRESENT) { - TRACE_ALWAYS("request_sense: media changed\n"); - lun->media_changed = true; - lun->media_present = true; - - return B_DEV_MEDIA_CHANGED; - } - // fall through - - case SCSI_SENSE_KEY_NOT_READY: - TRACE("request_sense: device not ready (asc 0x%02x ascq 0x%02x)\n", - parameter.additional_sense_code, - parameter.additional_sense_code_qualifier); - lun->media_present = false; - usb_disk_reset_capacity(lun); - return B_DEV_NOT_READY; - - case SCSI_SENSE_KEY_DATA_PROTECT: - TRACE_ALWAYS("request_sense: write protected\n"); - return B_READ_ONLY_DEVICE; - - case SCSI_SENSE_KEY_ABORTED_COMMAND: - TRACE_ALWAYS("request_sense: command aborted\n"); - return B_CANCELED; + if ((parameter.additional_sense_code == 0 + && parameter.additional_sense_code_qualifier == 0) + || label == NULL) { + scsi_get_sense_key_info(parameter.sense_key, &label, &action, &status); } - return B_ERROR; + if (status == B_DEV_MEDIA_CHANGED) { + lun->media_changed = true; + lun->media_present = true; + } else if (parameter.sense_key == SCSI_SENSE_KEY_UNIT_ATTENTION + && status != B_DEV_NO_MEDIA) { + lun->media_present = true; + } else if (status == B_DEV_NOT_READY) { + lun->media_present = false; + usb_disk_reset_capacity(lun); + } + + if (_action != NULL) + *_action = action; + + return status; } @@ -524,7 +511,7 @@ usb_disk_mode_sense(device_lun *lun) status_t -usb_disk_test_unit_ready(device_lun *lun) +usb_disk_test_unit_ready(device_lun *lun, err_act *_action) { // if unsupported we assume the unit is fixed and therefore always ok if (!lun->device->tur_supported) @@ -533,10 +520,10 @@ usb_disk_test_unit_ready(device_lun *lun) status_t result; if (lun->device->is_atapi) { result = usb_disk_operation(lun, SCSI_START_STOP_UNIT_6, 6, 0, 1, - NULL, NULL, false); + NULL, NULL, false, _action); } else { result = usb_disk_operation(lun, SCSI_TEST_UNIT_READY_6, 6, 0, 0, - NULL, NULL, true); + NULL, NULL, true, _action); } if (result == B_DEV_INVALID_IOCTL) { @@ -554,11 +541,14 @@ usb_disk_inquiry(device_lun *lun) size_t dataLength = sizeof(scsi_inquiry_6_parameter); scsi_inquiry_6_parameter parameter; status_t result = B_ERROR; + err_act action = err_act_ok; for (uint32 tries = 0; tries < 3; tries++) { result = usb_disk_operation(lun, SCSI_INQUIRY_6, 6, 0, dataLength, - ¶meter, &dataLength, true); - if (result == B_OK) + ¶meter, &dataLength, true, &action); + if (result == B_OK || (action != err_act_retry + && action != err_act_many_retries)) { break; + } } if (result != B_OK) { TRACE_ALWAYS("getting inquiry data failed: %s\n", strerror(result)); @@ -612,6 +602,7 @@ usb_disk_update_capacity(device_lun *lun) size_t dataLength = sizeof(scsi_read_capacity_10_parameter); scsi_read_capacity_10_parameter parameter; status_t result = B_ERROR; + err_act action = err_act_ok; // Retry reading the capacity up to three times. The first try might only // yield a unit attention telling us that the device or media status @@ -620,9 +611,11 @@ usb_disk_update_capacity(device_lun *lun) // reads. for (int32 i = 0; i < 3; i++) { result = usb_disk_operation(lun, SCSI_READ_CAPACITY_10, 10, 0, 0, - ¶meter, &dataLength, true); - if (result == B_OK) + ¶meter, &dataLength, true, &action); + if (result == B_OK || (action != err_act_retry + && action != err_act_many_retries)) { break; + } } if (result != B_OK) { @@ -801,10 +794,11 @@ usb_disk_device_added(usb_device newDevice, void **cookie) // initialize this lun result = usb_disk_inquiry(lun); + err_act action = err_act_ok; for (uint32 tries = 0; tries < 8; tries++) { TRACE("usb lun %"B_PRIu8" inquiry attempt %"B_PRIu32" begin\n", i, tries); - status_t ready = usb_disk_test_unit_ready(lun); + status_t ready = usb_disk_test_unit_ready(lun, &action); if (ready == B_OK || ready == B_DEV_NO_MEDIA) { if (lun->device_type == B_CD) lun->write_protected = true; @@ -821,7 +815,8 @@ usb_disk_device_added(usb_device newDevice, void **cookie) } TRACE("usb lun %"B_PRIu8" inquiry attempt %"B_PRIu32" failed\n", i, tries); - + if (action != err_act_retry && action != err_act_many_retries) + break; bigtime_t snoozeTime = 1000000 * tries; TRACE("snoozing %"B_PRIu64" microseconds for usb lun\n", snoozeTime); @@ -1095,7 +1090,17 @@ usb_disk_ioctl(void *cookie, uint32 op, void *buffer, size_t length) switch (op) { case B_GET_MEDIA_STATUS: { - *(status_t *)buffer = usb_disk_test_unit_ready(lun); + err_act action = err_act_ok; + for (uint32 tries = 0; tries < 3; tries++) { + status_t ready = usb_disk_test_unit_ready(lun, &action); + if (ready == B_OK || ready == B_DEV_NO_MEDIA + || (action != err_act_retry + && action != err_act_many_retries)) { + *(status_t *)buffer = ready; + break; + } + snooze(500000); + } TRACE("B_GET_MEDIA_STATUS: 0x%08" B_PRIx32 "\n", *(status_t *)buffer); result = B_OK; diff --git a/src/add-ons/kernel/drivers/graphics/radeon_hd/driver.cpp b/src/add-ons/kernel/drivers/graphics/radeon_hd/driver.cpp index e948edc4c2..9a5ef903d1 100644 --- a/src/add-ons/kernel/drivers/graphics/radeon_hd/driver.cpp +++ b/src/add-ons/kernel/drivers/graphics/radeon_hd/driver.cpp @@ -173,6 +173,7 @@ const struct supported_device { // Redwood {0x68da, 4, 0, RADEON_REDWOOD, CHIP_STD, "Radeon HD 5500"}, {0x68d9, 4, 0, RADEON_REDWOOD, CHIP_STD, "Radeon HD 5570"}, + {0x675f, 4, 0, RADEON_REDWOOD, CHIP_STD, "Radeon HD 5570"}, {0x68b9, 4, 0, RADEON_REDWOOD, CHIP_STD, "Radeon HD 5600"}, {0x68c1, 4, 0, RADEON_REDWOOD, CHIP_STD, "Radeon HD 5650"}, {0x68d8, 4, 0, RADEON_REDWOOD, CHIP_STD, "Radeon HD 5670"}, diff --git a/src/add-ons/kernel/file_systems/nfs4/FileSystem.cpp b/src/add-ons/kernel/file_systems/nfs4/FileSystem.cpp index 184e79a373..51c1600c25 100644 --- a/src/add-ons/kernel/file_systems/nfs4/FileSystem.cpp +++ b/src/add-ons/kernel/file_systems/nfs4/FileSystem.cpp @@ -125,8 +125,8 @@ GetInodeNames(const char** root, const char* _path) status_t -FileSystem::Mount(FileSystem** _fs, RPC::Server* serv, const char* fsPath, - dev_t id, const MountConfiguration& configuration) +FileSystem::Mount(FileSystem** _fs, RPC::Server* serv, const char* serverName, + const char* fsPath, dev_t id, const MountConfiguration& configuration) { ASSERT(_fs != NULL); ASSERT(serv != NULL); @@ -222,23 +222,23 @@ FileSystem::Mount(FileSystem** _fs, RPC::Server* serv, const char* fsPath, result = Inode::CreateInode(fs, fi, &inode); if (result != B_OK) return result; + RootInode* rootInode = reinterpret_cast(inode); + fs->fRoot = rootInode; - char* name = strrchr(fsPath, '/'); - if (name != NULL) { - name++; - reinterpret_cast(inode)->SetName(name); - } else if (fsPath[0] != '\0') - reinterpret_cast(inode)->SetName(fsPath); - else { - char* address = serv->ID().UniversalAddress(); - if (address != NULL) - reinterpret_cast(inode)->SetName(address); - else - reinterpret_cast(inode)->SetName("NFS4 Share"); - free(address); - } + char* fsName = strdup(fsPath); + if (fsName == NULL) + return B_NO_MEMORY; + for (int i = strlen(fsName) - 1; i >= 0 && fsName[i] == '/'; i--) + fsName[i] = '\0'; - fs->fRoot = reinterpret_cast(inode); + char* name = strrchr(fsName, '/'); + if (name != NULL) + rootInode->SetName(name + 1); + else if (fsName[0] != '\0') + rootInode->SetName(fsName); + else + rootInode->SetName(serverName); + free(fsName); fs->NFSServer()->AddFileSystem(fs); *_fs = fs; diff --git a/src/add-ons/kernel/file_systems/nfs4/FileSystem.h b/src/add-ons/kernel/file_systems/nfs4/FileSystem.h index 5d16d8d477..5ca172d484 100644 --- a/src/add-ons/kernel/file_systems/nfs4/FileSystem.h +++ b/src/add-ons/kernel/file_systems/nfs4/FileSystem.h @@ -32,7 +32,8 @@ struct MountConfiguration { class FileSystem : public DoublyLinkedListLinkImpl { public: static status_t Mount(FileSystem** pfs, RPC::Server* serv, - const char* path, dev_t id, + const char* path, const char* serverName, + dev_t id, const MountConfiguration& configuration); ~FileSystem(); diff --git a/src/add-ons/kernel/file_systems/nfs4/kernel_interface.cpp b/src/add-ons/kernel/file_systems/nfs4/kernel_interface.cpp index b8f7294dff..2f26e42a62 100644 --- a/src/add-ons/kernel/file_systems/nfs4/kernel_interface.cpp +++ b/src/add-ons/kernel/file_systems/nfs4/kernel_interface.cpp @@ -74,8 +74,8 @@ CreateNFS4Server(RPC::Server* serv) // dirtime=X - attempt revalidate directory cache not more often than each X // seconds static status_t -ParseArguments(const char* _args, AddressResolver** address, char** _path, - MountConfiguration* conf) +ParseArguments(const char* _args, AddressResolver** address, char** _server, + char** _path, MountConfiguration* conf) { if (_args == NULL) return B_BAD_VALUE; @@ -94,12 +94,18 @@ ParseArguments(const char* _args, AddressResolver** address, char** _path, return B_MISMATCHED_VALUES; *path++ = '\0'; - *address = new AddressResolver(args); - if (*address == NULL) + *_server = strdup(args); + if (*_server == NULL) return B_NO_MEMORY; + *address = new AddressResolver(args); + if (*address == NULL) { + delete *_server; + return B_NO_MEMORY; + } *_path = strdup(path); if (*_path == NULL) { + delete *_server; delete *address; return B_NO_MEMORY; } @@ -176,7 +182,8 @@ nfs4_mount(fs_volume* volume, const char* device, uint32 flags, AddressResolver* resolver; MountConfiguration config; char* path; - result = ParseArguments(args, &resolver, &path, &config); + char* serverName; + result = ParseArguments(args, &resolver, &serverName, &path, &config); if (result != B_OK) return result; MemoryDeleter pathDeleter(path); @@ -188,7 +195,9 @@ nfs4_mount(fs_volume* volume, const char* device, uint32 flags, return result; FileSystem* fs; - result = FileSystem::Mount(&fs, server, path, volume->id, config); + result = FileSystem::Mount(&fs, server, serverName, path, volume->id, + config); + free(serverName); if (result != B_OK) { gRPCServerManager->Release(server); return result; diff --git a/src/apps/networkstatus/NetworkStatusView.cpp b/src/apps/networkstatus/NetworkStatusView.cpp index cdff48eb65..45b5a4af45 100644 --- a/src/apps/networkstatus/NetworkStatusView.cpp +++ b/src/apps/networkstatus/NetworkStatusView.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2006-2012, Haiku, Inc. All rights reserved. + * Copyright 2006-2013, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. * * Authors: @@ -288,10 +288,12 @@ NetworkStatusView::MessageReceived(BMessage* message) { const char* deviceName; const char* name; + BNetworkAddress address; if (message->FindString("device", &deviceName) == B_OK - && message->FindString("name", &name) == B_OK) { + && message->FindString("name", &name) == B_OK + && message->FindFlat("address", &address) == B_OK) { BNetworkDevice device(deviceName); - status_t status = device.JoinNetwork(name); + status_t status = device.JoinNetwork(address); if (status != B_OK) { BString text = B_TRANSLATE("Could not join wireless network:\n"); @@ -467,6 +469,7 @@ NetworkStatusView::MouseDown(BPoint point) BMessage* message = new BMessage(kMsgJoinNetwork); message->AddString("device", wifiInterface); message->AddString("name", network.name); + message->AddFlat("address", &network.address); BMenuItem* item = new WirelessNetworkMenuItem(network.name, network.signal_strength, @@ -506,7 +509,7 @@ NetworkStatusView::_AboutRequested() { BAboutWindow* window = new BAboutWindow( B_TRANSLATE_SYSTEM_NAME("NetworkStatus"), kSignature); - + const char* authors[] = { "Axel Dörfler", "Hugo Santos", diff --git a/src/bin/coreutils/src/uname.c b/src/bin/coreutils/src/uname.c index f85d7e9124..16b0b33c94 100644 --- a/src/bin/coreutils/src/uname.c +++ b/src/bin/coreutils/src/uname.c @@ -50,6 +50,10 @@ # include #endif +#ifdef __HAIKU__ +# include +#endif + #include "system.h" #include "error.h" #include "quote.h" @@ -339,6 +343,23 @@ main (int argc, char **argv) # endif } #endif + +#ifdef __HAIKU__ + { + system_info sysinfo; + get_system_info(&sysinfo); + + switch (sysinfo.platform_type) { + case B_AT_CLONE_PLATFORM: + element = "x86"; + break; + case B_64_BIT_PC_PLATFORM: + element = "x86_64"; + break; + } + } +#endif + if (! (toprint == UINT_MAX && element == unknown)) print_element (element); } diff --git a/src/data/dts/bcm2835.dtsi b/src/data/dts/bcm2835.dtsi new file mode 100644 index 0000000000..8078ee413c --- /dev/null +++ b/src/data/dts/bcm2835.dtsi @@ -0,0 +1,468 @@ +/* + * Copyright (c) 2012 Oleksandr Tymoshenko + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +/ { + #address-cells = <1>; + #size-cells = <1>; + + cpus { + cpu@0 { + compatible = "arm,1176jzf-s"; + }; + }; + + + SOC: axi { + compatible = "simple-bus"; + #address-cells = <1>; + #size-cells = <1>; + reg = <0x20000000 0x01000000>; + ranges = <0 0x20000000 0x01000000>; + + intc: interrupt-controller { + compatible = "broadcom,bcm2835-armctrl-ic", + "broadcom,bcm2708-armctrl-ic"; + reg = <0xB200 0x200>; + + interrupt-controller; + #interrupt-cells = <1>; + + /* Bank 0 + * 0: ARM_TIMER + * 1: ARM_MAILBOX + * 2: ARM_DOORBELL_0 + * 3: ARM_DOORBELL_1 + * 4: VPU0_HALTED + * 5: VPU1_HALTED + * 6: ILLEGAL_TYPE0 + * 7: ILLEGAL_TYPE1 + */ + + /* Bank 1 + * 0: TIMER0 16: DMA0 + * 1: TIMER1 17: DMA1 + * 2: TIMER2 18: VC_DMA2 + * 3: TIMER3 19: VC_DMA3 + * 4: CODEC0 20: DMA4 + * 5: CODEC1 21: DMA5 + * 6: CODEC2 22: DMA6 + * 7: VC_JPEG 23: DMA7 + * 8: ISP 24: DMA8 + * 9: VC_USB 25: DMA9 + * 10: VC_3D 26: DMA10 + * 11: TRANSPOSER 27: DMA11 + * 12: MULTICORESYNC0 28: DMA12 + * 13: MULTICORESYNC1 29: AUX + * 14: MULTICORESYNC2 30: ARM + * 15: MULTICORESYNC3 31: VPUDMA + */ + + /* Bank 2 + * 0: HOSTPORT 16: SMI + * 1: VIDEOSCALER 17: GPIO0 + * 2: CCP2TX 18: GPIO1 + * 3: SDC 19: GPIO2 + * 4: DSI0 20: GPIO3 + * 5: AVE 21: VC_I2C + * 6: CAM0 22: VC_SPI + * 7: CAM1 23: VC_I2SPCM + * 8: HDMI0 24: VC_SDIO + * 9: HDMI1 25: VC_UART + * 10: PIXELVALVE1 26: SLIMBUS + * 11: I2CSPISLV 27: VEC + * 12: DSI1 28: CPG + * 13: PWA0 29: RNG + * 14: PWA1 30: VC_ARASANSDIO + * 15: CPR 31: AVSPMON + */ + }; + + timer { + compatible = "broadcom,bcm2835-system-timer", + "broadcom,bcm2708-system-timer"; + reg = <0x3000 0x1000>; + interrupts = <8 9 10 11>; + interrupt-parent = <&intc>; + + clock-frequency = <1000000>; + }; + + armtimer { + /* Not AMBA compatible */ + compatible = "broadcom,bcm2835-sp804", "arm,sp804"; + reg = <0xB400 0x24>; + interrupts = <0>; + interrupt-parent = <&intc>; + }; + + watchdog0 { + compatible = "broadcom,bcm2835-wdt", + "broadcom,bcm2708-wdt"; + reg = <0x10001c 0x0c>; /* 0x1c, 0x20, 0x24 */ + }; + + gpio: gpio { + compatible = "broadcom,bcm2835-gpio", + "broadcom,bcm2708-gpio"; + reg = <0x200000 0xb0>; + + /* Unusual arrangement of interrupts + * (determined by testing) + * 17: Bank 0 (GPIOs 0-31) + * 19: Bank 1 (GPIOs 32-53) + * 18: Bank 2 + * 20: All banks (GPIOs 0-53) + */ + interrupts = <57 59 58 60>; + interrupt-parent = <&intc>; + + gpio-controller; + #gpio-cells = <2>; + + interrupt-controller; + #interrupt-cells = <1>; + + pinctrl-names = "default"; + pinctrl-0 = <&pins_reserved>; + + /* Pins that can short 3.3V to GND in output mode: 46-47 + * Pins used by VideoCore: 48-53 + */ + broadcom,read-only = <46>, <47>, <48>, <49>, <50>, + <51>, <52>, <53>; + + /* BSC0 */ + pins_bsc0_a: bsc0_a { + broadcom,pins = <0>, <1>; + }; + + pins_bsc0_b: bsc0_b { + broadcom,pins = <28>, <29>; + }; + + pins_bsc0_c: bsc0_c { + broadcom,pins = <44>, <45>; + }; + + /* BSC1 */ + pins_bsc1_a: bsc1_a { + broadcom,pins = <2>, <3>; + }; + + pins_bsc1_b: bsc1_b { + broadcom,pins = <44>, <45>; + }; + + /* GPCLK0 */ + pins_gpclk0_a: gpclk0_a { + broadcom,pins = <4>; + }; + + pins_gpclk0_b: gpclk0_b { + broadcom,pins = <20>; + }; + + pins_gpclk0_c: gpclk0_c { + broadcom,pins = <32>; + }; + + pins_gpclk0_d: gpclk0_d { + broadcom,pins = <34>; + }; + + /* GPCLK1 */ + pins_gpclk1_a: gpclk1_a { + broadcom,pins = <5>; + }; + + pins_gpclk1_b: gpclk1_b { + broadcom,pins = <21>; + }; + + pins_gpclk1_c: gpclk1_c { + broadcom,pins = <42>; + }; + + pins_gpclk1_d: gpclk1_d { + broadcom,pins = <44>; + }; + + /* GPCLK2 */ + pins_gpclk2_a: gpclk2_a { + broadcom,pins = <6>; + }; + + pins_gpclk2_b: gpclk2_b { + broadcom,pins = <43>; + }; + + /* SPI0 */ + pins_spi0_a: spi0_a { + broadcom,pins = <7>, <8>, <9>, <10>, <11>; + }; + + pins_spi0_b: spi0_b { + broadcom,pins = <35>, <36>, <37>, <38>, <39>; + }; + + /* PWM */ + pins_pwm0_a: pwm0_a { + broadcom,pins = <12>; + }; + + pins_pwm0_b: pwm0_b { + broadcom,pins = <18>; + }; + + pins_pwm0_c: pwm0_c { + broadcom,pins = <40>; + }; + + pins_pwm1_a: pwm1_a { + broadcom,pins = <13>; + }; + + pins_pwm1_b: pwm1_b { + broadcom,pins = <19>; + }; + + pins_pwm1_c: pwm1_c { + broadcom,pins = <41>; + }; + + pins_pwm1_d: pwm1_d { + broadcom,pins = <45>; + }; + + /* UART0 */ + pins_uart0_a: uart0_a { + broadcom,pins = <14>, <15>; + }; + + pins_uart0_b: uart0_b { + broadcom,pins = <32>, <33>; + }; + + pins_uart0_c: uart0_c { + broadcom,pins = <36>, <37>; + }; + + pins_uart0_fc_a: uart0_fc_a { + broadcom,pins = <16>, <17>; + }; + + pins_uart0_fc_b: uart0_fc_b { + broadcom,pins = <30>, <31>; + }; + + pins_uart0_fc_c: uart0_fc_c { + broadcom,pins = <39>, <38>; + }; + + /* PCM */ + pins_pcm_a: pcm_a { + broadcom,pins = <18>, <19>, <20>, <21>; + }; + + pins_pcm_b: pcm_b { + broadcom,pins = <28>, <29>, <30>, <31>; + }; + + /* Secondary Address Bus */ + pins_sm_addr_a: sm_addr_a { + broadcom,pins = <5>, <4>, <3>, <2>, <1>, <0>; + }; + + pins_sm_addr_b: sm_addr_b { + broadcom,pins = <33>, <32>, <31>, <30>, <29>, + <28>; + }; + + pins_sm_ctl_a: sm_ctl_a { + broadcom,pins = <6>, <7>; + }; + + pins_sm_ctl_b: sm_ctl_b { + broadcom,pins = <34>, <35>; + }; + + pins_sm_data_8bit_a: sm_data_8bit_a { + broadcom,pins = <8>, <9>, <10>, <11>, <12>, + <13>, <14>, <15>; + }; + + pins_sm_data_8bit_b: sm_data_8bit_b { + broadcom,pins = <36>, <37>, <38>, <39>, <40>, + <41>, <42>, <43>; + }; + + pins_sm_data_16bit: sm_data_16bit { + broadcom,pins = <16>, <17>, <18>, <19>, <20>, + <21>, <22>, <23>; + }; + + pins_sm_data_18bit: sm_data_18bit { + broadcom,pins = <24>, <25>; + }; + + /* BSCSL */ + pins_bscsl: bscsl { + broadcom,pins = <18>, <19>; + }; + + /* SPISL */ + pins_spisl: spisl { + broadcom,pins = <18>, <19>, <20>, <21>; + }; + + /* SPI1 */ + pins_spi1: spi1 { + broadcom,pins = <16>, <17>, <18>, <19>, <20>, + <21>; + }; + + /* UART1 */ + pins_uart1_a: uart1_a { + broadcom,pins = <14>, <15>; + }; + + pins_uart1_b: uart1_b { + broadcom,pins = <32>, <33>; + }; + + pins_uart1_c: uart1_c { + broadcom,pins = <40>, <41>; + }; + + pins_uart1_fc_a: uart1_fc_a { + broadcom,pins = <16>, <17>; + }; + + pins_uart1_fc_b: uart1_fc_b { + broadcom,pins = <30>, <31>; + }; + + pins_uart1_fc_c: uart1_fc_c { + broadcom,pins = <43>, <42>; + }; + + /* SPI2 */ + pins_spi2: spi2 { + broadcom,pins = <40>, <41>, <42>, <43>, <44>, + <45>; + }; + + /* ARM JTAG */ + pins_arm_jtag_trst: arm_jtag_trst { + broadcom,pins = <22>; + }; + + pins_arm_jtag_a: arm_jtag_a { + broadcom,pins = <4>, <5>, <6>, <12>, <13>; + }; + + pins_arm_jtag_b: arm_jtag_b { + broadcom,pins = <23>, <24>, <25>, <26>, <27>; + }; + + /* Reserved */ + pins_reserved: reserved { + broadcom,pins = <48>, <49>, <50>, <51>, <52>, + <53>; + }; + }; + + dma: dma { + compatible = "broadcom,bcm2835-dma", + "broadcom,bcm2708-dma"; + reg = <0x7000 0x1000>, <0xE05000 0x1000>; + interrupts = <24 25 26 27 28 29 30 31 32 33 34 35 36>; + interrupt-parent = <&intc>; + + broadcom,channels = <0>; /* Set by VideoCore */ + }; + + vc_mbox: mbox { + compatible = "broadcom,bcm2835-mbox", + "broadcom,bcm2708-mbox"; + reg = <0xB880 0x40>; + interrupts = <1>; + interrupt-parent = <&intc>; + + /* Channels + * 0: Power + * 1: Frame buffer + * 2: Virtual UART + * 3: VCHIQ + * 4: LEDs + * 5: Buttons + * 6: Touch screen + */ + }; + + sdhci { + compatible = "broadcom,bcm2835-sdhci", + "broadcom,bcm2708-sdhci"; + reg = <0x300000 0x100>; + interrupts = <70>; + interrupt-parent = <&intc>; + + clock-frequency = <50000000>; /* Set by VideoCore */ + }; + + uart0: uart0 { + compatible = "broadcom,bcm2835-uart", + "broadcom,bcm2708-uart", "arm,pl011", + "arm,primecell"; + reg = <0x201000 0x1000>; + interrupts = <65>; + interrupt-parent = <&intc>; + + clock-frequency = <3000000>; /* Set by VideoCore */ + reg-shift = <2>; + }; + + vchiq { + compatible = "broadcom,bcm2835-vchiq"; + reg = <0xB800 0x50>; + interrupts = <2>; + interrupt-parent = <&intc>; + }; + + usb { + compatible = "broadcom,bcm2835-usb", + "broadcom,bcm2708-usb", + "synopsys,designware-hs-otg2"; + reg = <0x980000 0x20000>; + interrupts = <17>; + interrupt-parent = <&intc>; + #address-cells = <1>; + #size-cells = <0>; + }; + + }; +}; diff --git a/src/data/dts/pxa27x.dtsi b/src/data/dts/pxa27x.dtsi new file mode 100644 index 0000000000..d7c5d721a5 --- /dev/null +++ b/src/data/dts/pxa27x.dtsi @@ -0,0 +1,14 @@ +/* The pxa3xx skeleton simply augments the 2xx version */ +/include/ "pxa2xx.dtsi" + +/ { + model = "Marvell PXA27x familiy SoC"; + compatible = "marvell,pxa27x"; + + pxabus { + pxairq: interrupt-controller@40d00000 { + marvell,intc-priority; + marvell,intc-nr-irqs = <34>; + }; + }; +}; diff --git a/src/data/dts/pxa2xx.dtsi b/src/data/dts/pxa2xx.dtsi new file mode 100644 index 0000000000..670e23090b --- /dev/null +++ b/src/data/dts/pxa2xx.dtsi @@ -0,0 +1,135 @@ +/* + * pxa2xx.dtsi - Device Tree Include file for Marvell PXA2xx family SoC + * + * Copyright (C) 2011 Marek Vasut + * + * Licensed under GPLv2 or later. + */ + +/include/ "skeleton.dtsi" + +/ { + model = "Marvell PXA2xx family SoC"; + compatible = "marvell,pxa2xx"; + interrupt-parent = <&pxairq>; + + aliases { + serial0 = &ffuart; + serial1 = &btuart; + serial2 = &stuart; + serial3 = &hwuart; + /* i2c0 = &pwri2c; */ + i2c1 = &pxai2c1; + }; + + cpus { + #address-cells = <0>; + #size-cells = <0>; + cpu { + compatible = "marvell,xscale"; + device_type = "cpu"; + }; + }; + + pxabus { + compatible = "simple-bus"; + #address-cells = <1>; + #size-cells = <1>; + ranges; + + pxairq: interrupt-controller@40d00000 { + #interrupt-cells = <1>; + compatible = "marvell,pxa-intc"; + interrupt-controller; + interrupt-parent; + marvell,intc-nr-irqs = <32>; + reg = <0x40d00000 0xd0>; + }; + + gpio: gpio@40e00000 { + compatible = "mrvl,pxa-gpio"; + #address-cells = <0x1>; + #size-cells = <0x1>; + reg = <0x40e00000 0x10000>; + gpio-controller; + #gpio-cells = <0x2>; + interrupts = <10>; + interrupt-names = "gpio_mux"; + interrupt-controller; + #interrupt-cells = <0x2>; + ranges; + + gcb0: gpio@40e00000 { + reg = <0x40e00000 0x4>; + }; + + gcb1: gpio@40e00004 { + reg = <0x40e00004 0x4>; + }; + + gcb2: gpio@40e00008 { + reg = <0x40e00008 0x4>; + }; + gcb3: gpio@40e0000c { + reg = <0x40e0000c 0x4>; + }; + }; + + ffuart: uart@40100000 { + compatible = "mrvl,pxa-uart"; + reg = <0x40100000 0x30>; + interrupts = <22>; + status = "disabled"; + }; + + btuart: uart@40200000 { + compatible = "mrvl,pxa-uart"; + reg = <0x40200000 0x30>; + interrupts = <21>; + status = "disabled"; + }; + + stuart: uart@40700000 { + compatible = "mrvl,pxa-uart"; + reg = <0x40700000 0x30>; + interrupts = <20>; + status = "disabled"; + }; + + hwuart: uart@41100000 { + compatible = "mrvl,pxa-uart"; + reg = <0x41100000 0x30>; + interrupts = <7>; + status = "disabled"; + }; + + pxai2c1: i2c@40301680 { + compatible = "mrvl,pxa-i2c"; + reg = <0x40301680 0x30>; + interrupts = <18>; + #address-cells = <0x1>; + #size-cells = <0>; + status = "disabled"; + }; + + usb0: ohci@4c000000 { + compatible = "mrvl,pxa-ohci"; + reg = <0x4c000000 0x10000>; + interrupts = <3>; + status = "disabled"; + }; + + mmc0: mmc@41100000 { + compatible = "mrvl,pxa-mmc"; + reg = <0x41100000 0x1000>; + interrupts = <23>; + status = "disabled"; + }; + + rtc@40900000 { + compatible = "marvell,pxa-rtc"; + reg = <0x40900000 0x3c>; + interrupts = <30 31>; + }; + }; +}; diff --git a/src/data/dts/rpi.dts b/src/data/dts/rpi.dts new file mode 100644 index 0000000000..bdcee00dcb --- /dev/null +++ b/src/data/dts/rpi.dts @@ -0,0 +1,381 @@ +/* + * Copyright (c) 2012 Oleksandr Tymoshenko + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ +/dts-v1/; + +/include/ "bcm2835.dtsi" + +/memreserve/ 0x08000000 0x08000000; /* Set by VideoCore */ + +/ { + model = "Raspberry Pi (BCM2835)"; + compatible = "raspberrypi,model-a", "raspberrypi,model-b", + "broadcom,bcm2835-vc", "broadcom,bcm2708-vc"; + + memory { + device_type = "memory"; + reg = <0 0x8000000>; /* 128MB, Set by VideoCore */ + + }; + + system { + revision = <0>; /* Set by VideoCore */ + serial = <0 0>; /* Set by VideoCore */ + }; + + axi { + gpio: gpio { + /* BSC0 */ + pins_bsc0_a: bsc0_a { + broadcom,function = "ALT0"; + }; + + pins_bsc0_b: bsc0_b { + broadcom,function = "ALT0"; + }; + + pins_bsc0_c: bsc0_c { + broadcom,function = "ALT1"; + }; + + /* BSC1 */ + pins_bsc1_a: bsc1_a { + broadcom,function = "ALT0"; + }; + + pins_bsc1_b: bsc1_b { + broadcom,function = "ALT2"; + }; + + /* GPCLK0 */ + pins_gpclk0_a: gpclk0_a { + broadcom,function = "ALT0"; + }; + + pins_gpclk0_b: gpclk0_b { + broadcom,function = "ALT5"; + }; + + pins_gpclk0_c: gpclk0_c { + broadcom,function = "ALT0"; + }; + + pins_gpclk0_d: gpclk0_d { + broadcom,function = "ALT0"; + }; + + /* GPCLK1 */ + pins_gpclk1_a: gpclk1_a { + broadcom,function = "ALT0"; + }; + + pins_gpclk1_b: gpclk1_b { + broadcom,function = "ALT5"; + }; + + pins_gpclk1_c: gpclk1_c { + broadcom,function = "ALT0"; + }; + + pins_gpclk1_d: gpclk1_d { + broadcom,function = "ALT0"; + }; + + /* GPCLK2 */ + pins_gpclk2_a: gpclk2_a { + broadcom,function = "ALT0"; + }; + + pins_gpclk2_b: gpclk2_b { + broadcom,function = "ALT0"; + }; + + /* SPI0 */ + pins_spi0_a: spi0_a { + broadcom,function = "ALT0"; + }; + + pins_spi0_b: spi0_b { + broadcom,function = "ALT0"; + }; + + /* PWM */ + pins_pwm0_a: pwm0_a { + broadcom,function = "ALT0"; + }; + + pins_pwm0_b: pwm0_b { + broadcom,function = "ALT5"; + }; + + pins_pwm0_c: pwm0_c { + broadcom,function = "ALT0"; + }; + + pins_pwm1_a: pwm1_a { + broadcom,function = "ALT0"; + }; + + pins_pwm1_b: pwm1_b { + broadcom,function = "ALT5"; + }; + + pins_pwm1_c: pwm1_c { + broadcom,function = "ALT0"; + }; + + pins_pwm1_d: pwm1_d { + broadcom,function = "ALT0"; + }; + + /* UART0 */ + pins_uart0_a: uart0_a { + broadcom,function = "ALT0"; + }; + + pins_uart0_b: uart0_b { + broadcom,function = "ALT3"; + }; + + pins_uart0_c: uart0_c { + broadcom,function = "ALT2"; + }; + + pins_uart0_fc_a: uart0_fc_a { + broadcom,function = "ALT3"; + }; + + pins_uart0_fc_b: uart0_fc_b { + broadcom,function = "ALT3"; + }; + + pins_uart0_fc_c: uart0_fc_c { + broadcom,function = "ALT2"; + }; + + /* PCM */ + pins_pcm_a: pcm_a { + broadcom,function = "ALT0"; + }; + + pins_pcm_b: pcm_b { + broadcom,function = "ALT2"; + }; + + /* Secondary Address Bus */ + pins_sm_addr_a: sm_addr_a { + broadcom,function = "ALT1"; + }; + + pins_sm_addr_b: sm_addr_b { + broadcom,function = "ALT1"; + }; + + pins_sm_ctl_a: sm_ctl_a { + broadcom,function = "ALT1"; + }; + + pins_sm_ctl_b: sm_ctl_b { + broadcom,function = "ALT1"; + }; + + pins_sm_data_8bit_a: sm_data_8bit_a { + broadcom,function = "ALT1"; + }; + + pins_sm_data_8bit_b: sm_data_8bit_b { + broadcom,function = "ALT1"; + }; + + pins_sm_data_16bit: sm_data_16bit { + broadcom,function = "ALT1"; + }; + + pins_sm_data_18bit: sm_data_18bit { + broadcom,function = "ALT1"; + }; + + /* BSCSL */ + pins_bscsl: bscsl { + broadcom,function = "ALT3"; + }; + + /* SPISL */ + pins_spisl: spisl { + broadcom,function = "ALT3"; + }; + + /* SPI1 */ + pins_spi1: spi1 { + broadcom,function = "ALT4"; + }; + + /* UART1 */ + pins_uart1_a: uart1_a { + broadcom,function = "ALT5"; + }; + + pins_uart1_b: uart1_b { + broadcom,function = "ALT5"; + }; + + pins_uart1_c: uart1_c { + broadcom,function = "ALT5"; + }; + + pins_uart1_fc_a: uart1_fc_a { + broadcom,function = "ALT5"; + }; + + pins_uart1_fc_b: uart1_fc_b { + broadcom,function = "ALT5"; + }; + + pins_uart1_fc_c: uart1_fc_c { + broadcom,function = "ALT5"; + }; + + /* SPI2 */ + pins_spi2: spi2 { + broadcom,function = "ALT4"; + }; + + /* ARM JTAG */ + pins_arm_jtag_trst: arm_jtag_trst { + broadcom,function = "ALT4"; + }; + + pins_arm_jtag_a: arm_jtag_a { + broadcom,function = "ALT5"; + }; + + pins_arm_jtag_b: arm_jtag_b { + broadcom,function = "ALT4"; + }; + + /* Reserved */ + pins_reserved: reserved { + broadcom,function = "ALT3"; + }; + }; + usb { + hub { + compatible = "usb,hub", "usb,device"; + reg = <0x00000001>; + #address-cells = <1>; + #size-cells = <0>; + ethernet { + compatible = "net,ethernet", + "usb,device"; + reg = <0x00000001>; + mac-address = [00 00 00 00 00 00]; + }; + }; + + }; + + + }; + + display { + compatible = "broadcom,bcm2835-fb", "broadcom,bcm2708-fb"; + + broadcom,vc-mailbox = <&vc_mbox>; + broadcom,vc-channel = <1>; + + broadcom,width = <0>; /* Set by VideoCore */ + broadcom,height = <0>; /* Set by VideoCore */ + broadcom,depth = <0>; /* Set by VideoCore */ + }; + + leds { + compatible = "gpio-leds"; + + ok { + label = "ok"; + gpios = <&gpio 16 1>; + + /* Don't change this - it configures + * how the led driver determines if + * the led is on or off when it loads. + */ + default-state = "keep"; + + /* This is the real default state. */ + linux,default-trigger = "default-on"; + }; + }; + + power: regulator { + compatible = "broadcom,bcm2835-power-mgr", + "broadcom,bcm2708-power-mgr", + "simple-bus"; + #address-cells = <1>; + #size-cells = <0>; + + broadcom,vc-mailbox = <&vc_mbox>; + broadcom,vc-channel = <0>; + + regulator-name = "VideoCore"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + regulator-always-on = <1>; + + sd_card_power: regulator@0 { + compatible = "broadcom,bcm2835-power-dev", + "broadcom,bcm2708-power-dev"; + reg = <0>; + + vin-supply = <&power>; + regulator-name = "SD Card"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + }; + + /* This is for the controller itself, not the root port */ + usb_hcd_power: regulator@3 { + compatible = "broadcom,bcm2835-power-dev", + "broadcom,bcm2708-power-dev"; + reg = <3>; + + vin-supply = <&power>; + regulator-name = "USB HCD"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + }; + }; + + aliases { + uart0 = &uart0; + }; + + chosen { + bootargs = ""; /* Set by VideoCore */ + stdin = "uart0"; + stdout = "uart0"; + }; + +}; diff --git a/src/data/dts/skeleton.dtsi b/src/data/dts/skeleton.dtsi new file mode 100644 index 0000000000..b41d241de2 --- /dev/null +++ b/src/data/dts/skeleton.dtsi @@ -0,0 +1,13 @@ +/* + * Skeleton device tree; the bare minimum needed to boot; just include and + * add a compatible value. The bootloader will typically populate the memory + * node. + */ + +/ { + #address-cells = <1>; + #size-cells = <1>; + chosen { }; + aliases { }; + memory { device_type = "memory"; reg = <0 0>; }; +}; diff --git a/src/data/dts/verdex.dts b/src/data/dts/verdex.dts new file mode 100644 index 0000000000..eaabe757ac --- /dev/null +++ b/src/data/dts/verdex.dts @@ -0,0 +1,41 @@ +/dts-v1/; +/include/ "pxa27x.dtsi" + +/ { + model = "Gumstix Verdex"; + compatible = "gumstix,verdex", "marvell,pxa27x"; + + chosen { + bootargs = "console=ttyS0,115200 debug"; + }; + + memory { + reg = <0xa0000000 0x10000000>; + }; + + pxabus { + ffuart: uart@40100000 { + status = "okay"; + }; + + usb0: ohci@4c000000 { + status = "okay"; + }; + + /* The devices below should be in pxa27x.dtsi, but I kept them here + so to keep the files from upstream as clean as possible for now */ + + lcdc: lcdc@44000000 { + compatible = "mrvl,pxa-lcdc" ; + reg = <0x44000000 0xa0> ; + interrupts = <17> ; + }; + + timers: timers@40a00000 { + compatible = "mrvl,pxa-timers" ; + reg = <0x40a00000 0xc0> ; + interrupts = <26>, <27>, <28>, <29>, <7> ; + interrupt-names = "OST_0", "OST_1", "OST_2", "OST_3", "OST_4_11" ; + }; + }; +}; diff --git a/src/preferences/screensaver/ScreenSaverWindow.cpp b/src/preferences/screensaver/ScreenSaverWindow.cpp index 9020eaad65..e4f4e81bdc 100644 --- a/src/preferences/screensaver/ScreenSaverWindow.cpp +++ b/src/preferences/screensaver/ScreenSaverWindow.cpp @@ -863,6 +863,7 @@ ScreenSaverWindow::ScreenSaverWindow() // Create the tab view fTabView = new BTabView("tab_view", B_WIDTH_FROM_LABEL); + fTabView->SetBorder(B_NO_BORDER); // Create the controls inside the tabs fFadeView = new FadeView(B_TRANSLATE("General"), fSettings); @@ -878,7 +879,7 @@ ScreenSaverWindow::ScreenSaverWindow() B_ALIGN_USE_FULL_HEIGHT)); topView->SetExplicitMinSize(BSize(fMinWidth, fMinHeight)); BLayoutBuilder::Group<>(topView, B_VERTICAL) - .SetInsets(-1, B_USE_SMALL_SPACING, -1, -1) + .SetInsets(0, B_USE_SMALL_SPACING, 0, 0) .Add(fTabView) .End(); diff --git a/src/system/boot/arch/ppc/arch_framebuffer.h b/src/system/boot/arch/ppc/arch_framebuffer.h new file mode 100644 index 0000000000..6057d0f7ac --- /dev/null +++ b/src/system/boot/arch/ppc/arch_framebuffer.h @@ -0,0 +1,51 @@ +/* + * Copyright 2011-2012 Haiku, Inc. All rights reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Alexander von Gluck IV, kallisti5@unixzen.com + */ +#ifndef _ARCH_FRAMEBUFFER_H +#define _ARCH_FRAMEBUFFER_H + + +#include +#include + + +#define TRACE_VIDEO +#ifdef TRACE_VIDEO +# define TRACE(x...) dprintf(x) +# define CALLED() dprintf("%s()\n", __func__); +#else +# define TRACE(x...) ; +# define CALLED() ; +#endif +#define ERROR(x...) dprintf(x) + + +class ArchFramebuffer { +public: + ArchFramebuffer(addr_t base) + : + fBase(base) {}; + ~ArchFramebuffer() {}; + + virtual status_t Init() { return B_OK; }; + virtual status_t Probe() { return B_OK; }; + virtual status_t SetDefaultMode() { return B_OK; }; + virtual status_t SetVideoMode(int width, int height, int depth) + { return B_OK; }; + + virtual addr_t Base() { return fBase; }; + +protected: + addr_t fBase; +private: + int fCurrentWidth; + int fCurrentHeight; + int fCurrentDepth; +}; + + +#endif /* _ARCH_FRAMEBUFFER_H */ diff --git a/src/system/boot/platform/u-boot/Jamfile b/src/system/boot/platform/u-boot/Jamfile index 7ce4ed8623..dbc84fe4eb 100644 --- a/src/system/boot/platform/u-boot/Jamfile +++ b/src/system/boot/platform/u-boot/Jamfile @@ -52,6 +52,7 @@ BootMergeObject boot_platform_u-boot_common.o : uimage.cpp video.cpp fdt_support.cpp + openfirmware.cpp $(genericPlatformSources) $(libFDTSources) @@ -247,6 +248,9 @@ Depends haiku-mmc-image : haiku-$(HAIKU_BOOT_BOARD).mmc ; SEARCH on [ FGristFiles $(genericPlatformSources) ] = [ FDirName $(HAIKU_TOP) src system boot platform generic ] ; +SEARCH on [ FGristFiles openfirmware.cpp fdt_support.cpp ] + = [ FDirName $(HAIKU_TOP) src system kernel platform u-boot ] ; + SEARCH on [ FGristFiles $(libFDTSources) ] = [ FDirName $(HAIKU_TOP) src libs libfdt ] ; diff --git a/src/system/boot/platform/u-boot/arch/ppc/Jamfile b/src/system/boot/platform/u-boot/arch/ppc/Jamfile index c24f3f80f2..639e56fd35 100644 --- a/src/system/boot/platform/u-boot/arch/ppc/Jamfile +++ b/src/system/boot/platform/u-boot/arch/ppc/Jamfile @@ -6,19 +6,27 @@ UsePrivateHeaders kernel [ FDirName kernel arch $(TARGET_KERNEL_ARCH) ] [ FDirName kernel boot platform $(HAIKU_BOOT_PLATFORM) ] ; UsePrivateHeaders [ FDirName kernel arch $(TARGET_KERNEL_ARCH) board $(TARGET_BOOT_BOARD) ] ; +UseLibraryHeaders [ FDirName libfdt ] ; + SubDirC++Flags -fno-rtti ; +BootMergeObject boot_platform_u-boot_ppc_amcc440.o : + arch_mmu_amcc440.cpp + : -fno-pic -mcpu=440 +; + BootMergeObject boot_platform_u-boot_ppc.o : # must come first to have _start_* at correct locations shell.S - #arch_mmu.cpp + arch_mmu.cpp arch_cpu_asm.S arch_start_kernel.S arch_cpu.cpp #mmu.cpp : -fno-pic + : boot_platform_u-boot_ppc_amcc440.o ; -SEARCH on [ FGristFiles arch_cpu_asm.S arch_mmu.cpp ] +SEARCH on [ FGristFiles arch_cpu_asm.S ] = [ FDirName $(HAIKU_TOP) src system kernel arch $(TARGET_KERNEL_ARCH) ] ; diff --git a/src/system/boot/platform/u-boot/arch/ppc/arch_cpu.cpp b/src/system/boot/platform/u-boot/arch/ppc/arch_cpu.cpp index 5ea5245fb3..83e887509d 100644 --- a/src/system/boot/platform/u-boot/arch/ppc/arch_cpu.cpp +++ b/src/system/boot/platform/u-boot/arch/ppc/arch_cpu.cpp @@ -17,26 +17,142 @@ #include #include #include +#include #include #include +#include +#include #include +// TODO: try to move remaining FDT code to OF calls +extern "C" { +#include +#include +#include +}; -//#define TRACE_CPU + +extern void *gFDT; + +#define TRACE_CPU #ifdef TRACE_CPU # define TRACE(x) dprintf x #else # define TRACE(x) ; #endif -//uint32 gTimeConversionFactor; + +// FIXME: this is ugly; introduce a cpu type in kernel args +bool gIs440 = false; -static void -calculate_cpu_conversion_factor() +static status_t +enumerate_cpus(void) { - #warning U-Boot:TODO! + // iterate through the "/cpus" node to find all CPUs + int cpus = of_finddevice("/cpus"); + if (cpus == OF_FAILED) { + printf("enumerate_cpus(): Failed to open \"/cpus\"!\n"); + return B_ERROR; + } + + char cpuPath[256]; + int cookie = 0; + int cpuCount = 0; + while (of_get_next_device(&cookie, cpus, "cpu", cpuPath, + sizeof(cpuPath)) == B_OK) { + TRACE(("found CPU: %s\n", cpuPath)); + + // For the first CPU get the frequencies of CPU, bus, and time base. + // We assume they are the same for all CPUs. + if (cpuCount == 0) { + int cpu = of_finddevice(cpuPath); + if (cpu == OF_FAILED) { + printf("enumerate_cpus: Failed get CPU device node!\n"); + return B_ERROR; + } + + // TODO: Does encode-int really encode quadlet (32 bit numbers) + // only? + int32 clockFrequency; + if (of_getprop(cpu, "clock-frequency", &clockFrequency, 4) + == OF_FAILED) { + printf("enumerate_cpus: Failed to get CPU clock " + "frequency!\n"); + return B_ERROR; + } + int32 busFrequency = 0; + if (of_getprop(cpu, "bus-frequency", &busFrequency, 4) + == OF_FAILED) { + //printf("enumerate_cpus: Failed to get bus clock " + // "frequency!\n"); + //return B_ERROR; + } + int32 timeBaseFrequency; + if (of_getprop(cpu, "timebase-frequency", &timeBaseFrequency, 4) + == OF_FAILED) { + printf("enumerate_cpus: Failed to get time base " + "frequency!\n"); + return B_ERROR; + } + + gKernelArgs.arch_args.cpu_frequency = clockFrequency; + gKernelArgs.arch_args.bus_frequency = busFrequency; + gKernelArgs.arch_args.time_base_frequency = timeBaseFrequency; + + TRACE((" CPU clock frequency: %ld\n", clockFrequency)); + //TRACE((" bus clock frequency: %ld\n", busFrequency)); + TRACE((" time base frequency: %ld\n", timeBaseFrequency)); + } + + cpuCount++; + } + + if (cpuCount == 0) { + printf("enumerate_cpus(): Found no CPUs!\n"); + return B_ERROR; + } + + gKernelArgs.num_cpus = cpuCount; + + // FDT doesn't list bus frequency on the cpu node but on the plb node + if (gKernelArgs.arch_args.bus_frequency == 0) { + int plb = of_finddevice("/plb"); + + int32 busFrequency = 0; + if (of_getprop(plb, "clock-frequency", &busFrequency, 4) + == OF_FAILED) { + printf("enumerate_cpus: Failed to get bus clock " + "frequency!\n"); + return B_ERROR; + } + gKernelArgs.arch_args.bus_frequency = busFrequency; + } + TRACE((" bus clock frequency: %Ld\n", + gKernelArgs.arch_args.bus_frequency)); + +#if 0 +//XXX:Classic + // allocate the kernel stacks (the memory stuff is already initialized + // at this point) + addr_t stack = (addr_t)arch_mmu_allocate((void*)0x80000000, + cpuCount * (KERNEL_STACK_SIZE + KERNEL_STACK_GUARD_PAGES * B_PAGE_SIZE), + B_READ_AREA | B_WRITE_AREA, false); + if (!stack) { + printf("enumerate_cpus(): Failed to allocate kernel stack(s)!\n"); + return B_NO_MEMORY; + } + + for (int i = 0; i < cpuCount; i++) { + gKernelArgs.cpu_kstack[i].start = stack; + gKernelArgs.cpu_kstack[i].size = KERNEL_STACK_SIZE + + KERNEL_STACK_GUARD_PAGES * B_PAGE_SIZE; + stack += KERNEL_STACK_SIZE + KERNEL_STACK_GUARD_PAGES * B_PAGE_SIZE; + } +#endif + + return B_OK; } @@ -44,17 +160,69 @@ static status_t check_cpu_features() { uint32 msr; + uint32 pvr; + bool is_440 = false; + bool is_460 = false; + bool pvr_unknown = false; + bool fdt_unknown = true; + const char *fdt_model = NULL; -#if BOARD_CPU_TYPE_PPC440 - // the FPU is implemented as an Auxiliary Processing Unit, - // so we must enable transfers by setting the DAPUIB bit to 0 - asm volatile( - "mfccr0 %%r3\n" - "\tlis %%r4,~(1<<(20-16))\n" - "\tand %%r3,%%r3,%%r4\n" - "\tmtccr0 %%r3" - : : : "r3", "r4"); -#endif + // attempt to detect processor version, either from PVR or FDT + // TODO:someday we'll support other things than 440/460... + + // read the Processor Version Register + pvr = get_pvr(); + uint16 version = (uint16)(pvr >> 16); + uint16 revision = (uint16)(pvr & 0xffff); + + switch (version) { + case AMCC440EP: + is_440 = true; + break; + case AMCC460EX: + is_460 = true; + break; + default: + pvr_unknown = true; + } + + // if we have an FDT... + // XXX: use it only as fallback? + if (gFDT != NULL/* && pvr_unknown*/) { + // TODO: for MP support we must check /chosen/cpu first + int node = fdt_path_offset(gFDT, "/cpus/cpu@0"); + int len; + + fdt_model = (const char *)fdt_getprop(gFDT, node, "model", &len); + // TODO: partial match ? "PowerPC,440" && isalpha(next char) ? + if (fdt_model) { + if (!strcmp(fdt_model, "PowerPC,440EP")) { + is_440 = true; + fdt_unknown = false; + } else if (!strcmp(fdt_model, "PowerPC,460EX")) { + is_460 = true; + fdt_unknown = false; + } + } + } + + if (is_460) + is_440 = true; + + gIs440 = is_440; + + // some cpu-dependent tweaking + + if (is_440) { + // the FPU is implemented as an Auxiliary Processing Unit, + // so we must enable transfers by setting the DAPUIB bit to 0 + asm volatile( + "mfccr0 %%r3\n" + "\tlis %%r4,~(1<<(20-16))\n" + "\tand %%r3,%%r3,%%r4\n" + "\tmtccr0 %%r3" + : : : "r3", "r4"); + } // we do need an FPU for vsnprintf to work // on Sam460ex at least U-Boot doesn't enable the FPU for us @@ -68,6 +236,11 @@ check_cpu_features() return B_ERROR; } + TRACE(("CPU detection:\n")); + TRACE(("PVR revision %sknown: 0x%8lx\n", pvr_unknown ? "un" : "", pvr)); + TRACE(("FDT model %sknown: %s\n", fdt_unknown ? "un" : "", fdt_model)); + TRACE(("flags: %s440 %s460\n", is_440 ? "" : "!", is_460 ? "" : "!")); + return B_OK; } @@ -92,6 +265,11 @@ arch_spin(bigtime_t microseconds) extern "C" status_t boot_arch_cpu_init(void) { + // This is U-Boot + gKernelArgs.arch_args.platform = PPC_PLATFORM_U_BOOT; + + // first check some features + // including some necessary for dprintf()... status_t err = check_cpu_features(); if (err != B_OK) { @@ -99,10 +277,8 @@ boot_arch_cpu_init(void) return err; } - calculate_cpu_conversion_factor(); - - gKernelArgs.num_cpus = 1; - // this will eventually be corrected later on + // now enumerate correctly all CPUs and get system frequencies + enumerate_cpus(); return B_OK; } diff --git a/src/system/boot/platform/u-boot/arch/ppc/arch_mmu.cpp b/src/system/boot/platform/u-boot/arch/ppc/arch_mmu.cpp new file mode 100644 index 0000000000..10bdc1a53a --- /dev/null +++ b/src/system/boot/platform/u-boot/arch/ppc/arch_mmu.cpp @@ -0,0 +1,425 @@ +/* + * Copyright 2004-2008, Axel Dörfler, axeld@pinc-software.de. + * Based on code written by Travis Geiselbrecht for NewOS. + * + * Distributed under the terms of the MIT License. + */ + + +#include "mmu.h" + +#include +#include +#include +#include +#include +#include +#include +#ifdef __ARM__ +#include +#endif +#include + +#include + +#include + +#include + +/*! This implements boot loader mmu support for Book-E PowerPC, + which only support a limited number of TLB and no hardware page table walk, + and does not standardize at how to use the mmu, requiring vendor-specific + code. + + Like Linux, we pin one of the TLB entries to a fixed translation, + however we use it differently. + cf. http://kernel.org/doc/ols/2003/ols2003-pages-340-350.pdf + + This translation uses a single large page (16 or 256MB are possible) which + directly maps the begining of the RAM. + We use it as a linear space to allocate from at boot time, + loading the kernel and modules into it, and other required data. + Near the end we reserve a page table (it doesn't need to be aligned), + but unlike Linux we use the same globally hashed page table that is + implemented by Classic PPC, to allow reusing code if possible, and also + to limit fragmentation which would occur by using a tree-based page table. + However this means we might actually run out of page table entries in case + of too many collisions. + + The kernel will then create areas to cover this already-mapped space. + This also means proper permission bits (RWX) will not be applicable to + separate areas which are enclosed by this mapping. + + We put the kernel stack at the end of the mapping so that the guard page is + outsite and thus unmapped. (we don't support SMP) +*/ + +/*! The (physical) memory layout of the boot loader is currently as follows: + 0x00000000 kernel + 0x00400000 ...modules + + (at least on the Sam460ex U-Boot; we'll need to accomodate other setups) + 0x01000000 boot loader + 0x01800000 Flattened Device Tree + 0x01900000 boot.tgz (= ramdisk) + 0x02000000 boot loader uimage + + + boot loader heap (should be discarded later on) + ... 256M-Kstack page hash table + ... 256M kernel stack + kernel stack guard page + + The kernel is mapped at KERNEL_BASE, all other stuff mapped by the + loader (kernel args, modules, driver settings, ...) comes after + 0x80040000 which means that there is currently only 4 MB reserved for + the kernel itself (see kMaxKernelSize). FIXME: downsize kernel_ppc +*/ + + +int32 of_address_cells(int package); +int32 of_size_cells(int package); + +extern bool gIs440; +// XXX:use a base class for Book-E support? +extern status_t arch_mmu_setup_pinned_tlb_amcc440(phys_addr_t totalRam, + size_t &tableSize, size_t &tlbSize); + +#define TRACE_MMU +#ifdef TRACE_MMU +# define TRACE(x) dprintf x +#else +# define TRACE(x) ; +#endif + +#define TRACE_MEMORY_MAP + // Define this to print the memory map to serial debug. + +static const size_t kMaxKernelSize = 0x400000; // 4 MB for the kernel + +static addr_t sNextPhysicalAddress = kMaxKernelSize; //will be set by mmu_init +static addr_t sNextVirtualAddress = KERNEL_BASE + kMaxKernelSize; +//static addr_t sMaxVirtualAddress = KERNEL_BASE + kMaxKernelSize; + +// working page directory and page table +static void *sPageTable = 0 ; + + +static addr_t +get_next_virtual_address(size_t size) +{ + addr_t address = sNextVirtualAddress; + sNextPhysicalAddress += size; + sNextVirtualAddress += size; + + return address; +} + + +static addr_t +get_next_physical_address(size_t size) +{ + addr_t address = sNextPhysicalAddress; + sNextPhysicalAddress += size; + sNextVirtualAddress += size; + + return address; +} + + +// #pragma mark - + + +extern "C" addr_t +mmu_map_physical_memory(addr_t physicalAddress, size_t size, uint32 flags) +{ + panic("WRITEME"); + return 0; +} + + +/*! Sets up the final and kernel accessible GDT and IDT tables. + BIOS calls won't work any longer after this function has + been called. +*/ +extern "C" void +mmu_init_for_kernel(void) +{ + TRACE(("mmu_init_for_kernel\n")); + + // TODO: remove all U-Boot TLB + +#ifdef TRACE_MEMORY_MAP + { + uint32 i; + + dprintf("phys memory ranges:\n"); + for (i = 0; i < gKernelArgs.num_physical_memory_ranges; i++) { + dprintf(" base 0x%"B_PRIxPHYSADDR + ", length 0x%"B_PRIxPHYSADDR"\n", + gKernelArgs.physical_memory_range[i].start, + gKernelArgs.physical_memory_range[i].size); + } + + dprintf("allocated phys memory ranges:\n"); + for (i = 0; i < gKernelArgs.num_physical_allocated_ranges; i++) { + dprintf(" base 0x%"B_PRIxPHYSADDR + ", length 0x%"B_PRIxPHYSADDR"\n", + gKernelArgs.physical_allocated_range[i].start, + gKernelArgs.physical_allocated_range[i].size); + } + + dprintf("allocated virt memory ranges:\n"); + for (i = 0; i < gKernelArgs.num_virtual_allocated_ranges; i++) { + dprintf(" base 0x%"B_PRIxPHYSADDR + ", length 0x%"B_PRIxPHYSADDR"\n", + gKernelArgs.virtual_allocated_range[i].start, + gKernelArgs.virtual_allocated_range[i].size); + } + } +#endif +} + + +//TODO:move this to generic/ ? +static status_t +find_physical_memory_ranges(phys_addr_t &total) +{ + int memory = -1; + int package; + dprintf("checking for memory...\n"); + if (of_getprop(gChosen, "memory", &memory, sizeof(int)) == OF_FAILED) + package = of_finddevice("/memory"); + else + package = of_instance_to_package(memory); + if (package == OF_FAILED) + return B_ERROR; + + total = 0; + + // Memory base addresses are provided in 32 or 64 bit flavors + // #address-cells and #size-cells matches the number of 32-bit 'cells' + // representing the length of the base address and size fields + int root = of_finddevice("/"); + int32 regAddressCells = of_address_cells(root); + int32 regSizeCells = of_size_cells(root); + if (regAddressCells == OF_FAILED || regSizeCells == OF_FAILED) { + dprintf("finding base/size length counts failed, assume 32-bit.\n"); + regAddressCells = 1; + regSizeCells = 1; + } + + // NOTE : Size Cells of 2 is possible in theory... but I haven't seen it yet. + if (regAddressCells > 2 || regSizeCells > 1) { + panic("%s: Unsupported OpenFirmware cell count detected.\n" + "Address Cells: %" B_PRId32 "; Size Cells: %" B_PRId32 + " (CPU > 64bit?).\n", __func__, regAddressCells, regSizeCells); + return B_ERROR; + } + + // On 64-bit PowerPC systems (G5), our mem base range address is larger + if (regAddressCells == 2) { + struct of_region regions[64]; + int count = of_getprop(package, "reg", regions, sizeof(regions)); + if (count == OF_FAILED) + count = of_getprop(memory, "reg", regions, sizeof(regions)); + if (count == OF_FAILED) + return B_ERROR; + count /= sizeof(regions[0]); + + for (int32 i = 0; i < count; i++) { + if (regions[i].size <= 0) { + dprintf("%ld: empty region\n", i); + continue; + } + dprintf("%" B_PRIu32 ": base = %" B_PRIu64 "," + "size = %" B_PRIu32 "\n", i, regions[i].base, regions[i].size); + + total += regions[i].size; + + if (insert_physical_memory_range((addr_t)regions[i].base, + regions[i].size) != B_OK) { + dprintf("cannot map physical memory range " + "(num ranges = %" B_PRIu32 ")!\n", + gKernelArgs.num_physical_memory_ranges); + return B_ERROR; + } + } + return B_OK; + } + + // Otherwise, normal 32-bit PowerPC G3 or G4 have a smaller 32-bit one + struct of_region regions[64]; + int count = of_getprop(package, "reg", regions, sizeof(regions)); + if (count == OF_FAILED) + count = of_getprop(memory, "reg", regions, sizeof(regions)); + if (count == OF_FAILED) + return B_ERROR; + count /= sizeof(regions[0]); + + for (int32 i = 0; i < count; i++) { + if (regions[i].size <= 0) { + dprintf("%ld: empty region\n", i); + continue; + } + dprintf("%" B_PRIu32 ": base = %" B_PRIu32 "," + "size = %" B_PRIu32 "\n", i, regions[i].base, regions[i].size); + + total += regions[i].size; + + if (insert_physical_memory_range((addr_t)regions[i].base, + regions[i].size) != B_OK) { + dprintf("cannot map physical memory range " + "(num ranges = %" B_PRIu32 ")!\n", + gKernelArgs.num_physical_memory_ranges); + return B_ERROR; + } + } + + return B_OK; +} + + +extern "C" void +mmu_init(void) +{ + size_t tableSize, tlbSize; + status_t err; + TRACE(("mmu_init\n")); + + // get map of physical memory (fill in kernel_args structure) + + phys_addr_t total; + if (find_physical_memory_ranges(total) != B_OK) { + dprintf("Error: could not find physical memory ranges!\n"); + return /*B_ERROR*/; + } + dprintf("total physical memory = %" B_PRId64 "MB\n", total / (1024 * 1024)); + + // XXX: ugly, and wrong, there are several 440 mmu types... FIXME + if (gIs440) { + err = arch_mmu_setup_pinned_tlb_amcc440(total, tableSize, tlbSize); + dprintf("setup_pinned_tlb: 0x%08lx table %zdMB tlb %zdMB\n", + err, tableSize / (1024 * 1024), tlbSize / (1024 * 1024)); + } else { + panic("Unknown MMU type!"); + return; + } + + // remember the start of the allocated physical pages + gKernelArgs.physical_allocated_range[0].start + = gKernelArgs.physical_memory_range[0].start; + gKernelArgs.physical_allocated_range[0].size = tlbSize; + gKernelArgs.num_physical_allocated_ranges = 1; + + // Save the memory we've virtually allocated (for the kernel and other + // stuff) + gKernelArgs.virtual_allocated_range[0].start = KERNEL_BASE; + gKernelArgs.virtual_allocated_range[0].size + = tlbSize + KERNEL_STACK_GUARD_PAGES * B_PAGE_SIZE; + gKernelArgs.num_virtual_allocated_ranges = 1; + + + sPageTable = (void *)(tlbSize - tableSize - KERNEL_STACK_SIZE); + // we put the page table near the end of the pinned TLB + TRACE(("page table at 0x%p to 0x%p\n", sPageTable, + (uint8 *)sPageTable + tableSize)); + + // map in a kernel stack + gKernelArgs.cpu_kstack[0].start = (addr_t)(tlbSize - KERNEL_STACK_SIZE); + gKernelArgs.cpu_kstack[0].size = KERNEL_STACK_SIZE + + KERNEL_STACK_GUARD_PAGES * B_PAGE_SIZE; + + TRACE(("kernel stack at 0x%Lx to 0x%Lx\n", gKernelArgs.cpu_kstack[0].start, + gKernelArgs.cpu_kstack[0].start + gKernelArgs.cpu_kstack[0].size)); + +#ifdef __ARM__ + init_page_directory(); + + // map the page directory on the next vpage + gKernelArgs.arch_args.vir_pgdir = mmu_map_physical_memory( + (addr_t)sPageDirectory, MMU_L1_TABLE_SIZE, kDefaultPageFlags); +#endif +} + + +// #pragma mark - + + +extern "C" status_t +platform_allocate_region(void **_address, size_t size, uint8 protection, + bool /*exactAddress*/) +{ + TRACE(("platform_allocate_region(&%p, %zd)\n", *_address, size)); + + //get_next_virtual_address + size = (size + B_PAGE_SIZE - 1) / B_PAGE_SIZE * B_PAGE_SIZE; + // roundup to page size for clarity + + if (*_address != NULL) { + // This special path is almost only useful for loading the + // kernel into memory; it will only allow you to map the + // 'kMaxKernelSize' bytes following the kernel base address. + // Also, it won't check for already mapped addresses, so + // you better know why you are here :) + addr_t address = (addr_t)*_address; + + // is the address within the valid range? + if (address < KERNEL_BASE + || address + size >= KERNEL_BASE + kMaxKernelSize) { + TRACE(("mmu_allocate in illegal range\n address: %lx" + " KERNELBASE: %lx KERNEL_BASE + kMaxKernelSize: %lx" + " address + size : %lx \n", (uint32)address, KERNEL_BASE, + KERNEL_BASE + kMaxKernelSize, (uint32)(address + size))); + return B_ERROR; + } + TRACE(("platform_allocate_region: allocated %zd bytes at %08lx\n", size, + address)); + + return B_OK; + } + + void *address = (void *)get_next_virtual_address(size); + if (address == NULL) + return B_NO_MEMORY; + + TRACE(("platform_allocate_region: allocated %zd bytes at %p\n", size, + address)); + *_address = address; + return B_OK; +} + + +extern "C" status_t +platform_free_region(void *address, size_t size) +{ + TRACE(("platform_free_region(%p, %zd)\n", address, size)); +#ifdef __ARM__ + mmu_free(address, size); +#endif + return B_OK; +} + + +void +platform_release_heap(struct stage2_args *args, void *base) +{ + //XXX + // It will be freed automatically, since it is in the + // identity mapped region, and not stored in the kernel's + // page tables. +} + + +status_t +platform_init_heap(struct stage2_args *args, void **_base, void **_top) +{ + // the heap is put right before the pagetable + void *heap = (uint8 *)sPageTable - args->heap_size; + //FIXME: use phys addresses to allow passing args to U-Boot? + + *_base = heap; + *_top = (void *)((int8 *)heap + args->heap_size); + TRACE(("boot heap at 0x%p to 0x%p\n", *_base, *_top)); + return B_OK; +} diff --git a/src/system/boot/platform/u-boot/arch/ppc/arch_mmu_amcc440.cpp b/src/system/boot/platform/u-boot/arch/ppc/arch_mmu_amcc440.cpp new file mode 100644 index 0000000000..5077e63fba --- /dev/null +++ b/src/system/boot/platform/u-boot/arch/ppc/arch_mmu_amcc440.cpp @@ -0,0 +1,180 @@ +/* + * Copyright 2004-2008, Axel Dörfler, axeld@pinc-software.de. + * Based on code written by Travis Geiselbrecht for NewOS. + * + * Distributed under the terms of the MIT License. + */ + + +#include "mmu.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef __ARM__ +#include +#endif +#include + +#include + +#include + +#include + +int32 of_address_cells(int package); +int32 of_size_cells(int package); + +#define TRACE_MMU +#ifdef TRACE_MMU +# define TRACE(x) dprintf x +#else +# define TRACE(x) ; +#endif + + +/*! Computes the recommended minimal page table size as + described in table 7-22 of the PowerPC "Programming + Environment for 32-Bit Microprocessors". + The page table size ranges from 64 kB (for 8 MB RAM) + to 32 MB (for 4 GB RAM). + FIXME: account for larger TLB descriptors for Book-E +*/ +static size_t +suggested_page_table_size(phys_addr_t total) +{ + uint32 max = 23; + // 2^23 == 8 MB + + while (max < 32) { + if (total <= (1UL << max)) + break; + + max++; + } + + return 1UL << (max - 7); + // 2^(23 - 7) == 64 kB +} + + +static void +read_TLB(int i, uint32 tlb[3], uint8 &pid) +{ + //FIXME:read pid too + asm volatile( + "tlbre %0,%3,0\n" + "\ttlbre %1,%3,1\n" + "\ttlbre %2,%3,2" + : "=r"(tlb[0]), + "=r"(tlb[1]), + "=r"(tlb[2]) + : "r"(i) + ); +} + + +static void +write_TLB(int i, uint32 tlb[3], uint8 pid) +{ + //FIXME:write pid too + asm volatile( + "tlbwe %0,%3,0\n" + "\ttlbwe %1,%3,1\n" + "\ttlbwe %2,%3,2" + : : "r"(tlb[0]), + "r"(tlb[1]), + "r"(tlb[2]), + "r"(i) + ); +} + + +static void +dump_TLBs(void) +{ + int i; + for (i = 0; i < TLB_COUNT; i++) { + uint32 tlb[3];// = { 0, 0, 0 }; + uint8 pid; + read_TLB(i, tlb, pid); + dprintf("TLB[%02d]: %08lx %08lx %08lx %02x\n", + i, tlb[0], tlb[1], tlb[2], pid); + } +} + + +status_t +arch_mmu_setup_pinned_tlb_amcc440(phys_addr_t totalRam, size_t &tableSize, + size_t &tlbSize) +{ + dump_TLBs(); + tlb_length tlbLength = TLB_LENGTH_16MB; +//XXX:totalRam = 4LL*1024*1024*1024; + + size_t suggestedTableSize = suggested_page_table_size(totalRam); + dprintf("suggested page table size = %" B_PRIuSIZE "\n", + suggestedTableSize); + + tableSize = suggestedTableSize; + + // add 4MB for kernel and some more for modules... + tlbSize = tableSize + 8 * 1024 * 1024; + + // round up to realistic TLB lengths, either 16MB or 256MB + // the unused space will be filled with SLAB areas + if (tlbSize < 16 * 1024 * 1024) + tlbSize = 16 * 1024 * 1024; + else { + tlbSize = 256 * 1024 * 1024; + tlbLength = TLB_LENGTH_256MB; + } + + uint32 tlb[3]; + uint8 pid; + int i; + + // Make sure the last TLB is free, else we are in trouble + // XXX: allow using a different TLB entry? + read_TLB(TLB_COUNT - 1, tlb, pid); + if ((tlb[0] & TLB_V) != 0) { + panic("Last TLB already in use. FIXME."); + return B_ERROR; + } + + // TODO: remove existing mapping from U-Boot at KERNEL_BASE !!! + // (on Sam460ex it's pci mem) + // for now we just move it to AS1 which we don't use, until calling + // the kernel. + // we could probably swap it with our own KERNEL_BASE TLB to call U-Boot + // if required, but it'd be quite ugly. + for (i = 0; i < TLB_COUNT; i++) { + read_TLB(i, tlb, pid); + //dprintf("tlb[%d][0] = %08lx\n", i, tlb[0]); + // TODO: make the test more complete and correct + if ((tlb[0] & 0xfffffc00) == KERNEL_BASE) { + tlb[0] |= 0x100; // AS1 + write_TLB(i, tlb, pid); + dprintf("Moved existing translation in TLB[%d] to AS1\n", i); + } + } + + // pin the last TLB + //XXX:also maybe skip the FDT + initrd + loader ? + phys_addr_t physBase = gKernelArgs.physical_memory_range[0].start; + //TODO:make sure 1st range is large enough? + i = TLB_COUNT - 1; // last one + pid = 0; // the kernel's PID + tlb[0] = (KERNEL_BASE | tlbLength << 4 | TLB_V); + tlb[1] = ((physBase & 0xfffffc00) | (physBase >> 32)); + tlb[2] = (0x0000003f); // user:RWX kernel:RWX + write_TLB(i, tlb, pid); + + return B_OK; +} + diff --git a/src/system/boot/platform/u-boot/arch/ppc/arch_start_kernel.S b/src/system/boot/platform/u-boot/arch/ppc/arch_start_kernel.S index 2156e1d7a8..59d16fe9d0 100644 --- a/src/system/boot/platform/u-boot/arch/ppc/arch_start_kernel.S +++ b/src/system/boot/platform/u-boot/arch/ppc/arch_start_kernel.S @@ -3,7 +3,8 @@ * All rights reserved. Distributed under the terms of the MIT License. */ -#define FUNCTION(x) .global x; .type x,@function; x +#include + /* status_t arch_start_kernel(struct kernel_args *kernelArgs, addr_t kernelEntry, addr_t kernelStackTop); @@ -46,4 +47,5 @@ FUNCTION(arch_start_kernel): mtlr %r0 addi %r1, %r1, 32 blr +FUNCTION_END(arch_start_kernel) diff --git a/src/system/boot/platform/u-boot/console.cpp b/src/system/boot/platform/u-boot/console.cpp index 62293e464c..1ff4694278 100644 --- a/src/system/boot/platform/u-boot/console.cpp +++ b/src/system/boot/platform/u-boot/console.cpp @@ -45,10 +45,12 @@ static SerialConsole sSerial; FILE *stdin, *stdout, *stderr; +/* static void scroll_up() { } +*/ // #pragma mark - diff --git a/src/system/boot/platform/u-boot/devices.cpp b/src/system/boot/platform/u-boot/devices.cpp index ac380a77a3..a1a6916038 100644 --- a/src/system/boot/platform/u-boot/devices.cpp +++ b/src/system/boot/platform/u-boot/devices.cpp @@ -30,7 +30,7 @@ platform_add_boot_device(struct stage2_args *args, NodeList *devicesList) if (!args->platform.boot_tgz_data || !args->platform.boot_tgz_size) return B_DEVICE_NOT_FOUND; - TRACE("Memory Disk at: %lx size: %lx\n", args->platform.boot_tgz_data, + TRACE("Memory Disk at: %p size: %lx\n", args->platform.boot_tgz_data, args->platform.boot_tgz_size); MemoryDisk* disk = new(nothrow) MemoryDisk( diff --git a/src/system/boot/platform/u-boot/serial.cpp b/src/system/boot/platform/u-boot/serial.cpp index 27bbb812a1..4bf1a548e5 100644 --- a/src/system/boot/platform/u-boot/serial.cpp +++ b/src/system/boot/platform/u-boot/serial.cpp @@ -24,6 +24,8 @@ extern "C" { }; +extern "C" DebugUART *debug_uart_from_fdt(const void *fdt); + DebugUART* gUART; static int32 sSerialEnabled = 0; @@ -96,86 +98,11 @@ serial_cleanup(void) } -static void -serial_init_fdt(const void *fdt) -{ - const char *name; - const char *type; - int node; - int len; - phys_addr_t regs; - int32 clock = 0; - int32 speed = 0; - const void *prop; - - if (fdt == NULL) - return; - - name = fdt_get_alias(fdt, "serial"); - if (name == NULL) - name = fdt_get_alias(fdt, "serial0"); - if (name == NULL) - name = fdt_get_alias(fdt, "serial1"); - // TODO: else use /chosen linux,stdout-path - if (name == NULL) - return; - - node = fdt_path_offset(fdt, name); - //dprintf("serial: using '%s', node %d\n", name, node); - if (node < 0) - return; - - type = (const char *)fdt_getprop(fdt, node, "device_type", &len); - //dprintf("serial: type: '%s'\n", type); - if (type == NULL || strcmp(type, "serial")) - return; - - // determine the MMIO address - // TODO: ppc640 use 64bit addressing, but U-Boot seems to map it below 4G, - // and the FDT is not very clear. libfdt is also getting 64bit addr support. - // so FIXME someday. - prop = fdt_getprop(fdt, node, "virtual-reg", &len); - if (prop && len == 4) { - regs = fdt32_to_cpu(*(uint32_t *)prop); - //dprintf("serial: virtual-reg 0x%08llx\n", (int64)regs); - } else { - prop = fdt_getprop(fdt, node, "reg", &len); - if (prop && len >= 4) { - regs = fdt32_to_cpu(*(uint32_t *)prop); - //dprintf("serial: reg 0x%08llx\n", (int64)regs); - } else - return; - } - - // get the UART clock rate - prop = fdt_getprop(fdt, node, "clock-frequency", &len); - if (prop && len == 4) { - clock = fdt32_to_cpu(*(uint32_t *)prop); - //dprintf("serial: clock %ld\n", clock); - } - - // get current speed (XXX: not yet passed over) - prop = fdt_getprop(fdt, node, "current-speed", &len); - if (prop && len == 4) { - speed = fdt32_to_cpu(*(uint32_t *)prop); - //dprintf("serial: speed %ld\n", speed); - } - - if (fdt_node_check_compatible(fdt, node, "ns16550a") == 1 - || fdt_node_check_compatible(fdt, node, "ns16550") == 1) { - gUART = arch_get_uart_8250(regs, clock); - //dprintf("serial: using 8250\n"); - return; - } - -} - - extern "C" void serial_init(const void *fdt) { // first try with hints from the FDT - serial_init_fdt(fdt); + gUART = debug_uart_from_fdt(fdt); #ifdef BOARD_UART_DEBUG // fallback to hardcoded board UART diff --git a/src/system/boot/platform/u-boot/start.cpp b/src/system/boot/platform/u-boot/start.cpp index 5d2fea674d..e1dbee62aa 100644 --- a/src/system/boot/platform/u-boot/start.cpp +++ b/src/system/boot/platform/u-boot/start.cpp @@ -18,6 +18,7 @@ #include #include #include +#include #include @@ -104,6 +105,12 @@ platform_start_kernel(void) addr_t stackTop = gKernelArgs.cpu_kstack[0].start + gKernelArgs.cpu_kstack[0].size; + if (gFDT) { + // clone the Flattened Device Tree blob + gKernelArgs.platform_args.fdt = kernel_args_malloc(fdt_totalsize(gFDT)); + memcpy(gKernelArgs.platform_args.fdt, gFDT, fdt_totalsize(gFDT)); + } + // smp_init_other_cpus(); serial_cleanup(); mmu_init_for_kernel(); @@ -114,7 +121,7 @@ platform_start_kernel(void) status_t error = arch_start_kernel(&gKernelArgs, kernelEntry, stackTop); - panic("kernel returned!\n"); + panic("kernel returned %lx!\n", error); } @@ -190,6 +197,9 @@ start_raw(int argc, const char **argv) serial_init(gFDT); console_init(); + // initialize the OpenFirmware wrapper + of_init(NULL); + cpu_init(); if (args.platform.fdt_data) { diff --git a/src/system/kernel/arch/arm/Jamfile b/src/system/kernel/arch/arm/Jamfile index 25e4f8a42c..8386a7596f 100644 --- a/src/system/kernel/arch/arm/Jamfile +++ b/src/system/kernel/arch/arm/Jamfile @@ -10,10 +10,8 @@ SEARCH_SOURCE += [ FDirName $(SUBDIR) paging 32bit ] ; SEARCH_SOURCE += [ FDirName $(SUBDIR) $(DOTDOT) generic ] ; KernelMergeObject kernel_arch_arm.o : -# arch_atomic.c arch_commpage.cpp arch_cpu.cpp -# arch_cpu_asm.S arch_debug_console.cpp arch_debug.cpp arch_elf.cpp @@ -33,6 +31,9 @@ KernelMergeObject kernel_arch_arm.o : arch_uart_8250.cpp arch_uart_pl011.cpp + arch_atomic64.cpp + arch_atomic32.cpp + # paging arm_physical_page_mapper.cpp arm_physical_page_mapper_large_memory.cpp diff --git a/src/system/kernel/arch/arm/arch_asm.S b/src/system/kernel/arch/arm/arch_asm.S index 689f615646..6c04401717 100644 --- a/src/system/kernel/arch/arm/arch_asm.S +++ b/src/system/kernel/arch/arm/arch_asm.S @@ -82,21 +82,32 @@ FUNCTION(arm_context_switch): bx lr FUNCTION_END(arm_context_switch) + /* addr_t arm_get_fsr(void); */ FUNCTION(arm_get_fsr): mrc p15, 0, r0, c5, c0, 0 @ get FSR bx lr FUNCTION_END(arm_get_fsr) + /* addr_t arm_get_far(void); */ FUNCTION(arm_get_far): mrc p15, 0, r0, c6, c0, 0 @ get FAR bx lr FUNCTION_END(arm_get_far) + +/* addr_t arm_get_fp(void); */ +FUNCTION(arm_get_fp): + mov r0, fp @ get framepointer + bx lr +FUNCTION_END(arm_get_fp); + + /* status_t arch_cpu_user_memcpy(void *to, const void *from, size_t size, addr_t *faultHandler) */ FUNCTION(arch_cpu_user_memcpy): - stmfd sp!, { r4-r6 } + stmfd sp!, { r4-r6, lr } + ldr r6, [r3] ldr r4, =.L_user_memcpy_error str r4, [r3] /* set fault handler */ @@ -106,33 +117,35 @@ FUNCTION(arch_cpu_user_memcpy): str r5, [r0] add r1, #4 add r0, #4 - sub r4, #1 + subs r4, #1 bne 1b + + ands r4, r2, #3 /* size % 4 */ + beq 3f + 2: - and r4, r2, #3 /* size % 4 */ ldrb r5, [r1] strb r5, [r0] add r1, #1 add r0, #1 - sub r4, #1 + subs r4, #1 bne 2b - +3: str r6, [r3] /* restore fault handler */ mov r0, #0 - ldmfd sp!, { r4-r6 } - bx lr + ldmfd sp!, { r4-r6, pc } .L_user_memcpy_error: str r6, [r3] /* restore fault handler */ mov r0, #-1 - ldmfd sp!, { r4-r6 } - bx lr + ldmfd sp!, { r4-r6, pc } FUNCTION_END(arch_cpu_user_memcpy) /* status_t arch_cpu_user_memset(void *to, char c, size_t count, addr_t *faultHandler) */ FUNCTION(arch_cpu_user_memset): - stmfd sp!, { r4-r5 } + stmfd sp!, { r4-r5, lr } + ldr r5, [r3] ldr r4, =.L_user_memset_error str r4, [r3] @@ -146,33 +159,31 @@ FUNCTION(arch_cpu_user_memset): 1: str r1, [r0] add r0, r0, #4 - sub r4, r4, #1 + subs r4, r4, #1 bne 1b and r4, r2, #3 /* count % 4 */ 2: strb r1, [r0] add r0, r0, #1 - sub r4, r4, #1 + subs r4, r4, #1 bne 2b mov r0, #0 str r5, [r3] - ldmfd sp!, { r4-r5 } - bx lr + ldmfd sp!, { r4-r5, pc } .L_user_memset_error: mov r0, #-1 str r5, [r3] - ldmfd sp!, { r4-r5 } - bx lr + ldmfd sp!, { r4-r5, pc } FUNCTION_END(arch_cpu_user_memset) /* ssize_t arch_cpu_user_strlcpy(void *to, const void *from, size_t size, addr_t *faultHandler) */ FUNCTION(arch_cpu_user_strlcpy): - stmfd sp!, { r4-r6 } + stmfd sp!, { r4-r6, lr } ldr r5, [r3] ldr r4, =.L_user_strlcpy_error str r4, [r3] @@ -181,7 +192,7 @@ FUNCTION(arch_cpu_user_strlcpy): ldrb r4, [r1, r6] strb r4, [r0, r6] add r6, r6, #1 - and r4, #0xff /* done yet? */ + cmp r4, #0 beq 2f cmp r6, r2 /* reached max length? */ blt 1b @@ -189,18 +200,16 @@ FUNCTION(arch_cpu_user_strlcpy): mov r4, #0 strb r4, [r0, r6] - mov r0, r4 /* return B_OK */ + mov r0, r6 /* return length */ str r5, [r3] /* restore fault handler */ - ldmfd sp!, { r4-r6 } - bx lr + ldmfd sp!, { r4-r6, pc } .L_user_strlcpy_error: mov r0, #-1 str r5, [r3] - ldmfd sp!, { r4-r6 } - bx lr + ldmfd sp!, { r4-r6, pc } FUNCTION_END(arch_cpu_user_strlcpy) @@ -236,12 +245,11 @@ FUNCTION(arch_debug_call_with_fault_handler): blx r2 // regular return - ldmfd sp!, { r4, lr } - bx lr + ldmfd sp!, { r4, pc } // fault -- return via longjmp(jumpBuffer, 1) 1: - mov r0, r4 + mov r0, r1 mov r1, #1 bl longjmp FUNCTION_END(arch_debug_call_with_fault_handler) diff --git a/src/system/kernel/arch/arm/arch_atomic32.cpp b/src/system/kernel/arch/arm/arch_atomic32.cpp new file mode 100644 index 0000000000..df10e72bed --- /dev/null +++ b/src/system/kernel/arch/arm/arch_atomic32.cpp @@ -0,0 +1,177 @@ +/* + * Copyright 2013 Haiku, Inc. All rights reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Ithamar R. Adema, ithamar@upgrade-android.com + */ + +#include + +#include +#include + +#include + +#ifdef ATOMIC_FUNCS_ARE_SYSCALLS + +/* + * NOTE: These functions are _intentionally_ not using spinlocks, unlike + * the 64 bit versions. The reason for this is that they are used by the + * spinlock code itself, and therefore would deadlock. + * + * Since these are only really needed for ARMv5, which is not SMP anyway, + * this is an acceptable compromise. + */ + +int32 +atomic_set(vint32 *value, int32 newValue) +{ + InterruptsLocker locker; + + int32 oldValue = *value; + *value = newValue; + return oldValue; +} + +int32 +atomic_test_and_set(vint32 *value, int32 newValue, int32 testAgainst) +{ + InterruptsLocker locker; + + int32 oldValue = *value; + if (oldValue == testAgainst) + *value = newValue; + return oldValue; +} + +int32 +atomic_add(vint32 *value, int32 addValue) +{ + InterruptsLocker locker; + + int32 oldValue = *value; + *value += addValue; + return oldValue; +} + +int32 +atomic_and(vint32 *value, int32 andValue) +{ + InterruptsLocker locker; + + int32 oldValue = *value; + *value &= andValue; + return oldValue; +} + +int32 +atomic_or(vint32 *value, int32 orValue) +{ + InterruptsLocker locker; + + int32 oldValue = *value; + *value |= orValue; + return oldValue; +} + +int32 +atomic_get(vint32 *value) +{ + InterruptsLocker locker; + + int32 oldValue = *value; + return oldValue; +} + +int32 +_user_atomic_set(vint32 *value, int32 newValue) +{ + if (IS_USER_ADDRESS(value) + && lock_memory((void *)value, sizeof(int32), B_READ_DEVICE) == B_OK) { + int32 oldValue = atomic_set(value, newValue); + unlock_memory((void *)value, sizeof(int32), B_READ_DEVICE); + return oldValue; + } + +access_violation: + // XXX kill application + return -1; +} + +int32 +_user_atomic_test_and_set(vint32 *value, int32 newValue, int32 testAgainst) +{ + if (IS_USER_ADDRESS(value) + && lock_memory((void *)value, sizeof(int32), B_READ_DEVICE) == B_OK) { + int32 oldValue = atomic_test_and_set(value, newValue, testAgainst); + unlock_memory((void *)value, sizeof(int32), B_READ_DEVICE); + return oldValue; + } + +access_violation: + // XXX kill application + return -1; +} + +int32 +_user_atomic_add(vint32 *value, int32 addValue) +{ + if (IS_USER_ADDRESS(value) + && lock_memory((void *)value, sizeof(int32), B_READ_DEVICE) == B_OK) { + int32 oldValue = atomic_add(value, addValue); + unlock_memory((void *)value, sizeof(int32), B_READ_DEVICE); + return oldValue; + } + +access_violation: + // XXX kill application + return -1; +} + +int32 +_user_atomic_and(vint32 *value, int32 andValue) +{ + if (IS_USER_ADDRESS(value) + && lock_memory((void *)value, sizeof(int32), B_READ_DEVICE) == B_OK) { + int32 oldValue = atomic_and(value, andValue); + unlock_memory((void *)value, sizeof(int32), B_READ_DEVICE); + return oldValue; + } + +access_violation: + // XXX kill application + return -1; +} + +int32 +_user_atomic_or(vint32 *value, int32 orValue) +{ + if (IS_USER_ADDRESS(value) + && lock_memory((void *)value, sizeof(int32), B_READ_DEVICE) == B_OK) { + int32 oldValue = atomic_or(value, orValue); + unlock_memory((void *)value, sizeof(int32), B_READ_DEVICE); + return oldValue; + } + +access_violation: + // XXX kill application + return -1; +} + +int32 +_user_atomic_get(vint32 *value) +{ + if (IS_USER_ADDRESS(value) + && lock_memory((void *)value, sizeof(int32), B_READ_DEVICE) == B_OK) { + int32 oldValue = atomic_get(value); + unlock_memory((void *)value, sizeof(int32), B_READ_DEVICE); + return oldValue; + } + +access_violation: + // XXX kill application + return -1; +} + +#endif /* ATOMIC_FUNCS_ARE_SYSCALLS */ diff --git a/src/system/kernel/arch/arm/arch_atomic64.cpp b/src/system/kernel/arch/arm/arch_atomic64.cpp new file mode 100644 index 0000000000..a57fd61c6d --- /dev/null +++ b/src/system/kernel/arch/arm/arch_atomic64.cpp @@ -0,0 +1,192 @@ +/* + * Copyright 2013 Haiku, Inc. All rights reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Ithamar R. Adema, ithamar@upgrade-android.com + */ + +#include + +#include +#include + +#include + +#ifdef ATOMIC64_FUNCS_ARE_SYSCALLS + +/* + * NOTE: Unlike their 32-bit counterparts, these functions can use + * spinlocks safely currently, as no atomic 64-bit operations are + * done in the spinlock code. If this ever changes, this code will + * have to change. + * + * This code is here for ARMv6, which cannot do proper 64-bit atomic + * operations. Anything newer is capable, and does therefore not + * depend on this code. + */ + + +static spinlock atomic_lock = B_SPINLOCK_INITIALIZER; + + +int64 +atomic_set64(vint64 *value, int64 newValue) +{ + SpinLocker locker(&atomic_lock); + + int64 oldValue = *value; + *value = newValue; + return oldValue; +} + + +int64 +atomic_test_and_set64(vint64 *value, int64 newValue, int64 testAgainst) +{ + SpinLocker locker(&atomic_lock); + + int64 oldValue = *value; + if (oldValue == testAgainst) + *value = newValue; + return oldValue; +} + + +int64 +atomic_add64(vint64 *value, int64 addValue) +{ + SpinLocker locker(&atomic_lock); + + int64 oldValue = *value; + *value += addValue; + return oldValue; +} + + +int64 +atomic_and64(vint64 *value, int64 andValue) +{ + SpinLocker locker(&atomic_lock); + + int64 oldValue = *value; + *value &= andValue; + return oldValue; +} + + +int64 +atomic_or64(vint64 *value, int64 orValue) +{ + SpinLocker locker(&atomic_lock); + + int64 oldValue = *value; + *value |= orValue; + return oldValue; +} + + +int64 +atomic_get64(vint64 *value) +{ + SpinLocker locker(&atomic_lock); + return *value; +} + + +int64 +_user_atomic_set64(vint64 *value, int64 newValue) +{ + if (IS_USER_ADDRESS(value) + && lock_memory((void *)value, sizeof(int64), B_READ_DEVICE) == B_OK) { + int64 oldValue = atomic_set64(value, newValue); + unlock_memory((void *)value, sizeof(int64), B_READ_DEVICE); + return oldValue; + } + +access_violation: + // XXX kill application + return -1; +} + + +int64 +_user_atomic_test_and_set64(vint64 *value, int64 newValue, int64 testAgainst) +{ + if (IS_USER_ADDRESS(value) + && lock_memory((void *)value, sizeof(int64), B_READ_DEVICE) == B_OK) { + int64 oldValue = atomic_test_and_set64(value, newValue, testAgainst); + unlock_memory((void *)value, sizeof(int64), B_READ_DEVICE); + return oldValue; + } + +access_violation: + // XXX kill application + return -1; +} + + +int64 +_user_atomic_add64(vint64 *value, int64 addValue) +{ + if (IS_USER_ADDRESS(value) + && lock_memory((void *)value, sizeof(int64), B_READ_DEVICE) == B_OK) { + int64 oldValue = atomic_add64(value, addValue); + unlock_memory((void *)value, sizeof(int64), B_READ_DEVICE); + return oldValue; + } + +access_violation: + // XXX kill application + return -1; +} + + +int64 +_user_atomic_and64(vint64 *value, int64 andValue) +{ + if (IS_USER_ADDRESS(value) + && lock_memory((void *)value, sizeof(int64), B_READ_DEVICE) == B_OK) { + int64 oldValue = atomic_and64(value, andValue); + unlock_memory((void *)value, sizeof(int64), B_READ_DEVICE); + return oldValue; + } + +access_violation: + // XXX kill application + return -1; +} + + +int64 +_user_atomic_or64(vint64 *value, int64 orValue) +{ + if (IS_USER_ADDRESS(value) + && lock_memory((void *)value, sizeof(int64), B_READ_DEVICE) == B_OK) { + int64 oldValue = atomic_or64(value, orValue); + unlock_memory((void *)value, sizeof(int64), B_READ_DEVICE); + return oldValue; + } + +access_violation: + // XXX kill application + return -1; +} + + +int64 +_user_atomic_get64(vint64 *value) +{ + if (IS_USER_ADDRESS(value) + && lock_memory((void *)value, sizeof(int64), B_READ_DEVICE) == B_OK) { + int64 oldValue = atomic_get64(value); + unlock_memory((void *)value, sizeof(int64), B_READ_DEVICE); + return oldValue; + } + +access_violation: + // XXX kill application + return -1; +} + +#endif /* ATOMIC64_FUNCS_ARE_SYSCALLS */ diff --git a/src/system/kernel/arch/arm/arch_debug.cpp b/src/system/kernel/arch/arm/arch_debug.cpp index daae859148..1832ca2962 100644 --- a/src/system/kernel/arch/arm/arch_debug.cpp +++ b/src/system/kernel/arch/arm/arch_debug.cpp @@ -6,6 +6,8 @@ * Axel Dörfler * Ingo Weinhold * François Revol + * Ithamar R. Adema + * */ @@ -13,25 +15,22 @@ #include #include +#include #include #include #include #include - - -struct stack_frame { - struct stack_frame *previous; - addr_t return_address; -}; +#include +#include +#include #define NUM_PREVIOUS_LOCATIONS 32 extern struct iframe_stack gBootFrameStack; -/* static bool -already_visited(uint32 *visited, int32 *_last, int32 *_num, uint32 framePointer) +already_visited(uint32 *visited, int32 *_last, int32 *_num, uint32 fp) { int32 last = *_last; int32 num = *_num; @@ -39,13 +38,13 @@ already_visited(uint32 *visited, int32 *_last, int32 *_num, uint32 framePointer) for (i = 0; i < num; i++) { if (visited[(NUM_PREVIOUS_LOCATIONS + last - i) - % NUM_PREVIOUS_LOCATIONS] == framePointer) { + % NUM_PREVIOUS_LOCATIONS] == fp) { return true; } } *_last = last = (last + 1) % NUM_PREVIOUS_LOCATIONS; - visited[last] = framePointer; + visited[last] = fp; if (num < NUM_PREVIOUS_LOCATIONS) *_num = num + 1; @@ -54,99 +53,327 @@ already_visited(uint32 *visited, int32 *_last, int32 *_num, uint32 framePointer) } -static inline stack_frame * -get_current_stack_frame() +static status_t +get_next_frame(addr_t fp, addr_t *next, addr_t *ip) { - stack_frame *frame; - asm volatile("move.l %%fp,%0" : "=r"(frame)); - return frame; + if (fp != 0) { + addr_t _fp = *(((addr_t*)fp) -3); + addr_t _sp = *(((addr_t*)fp) -2); + addr_t _lr = *(((addr_t*)fp) -1); + addr_t _pc = *(((addr_t*)fp) -0); + + *ip = (_fp != 0) ? _lr : _pc; + *next = _fp; + + return B_OK; + } + + return B_BAD_VALUE; } static status_t -get_next_frame(addr_t framePointer, addr_t *next, addr_t *ip) +lookup_symbol(Thread* thread, addr_t address, addr_t* _baseAddress, + const char** _symbolName, const char** _imageName, bool* _exactMatch) { - Thread *thread = thread_get_current_thread(); - addr_t oldFaultHandler = thread->fault_handler; + status_t status = B_ENTRY_NOT_FOUND; - // set fault handler, so that we can safely access user stacks - if (thread) { - if (m68k_set_fault_handler(&thread->fault_handler, (addr_t)&&error)) - goto error; + if (IS_KERNEL_ADDRESS(address)) { + // a kernel symbol + status = elf_debug_lookup_symbol_address(address, _baseAddress, + _symbolName, _imageName, _exactMatch); + } else if (thread != NULL && thread->team != NULL) { + // try a lookup using the userland runtime loader structures + status = elf_debug_lookup_user_symbol_address(thread->team, address, + _baseAddress, _symbolName, _imageName, _exactMatch); + + if (status != B_OK) { + // try to locate the image in the images loaded into user space + status = image_debug_lookup_user_symbol_address(thread->team, + address, _baseAddress, _symbolName, _imageName, _exactMatch); + } } - *ip = ((struct stack_frame *)framePointer)->return_address; - *next = (addr_t)((struct stack_frame *)framePointer)->previous; - - if (thread) - thread->fault_handler = oldFaultHandler; - return B_OK; - -error: - thread->fault_handler = oldFaultHandler; - return B_BAD_ADDRESS; + return status; } static void -print_stack_frame(Thread *thread, addr_t ip, addr_t framePointer, - addr_t nextFramePointer) +set_debug_argument_variable(int32 index, uint64 value) { - addr_t diff = nextFramePointer - framePointer; - - // kernel space/user space switch - if (diff & 0x80000000) - diff = 0; - - // lookup symbol - const char *symbol, *image; - addr_t baseAddress; - bool exactMatch; - status_t status = elf_debug_lookup_symbol_address(ip, &baseAddress, &symbol, - &image, &exactMatch); - if (status != B_OK && !IS_KERNEL_ADDRESS(ip) && thread) { - // try to locate the image in the images loaded into user space - status = image_debug_lookup_user_symbol_address(thread->team, ip, - &baseAddress, &symbol, &image, &exactMatch); - } - if (status == B_OK) { - if (symbol != NULL) { - kprintf("%08lx (+%4ld) %08lx <%s>:%s + 0x%04lx%s\n", framePointer, - diff, ip, image, symbol, ip - baseAddress, - (exactMatch ? "" : " (nearest)")); - } else { - kprintf("%08lx (+%4ld) %08lx <%s@%p>:unknown + 0x%04lx\n", - framePointer, diff, ip, image, (void *)baseAddress, - ip - baseAddress); - } - } else - kprintf("%08lx (+%4ld) %08lx\n", framePointer, diff, ip); + char name[8]; + snprintf(name, sizeof(name), "_arg%ld", index); + set_debug_variable(name, value); } +template +static Type +read_function_argument_value(void* argument, bool& _valueKnown) +{ + Type value; + if (debug_memcpy(B_CURRENT_TEAM, &value, argument, sizeof(Type)) == B_OK) { + _valueKnown = true; + return value; + } + + _valueKnown = false; + return 0; +} + + +static status_t +print_demangled_call(const char* image, const char* symbol, addr_t args, + bool noObjectMethod, bool addDebugVariables) +{ + static const size_t kBufferSize = 256; + char* buffer = (char*)debug_malloc(kBufferSize); + if (buffer == NULL) + return B_NO_MEMORY; + + bool isObjectMethod; + const char* name = debug_demangle_symbol(symbol, buffer, kBufferSize, + &isObjectMethod); + if (name == NULL) { + debug_free(buffer); + return B_ERROR; + } + + uint32* arg = (uint32*)args; + + if (noObjectMethod) + isObjectMethod = false; + if (isObjectMethod) { + const char* lastName = strrchr(name, ':') - 1; + int namespaceLength = lastName - name; + + uint32 argValue = 0; + if (debug_memcpy(B_CURRENT_TEAM, &argValue, arg, 4) == B_OK) { + kprintf("<%s> %.*s<\33[32m%#" B_PRIx32 "\33[0m>%s", image, + namespaceLength, name, argValue, lastName); + } else + kprintf("<%s> %.*s%s", image, namespaceLength, name, lastName); + + if (addDebugVariables) + set_debug_variable("_this", argValue); + arg++; + } else + kprintf("<%s> %s", image, name); + + kprintf("("); + + size_t length; + int32 type, i = 0; + uint32 cookie = 0; + while (debug_get_next_demangled_argument(&cookie, symbol, buffer, + kBufferSize, &type, &length) == B_OK) { + if (i++ > 0) + kprintf(", "); + + // retrieve value and type identifier + + uint64 value; + bool valueKnown = false; + + switch (type) { + case B_INT64_TYPE: + value = read_function_argument_value(arg, valueKnown); + if (valueKnown) + kprintf("int64: \33[34m%Ld\33[0m", value); + break; + case B_INT32_TYPE: + value = read_function_argument_value(arg, valueKnown); + if (valueKnown) + kprintf("int32: \33[34m%ld\33[0m", (int32)value); + break; + case B_INT16_TYPE: + value = read_function_argument_value(arg, valueKnown); + if (valueKnown) + kprintf("int16: \33[34m%d\33[0m", (int16)value); + break; + case B_INT8_TYPE: + value = read_function_argument_value(arg, valueKnown); + if (valueKnown) + kprintf("int8: \33[34m%d\33[0m", (int8)value); + break; + case B_UINT64_TYPE: + value = read_function_argument_value(arg, valueKnown); + if (valueKnown) { + kprintf("uint64: \33[34m%#Lx\33[0m", value); + if (value < 0x100000) + kprintf(" (\33[34m%Lu\33[0m)", value); + } + break; + case B_UINT32_TYPE: + value = read_function_argument_value(arg, valueKnown); + if (valueKnown) { + kprintf("uint32: \33[34m%#lx\33[0m", (uint32)value); + if (value < 0x100000) + kprintf(" (\33[34m%lu\33[0m)", (uint32)value); + } + break; + case B_UINT16_TYPE: + value = read_function_argument_value(arg, valueKnown); + if (valueKnown) { + kprintf("uint16: \33[34m%#x\33[0m (\33[34m%u\33[0m)", + (uint16)value, (uint16)value); + } + break; + case B_UINT8_TYPE: + value = read_function_argument_value(arg, valueKnown); + if (valueKnown) { + kprintf("uint8: \33[34m%#x\33[0m (\33[34m%u\33[0m)", + (uint8)value, (uint8)value); + } + break; + case B_BOOL_TYPE: + value = read_function_argument_value(arg, valueKnown); + if (valueKnown) + kprintf("\33[34m%s\33[0m", value ? "true" : "false"); + break; + default: + if (buffer[0]) + kprintf("%s: ", buffer); + + if (length == 4) { + value = read_function_argument_value(arg, + valueKnown); + if (valueKnown) { + if (value == 0 + && (type == B_POINTER_TYPE || type == B_REF_TYPE)) + kprintf("NULL"); + else + kprintf("\33[34m%#lx\33[0m", (uint32)value); + } + break; + } + + + if (length == 8) { + value = read_function_argument_value(arg, + valueKnown); + } else + value = (uint64)arg; + + if (valueKnown) + kprintf("\33[34m%#Lx\33[0m", value); + break; + } + + if (!valueKnown) + kprintf("???"); + + if (valueKnown && type == B_STRING_TYPE) { + if (value == 0) + kprintf(" \33[31m\"\"\33[0m"); + else if (debug_strlcpy(B_CURRENT_TEAM, buffer, (char*)(addr_t)value, + kBufferSize) < B_OK) { + kprintf(" \33[31m\"\"\33[0m"); + } else + kprintf(" \33[36m\"%s\"\33[0m", buffer); + } + + if (addDebugVariables) + set_debug_argument_variable(i, value); + arg = (uint32*)((uint8*)arg + length); + } + + debug_free(buffer); + + kprintf(")"); + return B_OK; +} + + + +static void +print_stack_frame(Thread *thread, addr_t ip, addr_t fp, addr_t next, + int32 callIndex, bool demangle) +{ + const char* symbol; + const char* image; + addr_t baseAddress; + bool exactMatch; + status_t status; + addr_t diff; + + diff = next - fp; + + // MSB set = kernel space/user space switch + if (diff & ~((addr_t)-1 >> 1)) + diff = 0; + + status = lookup_symbol(thread, ip, &baseAddress, &symbol, &image, + &exactMatch); + + kprintf("%2" B_PRId32 " %0*lx (+%4ld) %0*lx ", callIndex, + B_PRINTF_POINTER_WIDTH, fp, diff, B_PRINTF_POINTER_WIDTH, ip); + + if (status == B_OK) { + if (exactMatch && demangle) { + status = print_demangled_call(image, symbol, + next, false, false); + } + + if (!exactMatch || !demangle || status != B_OK) { + if (symbol != NULL) { + kprintf("<%s> %s%s", image, symbol, + exactMatch ? "" : " (nearest)"); + } else + kprintf("<%s@%p> ", image, (void*)baseAddress); + } + + kprintf(" + %#04lx\n", ip - baseAddress); + } else { + VMArea *area = NULL; + if (thread != NULL && thread->team != NULL + && thread->team->address_space != NULL) { + area = thread->team->address_space->LookupArea(ip); + } + if (area != NULL) { + kprintf("%" B_PRId32 ":%s@%p + %#lx\n", area->id, area->name, + (void*)area->Base(), ip - area->Base()); + } else + kprintf("\n"); + } +} + static int stack_trace(int argc, char **argv) { - uint32 previousLocations[NUM_PREVIOUS_LOCATIONS]; - struct iframe_stack *frameStack; - Thread *thread; - addr_t framePointer; - int32 i, num = 0, last = 0; - - if (argc < 2) { - thread = thread_get_current_thread(); - framePointer = (addr_t)get_current_stack_frame(); - } else { -kprintf("Stack traces of other threads not supported yet!\n"); -return 0; + static const char* usage = "usage: %s [-d] [ ]\n" + "Prints a stack trace for the current, respectively the specified\n" + "thread.\n" + " -d - Disables the demangling of the symbols.\n" + " - The ID of the thread for which to print the stack\n" + " trace.\n"; + bool demangle = true; + int32 threadIndex = 1; + if (argc > 1 && !strcmp(argv[1], "-d")) { + demangle = false; + threadIndex++; } + if (argc > threadIndex + 1 + || (argc == 2 && strcmp(argv[1], "--help") == 0)) { + kprintf(usage, argv[0]); + return 0; + } + + addr_t previousLocations[NUM_PREVIOUS_LOCATIONS]; + Thread* thread = NULL; + phys_addr_t oldPageDirectory = 0; + addr_t fp = arm_get_fp(); + int32 num = 0, last = 0; + struct iframe_stack *frameStack; + // We don't have a thread pointer early in the boot process if (thread != NULL) frameStack = &thread->arch_info.iframes; else frameStack = &gBootFrameStack; + int32 i; for (i = 0; i < frameStack->index; i++) { kprintf("iframe %p (end = %p)\n", frameStack->frames[i], frameStack->frames[i] + 1); @@ -168,11 +395,11 @@ return 0; kprintf("frame caller :function + offset\n"); - for (;;) { + for (int32 callIndex = 0;; callIndex++) { // see if the frame pointer matches the iframe struct iframe *frame = NULL; for (i = 0; i < frameStack->index; i++) { - if (framePointer == (addr_t)frameStack->frames[i]) { + if (fp == (addr_t)frameStack->frames[i]) { // it's an iframe frame = frameStack->frames[i]; break; @@ -181,49 +408,43 @@ return 0; if (frame) { kprintf("iframe at %p\n", frame); - kprintf(" d0 0x%08lx d1 0x%08lx d2 0x%08lx d3 0x%08lx\n", - frame->d[0], frame->d[1], frame->d[2], frame->d[3]); - kprintf(" d4 0x%08lx d5 0x%08lx d6 0x%08lx d7 0x%08lx\n", - frame->d[4], frame->d[5], frame->d[6], frame->d[7]); - kprintf(" a0 0x%08lx a1 0x%08lx a2 0x%08lx a3 0x%08lx\n", - frame->a[0], frame->a[1], frame->a[2], frame->a[3]); - kprintf(" a4 0x%08lx a5 0x%08lx a6 0x%08lx a7 0x%08lx (sp)\n", -#warning M68K: a7 in iframe ?? - frame->a[4], frame->a[5], frame->a[6], -1L); - kprintf(" pc 0x%08lx sr 0x%04x\n", - frame->cpu.pc, frame->cpu.sr); -#warning M68K: missing regs + kprintf(" r0 0x%08lx r1 0x%08lx r2 0x%08lx r3 0x%08lx\n", + frame->r0, frame->r1, frame->r2, frame->r3); + kprintf(" r4 0x%08lx r5 0x%08lx r6 0x%08lx r7 0x%08lx\n", + frame->r4, frame->r5, frame->r6, frame->r7); + kprintf(" r8 0x%08lx r9 0x%08lx r10 0x%08lx r11 0x%08lx\n", + frame->r8, frame->r9, frame->r10, frame->r11); + kprintf(" r12 0x%08lx sp 0x%08lx lr 0x%08lx pc 0x%08lx\n", + frame->r12, frame->svc_sp, frame->svc_lr, frame->pc); - print_stack_frame(thread, frame->cpu.pc, framePointer, frame->a[6]); - framePointer = frame->a[6]; + fp = frame->svc_sp; + print_stack_frame(thread, frame->pc, frame->svc_sp, frame->svc_lr, callIndex, demangle); } else { - addr_t ip, nextFramePointer; + addr_t ip, next; - if (get_next_frame(framePointer, &nextFramePointer, &ip) != B_OK) { - kprintf("%08lx -- read fault\n", framePointer); + if (get_next_frame(fp, &next, &ip) != B_OK) { + kprintf("%08lx -- read fault\n", fp); break; } - if (ip == 0 || framePointer == 0) + if (ip == 0 || fp == 0) break; - print_stack_frame(thread, ip, framePointer, nextFramePointer); - framePointer = nextFramePointer; + print_stack_frame(thread, ip, fp, next, callIndex, demangle); + fp = next; } - if (already_visited(previousLocations, &last, &num, framePointer)) { - kprintf("circular stack frame: %p!\n", (void *)framePointer); + if (already_visited(previousLocations, &last, &num, fp)) { + kprintf("circular stack frame: %p!\n", (void *)fp); break; } - if (framePointer == 0) + if (fp == 0) break; } - return 0; } -*/ // #pragma mark - @@ -245,6 +466,7 @@ arch_debug_contains_call(Thread *thread, const char *symbol, void arch_debug_stack_trace(void) { + stack_trace(0, NULL); } @@ -261,8 +483,7 @@ int32 arch_debug_get_stack_trace(addr_t* returnAddresses, int32 maxCount, int32 skipIframes, int32 skipFrames, uint32 flags) { -#warning ARM:IMPLEMENT - + // TODO: Implement! return 0; } @@ -302,10 +523,9 @@ arch_get_debug_variable(const char* variableName, uint64* value) status_t arch_debug_init(kernel_args *args) { -// add_debugger_command("where", &stack_trace, "Same as \"sc\""); -// add_debugger_command("bt", &stack_trace, "Same as \"sc\" (as in gdb)"); -// add_debugger_command("sc", &stack_trace, "Stack crawl for current thread"); -#warning ARM:IMPLEMENT + add_debugger_command("where", &stack_trace, "Same as \"sc\""); + add_debugger_command("bt", &stack_trace, "Same as \"sc\" (as in gdb)"); + add_debugger_command("sc", &stack_trace, "Stack crawl for current thread"); return B_NO_ERROR; } diff --git a/src/system/kernel/arch/arm/arch_int.cpp b/src/system/kernel/arch/arm/arch_int.cpp index b41cc7154d..25aad9e0cf 100644 --- a/src/system/kernel/arch/arm/arch_int.cpp +++ b/src/system/kernel/arch/arm/arch_int.cpp @@ -31,7 +31,7 @@ #include -//#define TRACE_ARCH_INT +#define TRACE_ARCH_INT #ifdef TRACE_ARCH_INT # define TRACE(x) dprintf x #else @@ -108,9 +108,9 @@ print_iframe(const char *event, struct iframe *frame) frame->r0, frame->r1, frame->r2, frame->r3, frame->r4, frame->r5, frame->r6, frame->r7); dprintf("R08=%08lx R09=%08lx R10=%08lx R11=%08lx\n" - "R12=%08lx R13=%08lx R14=%08lx CPSR=%08lx\n", + "R12=%08lx SP=%08lx LR=%08lx PC=%08lx CPSR=%08lx\n", frame->r8, frame->r9, frame->r10, frame->r11, - frame->r12, frame->usr_sp, frame->usr_lr, frame->spsr); + frame->r12, frame->svc_sp, frame->svc_lr, frame->pc, frame->spsr); } @@ -188,10 +188,36 @@ arch_int_init_post_device_manager(struct kernel_args *args) } +// Little helper class for handling the +// iframe stack as used by KDL. +class IFrameScope { +public: + IFrameScope(struct iframe *iframe) { + fThread = thread_get_current_thread(); + if (fThread) + arm_push_iframe(&fThread->arch_info.iframes, iframe); + else + arm_push_iframe(&gBootFrameStack, iframe); + } + + virtual ~IFrameScope() { + // pop iframe + if (fThread) + arm_pop_iframe(&fThread->arch_info.iframes); + else + arm_pop_iframe(&gBootFrameStack); + } +private: + Thread* fThread; +}; + + extern "C" void arch_arm_undefined(struct iframe *iframe) { print_iframe("Undefined Instruction", iframe); + IFrameScope scope(iframe); // push/pop iframe + panic("not handled!"); } @@ -200,6 +226,7 @@ extern "C" void arch_arm_syscall(struct iframe *iframe) { print_iframe("Software interrupt", iframe); + IFrameScope scope(iframe); // push/pop iframe } @@ -214,8 +241,11 @@ arch_arm_data_abort(struct iframe *frame) #ifdef TRACE_ARCH_INT print_iframe("Data Abort", frame); + dprintf("FAR: %08lx, thread: %s\n", far, thread->name); #endif + IFrameScope scope(frame); + if (debug_debugger_running()) { // If this CPU or this thread has a fault handler, we're allowed to be // here. @@ -291,6 +321,8 @@ extern "C" void arch_arm_prefetch_abort(struct iframe *iframe) { print_iframe("Prefetch Abort", iframe); + IFrameScope scope(iframe); + panic("not handled!"); } @@ -298,6 +330,8 @@ arch_arm_prefetch_abort(struct iframe *iframe) extern "C" void arch_arm_irq(struct iframe *iframe) { + IFrameScope scope(iframe); + for (int i=0; i < 32; i++) { if (sPxaInterruptBase[PXA_ICIP] & (1 << i)) int_io_interrupt_handler(i, true); @@ -308,6 +342,8 @@ arch_arm_irq(struct iframe *iframe) extern "C" void arch_arm_fiq(struct iframe *iframe) { + IFrameScope scope(iframe); + for (int i=0; i < 32; i++) { if (sPxaInterruptBase[PXA_ICIP] & (1 << i)) { dprintf("arch_arm_fiq: help me, FIQ %d was triggered but no " diff --git a/src/system/kernel/arch/arm/arch_thread.cpp b/src/system/kernel/arch/arm/arch_thread.cpp index 3f7950e380..2de87612e8 100644 --- a/src/system/kernel/arch/arm/arch_thread.cpp +++ b/src/system/kernel/arch/arm/arch_thread.cpp @@ -42,6 +42,23 @@ static struct arch_thread sInitialState; Thread *gCurrentThread; +void +arm_push_iframe(struct iframe_stack *stack, struct iframe *frame) +{ + ASSERT(stack->index < IFRAME_TRACE_DEPTH); + stack->frames[stack->index++] = frame; +} + + +void +arm_pop_iframe(struct iframe_stack *stack) +{ + ASSERT(stack->index > 0); + stack->index--; +} + + + status_t arch_thread_init(struct kernel_args *args) { diff --git a/src/system/kernel/arch/arm/arch_timer.cpp b/src/system/kernel/arch/arm/arch_timer.cpp index 6c291ed6bb..01a6fb2f9a 100644 --- a/src/system/kernel/arch/arm/arch_timer.cpp +++ b/src/system/kernel/arch/arm/arch_timer.cpp @@ -29,7 +29,7 @@ #define PXA_TIMERS_PHYS_BASE 0x40A00000 -#define PXA_TIMERS_SIZE 0x000000C0 +#define PXA_TIMERS_SIZE B_PAGE_SIZE #define PXA_TIMERS_INTERRUPT 7 /* OST_4_11 */ #define PXA_OSSR 0x05 @@ -48,7 +48,7 @@ #define US2S(bt) ((bt) / 1000000ULL) #define US2MS(bt) ((bt) / 1000ULL) -static area_id sPxaTimersArea = B_ERROR; +static area_id sPxaTimersArea = -1; static uint32 *sPxaTimersBase = NULL; static bigtime_t sSystemTime = 0; @@ -107,6 +107,7 @@ arch_timer_clear_hardware_timer() int arch_init_timer(kernel_args *args) { + TRACE(("%s\n", __func__)); sPxaTimersArea = map_physical_memory("pxa_timers", PXA_TIMERS_PHYS_BASE, PXA_TIMERS_SIZE, 0, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA, (void**)&sPxaTimersBase); @@ -126,6 +127,9 @@ arch_init_timer(kernel_args *args) bigtime_t system_time(void) { + if (sPxaTimersArea < 0) + return 0; + return (sPxaTimersBase != NULL) ? sSystemTime + sPxaTimersBase[PXA_OSCR5] : 0ULL; diff --git a/src/system/kernel/arch/ppc/Jamfile b/src/system/kernel/arch/ppc/Jamfile index 493d20caa0..7cc64b8060 100644 --- a/src/system/kernel/arch/ppc/Jamfile +++ b/src/system/kernel/arch/ppc/Jamfile @@ -14,6 +14,7 @@ KernelMergeObject kernel_arch_ppc.o : arch_debug.cpp arch_elf.cpp arch_exceptions.S + arch_exceptions_44x.S arch_int.cpp arch_mmu.cpp arch_platform.cpp @@ -26,6 +27,8 @@ KernelMergeObject kernel_arch_ppc.o : arch_vm.cpp arch_vm_translation_map.cpp arch_asm.S + debug_uart_8250.cpp + arch_uart_8250.cpp generic_vm_physical_page_mapper.cpp generic_vm_physical_page_ops.cpp diff --git a/src/system/kernel/arch/ppc/arch_exceptions.S b/src/system/kernel/arch/ppc/arch_exceptions.S index b20198d257..85e532dd1e 100644 --- a/src/system/kernel/arch/ppc/arch_exceptions.S +++ b/src/system/kernel/arch/ppc/arch_exceptions.S @@ -5,8 +5,7 @@ * Copyright 2003, Travis Geiselbrecht. All rights reserved. * Distributed under the terms of the NewOS License. */ -#define FUNCTION(x) .global x; .type x,@function; x -#define LOCAL_FUNCTION(x) .type x,@function; x +#include /* General exception handling concept: diff --git a/src/system/kernel/arch/ppc/arch_exceptions_44x.S b/src/system/kernel/arch/ppc/arch_exceptions_44x.S new file mode 100644 index 0000000000..c533bcaaf5 --- /dev/null +++ b/src/system/kernel/arch/ppc/arch_exceptions_44x.S @@ -0,0 +1,441 @@ +/* + * Copyright 2013, François Revol . + * All rights reserved. Distributed under the terms of the MIT License. + * + * Copyright 2006, Ingo Weinhold . + * All rights reserved. Distributed under the terms of the MIT License. + * + * Copyright 2003, Travis Geiselbrecht. All rights reserved. + * Distributed under the terms of the NewOS License. + */ +#include + +/* General exception handling concept: + + The PPC architecture specifies entry point offsets for the various + exceptions in the first two physical pages. We put a short piece of code + (VEC_ENTRY()) into each exception vector. It calls exception_vector_common, + which is defined in the unused space at the beginning of the first physical + page. It re-enables address translation and calls ppc_exception_tail which + lies in the kernel. It dumps an iframe and invokes ppc_exception_entry() + (arch_int.cpp), which handles the exception and returns eventually. + The registers are restored from the iframe and we return from the + interrupt. + + algorithm overview: + + * VEC_ENTRY + * ppc_44x_exception_vector_common + * ppc_44x_exception_tail + - dump iframe + - ppc_exception_entry() + - restore registers and return from interrupt + + Here we use the following SPRG registers, which are at the disposal of the + operating system: + * SPRG0: Physical address pointer to a struct cpu_exception_context + for the current CPU. The structure contains helpful pointers + as well as some scratch memory for temporarily saving registers. + * SPRG1: Scratch. + + struct cpu_exception_context (defined in arch_int.h): + offset 0: virtual address of the exception handler routine in the kernel + offset 4: virtual address of the exception context + offset 8: kernel stack for the current thread + offset 12: start of scratch memory for saving registers etc. + + algorithm in detail: + + * VEC_ENTRY + - save r1 in SPRG1 and load cpu_exception_context into r1 + - save r0, save LR in r0 + * ppc_44x_exception_vector_common + - params: + . r0: old LR + . r1: exception context (physical address) + . SPRG1: original r1 + - save r0-3 + - load virtual exception context address to r1 + - turn on BAT for exception vector code + - turn on address translation + - get exception vector offset from LR + * ppc_44x_exception_tail + - params: + . r1: exception context (virtual address) + . r3: exception vector offset + . SPRG1: original r1 + - turn off BAT + - get kernel stack pointer + - dump iframe + - ppc_exception_entry() + - restore registers and return from interrupt + */ + + +/* exception vector definitions */ + +/* code in each exception vector */ +#define VEC_ENTRY() \ + mtsprg1 %r1 ; /* temporarily save r1 in SPRG1 */ \ + mfsprg0 %r1 ; /* ppc_cpu_exception_context* -> r1 */ \ + stw %r0, 16(%r1) ; /* save r0 */ \ + mflr %r0 ; /* save LR in r0 */ \ + bl ppc_44x_exception_vector_common ; /* continue with the common part */ + +/* defines an exception vector */ +#define DEFINE_VECTOR(offset, name) \ +.skip offset - (. - __44x_irqvec_start); \ +FUNCTION(ppc_44x_##name): \ + VEC_ENTRY() + + +.global __44x_irqvec_start +__44x_irqvec_start: + .long 0 + +/* Called by the exception vector code. + * LR: Points to the end of the exception vector code we're coming from. + * r0: original LR + * r1: ppc_cpu_exception_context* (physical address) + * SPRG1: original r1 + */ +ppc_44x_exception_vector_common: + stw %r0, 20(%r1) /* save original LR */ + stw %r2, 24(%r1) /* save r2 */ + stw %r3, 28(%r1) /* save r3 */ + + /* load the virtual address of the ppc_cpu_exception_context for this CPU */ + lwz %r1, 4(%r1) + + /* Address translation is turned off. We map this code via BAT, turn on + address translation, and continue in the kernel proper. */ + li %r0, 0x10|0x2 /* BATL_MC | BATL_PP_RW */ + mtibatl 0, %r0 /* load lower word of the instruction BAT */ + li %r0, 0x2 /* BEPI = 0, BL = 0 (128 KB), BATU_VS */ + mtibatu 0, %r0 /* load upper word of the instruction BAT */ + isync + sync + + /* turn on address translation */ + mfsrr1 %r0 /* load saved msr */ + rlwinm %r0, %r0, 28, 30, 31 /* extract mmu bits */ + mfmsr %r3 /* load the current msr */ + rlwimi %r3, %r0, 4, 26, 27 /* merge the mmu bits with the current msr */ + li %r0, 1 + rlwimi %r3, %r0, 13, 18, 18 /* turn on FPU, too */ + mtmsr %r3 /* load new msr (turning the mmu back on) */ + isync + + /* Get LR -- it points to the end of the exception vector code. We adjust it + to point to the beginning and can use it to identify the vector later. */ + mflr %r3 + subi %r3, %r3, 20 /* 5 instructions */ + + /* jump to kernel code (ppc_exception_tail) */ + lwz %r2, 0(%r1) + mtlr %r2 + blr + + +DEFINE_VECTOR(0x100, system_reset_exception) +DEFINE_VECTOR(0x200, machine_check_exception) +DEFINE_VECTOR(0x300, DSI_exception) +DEFINE_VECTOR(0x400, ISI_exception) +DEFINE_VECTOR(0x500, external_interrupt_exception) +DEFINE_VECTOR(0x600, alignment_exception) +DEFINE_VECTOR(0x700, program_exception) +DEFINE_VECTOR(0x800, FP_unavailable_exception) +DEFINE_VECTOR(0x900, decrementer_exception) +DEFINE_VECTOR(0xc00, system_call_exception) +DEFINE_VECTOR(0xd00, trace_exception) +DEFINE_VECTOR(0xe00, FP_assist_exception) +DEFINE_VECTOR(0xf00, perf_monitor_exception) +DEFINE_VECTOR(0xf20, altivec_unavailable_exception) +DEFINE_VECTOR(0x1000, ITLB_miss_exception) +DEFINE_VECTOR(0x1100, DTLB_miss_on_load_exception) +DEFINE_VECTOR(0x1200, DTLB_miss_on_store_exception) +DEFINE_VECTOR(0x1300, instruction_address_breakpoint_exception) +DEFINE_VECTOR(0x1400, system_management_exception) +DEFINE_VECTOR(0x1600, altivec_assist_exception) +DEFINE_VECTOR(0x1700, thermal_management_exception) + +.global __44x_irqvec_end +__44x_irqvec_end: + + +/* This is where ppc_44x_exception_vector_common continues. We're in the kernel here. + r1: ppc_cpu_exception_context* (virtual address) + r3: exception vector offset + SPRG1: original r1 + */ +FUNCTION(ppc_44x_exception_tail): + /* turn off BAT */ + li %r2, 0 + mtibatu 0, %r2 + mtibatl 0, %r2 + isync + sync + + /* save CR */ + mfcr %r0 + + mfsrr1 %r2 /* load saved msr */ + andi. %r2, %r2, (1 << 14) /* see if it was in kernel mode */ + beq .kernel /* yep */ + + /* We come from userland. Load the kernel stack top address for the current + userland thread. */ + mr %r2, %r1 + lwz %r1, 8(%r1) + b .restore_stack_end + +.kernel: + mr %r2, %r1 + mfsprg1 %r1 + +.restore_stack_end: + /* now r2 points to the ppc_cpu_exception_context, r1 to the kernel stack */ + /* restore the CR, it was messed up in the previous compare */ + mtcrf 0xff, %r0 + + /* align r1 to 8 bytes, so the iframe will be aligned too */ + rlwinm %r1, %r1, 0, 0, 28 + + /* save the registers */ + bl __44x_save_regs + + /* iframe pointer to r4 and a backup to r20 */ + mr %r4, %r1 + mr %r20, %r1 + + /* adjust the stack pointer for ABI compatibility */ + subi %r1, %r1, 8 /* make sure there's space for the previous + frame pointer and the return address */ + rlwinm %r1, %r1, 0, 0, 27 /* 16 byte align the stack pointer */ + li %r0, 0 + stw %r0, 0(%r1) /* previous frame pointer: NULL */ + /* 4(%r1) is room for the return address to be filled in by the + called function. */ + + /* r3: exception vector offset + r4: iframe pointer */ + bl ppc_exception_entry + + /* move the iframe to r1 */ + mr %r1, %r20 + + b __44x_restore_regs_and_rfi + + +/* called by ppc_44x_exception_tail + * register expectations: + * r1: stack + * r2: ppc_cpu_exception_context* + * SPRG1: original r1 + * r0,r3, LR: scrambled, but saved in scratch memory + * all other regs should have been unmodified by the exception handler, + * and ready to be saved + */ +__44x_save_regs: + /* Note: The iframe must be 8 byte aligned. The stack pointer we are passed + in r1 is aligned. So we store the floating point registers first and + need to take care that an even number of 4 byte registers is stored, + or insert padding respectively. */ + + /* push f0-f31 */ + stfdu %f0, -8(%r1) + stfdu %f1, -8(%r1) + stfdu %f2, -8(%r1) + stfdu %f3, -8(%r1) + stfdu %f4, -8(%r1) + stfdu %f5, -8(%r1) + stfdu %f6, -8(%r1) + stfdu %f7, -8(%r1) + stfdu %f8, -8(%r1) + stfdu %f9, -8(%r1) + stfdu %f10, -8(%r1) + stfdu %f11, -8(%r1) + stfdu %f12, -8(%r1) + stfdu %f13, -8(%r1) + stfdu %f14, -8(%r1) + stfdu %f15, -8(%r1) + stfdu %f16, -8(%r1) + stfdu %f17, -8(%r1) + stfdu %f18, -8(%r1) + stfdu %f19, -8(%r1) + stfdu %f20, -8(%r1) + stfdu %f21, -8(%r1) + stfdu %f22, -8(%r1) + stfdu %f23, -8(%r1) + stfdu %f24, -8(%r1) + stfdu %f25, -8(%r1) + stfdu %f26, -8(%r1) + stfdu %f27, -8(%r1) + stfdu %f28, -8(%r1) + stfdu %f29, -8(%r1) + stfdu %f30, -8(%r1) + stfdu %f31, -8(%r1) + + /* push r0-r3 */ + lwz %r0, 16(%r2) /* original r0 */ + stwu %r0, -4(%r1) /* push r0 */ + mfsprg1 %r0 /* original r1 */ + stwu %r0, -4(%r1) /* push r1 */ + lwz %r0, 24(%r2) /* original r2 */ + stwu %r0, -4(%r1) /* push r2 */ + lwz %r0, 28(%r2) /* original r3 */ + stwu %r0, -4(%r1) /* push r3 */ + + /* push r4-r31 */ + stwu %r4, -4(%r1) + stwu %r5, -4(%r1) + stwu %r6, -4(%r1) + stwu %r7, -4(%r1) + stwu %r8, -4(%r1) + stwu %r9, -4(%r1) + stwu %r10, -4(%r1) + stwu %r11, -4(%r1) + stwu %r12, -4(%r1) + stwu %r13, -4(%r1) + stwu %r14, -4(%r1) + stwu %r15, -4(%r1) + stwu %r16, -4(%r1) + stwu %r17, -4(%r1) + stwu %r18, -4(%r1) + stwu %r19, -4(%r1) + stwu %r20, -4(%r1) + stwu %r21, -4(%r1) + stwu %r22, -4(%r1) + stwu %r23, -4(%r1) + stwu %r24, -4(%r1) + stwu %r25, -4(%r1) + stwu %r26, -4(%r1) + stwu %r27, -4(%r1) + stwu %r28, -4(%r1) + stwu %r29, -4(%r1) + stwu %r30, -4(%r1) + stwu %r31, -4(%r1) + + /* save some of the other regs */ + mffs %f0 + stfsu %f0, -4(%r1) /* push FPSCR */ + mfctr %r0 + stwu %r0, -4(%r1) /* push CTR */ + mfxer %r0 + stwu %r0, -4(%r1) /* push XER */ + mfcr %r0 + stwu %r0, -4(%r1) /* push CR */ + lwz %r0, 20(%r2) /* original LR */ + stwu %r0, -4(%r1) /* push LR */ + mfspr %r0, %dsisr + stwu %r0, -4(%r1) /* push DSISR */ + mfspr %r0, %dar + stwu %r0, -4(%r1) /* push DAR */ + mfspr %r0, %srr1 + stwu %r0, -4(%r1) /* push SRR1 */ + mfspr %r0, %srr0 + stwu %r0, -4(%r1) /* push SRR0 */ + + stwu %r3, -4(%r1) /* exception vector offset */ + + blr + + +/* called at the tail end of each of the exceptions + * r1: iframe pointer + */ +__44x_restore_regs_and_rfi: + lwzu %r0, 4(%r1) /* SRR0 (skip vector offset) */ + mtspr %srr0, %r0 + lwzu %r0, 4(%r1) /* SRR1 */ + mtspr %srr1, %r0 + lwzu %r0, 4(%r1) /* DAR */ + mtspr %dar, %r0 + lwzu %r0, 4(%r1) /* DSISR */ + mtspr %dsisr, %r0 + lwzu %r0, 4(%r1) /* LR */ + mtlr %r0 + lwzu %r0, 4(%r1) /* CR */ + mtcr %r0 + lwzu %r0, 4(%r1) /* XER */ + mtxer %r0 + lwzu %r0, 4(%r1) /* CTR */ + mtctr %r0 + lfsu %f0, 4(%r1) /* FPSCR */ + mtfsf 0xff, %f0 + + lwzu %r31, 4(%r1) + lwzu %r30, 4(%r1) + lwzu %r29, 4(%r1) + lwzu %r28, 4(%r1) + lwzu %r27, 4(%r1) + lwzu %r26, 4(%r1) + lwzu %r25, 4(%r1) + lwzu %r24, 4(%r1) + lwzu %r23, 4(%r1) + lwzu %r22, 4(%r1) + lwzu %r21, 4(%r1) + lwzu %r20, 4(%r1) + lwzu %r19, 4(%r1) + lwzu %r18, 4(%r1) + lwzu %r17, 4(%r1) + lwzu %r16, 4(%r1) + lwzu %r15, 4(%r1) + lwzu %r14, 4(%r1) + lwzu %r13, 4(%r1) + lwzu %r12, 4(%r1) + lwzu %r11, 4(%r1) + lwzu %r10, 4(%r1) + lwzu %r9, 4(%r1) + lwzu %r8, 4(%r1) + lwzu %r7, 4(%r1) + lwzu %r6, 4(%r1) + lwzu %r5, 4(%r1) + lwzu %r4, 4(%r1) + lwzu %r3, 4(%r1) + + /* Stop here, before we overwrite r1, and continue with the floating point + registers first. */ + addi %r2, %r1, 16 /* skip r3-r0 */ + + /* f31-f0 */ + lfd %f31, 0(%r2) + lfdu %f30, 8(%r2) + lfdu %f29, 8(%r2) + lfdu %f28, 8(%r2) + lfdu %f27, 8(%r2) + lfdu %f26, 8(%r2) + lfdu %f25, 8(%r2) + lfdu %f24, 8(%r2) + lfdu %f23, 8(%r2) + lfdu %f22, 8(%r2) + lfdu %f21, 8(%r2) + lfdu %f20, 8(%r2) + lfdu %f19, 8(%r2) + lfdu %f18, 8(%r2) + lfdu %f17, 8(%r2) + lfdu %f16, 8(%r2) + lfdu %f15, 8(%r2) + lfdu %f14, 8(%r2) + lfdu %f13, 8(%r2) + lfdu %f12, 8(%r2) + lfdu %f11, 8(%r2) + lfdu %f10, 8(%r2) + lfdu %f9, 8(%r2) + lfdu %f8, 8(%r2) + lfdu %f7, 8(%r2) + lfdu %f6, 8(%r2) + lfdu %f5, 8(%r2) + lfdu %f4, 8(%r2) + lfdu %f3, 8(%r2) + lfdu %f2, 8(%r2) + lfdu %f1, 8(%r2) + lfd %f0, 8(%r2) + + /* r2-r0 */ + lwzu %r2, 4(%r1) + lwz %r0, 8(%r1) + lwz %r1, 4(%r1) + + /* return from interrupt */ + rfi diff --git a/src/system/kernel/arch/ppc/arch_platform.cpp b/src/system/kernel/arch/ppc/arch_platform.cpp index 2e2d95ffd0..5ed32287c1 100644 --- a/src/system/kernel/arch/ppc/arch_platform.cpp +++ b/src/system/kernel/arch/ppc/arch_platform.cpp @@ -9,12 +9,17 @@ #include +#include #include #include #include #include +// TODO: declare this in some header +extern void *gFDT; +extern "C" DebugUART *debug_uart_from_fdt(const void *fdt); + static PPCPlatform *sPPCPlatform; @@ -225,18 +230,149 @@ PPCOpenFirmware::ShutDown(bool reboot) } +// #pragma mark - U-Boot + FDT + + +namespace BPrivate { + +class PPCUBoot : public PPCPlatform { +public: + PPCUBoot(); + virtual ~PPCUBoot(); + + virtual status_t Init(struct kernel_args *kernelArgs); + virtual status_t InitSerialDebug(struct kernel_args *kernelArgs); + virtual status_t InitPostVM(struct kernel_args *kernelArgs); + virtual status_t InitRTC(struct kernel_args *kernelArgs, + struct real_time_data *data); + + virtual char SerialDebugGetChar(); + virtual void SerialDebugPutChar(char c); + + virtual void SetHardwareRTC(uint32 seconds); + virtual uint32 GetHardwareRTC(); + + virtual void ShutDown(bool reboot); + +private: + int fInput; + int fOutput; + int fRTC; + DebugUART *fDebugUART; +}; + +} // namespace BPrivate + +using BPrivate::PPCUBoot; + + +// constructor +PPCUBoot::PPCUBoot() + : PPCPlatform(PPC_PLATFORM_U_BOOT), + fInput(-1), + fOutput(-1), + fRTC(-1), + fDebugUART(NULL) +{ +} + +// destructor +PPCUBoot::~PPCUBoot() +{ +} + +// Init +status_t +PPCUBoot::Init(struct kernel_args *kernelArgs) +{ + gFDT = kernelArgs->platform_args.fdt; + // XXX: do we error out if no FDT? + return B_OK; +} + +// InitSerialDebug +status_t +PPCUBoot::InitSerialDebug(struct kernel_args *kernelArgs) +{ + fDebugUART = debug_uart_from_fdt(gFDT); + if (fDebugUART == NULL) + return B_ERROR; + return B_OK; +} + +// InitPostVM +status_t +PPCUBoot::InitPostVM(struct kernel_args *kernelArgs) +{ + return B_ERROR; +} + +// InitRTC +status_t +PPCUBoot::InitRTC(struct kernel_args *kernelArgs, + struct real_time_data *data) +{ + return B_ERROR; +} + +// DebugSerialGetChar +char +PPCUBoot::SerialDebugGetChar() +{ + if (fDebugUART) + return fDebugUART->GetChar(false); + return 0; +} + +// DebugSerialPutChar +void +PPCUBoot::SerialDebugPutChar(char c) +{ + if (fDebugUART) + fDebugUART->PutChar(c); +} + +// SetHardwareRTC +void +PPCUBoot::SetHardwareRTC(uint32 seconds) +{ +} + +// GetHardwareRTC +uint32 +PPCUBoot::GetHardwareRTC() +{ + return 0; +} + +// ShutDown +void +PPCUBoot::ShutDown(bool reboot) +{ +} + + // # pragma mark - +#define PLATFORM_BUFFER_SIZE MAX(sizeof(PPCOpenFirmware),sizeof(PPCUBoot)) // static buffer for constructing the actual PPCPlatform -static char *sPPCPlatformBuffer[sizeof(PPCOpenFirmware)]; +static char *sPPCPlatformBuffer[PLATFORM_BUFFER_SIZE]; status_t arch_platform_init(struct kernel_args *kernelArgs) { // only OpenFirmware supported for now - if (true) - sPPCPlatform = new(sPPCPlatformBuffer) PPCOpenFirmware; + switch (kernelArgs->arch_args.platform) { + case PPC_PLATFORM_OPEN_FIRMWARE: + sPPCPlatform = new(sPPCPlatformBuffer) PPCOpenFirmware; + break; + case PPC_PLATFORM_U_BOOT: + sPPCPlatform = new(sPPCPlatformBuffer) PPCUBoot; + break; + default: + return B_ERROR; + } return sPPCPlatform->Init(kernelArgs); } diff --git a/src/system/kernel/arch/x86/32/thread.cpp b/src/system/kernel/arch/x86/32/thread.cpp index 66465c2951..7bed6a0f4d 100644 --- a/src/system/kernel/arch/x86/32/thread.cpp +++ b/src/system/kernel/arch/x86/32/thread.cpp @@ -110,6 +110,15 @@ x86_set_tls_context(Thread *thread) } +static addr_t +arch_randomize_stack_pointer(addr_t value) +{ + STATIC_ASSERT(MAX_RANDOM_VALUE >= B_PAGE_SIZE - 1); + value -= random_value() & (B_PAGE_SIZE - 1); + return value & ~addr_t(0xf); +} + + static uint8* get_signal_stack(Thread* thread, struct iframe* frame, struct sigaction* action) { @@ -119,7 +128,8 @@ get_signal_stack(Thread* thread, struct iframe* frame, struct sigaction* action) && (frame->user_sp < thread->signal_stack_base || frame->user_sp >= thread->signal_stack_base + thread->signal_stack_size)) { - return (uint8*)(thread->signal_stack_base + thread->signal_stack_size); + addr_t stackTop = thread->signal_stack_base + thread->signal_stack_size; + return (uint8*)arch_randomize_stack_pointer(stackTop); } return (uint8*)frame->user_sp; @@ -202,15 +212,6 @@ arch_thread_dump_info(void *info) } -static addr_t -arch_randomize_stack_pointer(addr_t value) -{ - STATIC_ASSERT(MAX_RANDOM_VALUE >= B_PAGE_SIZE - 1); - value -= random_value() & (B_PAGE_SIZE - 1); - return value & ~addr_t(0xf); -} - - /*! Sets up initial thread context and enters user space */ status_t diff --git a/src/system/kernel/arch/x86/64/thread.cpp b/src/system/kernel/arch/x86/64/thread.cpp index e1a337fe3c..59db5028e4 100644 --- a/src/system/kernel/arch/x86/64/thread.cpp +++ b/src/system/kernel/arch/x86/64/thread.cpp @@ -95,6 +95,15 @@ x86_set_tls_context(Thread* thread) } +static addr_t +arch_randomize_stack_pointer(addr_t value) +{ + STATIC_ASSERT(MAX_RANDOM_VALUE >= B_PAGE_SIZE - 1); + value -= random_value() & (B_PAGE_SIZE - 1); + return value & ~addr_t(0xf); +} + + static uint8* get_signal_stack(Thread* thread, iframe* frame, struct sigaction* action) { @@ -104,7 +113,8 @@ get_signal_stack(Thread* thread, iframe* frame, struct sigaction* action) && (frame->user_sp < thread->signal_stack_base || frame->user_sp >= thread->signal_stack_base + thread->signal_stack_size)) { - return (uint8*)(thread->signal_stack_base + thread->signal_stack_size); + addr_t stackTop = thread->signal_stack_base + thread->signal_stack_size; + return (uint8*)arch_randomize_stack_pointer(stackTop); } // We are going to use the stack that we are already on. We must not touch @@ -198,15 +208,6 @@ arch_thread_dump_info(void* info) } -static addr_t -arch_randomize_stack_pointer(addr_t value) -{ - STATIC_ASSERT(MAX_RANDOM_VALUE >= B_PAGE_SIZE - 1); - value -= random_value() & (B_PAGE_SIZE - 1); - return value & ~addr_t(0xf); -} - - /*! Sets up initial thread context and enters user space */ status_t diff --git a/src/system/kernel/platform/u-boot/Jamfile b/src/system/kernel/platform/u-boot/Jamfile index d29857ba59..dbadd8cbcb 100644 --- a/src/system/kernel/platform/u-boot/Jamfile +++ b/src/system/kernel/platform/u-boot/Jamfile @@ -3,6 +3,24 @@ SubDir HAIKU_TOP src system kernel platform u-boot ; SubDirCcFlags $(TARGET_KERNEL_PIC_CCFLAGS) ; SubDirC++Flags $(TARGET_KERNEL_PIC_CCFLAGS) ; +UseLibraryHeaders [ FDirName libfdt ] ; + +local libFDTSources = + fdt.c + fdt_ro.c + fdt_rw.c + fdt_strerror.c + fdt_sw.c + fdt_wip.c +; + KernelMergeObject kernel_platform_u-boot.o : platform.cpp + fdt_support.cpp + openfirmware.cpp + $(libFDTSources) ; + +SEARCH on [ FGristFiles $(libFDTSources) ] + = [ FDirName $(HAIKU_TOP) src libs libfdt ] ; + diff --git a/src/system/boot/platform/u-boot/fdt_support.cpp b/src/system/kernel/platform/u-boot/fdt_support.cpp similarity index 52% rename from src/system/boot/platform/u-boot/fdt_support.cpp rename to src/system/kernel/platform/u-boot/fdt_support.cpp index d0ac350ae8..63e92dc3dd 100644 --- a/src/system/boot/platform/u-boot/fdt_support.cpp +++ b/src/system/kernel/platform/u-boot/fdt_support.cpp @@ -9,14 +9,22 @@ #include #include +#include +#include + extern "C" { #include #include #include }; +#ifndef _BOOT_MODE +/* the bootloader has it in asm code to avoid it ending up in .bss */ +void *gFDT; +#endif extern "C" void dump_fdt(const void *fdt); +extern "C" DebugUART *debug_uart_from_fdt(const void *fdt); //#define FDT_DUMP_NODES //#define FDT_DUMP_PROPS @@ -61,7 +69,7 @@ void dump_fdt(const void *fdt) int err; dprintf("FDT @ %p:\n", fdt); - + if (!fdt) return; @@ -113,3 +121,84 @@ void dump_fdt(const void *fdt) } +DebugUART * +debug_uart_from_fdt(const void *fdt) +{ + const char *name; + const char *type; + int node; + int len; + phys_addr_t regs; + int32 clock = 0; + int32 speed = 0; + const void *prop; + DebugUART *uart = NULL; + + if (fdt == NULL) + return NULL; + + name = fdt_get_alias(fdt, "serial"); + if (name == NULL) + name = fdt_get_alias(fdt, "serial0"); + if (name == NULL) + name = fdt_get_alias(fdt, "serial1"); + // TODO: else use /chosen linux,stdout-path + if (name == NULL) + return NULL; + + node = fdt_path_offset(fdt, name); + //dprintf("serial: using '%s', node %d\n", name, node); + if (node < 0) + return NULL; + + type = (const char *)fdt_getprop(fdt, node, "device_type", &len); + //dprintf("serial: type: '%s'\n", type); + if (type == NULL || strcmp(type, "serial")) + return NULL; + + // determine the MMIO address + // TODO: ppc460 use 64bit addressing, but U-Boot seems to map it below 4G, + // and the FDT is not very clear. libfdt is also getting 64bit addr support. + // so FIXME someday. + prop = fdt_getprop(fdt, node, "virtual-reg", &len); + if (prop && len == 4) { + regs = fdt32_to_cpu(*(uint32_t *)prop); + //dprintf("serial: virtual-reg 0x%08llx\n", (int64)regs); + } else { + prop = fdt_getprop(fdt, node, "reg", &len); + if (prop && len >= 4) { + regs = fdt32_to_cpu(*(uint32_t *)prop); + //dprintf("serial: reg 0x%08llx\n", (int64)regs); + } else + return NULL; + } + + // get the UART clock rate + prop = fdt_getprop(fdt, node, "clock-frequency", &len); + if (prop && len == 4) { + clock = fdt32_to_cpu(*(uint32_t *)prop); + //dprintf("serial: clock %ld\n", clock); + } + + // get current speed (XXX: not yet passed over) + prop = fdt_getprop(fdt, node, "current-speed", &len); + if (prop && len == 4) { + speed = fdt32_to_cpu(*(uint32_t *)prop); + //dprintf("serial: speed %ld\n", speed); + } + + if (fdt_node_check_compatible(fdt, node, "ns16550a") == 1 + || fdt_node_check_compatible(fdt, node, "ns16550") == 1) { + uart = arch_get_uart_8250(regs, clock); + //dprintf("serial: using 8250\n"); + // XXX:assume speed is already set + (void)speed; + } else { + // TODO: handle more UART types + // for when we can use U-Boot's console + panic("Unknown UART type %s", type); + } + + return uart; +} + diff --git a/src/system/kernel/platform/u-boot/openfirmware.cpp b/src/system/kernel/platform/u-boot/openfirmware.cpp new file mode 100644 index 0000000000..5fb8f2c624 --- /dev/null +++ b/src/system/kernel/platform/u-boot/openfirmware.cpp @@ -0,0 +1,344 @@ +/* + * Copyright 2003, Axel Dörfler, axeld@pinc-software.de. All rights reserved. + * Distributed under the terms of the MIT License. + */ + +#include +#include + +#include +#include + +extern "C" { +#include +#include +#include +}; + +#define TRACE_OF +#ifdef TRACE_OF +# define TRACE(x) dprintf x +#else +# define TRACE(x) ; +#endif + + +// FIXME: HACK: until we support multiple platforms at once in the kernel. + +extern void *gFDT; +int gChosen; + + +static int fdt2of(int err) +{ + if (err >= 0) + return err; + switch (err) { + case -FDT_ERR_NOTFOUND: + case -FDT_ERR_EXISTS: + case -FDT_ERR_NOSPACE: + case -FDT_ERR_BADOFFSET: + case -FDT_ERR_BADPATH: + case -FDT_ERR_BADPHANDLE: + case -FDT_ERR_BADSTATE: + case -FDT_ERR_TRUNCATED: + case -FDT_ERR_BADMAGIC: + case -FDT_ERR_BADVERSION: + case -FDT_ERR_BADSTRUCTURE: + case -FDT_ERR_BADLAYOUT: + case -FDT_ERR_INTERNAL: + default: + return OF_FAILED; + } +} + + +status_t +of_init(int (*openFirmwareEntry)(void *)) +{ + if (gFDT == NULL) + return OF_FAILED; + + gChosen = fdt2of(fdt_path_offset(gFDT, "/chosen")); + + if (gChosen == OF_FAILED) + return B_ERROR; + + return B_OK; +} + + +int +of_call_client_function(const char *method, int numArgs, int numReturns, ...) +{ + return OF_FAILED; +} + + +int +of_interpret(const char *command, int numArgs, int numReturns, ...) +{ + return OF_FAILED; +} + + +int +of_call_method(int handle, const char *method, int numArgs, int numReturns, ...) +{ + return OF_FAILED; +} + + +int +of_finddevice(const char *device) +{ + const char *name = device; + int node; + + if (device == NULL) + return OF_FAILED; + + if (device[0] != '/' && fdt_get_alias(gFDT, device)) + name = fdt_get_alias(gFDT, device); + + node = fdt_path_offset(gFDT, name); + TRACE(("of_finddevice('%s') name='%s' node=%d ret=%d\n", device, name, node, + fdt2of(node))); + return fdt2of(node); +} + + +status_t +of_get_next_device(int *_cookie, int root, const char *type, char *path, + size_t pathSize) +{ + int next; + int err; + + int startoffset = *_cookie ? *_cookie : -1; + + // iterate by property value + next = fdt_node_offset_by_prop_value(gFDT, startoffset, "device_type", + type, strlen(type) + 1); + TRACE(("of_get_next_device(c:%d, %d, '%s', %p, %zd) soffset=%d next=%d\n", + *_cookie, root, type, path, pathSize, startoffset, fdt2of(next))); + if (next < 0) + return B_ENTRY_NOT_FOUND; + + // make sure root is the parent + int parent = next; + while (root && parent) { + parent = fdt_parent_offset(gFDT, parent); + if (parent == root) + break; + if (parent <= 0) + return B_ENTRY_NOT_FOUND; + } + + *_cookie = next; + + err = fdt_get_path(gFDT, next, path, pathSize); + if (err < 0) + return B_ERROR; + + return B_OK; +} + + +/** Returns the first child of the given node + */ + +int +of_child(int node) +{ + return OF_FAILED; +} + + +/** Returns the next sibling of the given node + */ + +int +of_peer(int node) +{ + return OF_FAILED; +} + + +/** Returns the parent of the given node + */ + +int +of_parent(int node) +{ + return OF_FAILED; +} + + +int +of_instance_to_path(int instance, char *pathBuffer, int bufferSize) +{ + return OF_FAILED; +} + + +int +of_instance_to_package(int instance) +{ + return OF_FAILED; +} + + +int +of_getprop(int package, const char *property, void *buffer, int bufferSize) +{ + int oldSize = bufferSize; + const void *p = fdt_getprop(gFDT, package, property, &bufferSize); + + TRACE(("of_getprop(%d, '%s', , %d) =%p sz=%d ret=%d\n", package, property, + oldSize, p, bufferSize, fdt2of(bufferSize))); + + if (p == NULL) + return fdt2of(bufferSize); + + memcpy(buffer, p, bufferSize); + return bufferSize; +} + + +int +of_setprop(int package, const char *property, const void *buffer, int bufferSize) +{ + return OF_FAILED; +} + + +int +of_getproplen(int package, const char *property) +{ + return OF_FAILED; +} + + +int +of_nextprop(int package, const char *previousProperty, char *nextProperty) +{ + return OF_FAILED; +} + + +int +of_package_to_path(int package, char *pathBuffer, int bufferSize) +{ + return OF_FAILED; +} + + +/** given the package provided, get the number of cells ++ in the reg property ++ */ + +int32 +of_address_cells(int package) { + uint32 address_cells; + if (of_getprop(package, "#address-cells", + &address_cells, sizeof(address_cells)) == OF_FAILED) + return OF_FAILED; + + return address_cells; +} + + +int32 +of_size_cells(int package) { + uint32 size_cells; + if (of_getprop(package, "#size-cells", + &size_cells, sizeof(size_cells)) == OF_FAILED) + return OF_FAILED; + + return size_cells; +} + + +// I/O functions + + +int +of_open(const char *nodeName) +{ + return OF_FAILED; +} + + +void +of_close(int handle) +{ +} + + +int +of_read(int handle, void *buffer, int bufferSize) +{ + return OF_FAILED; +} + + +int +of_write(int handle, const void *buffer, int bufferSize) +{ + return OF_FAILED; +} + + +int +of_seek(int handle, long long pos) +{ + return OF_FAILED; +} + + +// memory functions + + +int +of_release(void *virtualAddress, int size) +{ + return OF_FAILED; +} + + +void * +of_claim(void *virtualAddress, int size, int align) +{ + return NULL; +} + + +// misc functions + + +/** tests if the given service is missing + */ + +int +of_test(const char *service) +{ + return OF_FAILED; +} + + +/** Returns the millisecond counter + */ + +int +of_milliseconds(void) +{ + return OF_FAILED; +} + + +void +of_exit(void) +{ +} + diff --git a/src/system/ldscripts/ppc/kernel.ld b/src/system/ldscripts/ppc/kernel.ld index 0814a0fb83..fbeb669074 100644 --- a/src/system/ldscripts/ppc/kernel.ld +++ b/src/system/ldscripts/ppc/kernel.ld @@ -91,6 +91,36 @@ SECTIONS _end = . ; + /* Stabs debugging sections. */ + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + /* DWARF debug sections. + Symbols in the DWARF debugging sections are relative to the beginning + of the section so we begin them at 0. */ + /* DWARF 1 */ + .debug 0 : { *(.debug) } + .line 0 : { *(.line) } + /* GNU DWARF 1 extensions */ + .debug_srcinfo 0 : { *(.debug_srcinfo) } + .debug_sfnames 0 : { *(.debug_sfnames) } + /* DWARF 1.1 and DWARF 2 */ + .debug_aranges 0 : { *(.debug_aranges) } + .debug_pubnames 0 : { *(.debug_pubnames) } + /* DWARF 2 */ + .debug_info 0 : { *(.debug_info) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_line 0 : { *(.debug_line) } + .debug_frame 0 : { *(.debug_frame) } + .debug_str 0 : { *(.debug_str) } + .debug_loc 0 : { *(.debug_loc) } + .debug_macinfo 0 : { *(.debug_macinfo) } + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } + /* These must appear regardless of . */ + /* Strip unnecessary stuff */ /DISCARD/ : { *(.comment .note .eh_frame .dtors .debug_*) } diff --git a/src/system/libroot/os/arch/arm/atomic.S b/src/system/libroot/os/arch/arm/atomic.S index 795e89961d..f27bfd7223 100644 --- a/src/system/libroot/os/arch/arm/atomic.S +++ b/src/system/libroot/os/arch/arm/atomic.S @@ -4,14 +4,15 @@ */ #include - +#include .text +#ifndef ATOMIC_FUNCS_ARE_SYSCALLS + /* int atomic_add(int *value, int increment) */ FUNCTION(atomic_add): -#if __ARM_ARCH__ >= 6 miss1: ldrex r12, [r0] add r2, r12, r1 strex r3, r2, [r0] @@ -19,25 +20,6 @@ miss1: ldrex r12, [r0] bne miss1 mov r0, r12 bx lr -#else - /* disable interrupts, do the add, and reenable */ - mrs r2, cpsr - mov r12, r2 - orr r2, r2, #(3<<6) - msr cpsr_c, r2 - - /* ints disabled, old cpsr state in r12 */ - - /* do the add, leave the previous value in r0 */ - mov r3, r0 - ldr r0, [r3] - add r2, r0, r1 - str r2, [r3] - - /* restore interrupts and exit */ - msr cpsr_c, r12 - bx lr -#endif FUNCTION_END(atomic_add) @@ -46,7 +28,6 @@ FUNCTION_END(atomic_add) /* int atomic_and(int *value, int andValue) */ FUNCTION(atomic_and): -#if __ARM_ARCH__ >= 6 miss2: ldrex r12, [r0] and r2, r12, r1 strex r3, r2, [r0] @@ -54,33 +35,11 @@ miss2: ldrex r12, [r0] bne miss2 mov r0, r12 bx lr -#else - /* disable interrupts, do the and, and reenable */ - mrs r2, cpsr - mov r12, r2 - orr r2, r2, #(3<<6) - msr cpsr_c, r2 - - /* ints disabled, old cpsr state in r12 */ - - /* do the and, leave the previous value in r0 */ - mov r3, r0 - ldr r0, [r3] - and r2, r0, r1 - str r2, [r3] - - /* restore interrupts and exit */ - msr cpsr_c, r12 - bx lr -#endif - FUNCTION_END(atomic_and) /* int atomic_or(int *value, int orValue) */ FUNCTION(atomic_or): -#if __ARM_ARCH__ >= 6 - miss3: ldrex r12, [r0] eor r2, r12, r1 strex r3, r2, [r0] @@ -88,48 +47,21 @@ miss3: ldrex r12, [r0] bne miss3 mov r0, r12 bx lr -#else - /* disable interrupts, do the or, and reenable */ - mrs r2, cpsr - mov r12, r2 - orr r2, r2, #(3<<6) - msr cpsr_c, r2 - - /* ints disabled, old cpsr state in r12 */ - - /* do the or, leave the previous value in r0 */ - mov r3, r0 - ldr r0, [r3] - orr r2, r0, r1 - str r2, [r3] - - /* restore interrupts and exit */ - msr cpsr_c, r12 - bx lr -#endif - FUNCTION_END(atomic_or) /* int atomic_set(int *value, int setTo) */ FUNCTION(atomic_set): -#if __ARM_ARCH__ >= 6 miss4: ldrex r12, [r0] strex r3, r1, [r0] teq r3, #0 bne miss4 bx lr -#else - mov r3, r0 - swp r0, r1, [r3] - bx lr -#endif FUNCTION_END(atomic_set) /* int atomic_test_and_set(int *value, int setTo, int testValue) */ FUNCTION(atomic_test_and_set): -#if __ARM_ARCH__ >= 6 miss5: ldrex r12, [r0] @ load from the address and mark it exclusive cmp r12, r2 @ compare the value with the comperand(r2) strexeq r3, r1, [r0] @ if they were equal, attempt to store the new value (r1) @@ -139,21 +71,6 @@ miss5: ldrex r12, [r0] @ load from the address and bne same @ if it succeeded, jump to (same) and return. there is no need to clrex if strex succeeded differ: clrex @ clrex same: mov r0, r12 -#else - /* disable interrupts, and save state */ - mrs r3, cpsr - mov r12, r3 - orr r3, r3, #(3<<6) - msr cpsr_c, r3 - - mov r3, r0 - ldr r0, [r3] - cmp r0, r2 - streq r1, [r3] - - /* restore interrupts and exit */ - msr cpsr_c, r12 -#endif bx lr FUNCTION_END(atomic_test_and_set) @@ -168,6 +85,10 @@ FUNCTION(__sync_fetch_and_add_4): bx lr FUNCTION_END(__sync_fetch_and_add_4) +#endif + +#ifndef ATOMIC64_FUNCS_ARE_SYSCALLS + /* int64 atomic_add64(vint64 *value, int64 addValue) */ FUNCTION(atomic_add64): bx lr @@ -197,3 +118,5 @@ FUNCTION_END(atomic_test_and_set64) FUNCTION(atomic_get64): bx lr FUNCTION_END(atomic_get64) + +#endif /* ATOMIC64_FUNCS_ARE_SYSCALLS */ diff --git a/src/system/libroot/os/thread.c b/src/system/libroot/os/thread.c index 41721453d3..0f14f29d9d 100644 --- a/src/system/libroot/os/thread.c +++ b/src/system/libroot/os/thread.c @@ -110,6 +110,7 @@ spawn_thread(thread_func entry, const char *name, int32 priority, void *data) __pthread_init_creation_attributes(NULL, thread, &thread_entry, entry, thread, name, &attributes); + thread->flags |= THREAD_DETACHED; attributes.priority = priority; @@ -256,4 +257,3 @@ snooze_until(bigtime_t timeout, int timeBase) { return _kern_snooze_etc(timeout, timeBase, B_ABSOLUTE_TIMEOUT, NULL); } - diff --git a/src/system/libroot/posix/arch/arm/siglongjmp.S b/src/system/libroot/posix/arch/arm/siglongjmp.S index 07fe6fd06a..9101e23bb8 100644 --- a/src/system/libroot/posix/arch/arm/siglongjmp.S +++ b/src/system/libroot/posix/arch/arm/siglongjmp.S @@ -5,16 +5,13 @@ #include -//#include "setjmp_internal.h" - /* int __siglongjmp(jmp_buf buffer, int value) */ FUNCTION(siglongjmp): FUNCTION(longjmp): FUNCTION(_longjmp): - str r1,[r0] - ldmia r0,{r0-r14} - bx lr -// bl __longjmp_return + str r1, [r0, #4] + ldmia r0, {r0-r14} + b __longjmp_return FUNCTION_END(siglongjmp) FUNCTION_END(longjmp) FUNCTION_END(_longjmp) diff --git a/src/system/libroot/posix/arch/arm/sigsetjmp.S b/src/system/libroot/posix/arch/arm/sigsetjmp.S index bf77eadf4e..74e046d87e 100644 --- a/src/system/libroot/posix/arch/arm/sigsetjmp.S +++ b/src/system/libroot/posix/arch/arm/sigsetjmp.S @@ -5,33 +5,25 @@ #include -//#include "setjmp_internal.h" - /* int sigsetjmp(jmp_buf buffer, int saveMask) */ FUNCTION(__sigsetjmp): FUNCTION(sigsetjmp): - stmdb sp!, {r4, lr} - stmia r0, {r0-r14} - str lr,[r0, #60] - mrs r1,cpsr - str r1,[r0,#64] - ldr r1,[r0,#4] - mov r0, #0 - - bl __setjmp_save_sigs - ldmia sp!, {r4, pc} -FUNCTION_END(__sigsetjmp) + stmia r0, {r0-r14} + mrs r1, cpsr + str r1, [r0, #64] + ldr r1, [r0, #4] + b __setjmp_save_sigs FUNCTION_END(sigsetjmp) +FUNCTION_END(__sigsetjmp) /* int setjmp(jmp_buf buffer) */ FUNCTION(setjmp): - stmia r0, {r0-r14} - str lr,[r0, #60] - mrs r1,cpsr - str r1,[r0,#64] - ldr r1,[r0,#4] - mov r0, #0 + stmia r0, {r0-r14} + mrs r1, cpsr + str r1, [r0, #64] + ldr r1, [r0, #4] + mov r0, #0 bx lr FUNCTION_END(setjmp)