···1919If the hash is incorrect, the kernel will inform you about this in "dmesg"2020upon module initialization, and tell you of the correct hash.21212222-You can determine the hash of the product ID strings by running2323-"pcmcia-modalias %n.%m" [%n being replaced with the socket number and %m being2424-replaced with the device function] from pcmciautils. It generates a string2222+You can determine the hash of the product ID strings by catting the file2323+"modalias" in the sysfs directory of the PCMCIA device. It generates a string2524in the following form:2625pcmcia:m0149cC1ABf06pfn00fn00pa725B842DpbF1EFEE84pc0877B627pd000000002726
+2
arch/alpha/kernel/irq_alpha.c
···5555#ifdef CONFIG_SMP5656 {5757 long cpu;5858+5959+ local_irq_disable();5860 smp_percpu_timer_interrupt(regs);5961 cpu = smp_processor_id();6062 if (cpu != boot_cpuid) {
+1-1
arch/alpha/kernel/traps.c
···240240 siginfo_t info;241241 int signo, code;242242243243- if (regs->ps == 0) {243243+ if ((regs->ps & ~IPL_MAX) == 0) {244244 if (type == 1) {245245 const unsigned int *data246246 = (const unsigned int *) regs->pc;
···11-#22-# Automatically generated make config: don't edit33-# Linux kernel version: 2.6.12-rc1-bk244-# Sun Mar 27 21:31:45 200555-#66-CONFIG_ARM=y77-CONFIG_MMU=y88-CONFIG_UID16=y99-CONFIG_RWSEM_GENERIC_SPINLOCK=y1010-CONFIG_GENERIC_CALIBRATE_DELAY=y1111-CONFIG_GENERIC_IOMAP=y1212-1313-#1414-# Code maturity level options1515-#1616-CONFIG_EXPERIMENTAL=y1717-CONFIG_CLEAN_COMPILE=y1818-CONFIG_BROKEN_ON_SMP=y1919-2020-#2121-# General setup2222-#2323-CONFIG_LOCALVERSION=""2424-CONFIG_SWAP=y2525-CONFIG_SYSVIPC=y2626-# CONFIG_POSIX_MQUEUE is not set2727-# CONFIG_BSD_PROCESS_ACCT is not set2828-CONFIG_SYSCTL=y2929-# CONFIG_AUDIT is not set3030-CONFIG_HOTPLUG=y3131-CONFIG_KOBJECT_UEVENT=y3232-# CONFIG_IKCONFIG is not set3333-# CONFIG_EMBEDDED is not set3434-CONFIG_KALLSYMS=y3535-# CONFIG_KALLSYMS_EXTRA_PASS is not set3636-CONFIG_BASE_FULL=y3737-CONFIG_FUTEX=y3838-CONFIG_EPOLL=y3939-CONFIG_CC_OPTIMIZE_FOR_SIZE=y4040-CONFIG_SHMEM=y4141-CONFIG_CC_ALIGN_FUNCTIONS=04242-CONFIG_CC_ALIGN_LABELS=04343-CONFIG_CC_ALIGN_LOOPS=04444-CONFIG_CC_ALIGN_JUMPS=04545-# CONFIG_TINY_SHMEM is not set4646-CONFIG_BASE_SMALL=04747-4848-#4949-# Loadable module support5050-#5151-CONFIG_MODULES=y5252-# CONFIG_MODULE_UNLOAD is not set5353-CONFIG_OBSOLETE_MODPARM=y5454-# CONFIG_MODVERSIONS is not set5555-# CONFIG_MODULE_SRCVERSION_ALL is not set5656-CONFIG_KMOD=y5757-5858-#5959-# System Type6060-#6161-# CONFIG_ARCH_CLPS7500 is not set6262-# CONFIG_ARCH_CLPS711X is not set6363-# CONFIG_ARCH_CO285 is not set6464-# CONFIG_ARCH_EBSA110 is not set6565-# CONFIG_ARCH_CAMELOT is not set6666-# CONFIG_ARCH_FOOTBRIDGE is not set6767-# CONFIG_ARCH_INTEGRATOR is not set6868-# CONFIG_ARCH_IOP3XX is not set6969-# CONFIG_ARCH_IXP4XX is not set7070-# CONFIG_ARCH_IXP2000 is not set7171-# CONFIG_ARCH_L7200 is not set7272-# CONFIG_ARCH_PXA is not set7373-# CONFIG_ARCH_RPC is not set7474-CONFIG_ARCH_SA1100=y7575-# CONFIG_ARCH_S3C2410 is not set7676-# CONFIG_ARCH_SHARK is not set7777-# CONFIG_ARCH_LH7A40X is not set7878-# CONFIG_ARCH_OMAP is not set7979-# CONFIG_ARCH_VERSATILE is not set8080-# CONFIG_ARCH_IMX is not set8181-# CONFIG_ARCH_H720X is not set8282-8383-#8484-# SA11x0 Implementations8585-#8686-# CONFIG_SA1100_ASSABET is not set8787-# CONFIG_SA1100_CERF is not set8888-# CONFIG_SA1100_COLLIE is not set8989-# CONFIG_SA1100_H3100 is not set9090-# CONFIG_SA1100_H3600 is not set9191-# CONFIG_SA1100_H3800 is not set9292-# CONFIG_SA1100_BADGE4 is not set9393-# CONFIG_SA1100_JORNADA720 is not set9494-# CONFIG_SA1100_HACKKIT is not set9595-# CONFIG_SA1100_LART is not set9696-# CONFIG_SA1100_PLEB is not set9797-# CONFIG_SA1100_SHANNON is not set9898-# CONFIG_SA1100_SIMPAD is not set9999-# CONFIG_SA1100_SSP is not set100100-101101-#102102-# Processor Type103103-#104104-CONFIG_CPU_32=y105105-CONFIG_CPU_SA1100=y106106-CONFIG_CPU_32v4=y107107-CONFIG_CPU_ABRT_EV4=y108108-CONFIG_CPU_CACHE_V4WB=y109109-CONFIG_CPU_CACHE_VIVT=y110110-CONFIG_CPU_TLB_V4WB=y111111-CONFIG_CPU_MINICACHE=y112112-113113-#114114-# Processor Features115115-#116116-117117-#118118-# Bus support119119-#120120-CONFIG_ISA=y121121-122122-#123123-# PCCARD (PCMCIA/CardBus) support124124-#125125-CONFIG_PCCARD=y126126-# CONFIG_PCMCIA_DEBUG is not set127127-CONFIG_PCMCIA=y128128-129129-#130130-# PC-card bridges131131-#132132-CONFIG_I82365=y133133-# CONFIG_TCIC is not set134134-CONFIG_PCMCIA_SA1100=y135135-CONFIG_PCCARD_NONSTATIC=y136136-137137-#138138-# Kernel Features139139-#140140-# CONFIG_PREEMPT is not set141141-CONFIG_DISCONTIGMEM=y142142-# CONFIG_LEDS is not set143143-CONFIG_ALIGNMENT_TRAP=y144144-145145-#146146-# Boot options147147-#148148-CONFIG_ZBOOT_ROM_TEXT=0x0149149-CONFIG_ZBOOT_ROM_BSS=0x0150150-CONFIG_CMDLINE="keepinitrd mem=16M root=/dev/ram ramdisk=8192 initrd=0xd0000000,4M"151151-# CONFIG_XIP_KERNEL is not set152152-153153-#154154-# CPU Frequency scaling155155-#156156-# CONFIG_CPU_FREQ is not set157157-158158-#159159-# Floating point emulation160160-#161161-162162-#163163-# At least one emulation must be selected164164-#165165-# CONFIG_FPE_NWFPE is not set166166-# CONFIG_FPE_FASTFPE is not set167167-168168-#169169-# Userspace binary formats170170-#171171-CONFIG_BINFMT_ELF=y172172-CONFIG_BINFMT_AOUT=y173173-# CONFIG_BINFMT_MISC is not set174174-# CONFIG_ARTHUR is not set175175-176176-#177177-# Power management options178178-#179179-# CONFIG_PM is not set180180-181181-#182182-# Device Drivers183183-#184184-185185-#186186-# Generic Driver Options187187-#188188-CONFIG_STANDALONE=y189189-CONFIG_PREVENT_FIRMWARE_BUILD=y190190-# CONFIG_FW_LOADER is not set191191-192192-#193193-# Memory Technology Devices (MTD)194194-#195195-# CONFIG_MTD is not set196196-197197-#198198-# Parallel port support199199-#200200-# CONFIG_PARPORT is not set201201-202202-#203203-# Plug and Play support204204-#205205-# CONFIG_PNP is not set206206-207207-#208208-# Block devices209209-#210210-# CONFIG_BLK_DEV_FD is not set211211-# CONFIG_BLK_DEV_XD is not set212212-# CONFIG_BLK_DEV_COW_COMMON is not set213213-CONFIG_BLK_DEV_LOOP=m214214-# CONFIG_BLK_DEV_CRYPTOLOOP is not set215215-CONFIG_BLK_DEV_NBD=m216216-# CONFIG_BLK_DEV_RAM is not set217217-CONFIG_BLK_DEV_RAM_COUNT=16218218-CONFIG_INITRAMFS_SOURCE=""219219-# CONFIG_CDROM_PKTCDVD is not set220220-221221-#222222-# IO Schedulers223223-#224224-CONFIG_IOSCHED_NOOP=y225225-CONFIG_IOSCHED_AS=y226226-CONFIG_IOSCHED_DEADLINE=y227227-CONFIG_IOSCHED_CFQ=y228228-# CONFIG_ATA_OVER_ETH is not set229229-230230-#231231-# ATA/ATAPI/MFM/RLL support232232-#233233-CONFIG_IDE=y234234-CONFIG_BLK_DEV_IDE=y235235-236236-#237237-# Please see Documentation/ide.txt for help/info on IDE drives238238-#239239-# CONFIG_BLK_DEV_IDE_SATA is not set240240-CONFIG_BLK_DEV_IDEDISK=y241241-# CONFIG_IDEDISK_MULTI_MODE is not set242242-# CONFIG_BLK_DEV_IDECS is not set243243-# CONFIG_BLK_DEV_IDECD is not set244244-# CONFIG_BLK_DEV_IDETAPE is not set245245-# CONFIG_BLK_DEV_IDEFLOPPY is not set246246-# CONFIG_IDE_TASK_IOCTL is not set247247-248248-#249249-# IDE chipset support/bugfixes250250-#251251-CONFIG_IDE_GENERIC=y252252-# CONFIG_IDE_ARM is not set253253-# CONFIG_IDE_CHIPSETS is not set254254-# CONFIG_BLK_DEV_IDEDMA is not set255255-# CONFIG_IDEDMA_AUTO is not set256256-# CONFIG_BLK_DEV_HD is not set257257-258258-#259259-# SCSI device support260260-#261261-# CONFIG_SCSI is not set262262-263263-#264264-# Multi-device support (RAID and LVM)265265-#266266-# CONFIG_MD is not set267267-268268-#269269-# Fusion MPT device support270270-#271271-272272-#273273-# IEEE 1394 (FireWire) support274274-#275275-276276-#277277-# I2O device support278278-#279279-280280-#281281-# Networking support282282-#283283-CONFIG_NET=y284284-285285-#286286-# Networking options287287-#288288-CONFIG_PACKET=y289289-CONFIG_PACKET_MMAP=y290290-# CONFIG_NETLINK_DEV is not set291291-CONFIG_UNIX=y292292-# CONFIG_NET_KEY is not set293293-CONFIG_INET=y294294-CONFIG_IP_MULTICAST=y295295-# CONFIG_IP_ADVANCED_ROUTER is not set296296-# CONFIG_IP_PNP is not set297297-# CONFIG_NET_IPIP is not set298298-# CONFIG_NET_IPGRE is not set299299-# CONFIG_IP_MROUTE is not set300300-# CONFIG_ARPD is not set301301-# CONFIG_SYN_COOKIES is not set302302-# CONFIG_INET_AH is not set303303-# CONFIG_INET_ESP is not set304304-# CONFIG_INET_IPCOMP is not set305305-# CONFIG_INET_TUNNEL is not set306306-CONFIG_IP_TCPDIAG=y307307-# CONFIG_IP_TCPDIAG_IPV6 is not set308308-309309-#310310-# IP: Virtual Server Configuration311311-#312312-# CONFIG_IP_VS is not set313313-# CONFIG_IPV6 is not set314314-CONFIG_NETFILTER=y315315-# CONFIG_NETFILTER_DEBUG is not set316316-317317-#318318-# IP: Netfilter Configuration319319-#320320-# CONFIG_IP_NF_CONNTRACK is not set321321-# CONFIG_IP_NF_CONNTRACK_MARK is not set322322-# CONFIG_IP_NF_QUEUE is not set323323-# CONFIG_IP_NF_IPTABLES is not set324324-# CONFIG_IP_NF_ARPTABLES is not set325325-326326-#327327-# SCTP Configuration (EXPERIMENTAL)328328-#329329-# CONFIG_IP_SCTP is not set330330-# CONFIG_ATM is not set331331-# CONFIG_BRIDGE is not set332332-# CONFIG_VLAN_8021Q is not set333333-# CONFIG_DECNET is not set334334-# CONFIG_LLC2 is not set335335-# CONFIG_IPX is not set336336-# CONFIG_ATALK is not set337337-# CONFIG_X25 is not set338338-# CONFIG_LAPB is not set339339-# CONFIG_NET_DIVERT is not set340340-# CONFIG_ECONET is not set341341-# CONFIG_WAN_ROUTER is not set342342-343343-#344344-# QoS and/or fair queueing345345-#346346-# CONFIG_NET_SCHED is not set347347-# CONFIG_NET_CLS_ROUTE is not set348348-349349-#350350-# Network testing351351-#352352-# CONFIG_NET_PKTGEN is not set353353-# CONFIG_NETPOLL is not set354354-# CONFIG_NET_POLL_CONTROLLER is not set355355-# CONFIG_HAMRADIO is not set356356-# CONFIG_IRDA is not set357357-# CONFIG_BT is not set358358-CONFIG_NETDEVICES=y359359-# CONFIG_DUMMY is not set360360-# CONFIG_BONDING is not set361361-# CONFIG_EQUALIZER is not set362362-# CONFIG_TUN is not set363363-364364-#365365-# ARCnet devices366366-#367367-# CONFIG_ARCNET is not set368368-369369-#370370-# Ethernet (10 or 100Mbit)371371-#372372-CONFIG_NET_ETHERNET=y373373-# CONFIG_MII is not set374374-# CONFIG_NET_VENDOR_3COM is not set375375-# CONFIG_LANCE is not set376376-# CONFIG_NET_VENDOR_SMC is not set377377-# CONFIG_SMC91X is not set378378-# CONFIG_NET_VENDOR_RACAL is not set379379-# CONFIG_AT1700 is not set380380-# CONFIG_DEPCA is not set381381-# CONFIG_HP100 is not set382382-# CONFIG_NET_ISA is not set383383-# CONFIG_NET_PCI is not set384384-# CONFIG_NET_POCKET is not set385385-386386-#387387-# Ethernet (1000 Mbit)388388-#389389-390390-#391391-# Ethernet (10000 Mbit)392392-#393393-394394-#395395-# Token Ring devices396396-#397397-# CONFIG_TR is not set398398-399399-#400400-# Wireless LAN (non-hamradio)401401-#402402-CONFIG_NET_RADIO=y403403-404404-#405405-# Obsolete Wireless cards support (pre-802.11)406406-#407407-# CONFIG_STRIP is not set408408-# CONFIG_ARLAN is not set409409-# CONFIG_WAVELAN is not set410410-CONFIG_PCMCIA_WAVELAN=y411411-# CONFIG_PCMCIA_NETWAVE is not set412412-413413-#414414-# Wireless 802.11 Frequency Hopping cards support415415-#416416-# CONFIG_PCMCIA_RAYCS is not set417417-418418-#419419-# Wireless 802.11b ISA/PCI cards support420420-#421421-# CONFIG_HERMES is not set422422-# CONFIG_ATMEL is not set423423-424424-#425425-# Wireless 802.11b Pcmcia/Cardbus cards support426426-#427427-CONFIG_AIRO_CS=y428428-CONFIG_PCMCIA_WL3501=y429429-CONFIG_NET_WIRELESS=y430430-431431-#432432-# PCMCIA network device support433433-#434434-CONFIG_NET_PCMCIA=y435435-CONFIG_PCMCIA_3C589=y436436-# CONFIG_PCMCIA_3C574 is not set437437-# CONFIG_PCMCIA_FMVJ18X is not set438438-CONFIG_PCMCIA_PCNET=y439439-# CONFIG_PCMCIA_NMCLAN is not set440440-# CONFIG_PCMCIA_SMC91C92 is not set441441-# CONFIG_PCMCIA_XIRC2PS is not set442442-# CONFIG_PCMCIA_AXNET is not set443443-444444-#445445-# Wan interfaces446446-#447447-# CONFIG_WAN is not set448448-# CONFIG_PPP is not set449449-# CONFIG_SLIP is not set450450-# CONFIG_SHAPER is not set451451-# CONFIG_NETCONSOLE is not set452452-453453-#454454-# ISDN subsystem455455-#456456-# CONFIG_ISDN is not set457457-458458-#459459-# Input device support460460-#461461-CONFIG_INPUT=y462462-463463-#464464-# Userland interfaces465465-#466466-CONFIG_INPUT_MOUSEDEV=y467467-CONFIG_INPUT_MOUSEDEV_PSAUX=y468468-CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024469469-CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768470470-# CONFIG_INPUT_JOYDEV is not set471471-# CONFIG_INPUT_TSDEV is not set472472-# CONFIG_INPUT_EVDEV is not set473473-# CONFIG_INPUT_EVBUG is not set474474-475475-#476476-# Input Device Drivers477477-#478478-CONFIG_INPUT_KEYBOARD=y479479-CONFIG_KEYBOARD_ATKBD=y480480-# CONFIG_KEYBOARD_SUNKBD is not set481481-# CONFIG_KEYBOARD_LKKBD is not set482482-# CONFIG_KEYBOARD_XTKBD is not set483483-# CONFIG_KEYBOARD_NEWTON is not set484484-CONFIG_INPUT_MOUSE=y485485-CONFIG_MOUSE_PS2=y486486-# CONFIG_MOUSE_SERIAL is not set487487-# CONFIG_MOUSE_INPORT is not set488488-# CONFIG_MOUSE_LOGIBM is not set489489-# CONFIG_MOUSE_PC110PAD is not set490490-# CONFIG_MOUSE_VSXXXAA is not set491491-# CONFIG_INPUT_JOYSTICK is not set492492-# CONFIG_INPUT_TOUCHSCREEN is not set493493-# CONFIG_INPUT_MISC is not set494494-495495-#496496-# Hardware I/O ports497497-#498498-CONFIG_SERIO=y499499-CONFIG_SERIO_SERPORT=y500500-CONFIG_SERIO_LIBPS2=y501501-# CONFIG_SERIO_RAW is not set502502-# CONFIG_GAMEPORT is not set503503-CONFIG_SOUND_GAMEPORT=y504504-505505-#506506-# Character devices507507-#508508-CONFIG_VT=y509509-CONFIG_VT_CONSOLE=y510510-CONFIG_HW_CONSOLE=y511511-# CONFIG_SERIAL_NONSTANDARD is not set512512-513513-#514514-# Serial drivers515515-#516516-# CONFIG_SERIAL_8250 is not set517517-518518-#519519-# Non-8250 serial port support520520-#521521-CONFIG_SERIAL_SA1100=y522522-CONFIG_SERIAL_SA1100_CONSOLE=y523523-CONFIG_SERIAL_CORE=y524524-CONFIG_SERIAL_CORE_CONSOLE=y525525-CONFIG_UNIX98_PTYS=y526526-CONFIG_LEGACY_PTYS=y527527-CONFIG_LEGACY_PTY_COUNT=256528528-529529-#530530-# IPMI531531-#532532-# CONFIG_IPMI_HANDLER is not set533533-534534-#535535-# Watchdog Cards536536-#537537-# CONFIG_WATCHDOG is not set538538-# CONFIG_NVRAM is not set539539-# CONFIG_RTC is not set540540-# CONFIG_DTLK is not set541541-# CONFIG_R3964 is not set542542-543543-#544544-# Ftape, the floppy tape device driver545545-#546546-# CONFIG_DRM is not set547547-548548-#549549-# PCMCIA character devices550550-#551551-# CONFIG_SYNCLINK_CS is not set552552-# CONFIG_RAW_DRIVER is not set553553-554554-#555555-# TPM devices556556-#557557-# CONFIG_TCG_TPM is not set558558-559559-#560560-# I2C support561561-#562562-# CONFIG_I2C is not set563563-564564-#565565-# Misc devices566566-#567567-568568-#569569-# Multimedia devices570570-#571571-# CONFIG_VIDEO_DEV is not set572572-573573-#574574-# Digital Video Broadcasting Devices575575-#576576-# CONFIG_DVB is not set577577-578578-#579579-# Graphics support580580-#581581-CONFIG_FB=y582582-CONFIG_FB_CFB_FILLRECT=y583583-CONFIG_FB_CFB_COPYAREA=y584584-CONFIG_FB_CFB_IMAGEBLIT=y585585-CONFIG_FB_SOFT_CURSOR=y586586-# CONFIG_FB_MODE_HELPERS is not set587587-# CONFIG_FB_TILEBLITTING is not set588588-CONFIG_FB_SA1100=y589589-# CONFIG_FB_VIRTUAL is not set590590-591591-#592592-# Console display driver support593593-#594594-# CONFIG_VGA_CONSOLE is not set595595-# CONFIG_MDA_CONSOLE is not set596596-CONFIG_DUMMY_CONSOLE=y597597-CONFIG_FRAMEBUFFER_CONSOLE=y598598-CONFIG_FONTS=y599599-CONFIG_FONT_8x8=y600600-# CONFIG_FONT_8x16 is not set601601-# CONFIG_FONT_6x11 is not set602602-# CONFIG_FONT_PEARL_8x8 is not set603603-# CONFIG_FONT_ACORN_8x8 is not set604604-# CONFIG_FONT_MINI_4x6 is not set605605-# CONFIG_FONT_SUN8x16 is not set606606-# CONFIG_FONT_SUN12x22 is not set607607-608608-#609609-# Logo configuration610610-#611611-# CONFIG_LOGO is not set612612-# CONFIG_BACKLIGHT_LCD_SUPPORT is not set613613-614614-#615615-# Sound616616-#617617-# CONFIG_SOUND is not set618618-619619-#620620-# USB support621621-#622622-CONFIG_USB_ARCH_HAS_HCD=y623623-# CONFIG_USB_ARCH_HAS_OHCI is not set624624-# CONFIG_USB is not set625625-626626-#627627-# USB Gadget Support628628-#629629-# CONFIG_USB_GADGET is not set630630-631631-#632632-# MMC/SD Card support633633-#634634-# CONFIG_MMC is not set635635-636636-#637637-# File systems638638-#639639-CONFIG_EXT2_FS=y640640-# CONFIG_EXT2_FS_XATTR is not set641641-# CONFIG_EXT3_FS is not set642642-# CONFIG_JBD is not set643643-# CONFIG_REISERFS_FS is not set644644-# CONFIG_JFS_FS is not set645645-646646-#647647-# XFS support648648-#649649-# CONFIG_XFS_FS is not set650650-# CONFIG_MINIX_FS is not set651651-# CONFIG_ROMFS_FS is not set652652-# CONFIG_QUOTA is not set653653-CONFIG_DNOTIFY=y654654-# CONFIG_AUTOFS_FS is not set655655-# CONFIG_AUTOFS4_FS is not set656656-657657-#658658-# CD-ROM/DVD Filesystems659659-#660660-# CONFIG_ISO9660_FS is not set661661-# CONFIG_UDF_FS is not set662662-663663-#664664-# DOS/FAT/NT Filesystems665665-#666666-CONFIG_FAT_FS=y667667-CONFIG_MSDOS_FS=y668668-# CONFIG_VFAT_FS is not set669669-CONFIG_FAT_DEFAULT_CODEPAGE=437670670-# CONFIG_NTFS_FS is not set671671-672672-#673673-# Pseudo filesystems674674-#675675-CONFIG_PROC_FS=y676676-CONFIG_SYSFS=y677677-# CONFIG_DEVFS_FS is not set678678-# CONFIG_DEVPTS_FS_XATTR is not set679679-# CONFIG_TMPFS is not set680680-# CONFIG_HUGETLB_PAGE is not set681681-CONFIG_RAMFS=y682682-683683-#684684-# Miscellaneous filesystems685685-#686686-# CONFIG_ADFS_FS is not set687687-# CONFIG_AFFS_FS is not set688688-# CONFIG_HFS_FS is not set689689-# CONFIG_HFSPLUS_FS is not set690690-# CONFIG_BEFS_FS is not set691691-# CONFIG_BFS_FS is not set692692-# CONFIG_EFS_FS is not set693693-# CONFIG_CRAMFS is not set694694-# CONFIG_VXFS_FS is not set695695-# CONFIG_HPFS_FS is not set696696-# CONFIG_QNX4FS_FS is not set697697-# CONFIG_SYSV_FS is not set698698-# CONFIG_UFS_FS is not set699699-700700-#701701-# Network File Systems702702-#703703-CONFIG_NFS_FS=y704704-# CONFIG_NFS_V3 is not set705705-# CONFIG_NFS_V4 is not set706706-# CONFIG_NFS_DIRECTIO is not set707707-# CONFIG_NFSD is not set708708-CONFIG_LOCKD=y709709-CONFIG_SUNRPC=y710710-# CONFIG_RPCSEC_GSS_KRB5 is not set711711-# CONFIG_RPCSEC_GSS_SPKM3 is not set712712-# CONFIG_SMB_FS is not set713713-# CONFIG_CIFS is not set714714-# CONFIG_NCP_FS is not set715715-# CONFIG_CODA_FS is not set716716-# CONFIG_AFS_FS is not set717717-718718-#719719-# Partition Types720720-#721721-# CONFIG_PARTITION_ADVANCED is not set722722-CONFIG_MSDOS_PARTITION=y723723-724724-#725725-# Native Language Support726726-#727727-CONFIG_NLS=y728728-CONFIG_NLS_DEFAULT="iso8859-1"729729-# CONFIG_NLS_CODEPAGE_437 is not set730730-# CONFIG_NLS_CODEPAGE_737 is not set731731-# CONFIG_NLS_CODEPAGE_775 is not set732732-# CONFIG_NLS_CODEPAGE_850 is not set733733-# CONFIG_NLS_CODEPAGE_852 is not set734734-# CONFIG_NLS_CODEPAGE_855 is not set735735-# CONFIG_NLS_CODEPAGE_857 is not set736736-# CONFIG_NLS_CODEPAGE_860 is not set737737-# CONFIG_NLS_CODEPAGE_861 is not set738738-# CONFIG_NLS_CODEPAGE_862 is not set739739-# CONFIG_NLS_CODEPAGE_863 is not set740740-# CONFIG_NLS_CODEPAGE_864 is not set741741-# CONFIG_NLS_CODEPAGE_865 is not set742742-# CONFIG_NLS_CODEPAGE_866 is not set743743-# CONFIG_NLS_CODEPAGE_869 is not set744744-# CONFIG_NLS_CODEPAGE_936 is not set745745-# CONFIG_NLS_CODEPAGE_950 is not set746746-# CONFIG_NLS_CODEPAGE_932 is not set747747-# CONFIG_NLS_CODEPAGE_949 is not set748748-# CONFIG_NLS_CODEPAGE_874 is not set749749-# CONFIG_NLS_ISO8859_8 is not set750750-# CONFIG_NLS_CODEPAGE_1250 is not set751751-# CONFIG_NLS_CODEPAGE_1251 is not set752752-# CONFIG_NLS_ASCII is not set753753-# CONFIG_NLS_ISO8859_1 is not set754754-# CONFIG_NLS_ISO8859_2 is not set755755-# CONFIG_NLS_ISO8859_3 is not set756756-# CONFIG_NLS_ISO8859_4 is not set757757-# CONFIG_NLS_ISO8859_5 is not set758758-# CONFIG_NLS_ISO8859_6 is not set759759-# CONFIG_NLS_ISO8859_7 is not set760760-# CONFIG_NLS_ISO8859_9 is not set761761-# CONFIG_NLS_ISO8859_13 is not set762762-# CONFIG_NLS_ISO8859_14 is not set763763-# CONFIG_NLS_ISO8859_15 is not set764764-# CONFIG_NLS_KOI8_R is not set765765-# CONFIG_NLS_KOI8_U is not set766766-# CONFIG_NLS_UTF8 is not set767767-768768-#769769-# Profiling support770770-#771771-# CONFIG_PROFILING is not set772772-773773-#774774-# Kernel hacking775775-#776776-# CONFIG_PRINTK_TIME is not set777777-# CONFIG_DEBUG_KERNEL is not set778778-CONFIG_LOG_BUF_SHIFT=14779779-CONFIG_DEBUG_BUGVERBOSE=y780780-CONFIG_FRAME_POINTER=y781781-# CONFIG_DEBUG_USER is not set782782-783783-#784784-# Security options785785-#786786-# CONFIG_KEYS is not set787787-# CONFIG_SECURITY is not set788788-789789-#790790-# Cryptographic options791791-#792792-# CONFIG_CRYPTO is not set793793-794794-#795795-# Hardware crypto devices796796-#797797-798798-#799799-# Library routines800800-#801801-# CONFIG_CRC_CCITT is not set802802-CONFIG_CRC32=y803803-# CONFIG_LIBCRC32C is not set
+8-12
arch/arm/kernel/head.S
···344344 str r6, [r0]345345#endif346346347347+#ifdef CONFIG_DEBUG_LL347348 bic r7, r7, #0x0c @ turn off cacheable348349 @ and bufferable bits349349-#ifdef CONFIG_DEBUG_LL350350 /*351351 * Map in IO space for serial debugging.352352 * This allows debug messages to be output···372372 teq r1, #MACH_TYPE_NETWINDER373373 teqne r1, #MACH_TYPE_CATS374374 bne 1f375375- add r0, r4, #0x3fc0 @ ff000000376376- mov r3, #0x7c000000377377- orr r3, r3, r7378378- str r3, [r0], #4379379- add r3, r3, #1 << 20380380- str r3, [r0], #4375375+ add r0, r4, #0xff000000 >> 18376376+ orr r3, r7, #0x7c000000377377+ str r3, [r0]3813781:382382-#endif383379#endif384380#ifdef CONFIG_ARCH_RPC385381 /*···383387 * Similar reasons here - for debug. This is384388 * only for Acorn RiscPC architectures.385389 */386386- add r0, r4, #0x80 @ 02000000387387- mov r3, #0x02000000388388- orr r3, r3, r7390390+ add r0, r4, #0x02000000 >> 18391391+ orr r3, r7, #0x02000000389392 str r3, [r0]390390- add r0, r4, #0x3600 @ d8000000393393+ add r0, r4, #0xd8000000 >> 18391394 str r3, [r0]395395+#endif392396#endif393397 mov pc, lr394398 .ltorg
+2-10
arch/arm/kernel/traps.c
···230230 do_exit(SIGSEGV);231231}232232233233-void die_if_kernel(const char *str, struct pt_regs *regs, int err)234234-{235235- if (user_mode(regs))236236- return;237237-238238- die(str, regs, err);239239-}240240-241241-static void notify_die(const char *str, struct pt_regs *regs, siginfo_t *info,242242- unsigned long err, unsigned long trap)233233+void notify_die(const char *str, struct pt_regs *regs, struct siginfo *info,234234+ unsigned long err, unsigned long trap)243235{244236 if (user_mode(regs)) {245237 current->thread.error_code = err;
···41414242/* These routines should handle the standard chip-specific modes4343 * for usb0/1/2 ports, covering basic mux and transceiver setup.4444- * Call omap_usb_init() once, from INIT_MACHINE().4544 *4645 * Some board-*.c files will need to set up additional mux options,4746 * like for suspend handling, vbus sensing, GPIOs, and the D+ pullup.
···126126{127127 switch (state) {128128 case PM_SUSPEND_MEM:129129+ case PM_SUSPEND_STANDBY:129130 return 0;130131 default:131132 return -EINVAL;···139138 extern void pxa_cpu_suspend(unsigned int);140139 extern void pxa_cpu_resume(void);141140142142- CKEN = CKEN22_MEMC | CKEN9_OSTIMER;141141+ if (state == PM_SUSPEND_STANDBY)142142+ CKEN = CKEN22_MEMC | CKEN9_OSTIMER | CKEN16_LCD |CKEN0_PWM0;143143+ else144144+ CKEN = CKEN22_MEMC | CKEN9_OSTIMER;143145144146 /* ensure voltage-change sequencer not initiated, which hangs */145147 PCFR &= ~PCFR_FVC;···151147 PEDR = 0xDF12FE1B;152148153149 switch (state) {150150+ case PM_SUSPEND_STANDBY:151151+ pxa_cpu_standby();152152+ break;154153 case PM_SUSPEND_MEM:155154 /* set resume return address */156155 PSPR = virt_to_phys(pxa_cpu_resume);
+32
arch/arm/mach-pxa/standby.S
···11+/*22+ * PXA27x standby mode33+ *44+ * Author: David Burrage55+ *66+ * 2005 (c) MontaVista Software, Inc. This file is licensed under77+ * the terms of the GNU General Public License version 2. This program88+ * is licensed "as is" without any warranty of any kind, whether express99+ * or implied.1010+ */1111+1212+#include <linux/config.h>1313+#include <linux/linkage.h>1414+#include <asm/assembler.h>1515+#include <asm/hardware.h>1616+1717+#include <asm/arch/pxa-regs.h>1818+1919+ .text2020+2121+ENTRY(pxa_cpu_standby)2222+ ldr r0, =PSSR2323+ mov r1, #(PSSR_PH | PSSR_STS)2424+ mov r2, #22525+ mov r3, #UNCACHED_PHYS_0 @ Read mem context in.2626+ ldr ip, [r3]2727+ b 1f2828+2929+ .align 53030+1: mcr p14, 0, r2, c7, c0, 0 @ put the system into Standby3131+ str r1, [r0] @ make sure PSSR_PH/STS are clear3232+ mov pc, lr
···1717#include <asm/io.h>1818#include <asm/pgtable.h>1919#include <asm/fixmap.h>2020-#include "io_ports.h"2020+#include <asm/i8253.h>21212222-extern spinlock_t i8253_lock;2222+#include "io_ports.h"23232424/* Number of usecs that the last interrupt was delayed */2525static int delay_at_last_interrupt;
···2424#include "mach_timer.h"25252626#include <asm/hpet.h>2727+#include <asm/i8253.h>27282829#ifdef CONFIG_HPET_TIMER2930static unsigned long hpet_usec_quotient;···3534static inline void cpufreq_delayed_get(void);36353736int tsc_disable __devinitdata = 0;3838-3939-extern spinlock_t i8253_lock;40374138static int use_tsc;4239/* Number of usecs that the last interrupt was delayed */
+1-1
arch/i386/mach-voyager/voyager_basic.c
···3030#include <linux/irq.h>3131#include <asm/tlbflush.h>3232#include <asm/arch_hooks.h>3333+#include <asm/i8253.h>33343435/*3536 * Power off function, if any···183182 * and swiftly introduce it to something sharp and184183 * pointy. */185184 __u16 val;186186- extern spinlock_t i8253_lock;187185188186 spin_lock(&i8253_lock);189187
···11-/*22- * Copyright (C) Cort Dougan 1999.33- *44- * This program is free software; you can redistribute it and/or55- * modify it under the terms of the GNU General Public License66- * as published by the Free Software Foundation; either version77- * 2 of the License, or (at your option) any later version.88- *99- * Generate a note section as per the CHRP specification.1010- *1111- */1212-1313-#include <stdio.h>1414-1515-#define PL(x) printf("%c%c%c%c", ((x)>>24)&0xff, ((x)>>16)&0xff, ((x)>>8)&0xff, (x)&0xff );1616-1717-int main(void)1818-{1919-/* header */2020- /* namesz */2121- PL(strlen("PowerPC")+1);2222- /* descrsz */2323- PL(6*4);2424- /* type */2525- PL(0x1275);2626- /* name */2727- printf("PowerPC"); printf("%c", 0);2828-2929-/* descriptor */3030- /* real-mode */3131- PL(0xffffffff);3232- /* real-base */3333- PL(0x00c00000);3434- /* real-size */3535- PL(0xffffffff);3636- /* virt-base */3737- PL(0xffffffff);3838- /* virt-size */3939- PL(0xffffffff);4040- /* load-base */4141- PL(0x4000);4242- return 0;4343-}
-83
arch/ppc64/boot/piggyback.c
···11-/*22- * Copyright 2001 IBM Corp 33- *44- * This program is free software; you can redistribute it and/or55- * modify it under the terms of the GNU General Public License66- * as published by the Free Software Foundation; either version77- * 2 of the License, or (at your option) any later version.88- */99-#include <stdio.h>1010-#include <unistd.h>1111-#include <string.h>1212-1313-extern long ce_exec_config[];1414-1515-int main(int argc, char *argv[])1616-{1717- int i, cnt, pos, len;1818- unsigned int cksum, val;1919- unsigned char *lp;2020- unsigned char buf[8192];2121- char *varname;2222- if (argc != 2)2323- {2424- fprintf(stderr, "usage: %s name <in-file >out-file\n",2525- argv[0]);2626- exit(1);2727- }2828-2929- varname = strrchr(argv[1], '/');3030- if (varname)3131- varname++;3232- else3333- varname = argv[1];3434-3535- fprintf(stdout, "#\n");3636- fprintf(stdout, "# Miscellaneous data structures:\n");3737- fprintf(stdout, "# WARNING - this file is automatically generated!\n");3838- fprintf(stdout, "#\n");3939- fprintf(stdout, "\n");4040- fprintf(stdout, "\t.data\n");4141- fprintf(stdout, "\t.globl %s_data\n", varname);4242- fprintf(stdout, "%s_data:\n", varname);4343- pos = 0;4444- cksum = 0;4545- while ((len = read(0, buf, sizeof(buf))) > 0)4646- {4747- cnt = 0;4848- lp = (unsigned char *)buf;4949- len = (len + 3) & ~3; /* Round up to longwords */5050- for (i = 0; i < len; i += 4)5151- {5252- if (cnt == 0)5353- {5454- fprintf(stdout, "\t.long\t");5555- }5656- fprintf(stdout, "0x%02X%02X%02X%02X", lp[0], lp[1], lp[2], lp[3]);5757- val = *(unsigned long *)lp;5858- cksum ^= val;5959- lp += 4;6060- if (++cnt == 4)6161- {6262- cnt = 0;6363- fprintf(stdout, " # %x \n", pos+i-12);6464- fflush(stdout);6565- } else6666- {6767- fprintf(stdout, ",");6868- }6969- }7070- if (cnt)7171- {7272- fprintf(stdout, "0\n");7373- }7474- pos += len;7575- }7676- fprintf(stdout, "\t.globl %s_len\n", varname);7777- fprintf(stdout, "%s_len:\t.long\t0x%x\n", varname, pos);7878- fflush(stdout);7979- fclose(stdout);8080- fprintf(stderr, "cksum = %x\n", cksum);8181- exit(0);8282-}8383-
+2-14
arch/ppc64/boot/prom.c
···4040int getprop(void *phandle, const char *name, void *buf, int buflen);4141void chrpboot(int a1, int a2, void *prom); /* in main.c */42424343-void printk(char *fmt, ...);4343+int printf(char *fmt, ...);44444545/* there is no convenient header to get this from... -- paulus */4646extern unsigned long strlen(const char *);···220220 case 1:221221 return ch;222222 case -1:223223- printk("read(stdin) returned -1\r\n");223223+ printf("read(stdin) returned -1\r\n");224224 return -1;225225 }226226 }···626626}627627628628static char sprint_buf[1024];629629-630630-void631631-printk(char *fmt, ...)632632-{633633- va_list args;634634- int n;635635-636636- va_start(args, fmt);637637- n = vsprintf(sprint_buf, fmt, args);638638- va_end(args);639639- write(stdout, sprint_buf, n);640640-}641629642630int643631printf(char *fmt, ...)
+196-100
arch/ppc64/kernel/ItLpQueue.c
···11/*22 * ItLpQueue.c33 * Copyright (C) 2001 Mike Corrigan IBM Corporation44- * 44+ *55 * This program is free software; you can redistribute it and/or modify66 * it under the terms of the GNU General Public License as published by77 * the Free Software Foundation; either version 2 of the License, or···1111#include <linux/stddef.h>1212#include <linux/kernel.h>1313#include <linux/sched.h>1414+#include <linux/bootmem.h>1515+#include <linux/seq_file.h>1616+#include <linux/proc_fs.h>1417#include <asm/system.h>1518#include <asm/paca.h>1619#include <asm/iSeries/ItLpQueue.h>1720#include <asm/iSeries/HvLpEvent.h>1821#include <asm/iSeries/HvCallEvent.h>19222020-static __inline__ int set_inUse( struct ItLpQueue * lpQueue )2121-{2222- int t;2323- u32 * inUseP = &(lpQueue->xInUseWord);2323+/*2424+ * The LpQueue is used to pass event data from the hypervisor to2525+ * the partition. This is where I/O interrupt events are communicated.2626+ *2727+ * It is written to by the hypervisor so cannot end up in the BSS.2828+ */2929+struct hvlpevent_queue hvlpevent_queue __attribute__((__section__(".data")));24302525- __asm__ __volatile__("\n\2626-1: lwarx %0,0,%2 \n\2727- cmpwi 0,%0,0 \n\2828- li %0,0 \n\2929- bne- 2f \n\3030- addi %0,%0,1 \n\3131- stwcx. %0,0,%2 \n\3232- bne- 1b \n\3333-2: eieio"3434- : "=&r" (t), "=m" (lpQueue->xInUseWord)3535- : "r" (inUseP), "m" (lpQueue->xInUseWord)3636- : "cc");3131+DEFINE_PER_CPU(unsigned long[HvLpEvent_Type_NumTypes], hvlpevent_counts);37323838- return t;3939-}4040-4141-static __inline__ void clear_inUse( struct ItLpQueue * lpQueue )4242-{4343- lpQueue->xInUseWord = 0;4444-}3333+static char *event_types[HvLpEvent_Type_NumTypes] = {3434+ "Hypervisor",3535+ "Machine Facilities",3636+ "Session Manager",3737+ "SPD I/O",3838+ "Virtual Bus",3939+ "PCI I/O",4040+ "RIO I/O",4141+ "Virtual Lan",4242+ "Virtual I/O"4343+};45444645/* Array of LpEvent handler functions */4746extern LpEventHandler lpEventHandler[HvLpEvent_Type_NumTypes];4848-unsigned long ItLpQueueInProcess = 0;49475050-struct HvLpEvent * ItLpQueue_getNextLpEvent( struct ItLpQueue * lpQueue )4848+static struct HvLpEvent * get_next_hvlpevent(void)5149{5252- struct HvLpEvent * nextLpEvent = 5353- (struct HvLpEvent *)lpQueue->xSlicCurEventPtr;5454- if ( nextLpEvent->xFlags.xValid ) {5050+ struct HvLpEvent * event;5151+ event = (struct HvLpEvent *)hvlpevent_queue.xSlicCurEventPtr;5252+5353+ if (event->xFlags.xValid) {5554 /* rmb() needed only for weakly consistent machines (regatta) */5655 rmb();5756 /* Set pointer to next potential event */5858- lpQueue->xSlicCurEventPtr += ((nextLpEvent->xSizeMinus1 +5959- LpEventAlign ) /6060- LpEventAlign ) *6161- LpEventAlign;5757+ hvlpevent_queue.xSlicCurEventPtr += ((event->xSizeMinus1 +5858+ LpEventAlign) / LpEventAlign) * LpEventAlign;5959+6260 /* Wrap to beginning if no room at end */6363- if (lpQueue->xSlicCurEventPtr > lpQueue->xSlicLastValidEventPtr)6464- lpQueue->xSlicCurEventPtr = lpQueue->xSlicEventStackPtr;6161+ if (hvlpevent_queue.xSlicCurEventPtr >6262+ hvlpevent_queue.xSlicLastValidEventPtr) {6363+ hvlpevent_queue.xSlicCurEventPtr =6464+ hvlpevent_queue.xSlicEventStackPtr;6565+ }6666+ } else {6767+ event = NULL;6568 }6666- else 6767- nextLpEvent = NULL;68696969- return nextLpEvent;7070+ return event;7071}71727272-int ItLpQueue_isLpIntPending( struct ItLpQueue * lpQueue )7373+static unsigned long spread_lpevents = NR_CPUS;7474+7575+int hvlpevent_is_pending(void)7376{7474- int retval = 0;7575- struct HvLpEvent * nextLpEvent;7676- if ( lpQueue ) {7777- nextLpEvent = (struct HvLpEvent *)lpQueue->xSlicCurEventPtr;7878- retval = nextLpEvent->xFlags.xValid | lpQueue->xPlicOverflowIntPending;7979- }8080- return retval;7777+ struct HvLpEvent *next_event;7878+7979+ if (smp_processor_id() >= spread_lpevents)8080+ return 0;8181+8282+ next_event = (struct HvLpEvent *)hvlpevent_queue.xSlicCurEventPtr;8383+8484+ return next_event->xFlags.xValid |8585+ hvlpevent_queue.xPlicOverflowIntPending;8186}82878383-void ItLpQueue_clearValid( struct HvLpEvent * event )8888+static void hvlpevent_clear_valid(struct HvLpEvent * event)8489{8585- /* Clear the valid bit of the event8686- * Also clear bits within this event that might8787- * look like valid bits (on 64-byte boundaries)8888- */8989- unsigned extra = (( event->xSizeMinus1 + LpEventAlign ) /9090- LpEventAlign ) - 1;9191- switch ( extra ) {9292- case 3:9393- ((struct HvLpEvent*)((char*)event+3*LpEventAlign))->xFlags.xValid=0;9494- case 2:9595- ((struct HvLpEvent*)((char*)event+2*LpEventAlign))->xFlags.xValid=0;9696- case 1:9797- ((struct HvLpEvent*)((char*)event+1*LpEventAlign))->xFlags.xValid=0;9898- case 0:9999- ; 9090+ /* Tell the Hypervisor that we're done with this event.9191+ * Also clear bits within this event that might look like valid bits.9292+ * ie. on 64-byte boundaries.9393+ */9494+ struct HvLpEvent *tmp;9595+ unsigned extra = ((event->xSizeMinus1 + LpEventAlign) /9696+ LpEventAlign) - 1;9797+9898+ switch (extra) {9999+ case 3:100100+ tmp = (struct HvLpEvent*)((char*)event + 3 * LpEventAlign);101101+ tmp->xFlags.xValid = 0;102102+ case 2:103103+ tmp = (struct HvLpEvent*)((char*)event + 2 * LpEventAlign);104104+ tmp->xFlags.xValid = 0;105105+ case 1:106106+ tmp = (struct HvLpEvent*)((char*)event + 1 * LpEventAlign);107107+ tmp->xFlags.xValid = 0;100108 }109109+101110 mb();111111+102112 event->xFlags.xValid = 0;103113}104114105105-unsigned ItLpQueue_process( struct ItLpQueue * lpQueue, struct pt_regs *regs )115115+void process_hvlpevents(struct pt_regs *regs)106116{107107- unsigned numIntsProcessed = 0;108108- struct HvLpEvent * nextLpEvent;117117+ struct HvLpEvent * event;109118110119 /* If we have recursed, just return */111111- if ( !set_inUse( lpQueue ) )112112- return 0;113113-114114- if (ItLpQueueInProcess == 0)115115- ItLpQueueInProcess = 1;116116- else117117- BUG();120120+ if (!spin_trylock(&hvlpevent_queue.lock))121121+ return;118122119123 for (;;) {120120- nextLpEvent = ItLpQueue_getNextLpEvent( lpQueue );121121- if ( nextLpEvent ) {122122- /* Count events to return to caller123123- * and count processed events in lpQueue124124- */125125- ++numIntsProcessed;126126- lpQueue->xLpIntCount++; 127127- /* Call appropriate handler here, passing 124124+ event = get_next_hvlpevent();125125+ if (event) {126126+ /* Call appropriate handler here, passing128127 * a pointer to the LpEvent. The handler129128 * must make a copy of the LpEvent if it130129 * needs it in a bottom half. (perhaps for131130 * an ACK)132132- * 133133- * Handlers are responsible for ACK processing 131131+ *132132+ * Handlers are responsible for ACK processing134133 *135134 * The Hypervisor guarantees that LpEvents will136135 * only be delivered with types that we have137136 * registered for, so no type check is necessary138137 * here!139139- */140140- if ( nextLpEvent->xType < HvLpEvent_Type_NumTypes )141141- lpQueue->xLpIntCountByType[nextLpEvent->xType]++;142142- if ( nextLpEvent->xType < HvLpEvent_Type_NumTypes &&143143- lpEventHandler[nextLpEvent->xType] ) 144144- lpEventHandler[nextLpEvent->xType](nextLpEvent, regs);138138+ */139139+ if (event->xType < HvLpEvent_Type_NumTypes)140140+ __get_cpu_var(hvlpevent_counts)[event->xType]++;141141+ if (event->xType < HvLpEvent_Type_NumTypes &&142142+ lpEventHandler[event->xType])143143+ lpEventHandler[event->xType](event, regs);145144 else146146- printk(KERN_INFO "Unexpected Lp Event type=%d\n", nextLpEvent->xType );147147-148148- ItLpQueue_clearValid( nextLpEvent );149149- } else if ( lpQueue->xPlicOverflowIntPending )145145+ printk(KERN_INFO "Unexpected Lp Event type=%d\n", event->xType );146146+147147+ hvlpevent_clear_valid(event);148148+ } else if (hvlpevent_queue.xPlicOverflowIntPending)150149 /*151150 * No more valid events. If overflow events are152151 * pending process them153152 */154154- HvCallEvent_getOverflowLpEvents( lpQueue->xIndex);153153+ HvCallEvent_getOverflowLpEvents(hvlpevent_queue.xIndex);155154 else156155 break;157156 }158157159159- ItLpQueueInProcess = 0;160160- mb();161161- clear_inUse( lpQueue );162162-163163- get_paca()->lpevent_count += numIntsProcessed;164164-165165- return numIntsProcessed;158158+ spin_unlock(&hvlpevent_queue.lock);166159}160160+161161+static int set_spread_lpevents(char *str)162162+{163163+ unsigned long val = simple_strtoul(str, NULL, 0);164164+165165+ /*166166+ * The parameter is the number of processors to share in processing167167+ * lp events.168168+ */169169+ if (( val > 0) && (val <= NR_CPUS)) {170170+ spread_lpevents = val;171171+ printk("lpevent processing spread over %ld processors\n", val);172172+ } else {173173+ printk("invalid spread_lpevents %ld\n", val);174174+ }175175+176176+ return 1;177177+}178178+__setup("spread_lpevents=", set_spread_lpevents);179179+180180+void setup_hvlpevent_queue(void)181181+{182182+ void *eventStack;183183+184184+ /*185185+ * Allocate a page for the Event Stack. The Hypervisor needs the186186+ * absolute real address, so we subtract out the KERNELBASE and add187187+ * in the absolute real address of the kernel load area.188188+ */189189+ eventStack = alloc_bootmem_pages(LpEventStackSize);190190+ memset(eventStack, 0, LpEventStackSize);191191+192192+ /* Invoke the hypervisor to initialize the event stack */193193+ HvCallEvent_setLpEventStack(0, eventStack, LpEventStackSize);194194+195195+ hvlpevent_queue.xSlicEventStackPtr = (char *)eventStack;196196+ hvlpevent_queue.xSlicCurEventPtr = (char *)eventStack;197197+ hvlpevent_queue.xSlicLastValidEventPtr = (char *)eventStack +198198+ (LpEventStackSize - LpEventMaxSize);199199+ hvlpevent_queue.xIndex = 0;200200+}201201+202202+static int proc_lpevents_show(struct seq_file *m, void *v)203203+{204204+ int cpu, i;205205+ unsigned long sum;206206+ static unsigned long cpu_totals[NR_CPUS];207207+208208+ /* FIXME: do we care that there's no locking here? */209209+ sum = 0;210210+ for_each_online_cpu(cpu) {211211+ cpu_totals[cpu] = 0;212212+ for (i = 0; i < HvLpEvent_Type_NumTypes; i++) {213213+ cpu_totals[cpu] += per_cpu(hvlpevent_counts, cpu)[i];214214+ }215215+ sum += cpu_totals[cpu];216216+ }217217+218218+ seq_printf(m, "LpEventQueue 0\n");219219+ seq_printf(m, " events processed:\t%lu\n", sum);220220+221221+ for (i = 0; i < HvLpEvent_Type_NumTypes; ++i) {222222+ sum = 0;223223+ for_each_online_cpu(cpu) {224224+ sum += per_cpu(hvlpevent_counts, cpu)[i];225225+ }226226+227227+ seq_printf(m, " %-20s %10lu\n", event_types[i], sum);228228+ }229229+230230+ seq_printf(m, "\n events processed by processor:\n");231231+232232+ for_each_online_cpu(cpu) {233233+ seq_printf(m, " CPU%02d %10lu\n", cpu, cpu_totals[cpu]);234234+ }235235+236236+ return 0;237237+}238238+239239+static int proc_lpevents_open(struct inode *inode, struct file *file)240240+{241241+ return single_open(file, proc_lpevents_show, NULL);242242+}243243+244244+static struct file_operations proc_lpevents_operations = {245245+ .open = proc_lpevents_open,246246+ .read = seq_read,247247+ .llseek = seq_lseek,248248+ .release = single_release,249249+};250250+251251+static int __init proc_lpevents_init(void)252252+{253253+ struct proc_dir_entry *e;254254+255255+ e = create_proc_entry("iSeries/lpevents", S_IFREG|S_IRUGO, NULL);256256+ if (e)257257+ e->proc_fops = &proc_lpevents_operations;258258+259259+ return 0;260260+}261261+__initcall(proc_lpevents_init);262262+
+2-9
arch/ppc64/kernel/LparData.c
···2828#include <asm/iSeries/IoHriProcessorVpd.h>2929#include <asm/iSeries/ItSpCommArea.h>30303131-/* The LpQueue is used to pass event data from the hypervisor to3232- * the partition. This is where I/O interrupt events are communicated.3333- */3434-3535-/* May be filled in by the hypervisor so cannot end up in the BSS */3636-struct ItLpQueue xItLpQueue __attribute__((__section__(".data")));3737-38313932/* The HvReleaseData is the root of the information shared between 4033 * the hypervisor and Linux. ···193200 0,0,0, /* 13 - 15 */194201 sizeof(struct IoHriProcessorVpd),/* 16 length of Proc Vpd */195202 0,0,0,0,0,0, /* 17 - 22 */196196- sizeof(struct ItLpQueue),/* 23 length of Lp Queue */203203+ sizeof(struct hvlpevent_queue), /* 23 length of Lp Queue */197204 0,0 /* 24 - 25 */198205 },199206 .xSlicVpdAdrs = { /* VPD addresses */···211218 0,0,0, /* 13 - 15 */212219 &xIoHriProcessorVpd, /* 16 Proc Vpd */213220 0,0,0,0,0,0, /* 17 - 22 */214214- &xItLpQueue, /* 23 Lp Queue */221221+ &hvlpevent_queue, /* 23 Lp Queue */215222 0,0216223 }217224};
-48
arch/ppc64/kernel/iSeries_proc.c
···4040}4141core_initcall(iseries_proc_create);42424343-static char *event_types[9] = {4444- "Hypervisor\t\t",4545- "Machine Facilities\t",4646- "Session Manager\t",4747- "SPD I/O\t\t",4848- "Virtual Bus\t\t",4949- "PCI I/O\t\t",5050- "RIO I/O\t\t",5151- "Virtual Lan\t\t",5252- "Virtual I/O\t\t"5353-};5454-5555-static int proc_lpevents_show(struct seq_file *m, void *v)5656-{5757- unsigned int i;5858-5959- seq_printf(m, "LpEventQueue 0\n");6060- seq_printf(m, " events processed:\t%lu\n",6161- (unsigned long)xItLpQueue.xLpIntCount);6262-6363- for (i = 0; i < 9; ++i)6464- seq_printf(m, " %s %10lu\n", event_types[i],6565- (unsigned long)xItLpQueue.xLpIntCountByType[i]);6666-6767- seq_printf(m, "\n events processed by processor:\n");6868-6969- for_each_online_cpu(i)7070- seq_printf(m, " CPU%02d %10u\n", i, paca[i].lpevent_count);7171-7272- return 0;7373-}7474-7575-static int proc_lpevents_open(struct inode *inode, struct file *file)7676-{7777- return single_open(file, proc_lpevents_show, NULL);7878-}7979-8080-static struct file_operations proc_lpevents_operations = {8181- .open = proc_lpevents_open,8282- .read = seq_read,8383- .llseek = seq_lseek,8484- .release = single_release,8585-};8686-8743static unsigned long startTitan = 0;8844static unsigned long startTb = 0;8945···103147static int __init iseries_proc_init(void)104148{105149 struct proc_dir_entry *e;106106-107107- e = create_proc_entry("iSeries/lpevents", S_IFREG|S_IRUGO, NULL);108108- if (e)109109- e->proc_fops = &proc_lpevents_operations;110150111151 e = create_proc_entry("iSeries/titanTod", S_IFREG|S_IRUGO, NULL);112152 if (e)
+1-42
arch/ppc64/kernel/iSeries_setup.c
···2424#include <linux/smp.h>2525#include <linux/param.h>2626#include <linux/string.h>2727-#include <linux/bootmem.h>2827#include <linux/initrd.h>2928#include <linux/seq_file.h>3029#include <linux/kdev_t.h>···675676 */676677static void __init iSeries_setup_arch(void)677678{678678- void *eventStack;679679 unsigned procIx = get_paca()->lppaca.dyn_hv_phys_proc_index;680680681681 /* Add an eye catcher and the systemcfg layout version number */···683685 systemcfg->version.minor = SYSTEMCFG_MINOR;684686685687 /* Setup the Lp Event Queue */686686-687687- /* Allocate a page for the Event Stack688688- * The hypervisor wants the absolute real address, so689689- * we subtract out the KERNELBASE and add in the690690- * absolute real address of the kernel load area691691- */692692- eventStack = alloc_bootmem_pages(LpEventStackSize);693693- memset(eventStack, 0, LpEventStackSize);694694-695695- /* Invoke the hypervisor to initialize the event stack */696696- HvCallEvent_setLpEventStack(0, eventStack, LpEventStackSize);697697-698698- /* Initialize fields in our Lp Event Queue */699699- xItLpQueue.xSlicEventStackPtr = (char *)eventStack;700700- xItLpQueue.xSlicCurEventPtr = (char *)eventStack;701701- xItLpQueue.xSlicLastValidEventPtr = (char *)eventStack +702702- (LpEventStackSize - LpEventMaxSize);703703- xItLpQueue.xIndex = 0;688688+ setup_hvlpevent_queue();704689705690 /* Compute processor frequency */706691 procFreqHz = ((1UL << 34) * 1000000) /···833852}834853835854late_initcall(iSeries_src_init);836836-837837-static int set_spread_lpevents(char *str)838838-{839839- unsigned long i;840840- unsigned long val = simple_strtoul(str, NULL, 0);841841-842842- /*843843- * The parameter is the number of processors to share in processing844844- * lp events.845845- */846846- if (( val > 0) && (val <= NR_CPUS)) {847847- for (i = 1; i < val; ++i)848848- paca[i].lpqueue_ptr = paca[0].lpqueue_ptr;849849-850850- printk("lpevent processing spread over %ld processors\n", val);851851- } else {852852- printk("invalid spread_lpevents %ld\n", val);853853- }854854-855855- return 1;856856-}857857-__setup("spread_lpevents=", set_spread_lpevents);858855859856#ifndef CONFIG_PCI860857void __init iSeries_init_IRQ(void) { }
+2-2
arch/ppc64/kernel/idle.c
···88888989 while (1) {9090 if (lpaca->lppaca.shared_proc) {9191- if (ItLpQueue_isLpIntPending(lpaca->lpqueue_ptr))9191+ if (hvlpevent_is_pending())9292 process_iSeries_events();9393 if (!need_resched())9494 yield_shared_processor();···100100101101 while (!need_resched()) {102102 HMT_medium();103103- if (ItLpQueue_isLpIntPending(lpaca->lpqueue_ptr))103103+ if (hvlpevent_is_pending())104104 process_iSeries_events();105105 HMT_low();106106 }
···801801 return rc;802802 /* We need to poll here as we are not yet taking interrupts */803803 while (rtc_data.busy) {804804- extern unsigned long lpevent_count;805805- struct ItLpQueue *lpq = get_paca()->lpqueue_ptr;806806- if (lpq && ItLpQueue_isLpIntPending(lpq))807807- lpevent_count += ItLpQueue_process(lpq, NULL);804804+ if (hvlpevent_is_pending())805805+ process_hvlpevents(NULL);808806 }809807 return rtc_set_tm(rtc_data.rc, rtc_data.ce_msg.ce_msg, tm);810808}
+3-5
arch/ppc64/kernel/nvram.c
···338338 */339339static int nvram_create_os_partition(void)340340{341341- struct list_head * p;342342- struct nvram_partition *part = NULL;343343- struct nvram_partition *new_part = NULL;341341+ struct nvram_partition *part;342342+ struct nvram_partition *new_part;344343 struct nvram_partition *free_part = NULL;345344 int seq_init[2] = { 0, 0 };346345 loff_t tmp_index;···348349349350 /* Find a free partition that will give us the maximum needed size 350351 If can't find one that will give us the minimum size needed */351351- list_for_each(p, &nvram_part->partition) {352352- part = list_entry(p, struct nvram_partition, partition);352352+ list_for_each_entry(part, &nvram_part->partition, partition) {353353 if (part->header.signature != NVRAM_SIG_FREE)354354 continue;355355
···400400 struct cpu *c = &per_cpu(cpu_devices, cpu);401401402402#ifdef CONFIG_NUMA403403- parent = &node_devices[cpu_to_node(cpu)];403403+ /* The node to which a cpu belongs can't be known404404+ * until the cpu is made present.405405+ */406406+ parent = NULL;407407+ if (cpu_present(cpu))408408+ parent = &node_devices[cpu_to_node(cpu)];404409#endif405410 /*406411 * For now, we just see if the system supports making
+2-6
arch/ppc64/kernel/time.c
···9999struct gettimeofday_struct do_gtod;100100101101extern unsigned long wall_jiffies;102102-extern unsigned long lpevent_count;103102extern int smp_tb_synchronized;104103105104extern struct timezone sys_tz;···366367 set_dec(next_dec);367368368369#ifdef CONFIG_PPC_ISERIES369369- {370370- struct ItLpQueue *lpq = lpaca->lpqueue_ptr;371371- if (lpq && ItLpQueue_isLpIntPending(lpq))372372- lpevent_count += ItLpQueue_process(lpq, regs);373373- }370370+ if (hvlpevent_is_pending())371371+ process_hvlpevents(regs);374372#endif375373376374/* collect purr register values often, for accurate calculations */
···132132config GENERIC_CALIBRATE_DELAY133133 bool "Auto calibration of the BogoMIPS value"134134 ---help---135135- The BogoMIPS value can easily derived from the CPU frequency.135135+ The BogoMIPS value can easily be derived from the CPU frequency.136136137137config CMDLINE_BOOL138138 bool "Default bootloader kernel arguments"···157157 bool158158 depends on XTENSA_PLATFORM_ISS159159 default y160160+161161+source "mm/Kconfig"160162161163endmenu162164
···11-/*22- * BK Id: SCCS/s.zlib.h 1.8 05/18/01 15:17:23 cort33- */44-/*55- * This file is derived from zlib.h and zconf.h from the zlib-0.9566- * distribution by Jean-loup Gailly and Mark Adler, with some additions77- * by Paul Mackerras to aid in implementing Deflate compression and88- * decompression for PPP packets.99- */1010-1111-/*1212- * ==FILEVERSION 960122==1313- *1414- * This marker is used by the Linux installation script to determine1515- * whether an up-to-date version of this file is already installed.1616- */1717-1818-/* zlib.h -- interface of the 'zlib' general purpose compression library1919- version 0.95, Aug 16th, 1995.2020-2121- Copyright (C) 1995 Jean-loup Gailly and Mark Adler2222-2323- This software is provided 'as-is', without any express or implied2424- warranty. In no event will the authors be held liable for any damages2525- arising from the use of this software.2626-2727- Permission is granted to anyone to use this software for any purpose,2828- including commercial applications, and to alter it and redistribute it2929- freely, subject to the following restrictions:3030-3131- 1. The origin of this software must not be misrepresented; you must not3232- claim that you wrote the original software. If you use this software3333- in a product, an acknowledgment in the product documentation would be3434- appreciated but is not required.3535- 2. Altered source versions must be plainly marked as such, and must not be3636- misrepresented as being the original software.3737- 3. This notice may not be removed or altered from any source distribution.3838-3939- Jean-loup Gailly Mark Adler4040- gzip@prep.ai.mit.edu madler@alumni.caltech.edu4141- */4242-4343-#ifndef _ZLIB_H4444-#define _ZLIB_H4545-4646-/* #include "zconf.h" */ /* included directly here */4747-4848-/* zconf.h -- configuration of the zlib compression library4949- * Copyright (C) 1995 Jean-loup Gailly.5050- * For conditions of distribution and use, see copyright notice in zlib.h5151- */5252-5353-/* From: zconf.h,v 1.12 1995/05/03 17:27:12 jloup Exp */5454-5555-/*5656- The library does not install any signal handler. It is recommended to5757- add at least a handler for SIGSEGV when decompressing; the library checks5858- the consistency of the input data whenever possible but may go nuts5959- for some forms of corrupted input.6060- */6161-6262-/*6363- * Compile with -DMAXSEG_64K if the alloc function cannot allocate more6464- * than 64k bytes at a time (needed on systems with 16-bit int).6565- * Compile with -DUNALIGNED_OK if it is OK to access shorts or ints6666- * at addresses which are not a multiple of their size.6767- * Under DOS, -DFAR=far or -DFAR=__far may be needed.6868- */6969-7070-#ifndef STDC7171-# if defined(MSDOS) || defined(__STDC__) || defined(__cplusplus)7272-# define STDC7373-# endif7474-#endif7575-7676-#ifdef __MWERKS__ /* Metrowerks CodeWarrior declares fileno() in unix.h */7777-# include <unix.h>7878-#endif7979-8080-/* Maximum value for memLevel in deflateInit2 */8181-#ifndef MAX_MEM_LEVEL8282-# ifdef MAXSEG_64K8383-# define MAX_MEM_LEVEL 88484-# else8585-# define MAX_MEM_LEVEL 98686-# endif8787-#endif8888-8989-#ifndef FAR9090-# define FAR9191-#endif9292-9393-/* Maximum value for windowBits in deflateInit2 and inflateInit2 */9494-#ifndef MAX_WBITS9595-# define MAX_WBITS 15 /* 32K LZ77 window */9696-#endif9797-9898-/* The memory requirements for deflate are (in bytes):9999- 1 << (windowBits+2) + 1 << (memLevel+9)100100- that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values)101101- plus a few kilobytes for small objects. For example, if you want to reduce102102- the default memory requirements from 256K to 128K, compile with103103- make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"104104- Of course this will generally degrade compression (there's no free lunch).105105-106106- The memory requirements for inflate are (in bytes) 1 << windowBits107107- that is, 32K for windowBits=15 (default value) plus a few kilobytes108108- for small objects.109109-*/110110-111111- /* Type declarations */112112-113113-#ifndef OF /* function prototypes */114114-# ifdef STDC115115-# define OF(args) args116116-# else117117-# define OF(args) ()118118-# endif119119-#endif120120-121121-typedef unsigned char Byte; /* 8 bits */122122-typedef unsigned int uInt; /* 16 bits or more */123123-typedef unsigned long uLong; /* 32 bits or more */124124-125125-typedef Byte FAR Bytef;126126-typedef char FAR charf;127127-typedef int FAR intf;128128-typedef uInt FAR uIntf;129129-typedef uLong FAR uLongf;130130-131131-#ifdef STDC132132- typedef void FAR *voidpf;133133- typedef void *voidp;134134-#else135135- typedef Byte FAR *voidpf;136136- typedef Byte *voidp;137137-#endif138138-139139-/* end of original zconf.h */140140-141141-#define ZLIB_VERSION "0.95P"142142-143143-/*144144- The 'zlib' compression library provides in-memory compression and145145- decompression functions, including integrity checks of the uncompressed146146- data. This version of the library supports only one compression method147147- (deflation) but other algorithms may be added later and will have the same148148- stream interface.149149-150150- For compression the application must provide the output buffer and151151- may optionally provide the input buffer for optimization. For decompression,152152- the application must provide the input buffer and may optionally provide153153- the output buffer for optimization.154154-155155- Compression can be done in a single step if the buffers are large156156- enough (for example if an input file is mmap'ed), or can be done by157157- repeated calls of the compression function. In the latter case, the158158- application must provide more input and/or consume the output159159- (providing more output space) before each call.160160-*/161161-162162-typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size));163163-typedef void (*free_func) OF((voidpf opaque, voidpf address, uInt nbytes));164164-165165-struct internal_state;166166-167167-typedef struct z_stream_s {168168- Bytef *next_in; /* next input byte */169169- uInt avail_in; /* number of bytes available at next_in */170170- uLong total_in; /* total nb of input bytes read so far */171171-172172- Bytef *next_out; /* next output byte should be put there */173173- uInt avail_out; /* remaining free space at next_out */174174- uLong total_out; /* total nb of bytes output so far */175175-176176- char *msg; /* last error message, NULL if no error */177177- struct internal_state FAR *state; /* not visible by applications */178178-179179- alloc_func zalloc; /* used to allocate the internal state */180180- free_func zfree; /* used to free the internal state */181181- voidp opaque; /* private data object passed to zalloc and zfree */182182-183183- Byte data_type; /* best guess about the data type: ascii or binary */184184-185185-} z_stream;186186-187187-/*188188- The application must update next_in and avail_in when avail_in has189189- dropped to zero. It must update next_out and avail_out when avail_out190190- has dropped to zero. The application must initialize zalloc, zfree and191191- opaque before calling the init function. All other fields are set by the192192- compression library and must not be updated by the application.193193-194194- The opaque value provided by the application will be passed as the first195195- parameter for calls of zalloc and zfree. This can be useful for custom196196- memory management. The compression library attaches no meaning to the197197- opaque value.198198-199199- zalloc must return Z_NULL if there is not enough memory for the object.200200- On 16-bit systems, the functions zalloc and zfree must be able to allocate201201- exactly 65536 bytes, but will not be required to allocate more than this202202- if the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS,203203- pointers returned by zalloc for objects of exactly 65536 bytes *must*204204- have their offset normalized to zero. The default allocation function205205- provided by this library ensures this (see zutil.c). To reduce memory206206- requirements and avoid any allocation of 64K objects, at the expense of207207- compression ratio, compile the library with -DMAX_WBITS=14 (see zconf.h).208208-209209- The fields total_in and total_out can be used for statistics or210210- progress reports. After compression, total_in holds the total size of211211- the uncompressed data and may be saved for use in the decompressor212212- (particularly if the decompressor wants to decompress everything in213213- a single step).214214-*/215215-216216- /* constants */217217-218218-#define Z_NO_FLUSH 0219219-#define Z_PARTIAL_FLUSH 1220220-#define Z_FULL_FLUSH 2221221-#define Z_SYNC_FLUSH 3 /* experimental: partial_flush + byte align */222222-#define Z_FINISH 4223223-#define Z_PACKET_FLUSH 5224224-/* See deflate() below for the usage of these constants */225225-226226-#define Z_OK 0227227-#define Z_STREAM_END 1228228-#define Z_ERRNO (-1)229229-#define Z_STREAM_ERROR (-2)230230-#define Z_DATA_ERROR (-3)231231-#define Z_MEM_ERROR (-4)232232-#define Z_BUF_ERROR (-5)233233-/* error codes for the compression/decompression functions */234234-235235-#define Z_BEST_SPEED 1236236-#define Z_BEST_COMPRESSION 9237237-#define Z_DEFAULT_COMPRESSION (-1)238238-/* compression levels */239239-240240-#define Z_FILTERED 1241241-#define Z_HUFFMAN_ONLY 2242242-#define Z_DEFAULT_STRATEGY 0243243-244244-#define Z_BINARY 0245245-#define Z_ASCII 1246246-#define Z_UNKNOWN 2247247-/* Used to set the data_type field */248248-249249-#define Z_NULL 0 /* for initializing zalloc, zfree, opaque */250250-251251-extern char *zlib_version;252252-/* The application can compare zlib_version and ZLIB_VERSION for consistency.253253- If the first character differs, the library code actually used is254254- not compatible with the zlib.h header file used by the application.255255- */256256-257257- /* basic functions */258258-259259-extern int inflateInit OF((z_stream *strm));260260-/*261261- Initializes the internal stream state for decompression. The fields262262- zalloc and zfree must be initialized before by the caller. If zalloc and263263- zfree are set to Z_NULL, inflateInit updates them to use default allocation264264- functions.265265-266266- inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not267267- enough memory. msg is set to null if there is no error message.268268- inflateInit does not perform any decompression: this will be done by269269- inflate().270270-*/271271-272272-273273-extern int inflate OF((z_stream *strm, int flush));274274-/*275275- Performs one or both of the following actions:276276-277277- - Decompress more input starting at next_in and update next_in and avail_in278278- accordingly. If not all input can be processed (because there is not279279- enough room in the output buffer), next_in is updated and processing280280- will resume at this point for the next call of inflate().281281-282282- - Provide more output starting at next_out and update next_out and avail_out283283- accordingly. inflate() always provides as much output as possible284284- (until there is no more input data or no more space in the output buffer).285285-286286- Before the call of inflate(), the application should ensure that at least287287- one of the actions is possible, by providing more input and/or consuming288288- more output, and updating the next_* and avail_* values accordingly.289289- The application can consume the uncompressed output when it wants, for290290- example when the output buffer is full (avail_out == 0), or after each291291- call of inflate().292292-293293- If the parameter flush is set to Z_PARTIAL_FLUSH or Z_PACKET_FLUSH,294294- inflate flushes as much output as possible to the output buffer. The295295- flushing behavior of inflate is not specified for values of the flush296296- parameter other than Z_PARTIAL_FLUSH, Z_PACKET_FLUSH or Z_FINISH, but the297297- current implementation actually flushes as much output as possible298298- anyway. For Z_PACKET_FLUSH, inflate checks that once all the input data299299- has been consumed, it is expecting to see the length field of a stored300300- block; if not, it returns Z_DATA_ERROR.301301-302302- inflate() should normally be called until it returns Z_STREAM_END or an303303- error. However if all decompression is to be performed in a single step304304- (a single call of inflate), the parameter flush should be set to305305- Z_FINISH. In this case all pending input is processed and all pending306306- output is flushed; avail_out must be large enough to hold all the307307- uncompressed data. (The size of the uncompressed data may have been saved308308- by the compressor for this purpose.) The next operation on this stream must309309- be inflateEnd to deallocate the decompression state. The use of Z_FINISH310310- is never required, but can be used to inform inflate that a faster routine311311- may be used for the single inflate() call.312312-313313- inflate() returns Z_OK if some progress has been made (more input314314- processed or more output produced), Z_STREAM_END if the end of the315315- compressed data has been reached and all uncompressed output has been316316- produced, Z_DATA_ERROR if the input data was corrupted, Z_STREAM_ERROR if317317- the stream structure was inconsistent (for example if next_in or next_out318318- was NULL), Z_MEM_ERROR if there was not enough memory, Z_BUF_ERROR if no319319- progress is possible or if there was not enough room in the output buffer320320- when Z_FINISH is used. In the Z_DATA_ERROR case, the application may then321321- call inflateSync to look for a good compression block. */322322-323323-324324-extern int inflateEnd OF((z_stream *strm));325325-/*326326- All dynamically allocated data structures for this stream are freed.327327- This function discards any unprocessed input and does not flush any328328- pending output.329329-330330- inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state331331- was inconsistent. In the error case, msg may be set but then points to a332332- static string (which must not be deallocated).333333-*/334334-335335- /* advanced functions */336336-337337-extern int inflateInit2 OF((z_stream *strm,338338- int windowBits));339339-/*340340- This is another version of inflateInit with more compression options. The341341- fields next_out, zalloc and zfree must be initialized before by the caller.342342-343343- The windowBits parameter is the base two logarithm of the maximum window344344- size (the size of the history buffer). It should be in the range 8..15 for345345- this version of the library (the value 16 will be allowed soon). The346346- default value is 15 if inflateInit is used instead. If a compressed stream347347- with a larger window size is given as input, inflate() will return with348348- the error code Z_DATA_ERROR instead of trying to allocate a larger window.349349-350350- If next_out is not null, the library will use this buffer for the history351351- buffer; the buffer must either be large enough to hold the entire output352352- data, or have at least 1<<windowBits bytes. If next_out is null, the353353- library will allocate its own buffer (and leave next_out null). next_in354354- need not be provided here but must be provided by the application for the355355- next call of inflate().356356-357357- If the history buffer is provided by the application, next_out must358358- never be changed by the application since the decompressor maintains359359- history information inside this buffer from call to call; the application360360- can only reset next_out to the beginning of the history buffer when361361- avail_out is zero and all output has been consumed.362362-363363- inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was364364- not enough memory, Z_STREAM_ERROR if a parameter is invalid (such as365365- windowBits < 8). msg is set to null if there is no error message.366366- inflateInit2 does not perform any decompression: this will be done by367367- inflate().368368-*/369369-370370-extern int inflateSync OF((z_stream *strm));371371-/*372372- Skips invalid compressed data until the special marker (see deflate()373373- above) can be found, or until all available input is skipped. No output374374- is provided.375375-376376- inflateSync returns Z_OK if the special marker has been found, Z_BUF_ERROR377377- if no more input was provided, Z_DATA_ERROR if no marker has been found,378378- or Z_STREAM_ERROR if the stream structure was inconsistent. In the success379379- case, the application may save the current current value of total_in which380380- indicates where valid compressed data was found. In the error case, the381381- application may repeatedly call inflateSync, providing more input each time,382382- until success or end of the input data.383383-*/384384-385385-extern int inflateReset OF((z_stream *strm));386386-/*387387- This function is equivalent to inflateEnd followed by inflateInit,388388- but does not free and reallocate all the internal decompression state.389389- The stream will keep attributes that may have been set by inflateInit2.390390-391391- inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source392392- stream state was inconsistent (such as zalloc or state being NULL).393393-*/394394-395395-extern int inflateIncomp OF((z_stream *strm));396396-/*397397- This function adds the data at next_in (avail_in bytes) to the output398398- history without performing any output. There must be no pending output,399399- and the decompressor must be expecting to see the start of a block.400400- Calling this function is equivalent to decompressing a stored block401401- containing the data at next_in (except that the data is not output).402402-*/403403-404404- /* checksum functions */405405-406406-/*407407- This function is not related to compression but is exported408408- anyway because it might be useful in applications using the409409- compression library.410410-*/411411-412412-extern uLong adler32 OF((uLong adler, Bytef *buf, uInt len));413413-414414-/*415415- Update a running Adler-32 checksum with the bytes buf[0..len-1] and416416- return the updated checksum. If buf is NULL, this function returns417417- the required initial value for the checksum.418418- An Adler-32 checksum is almost as reliable as a CRC32 but can be computed419419- much faster. Usage example:420420-421421- uLong adler = adler32(0L, Z_NULL, 0);422422-423423- while (read_buffer(buffer, length) != EOF) {424424- adler = adler32(adler, buffer, length);425425- }426426- if (adler != original_adler) error();427427-*/428428-429429-#ifndef _Z_UTIL_H430430- struct internal_state {int dummy;}; /* hack for buggy compilers */431431-#endif432432-433433-#endif /* _ZLIB_H */
···11-/*22- * arch/xtensa/lib/memcpy.S33- *44- * ANSI C standard library function memcpy55- *66- * This file is subject to the terms and conditions of the GNU General77- * Public License. See the file "COPYING" in the main directory of88- * this archive for more details.99- *1010- * Copyright (C) 2002 Tensilica Inc.1111- */1212-1313-#define _ASMLANGUAGE1414-#include <xtensa/config/core.h>1515-1616-.text1717-.align 41818-.global bcopy1919-.type bcopy,@function2020-bcopy:2121- movi a14, xthal_bcopy // a14 safe to use regardless of whether caller2222- // used call4 or call8 (can't have used call12)2323- jx a14 // let the Core HAL do the work2424-2525-.text2626-.align 42727-.global memcpy2828-.type memcpy,@function2929-memcpy:3030-.global memmove3131-.type memmove,@function3232-memmove:3333- movi a14, xthal_memcpy // a14 safe to use regardless of whether caller3434- // used call4 or call8 (can't have used call12)3535- jx a14 // let the Core HAL do the work3636-
-2150
arch/xtensa/boot/lib/zlib.c
···11-/*22- * BK Id: SCCS/s.zlib.c 1.8 05/18/01 15:17:24 cort33- */44-/*55- * This file is derived from various .h and .c files from the zlib-0.9566- * distribution by Jean-loup Gailly and Mark Adler, with some additions77- * by Paul Mackerras to aid in implementing Deflate compression and88- * decompression for PPP packets. See zlib.h for conditions of99- * distribution and use.1010- *1111- * Changes that have been made include:1212- * - changed functions not used outside this file to "local"1313- * - added minCompression parameter to deflateInit21414- * - added Z_PACKET_FLUSH (see zlib.h for details)1515- * - added inflateIncomp1616- *1717- */1818-1919-/*+++++*/2020-/* zutil.h -- internal interface and configuration of the compression library2121- * Copyright (C) 1995 Jean-loup Gailly.2222- * For conditions of distribution and use, see copyright notice in zlib.h2323- */2424-2525-/* WARNING: this file should *not* be used by applications. It is2626- part of the implementation of the compression library and is2727- subject to change. Applications should only use zlib.h.2828- */2929-3030-/* From: zutil.h,v 1.9 1995/05/03 17:27:12 jloup Exp */3131-3232-#define _Z_UTIL_H3333-3434-#include "zlib.h"3535-3636-#ifndef local3737-# define local static3838-#endif3939-/* compile with -Dlocal if your debugger can't find static symbols */4040-4141-#define FAR4242-4343-typedef unsigned char uch;4444-typedef uch FAR uchf;4545-typedef unsigned short ush;4646-typedef ush FAR ushf;4747-typedef unsigned long ulg;4848-4949-extern char *z_errmsg[]; /* indexed by 1-zlib_error */5050-5151-#define ERR_RETURN(strm,err) return (strm->msg=z_errmsg[1-err], err)5252-/* To be used only when the state is known to be valid */5353-5454-#ifndef NULL5555-#define NULL ((void *) 0)5656-#endif5757-5858- /* common constants */5959-6060-#define DEFLATED 86161-6262-#ifndef DEF_WBITS6363-# define DEF_WBITS MAX_WBITS6464-#endif6565-/* default windowBits for decompression. MAX_WBITS is for compression only */6666-6767-#if MAX_MEM_LEVEL >= 86868-# define DEF_MEM_LEVEL 86969-#else7070-# define DEF_MEM_LEVEL MAX_MEM_LEVEL7171-#endif7272-/* default memLevel */7373-7474-#define STORED_BLOCK 07575-#define STATIC_TREES 17676-#define DYN_TREES 27777-/* The three kinds of block type */7878-7979-#define MIN_MATCH 38080-#define MAX_MATCH 2588181-/* The minimum and maximum match lengths */8282-8383- /* functions */8484-8585-#include <linux/string.h>8686-#define zmemcpy memcpy8787-#define zmemzero(dest, len) memset(dest, 0, len)8888-8989-/* Diagnostic functions */9090-#ifdef DEBUG_ZLIB9191-# include <stdio.h>9292-# ifndef verbose9393-# define verbose 09494-# endif9595-# define Assert(cond,msg) {if(!(cond)) z_error(msg);}9696-# define Trace(x) fprintf x9797-# define Tracev(x) {if (verbose) fprintf x ;}9898-# define Tracevv(x) {if (verbose>1) fprintf x ;}9999-# define Tracec(c,x) {if (verbose && (c)) fprintf x ;}100100-# define Tracecv(c,x) {if (verbose>1 && (c)) fprintf x ;}101101-#else102102-# define Assert(cond,msg)103103-# define Trace(x)104104-# define Tracev(x)105105-# define Tracevv(x)106106-# define Tracec(c,x)107107-# define Tracecv(c,x)108108-#endif109109-110110-111111-typedef uLong (*check_func) OF((uLong check, Bytef *buf, uInt len));112112-113113-/* voidpf zcalloc OF((voidpf opaque, unsigned items, unsigned size)); */114114-/* void zcfree OF((voidpf opaque, voidpf ptr)); */115115-116116-#define ZALLOC(strm, items, size) \117117- (*((strm)->zalloc))((strm)->opaque, (items), (size))118118-#define ZFREE(strm, addr, size) \119119- (*((strm)->zfree))((strm)->opaque, (voidpf)(addr), (size))120120-#define TRY_FREE(s, p, n) {if (p) ZFREE(s, p, n);}121121-122122-/* deflate.h -- internal compression state123123- * Copyright (C) 1995 Jean-loup Gailly124124- * For conditions of distribution and use, see copyright notice in zlib.h125125- */126126-127127-/* WARNING: this file should *not* be used by applications. It is128128- part of the implementation of the compression library and is129129- subject to change. Applications should only use zlib.h.130130- */131131-132132-/*+++++*/133133-/* infblock.h -- header to use infblock.c134134- * Copyright (C) 1995 Mark Adler135135- * For conditions of distribution and use, see copyright notice in zlib.h136136- */137137-138138-/* WARNING: this file should *not* be used by applications. It is139139- part of the implementation of the compression library and is140140- subject to change. Applications should only use zlib.h.141141- */142142-143143-struct inflate_blocks_state;144144-typedef struct inflate_blocks_state FAR inflate_blocks_statef;145145-146146-local inflate_blocks_statef * inflate_blocks_new OF((147147- z_stream *z,148148- check_func c, /* check function */149149- uInt w)); /* window size */150150-151151-local int inflate_blocks OF((152152- inflate_blocks_statef *,153153- z_stream *,154154- int)); /* initial return code */155155-156156-local void inflate_blocks_reset OF((157157- inflate_blocks_statef *,158158- z_stream *,159159- uLongf *)); /* check value on output */160160-161161-local int inflate_blocks_free OF((162162- inflate_blocks_statef *,163163- z_stream *,164164- uLongf *)); /* check value on output */165165-166166-local int inflate_addhistory OF((167167- inflate_blocks_statef *,168168- z_stream *));169169-170170-local int inflate_packet_flush OF((171171- inflate_blocks_statef *));172172-173173-/*+++++*/174174-/* inftrees.h -- header to use inftrees.c175175- * Copyright (C) 1995 Mark Adler176176- * For conditions of distribution and use, see copyright notice in zlib.h177177- */178178-179179-/* WARNING: this file should *not* be used by applications. It is180180- part of the implementation of the compression library and is181181- subject to change. Applications should only use zlib.h.182182- */183183-184184-/* Huffman code lookup table entry--this entry is four bytes for machines185185- that have 16-bit pointers (e.g. PC's in the small or medium model). */186186-187187-typedef struct inflate_huft_s FAR inflate_huft;188188-189189-struct inflate_huft_s {190190- union {191191- struct {192192- Byte Exop; /* number of extra bits or operation */193193- Byte Bits; /* number of bits in this code or subcode */194194- } what;195195- uInt Nalloc; /* number of these allocated here */196196- Bytef *pad; /* pad structure to a power of 2 (4 bytes for */197197- } word; /* 16-bit, 8 bytes for 32-bit machines) */198198- union {199199- uInt Base; /* literal, length base, or distance base */200200- inflate_huft *Next; /* pointer to next level of table */201201- } more;202202-};203203-204204-#ifdef DEBUG_ZLIB205205- local uInt inflate_hufts;206206-#endif207207-208208-local int inflate_trees_bits OF((209209- uIntf *, /* 19 code lengths */210210- uIntf *, /* bits tree desired/actual depth */211211- inflate_huft * FAR *, /* bits tree result */212212- z_stream *)); /* for zalloc, zfree functions */213213-214214-local int inflate_trees_dynamic OF((215215- uInt, /* number of literal/length codes */216216- uInt, /* number of distance codes */217217- uIntf *, /* that many (total) code lengths */218218- uIntf *, /* literal desired/actual bit depth */219219- uIntf *, /* distance desired/actual bit depth */220220- inflate_huft * FAR *, /* literal/length tree result */221221- inflate_huft * FAR *, /* distance tree result */222222- z_stream *)); /* for zalloc, zfree functions */223223-224224-local int inflate_trees_fixed OF((225225- uIntf *, /* literal desired/actual bit depth */226226- uIntf *, /* distance desired/actual bit depth */227227- inflate_huft * FAR *, /* literal/length tree result */228228- inflate_huft * FAR *)); /* distance tree result */229229-230230-local int inflate_trees_free OF((231231- inflate_huft *, /* tables to free */232232- z_stream *)); /* for zfree function */233233-234234-235235-/*+++++*/236236-/* infcodes.h -- header to use infcodes.c237237- * Copyright (C) 1995 Mark Adler238238- * For conditions of distribution and use, see copyright notice in zlib.h239239- */240240-241241-/* WARNING: this file should *not* be used by applications. It is242242- part of the implementation of the compression library and is243243- subject to change. Applications should only use zlib.h.244244- */245245-246246-struct inflate_codes_state;247247-typedef struct inflate_codes_state FAR inflate_codes_statef;248248-249249-local inflate_codes_statef *inflate_codes_new OF((250250- uInt, uInt,251251- inflate_huft *, inflate_huft *,252252- z_stream *));253253-254254-local int inflate_codes OF((255255- inflate_blocks_statef *,256256- z_stream *,257257- int));258258-259259-local void inflate_codes_free OF((260260- inflate_codes_statef *,261261- z_stream *));262262-263263-264264-/*+++++*/265265-/* inflate.c -- zlib interface to inflate modules266266- * Copyright (C) 1995 Mark Adler267267- * For conditions of distribution and use, see copyright notice in zlib.h268268- */269269-270270-/* inflate private state */271271-struct internal_state {272272-273273- /* mode */274274- enum {275275- METHOD, /* waiting for method byte */276276- FLAG, /* waiting for flag byte */277277- BLOCKS, /* decompressing blocks */278278- CHECK4, /* four check bytes to go */279279- CHECK3, /* three check bytes to go */280280- CHECK2, /* two check bytes to go */281281- CHECK1, /* one check byte to go */282282- DONE, /* finished check, done */283283- BAD} /* got an error--stay here */284284- mode; /* current inflate mode */285285-286286- /* mode dependent information */287287- union {288288- uInt method; /* if FLAGS, method byte */289289- struct {290290- uLong was; /* computed check value */291291- uLong need; /* stream check value */292292- } check; /* if CHECK, check values to compare */293293- uInt marker; /* if BAD, inflateSync's marker bytes count */294294- } sub; /* submode */295295-296296- /* mode independent information */297297- int nowrap; /* flag for no wrapper */298298- uInt wbits; /* log2(window size) (8..15, defaults to 15) */299299- inflate_blocks_statef300300- *blocks; /* current inflate_blocks state */301301-302302-};303303-304304-305305-int inflateReset(z)306306-z_stream *z;307307-{308308- uLong c;309309-310310- if (z == Z_NULL || z->state == Z_NULL)311311- return Z_STREAM_ERROR;312312- z->total_in = z->total_out = 0;313313- z->msg = Z_NULL;314314- z->state->mode = z->state->nowrap ? BLOCKS : METHOD;315315- inflate_blocks_reset(z->state->blocks, z, &c);316316- Trace((stderr, "inflate: reset\n"));317317- return Z_OK;318318-}319319-320320-321321-int inflateEnd(z)322322-z_stream *z;323323-{324324- uLong c;325325-326326- if (z == Z_NULL || z->state == Z_NULL || z->zfree == Z_NULL)327327- return Z_STREAM_ERROR;328328- if (z->state->blocks != Z_NULL)329329- inflate_blocks_free(z->state->blocks, z, &c);330330- ZFREE(z, z->state, sizeof(struct internal_state));331331- z->state = Z_NULL;332332- Trace((stderr, "inflate: end\n"));333333- return Z_OK;334334-}335335-336336-337337-int inflateInit2(z, w)338338-z_stream *z;339339-int w;340340-{341341- /* initialize state */342342- if (z == Z_NULL)343343- return Z_STREAM_ERROR;344344-/* if (z->zalloc == Z_NULL) z->zalloc = zcalloc; */345345-/* if (z->zfree == Z_NULL) z->zfree = zcfree; */346346- if ((z->state = (struct internal_state FAR *)347347- ZALLOC(z,1,sizeof(struct internal_state))) == Z_NULL)348348- return Z_MEM_ERROR;349349- z->state->blocks = Z_NULL;350350-351351- /* handle undocumented nowrap option (no zlib header or check) */352352- z->state->nowrap = 0;353353- if (w < 0)354354- {355355- w = - w;356356- z->state->nowrap = 1;357357- }358358-359359- /* set window size */360360- if (w < 8 || w > 15)361361- {362362- inflateEnd(z);363363- return Z_STREAM_ERROR;364364- }365365- z->state->wbits = (uInt)w;366366-367367- /* create inflate_blocks state */368368- if ((z->state->blocks =369369- inflate_blocks_new(z, z->state->nowrap ? Z_NULL : adler32, 1 << w))370370- == Z_NULL)371371- {372372- inflateEnd(z);373373- return Z_MEM_ERROR;374374- }375375- Trace((stderr, "inflate: allocated\n"));376376-377377- /* reset state */378378- inflateReset(z);379379- return Z_OK;380380-}381381-382382-383383-int inflateInit(z)384384-z_stream *z;385385-{386386- return inflateInit2(z, DEF_WBITS);387387-}388388-389389-390390-#define NEEDBYTE {if(z->avail_in==0)goto empty;r=Z_OK;}391391-#define NEXTBYTE (z->avail_in--,z->total_in++,*z->next_in++)392392-393393-int inflate(z, f)394394-z_stream *z;395395-int f;396396-{397397- int r;398398- uInt b;399399-400400- if (z == Z_NULL || z->next_in == Z_NULL)401401- return Z_STREAM_ERROR;402402- r = Z_BUF_ERROR;403403- while (1) switch (z->state->mode)404404- {405405- case METHOD:406406- NEEDBYTE407407- if (((z->state->sub.method = NEXTBYTE) & 0xf) != DEFLATED)408408- {409409- z->state->mode = BAD;410410- z->msg = "unknown compression method";411411- z->state->sub.marker = 5; /* can't try inflateSync */412412- break;413413- }414414- if ((z->state->sub.method >> 4) + 8 > z->state->wbits)415415- {416416- z->state->mode = BAD;417417- z->msg = "invalid window size";418418- z->state->sub.marker = 5; /* can't try inflateSync */419419- break;420420- }421421- z->state->mode = FLAG;422422- case FLAG:423423- NEEDBYTE424424- if ((b = NEXTBYTE) & 0x20)425425- {426426- z->state->mode = BAD;427427- z->msg = "invalid reserved bit";428428- z->state->sub.marker = 5; /* can't try inflateSync */429429- break;430430- }431431- if (((z->state->sub.method << 8) + b) % 31)432432- {433433- z->state->mode = BAD;434434- z->msg = "incorrect header check";435435- z->state->sub.marker = 5; /* can't try inflateSync */436436- break;437437- }438438- Trace((stderr, "inflate: zlib header ok\n"));439439- z->state->mode = BLOCKS;440440- case BLOCKS:441441- r = inflate_blocks(z->state->blocks, z, r);442442- if (f == Z_PACKET_FLUSH && z->avail_in == 0 && z->avail_out != 0)443443- r = inflate_packet_flush(z->state->blocks);444444- if (r == Z_DATA_ERROR)445445- {446446- z->state->mode = BAD;447447- z->state->sub.marker = 0; /* can try inflateSync */448448- break;449449- }450450- if (r != Z_STREAM_END)451451- return r;452452- r = Z_OK;453453- inflate_blocks_reset(z->state->blocks, z, &z->state->sub.check.was);454454- if (z->state->nowrap)455455- {456456- z->state->mode = DONE;457457- break;458458- }459459- z->state->mode = CHECK4;460460- case CHECK4:461461- NEEDBYTE462462- z->state->sub.check.need = (uLong)NEXTBYTE << 24;463463- z->state->mode = CHECK3;464464- case CHECK3:465465- NEEDBYTE466466- z->state->sub.check.need += (uLong)NEXTBYTE << 16;467467- z->state->mode = CHECK2;468468- case CHECK2:469469- NEEDBYTE470470- z->state->sub.check.need += (uLong)NEXTBYTE << 8;471471- z->state->mode = CHECK1;472472- case CHECK1:473473- NEEDBYTE474474- z->state->sub.check.need += (uLong)NEXTBYTE;475475-476476- if (z->state->sub.check.was != z->state->sub.check.need)477477- {478478- z->state->mode = BAD;479479- z->msg = "incorrect data check";480480- z->state->sub.marker = 5; /* can't try inflateSync */481481- break;482482- }483483- Trace((stderr, "inflate: zlib check ok\n"));484484- z->state->mode = DONE;485485- case DONE:486486- return Z_STREAM_END;487487- case BAD:488488- return Z_DATA_ERROR;489489- default:490490- return Z_STREAM_ERROR;491491- }492492-493493- empty:494494- if (f != Z_PACKET_FLUSH)495495- return r;496496- z->state->mode = BAD;497497- z->state->sub.marker = 0; /* can try inflateSync */498498- return Z_DATA_ERROR;499499-}500500-501501-/*502502- * This subroutine adds the data at next_in/avail_in to the output history503503- * without performing any output. The output buffer must be "caught up";504504- * i.e. no pending output (hence s->read equals s->write), and the state must505505- * be BLOCKS (i.e. we should be willing to see the start of a series of506506- * BLOCKS). On exit, the output will also be caught up, and the checksum507507- * will have been updated if need be.508508- */509509-510510-int inflateIncomp(z)511511-z_stream *z;512512-{513513- if (z->state->mode != BLOCKS)514514- return Z_DATA_ERROR;515515- return inflate_addhistory(z->state->blocks, z);516516-}517517-518518-519519-int inflateSync(z)520520-z_stream *z;521521-{522522- uInt n; /* number of bytes to look at */523523- Bytef *p; /* pointer to bytes */524524- uInt m; /* number of marker bytes found in a row */525525- uLong r, w; /* temporaries to save total_in and total_out */526526-527527- /* set up */528528- if (z == Z_NULL || z->state == Z_NULL)529529- return Z_STREAM_ERROR;530530- if (z->state->mode != BAD)531531- {532532- z->state->mode = BAD;533533- z->state->sub.marker = 0;534534- }535535- if ((n = z->avail_in) == 0)536536- return Z_BUF_ERROR;537537- p = z->next_in;538538- m = z->state->sub.marker;539539-540540- /* search */541541- while (n && m < 4)542542- {543543- if (*p == (Byte)(m < 2 ? 0 : 0xff))544544- m++;545545- else if (*p)546546- m = 0;547547- else548548- m = 4 - m;549549- p++, n--;550550- }551551-552552- /* restore */553553- z->total_in += p - z->next_in;554554- z->next_in = p;555555- z->avail_in = n;556556- z->state->sub.marker = m;557557-558558- /* return no joy or set up to restart on a new block */559559- if (m != 4)560560- return Z_DATA_ERROR;561561- r = z->total_in; w = z->total_out;562562- inflateReset(z);563563- z->total_in = r; z->total_out = w;564564- z->state->mode = BLOCKS;565565- return Z_OK;566566-}567567-568568-#undef NEEDBYTE569569-#undef NEXTBYTE570570-571571-/*+++++*/572572-/* infutil.h -- types and macros common to blocks and codes573573- * Copyright (C) 1995 Mark Adler574574- * For conditions of distribution and use, see copyright notice in zlib.h575575- */576576-577577-/* WARNING: this file should *not* be used by applications. It is578578- part of the implementation of the compression library and is579579- subject to change. Applications should only use zlib.h.580580- */581581-582582-/* inflate blocks semi-private state */583583-struct inflate_blocks_state {584584-585585- /* mode */586586- enum {587587- TYPE, /* get type bits (3, including end bit) */588588- LENS, /* get lengths for stored */589589- STORED, /* processing stored block */590590- TABLE, /* get table lengths */591591- BTREE, /* get bit lengths tree for a dynamic block */592592- DTREE, /* get length, distance trees for a dynamic block */593593- CODES, /* processing fixed or dynamic block */594594- DRY, /* output remaining window bytes */595595- DONEB, /* finished last block, done */596596- BADB} /* got a data error--stuck here */597597- mode; /* current inflate_block mode */598598-599599- /* mode dependent information */600600- union {601601- uInt left; /* if STORED, bytes left to copy */602602- struct {603603- uInt table; /* table lengths (14 bits) */604604- uInt index; /* index into blens (or border) */605605- uIntf *blens; /* bit lengths of codes */606606- uInt bb; /* bit length tree depth */607607- inflate_huft *tb; /* bit length decoding tree */608608- int nblens; /* # elements allocated at blens */609609- } trees; /* if DTREE, decoding info for trees */610610- struct {611611- inflate_huft *tl, *td; /* trees to free */612612- inflate_codes_statef613613- *codes;614614- } decode; /* if CODES, current state */615615- } sub; /* submode */616616- uInt last; /* true if this block is the last block */617617-618618- /* mode independent information */619619- uInt bitk; /* bits in bit buffer */620620- uLong bitb; /* bit buffer */621621- Bytef *window; /* sliding window */622622- Bytef *end; /* one byte after sliding window */623623- Bytef *read; /* window read pointer */624624- Bytef *write; /* window write pointer */625625- check_func checkfn; /* check function */626626- uLong check; /* check on output */627627-628628-};629629-630630-631631-/* defines for inflate input/output */632632-/* update pointers and return */633633-#define UPDBITS {s->bitb=b;s->bitk=k;}634634-#define UPDIN {z->avail_in=n;z->total_in+=p-z->next_in;z->next_in=p;}635635-#define UPDOUT {s->write=q;}636636-#define UPDATE {UPDBITS UPDIN UPDOUT}637637-#define LEAVE {UPDATE return inflate_flush(s,z,r);}638638-/* get bytes and bits */639639-#define LOADIN {p=z->next_in;n=z->avail_in;b=s->bitb;k=s->bitk;}640640-#define NEEDBYTE {if(n)r=Z_OK;else LEAVE}641641-#define NEXTBYTE (n--,*p++)642642-#define NEEDBITS(j) {while(k<(j)){NEEDBYTE;b|=((uLong)NEXTBYTE)<<k;k+=8;}}643643-#define DUMPBITS(j) {b>>=(j);k-=(j);}644644-/* output bytes */645645-#define WAVAIL (q<s->read?s->read-q-1:s->end-q)646646-#define LOADOUT {q=s->write;m=WAVAIL;}647647-#define WRAP {if(q==s->end&&s->read!=s->window){q=s->window;m=WAVAIL;}}648648-#define FLUSH {UPDOUT r=inflate_flush(s,z,r); LOADOUT}649649-#define NEEDOUT {if(m==0){WRAP if(m==0){FLUSH WRAP if(m==0) LEAVE}}r=Z_OK;}650650-#define OUTBYTE(a) {*q++=(Byte)(a);m--;}651651-/* load local pointers */652652-#define LOAD {LOADIN LOADOUT}653653-654654-/*655655- * The IBM 150 firmware munges the data right after _etext[]. This656656- * protects it. -- Cort657657- */658658-local uInt protect_mask[] = {0, 0, 0, 0, 0, 0, 0, 0, 0 ,0 ,0 ,0};659659-/* And'ing with mask[n] masks the lower n bits */660660-local uInt inflate_mask[] = {661661- 0x0000,662662- 0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff,663663- 0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff664664-};665665-666666-/* copy as much as possible from the sliding window to the output area */667667-local int inflate_flush OF((668668- inflate_blocks_statef *,669669- z_stream *,670670- int));671671-672672-/*+++++*/673673-/* inffast.h -- header to use inffast.c674674- * Copyright (C) 1995 Mark Adler675675- * For conditions of distribution and use, see copyright notice in zlib.h676676- */677677-678678-/* WARNING: this file should *not* be used by applications. It is679679- part of the implementation of the compression library and is680680- subject to change. Applications should only use zlib.h.681681- */682682-683683-local int inflate_fast OF((684684- uInt,685685- uInt,686686- inflate_huft *,687687- inflate_huft *,688688- inflate_blocks_statef *,689689- z_stream *));690690-691691-692692-/*+++++*/693693-/* infblock.c -- interpret and process block types to last block694694- * Copyright (C) 1995 Mark Adler695695- * For conditions of distribution and use, see copyright notice in zlib.h696696- */697697-698698-/* Table for deflate from PKZIP's appnote.txt. */699699-local uInt border[] = { /* Order of the bit length code lengths */700700- 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};701701-702702-/*703703- Notes beyond the 1.93a appnote.txt:704704-705705- 1. Distance pointers never point before the beginning of the output706706- stream.707707- 2. Distance pointers can point back across blocks, up to 32k away.708708- 3. There is an implied maximum of 7 bits for the bit length table and709709- 15 bits for the actual data.710710- 4. If only one code exists, then it is encoded using one bit. (Zero711711- would be more efficient, but perhaps a little confusing.) If two712712- codes exist, they are coded using one bit each (0 and 1).713713- 5. There is no way of sending zero distance codes--a dummy must be714714- sent if there are none. (History: a pre 2.0 version of PKZIP would715715- store blocks with no distance codes, but this was discovered to be716716- too harsh a criterion.) Valid only for 1.93a. 2.04c does allow717717- zero distance codes, which is sent as one code of zero bits in718718- length.719719- 6. There are up to 286 literal/length codes. Code 256 represents the720720- end-of-block. Note however that the static length tree defines721721- 288 codes just to fill out the Huffman codes. Codes 286 and 287722722- cannot be used though, since there is no length base or extra bits723723- defined for them. Similarily, there are up to 30 distance codes.724724- However, static trees define 32 codes (all 5 bits) to fill out the725725- Huffman codes, but the last two had better not show up in the data.726726- 7. Unzip can check dynamic Huffman blocks for complete code sets.727727- The exception is that a single code would not be complete (see #4).728728- 8. The five bits following the block type is really the number of729729- literal codes sent minus 257.730730- 9. Length codes 8,16,16 are interpreted as 13 length codes of 8 bits731731- (1+6+6). Therefore, to output three times the length, you output732732- three codes (1+1+1), whereas to output four times the same length,733733- you only need two codes (1+3). Hmm.734734- 10. In the tree reconstruction algorithm, Code = Code + Increment735735- only if BitLength(i) is not zero. (Pretty obvious.)736736- 11. Correction: 4 Bits: # of Bit Length codes - 4 (4 - 19)737737- 12. Note: length code 284 can represent 227-258, but length code 285738738- really is 258. The last length deserves its own, short code739739- since it gets used a lot in very redundant files. The length740740- 258 is special since 258 - 3 (the min match length) is 255.741741- 13. The literal/length and distance code bit lengths are read as a742742- single stream of lengths. It is possible (and advantageous) for743743- a repeat code (16, 17, or 18) to go across the boundary between744744- the two sets of lengths.745745- */746746-747747-748748-local void inflate_blocks_reset(s, z, c)749749-inflate_blocks_statef *s;750750-z_stream *z;751751-uLongf *c;752752-{753753- if (s->checkfn != Z_NULL)754754- *c = s->check;755755- if (s->mode == BTREE || s->mode == DTREE)756756- ZFREE(z, s->sub.trees.blens, s->sub.trees.nblens * sizeof(uInt));757757- if (s->mode == CODES)758758- {759759- inflate_codes_free(s->sub.decode.codes, z);760760- inflate_trees_free(s->sub.decode.td, z);761761- inflate_trees_free(s->sub.decode.tl, z);762762- }763763- s->mode = TYPE;764764- s->bitk = 0;765765- s->bitb = 0;766766- s->read = s->write = s->window;767767- if (s->checkfn != Z_NULL)768768- s->check = (*s->checkfn)(0L, Z_NULL, 0);769769- Trace((stderr, "inflate: blocks reset\n"));770770-}771771-772772-773773-local inflate_blocks_statef *inflate_blocks_new(z, c, w)774774-z_stream *z;775775-check_func c;776776-uInt w;777777-{778778- inflate_blocks_statef *s;779779-780780- if ((s = (inflate_blocks_statef *)ZALLOC781781- (z,1,sizeof(struct inflate_blocks_state))) == Z_NULL)782782- return s;783783- if ((s->window = (Bytef *)ZALLOC(z, 1, w)) == Z_NULL)784784- {785785- ZFREE(z, s, sizeof(struct inflate_blocks_state));786786- return Z_NULL;787787- }788788- s->end = s->window + w;789789- s->checkfn = c;790790- s->mode = TYPE;791791- Trace((stderr, "inflate: blocks allocated\n"));792792- inflate_blocks_reset(s, z, &s->check);793793- return s;794794-}795795-796796-797797-local int inflate_blocks(s, z, r)798798-inflate_blocks_statef *s;799799-z_stream *z;800800-int r;801801-{802802- uInt t; /* temporary storage */803803- uLong b; /* bit buffer */804804- uInt k; /* bits in bit buffer */805805- Bytef *p; /* input data pointer */806806- uInt n; /* bytes available there */807807- Bytef *q; /* output window write pointer */808808- uInt m; /* bytes to end of window or read pointer */809809-810810- /* copy input/output information to locals (UPDATE macro restores) */811811- LOAD812812-813813- /* process input based on current state */814814- while (1) switch (s->mode)815815- {816816- case TYPE:817817- NEEDBITS(3)818818- t = (uInt)b & 7;819819- s->last = t & 1;820820- switch (t >> 1)821821- {822822- case 0: /* stored */823823- Trace((stderr, "inflate: stored block%s\n",824824- s->last ? " (last)" : ""));825825- DUMPBITS(3)826826- t = k & 7; /* go to byte boundary */827827- DUMPBITS(t)828828- s->mode = LENS; /* get length of stored block */829829- break;830830- case 1: /* fixed */831831- Trace((stderr, "inflate: fixed codes block%s\n",832832- s->last ? " (last)" : ""));833833- {834834- uInt bl, bd;835835- inflate_huft *tl, *td;836836-837837- inflate_trees_fixed(&bl, &bd, &tl, &td);838838- s->sub.decode.codes = inflate_codes_new(bl, bd, tl, td, z);839839- if (s->sub.decode.codes == Z_NULL)840840- {841841- r = Z_MEM_ERROR;842842- LEAVE843843- }844844- s->sub.decode.tl = Z_NULL; /* don't try to free these */845845- s->sub.decode.td = Z_NULL;846846- }847847- DUMPBITS(3)848848- s->mode = CODES;849849- break;850850- case 2: /* dynamic */851851- Trace((stderr, "inflate: dynamic codes block%s\n",852852- s->last ? " (last)" : ""));853853- DUMPBITS(3)854854- s->mode = TABLE;855855- break;856856- case 3: /* illegal */857857- DUMPBITS(3)858858- s->mode = BADB;859859- z->msg = "invalid block type";860860- r = Z_DATA_ERROR;861861- LEAVE862862- }863863- break;864864- case LENS:865865- NEEDBITS(32)866866- if (((~b) >> 16) != (b & 0xffff))867867- {868868- s->mode = BADB;869869- z->msg = "invalid stored block lengths";870870- r = Z_DATA_ERROR;871871- LEAVE872872- }873873- s->sub.left = (uInt)b & 0xffff;874874- b = k = 0; /* dump bits */875875- Tracev((stderr, "inflate: stored length %u\n", s->sub.left));876876- s->mode = s->sub.left ? STORED : TYPE;877877- break;878878- case STORED:879879- if (n == 0)880880- LEAVE881881- NEEDOUT882882- t = s->sub.left;883883- if (t > n) t = n;884884- if (t > m) t = m;885885- zmemcpy(q, p, t);886886- p += t; n -= t;887887- q += t; m -= t;888888- if ((s->sub.left -= t) != 0)889889- break;890890- Tracev((stderr, "inflate: stored end, %lu total out\n",891891- z->total_out + (q >= s->read ? q - s->read :892892- (s->end - s->read) + (q - s->window))));893893- s->mode = s->last ? DRY : TYPE;894894- break;895895- case TABLE:896896- NEEDBITS(14)897897- s->sub.trees.table = t = (uInt)b & 0x3fff;898898-#ifndef PKZIP_BUG_WORKAROUND899899- if ((t & 0x1f) > 29 || ((t >> 5) & 0x1f) > 29)900900- {901901- s->mode = BADB;902902- z->msg = "too many length or distance symbols";903903- r = Z_DATA_ERROR;904904- LEAVE905905- }906906-#endif907907- t = 258 + (t & 0x1f) + ((t >> 5) & 0x1f);908908- if (t < 19)909909- t = 19;910910- if ((s->sub.trees.blens = (uIntf*)ZALLOC(z, t, sizeof(uInt))) == Z_NULL)911911- {912912- r = Z_MEM_ERROR;913913- LEAVE914914- }915915- s->sub.trees.nblens = t;916916- DUMPBITS(14)917917- s->sub.trees.index = 0;918918- Tracev((stderr, "inflate: table sizes ok\n"));919919- s->mode = BTREE;920920- case BTREE:921921- while (s->sub.trees.index < 4 + (s->sub.trees.table >> 10))922922- {923923- NEEDBITS(3)924924- s->sub.trees.blens[border[s->sub.trees.index++]] = (uInt)b & 7;925925- DUMPBITS(3)926926- }927927- while (s->sub.trees.index < 19)928928- s->sub.trees.blens[border[s->sub.trees.index++]] = 0;929929- s->sub.trees.bb = 7;930930- t = inflate_trees_bits(s->sub.trees.blens, &s->sub.trees.bb,931931- &s->sub.trees.tb, z);932932- if (t != Z_OK)933933- {934934- r = t;935935- if (r == Z_DATA_ERROR)936936- s->mode = BADB;937937- LEAVE938938- }939939- s->sub.trees.index = 0;940940- Tracev((stderr, "inflate: bits tree ok\n"));941941- s->mode = DTREE;942942- case DTREE:943943- while (t = s->sub.trees.table,944944- s->sub.trees.index < 258 + (t & 0x1f) + ((t >> 5) & 0x1f))945945- {946946- inflate_huft *h;947947- uInt i, j, c;948948-949949- t = s->sub.trees.bb;950950- NEEDBITS(t)951951- h = s->sub.trees.tb + ((uInt)b & inflate_mask[t]);952952- t = h->word.what.Bits;953953- c = h->more.Base;954954- if (c < 16)955955- {956956- DUMPBITS(t)957957- s->sub.trees.blens[s->sub.trees.index++] = c;958958- }959959- else /* c == 16..18 */960960- {961961- i = c == 18 ? 7 : c - 14;962962- j = c == 18 ? 11 : 3;963963- NEEDBITS(t + i)964964- DUMPBITS(t)965965- j += (uInt)b & inflate_mask[i];966966- DUMPBITS(i)967967- i = s->sub.trees.index;968968- t = s->sub.trees.table;969969- if (i + j > 258 + (t & 0x1f) + ((t >> 5) & 0x1f) ||970970- (c == 16 && i < 1))971971- {972972- s->mode = BADB;973973- z->msg = "invalid bit length repeat";974974- r = Z_DATA_ERROR;975975- LEAVE976976- }977977- c = c == 16 ? s->sub.trees.blens[i - 1] : 0;978978- do {979979- s->sub.trees.blens[i++] = c;980980- } while (--j);981981- s->sub.trees.index = i;982982- }983983- }984984- inflate_trees_free(s->sub.trees.tb, z);985985- s->sub.trees.tb = Z_NULL;986986- {987987- uInt bl, bd;988988- inflate_huft *tl, *td;989989- inflate_codes_statef *c;990990-991991- bl = 9; /* must be <= 9 for lookahead assumptions */992992- bd = 6; /* must be <= 9 for lookahead assumptions */993993- t = s->sub.trees.table;994994- t = inflate_trees_dynamic(257 + (t & 0x1f), 1 + ((t >> 5) & 0x1f),995995- s->sub.trees.blens, &bl, &bd, &tl, &td, z);996996- if (t != Z_OK)997997- {998998- if (t == (uInt)Z_DATA_ERROR)999999- s->mode = BADB;10001000- r = t;10011001- LEAVE10021002- }10031003- Tracev((stderr, "inflate: trees ok\n"));10041004- if ((c = inflate_codes_new(bl, bd, tl, td, z)) == Z_NULL)10051005- {10061006- inflate_trees_free(td, z);10071007- inflate_trees_free(tl, z);10081008- r = Z_MEM_ERROR;10091009- LEAVE10101010- }10111011- ZFREE(z, s->sub.trees.blens, s->sub.trees.nblens * sizeof(uInt));10121012- s->sub.decode.codes = c;10131013- s->sub.decode.tl = tl;10141014- s->sub.decode.td = td;10151015- }10161016- s->mode = CODES;10171017- case CODES:10181018- UPDATE10191019- if ((r = inflate_codes(s, z, r)) != Z_STREAM_END)10201020- return inflate_flush(s, z, r);10211021- r = Z_OK;10221022- inflate_codes_free(s->sub.decode.codes, z);10231023- inflate_trees_free(s->sub.decode.td, z);10241024- inflate_trees_free(s->sub.decode.tl, z);10251025- LOAD10261026- Tracev((stderr, "inflate: codes end, %lu total out\n",10271027- z->total_out + (q >= s->read ? q - s->read :10281028- (s->end - s->read) + (q - s->window))));10291029- if (!s->last)10301030- {10311031- s->mode = TYPE;10321032- break;10331033- }10341034- if (k > 7) /* return unused byte, if any */10351035- {10361036- Assert(k < 16, "inflate_codes grabbed too many bytes")10371037- k -= 8;10381038- n++;10391039- p--; /* can always return one */10401040- }10411041- s->mode = DRY;10421042- case DRY:10431043- FLUSH10441044- if (s->read != s->write)10451045- LEAVE10461046- s->mode = DONEB;10471047- case DONEB:10481048- r = Z_STREAM_END;10491049- LEAVE10501050- case BADB:10511051- r = Z_DATA_ERROR;10521052- LEAVE10531053- default:10541054- r = Z_STREAM_ERROR;10551055- LEAVE10561056- }10571057-}10581058-10591059-10601060-local int inflate_blocks_free(s, z, c)10611061-inflate_blocks_statef *s;10621062-z_stream *z;10631063-uLongf *c;10641064-{10651065- inflate_blocks_reset(s, z, c);10661066- ZFREE(z, s->window, s->end - s->window);10671067- ZFREE(z, s, sizeof(struct inflate_blocks_state));10681068- Trace((stderr, "inflate: blocks freed\n"));10691069- return Z_OK;10701070-}10711071-10721072-/*10731073- * This subroutine adds the data at next_in/avail_in to the output history10741074- * without performing any output. The output buffer must be "caught up";10751075- * i.e. no pending output (hence s->read equals s->write), and the state must10761076- * be BLOCKS (i.e. we should be willing to see the start of a series of10771077- * BLOCKS). On exit, the output will also be caught up, and the checksum10781078- * will have been updated if need be.10791079- */10801080-local int inflate_addhistory(s, z)10811081-inflate_blocks_statef *s;10821082-z_stream *z;10831083-{10841084- uLong b; /* bit buffer */ /* NOT USED HERE */10851085- uInt k; /* bits in bit buffer */ /* NOT USED HERE */10861086- uInt t; /* temporary storage */10871087- Bytef *p; /* input data pointer */10881088- uInt n; /* bytes available there */10891089- Bytef *q; /* output window write pointer */10901090- uInt m; /* bytes to end of window or read pointer */10911091-10921092- if (s->read != s->write)10931093- return Z_STREAM_ERROR;10941094- if (s->mode != TYPE)10951095- return Z_DATA_ERROR;10961096-10971097- /* we're ready to rock */10981098- LOAD10991099- /* while there is input ready, copy to output buffer, moving11001100- * pointers as needed.11011101- */11021102- while (n) {11031103- t = n; /* how many to do */11041104- /* is there room until end of buffer? */11051105- if (t > m) t = m;11061106- /* update check information */11071107- if (s->checkfn != Z_NULL)11081108- s->check = (*s->checkfn)(s->check, q, t);11091109- zmemcpy(q, p, t);11101110- q += t;11111111- p += t;11121112- n -= t;11131113- z->total_out += t;11141114- s->read = q; /* drag read pointer forward */11151115-/* WRAP */ /* expand WRAP macro by hand to handle s->read */11161116- if (q == s->end) {11171117- s->read = q = s->window;11181118- m = WAVAIL;11191119- }11201120- }11211121- UPDATE11221122- return Z_OK;11231123-}11241124-11251125-11261126-/*11271127- * At the end of a Deflate-compressed PPP packet, we expect to have seen11281128- * a `stored' block type value but not the (zero) length bytes.11291129- */11301130-local int inflate_packet_flush(s)11311131- inflate_blocks_statef *s;11321132-{11331133- if (s->mode != LENS)11341134- return Z_DATA_ERROR;11351135- s->mode = TYPE;11361136- return Z_OK;11371137-}11381138-11391139-11401140-/*+++++*/11411141-/* inftrees.c -- generate Huffman trees for efficient decoding11421142- * Copyright (C) 1995 Mark Adler11431143- * For conditions of distribution and use, see copyright notice in zlib.h11441144- */11451145-11461146-/* simplify the use of the inflate_huft type with some defines */11471147-#define base more.Base11481148-#define next more.Next11491149-#define exop word.what.Exop11501150-#define bits word.what.Bits11511151-11521152-11531153-local int huft_build OF((11541154- uIntf *, /* code lengths in bits */11551155- uInt, /* number of codes */11561156- uInt, /* number of "simple" codes */11571157- uIntf *, /* list of base values for non-simple codes */11581158- uIntf *, /* list of extra bits for non-simple codes */11591159- inflate_huft * FAR*,/* result: starting table */11601160- uIntf *, /* maximum lookup bits (returns actual) */11611161- z_stream *)); /* for zalloc function */11621162-11631163-local voidpf falloc OF((11641164- voidpf, /* opaque pointer (not used) */11651165- uInt, /* number of items */11661166- uInt)); /* size of item */11671167-11681168-local void ffree OF((11691169- voidpf q, /* opaque pointer (not used) */11701170- voidpf p, /* what to free (not used) */11711171- uInt n)); /* number of bytes (not used) */11721172-11731173-/* Tables for deflate from PKZIP's appnote.txt. */11741174-local uInt cplens[] = { /* Copy lengths for literal codes 257..285 */11751175- 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,11761176- 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};11771177- /* actually lengths - 2; also see note #13 above about 258 */11781178-local uInt cplext[] = { /* Extra bits for literal codes 257..285 */11791179- 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2,11801180- 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 192, 192}; /* 192==invalid */11811181-local uInt cpdist[] = { /* Copy offsets for distance codes 0..29 */11821182- 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,11831183- 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,11841184- 8193, 12289, 16385, 24577};11851185-local uInt cpdext[] = { /* Extra bits for distance codes */11861186- 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6,11871187- 7, 7, 8, 8, 9, 9, 10, 10, 11, 11,11881188- 12, 12, 13, 13};11891189-11901190-/*11911191- Huffman code decoding is performed using a multi-level table lookup.11921192- The fastest way to decode is to simply build a lookup table whose11931193- size is determined by the longest code. However, the time it takes11941194- to build this table can also be a factor if the data being decoded11951195- is not very long. The most common codes are necessarily the11961196- shortest codes, so those codes dominate the decoding time, and hence11971197- the speed. The idea is you can have a shorter table that decodes the11981198- shorter, more probable codes, and then point to subsidiary tables for11991199- the longer codes. The time it costs to decode the longer codes is12001200- then traded against the time it takes to make longer tables.12011201-12021202- This results of this trade are in the variables lbits and dbits12031203- below. lbits is the number of bits the first level table for literal/12041204- length codes can decode in one step, and dbits is the same thing for12051205- the distance codes. Subsequent tables are also less than or equal to12061206- those sizes. These values may be adjusted either when all of the12071207- codes are shorter than that, in which case the longest code length in12081208- bits is used, or when the shortest code is *longer* than the requested12091209- table size, in which case the length of the shortest code in bits is12101210- used.12111211-12121212- There are two different values for the two tables, since they code a12131213- different number of possibilities each. The literal/length table12141214- codes 286 possible values, or in a flat code, a little over eight12151215- bits. The distance table codes 30 possible values, or a little less12161216- than five bits, flat. The optimum values for speed end up being12171217- about one bit more than those, so lbits is 8+1 and dbits is 5+1.12181218- The optimum values may differ though from machine to machine, and12191219- possibly even between compilers. Your mileage may vary.12201220- */12211221-12221222-12231223-/* If BMAX needs to be larger than 16, then h and x[] should be uLong. */12241224-#define BMAX 15 /* maximum bit length of any code */12251225-#define N_MAX 288 /* maximum number of codes in any set */12261226-12271227-#ifdef DEBUG_ZLIB12281228- uInt inflate_hufts;12291229-#endif12301230-12311231-local int huft_build(b, n, s, d, e, t, m, zs)12321232-uIntf *b; /* code lengths in bits (all assumed <= BMAX) */12331233-uInt n; /* number of codes (assumed <= N_MAX) */12341234-uInt s; /* number of simple-valued codes (0..s-1) */12351235-uIntf *d; /* list of base values for non-simple codes */12361236-uIntf *e; /* list of extra bits for non-simple codes */12371237-inflate_huft * FAR *t; /* result: starting table */12381238-uIntf *m; /* maximum lookup bits, returns actual */12391239-z_stream *zs; /* for zalloc function */12401240-/* Given a list of code lengths and a maximum table size, make a set of12411241- tables to decode that set of codes. Return Z_OK on success, Z_BUF_ERROR12421242- if the given code set is incomplete (the tables are still built in this12431243- case), Z_DATA_ERROR if the input is invalid (all zero length codes or an12441244- over-subscribed set of lengths), or Z_MEM_ERROR if not enough memory. */12451245-{12461246-12471247- uInt a; /* counter for codes of length k */12481248- uInt c[BMAX+1]; /* bit length count table */12491249- uInt f; /* i repeats in table every f entries */12501250- int g; /* maximum code length */12511251- int h; /* table level */12521252- register uInt i; /* counter, current code */12531253- register uInt j; /* counter */12541254- register int k; /* number of bits in current code */12551255- int l; /* bits per table (returned in m) */12561256- register uIntf *p; /* pointer into c[], b[], or v[] */12571257- inflate_huft *q; /* points to current table */12581258- struct inflate_huft_s r; /* table entry for structure assignment */12591259- inflate_huft *u[BMAX]; /* table stack */12601260- uInt v[N_MAX]; /* values in order of bit length */12611261- register int w; /* bits before this table == (l * h) */12621262- uInt x[BMAX+1]; /* bit offsets, then code stack */12631263- uIntf *xp; /* pointer into x */12641264- int y; /* number of dummy codes added */12651265- uInt z; /* number of entries in current table */12661266-12671267-12681268- /* Generate counts for each bit length */12691269- p = c;12701270-#define C0 *p++ = 0;12711271-#define C2 C0 C0 C0 C012721272-#define C4 C2 C2 C2 C212731273- C4 /* clear c[]--assume BMAX+1 is 16 */12741274- p = b; i = n;12751275- do {12761276- c[*p++]++; /* assume all entries <= BMAX */12771277- } while (--i);12781278- if (c[0] == n) /* null input--all zero length codes */12791279- {12801280- *t = (inflate_huft *)Z_NULL;12811281- *m = 0;12821282- return Z_OK;12831283- }12841284-12851285-12861286- /* Find minimum and maximum length, bound *m by those */12871287- l = *m;12881288- for (j = 1; j <= BMAX; j++)12891289- if (c[j])12901290- break;12911291- k = j; /* minimum code length */12921292- if ((uInt)l < j)12931293- l = j;12941294- for (i = BMAX; i; i--)12951295- if (c[i])12961296- break;12971297- g = i; /* maximum code length */12981298- if ((uInt)l > i)12991299- l = i;13001300- *m = l;13011301-13021302-13031303- /* Adjust last length count to fill out codes, if needed */13041304- for (y = 1 << j; j < i; j++, y <<= 1)13051305- if ((y -= c[j]) < 0)13061306- return Z_DATA_ERROR;13071307- if ((y -= c[i]) < 0)13081308- return Z_DATA_ERROR;13091309- c[i] += y;13101310-13111311-13121312- /* Generate starting offsets into the value table for each length */13131313- x[1] = j = 0;13141314- p = c + 1; xp = x + 2;13151315- while (--i) { /* note that i == g from above */13161316- *xp++ = (j += *p++);13171317- }13181318-13191319-13201320- /* Make a table of values in order of bit lengths */13211321- p = b; i = 0;13221322- do {13231323- if ((j = *p++) != 0)13241324- v[x[j]++] = i;13251325- } while (++i < n);13261326-13271327-13281328- /* Generate the Huffman codes and for each, make the table entries */13291329- x[0] = i = 0; /* first Huffman code is zero */13301330- p = v; /* grab values in bit order */13311331- h = -1; /* no tables yet--level -1 */13321332- w = -l; /* bits decoded == (l * h) */13331333- u[0] = (inflate_huft *)Z_NULL; /* just to keep compilers happy */13341334- q = (inflate_huft *)Z_NULL; /* ditto */13351335- z = 0; /* ditto */13361336-13371337- /* go through the bit lengths (k already is bits in shortest code) */13381338- for (; k <= g; k++)13391339- {13401340- a = c[k];13411341- while (a--)13421342- {13431343- /* here i is the Huffman code of length k bits for value *p */13441344- /* make tables up to required level */13451345- while (k > w + l)13461346- {13471347- h++;13481348- w += l; /* previous table always l bits */13491349-13501350- /* compute minimum size table less than or equal to l bits */13511351- z = (z = g - w) > (uInt)l ? l : z; /* table size upper limit */13521352- if ((f = 1 << (j = k - w)) > a + 1) /* try a k-w bit table */13531353- { /* too few codes for k-w bit table */13541354- f -= a + 1; /* deduct codes from patterns left */13551355- xp = c + k;13561356- if (j < z)13571357- while (++j < z) /* try smaller tables up to z bits */13581358- {13591359- if ((f <<= 1) <= *++xp)13601360- break; /* enough codes to use up j bits */13611361- f -= *xp; /* else deduct codes from patterns */13621362- }13631363- }13641364- z = 1 << j; /* table entries for j-bit table */13651365-13661366- /* allocate and link in new table */13671367- if ((q = (inflate_huft *)ZALLOC13681368- (zs,z + 1,sizeof(inflate_huft))) == Z_NULL)13691369- {13701370- if (h)13711371- inflate_trees_free(u[0], zs);13721372- return Z_MEM_ERROR; /* not enough memory */13731373- }13741374- q->word.Nalloc = z + 1;13751375-#ifdef DEBUG_ZLIB13761376- inflate_hufts += z + 1;13771377-#endif13781378- *t = q + 1; /* link to list for huft_free() */13791379- *(t = &(q->next)) = Z_NULL;13801380- u[h] = ++q; /* table starts after link */13811381-13821382- /* connect to last table, if there is one */13831383- if (h)13841384- {13851385- x[h] = i; /* save pattern for backing up */13861386- r.bits = (Byte)l; /* bits to dump before this table */13871387- r.exop = (Byte)j; /* bits in this table */13881388- r.next = q; /* pointer to this table */13891389- j = i >> (w - l); /* (get around Turbo C bug) */13901390- u[h-1][j] = r; /* connect to last table */13911391- }13921392- }13931393-13941394- /* set up table entry in r */13951395- r.bits = (Byte)(k - w);13961396- if (p >= v + n)13971397- r.exop = 128 + 64; /* out of values--invalid code */13981398- else if (*p < s)13991399- {14001400- r.exop = (Byte)(*p < 256 ? 0 : 32 + 64); /* 256 is end-of-block */14011401- r.base = *p++; /* simple code is just the value */14021402- }14031403- else14041404- {14051405- r.exop = (Byte)e[*p - s] + 16 + 64; /* non-simple--look up in lists */14061406- r.base = d[*p++ - s];14071407- }14081408-14091409- /* fill code-like entries with r */14101410- f = 1 << (k - w);14111411- for (j = i >> w; j < z; j += f)14121412- q[j] = r;14131413-14141414- /* backwards increment the k-bit code i */14151415- for (j = 1 << (k - 1); i & j; j >>= 1)14161416- i ^= j;14171417- i ^= j;14181418-14191419- /* backup over finished tables */14201420- while ((i & ((1 << w) - 1)) != x[h])14211421- {14221422- h--; /* don't need to update q */14231423- w -= l;14241424- }14251425- }14261426- }14271427-14281428-14291429- /* Return Z_BUF_ERROR if we were given an incomplete table */14301430- return y != 0 && g != 1 ? Z_BUF_ERROR : Z_OK;14311431-}14321432-14331433-14341434-local int inflate_trees_bits(c, bb, tb, z)14351435-uIntf *c; /* 19 code lengths */14361436-uIntf *bb; /* bits tree desired/actual depth */14371437-inflate_huft * FAR *tb; /* bits tree result */14381438-z_stream *z; /* for zfree function */14391439-{14401440- int r;14411441-14421442- r = huft_build(c, 19, 19, (uIntf*)Z_NULL, (uIntf*)Z_NULL, tb, bb, z);14431443- if (r == Z_DATA_ERROR)14441444- z->msg = "oversubscribed dynamic bit lengths tree";14451445- else if (r == Z_BUF_ERROR)14461446- {14471447- inflate_trees_free(*tb, z);14481448- z->msg = "incomplete dynamic bit lengths tree";14491449- r = Z_DATA_ERROR;14501450- }14511451- return r;14521452-}14531453-14541454-14551455-local int inflate_trees_dynamic(nl, nd, c, bl, bd, tl, td, z)14561456-uInt nl; /* number of literal/length codes */14571457-uInt nd; /* number of distance codes */14581458-uIntf *c; /* that many (total) code lengths */14591459-uIntf *bl; /* literal desired/actual bit depth */14601460-uIntf *bd; /* distance desired/actual bit depth */14611461-inflate_huft * FAR *tl; /* literal/length tree result */14621462-inflate_huft * FAR *td; /* distance tree result */14631463-z_stream *z; /* for zfree function */14641464-{14651465- int r;14661466-14671467- /* build literal/length tree */14681468- if ((r = huft_build(c, nl, 257, cplens, cplext, tl, bl, z)) != Z_OK)14691469- {14701470- if (r == Z_DATA_ERROR)14711471- z->msg = "oversubscribed literal/length tree";14721472- else if (r == Z_BUF_ERROR)14731473- {14741474- inflate_trees_free(*tl, z);14751475- z->msg = "incomplete literal/length tree";14761476- r = Z_DATA_ERROR;14771477- }14781478- return r;14791479- }14801480-14811481- /* build distance tree */14821482- if ((r = huft_build(c + nl, nd, 0, cpdist, cpdext, td, bd, z)) != Z_OK)14831483- {14841484- if (r == Z_DATA_ERROR)14851485- z->msg = "oversubscribed literal/length tree";14861486- else if (r == Z_BUF_ERROR) {14871487-#ifdef PKZIP_BUG_WORKAROUND14881488- r = Z_OK;14891489- }14901490-#else14911491- inflate_trees_free(*td, z);14921492- z->msg = "incomplete literal/length tree";14931493- r = Z_DATA_ERROR;14941494- }14951495- inflate_trees_free(*tl, z);14961496- return r;14971497-#endif14981498- }14991499-15001500- /* done */15011501- return Z_OK;15021502-}15031503-15041504-15051505-/* build fixed tables only once--keep them here */15061506-local int fixed_lock = 0;15071507-local int fixed_built = 0;15081508-#define FIXEDH 530 /* number of hufts used by fixed tables */15091509-local uInt fixed_left = FIXEDH;15101510-local inflate_huft fixed_mem[FIXEDH];15111511-local uInt fixed_bl;15121512-local uInt fixed_bd;15131513-local inflate_huft *fixed_tl;15141514-local inflate_huft *fixed_td;15151515-15161516-15171517-local voidpf falloc(q, n, s)15181518-voidpf q; /* opaque pointer (not used) */15191519-uInt n; /* number of items */15201520-uInt s; /* size of item */15211521-{15221522- Assert(s == sizeof(inflate_huft) && n <= fixed_left,15231523- "inflate_trees falloc overflow");15241524- if (q) s++; /* to make some compilers happy */15251525- fixed_left -= n;15261526- return (voidpf)(fixed_mem + fixed_left);15271527-}15281528-15291529-15301530-local void ffree(q, p, n)15311531-voidpf q;15321532-voidpf p;15331533-uInt n;15341534-{15351535- Assert(0, "inflate_trees ffree called!");15361536- if (q) q = p; /* to make some compilers happy */15371537-}15381538-15391539-15401540-local int inflate_trees_fixed(bl, bd, tl, td)15411541-uIntf *bl; /* literal desired/actual bit depth */15421542-uIntf *bd; /* distance desired/actual bit depth */15431543-inflate_huft * FAR *tl; /* literal/length tree result */15441544-inflate_huft * FAR *td; /* distance tree result */15451545-{15461546- /* build fixed tables if not built already--lock out other instances */15471547- while (++fixed_lock > 1)15481548- fixed_lock--;15491549- if (!fixed_built)15501550- {15511551- int k; /* temporary variable */15521552- unsigned c[288]; /* length list for huft_build */15531553- z_stream z; /* for falloc function */15541554-15551555- /* set up fake z_stream for memory routines */15561556- z.zalloc = falloc;15571557- z.zfree = ffree;15581558- z.opaque = Z_NULL;15591559-15601560- /* literal table */15611561- for (k = 0; k < 144; k++)15621562- c[k] = 8;15631563- for (; k < 256; k++)15641564- c[k] = 9;15651565- for (; k < 280; k++)15661566- c[k] = 7;15671567- for (; k < 288; k++)15681568- c[k] = 8;15691569- fixed_bl = 7;15701570- huft_build(c, 288, 257, cplens, cplext, &fixed_tl, &fixed_bl, &z);15711571-15721572- /* distance table */15731573- for (k = 0; k < 30; k++)15741574- c[k] = 5;15751575- fixed_bd = 5;15761576- huft_build(c, 30, 0, cpdist, cpdext, &fixed_td, &fixed_bd, &z);15771577-15781578- /* done */15791579- fixed_built = 1;15801580- }15811581- fixed_lock--;15821582- *bl = fixed_bl;15831583- *bd = fixed_bd;15841584- *tl = fixed_tl;15851585- *td = fixed_td;15861586- return Z_OK;15871587-}15881588-15891589-15901590-local int inflate_trees_free(t, z)15911591-inflate_huft *t; /* table to free */15921592-z_stream *z; /* for zfree function */15931593-/* Free the malloc'ed tables built by huft_build(), which makes a linked15941594- list of the tables it made, with the links in a dummy first entry of15951595- each table. */15961596-{15971597- register inflate_huft *p, *q;15981598-15991599- /* Go through linked list, freeing from the malloced (t[-1]) address. */16001600- p = t;16011601- while (p != Z_NULL)16021602- {16031603- q = (--p)->next;16041604- ZFREE(z, p, p->word.Nalloc * sizeof(inflate_huft));16051605- p = q;16061606- }16071607- return Z_OK;16081608-}16091609-16101610-/*+++++*/16111611-/* infcodes.c -- process literals and length/distance pairs16121612- * Copyright (C) 1995 Mark Adler16131613- * For conditions of distribution and use, see copyright notice in zlib.h16141614- */16151615-16161616-/* simplify the use of the inflate_huft type with some defines */16171617-#define base more.Base16181618-#define next more.Next16191619-#define exop word.what.Exop16201620-#define bits word.what.Bits16211621-16221622-/* inflate codes private state */16231623-struct inflate_codes_state {16241624-16251625- /* mode */16261626- enum { /* waiting for "i:"=input, "o:"=output, "x:"=nothing */16271627- START, /* x: set up for LEN */16281628- LEN, /* i: get length/literal/eob next */16291629- LENEXT, /* i: getting length extra (have base) */16301630- DIST, /* i: get distance next */16311631- DISTEXT, /* i: getting distance extra */16321632- COPY, /* o: copying bytes in window, waiting for space */16331633- LIT, /* o: got literal, waiting for output space */16341634- WASH, /* o: got eob, possibly still output waiting */16351635- END, /* x: got eob and all data flushed */16361636- BADCODE} /* x: got error */16371637- mode; /* current inflate_codes mode */16381638-16391639- /* mode dependent information */16401640- uInt len;16411641- union {16421642- struct {16431643- inflate_huft *tree; /* pointer into tree */16441644- uInt need; /* bits needed */16451645- } code; /* if LEN or DIST, where in tree */16461646- uInt lit; /* if LIT, literal */16471647- struct {16481648- uInt get; /* bits to get for extra */16491649- uInt dist; /* distance back to copy from */16501650- } copy; /* if EXT or COPY, where and how much */16511651- } sub; /* submode */16521652-16531653- /* mode independent information */16541654- Byte lbits; /* ltree bits decoded per branch */16551655- Byte dbits; /* dtree bits decoder per branch */16561656- inflate_huft *ltree; /* literal/length/eob tree */16571657- inflate_huft *dtree; /* distance tree */16581658-16591659-};16601660-16611661-16621662-local inflate_codes_statef *inflate_codes_new(bl, bd, tl, td, z)16631663-uInt bl, bd;16641664-inflate_huft *tl, *td;16651665-z_stream *z;16661666-{16671667- inflate_codes_statef *c;16681668-16691669- if ((c = (inflate_codes_statef *)16701670- ZALLOC(z,1,sizeof(struct inflate_codes_state))) != Z_NULL)16711671- {16721672- c->mode = START;16731673- c->lbits = (Byte)bl;16741674- c->dbits = (Byte)bd;16751675- c->ltree = tl;16761676- c->dtree = td;16771677- Tracev((stderr, "inflate: codes new\n"));16781678- }16791679- return c;16801680-}16811681-16821682-16831683-local int inflate_codes(s, z, r)16841684-inflate_blocks_statef *s;16851685-z_stream *z;16861686-int r;16871687-{16881688- uInt j; /* temporary storage */16891689- inflate_huft *t; /* temporary pointer */16901690- uInt e; /* extra bits or operation */16911691- uLong b; /* bit buffer */16921692- uInt k; /* bits in bit buffer */16931693- Bytef *p; /* input data pointer */16941694- uInt n; /* bytes available there */16951695- Bytef *q; /* output window write pointer */16961696- uInt m; /* bytes to end of window or read pointer */16971697- Bytef *f; /* pointer to copy strings from */16981698- inflate_codes_statef *c = s->sub.decode.codes; /* codes state */16991699-17001700- /* copy input/output information to locals (UPDATE macro restores) */17011701- LOAD17021702-17031703- /* process input and output based on current state */17041704- while (1) switch (c->mode)17051705- { /* waiting for "i:"=input, "o:"=output, "x:"=nothing */17061706- case START: /* x: set up for LEN */17071707-#ifndef SLOW17081708- if (m >= 258 && n >= 10)17091709- {17101710- UPDATE17111711- r = inflate_fast(c->lbits, c->dbits, c->ltree, c->dtree, s, z);17121712- LOAD17131713- if (r != Z_OK)17141714- {17151715- c->mode = r == Z_STREAM_END ? WASH : BADCODE;17161716- break;17171717- }17181718- }17191719-#endif /* !SLOW */17201720- c->sub.code.need = c->lbits;17211721- c->sub.code.tree = c->ltree;17221722- c->mode = LEN;17231723- case LEN: /* i: get length/literal/eob next */17241724- j = c->sub.code.need;17251725- NEEDBITS(j)17261726- t = c->sub.code.tree + ((uInt)b & inflate_mask[j]);17271727- DUMPBITS(t->bits)17281728- e = (uInt)(t->exop);17291729- if (e == 0) /* literal */17301730- {17311731- c->sub.lit = t->base;17321732- Tracevv((stderr, t->base >= 0x20 && t->base < 0x7f ?17331733- "inflate: literal '%c'\n" :17341734- "inflate: literal 0x%02x\n", t->base));17351735- c->mode = LIT;17361736- break;17371737- }17381738- if (e & 16) /* length */17391739- {17401740- c->sub.copy.get = e & 15;17411741- c->len = t->base;17421742- c->mode = LENEXT;17431743- break;17441744- }17451745- if ((e & 64) == 0) /* next table */17461746- {17471747- c->sub.code.need = e;17481748- c->sub.code.tree = t->next;17491749- break;17501750- }17511751- if (e & 32) /* end of block */17521752- {17531753- Tracevv((stderr, "inflate: end of block\n"));17541754- c->mode = WASH;17551755- break;17561756- }17571757- c->mode = BADCODE; /* invalid code */17581758- z->msg = "invalid literal/length code";17591759- r = Z_DATA_ERROR;17601760- LEAVE17611761- case LENEXT: /* i: getting length extra (have base) */17621762- j = c->sub.copy.get;17631763- NEEDBITS(j)17641764- c->len += (uInt)b & inflate_mask[j];17651765- DUMPBITS(j)17661766- c->sub.code.need = c->dbits;17671767- c->sub.code.tree = c->dtree;17681768- Tracevv((stderr, "inflate: length %u\n", c->len));17691769- c->mode = DIST;17701770- case DIST: /* i: get distance next */17711771- j = c->sub.code.need;17721772- NEEDBITS(j)17731773- t = c->sub.code.tree + ((uInt)b & inflate_mask[j]);17741774- DUMPBITS(t->bits)17751775- e = (uInt)(t->exop);17761776- if (e & 16) /* distance */17771777- {17781778- c->sub.copy.get = e & 15;17791779- c->sub.copy.dist = t->base;17801780- c->mode = DISTEXT;17811781- break;17821782- }17831783- if ((e & 64) == 0) /* next table */17841784- {17851785- c->sub.code.need = e;17861786- c->sub.code.tree = t->next;17871787- break;17881788- }17891789- c->mode = BADCODE; /* invalid code */17901790- z->msg = "invalid distance code";17911791- r = Z_DATA_ERROR;17921792- LEAVE17931793- case DISTEXT: /* i: getting distance extra */17941794- j = c->sub.copy.get;17951795- NEEDBITS(j)17961796- c->sub.copy.dist += (uInt)b & inflate_mask[j];17971797- DUMPBITS(j)17981798- Tracevv((stderr, "inflate: distance %u\n", c->sub.copy.dist));17991799- c->mode = COPY;18001800- case COPY: /* o: copying bytes in window, waiting for space */18011801-#ifndef __TURBOC__ /* Turbo C bug for following expression */18021802- f = (uInt)(q - s->window) < c->sub.copy.dist ?18031803- s->end - (c->sub.copy.dist - (q - s->window)) :18041804- q - c->sub.copy.dist;18051805-#else18061806- f = q - c->sub.copy.dist;18071807- if ((uInt)(q - s->window) < c->sub.copy.dist)18081808- f = s->end - (c->sub.copy.dist - (q - s->window));18091809-#endif18101810- while (c->len)18111811- {18121812- NEEDOUT18131813- OUTBYTE(*f++)18141814- if (f == s->end)18151815- f = s->window;18161816- c->len--;18171817- }18181818- c->mode = START;18191819- break;18201820- case LIT: /* o: got literal, waiting for output space */18211821- NEEDOUT18221822- OUTBYTE(c->sub.lit)18231823- c->mode = START;18241824- break;18251825- case WASH: /* o: got eob, possibly more output */18261826- FLUSH18271827- if (s->read != s->write)18281828- LEAVE18291829- c->mode = END;18301830- case END:18311831- r = Z_STREAM_END;18321832- LEAVE18331833- case BADCODE: /* x: got error */18341834- r = Z_DATA_ERROR;18351835- LEAVE18361836- default:18371837- r = Z_STREAM_ERROR;18381838- LEAVE18391839- }18401840-}18411841-18421842-18431843-local void inflate_codes_free(c, z)18441844-inflate_codes_statef *c;18451845-z_stream *z;18461846-{18471847- ZFREE(z, c, sizeof(struct inflate_codes_state));18481848- Tracev((stderr, "inflate: codes free\n"));18491849-}18501850-18511851-/*+++++*/18521852-/* inflate_util.c -- data and routines common to blocks and codes18531853- * Copyright (C) 1995 Mark Adler18541854- * For conditions of distribution and use, see copyright notice in zlib.h18551855- */18561856-18571857-/* copy as much as possible from the sliding window to the output area */18581858-local int inflate_flush(s, z, r)18591859-inflate_blocks_statef *s;18601860-z_stream *z;18611861-int r;18621862-{18631863- uInt n;18641864- Bytef *p, *q;18651865-18661866- /* local copies of source and destination pointers */18671867- p = z->next_out;18681868- q = s->read;18691869-18701870- /* compute number of bytes to copy as far as end of window */18711871- n = (uInt)((q <= s->write ? s->write : s->end) - q);18721872- if (n > z->avail_out) n = z->avail_out;18731873- if (n && r == Z_BUF_ERROR) r = Z_OK;18741874-18751875- /* update counters */18761876- z->avail_out -= n;18771877- z->total_out += n;18781878-18791879- /* update check information */18801880- if (s->checkfn != Z_NULL)18811881- s->check = (*s->checkfn)(s->check, q, n);18821882-18831883- /* copy as far as end of window */18841884- zmemcpy(p, q, n);18851885- p += n;18861886- q += n;18871887-18881888- /* see if more to copy at beginning of window */18891889- if (q == s->end)18901890- {18911891- /* wrap pointers */18921892- q = s->window;18931893- if (s->write == s->end)18941894- s->write = s->window;18951895-18961896- /* compute bytes to copy */18971897- n = (uInt)(s->write - q);18981898- if (n > z->avail_out) n = z->avail_out;18991899- if (n && r == Z_BUF_ERROR) r = Z_OK;19001900-19011901- /* update counters */19021902- z->avail_out -= n;19031903- z->total_out += n;19041904-19051905- /* update check information */19061906- if (s->checkfn != Z_NULL)19071907- s->check = (*s->checkfn)(s->check, q, n);19081908-19091909- /* copy */19101910- zmemcpy(p, q, n);19111911- p += n;19121912- q += n;19131913- }19141914-19151915- /* update pointers */19161916- z->next_out = p;19171917- s->read = q;19181918-19191919- /* done */19201920- return r;19211921-}19221922-19231923-19241924-/*+++++*/19251925-/* inffast.c -- process literals and length/distance pairs fast19261926- * Copyright (C) 1995 Mark Adler19271927- * For conditions of distribution and use, see copyright notice in zlib.h19281928- */19291929-19301930-/* simplify the use of the inflate_huft type with some defines */19311931-#define base more.Base19321932-#define next more.Next19331933-#define exop word.what.Exop19341934-#define bits word.what.Bits19351935-19361936-/* macros for bit input with no checking and for returning unused bytes */19371937-#define GRABBITS(j) {while(k<(j)){b|=((uLong)NEXTBYTE)<<k;k+=8;}}19381938-#define UNGRAB {n+=(c=k>>3);p-=c;k&=7;}19391939-19401940-/* Called with number of bytes left to write in window at least 25819411941- (the maximum string length) and number of input bytes available19421942- at least ten. The ten bytes are six bytes for the longest length/19431943- distance pair plus four bytes for overloading the bit buffer. */19441944-19451945-local int inflate_fast(bl, bd, tl, td, s, z)19461946-uInt bl, bd;19471947-inflate_huft *tl, *td;19481948-inflate_blocks_statef *s;19491949-z_stream *z;19501950-{19511951- inflate_huft *t; /* temporary pointer */19521952- uInt e; /* extra bits or operation */19531953- uLong b; /* bit buffer */19541954- uInt k; /* bits in bit buffer */19551955- Bytef *p; /* input data pointer */19561956- uInt n; /* bytes available there */19571957- Bytef *q; /* output window write pointer */19581958- uInt m; /* bytes to end of window or read pointer */19591959- uInt ml; /* mask for literal/length tree */19601960- uInt md; /* mask for distance tree */19611961- uInt c; /* bytes to copy */19621962- uInt d; /* distance back to copy from */19631963- Bytef *r; /* copy source pointer */19641964-19651965- /* load input, output, bit values */19661966- LOAD19671967-19681968- /* initialize masks */19691969- ml = inflate_mask[bl];19701970- md = inflate_mask[bd];19711971-19721972- /* do until not enough input or output space for fast loop */19731973- do { /* assume called with m >= 258 && n >= 10 */19741974- /* get literal/length code */19751975- GRABBITS(20) /* max bits for literal/length code */19761976- if ((e = (t = tl + ((uInt)b & ml))->exop) == 0)19771977- {19781978- DUMPBITS(t->bits)19791979- Tracevv((stderr, t->base >= 0x20 && t->base < 0x7f ?19801980- "inflate: * literal '%c'\n" :19811981- "inflate: * literal 0x%02x\n", t->base));19821982- *q++ = (Byte)t->base;19831983- m--;19841984- continue;19851985- }19861986- do {19871987- DUMPBITS(t->bits)19881988- if (e & 16)19891989- {19901990- /* get extra bits for length */19911991- e &= 15;19921992- c = t->base + ((uInt)b & inflate_mask[e]);19931993- DUMPBITS(e)19941994- Tracevv((stderr, "inflate: * length %u\n", c));19951995-19961996- /* decode distance base of block to copy */19971997- GRABBITS(15); /* max bits for distance code */19981998- e = (t = td + ((uInt)b & md))->exop;19991999- do {20002000- DUMPBITS(t->bits)20012001- if (e & 16)20022002- {20032003- /* get extra bits to add to distance base */20042004- e &= 15;20052005- GRABBITS(e) /* get extra bits (up to 13) */20062006- d = t->base + ((uInt)b & inflate_mask[e]);20072007- DUMPBITS(e)20082008- Tracevv((stderr, "inflate: * distance %u\n", d));20092009-20102010- /* do the copy */20112011- m -= c;20122012- if ((uInt)(q - s->window) >= d) /* offset before dest */20132013- { /* just copy */20142014- r = q - d;20152015- *q++ = *r++; c--; /* minimum count is three, */20162016- *q++ = *r++; c--; /* so unroll loop a little */20172017- }20182018- else /* else offset after destination */20192019- {20202020- e = d - (q - s->window); /* bytes from offset to end */20212021- r = s->end - e; /* pointer to offset */20222022- if (c > e) /* if source crosses, */20232023- {20242024- c -= e; /* copy to end of window */20252025- do {20262026- *q++ = *r++;20272027- } while (--e);20282028- r = s->window; /* copy rest from start of window */20292029- }20302030- }20312031- do { /* copy all or what's left */20322032- *q++ = *r++;20332033- } while (--c);20342034- break;20352035- }20362036- else if ((e & 64) == 0)20372037- e = (t = t->next + ((uInt)b & inflate_mask[e]))->exop;20382038- else20392039- {20402040- z->msg = "invalid distance code";20412041- UNGRAB20422042- UPDATE20432043- return Z_DATA_ERROR;20442044- }20452045- } while (1);20462046- break;20472047- }20482048- if ((e & 64) == 0)20492049- {20502050- if ((e = (t = t->next + ((uInt)b & inflate_mask[e]))->exop) == 0)20512051- {20522052- DUMPBITS(t->bits)20532053- Tracevv((stderr, t->base >= 0x20 && t->base < 0x7f ?20542054- "inflate: * literal '%c'\n" :20552055- "inflate: * literal 0x%02x\n", t->base));20562056- *q++ = (Byte)t->base;20572057- m--;20582058- break;20592059- }20602060- }20612061- else if (e & 32)20622062- {20632063- Tracevv((stderr, "inflate: * end of block\n"));20642064- UNGRAB20652065- UPDATE20662066- return Z_STREAM_END;20672067- }20682068- else20692069- {20702070- z->msg = "invalid literal/length code";20712071- UNGRAB20722072- UPDATE20732073- return Z_DATA_ERROR;20742074- }20752075- } while (1);20762076- } while (m >= 258 && n >= 10);20772077-20782078- /* not enough input or output--restore pointers and return */20792079- UNGRAB20802080- UPDATE20812081- return Z_OK;20822082-}20832083-20842084-20852085-/*+++++*/20862086-/* zutil.c -- target dependent utility functions for the compression library20872087- * Copyright (C) 1995 Jean-loup Gailly.20882088- * For conditions of distribution and use, see copyright notice in zlib.h20892089- */20902090-20912091-/* From: zutil.c,v 1.8 1995/05/03 17:27:12 jloup Exp */20922092-20932093-char *zlib_version = ZLIB_VERSION;20942094-20952095-char *z_errmsg[] = {20962096-"stream end", /* Z_STREAM_END 1 */20972097-"", /* Z_OK 0 */20982098-"file error", /* Z_ERRNO (-1) */20992099-"stream error", /* Z_STREAM_ERROR (-2) */21002100-"data error", /* Z_DATA_ERROR (-3) */21012101-"insufficient memory", /* Z_MEM_ERROR (-4) */21022102-"buffer error", /* Z_BUF_ERROR (-5) */21032103-""};21042104-21052105-21062106-/*+++++*/21072107-/* adler32.c -- compute the Adler-32 checksum of a data stream21082108- * Copyright (C) 1995 Mark Adler21092109- * For conditions of distribution and use, see copyright notice in zlib.h21102110- */21112111-21122112-/* From: adler32.c,v 1.6 1995/05/03 17:27:08 jloup Exp */21132113-21142114-#define BASE 65521L /* largest prime smaller than 65536 */21152115-#define NMAX 555221162116-/* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */21172117-21182118-#define DO1(buf) {s1 += *buf++; s2 += s1;}21192119-#define DO2(buf) DO1(buf); DO1(buf);21202120-#define DO4(buf) DO2(buf); DO2(buf);21212121-#define DO8(buf) DO4(buf); DO4(buf);21222122-#define DO16(buf) DO8(buf); DO8(buf);21232123-21242124-/* ========================================================================= */21252125-uLong adler32(adler, buf, len)21262126- uLong adler;21272127- Bytef *buf;21282128- uInt len;21292129-{21302130- unsigned long s1 = adler & 0xffff;21312131- unsigned long s2 = (adler >> 16) & 0xffff;21322132- int k;21332133-21342134- if (buf == Z_NULL) return 1L;21352135-21362136- while (len > 0) {21372137- k = len < NMAX ? len : NMAX;21382138- len -= k;21392139- while (k >= 16) {21402140- DO16(buf);21412141- k -= 16;21422142- }21432143- if (k != 0) do {21442144- DO1(buf);21452145- } while (--k);21462146- s1 %= BASE;21472147- s2 %= BASE;21482148- }21492149- return (s2 << 16) | s1;21502150-}
+6-14
arch/xtensa/boot/lib/zmem.c
···11-#include "zlib.h"11+#include <linux/zlib.h>2233/* bits taken from ppc */44···99 for (;;);1010}11111212-void *zalloc(void *x, unsigned items, unsigned size)1212+void *zalloc(unsigned size)1313{1414 void *p = avail_ram;15151616- size *= items;1716 size = (size + 7) & -8;1817 avail_ram += size;1918 if (avail_ram > end_avail) {···2223 }2324 return p;2425}2525-2626-void zfree(void *x, void *addr, unsigned nb)2727-{2828-}2929-30263127#define HEAD_CRC 23228#define EXTRA_FIELD 4···3743 int r, i, flags;38443945 /* skip header */4040-4146 i = 10;4247 flags = src[3];4348 if (src[2] != DEFLATED || (flags & RESERVED) != 0) {···5865 exit();5966 }60676161- s.zalloc = zalloc;6262- s.zfree = zfree;6363- r = inflateInit2(&s, -MAX_WBITS);6868+ s.workspace = zalloc(zlib_inflate_workspacesize());6969+ r = zlib_inflateInit2(&s, -MAX_WBITS);6470 if (r != Z_OK) {6571 //puts("inflateInit2 returned "); puthex(r); puts("\n");6672 exit();···6876 s.avail_in = *lenp - i;6977 s.next_out = dst;7078 s.avail_out = dstlen;7171- r = inflate(&s, Z_FINISH);7979+ r = zlib_inflate(&s, Z_FINISH);7280 if (r != Z_OK && r != Z_STREAM_END) {7381 //puts("inflate returned "); puthex(r); puts("\n");7482 exit();7583 }7684 *lenp = s.next_out - (unsigned char *) dst;7777- inflateEnd(&s);8585+ zlib_inflateEnd(&s);7886}7987
+5-90
arch/xtensa/kernel/pci.c
···57575858static int pci_bus_count;59596060-static void pcibios_fixup_resources(struct pci_dev* dev);6161-6262-#if 0 // FIXME6363-struct pci_fixup pcibios_fixups[] = {6464- { DECLARE_PCI_FIXUP_HEADER, PCI_ANY_ID, PCI_ANY_ID, pcibios_fixup_resources },6565- { 0 }6666-};6767-#endif6868-6969-void7070-pcibios_update_resource(struct pci_dev *dev, struct resource *root,7171- struct resource *res, int resource)7272-{7373- u32 new, check, mask;7474- int reg;7575- struct pci_controller* pci_ctrl = dev->sysdata;7676-7777- new = res->start;7878- if (pci_ctrl && res->flags & IORESOURCE_IO) {7979- new -= pci_ctrl->io_space.base;8080- }8181- new |= (res->flags & PCI_REGION_FLAG_MASK);8282- if (resource < 6) {8383- reg = PCI_BASE_ADDRESS_0 + 4*resource;8484- } else if (resource == PCI_ROM_RESOURCE) {8585- res->flags |= PCI_ROM_ADDRESS_ENABLE;8686- reg = dev->rom_base_reg;8787- } else {8888- /* Somebody might have asked allocation of a non-standard resource */8989- return;9090- }9191-9292- pci_write_config_dword(dev, reg, new);9393- pci_read_config_dword(dev, reg, &check);9494- mask = (new & PCI_BASE_ADDRESS_SPACE_IO) ?9595- PCI_BASE_ADDRESS_IO_MASK : PCI_BASE_ADDRESS_MEM_MASK;9696-9797- if ((new ^ check) & mask) {9898- printk(KERN_ERR "PCI: Error while updating region "9999- "%s/%d (%08x != %08x)\n", dev->slot_name, resource,100100- new, check);101101- }102102-}103103-10460/*10561 * We need to avoid collisions with `mirrored' VGA ports10662 * and other strange ISA hardware, so we always want the···8112582126 if (size > 0x100) {83127 printk(KERN_ERR "PCI: I/O Region %s/%d too large"8484- " (%ld bytes)\n", dev->slot_name,128128+ " (%ld bytes)\n", pci_name(dev),85129 dev->resource - res, size);86130 }87131···105149 r = &dev->resource[idx];106150 if (!r->start && r->end) {107151 printk (KERN_ERR "PCI: Device %s not available because "108108- "of resource collisions\n", dev->slot_name);152152+ "of resource collisions\n", pci_name(dev));109153 return -EINVAL;110154 }111155 if (r->flags & IORESOURCE_IO)···117161 cmd |= PCI_COMMAND_MEMORY;118162 if (cmd != old_cmd) {119163 printk("PCI: Enabling device %s (%04x -> %04x)\n",120120- dev->slot_name, old_cmd, cmd);164164+ pci_name(dev), old_cmd, cmd);121165 pci_write_config_word(dev, PCI_COMMAND, cmd);122166 }123167 return 0;···249293 r = &dev->resource[idx];250294 if (!r->start && r->end) {251295 printk(KERN_ERR "PCI: Device %s not available because "252252- "of resource collisions\n", dev->slot_name);296296+ "of resource collisions\n", pci_name(dev));253297 return -EINVAL;254298 }255299 if (r->flags & IORESOURCE_IO)···259303 }260304 if (cmd != old_cmd) {261305 printk("PCI: Enabling device %s (%04x -> %04x)\n",262262- dev->slot_name, old_cmd, cmd);306306+ pci_name(dev), old_cmd, cmd);263307 pci_write_config_word(dev, PCI_COMMAND, cmd);264308 }265309···280324}281325282326#endif /* CONFIG_PROC_FS */283283-284284-285285-static void286286-pcibios_fixup_resources(struct pci_dev *dev)287287-{288288- struct pci_controller* pci_ctrl = (struct pci_controller *)dev->sysdata;289289- int i;290290- unsigned long offset;291291-292292- if (!pci_ctrl) {293293- printk(KERN_ERR "No pci_ctrl for PCI dev %s!\n",dev->slot_name);294294- return;295295- }296296- for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {297297- struct resource *res = dev->resource + i;298298- if (!res->start || !res->flags)299299- continue;300300- if (res->end == 0xffffffff) {301301- DBG("PCI:%s Resource %d [%08lx-%08lx] is unassigned\n",302302- dev->slot_name, i, res->start, res->end);303303- res->end -= res->start;304304- res->start = 0;305305- continue;306306- }307307- offset = 0;308308- if (res->flags & IORESOURCE_IO)309309- offset = (unsigned long) pci_ctrl->io_space.base;310310- else if (res->flags & IORESOURCE_MEM)311311- offset = (unsigned long) pci_ctrl->mem_space.base;312312-313313- if (offset != 0) {314314- res->start += offset;315315- res->end += offset;316316-#ifdef DEBUG317317- printk("Fixup res %d (%lx) of dev %s: %lx -> %lx\n",318318- i, res->flags, dev->slot_name,319319- res->start - offset, res->start);320320-#endif321321- }322322- }323323-}324327325328/*326329 * Platform support for /proc/bus/pci/X/Y mmap()s,
+3-2
arch/xtensa/kernel/ptrace.c
···2222#include <linux/smp.h>2323#include <linux/smp_lock.h>2424#include <linux/security.h>2525+#include <linux/signal.h>25262627#include <asm/pgtable.h>2728#include <asm/page.h>···240239 case PTRACE_CONT: /* restart after signal. */241240 {242241 ret = -EIO;243243- if ((unsigned long) data > _NSIG)242242+ if (!valid_signal(data))244243 break;245244 if (request == PTRACE_SYSCALL)246245 set_tsk_thread_flag(child, TIF_SYSCALL_TRACE);···270269271270 case PTRACE_SINGLESTEP:272271 ret = -EIO;273273- if ((unsigned long) data > _NSIG)272272+ if (!valid_signal(data))274273 break;275274 clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);276275 child->ptrace |= PT_SINGLESTEP;
+1-1
drivers/acpi/pci_irq.c
···433433 printk(KERN_WARNING PREFIX "PCI Interrupt %s[%c]: no GSI",434434 pci_name(dev), ('A' + pin));435435 /* Interrupt Line values above 0xF are forbidden */436436- if (dev->irq >= 0 && (dev->irq <= 0xF)) {436436+ if (dev->irq > 0 && (dev->irq <= 0xF)) {437437 printk(" - using IRQ %d\n", dev->irq);438438 acpi_register_gsi(dev->irq, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_LOW);439439 return_VALUE(0);
···133133decl_subsys(bus, &ktype_bus, NULL);134134135135136136+/* Manually detach a device from it's associated driver. */137137+static int driver_helper(struct device *dev, void *data)138138+{139139+ const char *name = data;140140+141141+ if (strcmp(name, dev->bus_id) == 0)142142+ return 1;143143+ return 0;144144+}145145+146146+static ssize_t driver_unbind(struct device_driver *drv,147147+ const char *buf, size_t count)148148+{149149+ struct bus_type *bus = get_bus(drv->bus);150150+ struct device *dev;151151+ int err = -ENODEV;152152+153153+ dev = bus_find_device(bus, NULL, (void *)buf, driver_helper);154154+ if ((dev) &&155155+ (dev->driver == drv)) {156156+ device_release_driver(dev);157157+ err = count;158158+ }159159+ return err;160160+}161161+static DRIVER_ATTR(unbind, S_IWUSR, NULL, driver_unbind);162162+163163+/*164164+ * Manually attach a device to a driver.165165+ * Note: the driver must want to bind to the device,166166+ * it is not possible to override the driver's id table.167167+ */168168+static ssize_t driver_bind(struct device_driver *drv,169169+ const char *buf, size_t count)170170+{171171+ struct bus_type *bus = get_bus(drv->bus);172172+ struct device *dev;173173+ int err = -ENODEV;174174+175175+ dev = bus_find_device(bus, NULL, (void *)buf, driver_helper);176176+ if ((dev) &&177177+ (dev->driver == NULL)) {178178+ down(&dev->sem);179179+ err = driver_probe_device(drv, dev);180180+ up(&dev->sem);181181+ put_device(dev);182182+ }183183+ return err;184184+}185185+static DRIVER_ATTR(bind, S_IWUSR, NULL, driver_bind);186186+187187+136188static struct device * next_device(struct klist_iter * i)137189{138190 struct klist_node * n = klist_next(i);···229177 return error;230178}231179180180+/**181181+ * bus_find_device - device iterator for locating a particular device.182182+ * @bus: bus type183183+ * @start: Device to begin with184184+ * @data: Data to pass to match function185185+ * @match: Callback function to check device186186+ *187187+ * This is similar to the bus_for_each_dev() function above, but it188188+ * returns a reference to a device that is 'found' for later use, as189189+ * determined by the @match callback.190190+ *191191+ * The callback should return 0 if the device doesn't match and non-zero192192+ * if it does. If the callback returns non-zero, this function will193193+ * return to the caller and not iterate over any more devices.194194+ */195195+struct device * bus_find_device(struct bus_type *bus,196196+ struct device *start, void *data,197197+ int (*match)(struct device *, void *))198198+{199199+ struct klist_iter i;200200+ struct device *dev;201201+202202+ if (!bus)203203+ return NULL;204204+205205+ klist_iter_init_node(&bus->klist_devices, &i,206206+ (start ? &start->knode_bus : NULL));207207+ while ((dev = next_device(&i)))208208+ if (match(dev, data) && get_device(dev))209209+ break;210210+ klist_iter_exit(&i);211211+ return dev;212212+}232213233214234215static struct device_driver * next_driver(struct klist_iter * i)···448363 module_add_driver(drv->owner, drv);449364450365 driver_add_attrs(bus, drv);366366+ driver_create_file(drv, &driver_attr_unbind);367367+ driver_create_file(drv, &driver_attr_bind);451368 }452369 return error;453370}···467380void bus_remove_driver(struct device_driver * drv)468381{469382 if (drv->bus) {383383+ driver_remove_file(drv, &driver_attr_bind);384384+ driver_remove_file(drv, &driver_attr_unbind);470385 driver_remove_attrs(drv->bus, drv);471386 klist_remove(&drv->knode_bus);472387 pr_debug("bus %s: remove driver %s\n", drv->bus->name, drv->name);···483394/* Helper for bus_rescan_devices's iter */484395static int bus_rescan_devices_helper(struct device *dev, void *data)485396{486486- int *count = data;487487-488488- if (!dev->driver && (device_attach(dev) > 0))489489- (*count)++;490490-397397+ if (!dev->driver)398398+ device_attach(dev);491399 return 0;492400}493401494494-495402/**496496- * bus_rescan_devices - rescan devices on the bus for possible drivers497497- * @bus: the bus to scan.403403+ * bus_rescan_devices - rescan devices on the bus for possible drivers404404+ * @bus: the bus to scan.498405 *499499- * This function will look for devices on the bus with no driver500500- * attached and rescan it against existing drivers to see if it501501- * matches any. Calls device_attach(). Returns the number of devices502502- * that were sucessfully bound to a driver.406406+ * This function will look for devices on the bus with no driver407407+ * attached and rescan it against existing drivers to see if it matches408408+ * any by calling device_attach() for the unbound devices.503409 */504504-int bus_rescan_devices(struct bus_type * bus)410410+void bus_rescan_devices(struct bus_type * bus)505411{506506- int count = 0;507507-508508- bus_for_each_dev(bus, NULL, &count, bus_rescan_devices_helper);509509-510510- return count;412412+ bus_for_each_dev(bus, NULL, NULL, bus_rescan_devices_helper);511413}512414513415···637557638558639559EXPORT_SYMBOL_GPL(bus_for_each_dev);560560+EXPORT_SYMBOL_GPL(bus_find_device);640561EXPORT_SYMBOL_GPL(bus_for_each_drv);641562642563EXPORT_SYMBOL_GPL(bus_add_device);
+1-1
drivers/base/core.c
···333333 struct device * parent = dev->parent;334334335335 if (parent)336336- klist_remove(&dev->knode_parent);336336+ klist_del(&dev->knode_parent);337337338338 /* Notify the platform of the removal, in case they339339 * need to do anything...
+1-1
drivers/base/dd.c
···6565 *6666 * This function must be called with @dev->sem held.6767 */6868-static int driver_probe_device(struct device_driver * drv, struct device * dev)6868+int driver_probe_device(struct device_driver * drv, struct device * dev)6969{7070 int ret = 0;7171
+35
drivers/base/driver.c
···565657575858/**5959+ * driver_find_device - device iterator for locating a particular device.6060+ * @driver: The device's driver6161+ * @start: Device to begin with6262+ * @data: Data to pass to match function6363+ * @match: Callback function to check device6464+ *6565+ * This is similar to the driver_for_each_device() function above, but6666+ * it returns a reference to a device that is 'found' for later use, as6767+ * determined by the @match callback.6868+ *6969+ * The callback should return 0 if the device doesn't match and non-zero7070+ * if it does. If the callback returns non-zero, this function will7171+ * return to the caller and not iterate over any more devices.7272+ */7373+struct device * driver_find_device(struct device_driver *drv,7474+ struct device * start, void * data,7575+ int (*match)(struct device *, void *))7676+{7777+ struct klist_iter i;7878+ struct device *dev;7979+8080+ if (!drv)8181+ return NULL;8282+8383+ klist_iter_init_node(&drv->klist_devices, &i,8484+ (start ? &start->knode_driver : NULL));8585+ while ((dev = next_device(&i)))8686+ if (match(dev, data) && get_device(dev))8787+ break;8888+ klist_iter_exit(&i);8989+ return dev;9090+}9191+EXPORT_SYMBOL_GPL(driver_find_device);9292+9393+/**5994 * driver_create_file - create sysfs file for driver.6095 * @drv: driver.6196 * @attr: driver attribute descriptor.
···2020# Core IDE code - must come before legacy2121ide-core-$(CONFIG_BLK_DEV_IDEPCI) += setup-pci.o2222ide-core-$(CONFIG_BLK_DEV_IDEDMA) += ide-dma.o2323-ide-core-$(CONFIG_BLK_DEV_IDE_TCQ) += ide-tcq.o2423ide-core-$(CONFIG_PROC_FS) += ide-proc.o2524ide-core-$(CONFIG_BLK_DEV_IDEPNP) += ide-pnp.o2625
···217217 * Initialize the cs5530 bridge for reliable IDE DMA operation.218218 */219219220220-static unsigned int __init init_chipset_cs5530 (struct pci_dev *dev, const char *name)220220+static unsigned int __devinit init_chipset_cs5530 (struct pci_dev *dev, const char *name)221221{222222 struct pci_dev *master_0 = NULL, *cs5530_0 = NULL;223223 unsigned long flags;···308308 * performs channel-specific pre-initialization before drive probing.309309 */310310311311-static void __init init_hwif_cs5530 (ide_hwif_t *hwif)311311+static void __devinit init_hwif_cs5530 (ide_hwif_t *hwif)312312{313313 unsigned long basereg;314314 u32 d0_timings;
+4-4
drivers/ide/pci/cy82c693.c
···391391/*392392 * this function is called during init and is used to setup the cy82c693 chip393393 */394394-static unsigned int __init init_chipset_cy82c693(struct pci_dev *dev, const char *name)394394+static unsigned int __devinit init_chipset_cy82c693(struct pci_dev *dev, const char *name)395395{396396 if (PCI_FUNC(dev->devfn) != 1)397397 return 0;···443443/*444444 * the init function - called for each ide channel once445445 */446446-static void __init init_hwif_cy82c693(ide_hwif_t *hwif)446446+static void __devinit init_hwif_cy82c693(ide_hwif_t *hwif)447447{448448 hwif->autodma = 0;449449···467467 hwif->drives[1].autodma = hwif->autodma;468468}469469470470-static __initdata ide_hwif_t *primary;470470+static __devinitdata ide_hwif_t *primary;471471472472-void __init init_iops_cy82c693(ide_hwif_t *hwif)472472+void __devinit init_iops_cy82c693(ide_hwif_t *hwif)473473{474474 if (PCI_FUNC(hwif->pci_dev->devfn) == 1)475475 primary = hwif;
···326326/*327327 * init_hwif_opti621() is called once for each hwif found at boot.328328 */329329-static void __init init_hwif_opti621 (ide_hwif_t *hwif)329329+static void __devinit init_hwif_opti621 (ide_hwif_t *hwif)330330{331331 hwif->autodma = 0;332332 hwif->drives[0].drive_data = PIO_DONT_KNOW;
+1-1
drivers/ide/pci/sc1200.c
···459459 * This gets invoked by the IDE driver once for each channel,460460 * and performs channel-specific pre-initialization before drive probing.461461 */462462-static void __init init_hwif_sc1200 (ide_hwif_t *hwif)462462+static void __devinit init_hwif_sc1200 (ide_hwif_t *hwif)463463{464464 if (hwif->mate)465465 hwif->serialized = hwif->mate->serialized = 1;
+3-3
drivers/ide/pci/sl82c105.c
···386386 * channel 0 here at least, but channel 1 has to be enabled by387387 * firmware or arch code. We still set both to 16 bits mode.388388 */389389-static unsigned int __init init_chipset_sl82c105(struct pci_dev *dev, const char *msg)389389+static unsigned int __devinit init_chipset_sl82c105(struct pci_dev *dev, const char *msg)390390{391391 u32 val;392392···399399 return dev->irq;400400}401401402402-static void __init init_dma_sl82c105(ide_hwif_t *hwif, unsigned long dma_base)402402+static void __devinit init_dma_sl82c105(ide_hwif_t *hwif, unsigned long dma_base)403403{404404 unsigned int rev;405405 u8 dma_state;···431431 * Initialise the chip432432 */433433434434-static void __init init_hwif_sl82c105(ide_hwif_t *hwif)434434+static void __devinit init_hwif_sl82c105(ide_hwif_t *hwif)435435{436436 struct pci_dev *dev = hwif->pci_dev;437437 u32 val;
···415415 * and initialize its drive independent registers.416416 */417417418418-static unsigned int __init init_chipset_via82cxxx(struct pci_dev *dev, const char *name)418418+static unsigned int __devinit init_chipset_via82cxxx(struct pci_dev *dev, const char *name)419419{420420 struct pci_dev *isa = NULL;421421 u8 t, v;···576576 return 0;577577}578578579579-static void __init init_hwif_via82cxxx(ide_hwif_t *hwif)579579+static void __devinit init_hwif_via82cxxx(ide_hwif_t *hwif)580580{581581 int i;582582
+2-1
drivers/input/gameport/gameport.c
···60606161#if defined(__i386__)62626363+#include <asm/i8253.h>6464+6365#define DELTA(x,y) ((y)-(x)+((y)<(x)?1193182/HZ:0))6466#define GET_TIME(x) do { x = get_time_pit(); } while (0)65676668static unsigned int get_time_pit(void)6769{6868- extern spinlock_t i8253_lock;6970 unsigned long flags;7071 unsigned int count;7172
+3-1
drivers/input/joystick/analog.c
···140140 */141141142142#ifdef __i386__143143+144144+#include <asm/i8253.h>145145+143146#define GET_TIME(x) do { if (cpu_has_tsc) rdtscl(x); else x = get_time_pit(); } while (0)144147#define DELTA(x,y) (cpu_has_tsc ? ((y) - (x)) : ((x) - (y) + ((x) < (y) ? CLOCK_TICK_RATE / HZ : 0)))145148#define TIME_NAME (cpu_has_tsc?"TSC":"PIT")146149static unsigned int get_time_pit(void)147150{148148- extern spinlock_t i8253_lock;149151 unsigned long flags;150152 unsigned int count;151153
+6-3
drivers/mmc/mmci.c
···2020#include <linux/mmc/host.h>2121#include <linux/mmc/protocol.h>22222323+#include <asm/div64.h>2324#include <asm/io.h>2425#include <asm/irq.h>2526#include <asm/scatterlist.h>···7170static void mmci_start_data(struct mmci_host *host, struct mmc_data *data)7271{7372 unsigned int datactrl, timeout, irqmask;7373+ unsigned long long clks;7474 void __iomem *base;75757676 DBG(host, "blksz %04x blks %04x flags %08x\n",···83818482 mmci_init_sg(host, data);85838686- timeout = data->timeout_clks +8787- ((unsigned long long)data->timeout_ns * host->cclk) /8888- 1000000000ULL;8484+ clks = (unsigned long long)data->timeout_ns * host->cclk;8585+ do_div(clks, 1000000000UL);8686+8787+ timeout = data->timeout_clks + (unsigned int)clks;89889089 base = host->base;9190 writel(timeout, base + MMCIDATATIMER);
+48-32
drivers/mmc/wbsd.c
···5454#define DBGF(x...) do { } while (0)5555#endif56565757-#ifdef CONFIG_MMC_DEBUG5858-void DBG_REG(int reg, u8 value)5959-{6060- int i;6161-6262- printk(KERN_DEBUG "wbsd: Register %d: 0x%02X %3d '%c' ",6363- reg, (int)value, (int)value, (value < 0x20)?'.':value);6464-6565- for (i = 7;i >= 0;i--)6666- {6767- if (value & (1 << i))6868- printk("x");6969- else7070- printk(".");7171- }7272-7373- printk("\n");7474-}7575-#else7676-#define DBG_REG(r, v) do {} while (0)7777-#endif7878-7957/*8058 * Device resources8159 */···6991MODULE_DEVICE_TABLE(pnp, pnp_dev_table);70927193#endif /* CONFIG_PNP */9494+9595+static const int config_ports[] = { 0x2E, 0x4E };9696+static const int unlock_codes[] = { 0x83, 0x87 };9797+9898+static const int valid_ids[] = {9999+ 0x7112,100100+ };7210173102#ifdef CONFIG_PNP74103static unsigned int nopnp = 0;···10361051\*****************************************************************************/1037105210381053/*10541054+ * Helper function for card detection10551055+ */10561056+static void wbsd_detect_card(unsigned long data)10571057+{10581058+ struct wbsd_host *host = (struct wbsd_host*)data;10591059+10601060+ BUG_ON(host == NULL);10611061+10621062+ DBG("Executing card detection\n");10631063+10641064+ mmc_detect_change(host->mmc); 10651065+}10661066+10671067+/*10391068 * Tasklets10401069 */10411070···10741075{10751076 struct wbsd_host* host = (struct wbsd_host*)param;10761077 u8 csr;10771077- int change = 0;1078107810791079 spin_lock(&host->lock);10801080···10921094 {10931095 DBG("Card inserted\n");10941096 host->flags |= WBSD_FCARD_PRESENT;10951095- change = 1;10971097+10981098+ /*10991099+ * Delay card detection to allow electrical connections11001100+ * to stabilise.11011101+ */11021102+ mod_timer(&host->timer, jiffies + HZ/2);10961103 }11041104+11051105+ spin_unlock(&host->lock);10971106 }10981107 else if (host->flags & WBSD_FCARD_PRESENT)10991108 {11001109 DBG("Card removed\n");11011110 host->flags &= ~WBSD_FCARD_PRESENT;11021102- change = 1;1103111111041112 if (host->mrq)11051113 {···11161112 host->mrq->cmd->error = MMC_ERR_FAILED;11171113 tasklet_schedule(&host->finish_tasklet);11181114 }11191119- }11201120-11211121- /*11221122- * Unlock first since we might get a call back.11231123- */11241124- spin_unlock(&host->lock);11151115+11161116+ /*11171117+ * Unlock first since we might get a call back.11181118+ */11191119+ spin_unlock(&host->lock);1125112011261126- if (change)11271121 mmc_detect_change(host->mmc);11221122+ }11281123}1129112411301125static void wbsd_tasklet_fifo(unsigned long param)···13281325 spin_lock_init(&host->lock);1329132613301327 /*13281328+ * Set up detection timer13291329+ */13301330+ init_timer(&host->timer);13311331+ host->timer.data = (unsigned long)host;13321332+ host->timer.function = wbsd_detect_card;13331333+13341334+ /*13311335 * Maximum number of segments. Worst case is one sector per segment13321336 * so this will be 64kB/512.13331337 */···13611351static void __devexit wbsd_free_mmc(struct device* dev)13621352{13631353 struct mmc_host* mmc;13541354+ struct wbsd_host* host;1364135513651356 mmc = dev_get_drvdata(dev);13661357 if (!mmc)13671358 return;13591359+13601360+ host = mmc_priv(mmc);13611361+ BUG_ON(host == NULL);13621362+13631363+ del_timer_sync(&host->timer);1368136413691365 mmc_free_host(mmc);13701366
+2-7
drivers/mmc/wbsd.h
···88 * published by the Free Software Foundation.99 */10101111-const int config_ports[] = { 0x2E, 0x4E };1212-const int unlock_codes[] = { 0x83, 0x87 };1313-1414-const int valid_ids[] = {1515- 0x7112,1616- };1717-1811#define LOCK_CODE 0xAA19122013#define WBSD_CONF_SWRST 0x02···180187 struct tasklet_struct timeout_tasklet;181188 struct tasklet_struct finish_tasklet;182189 struct tasklet_struct block_tasklet;190190+191191+ struct timer_list timer; /* Card detection timer */183192};
+2-14
drivers/mtd/afs.c
···219219 */220220 for (idx = off = 0; off < mtd->size; off += mtd->erasesize) {221221 struct image_info_struct iis;222222- u_int iis_ptr, img_ptr, size;222222+ u_int iis_ptr, img_ptr;223223224224 /* Read the footer. */225225 ret = afs_read_footer(mtd, &img_ptr, &iis_ptr, off, mask);···236236 continue;237237238238 strcpy(str, iis.name);239239- size = mtd->erasesize + off - img_ptr;240240-241241- /*242242- * In order to support JFFS2 partitions on this layout,243243- * we must lie to MTD about the real size of JFFS2244244- * partitions; this ensures that the AFS flash footer245245- * won't be erased by JFFS2. Please ensure that your246246- * JFFS2 partitions are given image numbers between247247- * 1000 and 2000 inclusive.248248- */249249- if (iis.imageNumber >= 1000 && iis.imageNumber < 2000)250250- size -= mtd->erasesize;251239252240 parts[idx].name = str;253253- parts[idx].size = size;241241+ parts[idx].size = (iis.length + mtd->erasesize - 1) & ~(mtd->erasesize - 1);254242 parts[idx].offset = img_ptr;255243 parts[idx].mask_flags = 0;256244
···20612061 up->port.ops = &serial8250_pops;20622062 }2063206320642064- for (i = 0, up = serial8250_ports; i < ARRAY_SIZE(old_serial_port);20642064+ for (i = 0, up = serial8250_ports;20652065+ i < ARRAY_SIZE(old_serial_port) && i < UART_NR;20652066 i++, up++) {20662067 up->port.iobase = old_serial_port[i].port;20672068 up->port.irq = irq_canonicalize(old_serial_port[i].irq);
-5
drivers/serial/s3c2410.c
···522522static int s3c24xx_serial_startup(struct uart_port *port)523523{524524 struct s3c24xx_uart_port *ourport = to_ourport(port);525525- unsigned long flags;526525 int ret;527526528527 dbg("s3c24xx_serial_startup: port=%p (%08lx,%p)\n",529528 port->mapbase, port->membase);530530-531531- local_irq_save(flags);532529533530 rx_enabled(port) = 1;534531···560563 /* the port reset code should have done the correct561564 * register setup for the port controls */562565563563- local_irq_restore(flags);564566 return ret;565567566568 err:567569 s3c24xx_serial_shutdown(port);568568- local_irq_restore(flags);569570 return ret;570571}571572
+13-1
drivers/serial/serial_core.c
···18081808 struct termios termios;18091809 int i;1810181018111811+ /*18121812+ * Ensure that the serial console lock is initialised18131813+ * early.18141814+ */18151815+ spin_lock_init(&port->lock);18161816+18111817 memset(&termios, 0, sizeof(struct termios));1812181818131819 termios.c_cflag = CREAD | HUPCL | CLOCAL;···2202219622032197 state->port = port;2204219822052205- spin_lock_init(&port->lock);22062199 port->cons = drv->cons;22072200 port->info = state->info;22012201+22022202+ /*22032203+ * If this port is a console, then the spinlock is already22042204+ * initialised.22052205+ */22062206+ if (!uart_console(port))22072207+ spin_lock_init(&port->lock);2208220822092209 uart_configure_port(drv, state, port);22102210
+1-7
drivers/video/console/fbcon.c
···142142#define CURSOR_DRAW_DELAY (1)143143144144/* # VBL ints between cursor state changes */145145-#define ARM_CURSOR_BLINK_RATE (10)146145#define ATARI_CURSOR_BLINK_RATE (42)147146#define MAC_CURSOR_BLINK_RATE (32)148147#define DEFAULT_CURSOR_BLINK_RATE (20)···287288 release_console_sem();288289}289290290290-#if (defined(__arm__) && defined(IRQ_VSYNCPULSE)) || defined(CONFIG_ATARI) || defined(CONFIG_MAC)291291+#if defined(CONFIG_ATARI) || defined(CONFIG_MAC)291292static int cursor_blink_rate;292293static irqreturn_t fb_vbl_handler(int irq, void *dev_id, struct pt_regs *fp)293294{···877878 }878879#endif /* CONFIG_MAC */879880880880-#if defined(__arm__) && defined(IRQ_VSYNCPULSE)881881- cursor_blink_rate = ARM_CURSOR_BLINK_RATE;882882- irqres = request_irq(IRQ_VSYNCPULSE, fb_vbl_handler, SA_SHIRQ,883883- "framebuffer vbl", info);884884-#endif885881 /* Initialize the work queue. If the driver provides its886882 * own work queue this means it will use something besides 887883 * default timer to flash the cursor. */
+1-1
fs/fat/cache.c
···5656 return 0;5757}58585959-void __exit fat_cache_destroy(void)5959+void fat_cache_destroy(void)6060{6161 if (kmem_cache_destroy(fat_cache_cachep))6262 printk(KERN_INFO "fat_cache: not all structures were freed\n");
+15-6
fs/fat/inode.c
···13271327EXPORT_SYMBOL(fat_fill_super);1328132813291329int __init fat_cache_init(void);13301330-void __exit fat_cache_destroy(void);13301330+void fat_cache_destroy(void);1331133113321332static int __init init_fat_fs(void)13331333{13341334- int ret;13341334+ int err;1335133513361336- ret = fat_cache_init();13371337- if (ret < 0)13381338- return ret;13391339- return fat_init_inodecache();13361336+ err = fat_cache_init();13371337+ if (err)13381338+ return err;13391339+13401340+ err = fat_init_inodecache();13411341+ if (err)13421342+ goto failed;13431343+13441344+ return 0;13451345+13461346+failed:13471347+ fat_cache_destroy();13481348+ return err;13401349}1341135013421351static void __exit exit_fat_fs(void)
-1
fs/freevxfs/vxfs.h
···3737 * superblocks of the Veritas Filesystem.3838 */3939#include <linux/types.h>4040-#include "vxfs_kcompat.h"414042414342/*
+1-1
fs/freevxfs/vxfs_bmap.c
···101101 return 0;102102103103fail_size:104104- printk("vxfs: indirect extent to big!\n");104104+ printk("vxfs: indirect extent too big!\n");105105fail_buf:106106 return 0;107107}
+6-5
fs/freevxfs/vxfs_fshead.c
···7878 struct buffer_head *bp;79798080 bp = vxfs_bread(ip, which);8181- if (buffer_mapped(bp)) {8181+ if (bp) {8282 struct vxfs_fsh *fhp;83838484- if (!(fhp = kmalloc(sizeof(*fhp), SLAB_KERNEL)))8585- return NULL;8484+ if (!(fhp = kmalloc(sizeof(*fhp), GFP_KERNEL)))8585+ goto out;8686 memcpy(fhp, bp->b_data, sizeof(*fhp));87878888- brelse(bp);8888+ put_bh(bp);8989 return (fhp);9090 }9191-9191+out:9292+ brelse(bp);9293 return NULL;9394}9495
-49
fs/freevxfs/vxfs_kcompat.h
···11-#ifndef _VXFS_KCOMPAT_H22-#define _VXFS_KCOMPAT_H33-44-#include <linux/version.h>55-66-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))77-88-#include <linux/blkdev.h>99-1010-typedef long sector_t;1111-1212-/* From include/linux/fs.h (Linux 2.5.2-pre3) */1313-static inline struct buffer_head * sb_bread(struct super_block *sb, int block)1414-{1515- return bread(sb->s_dev, block, sb->s_blocksize);1616-}1717-1818-/* Dito. */1919-static inline void map_bh(struct buffer_head *bh, struct super_block *sb, int block)2020-{2121- bh->b_state |= 1 << BH_Mapped;2222- bh->b_dev = sb->s_dev;2323- bh->b_blocknr = block;2424-}2525-2626-/* From fs/block_dev.c (Linux 2.5.2-pre2) */2727-static inline int sb_set_blocksize(struct super_block *sb, int size)2828-{2929- int bits;3030- if (set_blocksize(sb->s_dev, size) < 0)3131- return 0;3232- sb->s_blocksize = size;3333- for (bits = 9, size >>= 9; size >>= 1; bits++)3434- ;3535- sb->s_blocksize_bits = bits;3636- return sb->s_blocksize;3737-}3838-3939-/* Dito. */4040-static inline int sb_min_blocksize(struct super_block *sb, int size)4141-{4242- int minsize = get_hardsect_size(sb->s_dev);4343- if (size < minsize)4444- size = minsize;4545- return sb_set_blocksize(sb, size);4646-}4747-4848-#endif /* Kernel 2.4 */4949-#endif /* _VXFS_KCOMPAT_H */
···1111#ifndef _XTENSA_ERRNO_H1212#define _XTENSA_ERRNO_H13131414-#define EPERM 1 /* Operation not permitted */1515-#define ENOENT 2 /* No such file or directory */1616-#define ESRCH 3 /* No such process */1717-#define EINTR 4 /* Interrupted system call */1818-#define EIO 5 /* I/O error */1919-#define ENXIO 6 /* No such device or address */2020-#define E2BIG 7 /* Arg list too long */2121-#define ENOEXEC 8 /* Exec format error */2222-#define EBADF 9 /* Bad file number */2323-#define ECHILD 10 /* No child processes */2424-#define EAGAIN 11 /* Try again */2525-#define ENOMEM 12 /* Out of memory */2626-#define EACCES 13 /* Permission denied */2727-#define EFAULT 14 /* Bad address */2828-#define ENOTBLK 15 /* Block device required */2929-#define EBUSY 16 /* Device or resource busy */3030-#define EEXIST 17 /* File exists */3131-#define EXDEV 18 /* Cross-device link */3232-#define ENODEV 19 /* No such device */3333-#define ENOTDIR 20 /* Not a directory */3434-#define EISDIR 21 /* Is a directory */3535-#define EINVAL 22 /* Invalid argument */3636-#define ENFILE 23 /* File table overflow */3737-#define EMFILE 24 /* Too many open files */3838-#define ENOTTY 25 /* Not a typewriter */3939-#define ETXTBSY 26 /* Text file busy */4040-#define EFBIG 27 /* File too large */4141-#define ENOSPC 28 /* No space left on device */4242-#define ESPIPE 29 /* Illegal seek */4343-#define EROFS 30 /* Read-only file system */4444-#define EMLINK 31 /* Too many links */4545-#define EPIPE 32 /* Broken pipe */4646-#define EDOM 33 /* Math argument out of domain of func */4747-#define ERANGE 34 /* Math result not representable */4848-#define EDEADLK 35 /* Resource deadlock would occur */4949-#define ENAMETOOLONG 36 /* File name too long */5050-#define ENOLCK 37 /* No record locks available */5151-#define ENOSYS 38 /* Function not implemented */5252-#define ENOTEMPTY 39 /* Directory not empty */5353-#define ELOOP 40 /* Too many symbolic links encountered */5454-#define EWOULDBLOCK EAGAIN /* Operation would block */5555-#define ENOMSG 42 /* No message of desired type */5656-#define EIDRM 43 /* Identifier removed */5757-#define ECHRNG 44 /* Channel number out of range */5858-#define EL2NSYNC 45 /* Level 2 not synchronized */5959-#define EL3HLT 46 /* Level 3 halted */6060-#define EL3RST 47 /* Level 3 reset */6161-#define ELNRNG 48 /* Link number out of range */6262-#define EUNATCH 49 /* Protocol driver not attached */6363-#define ENOCSI 50 /* No CSI structure available */6464-#define EL2HLT 51 /* Level 2 halted */6565-#define EBADE 52 /* Invalid exchange */6666-#define EBADR 53 /* Invalid request descriptor */6767-#define EXFULL 54 /* Exchange full */6868-#define ENOANO 55 /* No anode */6969-#define EBADRQC 56 /* Invalid request code */7070-#define EBADSLT 57 /* Invalid slot */7171-7272-#define EDEADLOCK EDEADLK7373-7474-#define EBFONT 59 /* Bad font file format */7575-#define ENOSTR 60 /* Device not a stream */7676-#define ENODATA 61 /* No data available */7777-#define ETIME 62 /* Timer expired */7878-#define ENOSR 63 /* Out of streams resources */7979-#define ENONET 64 /* Machine is not on the network */8080-#define ENOPKG 65 /* Package not installed */8181-#define EREMOTE 66 /* Object is remote */8282-#define ENOLINK 67 /* Link has been severed */8383-#define EADV 68 /* Advertise error */8484-#define ESRMNT 69 /* Srmount error */8585-#define ECOMM 70 /* Communication error on send */8686-#define EPROTO 71 /* Protocol error */8787-#define EMULTIHOP 72 /* Multihop attempted */8888-#define EDOTDOT 73 /* RFS specific error */8989-#define EBADMSG 74 /* Not a data message */9090-#define EOVERFLOW 75 /* Value too large for defined data type */9191-#define ENOTUNIQ 76 /* Name not unique on network */9292-#define EBADFD 77 /* File descriptor in bad state */9393-#define EREMCHG 78 /* Remote address changed */9494-#define ELIBACC 79 /* Can not access a needed shared library */9595-#define ELIBBAD 80 /* Accessing a corrupted shared library */9696-#define ELIBSCN 81 /* .lib section in a.out corrupted */9797-#define ELIBMAX 82 /* Attempting to link in too many shared libraries */9898-#define ELIBEXEC 83 /* Cannot exec a shared library directly */9999-#define EILSEQ 84 /* Illegal byte sequence */100100-#define ERESTART 85 /* Interrupted system call should be restarted */101101-#define ESTRPIPE 86 /* Streams pipe error */102102-#define EUSERS 87 /* Too many users */103103-#define ENOTSOCK 88 /* Socket operation on non-socket */104104-#define EDESTADDRREQ 89 /* Destination address required */105105-#define EMSGSIZE 90 /* Message too long */106106-#define EPROTOTYPE 91 /* Protocol wrong type for socket */107107-#define ENOPROTOOPT 92 /* Protocol not available */108108-#define EPROTONOSUPPORT 93 /* Protocol not supported */109109-#define ESOCKTNOSUPPORT 94 /* Socket type not supported */110110-#define EOPNOTSUPP 95 /* Operation not supported on transport endpoint */111111-#define EPFNOSUPPORT 96 /* Protocol family not supported */112112-#define EAFNOSUPPORT 97 /* Address family not supported by protocol */113113-#define EADDRINUSE 98 /* Address already in use */114114-#define EADDRNOTAVAIL 99 /* Cannot assign requested address */115115-#define ENETDOWN 100 /* Network is down */116116-#define ENETUNREACH 101 /* Network is unreachable */117117-#define ENETRESET 102 /* Network dropped connection because of reset */118118-#define ECONNABORTED 103 /* Software caused connection abort */119119-#define ECONNRESET 104 /* Connection reset by peer */120120-#define ENOBUFS 105 /* No buffer space available */121121-#define EISCONN 106 /* Transport endpoint is already connected */122122-#define ENOTCONN 107 /* Transport endpoint is not connected */123123-#define ESHUTDOWN 108 /* Cannot send after transport endpoint shutdown */124124-#define ETOOMANYREFS 109 /* Too many references: cannot splice */125125-#define ETIMEDOUT 110 /* Connection timed out */126126-#define ECONNREFUSED 111 /* Connection refused */127127-#define EHOSTDOWN 112 /* Host is down */128128-#define EHOSTUNREACH 113 /* No route to host */129129-#define EALREADY 114 /* Operation already in progress */130130-#define EINPROGRESS 115 /* Operation now in progress */131131-#define ESTALE 116 /* Stale NFS file handle */132132-#define EUCLEAN 117 /* Structure needs cleaning */133133-#define ENOTNAM 118 /* Not a XENIX named type file */134134-#define ENAVAIL 119 /* No XENIX semaphores available */135135-#define EISNAM 120 /* Is a named type file */136136-#define EREMOTEIO 121 /* Remote I/O error */137137-#define EDQUOT 122 /* Quota exceeded */138138-139139-#define ENOMEDIUM 123 /* No medium found */140140-#define EMEDIUMTYPE 124 /* Wrong medium type */1414+#include <asm-generic/errno.h>1411514216#endif /* _XTENSA_ERRNO_H */